From 533b5fea6d46fefea441c86d54d8adbfb99dd039 Mon Sep 17 00:00:00 2001 From: Jason Creighton Date: Wed, 4 Apr 2007 04:16:12 +0200 Subject: take window borders into account when resizing (requires latest X11-extras) darcs-hash:20070404021612-b9aa7-842163845e3969d9f5446065bc3fe57606501a48 --- Operations.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Operations.hs') diff --git a/Operations.hs b/Operations.hs index 889d03c..994843b 100644 --- a/Operations.hs +++ b/Operations.hs @@ -31,7 +31,7 @@ refresh = do flip mapM_ (M.assocs ws2sc) $ \(n, scn) -> do let sc = xinesc !! scn fl = M.findWithDefault dfltfl n fls - mapM_ (\(w, Rectangle a b c e) -> io $ moveResizeWindow d w a b c e) $ + mapM_ (\(w, rect) -> io $ moveWindowInside d w rect) $ case layoutType fl of Full -> fmap (flip (,) sc) $ maybeToList $ W.peekStack n ws Tall -> tile (tileFraction fl) sc $ W.index n ws @@ -113,6 +113,15 @@ setButtonGrab False w = withDisplay $ \d -> io $ flip mapM_ buttonsToGrab $ \b -> ungrabButton d b anyModifier w +-- | moveWindowInside. Moves and resizes w such that it fits inside the given +-- rectangle, including its border. +moveWindowInside :: Display -> Window -> Rectangle -> IO () +moveWindowInside d w r = do + bw <- (fromIntegral . waBorderWidth) `liftM` getWindowAttributes d w + moveResizeWindow d w (rect_x r) (rect_y r) + (rect_width r - bw*2) + (rect_height r - bw*2) + -- | manage. Add a new window to be managed in the current workspace. Bring it into focus. -- If the window is already under management, it is just raised. -- -- cgit v1.2.3