Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions winit-win32/src/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1118,10 +1118,19 @@ unsafe fn lose_active_focus(window: HWND, userdata: &WindowData) {
/// has to be done manually whenever `parent` receives a `WM_WINDOWPOSCHANGED` that moved it.
unsafe fn reposition_owned_windows(parent: HWND) {
unsafe extern "system" fn enum_proc(hwnd: HWND, lparam: LPARAM) -> BOOL {
use windows_sys::Win32::UI::WindowsAndMessaging::GWL_WNDPROC;

if unsafe { GetWindow(hwnd, GW_OWNER) } != lparam as HWND {
return true.into(); // continue enumeration
}

// Only winit's own windows keep a `WindowData` pointer in `GWL_USERDATA`, so skip any
// owned window that runs a different window procedure (dialogs, tooltips, helpers)
let window_proc = unsafe { util::get_window_long(hwnd, GWL_WNDPROC) };
if window_proc != public_window_callback as *const () as isize {
return true.into(); // continue enumeration
}

let userdata_ptr = unsafe { util::get_window_long(hwnd, GWL_USERDATA) } as *mut WindowData;
if !userdata_ptr.is_null() {
let userdata = unsafe { &*userdata_ptr };
Expand Down
1 change: 1 addition & 0 deletions winit/src/changelog/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ changelog entry.

- On Windows, fix a crash occurring when trying to create a DXGI surface on a window that is both fullscreen and always on top.
- On Wayland, use the touch serial for `Window::drag_window`, `Window::drag_resize_window` and `Window::show_window_menu` when the interaction was started by touch.
- On Windows, fix a crash when moving a window that owns windows not created by winit, such as native dialogs or application helper windows.

### Changed

Expand Down
Loading