-
Notifications
You must be signed in to change notification settings - Fork 235
use set_keymap and get_keymap to proper handle keymap #1903
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
base: master
Are you sure you want to change the base?
Conversation
3d6c503 to
a9a6e0a
Compare
a9a6e0a to
a659a34
Compare
67f4c7e to
b114ff2
Compare
b114ff2 to
3bd3c18
Compare
05bd7d2 to
fd505bc
Compare
|
Seems this PR is necessary to unbreak wtype that broke after the last virtual keyboard PR. @Bot-wxt1221 with this PR, wtype works for clients, but for compositor binds it still uses the wrong keymap. I'm actually not sure what's happening. In winit backend, inside the If I do |
721e9ca to
13e102c
Compare
43ef44c to
e18b18b
Compare
| let _ = keyboard_handle.set_keymap(user_data, &old_keymap); | ||
| let _ = keyboard_handle.set_modifier_state(old_modifiers); | ||
| keyboard_handle.advertise_modifier_state(user_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a good idea to reset the keymap right away after every keyboard event? How does it work with modifiers, i.e. won't this code immediately clear the Ctrl modifier after pressing down Ctrl on the virtual kb?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wvkbd only send modifier without key event while some send both. Keymap update won't cost too much(in my opinion.)
won't this code immediately clear the Ctrl modifier after pressing down Ctrl on the virtual kb?
A great question but I don't know what's the correct solution. Do you think combine all modifier into one instead of maintaining different is ok?
This allows setting a pre-compiled keymap while ensuring the keymap was created under the same keyboard handle, and more importantly, the same xkbcommon context within the same thread.
e18b18b to
db6049c
Compare
db6049c to
6cb3229
Compare
WM need keymap to process input. So change_keymap is neccessary.Follow by #1803.
Applied #1907 (I changed it a little bit as I was overflowded by the complie error. I wonder if it's the best practice.)
Problem mainly on YaLTeR/niri#2314
Current impl is stupid. The correct way should be simulate a virtual keyboard handler like libinput backend.But I have no interest in it. So let's just make it possible to solve all issue.I believe it will solve all the problem.
By the way, I'm not familiar with rust so maybe a rust expert should review my code.