summaryrefslogtreecommitdiff
path: root/src/core/effects.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/effects.c')
-rw-r--r--src/core/effects.c42
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);
}