mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #21881 - pyfisch:keyboard-types, r=paulrouget
Use keyboard-types crate Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent from the W3C UI Events spec. All keyboard handling now uses the new types. Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now recognized in a uniform way. Updated the winit port. Updated webdriver integration. part of #20331 What this PR does: * allow the use non-ASCII keyboards for text input * decouple keyboard event "key" from "code" (key meaning vs location) What this PR does not do: * completely improve keyboard events send from winit and webdriver * add support for CompositionEvent or IME Notes: * The winit embedder does not send keyup events for printable keys (this is a regression) * keyboard-types is on crates.io because I believe it to be useful outside of servo. If you prefer I can add a copy in this repo. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21881) <!-- Reviewable:end -->
This commit is contained in:
commit
9a0404ac5f
35 changed files with 747 additions and 1673 deletions
|
@ -11,6 +11,7 @@ path = "lib.rs"
|
|||
|
||||
[dependencies]
|
||||
ipc-channel = "0.11"
|
||||
keyboard-types = {version = "0.4.2-servo", features = ["serde"]}
|
||||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
extern crate ipc_channel;
|
||||
extern crate keyboard_types;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
#[macro_use]
|
||||
|
@ -18,7 +19,8 @@ extern crate webrender_api;
|
|||
pub mod resources;
|
||||
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{InputMethodType, Key, KeyModifiers, KeyState, TopLevelBrowsingContextId};
|
||||
use keyboard_types::KeyboardEvent;
|
||||
use msg::constellation_msg::{InputMethodType, TopLevelBrowsingContextId};
|
||||
use servo_channel::{Receiver, Sender};
|
||||
use servo_url::ServoUrl;
|
||||
use std::fmt::{Debug, Error, Formatter};
|
||||
|
@ -93,7 +95,7 @@ pub enum EmbedderMsg {
|
|||
/// Wether or not to unload a document
|
||||
AllowUnload(IpcSender<bool>),
|
||||
/// Sends an unconsumed key event back to the embedder.
|
||||
KeyEvent(Option<char>, Key, KeyState, KeyModifiers),
|
||||
Keyboard(KeyboardEvent),
|
||||
/// Changes the cursor.
|
||||
SetCursor(CursorKind),
|
||||
/// A favicon was detected
|
||||
|
@ -134,7 +136,7 @@ impl Debug for EmbedderMsg {
|
|||
EmbedderMsg::Alert(..) => write!(f, "Alert"),
|
||||
EmbedderMsg::AllowUnload(..) => write!(f, "AllowUnload"),
|
||||
EmbedderMsg::AllowNavigation(..) => write!(f, "AllowNavigation"),
|
||||
EmbedderMsg::KeyEvent(..) => write!(f, "KeyEvent"),
|
||||
EmbedderMsg::Keyboard(..) => write!(f, "Keyboard"),
|
||||
EmbedderMsg::SetCursor(..) => write!(f, "SetCursor"),
|
||||
EmbedderMsg::NewFavicon(..) => write!(f, "NewFavicon"),
|
||||
EmbedderMsg::HeadParsed => write!(f, "HeadParsed"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue