You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
B - bugDang, that shouldn't have happenedD - hardLikely harder than most tasks hereDS - x11Affects the X11 backend, or generally free Unix platformsP - lowNice to have
Arch Linux
x11
winit - all tested: 0.11.3 / 0.12.0 / current git head (eadd9a1)
All the fields of ModifierState are always false, regardless of whether or not I am holding shift/ctrl/alt/windows key. Shift/ctrl/false/window key presses and releases are registered as key event's and passed to my application, they just don't change the modifier state.
Well, intentional is a strong word. It's just that the relevant X11 event has no modifier info associated with it, and so the only straightforward solution for this is to make a round-trip to the X server (which is something I've been working on reducing).
I've thought of a cool idea for how to fix this, so I'll reopen this.
@francesca64 Ran into this issue as well, Is it advised to track the state of the modifier keys independently? I'd like to perform an action when the user presses e.g. alt + n.
@xla I'm not active here anymore. The X11 backend doesn't currently have a maintainer, so this bug probably won't be fixed for a while. You only need this feature if you want to handle modifiers while the window isn't focused; @Osspial is a better person to ask if you need more advice.
For anyone who wants to fix this in the future, using the Xkb extension is the only way. This is esoteric, but I have a reference implementation here: francesca64@fe0e98e (I remember there being another branch from my second attempt to do this, but I didn't see one). The normal way to interpret the Xkb state info is using libxkbcommon, which is ubiquitous, but libxkbcommon-x11 isn't! So, to implement this, parts of libxkbcommon would have to be reimplemented. Note that getting Xkb to interop with XIM isn't possible, so you'd either A) only use Xkb for a subset of keyboard handling (like the modifiers in this issue), or B) write a custom IME client, which will likely be necessary longterm anyway due to the thread-safety/etc. issues with XIM, but is no small undertaking.
B - bugDang, that shouldn't have happenedD - hardLikely harder than most tasks hereDS - x11Affects the X11 backend, or generally free Unix platformsP - lowNice to have
Activity
francesca64 commentedon Apr 25, 2018
By your repro code, I'm guessing you're referring to the
DeviceEventmodifiers and notWindowEvent?gmorenz commentedon Apr 25, 2018
Ah, you're right,
WindowEventworks correctly, I'm guessing this is intentional and counts as user error then?francesca64 commentedon Apr 25, 2018
Well, intentional is a strong word. It's just that the relevant X11 event has no modifier info associated with it, and so the only straightforward solution for this is to make a round-trip to the X server (which is something I've been working on reducing).
I've thought of a cool idea for how to fix this, so I'll reopen this.
[-]Key modifiers never set[/-][+]X11: DeviceEvent::Key modifiers never set[/+]xla commentedon May 21, 2019
@francesca64 Ran into this issue as well, Is it advised to track the state of the modifier keys independently? I'd like to perform an action when the user presses e.g.
alt + n.francesca64 commentedon May 21, 2019
@xla I'm not active here anymore. The X11 backend doesn't currently have a maintainer, so this bug probably won't be fixed for a while. You only need this feature if you want to handle modifiers while the window isn't focused; @Osspial is a better person to ask if you need more advice.
For anyone who wants to fix this in the future, using the Xkb extension is the only way. This is esoteric, but I have a reference implementation here: francesca64@fe0e98e (I remember there being another branch from my second attempt to do this, but I didn't see one). The normal way to interpret the Xkb state info is using libxkbcommon, which is ubiquitous, but libxkbcommon-x11 isn't! So, to implement this, parts of libxkbcommon would have to be reimplemented. Note that getting Xkb to interop with XIM isn't possible, so you'd either A) only use Xkb for a subset of keyboard handling (like the modifiers in this issue), or B) write a custom IME client, which will likely be necessary longterm anyway due to the thread-safety/etc. issues with XIM, but is no small undertaking.
murarth commentedon Dec 5, 2019
Closed by #1132, which implemented manual modifier state tracking in X11.