You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keybindings don't work on Linux and maybe windows #21161
I'm going to try to tackle that one, including #17146. We accumulated a lot of workarounds and winit has changed quite a bit (fixed some stuff, broke some other stuff).
There are few bugs in winit on Mac where key down events for modifiers are not sent correctly.
The behavior for control keys is different on Windows.
And ReceivedCharacter is not always fired the same way depending on the platform.
My goal is to achieve the same behavior across the 3 platforms for:
basic typing
typing with a different layout (testing with Azerty)
getting return, backspace and arrows to work
get Cmd-A and Ctrl-A to work in a textbox
make clipboard shortcut work
make sure Ctrl/Cmd-XXX shortcuts are caught and not repeated
I've had a look but made very little progress. I'm not sure how useful this will be, but just in case, here's what I have found on Linux:
Everything happens in ports/servo/glutin_app/window.rs and components/servo/lib.rs
the run function in windows.rs does a callback to self.winit_event_to_servo_event on each window events.
printing out the event (e) in the events_loop, before the callback shows that all events are the same at this point, Key::KeyboardInput
the Window::handle_events interprets normal alphabet and Alt keys as [Key], but interprets the control key as a [MouseMove]!
I think the issue is that winit_event_to_servo_event (in ports/servo/glutin_app/window.rs) is matching for winit::WindowEvent::KeyboardInput but the Control key is still a winit::Key::KeyboardInput. I had some code that showed this, but removed it since, and haven't had time to dig there since then.
the control keys create a sticky state: If you press CTRL -X (x or any letter it doesn't matter) once, then all keys pressed after that show ctrl: true as a ModifiersState. The only way to change that state back to false is to again press CTRL with a key. Pressing CTRL on its own will not change the state.
This point above explains why CTRL-L in servo on Linux does not bring the URL menu. You can get the URL menu following this sequence:
start servo
press CTRL-L (not necessarily L, any letter at the same time as CTRL)
press the key 'L' on its own
press CTRL-L (any letter) again to switch away from the control modifier
Activity
[-]Keybindings don't work on Linux (and maybe windows)[/-][+]Keybindings don't work on Linux and maybe windows[/+]paulrouget commentedon Jul 25, 2018
I'm going to try to tackle that one, including #17146. We accumulated a lot of workarounds and winit has changed quite a bit (fixed some stuff, broke some other stuff).
There are few bugs in winit on Mac where key down events for modifiers are not sent correctly.
The behavior for control keys is different on Windows.
And
ReceivedCharacteris not always fired the same way depending on the platform.My goal is to achieve the same behavior across the 3 platforms for:
dorfsmay commentedon Jul 25, 2018
I've had a look but made very little progress. I'm not sure how useful this will be, but just in case, here's what I have found on Linux:
Everything happens in
ports/servo/glutin_app/window.rsandcomponents/servo/lib.rsthe
runfunction in windows.rs does a callback to self.winit_event_to_servo_event on each window events.printing out the event (e) in the events_loop, before the callback shows that all events are the same at this point,
Key::KeyboardInputthe Window::handle_events interprets normal alphabet and Alt keys as
[Key], but interprets the control key as a[MouseMove]!I think the issue is that
winit_event_to_servo_event(in ports/servo/glutin_app/window.rs) is matching forwinit::WindowEvent::KeyboardInputbut the Control key is still awinit::Key::KeyboardInput. I had some code that showed this, but removed it since, and haven't had time to dig there since then.the control keys create a sticky state: If you press CTRL -X (x or any letter it doesn't matter) once, then all keys pressed after that show
ctrl: trueas a ModifiersState. The only way to change that state back to false is to again press CTRL with a key. Pressing CTRL on its own will not change the state.This point above explains why CTRL-L in servo on Linux does not bring the URL menu. You can get the URL menu following this sequence:
dorfsmay commentedon Jul 25, 2018
This is a printout from adding a bunch of debugging println when pressing the following keys in this order:
ModifiersState)ModifiersStatenow!)I can push my branch that I used to generate this, but it is just a few println in the functions mentioned above
key-press-printout.txt
paulrouget commentedon Jul 26, 2018
@dorfsmay thank you. I think I might need help later with extensive testing.
paulrouget commentedon Jul 26, 2018
PR: #21250
Auto merge of #21250 - paulrouget:fixkeys, r=jdm
Auto merge of #21250 - paulrouget:fixkeys, r=jdm
Auto merge of #21250 - paulrouget:fixkeys, r=jdm