Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor winit key handling #21250

Merged
merged 1 commit into from Jul 30, 2018
Merged

Refactor winit key handling #21250

merged 1 commit into from Jul 30, 2018

Conversation

@paulrouget
Copy link
Contributor

paulrouget commented Jul 26, 2018

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 rust-windowing/winit#610.


This change is Reviewable

@paulrouget
Copy link
Contributor Author

paulrouget commented Jul 26, 2018

I basically recorded all the winit events when doing this: #21161 (comment)

Linux and Windows behave the same way. Mac has extra ReceivedCharacter events.

I figured that the logic is to only send release events on KeyboardInput and send press events on ReceivedCharacter only if the character is printable (see the code comments).

@paulrouget
Copy link
Contributor Author

paulrouget commented Jul 26, 2018

/cc @dorfsmay maybe you can also test this PR

@dorfsmay
Copy link

dorfsmay commented Jul 26, 2018

The sticky control key is still there.

I checked that I'm on the right branch (checked the line in the files), and also:

$ git branch -v
* fixkeys 3c7bb87 Refactor winit key handling
master  4c5a7ea Auto merge of #21246 - servo:webgl, r=emilio

But, it's not worse, so if this PR fixes other things it's worth merging, and we can investigate the Linux ctrl key further later.

@paulrouget
Copy link
Contributor Author

paulrouget commented Jul 27, 2018

@dorfsmay with this PR, here, I can not reproduce the sticky control key issue.

This is what I do:

  • Linux, Xorg server
  • ./mach run -d 'data:text/html,<input>'
  • click on the text input
  • Ctrl-L, this brings the popup. Click cancel.
  • l, the letter l is printed in the input
@dorfsmay
Copy link

dorfsmay commented Jul 27, 2018

Correct that sequence works fine, but this one shows the stickiness of the control key:

  • ./mach run --dev
  • move mouse to servo and give focus
  • press the R key - nothing happens - good, as expected
  • press ctrl-R - nothing happens - bad, should reload
  • press ctrl-R - reloads content
  • press R - reloads content!! - bad, shows that the ctrl state is stuck
  • press ctrl-R (or anything) - reloads
  • press R - nothing happens, shows that the ctrl state is gone now

If this PR fixes other issues, I think it's worth merging, and we can keep working on the sticky control separately.

@jdm
jdm approved these changes Jul 27, 2018
Copy link
Member

jdm left a comment

These changes seem like a reasonable improvement.

@jdm jdm assigned jdm and unassigned emilio Jul 27, 2018
@kwonoj
Copy link
Contributor

kwonoj commented Jul 27, 2018

Changewise looks fine, I may try few on windows once this is landed.

@paulrouget
Copy link
Contributor Author

paulrouget commented Jul 30, 2018

@dorfsmay sadly I cannot reproduce your steps. Works fine here on Ubuntu. ctrl-R reloads on first hit. Can you check with xev the events you got on Ctrl-R and gather as many info about this bug in a different issue? We will also need to understand which version of Linux you use, your keyboard layout, and if possible, some winit logs.

@paulrouget
Copy link
Contributor Author

paulrouget commented Jul 30, 2018

@bors-servo r=jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

📌 Commit 3c7bb87 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

Testing commit 3c7bb87 with merge 9c7891c...

bors-servo added a commit that referenced this pull request Jul 30, 2018
Refactor winit key handling

This should improve keys input on Linux and Windows.
Should fix #17146 and #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 rust-windowing/winit#610.

@kwonoj and @atouchet I'd appreciate if you could look at this.

<!-- 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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

💔 Test failed - mac-rel-css1

@jdm
Copy link
Member

jdm commented Jul 30, 2018

@bors-servo retry

@atouchet
Copy link
Contributor

atouchet commented Jul 30, 2018

I will make sure to test this on Windows when it's merged.

@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

💔 Test failed - mac-rel-css1

@CYBAI
Copy link
Collaborator

CYBAI commented Jul 30, 2018

@bors-servo retry

  • #JustInfraThings
@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

Testing commit 3c7bb87 with merge 1bd34e7...

bors-servo added a commit that referenced this pull request Jul 30, 2018
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 rust-windowing/winit#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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

💔 Test failed - android

@jdm
Copy link
Member

jdm commented Jul 30, 2018

@bors-servo retry

  • cleared out the builder
@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

bors-servo added a commit that referenced this pull request Jul 30, 2018
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 rust-windowing/winit#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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

Testing commit 3c7bb87 with merge 9790f87...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

💔 Test failed - android

@jdm
Copy link
Member

jdm commented Jul 30, 2018

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jul 30, 2018

@bors-servo bors-servo merged commit 3c7bb87 into servo:master Jul 30, 2018
3 of 4 checks passed
3 of 4 checks passed
Taskcluster (pull_request) TaskGroup: failure
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

9 participants
You can’t perform that action at this time.