comparison gtk3/dw.c @ 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
comparison
equal deleted inserted replaced
1470:a317c2ec1d4c 1471:26dbd11399d6
8616 } 8616 }
8617 else 8617 else
8618 { 8618 {
8619 /* Check if we have cached frame size values */ 8619 /* Check if we have cached frame size values */
8620 if(!((cx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_width"))) | 8620 if(!((cx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_width"))) |
8621 (cy = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_height"))))) 8621 (cy = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_frame_height")))))
8622 { 8622 {
8623 /* If not try to ask the window manager for the estimated size... 8623 /* If not try to ask the window manager for the estimated size...
8624 * and finally if all else fails, guess. 8624 * and finally if all else fails, guess.
8625 */ 8625 */
8626 _dw_get_frame_extents(handle, &cy, &cx); 8626 _dw_get_frame_extents(handle, &cy, &cx);
8631 /* Save the size for when it is shown */ 8631 /* Save the size for when it is shown */
8632 g_object_set_data(G_OBJECT(handle), "_dw_width", GINT_TO_POINTER(width)); 8632 g_object_set_data(G_OBJECT(handle), "_dw_width", GINT_TO_POINTER(width));
8633 g_object_set_data(G_OBJECT(handle), "_dw_height", GINT_TO_POINTER(height)); 8633 g_object_set_data(G_OBJECT(handle), "_dw_height", GINT_TO_POINTER(height));
8634 } 8634 }
8635 /* Resize minus the border size */ 8635 /* Resize minus the border size */
8636 gtk_window_resize(GTK_WINDOW(handle), width - cx , height - cy ); 8636 if(width > cx && height > cy)
8637 gtk_window_set_default_size(GTK_WINDOW(handle), width - cx, height - cy); 8637 {
8638 gtk_window_resize(GTK_WINDOW(handle), width - cx , height - cy );
8639 gtk_window_set_default_size(GTK_WINDOW(handle), width - cx, height - cy);
8640 }
8638 } 8641 }
8639 else 8642 else
8640 gtk_widget_set_size_request(handle, width, height); 8643 gtk_widget_set_size_request(handle, width, height);
8641 DW_MUTEX_UNLOCK; 8644 DW_MUTEX_UNLOCK;
8642 } 8645 }