mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
X.A.Submap: establish pointer grab to avoid freezing X.
Establish active asynchronous pointer grab before entering infinity cycle. Because xmonad already has passive synchronous pointer grab, this overwrites it temporary and avoids freezing X, when button press occurs after submap key press. Also, terminate submap at button press in the same way, as we do for wrong key press.
This commit is contained in:
parent
c69b2933a3
commit
b9d8f6ce34
@ -42,6 +42,12 @@
|
|||||||
EWMH taskbars and pagers. Useful for `NamedScratchpad` windows, since
|
EWMH taskbars and pagers. Useful for `NamedScratchpad` windows, since
|
||||||
you will usually be taken to the `NSP` workspace by them.
|
you will usually be taken to the `NSP` workspace by them.
|
||||||
|
|
||||||
|
* `XMonad.Actions.Submap`
|
||||||
|
|
||||||
|
Establish pointer grab to avoid freezing X, when button press occurs after
|
||||||
|
submap key press. And terminate submap at button press in the same way,
|
||||||
|
as we do for wrong key press.
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|
||||||
* `XMonad.Layout.LayoutBuilder`
|
* `XMonad.Layout.LayoutBuilder`
|
||||||
|
@ -75,17 +75,23 @@ submapDefaultWithKey defAction keys = do
|
|||||||
XConf { theRoot = root, display = d } <- ask
|
XConf { theRoot = root, display = d } <- ask
|
||||||
|
|
||||||
io $ grabKeyboard d root False grabModeAsync grabModeAsync currentTime
|
io $ grabKeyboard d root False grabModeAsync grabModeAsync currentTime
|
||||||
|
io $ grabPointer d root False buttonPressMask grabModeAsync grabModeAsync
|
||||||
|
none none currentTime
|
||||||
|
|
||||||
(m, s) <- io $ allocaXEvent $ \p -> fix $ \nextkey -> do
|
(m, s) <- io $ allocaXEvent $ \p -> fix $ \nextkey -> do
|
||||||
maskEvent d keyPressMask p
|
maskEvent d (keyPressMask .|. buttonPressMask) p
|
||||||
KeyEvent { ev_keycode = code, ev_state = m } <- getEvent p
|
ev <- getEvent p
|
||||||
keysym <- keycodeToKeysym d code 0
|
case ev of
|
||||||
if isModifierKey keysym
|
KeyEvent { ev_keycode = code, ev_state = m } -> do
|
||||||
then nextkey
|
keysym <- keycodeToKeysym d code 0
|
||||||
else return (m, keysym)
|
if isModifierKey keysym
|
||||||
|
then nextkey
|
||||||
|
else return (m, keysym)
|
||||||
|
_ -> return (0, 0)
|
||||||
-- Remove num lock mask and Xkb group state bits
|
-- Remove num lock mask and Xkb group state bits
|
||||||
m' <- cleanMask $ m .&. ((1 `shiftL` 12) - 1)
|
m' <- cleanMask $ m .&. ((1 `shiftL` 12) - 1)
|
||||||
|
|
||||||
|
io $ ungrabPointer d currentTime
|
||||||
io $ ungrabKeyboard d currentTime
|
io $ ungrabKeyboard d currentTime
|
||||||
|
|
||||||
fromMaybe (defAction (m', s)) (M.lookup (m', s) keys)
|
fromMaybe (defAction (m', s)) (M.lookup (m', s) keys)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user