From f5f20efe0db75b472e1d6f2f96f56173c056b134 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Wed, 25 Sep 2002 01:20:44 +0000 Subject: [PATCH] update best_overlap as we go through the loop - doh. Fix from 2002-09-24 Havoc Pennington * src/place.c (fit_rect_in_xinerama): update best_overlap as we go through the loop - doh. Fix from readams@hmc.edu for #90799. (find_first_fit): try the origin of each xinerama screen after the first. Also from readams@hmc.edu --- ChangeLog | 7 +++++++ src/place.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bf726abb9..51a2f4fff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-09-24 Havoc Pennington + + * src/place.c (fit_rect_in_xinerama): update best_overlap as we go + through the loop - doh. Fix from readams@hmc.edu for #90799. + (find_first_fit): try the origin of each xinerama screen + after the first. Also from readams@hmc.edu + 2002-09-24 Havoc Pennington * src/window.c (meta_window_save_rect): new function, diff --git a/src/place.c b/src/place.c index 8da2be8b6..3331409a9 100644 --- a/src/place.c +++ b/src/place.c @@ -374,7 +374,10 @@ fit_rect_in_xinerama (MetaScreen *screen, overlap = 0; if (overlap > best_overlap) - best_index = i; + { + best_index = i; + best_overlap = overlap; + } ++i; } @@ -425,6 +428,7 @@ find_first_fit (MetaWindow *window, GList *sorted; GList *tmp; MetaRectangle rect; + int i; retval = FALSE; sorted = NULL; @@ -527,6 +531,31 @@ find_first_fit (MetaWindow *window, tmp = tmp->next; } + + /* Origin of each Xinerama screen which isn't the first */ + i = 1; + while (i < window->screen->n_xinerama_infos) + { + rect.x = window->screen->xinerama_infos[i].x_origin; + rect.y = window->screen->xinerama_infos[i].y_origin; + + if (fit_rect_in_xinerama (window->screen, &rect) && + !rectangle_overlaps_some_window (&rect, windows)) + { + *new_x = rect.x; + *new_y = rect.y; + if (fgeom) + { + *new_x += fgeom->left_width; + *new_y += fgeom->top_height; + } + + retval = TRUE; + + goto out; + } + ++i; + } out: g_list_free (sorted);