diff options
author | Stefano Karapetsas <[email protected]> | 2014-07-01 10:58:02 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-07-01 10:58:02 +0200 |
commit | 567890a8a1884247de29e9f97cf9cd8110247c04 (patch) | |
tree | cfa21e7fb23d1974bc660c5e1d363049923470ca /src/core/effects.c | |
parent | a65a66d49bd0d6ec6c94b8e3ecd551cb570cec95 (diff) | |
parent | 5b415150cf3676ee95e1da7d5a29093cd20e6c4e (diff) | |
download | marco-567890a8a1884247de29e9f97cf9cd8110247c04.tar.bz2 marco-567890a8a1884247de29e9f97cf9cd8110247c04.tar.xz |
Merge pull request #115 from Samsagax/animation-fix-clean
Experimental animation fix (clean)
Diffstat (limited to 'src/core/effects.c')
-rw-r--r-- | src/core/effects.c | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/src/core/effects.c b/src/core/effects.c index 4e9b3ae8..853d5ce9 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. @@ -173,17 +179,13 @@ create_effect (MetaEffectType type, } /** - * Destroys an effect. If the effect has a "finished" hook, it will be - * called before cleanup. + * Destroys an effect. * * \param effect The effect. */ static void effect_free (MetaEffect *effect) { - if (effect->priv->finished) - effect->priv->finished (effect->priv->finished_data); - g_free (effect->priv); g_free (effect); } @@ -383,6 +385,8 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context) graphics_sync (context); + context->finished(context->finished_data); + g_free (context); return FALSE; } @@ -430,7 +434,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 +461,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,7 +726,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_UNMINIMIZE_ANIMATION_LENGTH, + effect->priv->finished, + effect->priv->finished_data); break; default: @@ -728,8 +747,15 @@ run_default_effect_handler (MetaEffect *effect) static void run_handler (MetaEffect *effect) { + /* If effects are disabled just run the finished function */ if (meta_prefs_get_mate_animations ()) + { run_default_effect_handler (effect); + } + else + { + effect->priv->finished(effect->priv->finished_data); + } effect_free (effect); } |