mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-14 19:45:44 -07:00
Merge pull request #446 from liskin/floatloc-size-hints
X.Operations: Apply size hints in floatLocation
This commit is contained in:
@@ -14,6 +14,10 @@
|
||||
|
||||
* `Tall` does not draw windows with zero area.
|
||||
|
||||
* `XMonad.Operations.floatLocation` now applies size hints. This means windows
|
||||
will snap to these hints as soon as they're floated (mouse move, keybinding).
|
||||
Previously that only happened on mouse resize.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Duplicated floats (e.g. from X.A.CopyToAll) no longer escape to inactive
|
||||
|
@@ -704,6 +704,7 @@ floatLocation w =
|
||||
|
||||
where go = withDisplay $ \d -> do
|
||||
ws <- gets windowset
|
||||
sh <- io $ getWMNormalHints d w
|
||||
wa <- io $ getWindowAttributes d w
|
||||
let bw = (fromIntegral . wa_border_width) wa
|
||||
point_sc <- pointScreen (fi $ wa_x wa) (fi $ wa_y wa)
|
||||
@@ -718,13 +719,14 @@ floatLocation w =
|
||||
sr = screenRect . W.screenDetail $ sc
|
||||
x = (fi (wa_x wa) - fi (rect_x sr)) % fi (rect_width sr)
|
||||
y = (fi (wa_y wa) - fi (rect_y sr)) % fi (rect_height sr)
|
||||
width = fi (wa_width wa + bw*2) % fi (rect_width sr)
|
||||
height = fi (wa_height wa + bw*2) % fi (rect_height sr)
|
||||
(width, height) = applySizeHintsContents sh (wa_width wa, wa_height wa)
|
||||
rwidth = fi (width + bw*2) % fi (rect_width sr)
|
||||
rheight = fi (height + bw*2) % fi (rect_height sr)
|
||||
-- adjust x/y of unmanaged windows if we ignored or didn't get pointScreen,
|
||||
-- it might be out of bounds otherwise
|
||||
rr = if managed || point_sc `sr_eq` Just sc
|
||||
then W.RationalRect x y width height
|
||||
else W.RationalRect (0.5 - width/2) (0.5 - height/2) width height
|
||||
then W.RationalRect x y rwidth rheight
|
||||
else W.RationalRect (0.5 - rwidth/2) (0.5 - rheight/2) rwidth rheight
|
||||
|
||||
return (W.screen sc, rr)
|
||||
|
||||
|
Reference in New Issue
Block a user