diff --git a/ChangeLog b/ChangeLog index 3e123136a..ea7d92b5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-07-12 Havoc Pennington + + * 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 * src/metacity-dialog.c (main): option to display error when a diff --git a/src/place.c b/src/place.c index 76191e6d5..023ff7dac 100644 --- a/src/place.c +++ b/src/place.c @@ -160,16 +160,33 @@ find_next_cascade (MetaWindow *window, cascade_y = wy; } else - goto found; /* no window at this cascade point. */ + { + /* Keep searching for a further-down-the-diagonal window. */ + } 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); + /* 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. */ if (fgeom == NULL) { diff --git a/src/window.c b/src/window.c index 838c95867..882f9770c 100644 --- a/src/window.c +++ b/src/window.c @@ -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 */ meta_stack_thaw (window->screen->stack);