From cf0f7d68d554cf5044d00d1d679a32dd9f3abd3a Mon Sep 17 00:00:00 2001 From: Nicolas Bonifas Date: Sun, 13 Sep 2009 22:28:40 +0200 Subject: [PATCH] Un-maximize window inside current head If the old_geometry coordinates were saved while the window was in another xinerama head, use current coordinates as the old ones to avoid making the window jump heads when un-maximizing it. --- src/actions.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/actions.c b/src/actions.c index 91686935..85412e87 100644 --- a/src/actions.c +++ b/src/actions.c @@ -499,6 +499,9 @@ static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x, i void wUnmaximizeWindow(WWindow * wwin) { int x, y, w, h; + WMRect old_geom_rect; + int old_head; + Bool same_head; if (!wwin->flags.maximized) return; @@ -508,8 +511,11 @@ void wUnmaximizeWindow(WWindow * wwin) wUnshadeWindow(wwin); } /* Use old coordinates if they are set, current values otherwise */ - x = wwin->old_geometry.x ? wwin->old_geometry.x : wwin->frame_x; - y = wwin->old_geometry.y ? wwin->old_geometry.y : wwin->frame_y; + old_geom_rect = wmkrect(wwin->old_geometry.x, wwin->old_geometry.y, wwin->old_geometry.width, wwin->old_geometry.height); + old_head = wGetHeadForRect(wwin->screen_ptr, old_geom_rect); + same_head = (wGetHeadForWindow(wwin) == old_head); + x = (wwin->old_geometry.x && same_head) ? wwin->old_geometry.x : wwin->frame_x; + y = (wwin->old_geometry.y && same_head) ? wwin->old_geometry.y : wwin->frame_y; w = wwin->old_geometry.width ? wwin->old_geometry.width : wwin->client.width; h = wwin->old_geometry.height ? wwin->old_geometry.height : wwin->client.height; -- 2.11.4.GIT