Mercurial > dwindows
comparison gtk/dw.c @ 1480:559f434dcfbd
FIXME: Similar fix for GTK2 of the GTK3 fix for gdk_window_get_frame_extents()
returning a bogus 200x200 result... Seems to be an issue with mutter the Gnome 3
window manager. Hopefully I can find a better way to workaround this issue.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 22 Dec 2011 12:20:52 +0000 |
parents | 1d414e81a099 |
children | 1ad57598f9cb |
comparison
equal
deleted
inserted
replaced
1479:1d414e81a099 | 1480:559f434dcfbd |
---|---|
10382 if(GTK_IS_WINDOW(handle)) | 10382 if(GTK_IS_WINDOW(handle)) |
10383 { | 10383 { |
10384 #if GTK_MAJOR_VERSION > 1 | 10384 #if GTK_MAJOR_VERSION > 1 |
10385 int horz = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_grav_horz")); | 10385 int horz = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_grav_horz")); |
10386 int vert = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_grav_vert")); | 10386 int vert = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_grav_vert")); |
10387 int cx = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_frame_width")); | |
10388 int cy = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_frame_height")); | |
10387 int newx = x, newy = y, width = 0, height = 0; | 10389 int newx = x, newy = y, width = 0, height = 0; |
10388 | 10390 |
10389 /* If the window is mapped */ | 10391 /* If the window is mapped */ |
10390 if(handle->window && GTK_WIDGET_MAPPED(handle)) | 10392 if(handle->window && GTK_WIDGET_MAPPED(handle)) |
10391 { | 10393 { |
10392 /* If we need the width or height... */ | 10394 /* If we need the width or height... */ |
10393 if(horz || vert) | 10395 if(horz || vert) |
10394 { | 10396 { |
10395 GdkRectangle frame; | 10397 GdkRectangle frame; |
10398 int count = 0; | |
10396 | 10399 |
10397 /* Get the frame size */ | 10400 /* Get the frame size */ |
10398 gdk_window_get_frame_extents(handle->window, &frame); | 10401 gdk_window_get_frame_extents(handle->window, &frame); |
10402 | |
10403 /* FIXME: Sometimes we get returned an invalid 200x200 | |
10404 * result... so if we get this... try the call a second | |
10405 * time and hope for a better result. | |
10406 */ | |
10407 while((frame.width == 200 || frame.width == (200 + cx)) && | |
10408 (frame.height == 200 || frame.height == (200 + cy)) && count < 10) | |
10409 { | |
10410 dw_main_sleep(1); | |
10411 count++; | |
10412 gdk_window_get_frame_extents(handle->window, &frame); | |
10413 } | |
10399 width = frame.width; | 10414 width = frame.width; |
10400 height = frame.height; | 10415 height = frame.height; |
10401 } | 10416 } |
10402 } | 10417 } |
10403 else | 10418 else |
10404 { | 10419 { |
10405 int cx , cy; | 10420 int cx , cy; |
10406 | 10421 |
10407 /* Check if we have cached frame size values */ | 10422 /* Check if we have cached frame size values */ |
10408 if(!((cx = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_frame_width"))) | | 10423 if(!(cx | cy)) |
10409 (cy = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_frame_height"))))) | |
10410 { | 10424 { |
10411 /* If not try to ask the window manager for the estimated size... | 10425 /* If not try to ask the window manager for the estimated size... |
10412 * and finally if all else fails, guess. | 10426 * and finally if all else fails, guess. |
10413 */ | 10427 */ |
10414 _dw_get_frame_extents(handle, &cy, &cx); | 10428 _dw_get_frame_extents(handle, &cy, &cx); |