-
Notifications
You must be signed in to change notification settings - Fork 135
Send modifiers to the Wayland server when a modifier key event needs to be forwarded #1292
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
… 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? |
Signed-off-by: fortime <[email protected]>
hi @wengxt, can you have a look at this pr? |
can anyone review this pr? |
My issue with this is that I don't like this approach. We have already experience lots of case that compositor stuck in a unrecoverable modifier state. If you want to do this you have to reset the modifier map state to original one after you forward the key to reduce the risk. But still even that, I still don't like the approach. I'd rather compositor can introduce a new event for such cases. |
If you don't like this approach, why not propose it at the first time? Instead, propose it after many revisions. The first revision is enough for me. Also, I can try other workarounds. |
I don't like but adding new protocol to wayland-protocols is hard. There is really not another way other than this approach right now from wayland protocol point of view. So it's really up to whether we have to solve it right now, or we can wait. If you're thinking of approach like ydotool that need root, answer to that would simply be no. I wonder even consider that. |
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. 中文輸入也可以。