Skip to content

Commit

Permalink
Grab Pointer in TreeSelect
Browse files Browse the repository at this point in the history
If this is not done, trying to select another window with the mouse when
treeselect is up, the X server may stop handling keyboard and pointer
requests, making it appear that xmonad froze.  As the pointer can't do
useful things anyways when the treeselect window is shown, simply
grabbing it solves this problem.

C.f.:
  - xmonad/xmonad/issues/116
  - xmonad/issues/445
  • Loading branch information
slotThe committed Jan 20, 2021
1 parent 724ad6f commit 79d2312
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions XMonad/Actions/TreeSelect.hs
Expand Up @@ -329,10 +329,11 @@ treeselectAt conf@TSConfig{..} zipper hist = withDisplay $ \display -> do
-- and mouse button 1
grabButton display button1 anyModifier win True buttonReleaseMask grabModeAsync grabModeAsync none none

-- grab the keyboard
status <- liftIO $ grabKeyboard display win True grabModeAsync grabModeAsync currentTime
-- grab the keyboard and the pointer
statusK <- liftIO $ grabKeyboard display win True grabModeAsync grabModeAsync currentTime
statusP <- liftIO $ grabPointer display win True none grabModeAsync grabModeAsync none none currentTime

r <- if status == grabSuccess
r <- if statusK == grabSuccess && statusP == grabSuccess
then do
-- load the XMF font
gc <- liftIO $ createGC display win
Expand Down

0 comments on commit 79d2312

Please sign in to comment.