Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport non-QWERTY keyboards #11950
Support non-QWERTY keyboards #11950
Conversation
highfive
commented
Jun 30, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jun 30, 2016
|
Mac French keyboard here, 'a' works, but not shift etc to input '.' with 'shift-;'. |
What happens if you press "Shift + a"? |
Support non-QWERTY keyboards, take 2 See #11950. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11955) <!-- Reviewable:end -->
|
Tested against a french keyboard and everything seems to be working as expected. |
| @@ -233,7 +241,13 @@ impl Window { | |||
|
|
|||
| fn handle_window_event(&self, event: glutin::Event) -> bool { | |||
| match event { | |||
| Event::KeyboardInput(element_state, _scan_code, Some(virtual_key_code)) => { | |||
| Event::ReceivedCharacter(ch) => { | |||
| assert!(self.pending_key_event_char.get().is_none()); | |||
This comment has been minimized.
This comment has been minimized.
mbrubeck
Jun 30, 2016
Contributor
This assertion panics if I try to type a character using the Compose key (e.g. Compose+A+E to type æ).
|
My Linux/X11 dvorak key mapping still works with this patch, except for one corner case noted above. |
|
@jdm It seems you didn't include my bincode bump that fixes the char serialization. |
|
@nox It's... right there? In the PR? |
|
Oh right, didn't look at the right commit. |
| @@ -69,6 +70,7 @@ impl KeyboardEvent { | |||
| cancelable: bool, | |||
| view: Option<&Window>, | |||
| _detail: i32, | |||
| ch: Option<char>, | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@jdm Who would you like to review this? |
|
Someone who wants to learn more about how we do keyboard input? I don't have a name in mind, unfortunately. |
|
|
|
SGTM. What do we need for this to get landed? What's blocking this to be reviewed? |
|
Nothing's blocking it that I'm aware. |
|
Looks good to me modulo the nits, the ipc-channel/bincode update, and the compose key, that is servo/glutin#101 -S-awaiting-review +S-needs-code-changes Reviewed 12 of 12 files at r1. components/constellation/constellation.rs, line 809 [r1] (raw file):
This can be removed now right? components/constellation/constellation.rs, line 1636 [r1] (raw file):
Can we be consistent with the order here? Either ports/glutin/window.rs, line 245 [r3] (raw file):
|
|
Ah, and I don't think I need to say this, but awesome work here, thanks for doing this Josh! :) |
|
|
|
Hm... need to update the cef port :/ |
…ues to a single byte.
|
@bors-servo: r=emilio |
|
|
Support non-QWERTY keyboards Using the ReceivedCharacter event from glutin, we can obtain the actual key characters that the user is pressing and releasing. This gets passed to the script thread along with the physical key data, since KeyboardEvent needs both pieces of information, where they get merged into a single logical key that gets processed by clients like TextInput without any special changes. Tested by switching my macbook keyboard to dvorak and looking at the output of keypress/keyup/keydown event listeners, as well as playing with tests/html/textarea.html. Non-content keybindings like reload work as expected, too - the remapped keybinding triggers the reload action. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #4144 - [X] These changes do not require tests because I can't think of a way to test remapped keyboard input Fixes #11991. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11950) <!-- Reviewable:end -->
|
|
highfive
commented
Jul 6, 2016
|
|
@bors-servo retry |
|
|
|
|
|
@bors-servo retry #11693 |
Support non-QWERTY keyboards Using the ReceivedCharacter event from glutin, we can obtain the actual key characters that the user is pressing and releasing. This gets passed to the script thread along with the physical key data, since KeyboardEvent needs both pieces of information, where they get merged into a single logical key that gets processed by clients like TextInput without any special changes. Tested by switching my macbook keyboard to dvorak and looking at the output of keypress/keyup/keydown event listeners, as well as playing with tests/html/textarea.html. Non-content keybindings like reload work as expected, too - the remapped keybinding triggers the reload action. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #4144 - [X] These changes do not require tests because I can't think of a way to test remapped keyboard input Fixes #11991. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11950) <!-- Reviewable:end -->
|
|
jdm commentedJun 30, 2016
•
edited by Ms2ger
Using the ReceivedCharacter event from glutin, we can obtain the actual key characters that the user is pressing and releasing. This gets passed to the script thread along with the physical key data, since KeyboardEvent needs both pieces of information, where they get merged into a single logical key that gets processed by clients like TextInput without any special changes.
Tested by switching my macbook keyboard to dvorak and looking at the output of keypress/keyup/keydown event listeners, as well as playing with tests/html/textarea.html. Non-content keybindings like reload work as expected, too - the remapped keybinding triggers the reload action.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsFixes #11991.
This change is