diff options
author | raveit65 <[email protected]> | 2017-04-14 12:43:39 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-04-15 18:50:28 +0200 |
commit | d3ef2b3a5dfd9a8f7f5a99be184df287898d6cc1 (patch) | |
tree | b5226a15dc7b56040b32a78512453bbdd238b30d /eel | |
parent | 8140e40379ce94f975c65a8bf2e11c636998c05c (diff) | |
download | caja-d3ef2b3a5dfd9a8f7f5a99be184df287898d6cc1.tar.bz2 caja-d3ef2b3a5dfd9a8f7f5a99be184df287898d6cc1.tar.xz |
eel: Queue resizes on the canvas as elements change visibility
Not queueing resizes may play oddly with the size request caches in
GTK+, resulting in gtk_widget_get_preferred_width/height returning
0 even after the canvas was populated.
https://bugzilla.gnome.org/show_bug.cgi?id=667831
Taken from:
https://git.gnome.org/browse/nautilus/commit/?id=8c77821
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-canvas.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c index da39007c..81dafc43 100644 --- a/eel/eel-canvas.c +++ b/eel/eel-canvas.c @@ -578,6 +578,15 @@ eel_canvas_item_move (EelCanvasItem *item, double dx, double dy) } +#if GTK_CHECK_VERSION (3, 0, 0) +static void +eel_canvas_queue_resize (EelCanvas *canvas) +{ + if (gtk_widget_is_drawable (GTK_WIDGET (canvas))) + gtk_widget_queue_resize (GTK_WIDGET (canvas)); +} +#endif + /* Convenience function to reorder items in a group's child list. This puts the * specified link after the "before" link. Returns TRUE if the list was changed. */ @@ -851,6 +860,9 @@ eel_canvas_item_show (EelCanvasItem *item) } redraw_and_repick_if_mapped (item); +#if GTK_CHECK_VERSION (3, 0, 0) + eel_canvas_queue_resize (item->canvas); +#endif } } @@ -876,6 +888,10 @@ eel_canvas_item_hide (EelCanvasItem *item) if (item->flags & EEL_CANVAS_ITEM_MAPPED) (* EEL_CANVAS_ITEM_GET_CLASS (item)->unmap) (item); +#if GTK_CHECK_VERSION (3, 0, 0) + eel_canvas_queue_resize (item->canvas); +#endif + /* No need to unrealize when we just want to hide */ } } @@ -1909,6 +1925,11 @@ group_add (EelCanvasGroup *group, EelCanvasItem *item) if (!(item->flags & EEL_CANVAS_ITEM_MAPPED)) (* EEL_CANVAS_ITEM_GET_CLASS (item)->map) (item); } + +#if GTK_CHECK_VERSION (3, 0, 0) + if (item->flags & EEL_CANVAS_ITEM_VISIBLE) + eel_canvas_queue_resize (EEL_CANVAS_ITEM (group)->canvas); +#endif } /* Removes an item from a group */ @@ -1929,6 +1950,11 @@ group_remove (EelCanvasGroup *group, EelCanvasItem *item) if (item->flags & EEL_CANVAS_ITEM_REALIZED) (* EEL_CANVAS_ITEM_GET_CLASS (item)->unrealize) (item); +#if GTK_CHECK_VERSION (3, 0, 0) + if (item->flags & EEL_CANVAS_ITEM_VISIBLE) + eel_canvas_queue_resize (item->canvas); +#endif + /* Unparent the child */ item->parent = NULL; |