Only open new windows on the current xinerama. Closes #145503, for now.

2007-06-18  Thomas Thurman  <thomas@thurman.org.uk>

        * src/place.c (find_first_fit, meta_window_place): Only open new
        windows on the current xinerama. Closes #145503, for now.


svn path=/trunk/; revision=3247
This commit is contained in:
Thomas Thurman 2007-06-18 11:46:44 +00:00 committed by Thomas James Alexander Thurman
parent e6083f64fb
commit 7c4af65ec1
2 changed files with 86 additions and 145 deletions

View File

@ -1,3 +1,8 @@
2007-06-18 Thomas Thurman <thomas@thurman.org.uk>
* src/place.c (find_first_fit, meta_window_place): Only open new
windows on the current xinerama. Closes #145503, for now.
2007-06-17 Thomas Thurman <thomas@thurman.org.uk> 2007-06-17 Thomas Thurman <thomas@thurman.org.uk>
* src/screen.[ch] (meta_screen_apply_startup_properties): return a * src/screen.[ch] (meta_screen_apply_startup_properties): return a

View File

@ -500,8 +500,7 @@ find_first_fit (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameGeometry *fgeom,
/* visible windows on relevant workspaces */ /* visible windows on relevant workspaces */
GList *windows, GList *windows,
int* xineramas_list, int xinerama,
int n_xineramas,
int x, int x,
int y, int y,
int *new_x, int *new_x,
@ -520,7 +519,6 @@ find_first_fit (MetaWindow *window,
GList *tmp; GList *tmp;
MetaRectangle rect; MetaRectangle rect;
MetaRectangle work_area; MetaRectangle work_area;
int i;
retval = FALSE; retval = FALSE;
@ -543,107 +541,98 @@ find_first_fit (MetaWindow *window,
rect.height += fgeom->top_height + fgeom->bottom_height; rect.height += fgeom->top_height + fgeom->bottom_height;
} }
for (i = 0; i < n_xineramas; i++)
{
#ifdef WITH_VERBOSE_MODE #ifdef WITH_VERBOSE_MODE
{
char xinerama_location_string[RECT_LENGTH]; char xinerama_location_string[RECT_LENGTH];
meta_rectangle_to_string (&window->screen->xinerama_infos[xineramas_list[i]].rect, meta_rectangle_to_string (&window->screen->xinerama_infos[xinerama].rect,
xinerama_location_string); xinerama_location_string);
meta_topic (META_DEBUG_XINERAMA, meta_topic (META_DEBUG_XINERAMA,
"Natural xinerama %d is %s\n", "Natural xinerama is %s\n",
i,
xinerama_location_string); xinerama_location_string);
}
#endif #endif
}
/* try each xinerama in the natural ordering in turn */ meta_window_get_work_area_for_xinerama (window, xinerama, &work_area);
i = 0;
while (i < n_xineramas)
{
meta_window_get_work_area_for_xinerama (window, xineramas_list[i], &work_area);
center_tile_rect_in_area (&rect, &work_area); center_tile_rect_in_area (&rect, &work_area);
if (meta_rectangle_contains_rect (&work_area, &rect) && if (meta_rectangle_contains_rect (&work_area, &rect) &&
!rectangle_overlaps_some_window (&rect, windows)) !rectangle_overlaps_some_window (&rect, windows))
{ {
*new_x = rect.x; *new_x = rect.x;
*new_y = rect.y; *new_y = rect.y;
if (fgeom) if (fgeom)
{ {
*new_x += fgeom->left_width; *new_x += fgeom->left_width;
*new_y += fgeom->top_height; *new_y += fgeom->top_height;
} }
retval = TRUE; retval = TRUE;
goto out; goto out;
} }
/* try below each window */ /* try below each window */
tmp = below_sorted; tmp = below_sorted;
while (tmp != NULL) while (tmp != NULL)
{ {
MetaWindow *w = tmp->data; MetaWindow *w = tmp->data;
MetaRectangle outer_rect; MetaRectangle outer_rect;
meta_window_get_outer_rect (w, &outer_rect); meta_window_get_outer_rect (w, &outer_rect);
rect.x = outer_rect.x; rect.x = outer_rect.x;
rect.y = outer_rect.y + outer_rect.height; rect.y = outer_rect.y + outer_rect.height;
if (meta_rectangle_contains_rect (&work_area, &rect) && if (meta_rectangle_contains_rect (&work_area, &rect) &&
!rectangle_overlaps_some_window (&rect, below_sorted)) !rectangle_overlaps_some_window (&rect, below_sorted))
{ {
*new_x = rect.x; *new_x = rect.x;
*new_y = rect.y; *new_y = rect.y;
if (fgeom) if (fgeom)
{ {
*new_x += fgeom->left_width; *new_x += fgeom->left_width;
*new_y += fgeom->top_height; *new_y += fgeom->top_height;
} }
retval = TRUE; retval = TRUE;
goto out; goto out;
} }
tmp = tmp->next; tmp = tmp->next;
} }
/* try to the right of each window */ /* try to the right of each window */
tmp = right_sorted; tmp = right_sorted;
while (tmp != NULL) while (tmp != NULL)
{ {
MetaWindow *w = tmp->data; MetaWindow *w = tmp->data;
MetaRectangle outer_rect; MetaRectangle outer_rect;
meta_window_get_outer_rect (w, &outer_rect); meta_window_get_outer_rect (w, &outer_rect);
rect.x = outer_rect.x + outer_rect.width; rect.x = outer_rect.x + outer_rect.width;
rect.y = outer_rect.y; rect.y = outer_rect.y;
if (meta_rectangle_contains_rect (&work_area, &rect) && if (meta_rectangle_contains_rect (&work_area, &rect) &&
!rectangle_overlaps_some_window (&rect, right_sorted)) !rectangle_overlaps_some_window (&rect, right_sorted))
{ {
*new_x = rect.x; *new_x = rect.x;
*new_y = rect.y; *new_y = rect.y;
if (fgeom) if (fgeom)
{ {
*new_x += fgeom->left_width; *new_x += fgeom->left_width;
*new_y += fgeom->top_height; *new_y += fgeom->top_height;
} }
retval = TRUE; retval = TRUE;
goto out; goto out;
} }
tmp = tmp->next; tmp = tmp->next;
} }
++i;
}
out: out:
@ -662,10 +651,6 @@ meta_window_place (MetaWindow *window,
{ {
GList *windows; GList *windows;
const MetaXineramaScreenInfo *xi; const MetaXineramaScreenInfo *xi;
int* xineramas_list = NULL;
int n_xineramas;
int i;
int placed_on = -1;
/* frame member variables should NEVER be used in here, only /* frame member variables should NEVER be used in here, only
* MetaFrameGeometry. But remember fgeom == NULL * MetaFrameGeometry. But remember fgeom == NULL
@ -793,10 +778,6 @@ meta_window_place (MetaWindow *window,
} }
} }
meta_screen_get_natural_xinerama_list (window->screen,
&xineramas_list,
&n_xineramas);
/* FIXME UTILITY with transient set should be stacked up /* FIXME UTILITY with transient set should be stacked up
* on the sides of the parent window or something. * on the sides of the parent window or something.
*/ */
@ -861,54 +842,10 @@ meta_window_place (MetaWindow *window,
y = xi->rect.y; y = xi->rect.y;
if (find_first_fit (window, fgeom, windows, if (find_first_fit (window, fgeom, windows,
xineramas_list, n_xineramas, xi->number,
x, y, &x, &y)) x, y, &x, &y))
goto done_check_denied_focus; goto done_check_denied_focus;
/* This is a special-case origin-cascade so that windows that are
* too large to fit onto a workspace (and which will be
* automaximized later) will go onto an empty xinerama if one is
* available.
*/
if (window->has_maximize_func && window->decorated &&
!window->fullscreen)
{
if (window->frame)
{
x = fgeom->left_width;
y = fgeom->top_height;
}
else
{
x = 0;
y = 0;
}
for (i = 0; i < n_xineramas; i++)
{
MetaRectangle work_area;
meta_window_get_work_area_for_xinerama (window, xineramas_list[i], &work_area);
if (!rectangle_overlaps_some_window (&work_area, windows))
{
x += work_area.x;
y += work_area.y;
placed_on = i;
break;
}
}
}
/* if the window wasn't placed at the origin of an empty xinerama,
* cascade it onto the current xinerama
*/
if (placed_on == -1)
{
find_next_cascade (window, fgeom, windows, x, y, &x, &y);
placed_on = window->screen->last_xinerama_index;
}
/* Maximize windows if they are too big for their work area (bit of /* Maximize windows if they are too big for their work area (bit of
* a hack here). Assume undecorated windows probably don't intend to * a hack here). Assume undecorated windows probably don't intend to
* be maximized. * be maximized.
@ -920,7 +857,7 @@ meta_window_place (MetaWindow *window,
MetaRectangle outer; MetaRectangle outer;
meta_window_get_work_area_for_xinerama (window, meta_window_get_work_area_for_xinerama (window,
xineramas_list[placed_on], xi->number,
&workarea); &workarea);
meta_window_get_outer_rect (window, &outer); meta_window_get_outer_rect (window, &outer);
@ -967,7 +904,7 @@ meta_window_place (MetaWindow *window,
y = xi->rect.y; y = xi->rect.y;
found_fit = find_first_fit (window, fgeom, focus_window_list, found_fit = find_first_fit (window, fgeom, focus_window_list,
xineramas_list, n_xineramas, xi->number,
x, y, &x, &y); x, y, &x, &y);
g_list_free (focus_window_list); g_list_free (focus_window_list);
} }
@ -980,7 +917,6 @@ meta_window_place (MetaWindow *window,
} }
done: done:
g_free (xineramas_list);
g_list_free (windows); g_list_free (windows);
done_no_constraints: done_no_constraints: