X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=blobdiff_plain;f=libchimara%2Fwindow.c;h=fb7311e7280a09f0c1300fa026630a2221fcb1c3;hp=ef85e3f2651f4de44bd99798c490b40d36f2926c;hb=a990c9f6e84e43b37e9f1e6b89ea6a1e8646354b;hpb=1775204e98cf4fa86cd43cd8665bb75fe1e6a15b diff --git a/libchimara/window.c b/libchimara/window.c index ef85e3f..fb7311e 100644 --- a/libchimara/window.c +++ b/libchimara/window.c @@ -1008,13 +1008,19 @@ glk_window_clear(winid_t win) case wintype_Graphics: { + GtkAllocation allocation; + /* Wait for the window's size to be updated */ g_mutex_lock(glk_data->arrange_lock); if(glk_data->needs_rearrange) g_cond_wait(glk_data->rearranged, glk_data->arrange_lock); g_mutex_unlock(glk_data->arrange_lock); - glk_window_erase_rect(win, 0, 0, win->widget->allocation.width, win->widget->allocation.height); + gdk_threads_enter(); + gtk_widget_get_allocation(win->widget, &allocation); + gdk_threads_leave(); + + glk_window_erase_rect(win, 0, 0, allocation.width, allocation.height); } break; @@ -1134,6 +1140,7 @@ glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr) { VALID_WINDOW(win, return); + GtkAllocation allocation; ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); switch(win->type) @@ -1154,9 +1161,10 @@ glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr) g_mutex_unlock(glk_data->arrange_lock); gdk_threads_enter(); + gtk_widget_get_allocation(win->widget, &allocation); /* Cache the width and height */ - win->width = (glui32)(win->widget->allocation.width / win->unit_width); - win->height = (glui32)(win->widget->allocation.height / win->unit_height); + win->width = (glui32)(allocation.width / win->unit_width); + win->height = (glui32)(allocation.height / win->unit_height); gdk_threads_leave(); if(widthptr != NULL) @@ -1173,10 +1181,11 @@ glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr) g_mutex_unlock(glk_data->arrange_lock); gdk_threads_enter(); + gtk_widget_get_allocation(win->widget, &allocation); if(widthptr != NULL) - *widthptr = (glui32)(win->widget->allocation.width / win->unit_width); + *widthptr = (glui32)(allocation.width / win->unit_width); if(heightptr != NULL) - *heightptr = (glui32)(win->widget->allocation.height / win->unit_height); + *heightptr = (glui32)(allocation.height / win->unit_height); gdk_threads_leave(); break; @@ -1188,10 +1197,11 @@ glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr) g_mutex_unlock(glk_data->arrange_lock); gdk_threads_enter(); + gtk_widget_get_allocation(win->widget, &allocation); if(widthptr != NULL) - *widthptr = (glui32)(win->widget->allocation.width); + *widthptr = (glui32)(allocation.width); if(heightptr != NULL) - *heightptr = (glui32)(win->widget->allocation.height); + *heightptr = (glui32)(allocation.height); gdk_threads_leave(); break;