diff options
| author | Josh Rahm <rahm@google.com> | 2022-03-18 17:47:40 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:45 -0600 |
| commit | 1edf73036adf0f17e6ac4808a2a35d768d80db86 (patch) | |
| tree | ad1277c42eef73aaf6208713520b52e332fb29ab /src/Internal/Submap.hs | |
| parent | 395ed34bf02faf2c05c84101ab63f4917ca1aed9 (diff) | |
| download | rde-1edf73036adf0f17e6ac4808a2a35d768d80db86.tar.gz rde-1edf73036adf0f17e6ac4808a2a35d768d80db86.tar.bz2 rde-1edf73036adf0f17e6ac4808a2a35d768d80db86.zip | |
Add experimental motion events. Not super useful at the moment, but might be in the future.
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 |