-
Notifications
You must be signed in to change notification settings - Fork 28
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
xkb implementation seems to behave differently from its C counterpart #181
Comments
IIUC you're not using the API in exactly the same way (i.e. checking changed masks), which is perhaps why it's not doing the same thing. Does something like this (untested) help?
|
Sadly, adding
Maybe there's a different thing that requires checking? |
Btw, if I don't retrieve a layout index or the symbols string, |
Oh, sorry, you can drop the .check(), that was me being pedantic. |
Yeah, waiting for event should only give you the events you've selected, so i think that's expected. You'll still need the SelectEvents bit |
Ight, sorry for the pause. The |
What is the type? |
|
Ok, and if you xtrace it, do you see the events you expect? I can imagine NewKeyboardNotifyEvents are sent, but perhaps in addition to StateChangeNotify? |
xcffib v1.7.1
I'm trying to reimplement the event loop that https://github.com/xkbmon/xkbmon does, but can't replicate the behaviour, specifically -- the filtering of events. I'm only interested in those that signal about the keyboard layout change, and xkbmon does it like this (the comments are added by me):
At the moment, the only reliable way to check if the layout has changed is to check the value of
event.oldMaxKeyCode
, which gets the same index as the result ofxkb.GetState(xcffib.xkb.ID.UseCoreKbd).reply().lockedGroup
(wherexkb = conn(xcffib.xkb.key)
). On one hand, it might be somewhat cheaper to use that value myself to get the layout by index than to rerunGetState()
, on the other -- it still differs from the C implementation.Btw, the code I come up with (with some help from, Lord forgive me, ChatGPT (except from the event filter, I found it out myself)) is such: https://pastebin.com/F2QQiUL0
The text was updated successfully, but these errors were encountered: