Auto merge of #21250 - paulrouget:fixkeys, r=jdm

Refactor winit key handling

This should improve keys input on Linux and Windows.
Should fix #17146 and fix #21161

Tested Mac, Windows and Linux. Basic typing works, combo work, text navigation works. I hit some strange issues where sometimes the text would be displayed late, but I believe it is unrelated to this PR.

If we land that now, we will hit a regression on Mac, we need a winit update that includes https://github.com/tomaka/winit/pull/610.

<!-- 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/21250)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-07-30 13:02:41 -04:00 committed by GitHub
commit 1bd34e7c55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 96 deletions

View file

@ -367,10 +367,8 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
(EmbedderMsg::KeyEvent(ch, key, state, modified),
ShutdownState::NotShuttingDown) => {
if state == KeyState::Pressed {
let event = (top_level_browsing_context, EmbedderMsg::KeyEvent(ch, key, state, modified));
self.embedder_events.push(event);
}
let event = (top_level_browsing_context, EmbedderMsg::KeyEvent(ch, key, state, modified));
self.embedder_events.push(event);
},
(msg, ShutdownState::NotShuttingDown) => {