On Windows, fix left mouse button release event not being sent after Window::drag_window (#2564)

This commit is contained in:
feelingnothing 2022-12-07 01:18:50 +03:00 committed by GitHub
parent 4ed4e918f3
commit 9f781bc422
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View file

@ -8,6 +8,7 @@ And please only add new entries to the top of this list, right below the `# Unre
# Unreleased # 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, 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 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). - On Windows and MacOS, add API to enable/disable window buttons (close, minimize, ...etc).

View file

@ -1006,9 +1006,13 @@ unsafe fn public_window_callback_inner<T: 'static>(
} }
WM_EXITSIZEMOVE => { WM_EXITSIZEMOVE => {
userdata let mut state = userdata.window_state_lock();
.window_state_lock() if state.dragging {
.set_window_flags_in_place(|f| f.remove(WindowFlags::MARKER_IN_SIZE_MOVE)); state.dragging = false;
PostMessageW(window, WM_LBUTTONUP, 0, lparam);
}
state.set_window_flags_in_place(|f| f.remove(WindowFlags::MARKER_IN_SIZE_MOVE));
0 0
} }

View file

@ -418,6 +418,9 @@ impl Window {
y: points.y as i16, y: points.y as i16,
}; };
ReleaseCapture(); ReleaseCapture();
self.window_state_lock().dragging = true;
PostMessageW( PostMessageW(
self.hwnd(), self.hwnd(),
WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN,

View file

@ -52,6 +52,8 @@ pub(crate) struct WindowState {
pub is_active: bool, pub is_active: bool,
pub is_focused: bool, pub is_focused: bool,
pub dragging: bool,
pub skip_taskbar: bool, pub skip_taskbar: bool,
} }
@ -162,6 +164,8 @@ impl WindowState {
is_active: false, is_active: false,
is_focused: false, is_focused: false,
dragging: false,
skip_taskbar: false, skip_taskbar: false,
} }
} }