forked from AuroraMiddleware/gtk
window: Don't assume 640x480 max default size
Instead, use the monitor's work area. This might have unforseen side effects that warrant a later revert, such as: - Apparently some WMs assume maximizing when a window is maximum screen size. - WMs might not shrink the window by the decorations' size when it tries to be fullscreen. - Applications might have buggy size request code that causes weirdly sized windows.
This commit is contained in:
parent
8308f4c1e9
commit
f18655c641
@ -5728,13 +5728,6 @@ gtk_window_unmap (GtkWidget *widget)
|
|||||||
* information from the windowing system.)
|
* information from the windowing system.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* We use these for now to not make windows too big by accident. Note
|
|
||||||
* that we still clamp these numbers by screen size. Also note that
|
|
||||||
* minimum size still overrides this. So keep your windows small! :)
|
|
||||||
*/
|
|
||||||
#define MAX_DEFAULT_WINDOW_WIDTH 640
|
|
||||||
#define MAX_DEFAULT_WINDOW_HEIGHT 480
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_window_guess_default_size (GtkWindow *window,
|
gtk_window_guess_default_size (GtkWindow *window,
|
||||||
gint *width,
|
gint *width,
|
||||||
@ -5742,27 +5735,31 @@ gtk_window_guess_default_size (GtkWindow *window,
|
|||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
GdkWindow *gdkwindow;
|
||||||
|
GdkRectangle workarea;
|
||||||
int minimum, natural;
|
int minimum, natural;
|
||||||
|
|
||||||
widget = GTK_WIDGET (window);
|
widget = GTK_WIDGET (window);
|
||||||
screen = gtk_widget_get_screen (widget);
|
screen = gtk_widget_get_screen (widget);
|
||||||
|
gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
|
||||||
|
|
||||||
*width = gdk_screen_get_width (screen);
|
if (gdkwindow)
|
||||||
*height = gdk_screen_get_height (screen);
|
|
||||||
|
|
||||||
if (*width >= *height)
|
|
||||||
{
|
{
|
||||||
/* landscape */
|
gdk_screen_get_monitor_workarea (screen,
|
||||||
*width = MIN (*width, MAX_DEFAULT_WINDOW_WIDTH);
|
gdk_screen_get_monitor_at_window (screen, gdkwindow),
|
||||||
*height = MIN (*height, MAX_DEFAULT_WINDOW_HEIGHT);
|
&workarea);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* portrait */
|
/* XXX: Figure out what screen we appear on */
|
||||||
*width = MIN (*width, MAX_DEFAULT_WINDOW_HEIGHT);
|
gdk_screen_get_monitor_workarea (screen,
|
||||||
*height = MIN (*height, MAX_DEFAULT_WINDOW_WIDTH);
|
0,
|
||||||
|
&workarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*width = workarea.width;
|
||||||
|
*height = workarea.height;
|
||||||
|
|
||||||
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT)
|
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT)
|
||||||
{
|
{
|
||||||
gtk_widget_get_preferred_height (widget, &minimum, &natural);
|
gtk_widget_get_preferred_height (widget, &minimum, &natural);
|
||||||
|
Loading…
Reference in New Issue
Block a user