Automaximize large windows on map

Windows that start up in a size that is almost as big as the workarea create
extra work for the user (resizing or maximizing) so save the user's time by
detecting such windows and automaximize them.

https://bugzilla.gnome.org/show_bug.cgi?id=671677
This commit is contained in:
Adel Gadllah 2012-03-15 20:42:11 +01:00
parent c39998efee
commit f2f500836e

View File

@ -57,7 +57,9 @@
#include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xcomposite.h>
/* Windows that unmaximize to a size bigger than that fraction of the workarea /* Windows that unmaximize to a size bigger than that fraction of the workarea
* will be scaled down to that size (while maintaining aspect ratio) */ * will be scaled down to that size (while maintaining aspect ratio).
* Windows that cover an area greater then this size are automaximized on map.
*/
#define MAX_UNMAXIMIZED_WINDOW_AREA .8 #define MAX_UNMAXIMIZED_WINDOW_AREA .8
static int destroying_windows_disallowed = 0; static int destroying_windows_disallowed = 0;
@ -3013,7 +3015,20 @@ meta_window_show (MetaWindow *window)
} }
if (!window->placed) if (!window->placed)
{
if (window->showing_for_first_time)
{
MetaRectangle work_area;
meta_window_get_work_area_for_monitor (window, window->monitor->number, &work_area);
/* Automaximize windows that map with a size > MAX_UNMAXIMIZED_WINDOW_AREA of the work area */
if (window->rect.width * window->rect.height > work_area.width * work_area.height * MAX_UNMAXIMIZED_WINDOW_AREA)
{
window->maximize_horizontally_after_placement = TRUE;
window->maximize_vertically_after_placement = TRUE;
}
}
meta_window_force_placement (window); meta_window_force_placement (window);
}
if (needs_stacking_adjustment) if (needs_stacking_adjustment)
{ {