1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

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.
This commit is contained in:
Nicolas Bonifas
2009-09-13 22:28:40 +02:00
committed by Carlos R. Mafra
parent 3106292f4b
commit cf0f7d68d5

View File

@@ -499,6 +499,9 @@ static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x, i
void wUnmaximizeWindow(WWindow * wwin) void wUnmaximizeWindow(WWindow * wwin)
{ {
int x, y, w, h; int x, y, w, h;
WMRect old_geom_rect;
int old_head;
Bool same_head;
if (!wwin->flags.maximized) if (!wwin->flags.maximized)
return; return;
@@ -508,8 +511,11 @@ void wUnmaximizeWindow(WWindow * wwin)
wUnshadeWindow(wwin); wUnshadeWindow(wwin);
} }
/* Use old coordinates if they are set, current values otherwise */ /* Use old coordinates if they are set, current values otherwise */
x = wwin->old_geometry.x ? wwin->old_geometry.x : wwin->frame_x; old_geom_rect = wmkrect(wwin->old_geometry.x, wwin->old_geometry.y, wwin->old_geometry.width, wwin->old_geometry.height);
y = wwin->old_geometry.y ? wwin->old_geometry.y : wwin->frame_y; 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; w = wwin->old_geometry.width ? wwin->old_geometry.width : wwin->client.width;
h = wwin->old_geometry.height ? wwin->old_geometry.height : wwin->client.height; h = wwin->old_geometry.height ? wwin->old_geometry.height : wwin->client.height;