Mercurial > dwindows
changeset 1471:26dbd11399d6
Don't attempt to set windows to an invalid size on GTK when
a very small or 0 size is requested.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 20 Dec 2011 15:05:14 +0000 |
parents | a317c2ec1d4c |
children | 1794caee0758 |
files | gtk/dw.c gtk3/dw.c |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/gtk/dw.c Tue Dec 20 14:30:10 2011 +0000 +++ b/gtk/dw.c Tue Dec 20 15:05:14 2011 +0000 @@ -10251,8 +10251,11 @@ gtk_object_set_data(GTK_OBJECT(handle), "_dw_height", GINT_TO_POINTER(height)); } /* Resize minus the border size */ - gdk_window_resize(handle->window, width - cx , height - cy ); - gtk_window_set_default_size(GTK_WINDOW(handle), width - cx, height - cy ); + if(width > cx && height > cy) + { + gdk_window_resize(handle->window, width - cx , height - cy ); + gtk_window_set_default_size(GTK_WINDOW(handle), width - cx, height - cy ); + } } else gtk_widget_set_usize(handle, width, height);
--- a/gtk3/dw.c Tue Dec 20 14:30:10 2011 +0000 +++ b/gtk3/dw.c Tue Dec 20 15:05:14 2011 +0000 @@ -8618,7 +8618,7 @@ { /* Check if we have cached frame size values */ if(!((cx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_width"))) | - (cy = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_height"))))) + (cy = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_height"))))) { /* If not try to ask the window manager for the estimated size... * and finally if all else fails, guess. @@ -8633,8 +8633,11 @@ g_object_set_data(G_OBJECT(handle), "_dw_height", GINT_TO_POINTER(height)); } /* Resize minus the border size */ - gtk_window_resize(GTK_WINDOW(handle), width - cx , height - cy ); - gtk_window_set_default_size(GTK_WINDOW(handle), width - cx, height - cy); + if(width > cx && height > cy) + { + gtk_window_resize(GTK_WINDOW(handle), width - cx , height - cy ); + gtk_window_set_default_size(GTK_WINDOW(handle), width - cx, height - cy); + } } else gtk_widget_set_size_request(handle, width, height);