mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-31 22:00:04 -04:00
On X11, update keymap on XkbMapNotify
This is required to handle xmodmap. Fixes #3338.
This commit is contained in:
@@ -11,6 +11,7 @@ Unreleased` header.
|
|||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- On X11, keymap not updated from xmodmap.
|
||||||
- On X11, reduce the amount of time spent fetching screen resources.
|
- On X11, reduce the amount of time spent fetching screen resources.
|
||||||
- On Wayland, fix `Window::request_inner_size` being overwritten by resize.
|
- On Wayland, fix `Window::request_inner_size` being overwritten by resize.
|
||||||
- On Wayland, fix `Window::inner_size` not using the correct rounding.
|
- On Wayland, fix `Window::inner_size` not using the correct rounding.
|
||||||
|
|||||||
@@ -1282,6 +1282,21 @@ impl<T: 'static> EventProcessor<T> {
|
|||||||
unsafe { self.kb_state.init_with_x11_keymap() };
|
unsafe { self.kb_state.init_with_x11_keymap() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ffi::XkbMapNotify => {
|
||||||
|
let prev_mods = self.kb_state.mods_state();
|
||||||
|
unsafe { self.kb_state.init_with_x11_keymap() };
|
||||||
|
let new_mods = self.kb_state.mods_state();
|
||||||
|
if prev_mods != new_mods {
|
||||||
|
if let Some(window) = self.active_window {
|
||||||
|
callback(Event::WindowEvent {
|
||||||
|
window_id: mkwid(window),
|
||||||
|
event: WindowEvent::ModifiersChanged(
|
||||||
|
Into::<ModifiersState>::into(new_mods).into(),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
ffi::XkbStateNotify => {
|
ffi::XkbStateNotify => {
|
||||||
let xev =
|
let xev =
|
||||||
unsafe { &*(xev as *const _ as *const ffi::XkbStateNotifyEvent) };
|
unsafe { &*(xev as *const _ as *const ffi::XkbStateNotifyEvent) };
|
||||||
|
|||||||
@@ -364,7 +364,9 @@ impl<T: 'static> EventLoop<T> {
|
|||||||
.xconn
|
.xconn
|
||||||
.select_xkb_events(
|
.select_xkb_events(
|
||||||
0x100, // Use the "core keyboard device"
|
0x100, // Use the "core keyboard device"
|
||||||
xkb::EventType::NEW_KEYBOARD_NOTIFY | xkb::EventType::STATE_NOTIFY,
|
xkb::EventType::NEW_KEYBOARD_NOTIFY
|
||||||
|
| xkb::EventType::MAP_NOTIFY
|
||||||
|
| xkb::EventType::STATE_NOTIFY,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user