-
Notifications
You must be signed in to change notification settings - Fork 126
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
Send modifiers to the Wayland server when a modifier key event needs to be forwarded #1292
base: master
Are you sure you want to change the base?
Conversation
… key event needs to be forwarded. Signed-off-by: fortime <[email protected]>
@wengxt can you have a review on this pr? |
the implementation should map modifier key -> key code from keymap with xkbcommon, instead of hardcode key code. |
Sorry, I'm new to xkbcommon. I can't find out which api I should use. I have tried to use For example, the name of keycode 50 is "LFSH", and I use "LFSH" to get the modifier index, it returns XKB_MOD_INVALID. |
The reason to use xkbcommon for it , is because, for example, xkb option may allow to do things like "swap capslock & ctrl", in that case, key code will be same for the key. Your implementation will be sending the wrong key. The logic should be like:
|
Do you mean I should use key sym to check if it is a modifier?
Is it correct? |
@fortime well.. you shouldn't really assume, Control_L/R keysyms can produce Control modifier state. They are actually two separate concept. The code to pick the key when xkb_keymap_key_get_syms_by_level has the desired keysym and verify with xkb_state_update_key can really produce the relevant mask |
…update_mask` and `xkb_state_update_key` to find all keycodes which changes modifiers. Signed-off-by: fortime <[email protected]>
@wengxt can you check whether it is the logic you mean in the new commit? |
I'm using kwin 6 with wayland enabled, and I'm writing a virtual keyboard using the
org.fcitx.Fcitx5.VirtualKeyboardBackend1
interface. Currently, a modifier key event is forwarded to the wayland server throughwl_keyboard::key
. This doesn't work, at least in kwin 6. I think the correct way is usingwl_keyboard::modifiers
.My virtual keyboard works well with this patch.
This paragraph is composed using my virtual keyboard. Uppercase letters can be inputted since
Shift
works. 中文輸入也可以。