try to maximize windows that are too big for the work area

2002-07-12  Havoc Pennington  <hp@redhat.com>

	* src/window.c (meta_window_new): try to maximize windows that
	are too big for the work area

	* src/place.c (find_next_cascade): don't let the cascade algorithm
	place windows off the screen, and fix it to always exhaustively
	search the window list for cascade parents.
This commit is contained in:
Havoc Pennington 2002-07-12 23:03:40 +00:00 committed by Havoc Pennington
parent 23cefa0bb5
commit b908e45208
3 changed files with 47 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2002-07-12 Havoc Pennington <hp@redhat.com>
* src/window.c (meta_window_new): try to maximize windows that
are too big for the work area
* src/place.c (find_next_cascade): don't let the cascade algorithm
place windows off the screen, and fix it to always exhaustively
search the window list for cascade parents.
2002-07-11 Havoc Pennington <hp@pobox.com> 2002-07-11 Havoc Pennington <hp@pobox.com>
* src/metacity-dialog.c (main): option to display error when a * src/metacity-dialog.c (main): option to display error when a

View File

@ -160,16 +160,33 @@ find_next_cascade (MetaWindow *window,
cascade_y = wy; cascade_y = wy;
} }
else else
goto found; /* no window at this cascade point. */ {
/* Keep searching for a further-down-the-diagonal window. */
}
tmp = tmp->next; tmp = tmp->next;
} }
/* cascade_x and cascade_y will match the last window in the list. */ /* cascade_x and cascade_y will match the last window in the list
* that was "in the way" (in the approximate cascade diagonal)
*/
found:
g_list_free (sorted); g_list_free (sorted);
/* don't place windows off the screen */
if (((cascade_x + (window->frame ? window->frame->rect.width : window->rect.width)) >
(work_area.x + work_area.width)) ||
((cascade_y + (window->frame ? window->frame->rect.height : window->rect.height)) >
(work_area.y + work_area.height)))
{
/* FIXME it would be better to try to start a new cascade to the
* right of the last one, probably. Instead of just falling back
* to "origin"
*/
cascade_x = MAX (0, work_area.x);
cascade_y = MAX (0, work_area.y);
}
/* Convert coords to position of window, not position of frame. */ /* Convert coords to position of window, not position of frame. */
if (fgeom == NULL) if (fgeom == NULL)
{ {

View File

@ -609,6 +609,24 @@ meta_window_new (MetaDisplay *display, Window xwindow,
} }
} }
/* Maximize windows if they are too big for their work
* area (bit of a hack here). Assume undecorated windows
* probably don't intend to be maximized.
*/
if (window->has_maximize_func && window->decorated)
{
MetaRectangle workarea;
MetaRectangle outer;
meta_window_get_work_area (window, TRUE, &workarea);
meta_window_get_outer_rect (window, &outer);
if (outer.width >= workarea.width &&
outer.height >= workarea.height)
meta_window_maximize (window);
}
/* Sync stack changes */ /* Sync stack changes */
meta_stack_thaw (window->screen->stack); meta_stack_thaw (window->screen->stack);