windows: Avoid setting the mouse cursor while the window is disabled (#33230)
Don’t set the mouse cursor when the window is disabled, it causes issues with modal dialogs. Release Notes: - N/A
This commit is contained in:
@@ -92,7 +92,7 @@ pub(crate) fn handle_msg(
|
||||
WM_DEADCHAR => handle_dead_char_msg(wparam, state_ptr),
|
||||
WM_IME_STARTCOMPOSITION => handle_ime_position(handle, state_ptr),
|
||||
WM_IME_COMPOSITION => handle_ime_composition(handle, lparam, state_ptr),
|
||||
WM_SETCURSOR => handle_set_cursor(lparam, state_ptr),
|
||||
WM_SETCURSOR => handle_set_cursor(handle, lparam, state_ptr),
|
||||
WM_SETTINGCHANGE => handle_system_settings_changed(handle, lparam, state_ptr),
|
||||
WM_INPUTLANGCHANGE => handle_input_language_changed(lparam, state_ptr),
|
||||
WM_GPUI_CURSOR_STYLE_CHANGED => handle_cursor_changed(lparam, state_ptr),
|
||||
@@ -1108,11 +1108,24 @@ fn handle_cursor_changed(lparam: LPARAM, state_ptr: Rc<WindowsWindowStatePtr>) -
|
||||
Some(0)
|
||||
}
|
||||
|
||||
fn handle_set_cursor(lparam: LPARAM, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
|
||||
if matches!(
|
||||
lparam.loword() as u32,
|
||||
HTLEFT | HTRIGHT | HTTOP | HTTOPLEFT | HTTOPRIGHT | HTBOTTOM | HTBOTTOMLEFT | HTBOTTOMRIGHT
|
||||
) {
|
||||
fn handle_set_cursor(
|
||||
handle: HWND,
|
||||
lparam: LPARAM,
|
||||
state_ptr: Rc<WindowsWindowStatePtr>,
|
||||
) -> Option<isize> {
|
||||
if unsafe { !IsWindowEnabled(handle).as_bool() }
|
||||
|| matches!(
|
||||
lparam.loword() as u32,
|
||||
HTLEFT
|
||||
| HTRIGHT
|
||||
| HTTOP
|
||||
| HTTOPLEFT
|
||||
| HTTOPRIGHT
|
||||
| HTBOTTOM
|
||||
| HTBOTTOMLEFT
|
||||
| HTBOTTOMRIGHT
|
||||
)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
unsafe {
|
||||
|
||||
Reference in New Issue
Block a user