diff --git a/CHANGELOG.md b/CHANGELOG.md index d6200eaf..43bbc932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ And please only add new entries to the top of this list, right below the `# Unre # Unreleased +- On Windows, fix left mouse button release event not being sent after `Window::drag_window`. - On macOS, run most actions on the main thread, which is strictly more correct, but might make multithreaded applications block slightly more. - On macOS, fix panic when getting current monitor without any monitor attached. - On Windows and MacOS, add API to enable/disable window buttons (close, minimize, ...etc). diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index 15ff475c..18213cf4 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -1006,9 +1006,13 @@ unsafe fn public_window_callback_inner( } WM_EXITSIZEMOVE => { - userdata - .window_state_lock() - .set_window_flags_in_place(|f| f.remove(WindowFlags::MARKER_IN_SIZE_MOVE)); + let mut state = userdata.window_state_lock(); + if state.dragging { + state.dragging = false; + PostMessageW(window, WM_LBUTTONUP, 0, lparam); + } + + state.set_window_flags_in_place(|f| f.remove(WindowFlags::MARKER_IN_SIZE_MOVE)); 0 } diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs index 0706fc83..10522431 100644 --- a/src/platform_impl/windows/window.rs +++ b/src/platform_impl/windows/window.rs @@ -418,6 +418,9 @@ impl Window { y: points.y as i16, }; ReleaseCapture(); + + self.window_state_lock().dragging = true; + PostMessageW( self.hwnd(), WM_NCLBUTTONDOWN, diff --git a/src/platform_impl/windows/window_state.rs b/src/platform_impl/windows/window_state.rs index c5a092ac..cf83ba00 100644 --- a/src/platform_impl/windows/window_state.rs +++ b/src/platform_impl/windows/window_state.rs @@ -52,6 +52,8 @@ pub(crate) struct WindowState { pub is_active: bool, pub is_focused: bool, + pub dragging: bool, + pub skip_taskbar: bool, } @@ -162,6 +164,8 @@ impl WindowState { is_active: false, is_focused: false, + dragging: false, + skip_taskbar: false, } }