summaryrefslogtreecommitdiffstats
path: root/Operations.hs
diff options
context:
space:
mode:
authorDavid Roundy <droundy@darcs.net>2007-09-27 23:10:14 +0200
committerDavid Roundy <droundy@darcs.net>2007-09-27 23:10:14 +0200
commit97d8dc7ccd82389289efe93b53712467ff620b1a (patch)
treed60a713e53e039ffee21b0243e0f57491f56534b /Operations.hs
parent203b48d3cd264e85233d0f198fd8eec85e72c39d (diff)
downloadmetatile-97d8dc7ccd82389289efe93b53712467ff620b1a.tar
metatile-97d8dc7ccd82389289efe93b53712467ff620b1a.zip
put transients completely on the screen when possible.
darcs-hash:20070927211014-72aca-55414f2cf6b2aaff082c9032660d8b0aaaf57ba2
Diffstat (limited to 'Operations.hs')
-rw-r--r--Operations.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/Operations.hs b/Operations.hs
index 3deb4ad..ab585c7 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -55,7 +55,12 @@ manage w = whenX (fmap not $ isClient w) $ withDisplay $ \d -> do
isTransient <- isJust `liftM` io (getTransientForHint d w)
(sc, rr) <- floatLocation w
- let f ws | isFixedSize || isTransient = W.float w rr . W.insertUp w . W.view i $ ws
+ -- ensure that float windows don't go over the edge of the screen
+ let adjust (W.RationalRect x y wid h) | x + wid >= 1 || y + wid >= 1 || x <= 0 || y <= 0
+ = W.RationalRect (0.5 - wid/2) (0.5 - h/2) wid h
+ adjust r = r
+
+ let f ws | isFixedSize || isTransient = W.float w (adjust rr) . W.insertUp w . W.view i $ ws
| otherwise = W.insertUp w ws
where i = fromMaybe (W.tag . W.workspace . W.current $ ws) $ W.lookupWorkspace sc ws
windows f
@@ -512,10 +517,10 @@ floatLocation w = withDisplay $ \d -> do
let sc = fromMaybe (W.current ws) $ find (pointWithin (fi $ wa_x wa) (fi $ wa_y wa) . screenRect . W.screenDetail) $ W.screens ws
sr = screenRect . W.screenDetail $ sc
bw = fi . wa_border_width $ wa
- rr = (W.RationalRect ((fi (wa_x wa) - fi (rect_x sr)) % fi (rect_width sr))
- ((fi (wa_y wa) - fi (rect_y sr)) % fi (rect_height sr))
- (fi (wa_width wa + bw*2) % fi (rect_width sr))
- (fi (wa_height wa + bw*2) % fi (rect_height sr)))
+ rr = W.RationalRect ((fi (wa_x wa) - fi (rect_x sr)) % fi (rect_width sr))
+ ((fi (wa_y wa) - fi (rect_y sr)) % fi (rect_height sr))
+ (fi (wa_width wa + bw*2) % fi (rect_width sr))
+ (fi (wa_height wa + bw*2) % fi (rect_height sr))
return (W.screen $ sc, rr)
where fi x = fromIntegral x