mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
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:
parent
23cefa0bb5
commit
b908e45208
@ -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>
|
||||
|
||||
* src/metacity-dialog.c (main): option to display error when a
|
||||
|
23
src/place.c
23
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)
|
||||
{
|
||||
|
18
src/window.c
18
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user