summaryrefslogtreecommitdiffstats
path: root/MetaTile/Layout
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-09-17 05:32:29 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-09-17 05:32:29 +0200
commitf3b1977043a8736ac856d4477b485ee441a4342f (patch)
tree7c1aed57bcc08b37b1c4e4ec6233528ae35e6fd3 /MetaTile/Layout
parent7754569f8978dff5c7f6304295cafa487c42d318 (diff)
downloadmetatile-f3b1977043a8736ac856d4477b485ee441a4342f.tar
metatile-f3b1977043a8736ac856d4477b485ee441a4342f.zip
Keep track of the current desired frame bounds in the frame state
This saved a few round-trips to the X server and is preparation for the window confinement feature.
Diffstat (limited to 'MetaTile/Layout')
-rw-r--r--MetaTile/Layout/Floating.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/MetaTile/Layout/Floating.hs b/MetaTile/Layout/Floating.hs
index ac306d3..d317063 100644
--- a/MetaTile/Layout/Floating.hs
+++ b/MetaTile/Layout/Floating.hs
@@ -88,18 +88,18 @@ mouseMoveWindow :: Window -> X ()
mouseMoveWindow w = whenX (isClient w) $ withDisplay $ \d -> do
frame <- getsWindowState wsFrame w
io $ raiseWindow d frame
- wa <- io $ getWindowAttributes d frame
+ Just (Rectangle x y width height) <- getsFrameState fsBounds frame
(_, _, _, ox', oy', _, _, _) <- io $ queryPointer d frame
let ox = fromIntegral ox'
oy = fromIntegral oy'
- mouseDrag (\ex ey -> (io $ moveWindow d frame (fromIntegral (fromIntegral (wa_x wa) + (ex - ox))) (fromIntegral (fromIntegral (wa_y wa) + (ey - oy)))) >> reveal w) (float w)
+ mouseDrag (\ex ey -> tileWindow w (Rectangle (fromIntegral (fromIntegral x + (ex - ox))) (fromIntegral (fromIntegral y + (ey - oy))) width height) >> configure w) (float w)
-- | XXX comment me
mouseResizeWindow :: Window -> X ()
mouseResizeWindow w = whenX (isClient w) $ withDisplay $ \d -> do
frame <- getsWindowState wsFrame w
io $ raiseWindow d frame
- wa <- io $ getWindowAttributes d frame
+ Just (Rectangle x y width height) <- getsFrameState fsBounds frame
sh <- io $ getWMNormalHints d w
- io $ warpPointer d none frame 0 0 0 0 (fromIntegral (wa_width wa)) (fromIntegral (wa_height wa))
- mouseDrag (\ex ey -> (io $ resizeWindow d frame `uncurry` applySizeHintsContents sh (ex - fromIntegral (wa_x wa), ey - fromIntegral (wa_y wa))) >> reveal w) (float w)
+ io $ warpPointer d none frame 0 0 0 0 (fromIntegral width) (fromIntegral height)
+ mouseDrag (\ex ey -> tileWindow w (Rectangle x y `uncurry` applySizeHintsContents sh (ex - fromIntegral x, ey - fromIntegral y)) >> configure w) (float w)