X.L.Maximize: Make layout forget maximized window when it is closed

The X.L.Maximize layout modifier does not track whether the window it stores as
maximized does still exist.  The X server reuses window IDs.  As a result, I
was able to reproduce the following behaviour (e.g., by opening and closing
xpdf windows): Create a window, maximize it, close it without restoring it to
its normal state.  Open a new window with the same window ID (e.g., an xpdf
window after just closing an xpdf window).  The new window will open maximized,
which is not what one would expect.  This patch addresses this problem,
removing the ID of the maximized window from the layout when the maximized
window is closed.
This commit is contained in:
Norbert Zeh 2010-10-29 22:15:51 +00:00
parent 81d338952d
commit a73a61302c

View File

@ -64,12 +64,14 @@ instance LayoutModifier Maximize Window where
pureModifier (Maximize (Just target)) rect (Just (S.Stack focused _ _)) wrs = pureModifier (Maximize (Just target)) rect (Just (S.Stack focused _ _)) wrs =
if focused == target if focused == target
then (maxed ++ rest, Nothing) then (maxed ++ rest, Nothing)
else (rest ++ maxed, Nothing) else (rest ++ maxed, lay)
where where
(toMax, rest) = partition (\(w, _) -> w == target) wrs (toMax, rest) = partition (\(w, _) -> w == target) wrs
maxed = map (\(w, _) -> (w, maxRect)) toMax maxed = map (\(w, _) -> (w, maxRect)) toMax
maxRect = Rectangle (rect_x rect + 25) (rect_y rect + 25) maxRect = Rectangle (rect_x rect + 25) (rect_y rect + 25)
(rect_width rect - 50) (rect_height rect - 50) (rect_width rect - 50) (rect_height rect - 50)
lay | null maxed = Just (Maximize Nothing)
| otherwise = Nothing
pureModifier _ _ _ wrs = (wrs, Nothing) pureModifier _ _ _ wrs = (wrs, Nothing)
pureMess (Maximize mw) m = case fromMessage m of pureMess (Maximize mw) m = case fromMessage m of