From 88cd26575d483221f5323c5cf23f1e8e26bd9cef Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 21 Apr 2013 19:53:57 -0400 Subject: [PATCH] GtkStack: rtl flipping for animation We switch slide-right and slight-left when in rtl. --- gtk/gtkstack.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index e97f0e01a3..12680b2557 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -736,6 +736,21 @@ gtk_stack_unschedule_ticks (GtkStack *stack) } } +static GtkStackTransitionType +effective_transition_type (GtkStack *stack, + GtkStackTransitionType transition_type) +{ + if (gtk_widget_get_direction (GTK_WIDGET (stack)) == GTK_TEXT_DIR_RTL) + { + if (transition_type == GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT) + return GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT; + else if (transition_type == GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT) + return GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT; + } + + return transition_type; +} + static void gtk_stack_start_transition (GtkStack *stack, GtkStackTransitionType transition_type, @@ -760,7 +775,7 @@ gtk_stack_start_transition (GtkStack *stack, priv->transition_pos = 0.0; priv->start_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget)); priv->end_time = priv->start_time + (transition_duration * 1000); - priv->active_transition_type = transition_type; + priv->active_transition_type = effective_transition_type (stack, transition_type); gtk_stack_schedule_ticks (stack); } else @@ -1397,7 +1412,8 @@ gtk_stack_draw (GtkWidget *widget, priv->last_visible_surface_allocation.height); pattern_cr = cairo_create (priv->last_visible_surface); /* We don't use propagate_draw here, because we don't want to apply - the bin_window offset */ + * the bin_window offset + */ gtk_widget_draw (priv->last_visible_child->widget, pattern_cr); cairo_destroy (pattern_cr); }