Add keyboard modifiers to input event
Making applications track modifier keys results in unnecessary work for
consumers, it's error prone, and it turns out to have unavoidable bugs.
For example, alt-tabbing with x11 results in the alt modifier state
getting stuck.
To resolve these problems, this patch adds a Mods value to the keyboard
input event.
Based on this patch: d287fa96e3
This commit is contained in:
parent
449f7d9d90
commit
f3ccdb7aec
9 changed files with 40 additions and 14 deletions
|
|
@ -3,6 +3,8 @@ use std::sync::{Arc, Mutex};
|
|||
|
||||
use {VirtualKeyCode, ElementState, WindowEvent as Event};
|
||||
|
||||
use events::ModifiersState;
|
||||
|
||||
use super::wayland_kbd;
|
||||
use wayland_client::EventQueueHandle;
|
||||
use wayland_client::protocol::wl_keyboard;
|
||||
|
|
@ -35,7 +37,8 @@ impl wayland_kbd::Handler for KbdHandler {
|
|||
};
|
||||
let vkcode = key_to_vkey(rawkey, keysym);
|
||||
let mut guard = eviter.lock().unwrap();
|
||||
guard.push_back(Event::KeyboardInput(state, rawkey as u8, vkcode));
|
||||
// TODO implement ModifiersState
|
||||
guard.push_back(Event::KeyboardInput(state, rawkey as u8, vkcode, ModifiersState::default()));
|
||||
// send char event only on key press, not release
|
||||
if let ElementState::Released = state { return }
|
||||
if let Some(txt) = utf8 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue