mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Associate logical and physical keypresses together to support non-QWERTY keyboards.
This commit is contained in:
parent
87c7772527
commit
04ce86c08c
15 changed files with 137 additions and 77 deletions
|
@ -701,9 +701,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
self.composition_request = CompositionRequest::CompositeNow(reason)
|
||||
}
|
||||
|
||||
(Msg::KeyEvent(key, state, modified), ShutdownState::NotShuttingDown) => {
|
||||
(Msg::KeyEvent(ch, key, state, modified), ShutdownState::NotShuttingDown) => {
|
||||
if state == KeyState::Pressed {
|
||||
self.window.handle_key(key, modified);
|
||||
self.window.handle_key(ch, key, modified);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1348,8 +1348,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
self.on_touchpad_pressure_event(cursor, pressure, stage);
|
||||
}
|
||||
|
||||
WindowEvent::KeyEvent(key, state, modifiers) => {
|
||||
self.on_key_event(key, state, modifiers);
|
||||
WindowEvent::KeyEvent(ch, key, state, modifiers) => {
|
||||
self.on_key_event(ch, key, state, modifiers);
|
||||
}
|
||||
|
||||
WindowEvent::Quit => {
|
||||
|
@ -1880,8 +1880,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
}
|
||||
|
||||
fn on_key_event(&self, key: Key, state: KeyState, modifiers: KeyModifiers) {
|
||||
let msg = ConstellationMsg::KeyEvent(key, state, modifiers);
|
||||
fn on_key_event(&self, ch: Option<char>, key: Key, state: KeyState, modifiers: KeyModifiers) {
|
||||
let msg = ConstellationMsg::KeyEvent(ch, key, state, modifiers);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending key event to constellation failed ({}).", e);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue