@@ -21,14 +21,11 @@ struct _Animatedpane
2121
2222 GtkWidget * paned ;
2323
24+ // the state we expose via properties
2425 gboolean revealed ;
25-
26- /* Saved position of the GtkPaned separator.
27- */
2826 int position ;
2927
30- /* Animation state.
31- */
28+ // animation state.
3229 double elapsed ;
3330 double last_frame_time ;
3431 gboolean is_animating ;
@@ -124,13 +121,23 @@ animatedpaned_set_child_position( Animatedpane *animatedpane, int position )
124121 gtk_paned_set_position ( GTK_PANED ( animatedpane -> paned ), position );
125122}
126123
124+ /* From clutter-easing.c, based on Robert Penner's infamous easing equations,
125+ * MIT license.
126+ */
127+ static double
128+ ease_out_cubic ( double t )
129+ {
130+ double p = t - 1 ;
131+
132+ return ( p * p * p + 1 );
133+ }
134+
127135static gboolean
128136animatedpane_animate_tick ( GtkWidget * widget , GdkFrameClock * frame_clock ,
129137 gpointer client_data )
130138{
131139 Animatedpane * animatedpane = ANIMATEDPANE ( widget );
132140 gint64 frame_time = gdk_frame_clock_get_frame_time ( frame_clock );
133- gboolean revealed = GPOINTER_TO_INT ( client_data );
134141
135142 double t ;
136143
@@ -151,8 +158,8 @@ animatedpane_animate_tick( GtkWidget *widget, GdkFrameClock *frame_clock,
151158 if ( t >= 0.99 ) {
152159 // all done
153160 animatedpaned_set_child_position ( animatedpane , animatedpane -> stop );
154- animatedpaned_set_child_visibility ( animatedpane , revealed );
155- animatedpane -> revealed = revealed ;
161+ if ( ! animatedpane -> revealed )
162+ animatedpaned_set_child_visibility ( animatedpane , FALSE ) ;
156163 animatedpane -> is_animating = FALSE;
157164
158165 return ( G_SOURCE_REMOVE );
@@ -175,6 +182,8 @@ animatedpaned_set_revealed( Animatedpane *animatedpane, gboolean revealed )
175182#endif /* DEBUG */
176183
177184 if ( animatedpane -> revealed != revealed ) {
185+ animatedpane -> revealed = revealed ;
186+
178187 if ( animatedpaned_enable_animations ( animatedpane ) ) {
179188 animatedpane -> last_frame_time = -1 ;
180189 animatedpane -> elapsed = 0.0 ;
@@ -198,12 +207,10 @@ animatedpaned_set_revealed( Animatedpane *animatedpane, gboolean revealed )
198207 animatedpaned_set_child_visibility ( animatedpane , TRUE );
199208
200209 gtk_widget_add_tick_callback ( GTK_WIDGET ( animatedpane ),
201- animatedpane_animate_tick , GINT_TO_POINTER ( revealed ),
202- NULL );
210+ animatedpane_animate_tick , NULL , NULL );
203211 }
204212 else {
205213 animatedpaned_set_child_visibility ( animatedpane , revealed );
206- animatedpane -> revealed = revealed ;
207214 }
208215 }
209216}
0 commit comments