X.A.{Grid,Tree}Select, X.Prompt: Fix keybindings like Shift-Tab and similar

This changes KeyPress handling in these modules to behave much closer to
how xmonad core itself handles keypresses. The primary difference lies
in that xmonad reads raw KeyCode and then converts it to unmodified
KeySym, while these modules used `lookupString` to find the actual
keysyms. As a consequence, key definitions like `(shiftMap, xK_Tab)`
didn't work on many layouts because an actual KeySym for `Shift-Tab` is
commonly `ISO_LEFT_TAB`, and not `Tab`.

Closes: https://github.com/xmonad/xmonad-contrib/pull/590
Co-authored-by: Tomas Janousek <tomi@nomi.cz>
This commit is contained in:
Nikolay Yakimov
2021-08-12 11:30:23 +03:00
committed by Tomas Janousek
parent 12c5518852
commit 68c967ec0c
3 changed files with 10 additions and 8 deletions

View File

@@ -637,10 +637,11 @@ eventLoop handle stopAction = do
-- Also capture @buttonPressMask@, see Note [Allow ButtonEvents]
maskEvent d (exposureMask .|. keyPressMask .|. buttonPressMask) e
ev <- getEvent e
(ks,s) <- if ev_event_type ev == keyPress
then lookupString $ asKeyEvent e
else return (Nothing, "")
return (fromMaybe xK_VoidSymbol ks,s,ev)
if ev_event_type ev == keyPress
then do (_, s) <- lookupString $ asKeyEvent e
ks <- keycodeToKeysym d (ev_keycode ev) 0
return (ks, s, ev)
else return (noSymbol, "", ev)
l -> do
modify $ \s -> s { eventBuffer = tail l }
return $ head l