diff options
author | Chris Down <chris@chrisdown.name> | 2022-12-07 14:55:08 +0000 |
---|---|---|
committer | Rafael Marcalo <raroma09@gmail.com> | 2022-12-10 15:58:03 +0000 |
commit | 535e20c8daa7b2e7131a5b88d1d776987df6cd12 (patch) | |
tree | 14d4a1e2615030e9e79e16f15a14007d3c9c17ea /vanitygaps.c | |
parent | 8a53e7077b8eb705b1f0e80216343a8a5727cb3a (diff) |
grabkeys: Avoid missing events when a keysym maps to multiple keycodes
It's not uncommon for one keysym to map to multiple keycodes. For
example, the "play" button on my keyboard sends keycode 172, but my
bluetooth headphones send keycode 208, both of which map back to
XF86AudioPlay:
% xmodmap -pke | grep XF86AudioPlay
keycode 172 = XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause
keycode 208 = XF86AudioPlay NoSymbol XF86AudioPlay
keycode 215 = XF86AudioPlay NoSymbol XF86AudioPlay
This is a problem because the current code only grabs a single one of
these keycodes, which means that events for any other keycode also
mapping to the bound keysym will not be handled by dwm. In my case, this
means that binding XF86AudioPlay does the right thing and correctly
handles my keyboard's keys, but does nothing on my headphones. I'm not
the only person affected by this, there are other reports[0].
In order to fix this, we look at the mappings between keycodes and
keysyms at grabkeys() time and pick out all matching keycodes rather
than just the first one. The keypress() side of this doesn't need any
changes because the keycode gets converted back to a canonical keysym
before any action is taken.
0: https://github.com/cdown/dwm/issues/11
Diffstat (limited to 'vanitygaps.c')
0 files changed, 0 insertions, 0 deletions