From b74a2c4063d1e1ec36c02af0a7b7dd0f7357b117 Mon Sep 17 00:00:00 2001 From: Alex Charlton Date: Fri, 22 May 2026 11:05:36 -0700 Subject: [PATCH 1/2] Win: Fix DND Filtering GetMessageW to hwnd precludes getting events from the OLE thread that's handling the DND. --- src/win/window.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/win/window.rs b/src/win/window.rs index f86b1c27..beba9695 100644 --- a/src/win/window.rs +++ b/src/win/window.rs @@ -632,13 +632,13 @@ impl Window<'_> { B: FnOnce(&mut crate::Window) -> H, B: Send + 'static, { - let (_, hwnd) = Self::open(false, null_mut(), options, build); + let (_, _) = Self::open(false, null_mut(), options, build); unsafe { let mut msg: MSG = std::mem::zeroed(); loop { - let status = GetMessageW(&mut msg, hwnd, 0, 0); + let status = GetMessageW(&mut msg, null_mut(), 0, 0); if status == -1 { break; From 7501043aacc2a5e6b3d0b208def0481cb021a4a1 Mon Sep 17 00:00:00 2001 From: Alex Charlton Date: Mon, 25 May 2026 13:38:28 -0700 Subject: [PATCH 2/2] Exit properly --- src/win/window.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/win/window.rs b/src/win/window.rs index beba9695..4ab4f4d4 100644 --- a/src/win/window.rs +++ b/src/win/window.rs @@ -512,7 +512,7 @@ pub(super) struct WindowState { window_class: Cell>, current_size: Cell, current_scale_factor: Cell, - _parent_handle: Option, + _parent_handle: ParentHandle, keyboard_state: RefCell, mouse_button_counter: Cell, mouse_was_outside_window: RefCell, @@ -632,7 +632,7 @@ impl Window<'_> { B: FnOnce(&mut crate::Window) -> H, B: Send + 'static, { - let (_, _) = Self::open(false, null_mut(), options, build); + let (window_handle, _) = Self::open(false, null_mut(), options, build); unsafe { let mut msg: MSG = std::mem::zeroed(); @@ -646,6 +646,10 @@ impl Window<'_> { TranslateMessage(&msg); DispatchMessageW(&msg); + + if !window_handle.is_open() { + break; + } } } } @@ -725,7 +729,6 @@ impl Window<'_> { }); let (parent_handle, window_handle) = ParentHandle::new(hwnd); - let parent_handle = if parented { Some(parent_handle) } else { None }; let window_state = Rc::new(WindowState { hwnd,