Skip to content

Expose window HWND on Windows (mirrors apple_view() on macOS)#603

Open
TheRedDeveloper wants to merge 1 commit intonot-fl3:masterfrom
TheRedDeveloper:hwndexpose
Open

Expose window HWND on Windows (mirrors apple_view() on macOS)#603
TheRedDeveloper wants to merge 1 commit intonot-fl3:masterfrom
TheRedDeveloper:hwndexpose

Conversation

@TheRedDeveloper
Copy link

This adds a window::windows_hwnd() function that returns the main window's HWND as *mut c_void, analogous to the existing window::apple_view() on macOS.

Issue

Downstream crates that integrate with Windows platform APIs (accessibility via UI Automation / AccessKit, drag-and-drop, theming, etc.) need the HWND but currently can't access it since WindowsDisplay.wnd is pub(crate).

Solution

  • windows.rs: Added a static WINDOW_HWND that is set immediately after CreateWindowExW, and a public get_window_hwnd() function.
  • lib.rs: Added window::windows_hwnd() (gated behind #[cfg(target_os = "windows")]).

It's just a new public function I need to implement accessibility features on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant