mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-10 05:01:31 +11:00
Windows, emit ReceivedCharacter
on system keybinds
Currently needed for downstream users relaying on `ReceivedCharacter` for implementing keybindings.
This commit is contained in:
parent
fafdedfb7d
commit
4d48c76da9
|
@ -8,6 +8,7 @@ And please only add new entries to the top of this list, right below the `# Unre
|
||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- On Windows, emit `ReceivedCharacter` events on system keybindings.
|
||||||
- On Windows, fixed focus event emission on minimize.
|
- On Windows, fixed focus event emission on minimize.
|
||||||
- On MacOS, made `accepts_first_mouse` configurable.
|
- On MacOS, made `accepts_first_mouse` configurable.
|
||||||
- Migrated `WindowBuilderExtUnix::with_resize_increments` to `WindowBuilder`.
|
- Migrated `WindowBuilderExtUnix::with_resize_increments` to `WindowBuilder`.
|
||||||
|
|
|
@ -65,7 +65,7 @@ use windows_sys::Win32::{
|
||||||
WM_MOUSEWHEEL, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCCREATE, WM_NCDESTROY,
|
WM_MOUSEWHEEL, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCCREATE, WM_NCDESTROY,
|
||||||
WM_NCLBUTTONDOWN, WM_PAINT, WM_POINTERDOWN, WM_POINTERUP, WM_POINTERUPDATE,
|
WM_NCLBUTTONDOWN, WM_PAINT, WM_POINTERDOWN, WM_POINTERUP, WM_POINTERUPDATE,
|
||||||
WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETCURSOR, WM_SETFOCUS, WM_SETTINGCHANGE, WM_SIZE,
|
WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETCURSOR, WM_SETFOCUS, WM_SETTINGCHANGE, WM_SIZE,
|
||||||
WM_SYSCOMMAND, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TOUCH, WM_WINDOWPOSCHANGED,
|
WM_SYSCHAR, WM_SYSCOMMAND, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TOUCH, WM_WINDOWPOSCHANGED,
|
||||||
WM_WINDOWPOSCHANGING, WM_XBUTTONDOWN, WM_XBUTTONUP, WNDCLASSEXW, WS_EX_LAYERED,
|
WM_WINDOWPOSCHANGING, WM_XBUTTONDOWN, WM_XBUTTONUP, WNDCLASSEXW, WS_EX_LAYERED,
|
||||||
WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP,
|
WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP,
|
||||||
WS_VISIBLE,
|
WS_VISIBLE,
|
||||||
|
@ -1186,7 +1186,7 @@ unsafe fn public_window_callback_inner<T: 'static>(
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
WM_CHAR => {
|
WM_CHAR | WM_SYSCHAR => {
|
||||||
use crate::event::WindowEvent::ReceivedCharacter;
|
use crate::event::WindowEvent::ReceivedCharacter;
|
||||||
use std::char;
|
use std::char;
|
||||||
let is_high_surrogate = (0xD800..=0xDBFF).contains(&wparam);
|
let is_high_surrogate = (0xD800..=0xDBFF).contains(&wparam);
|
||||||
|
@ -1217,8 +1217,19 @@ unsafe fn public_window_callback_inner<T: 'static>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo(msiglreith):
|
||||||
|
// Ideally, `WM_SYSCHAR` shouldn't emit a `ReceivedChar` event
|
||||||
|
// indicating user text input. As we lack dedicated support
|
||||||
|
// accelerators/keybindings these events will be additionally
|
||||||
|
// emitted for downstream users.
|
||||||
|
// This means certain key combinations (ie Alt + Space) will
|
||||||
|
// trigger the default system behavior **and** emit a char event.
|
||||||
|
if msg == WM_SYSCHAR {
|
||||||
|
DefWindowProcW(window, msg, wparam, lparam)
|
||||||
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WM_MENUCHAR => (MNC_CLOSE << 16) as isize,
|
WM_MENUCHAR => (MNC_CLOSE << 16) as isize,
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue