On Windows, set the cursor icon when the cursor first enters a window (#1807)

This commit is contained in:
Markus Røyset 2021-01-05 17:39:13 +01:00 committed by GitHub
parent 38fccebe1f
commit 9d63fc7ca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -1,5 +1,6 @@
# Unreleased
- On Windows, fix bug causing newly created windows to erroneously display the "wait" (spinning) cursor.
- On Windows, change the default window size (1024x768) to match the default on other desktop platforms (800x600).
- On Windows, fix bug causing mouse capture to not be released.
- On Windows, fix fullscreen not preserving minimized/maximized state.

View file

@ -20,7 +20,7 @@ use winapi::shared::basetsd::{DWORD_PTR, UINT_PTR};
use winapi::{
shared::{
minwindef::{BOOL, DWORD, HIWORD, INT, LOWORD, LPARAM, LRESULT, UINT, WPARAM},
minwindef::{BOOL, DWORD, HIWORD, INT, LOWORD, LPARAM, LRESULT, UINT, WORD, WPARAM},
windef::{HWND, POINT, RECT},
windowsx, winerror,
},
@ -1664,11 +1664,11 @@ unsafe fn public_window_callback_inner<T: 'static>(
winuser::WM_SETCURSOR => {
let set_cursor_to = {
let window_state = subclass_input.window_state.lock();
if window_state
.mouse
.cursor_flags()
.contains(CursorFlags::IN_WINDOW)
{
// The return value for the preceding `WM_NCHITTEST` message is conveniently
// provided through the low-order word of lParam. We use that here since
// `WM_MOUSEMOVE` seems to come after `WM_SETCURSOR` for a given cursor movement.
let in_client_area = LOWORD(lparam as DWORD) == winuser::HTCLIENT as WORD;
if in_client_area {
Some(window_state.mouse.cursor)
} else {
None