From f3b1977043a8736ac856d4477b485ee441a4342f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 17 Sep 2013 05:32:29 +0200 Subject: 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. --- MetaTile/Layout/Floating.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'MetaTile/Layout') 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) -- cgit v1.2.3