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

Stuck modifier keys #43

Open
AndrisBB opened this issue Dec 10, 2019 · 0 comments
Open

Stuck modifier keys #43

AndrisBB opened this issue Dec 10, 2019 · 0 comments

Comments

@AndrisBB
Copy link

I have been using the imx6 backend and have a problem with modifier keys (shift, alt etc.).
If the Shift key is held down for the two key presses or longer then shift key stays in the DEPRESSED state when the key is released.
This is causing problems in the JavaScript code because then key event indicates that shift key is held down when other keys are used.

Seems to be that problem is in the input server:
LibinputServer::handleKeyboardEvent(uint32_t eventTime, uint32_t code, uint32_t state)
which is calling the
xkb_state_update_key(xkbState, code, !!state ? XKB_KEY_DOWN : XKB_KEY_UP);

From the xkbcommon documentation I can see that this function must be called with matching KEY_DOWN/KEY_UP pairs. If the key is held down then there are multiple KEY_DOW events with one KEY_UP which is causing the mods stay in the DEPRESSED state.

A series of calls to this function should be consistent; that is, a call with XKB_KEY_DOWN for a key should be matched by an XKB_KEY_UP; if a key is pressed twice, it should be released twice; etc. Otherwise (e.g. due to missed input events), situations like "stuck modifiers" may occur.

xkb_state_serialize_mods(xkbState, XKB_STATE_MODS_DEPRESSED) always returns that modifier is still down after it has been released.

Is there a fix for this or I have to implement my own solution to keep separate state of the mod keys and drop for example shift key events if key is already pressed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant