From 0a0c2391dec6e4230c09f3c049194ddf84be48ce Mon Sep 17 00:00:00 2001 From: "Carlos R. Mafra" Date: Thu, 17 Sep 2009 00:18:56 +0200 Subject: [PATCH] Maximus: Avoid a window list order issue If we compute the maximus geometry in only one pass through the window list, the order in which the windows appear in the list can affect the outcome. That is because before computing the intersections in the y-projections we update the y coordinates from whatever window which happened to change the new_y coordinate during the previous x-intersection computations, but that may not be _the_ blocking window which decides the final positions in the y axis. Therefore we may find that this "intermediate window state" has a non-vanishing y-intersection with another one -- and be blocked by it -- even though that should not be the case for the final outcome. So to avoid that we first scan through all the windows to decide the final maximumized coordinates in the y axis. Only after that we compute the x-coordinates. --- src/actions.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/actions.c b/src/actions.c index 1a383f29..c9c8070e 100644 --- a/src/actions.c +++ b/src/actions.c @@ -474,6 +474,26 @@ static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x, i new_botton_0 = top_j; } } + } + + tmp = wwin; + while (tmp->prev) { + /* ignore windows in other workspaces or minimized */ + if (tmp->prev->frame->workspace != wwin->screen_ptr->current_workspace + || tmp->prev->flags.miniaturized) { + tmp = tmp->prev; + continue; + } + tmp = tmp->prev; + + /* set the w_j window coordinates */ + x_j = tmp->frame_x; + y_j = tmp->frame_y; + width_j = tmp->frame->core->width; + height_j = tmp->frame->core->height; + botton_j = y_j + height_j; + top_j = y_j; + right_border_j = x_j + width_j; /* * Use the updated y coordinates from the above step to account