diff options
author | Joaquín Ignacio Aramendía <[email protected]> | 2014-06-24 12:02:44 -0300 |
---|---|---|
committer | Joaquín Ignacio Aramendía <[email protected]> | 2014-06-26 20:26:23 -0300 |
commit | f96f358816b7f4c94f1575a9e0dfe81f9fb26efd (patch) | |
tree | a0dac7164b69eca1151a38f4456afa3228971c8f /src/core | |
parent | f3263ee47c1ad6cacd359668ef967af9c8d2beb7 (diff) | |
download | marco-f96f358816b7f4c94f1575a9e0dfe81f9fb26efd.tar.bz2 marco-f96f358816b7f4c94f1575a9e0dfe81f9fb26efd.tar.xz |
Fix: the effect "finished" callback needs to be called after the effect ends
Added two fields to BoxAnimationContext to handle finish callback inside
box_animation_timeout function instead of effect_free. Now the finish
function is called after the effect is finished.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/effects.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/core/effects.c b/src/core/effects.c index 592e3470..658f6fa5 100644 --- a/src/core/effects.c +++ b/src/core/effects.c @@ -67,6 +67,7 @@ #endif #define META_MINIMIZE_ANIMATION_LENGTH 0.25 +#define META_UNMINIMIZE_ANIMATION_LENGTH 0.25 #define META_SHADE_ANIMATION_LENGTH 0.2 #include <string.h> @@ -98,6 +99,9 @@ typedef struct MetaRectangle start_rect; MetaRectangle end_rect; + MetaEffectFinished finished; + gpointer finished_data; + } BoxAnimationContext; /** @@ -149,7 +153,9 @@ static void draw_box_animation (MetaScreen *screen, MetaRectangle *initial_rect, MetaRectangle *destination_rect, - double seconds_duration); + double seconds_duration, + MetaEffectFinished finished, + gpointer finished_data); /** * Creates an effect. @@ -181,8 +187,8 @@ create_effect (MetaEffectType type, static void effect_free (MetaEffect *effect) { - if (effect->priv->finished) - effect->priv->finished (effect->priv->finished_data); + /*if (effect->priv->finished) + effect->priv->finished (effect->priv->finished_data);*/ g_free (effect->priv); g_free (effect); @@ -383,6 +389,8 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context) graphics_sync (context); + context->finished(context->finished_data); + g_free (context); return FALSE; } @@ -430,7 +438,9 @@ void draw_box_animation (MetaScreen *screen, MetaRectangle *initial_rect, MetaRectangle *destination_rect, - double seconds_duration) + double seconds_duration, + MetaEffectFinished finished, + gpointer finished_data) { BoxAnimationContext *context; @@ -455,6 +465,9 @@ draw_box_animation (MetaScreen *screen, context->start_rect = *initial_rect; context->end_rect = *destination_rect; + context->finished = finished; + context->finished_data = finished_data; + #ifdef HAVE_SHAPE attrs.override_redirect = True; @@ -717,13 +730,17 @@ run_default_effect_handler (MetaEffect *effect) draw_box_animation (effect->window->screen, &(effect->u.minimize.window_rect), &(effect->u.minimize.icon_rect), - META_MINIMIZE_ANIMATION_LENGTH); + META_MINIMIZE_ANIMATION_LENGTH, + effect->priv->finished, + effect->priv->finished_data); break; case META_EFFECT_UNMINIMIZE: draw_box_animation (effect->window->screen, &(effect->u.minimize.icon_rect), &(effect->u.minimize.window_rect), - META_MINIMIZE_ANIMATION_LENGTH); + META_UNMINIMIZE_ANIMATION_LENGTH, + effect->priv->finished, + effect->priv->finished_data); break; default: |