mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +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);
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ pub enum Msg {
|
|||
/// Composite.
|
||||
Recomposite(CompositingReason),
|
||||
/// Sends an unconsumed key event back to the compositor.
|
||||
KeyEvent(Key, KeyState, KeyModifiers),
|
||||
KeyEvent(Option<char>, Key, KeyState, KeyModifiers),
|
||||
/// Script has handled a touch event, and either prevented or allowed default actions.
|
||||
TouchEventProcessed(EventResult),
|
||||
/// Changes the cursor.
|
||||
|
|
|
@ -76,7 +76,7 @@ pub enum WindowEvent {
|
|||
/// Sent when the user quits the application
|
||||
Quit,
|
||||
/// Sent when a key input state changes
|
||||
KeyEvent(Key, KeyState, KeyModifiers),
|
||||
KeyEvent(Option<char>, Key, KeyState, KeyModifiers),
|
||||
/// Sent when Ctr+R/Apple+R is called to reload the current page.
|
||||
Reload,
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ pub trait WindowMethods {
|
|||
fn set_cursor(&self, cursor: Cursor);
|
||||
|
||||
/// Process a key event.
|
||||
fn handle_key(&self, key: Key, mods: KeyModifiers);
|
||||
fn handle_key(&self, ch: Option<char>, key: Key, mods: KeyModifiers);
|
||||
|
||||
/// Does this window support a clipboard
|
||||
fn supports_clipboard(&self) -> bool;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue