diff options
author | raveit65 <[email protected]> | 2017-04-12 19:45:30 +0200 |
---|---|---|
committer | lukefromdc <[email protected]> | 2017-04-13 14:15:19 -0400 |
commit | dddec5fcd50f15eb03a95e0369b418b5b8ce131f (patch) | |
tree | d9d68fa77fe4df561a959d89eac11c4f7525bf2a /eel | |
parent | 05724185f11f68d7432775c4ebc77e5ae6d5196e (diff) | |
download | caja-dddec5fcd50f15eb03a95e0369b418b5b8ce131f.tar.bz2 caja-dddec5fcd50f15eb03a95e0369b418b5b8ce131f.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 | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c index d88aeecb..97a6a2f0 100644 --- a/eel/eel-canvas.c +++ b/eel/eel-canvas.c @@ -557,6 +557,13 @@ eel_canvas_item_move (EelCanvasItem *item, double dx, double dy) } +static void +eel_canvas_queue_resize (EelCanvas *canvas) +{ + if (gtk_widget_is_drawable (GTK_WIDGET (canvas))) + gtk_widget_queue_resize (GTK_WIDGET (canvas)); +} + /* 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. */ @@ -830,6 +837,7 @@ eel_canvas_item_show (EelCanvasItem *item) } redraw_and_repick_if_mapped (item); + eel_canvas_queue_resize (item->canvas); } } @@ -855,6 +863,8 @@ eel_canvas_item_hide (EelCanvasItem *item) if (item->flags & EEL_CANVAS_ITEM_MAPPED) (* EEL_CANVAS_ITEM_GET_CLASS (item)->unmap) (item); + eel_canvas_queue_resize (item->canvas); + /* No need to unrealize when we just want to hide */ } } @@ -1832,6 +1842,9 @@ group_add (EelCanvasGroup *group, EelCanvasItem *item) if (!(item->flags & EEL_CANVAS_ITEM_MAPPED)) (* EEL_CANVAS_ITEM_GET_CLASS (item)->map) (item); } + + if (item->flags & EEL_CANVAS_ITEM_VISIBLE) + eel_canvas_queue_resize (EEL_CANVAS_ITEM (group)->canvas); } /* Removes an item from a group */ @@ -1846,12 +1859,16 @@ group_remove (EelCanvasGroup *group, EelCanvasItem *item) for (children = group->item_list; children; children = children->next) if (children->data == item) { - if (item->flags & EEL_CANVAS_ITEM_MAPPED) + if (item->flags & EEL_CANVAS_ITEM_MAPPED) { (* EEL_CANVAS_ITEM_GET_CLASS (item)->unmap) (item); + } if (item->flags & EEL_CANVAS_ITEM_REALIZED) (* EEL_CANVAS_ITEM_GET_CLASS (item)->unrealize) (item); + if (item->flags & EEL_CANVAS_ITEM_VISIBLE) + eel_canvas_queue_resize (item->canvas); + /* Unparent the child */ item->parent = NULL; |