diff options
author | Jason Creighton <jcreigh@gmail.com> | 2007-04-04 04:16:12 +0200 |
---|---|---|
committer | Jason Creighton <jcreigh@gmail.com> | 2007-04-04 04:16:12 +0200 |
commit | 533b5fea6d46fefea441c86d54d8adbfb99dd039 (patch) | |
tree | ef1fd75b19cc5c8211e602df7357c6971b8920d0 | |
parent | 59430332305db8667ff56314a647da40df13b64d (diff) | |
download | metatile-533b5fea6d46fefea441c86d54d8adbfb99dd039.tar metatile-533b5fea6d46fefea441c86d54d8adbfb99dd039.zip |
take window borders into account when resizing (requires latest X11-extras)
darcs-hash:20070404021612-b9aa7-842163845e3969d9f5446065bc3fe57606501a48
-rw-r--r-- | Operations.hs | 11 |
1 files changed, 10 insertions, 1 deletions
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. -- |