diff options
Diffstat (limited to 'src/Internal/Submap.hs')
| -rw-r--r-- | src/Internal/Submap.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Internal/Submap.hs b/src/Internal/Submap.hs index 40becdc..e5968ff 100644 --- a/src/Internal/Submap.hs +++ b/src/Internal/Submap.hs @@ -2,6 +2,7 @@ module Internal.Submap ( mapNextString, submapButtonsWithKey, nextButton, + nextMotion, module X) where import XMonad hiding (keys) @@ -47,6 +48,20 @@ nextButton = do return ret +nextMotion :: X (Int, Int) +nextMotion = do + XConf { theRoot = root, display = d } <- ask + io $ grabPointer d root False pointerMotionMask grabModeAsync grabModeAsync 0 0 currentTime + + ret <- io $ allocaXEvent $ \xEv -> do + maskEvent d pointerMotionMask xEv + MotionEvent { ev_x = x, ev_y = y } <- getEvent xEv + return (fromIntegral x, fromIntegral y) + + io $ ungrabPointer d currentTime + + return ret + submapButtonsWithKey :: ((ButtonMask, Button) -> Window -> X ()) -> (Map (ButtonMask, Button) (Window -> X ())) -> Window -> X () submapButtonsWithKey defaultAction actions window = do |