[gtk+/wip/baedert/stack-size-interpolate: 5/11] GtkStack: Save last visible widget size
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/stack-size-interpolate: 5/11] GtkStack: Save last visible widget size
- Date: Mon, 25 May 2015 14:56:44 +0000 (UTC)
commit 99f8bcf1ef7fdfa25e8b532200ea04421d93a190
Author: Timm Bäder <mail baedert org>
Date: Sun May 24 16:55:34 2015 +0200
GtkStack: Save last visible widget size
When interpolating the stack size, we compute the current size by using
the prefered/minimum current size and the last size. We can't use the
last_visible_surface_allocation because that is not available until the
first _draw call and it doesn't include the child's margins.
gtk/gtkstack.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 46a8f73..49a9a7c 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -137,6 +137,9 @@ typedef struct {
gint64 start_time;
gint64 end_time;
+ gint last_visible_widget_width;
+ gint last_visible_widget_height;
+
GtkStackTransitionType active_transition_type;
} GtkStackPrivate;
@@ -1059,9 +1062,20 @@ set_visible_child (GtkStack *stack,
if (priv->visible_child && priv->visible_child->widget)
{
if (gtk_widget_is_visible (widget))
- priv->last_visible_child = priv->visible_child;
+ {
+ int fake;
+ priv->last_visible_child = priv->visible_child;
+ gtk_widget_get_preferred_width (priv->last_visible_child->widget,
+ &fake,
+ &priv->last_visible_widget_width);
+ gtk_widget_get_preferred_height (priv->last_visible_child->widget,
+ &fake,
+ &priv->last_visible_widget_height);
+ }
else
- gtk_widget_set_child_visible (priv->visible_child->widget, FALSE);
+ {
+ gtk_widget_set_child_visible (priv->visible_child->widget, FALSE);
+ }
}
priv->visible_child = child_info;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]