summaryrefslogtreecommitdiff
path: root/xcb.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2012-05-30 16:53:16 +0200
committerMichael Stapelberg <michael@stapelberg.de>2012-05-30 16:53:16 +0200
commit1da637c41964180a71904e4870cbb777a11b88e0 (patch)
tree5786f1a4b1ac6d7589cff7d7e1cbc0c05aedc511 /xcb.c
parentdd02dff44a582fe95d2d4662a7ca537d6adebffb (diff)
skip shift when getting the modifier mask (Thanks SardemFF7)
Diffstat (limited to 'xcb.c')
-rw-r--r--xcb.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/xcb.c b/xcb.c
index a247763..4e04e94 100644
--- a/xcb.c
+++ b/xcb.c
@@ -159,7 +159,20 @@ uint32_t get_mod_mask(xcb_connection_t *conn, xcb_key_symbols_t *symbols, uint32
modmap_r = xcb_get_modifier_mapping_reply(conn, xcb_get_modifier_mapping(conn), NULL);
modmap = xcb_get_modifier_mapping_keycodes(modmap_r);
- for (int i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++) {
+ /* We skip i == 0 (Shift) because Shift is always Shift. Handling it
+ * would make i3lock believe that Shift is the modifier for CapsLock in
+ * case CapsLock is activated using the shift keysym:
+ *
+ * $ xmodmap
+ * shift Shift_L (0x32), Shift_R (0x3e)
+ * lock Shift_L (0x32)
+ *
+ * The X11 documentation states that CapsLock and ShiftLock can only be
+ * on the lock modifier.
+ */
+ if (i == 0)
+ continue;
for (int j = 0; j < modmap_r->keycodes_per_modifier; j++) {
kc = modmap[i * modmap_r->keycodes_per_modifier + j];
for (xcb_keycode_t *ktest = modeswitchcodes; *ktest; ktest++) {
@@ -171,6 +184,7 @@ uint32_t get_mod_mask(xcb_connection_t *conn, xcb_key_symbols_t *symbols, uint32
return (1 << i);
}
}
+ }
free(modeswitchcodes);
free(modmap_r);