summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-04-12 19:45:30 +0200
committerraveit65 <[email protected]>2017-04-15 19:01:59 +0200
commitaa7a17fd9960549aef378c352a612fac0ef45cc0 (patch)
treef6aea1080b903c4c362ac9b9e1759270fb9ca8fb
parent7773a9a4b65c5219f57c344925ffd94d30367c0b (diff)
downloadcaja-aa7a17fd9960549aef378c352a612fac0ef45cc0.tar.bz2
caja-aa7a17fd9960549aef378c352a612fac0ef45cc0.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
-rw-r--r--eel/eel-canvas.c19
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;