[nautilus] eel: Queue resizes on the canvas as elements change visibility
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] eel: Queue resizes on the canvas as elements change visibility
- Date: Mon, 16 Jan 2012 16:15:21 +0000 (UTC)
commit 8c778211e5c826998890d2034b828928c693e4d9
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jan 12 23:24:23 2012 +0100
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
eel/eel-canvas.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index 0b2cbed..4355e19 100644
--- a/eel/eel-canvas.c
+++ b/eel/eel-canvas.c
@@ -531,6 +531,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.
*/
@@ -787,6 +794,7 @@ eel_canvas_item_show (EelCanvasItem *item)
}
redraw_and_repick_if_mapped (item);
+ eel_canvas_queue_resize (item->canvas);
}
}
@@ -807,10 +815,12 @@ eel_canvas_item_hide (EelCanvasItem *item)
item->flags &= ~EEL_CANVAS_ITEM_VISIBLE;
redraw_and_repick_if_mapped (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 */
}
}
@@ -1672,6 +1682,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 */
@@ -1685,12 +1698,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]