Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Set the cursor icon when the cursor first enters a window #1807

Merged
merged 1 commit into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
12 changes: 6 additions & 6 deletions src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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
Expand Down