mirror of
https://github.com/tauri-apps/winit.git
synced 2026-02-04 02:11:19 +01:00
On Windows, set the cursor icon when the cursor first enters a window (#1807)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user