diff options
author | robreim <robreim@bobturf.org> | 2008-05-11 11:40:56 +0200 |
---|---|---|
committer | robreim <robreim@bobturf.org> | 2008-05-11 11:40:56 +0200 |
commit | 489eb44274ce281158d1d3d77260db41bb4204d0 (patch) | |
tree | 044422ba10010f36495d057881cdd749fc50d3b7 | |
parent | d31b181870fdff84bc19a1153b2b5793d1fe5b64 (diff) | |
download | XMonadContrib-489eb44274ce281158d1d3d77260db41bb4204d0.tar.gz XMonadContrib-489eb44274ce281158d1d3d77260db41bb4204d0.tar.xz XMonadContrib-489eb44274ce281158d1d3d77260db41bb4204d0.zip |
Fix window region checking in UpdatePointer
darcs-hash:20080511094056-d4c7e-6145e3a96972b1be277f633c7d4ac7c7dcd74804.gz
-rw-r--r-- | XMonad/Actions/UpdatePointer.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/XMonad/Actions/UpdatePointer.hs b/XMonad/Actions/UpdatePointer.hs index b2751bf..6761506 100644 --- a/XMonad/Actions/UpdatePointer.hs +++ b/XMonad/Actions/UpdatePointer.hs @@ -60,9 +60,9 @@ updatePointer p = withFocused $ \w -> do root <- asks theRoot mouseIsMoving <- asks mouseFocused wa <- io $ getWindowAttributes dpy w - (_sameRoot,_,w',rootx,rooty,_,_,_) <- io $ queryPointer dpy root - -- Can sameRoot ever be false in this case? I'm going to assume not - unless (w == w' || mouseIsMoving) $ + (_sameRoot,_,_,rootx,rooty,_,_,_) <- io $ queryPointer dpy root + unless (pointWithinRegion rootx rooty (wa_x wa) (wa_y wa) (wa_width wa) (wa_height wa) + || mouseIsMoving) $ case p of Nearest -> do let x = moveWithin rootx (wa_x wa) ((wa_x wa) + (wa_width wa)) @@ -81,3 +81,9 @@ moveWithin current lower upper = then upper else current +-- Test that a point resides within a region. +-- This belongs somewhere more generally accessible than this module. +pointWithinRegion :: Integral a => a -> a -> a -> a -> a -> a -> Bool +pointWithinRegion px py rx ry rw rh = + within px rx (rx + rw) && within py ry (ry + rh) + where within x left right = x >= left && x <= right |