Update to Clutter 0.9

Fixes various API breakage due to switching to Clutter 0.9.
This commit is contained in:
Thomas Wood 2009-01-28 15:43:36 +00:00
parent 66a5edd31a
commit 4589d1246d
6 changed files with 187 additions and 182 deletions

View File

@ -302,7 +302,7 @@ if test x$have_xrender = xyes; then
AC_DEFINE(HAVE_RENDER, , [Building with Render extension support]) AC_DEFINE(HAVE_RENDER, , [Building with Render extension support])
fi fi
CLUTTER_PACKAGE=clutter-0.8 CLUTTER_PACKAGE=clutter-0.9
AC_SUBST(CLUTTER_PACKAGE) AC_SUBST(CLUTTER_PACKAGE)
if test x$have_clutter = xyes; then if test x$have_clutter = xyes; then
METACITY_PC_MODULES="$METACITY_PC_MODULES $CLUTTER_PACKAGE " METACITY_PC_MODULES="$METACITY_PC_MODULES $CLUTTER_PACKAGE "

View File

@ -34,11 +34,7 @@
#include <X11/extensions/Xrender.h> #include <X11/extensions/Xrender.h>
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include <clutter/clutter-group.h>
#include <clutter/x11/clutter-x11.h> #include <clutter/x11/clutter-x11.h>
#ifdef HAVE_GLX_TEXTURE_PIXMAP
#include <clutter/glx/clutter-glx.h>
#endif /* HAVE_GLX_TEXTURE_PIXMAP */
#include <cogl/cogl.h> #include <cogl/cogl.h>
#define SHADOW_RADIUS 8 #define SHADOW_RADIUS 8

View File

@ -25,15 +25,12 @@
#include <config.h> #include <config.h>
#include <clutter/clutter-texture.h> #include "mutter-shaped-texture.h"
#include <clutter/x11/clutter-x11.h>
#ifdef HAVE_GLX_TEXTURE_PIXMAP #include <clutter/clutter.h>
#include <clutter/glx/clutter-glx.h>
#endif /* HAVE_GLX_TEXTURE_PIXMAP */
#include <cogl/cogl.h> #include <cogl/cogl.h>
#include <string.h> #include <string.h>
#include "mutter-shaped-texture.h"
static void mutter_shaped_texture_dispose (GObject *object); static void mutter_shaped_texture_dispose (GObject *object);
static void mutter_shaped_texture_finalize (GObject *object); static void mutter_shaped_texture_finalize (GObject *object);
@ -364,7 +361,6 @@ mutter_shaped_texture_paint (ClutterActor *actor)
guint paint_gl_width, paint_gl_height; guint paint_gl_width, paint_gl_height;
GLfloat vertex_coords[8], paint_tex_coords[8]; GLfloat vertex_coords[8], paint_tex_coords[8];
ClutterActorBox alloc; ClutterActorBox alloc;
static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
#if 1 /* please see comment below about workaround */ #if 1 /* please see comment below about workaround */
guint depth; guint depth;
GLint orig_gl_tex_env_mode; GLint orig_gl_tex_env_mode;
@ -427,7 +423,7 @@ mutter_shaped_texture_paint (ClutterActor *actor)
glDisableClientState (GL_COLOR_ARRAY); glDisableClientState (GL_COLOR_ARRAY);
glVertexPointer (2, GL_FLOAT, 0, vertex_coords); glVertexPointer (2, GL_FLOAT, 0, vertex_coords);
glTexCoordPointer (2, GL_FLOAT, 0, paint_tex_coords); glTexCoordPointer (2, GL_FLOAT, 0, paint_tex_coords);
cogl_color (&white); cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
/* Put the main painting texture in the first texture unit */ /* Put the main painting texture in the first texture unit */
glBindTexture (paint_target, paint_gl_tex); glBindTexture (paint_target, paint_gl_tex);
@ -600,13 +596,14 @@ mutter_shaped_texture_pick (ClutterActor *actor,
mutter_shaped_texture_ensure_mask (stex); mutter_shaped_texture_ensure_mask (stex);
cogl_color (color); cogl_set_source_color4ub (color->red, color->green, color->blue,
color->alpha);
clutter_actor_get_allocation_box (actor, &alloc); clutter_actor_get_allocation_box (actor, &alloc);
/* Paint the mask rectangle in the given color */ /* Paint the mask rectangle in the given color */
cogl_texture_rectangle (priv->mask_texture, cogl_set_source_texture (priv->mask_texture);
0, 0, cogl_rectangle_with_texture_coords (0, 0,
CLUTTER_UNITS_TO_FIXED (alloc.x2 - alloc.x1), CLUTTER_UNITS_TO_FIXED (alloc.x2 - alloc.x1),
CLUTTER_UNITS_TO_FIXED (alloc.y2 - alloc.y1), CLUTTER_UNITS_TO_FIXED (alloc.y2 - alloc.y1),
0, 0, CFX_ONE, CFX_ONE); 0, 0, CFX_ONE, CFX_ONE);

View File

@ -26,8 +26,7 @@
#ifndef __MUTTER_SHAPED_TEXTURE_H__ #ifndef __MUTTER_SHAPED_TEXTURE_H__
#define __MUTTER_SHAPED_TEXTURE_H__ #define __MUTTER_SHAPED_TEXTURE_H__
#include <clutter/clutter-texture.h> #include <clutter/clutter.h>
#include <clutter/x11/clutter-x11.h>
#ifdef HAVE_GLX_TEXTURE_PIXMAP #ifdef HAVE_GLX_TEXTURE_PIXMAP
#include <clutter/glx/clutter-glx.h> #include <clutter/glx/clutter-glx.h>
#endif /* HAVE_GLX_TEXTURE_PIXMAP */ #endif /* HAVE_GLX_TEXTURE_PIXMAP */

View File

@ -96,12 +96,6 @@ MUTTER_PLUGIN_DECLARE(MutterDefaultPlugin, mutter_default_plugin);
*/ */
struct _MutterDefaultPluginPrivate struct _MutterDefaultPluginPrivate
{ {
ClutterEffectTemplate *destroy_effect;
ClutterEffectTemplate *minimize_effect;
ClutterEffectTemplate *maximize_effect;
ClutterEffectTemplate *map_effect;
ClutterEffectTemplate *switch_workspace_effect;
/* Valid only when switch_workspace effect is in progress */ /* Valid only when switch_workspace effect is in progress */
ClutterTimeline *tml_switch_workspace1; ClutterTimeline *tml_switch_workspace1;
ClutterTimeline *tml_switch_workspace2; ClutterTimeline *tml_switch_workspace2;
@ -114,16 +108,35 @@ struct _MutterDefaultPluginPrivate
gboolean debug_mode : 1; gboolean debug_mode : 1;
}; };
/*
* Per actor private data we attach to each actor.
*/
typedef struct _ActorPrivate
{
ClutterActor *orig_parent;
ClutterTimeline *tml_minimize;
ClutterTimeline *tml_maximize;
ClutterTimeline *tml_destroy;
ClutterTimeline *tml_map;
gboolean is_minimized : 1;
gboolean is_maximized : 1;
} ActorPrivate;
/* callback data for when animations complete */
typedef struct
{
ClutterActor *actor;
MutterPlugin *plugin;
} EffectCompleteData;
static void static void
mutter_default_plugin_dispose (GObject *object) mutter_default_plugin_dispose (GObject *object)
{ {
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (object)->priv; /* MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (object)->priv;
*/
g_object_unref (priv->destroy_effect);
g_object_unref (priv->minimize_effect);
g_object_unref (priv->maximize_effect);
g_object_unref (priv->switch_workspace_effect);
G_OBJECT_CLASS (mutter_default_plugin_parent_class)->dispose (object); G_OBJECT_CLASS (mutter_default_plugin_parent_class)->dispose (object);
} }
@ -189,31 +202,6 @@ mutter_default_plugin_constructed (GObject *object)
switch_timeout *= 2; switch_timeout *= 2;
} }
priv->destroy_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration (
destroy_timeout),
CLUTTER_ALPHA_SINE_INC);
priv->minimize_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration (
minimize_timeout),
CLUTTER_ALPHA_SINE_INC);
priv->maximize_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration (
maximize_timeout),
CLUTTER_ALPHA_SINE_INC);
priv->map_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration (
map_timeout),
CLUTTER_ALPHA_SINE_INC);
priv->switch_workspace_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration (
switch_timeout),
CLUTTER_ALPHA_SINE_INC);
} }
static void static void
@ -254,23 +242,6 @@ mutter_default_plugin_init (MutterDefaultPlugin *self)
priv->info.description = "This is an example of a plugin implementation."; priv->info.description = "This is an example of a plugin implementation.";
} }
/*
* Per actor private data we attach to each actor.
*/
typedef struct _ActorPrivate
{
ClutterActor *orig_parent;
ClutterTimeline *tml_minimize;
ClutterTimeline *tml_maximize;
ClutterTimeline *tml_destroy;
ClutterTimeline *tml_map;
gboolean is_minimized : 1;
gboolean is_maximized : 1;
} ActorPrivate;
/* /*
* Actor private data accessor * Actor private data accessor
*/ */
@ -308,7 +279,7 @@ typedef struct SwitchWorkspaceData
} SwitchWorkspaceData; } SwitchWorkspaceData;
static void static void
on_switch_workspace_effect_complete (ClutterActor *group, gpointer data) on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
{ {
SwitchWorkspaceData *sw_data = data; SwitchWorkspaceData *sw_data = data;
MutterPlugin *plugin = sw_data->plugin; MutterPlugin *plugin = sw_data->plugin;
@ -360,6 +331,7 @@ switch_workspace (MutterPlugin *plugin,
int screen_width, screen_height; int screen_width, screen_height;
MetaScreen *screen = mutter_plugin_get_screen (plugin); MetaScreen *screen = mutter_plugin_get_screen (plugin);
SwitchWorkspaceData *sw_data = g_new (SwitchWorkspaceData, 1); SwitchWorkspaceData *sw_data = g_new (SwitchWorkspaceData, 1);
ClutterAnimation *animation;
sw_data->plugin = plugin; sw_data->plugin = plugin;
sw_data->actors = actors; sw_data->actors = actors;
@ -435,16 +407,23 @@ switch_workspace (MutterPlugin *plugin,
priv->desktop1 = workspace0; priv->desktop1 = workspace0;
priv->desktop2 = workspace1; priv->desktop2 = workspace1;
priv->tml_switch_workspace2 = animation = clutter_actor_animate (workspace0, CLUTTER_EASE_IN_SINE,
clutter_effect_scale (priv->switch_workspace_effect, SWITCH_TIMEOUT,
workspace1, 1.0, 1.0, "scale-x", 1.0,
on_switch_workspace_effect_complete, "scale-y", 1.0,
(gpointer)sw_data); NULL);
priv->tml_switch_workspace1 = clutter_animation_get_timeline (animation);
g_signal_connect (priv->tml_switch_workspace1,
"completed",
G_CALLBACK (on_switch_workspace_effect_complete),
sw_data);
priv->tml_switch_workspace1 = animation = clutter_actor_animate (workspace1, CLUTTER_EASE_IN_SINE,
clutter_effect_scale (priv->switch_workspace_effect, SWITCH_TIMEOUT,
workspace0, 0.0, 0.0, "scale-x", 0.0,
NULL, NULL); "scale-y", 0.0,
NULL);
priv->tml_switch_workspace2 = clutter_animation_get_timeline (animation);
} }
@ -453,30 +432,32 @@ switch_workspace (MutterPlugin *plugin,
* calls the manager callback function. * calls the manager callback function.
*/ */
static void static void
on_minimize_effect_complete (ClutterActor *actor, gpointer data) on_minimize_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
{ {
/* /*
* Must reverse the effect of the effect; must hide it first to ensure * Must reverse the effect of the effect; must hide it first to ensure
* that the restoration will not be visible. * that the restoration will not be visible.
*/ */
MutterPlugin *plugin = data; MutterPlugin *plugin = data->plugin;
ActorPrivate *apriv; ActorPrivate *apriv;
MutterWindow *mc_window = MUTTER_WINDOW (actor); MutterWindow *mc_window = MUTTER_WINDOW (data->actor);
apriv = get_actor_private (MUTTER_WINDOW (actor)); apriv = get_actor_private (MUTTER_WINDOW (data->actor));
apriv->tml_minimize = NULL; apriv->tml_minimize = NULL;
clutter_actor_hide (actor); clutter_actor_hide (data->actor);
/* FIXME - we shouldn't assume the original scale, it should be saved /* FIXME - we shouldn't assume the original scale, it should be saved
* at the start of the effect */ * at the start of the effect */
clutter_actor_set_scale (actor, 1.0, 1.0); clutter_actor_set_scale (data->actor, 1.0, 1.0);
clutter_actor_move_anchor_point_from_gravity (actor, clutter_actor_move_anchor_point_from_gravity (data->actor,
CLUTTER_GRAVITY_NORTH_WEST); CLUTTER_GRAVITY_NORTH_WEST);
/* Now notify the manager that we are done with this effect */ /* Now notify the manager that we are done with this effect */
mutter_plugin_effect_completed (plugin, mc_window, mutter_plugin_effect_completed (plugin, mc_window,
MUTTER_PLUGIN_MINIMIZE); MUTTER_PLUGIN_MINIMIZE);
g_free (data);
} }
/* /*
@ -486,7 +467,6 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer data)
static void static void
minimize (MutterPlugin *plugin, MutterWindow *mc_window) minimize (MutterPlugin *plugin, MutterWindow *mc_window)
{ {
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
MetaCompWindowType type; MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window); ClutterActor *actor = CLUTTER_ACTOR (mc_window);
@ -494,6 +474,8 @@ minimize (MutterPlugin *plugin, MutterWindow *mc_window)
if (type == META_COMP_WINDOW_NORMAL) if (type == META_COMP_WINDOW_NORMAL)
{ {
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
ActorPrivate *apriv = get_actor_private (mc_window); ActorPrivate *apriv = get_actor_private (mc_window);
apriv->is_minimized = TRUE; apriv->is_minimized = TRUE;
@ -501,13 +483,19 @@ minimize (MutterPlugin *plugin, MutterWindow *mc_window)
clutter_actor_move_anchor_point_from_gravity (actor, clutter_actor_move_anchor_point_from_gravity (actor,
CLUTTER_GRAVITY_CENTER); CLUTTER_GRAVITY_CENTER);
apriv->tml_minimize = clutter_effect_scale (priv->minimize_effect, animation = clutter_actor_animate (actor,
actor, CLUTTER_EASE_IN_SINE,
0.0, MINIMIZE_TIMEOUT,
0.0, "scale-x", 0.0,
(ClutterEffectCompleteFunc) "scale-y", 0.0,
on_minimize_effect_complete, NULL);
plugin); apriv->tml_minimize = clutter_animation_get_timeline (animation);
data->plugin = plugin;
data->actor = actor;
g_signal_connect (apriv->tml_minimize, "completed",
G_CALLBACK (on_minimize_effect_complete),
data);
} }
else else
mutter_plugin_effect_completed (plugin, mc_window, mutter_plugin_effect_completed (plugin, mc_window,
@ -519,25 +507,27 @@ minimize (MutterPlugin *plugin, MutterWindow *mc_window)
* calls the manager callback function. * calls the manager callback function.
*/ */
static void static void
on_maximize_effect_complete (ClutterActor *actor, gpointer data) on_maximize_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
{ {
/* /*
* Must reverse the effect of the effect. * Must reverse the effect of the effect.
*/ */
MutterPlugin * plugin = data; MutterPlugin * plugin = data->plugin;
MutterWindow *mc_window = MUTTER_WINDOW (actor); MutterWindow *mc_window = MUTTER_WINDOW (data->actor);
ActorPrivate *apriv = get_actor_private (mc_window); ActorPrivate *apriv = get_actor_private (mc_window);
apriv->tml_maximize = NULL; apriv->tml_maximize = NULL;
/* FIXME - don't assume the original scale was 1.0 */ /* FIXME - don't assume the original scale was 1.0 */
clutter_actor_set_scale (actor, 1.0, 1.0); clutter_actor_set_scale (data->actor, 1.0, 1.0);
clutter_actor_move_anchor_point_from_gravity (actor, clutter_actor_move_anchor_point_from_gravity (data->actor,
CLUTTER_GRAVITY_NORTH_WEST); CLUTTER_GRAVITY_NORTH_WEST);
/* Now notify the manager that we are done with this effect */ /* Now notify the manager that we are done with this effect */
mutter_plugin_effect_completed (plugin, mc_window, mutter_plugin_effect_completed (plugin, mc_window,
MUTTER_PLUGIN_MAXIMIZE); MUTTER_PLUGIN_MAXIMIZE);
g_free (data);
} }
/* /*
@ -553,7 +543,6 @@ maximize (MutterPlugin *plugin,
MutterWindow *mc_window, MutterWindow *mc_window,
gint end_x, gint end_y, gint end_width, gint end_height) gint end_x, gint end_y, gint end_width, gint end_height)
{ {
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
MetaCompWindowType type; MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window); ClutterActor *actor = CLUTTER_ACTOR (mc_window);
@ -566,6 +555,8 @@ maximize (MutterPlugin *plugin,
if (type == META_COMP_WINDOW_NORMAL) if (type == META_COMP_WINDOW_NORMAL)
{ {
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
ActorPrivate *apriv = get_actor_private (mc_window); ActorPrivate *apriv = get_actor_private (mc_window);
guint width, height; guint width, height;
gint x, y; gint x, y;
@ -589,15 +580,18 @@ maximize (MutterPlugin *plugin,
clutter_actor_move_anchor_point (actor, anchor_x, anchor_y); clutter_actor_move_anchor_point (actor, anchor_x, anchor_y);
apriv->tml_maximize = animation = clutter_actor_animate (actor,
clutter_effect_scale (priv->maximize_effect, CLUTTER_EASE_IN_SINE,
actor, MAXIMIZE_TIMEOUT,
scale_x, "scale-x", scale_x,
scale_y, "scale-y", scale_y,
(ClutterEffectCompleteFunc) NULL);
on_maximize_effect_complete, apriv->tml_maximize = clutter_animation_get_timeline (animation);
plugin); data->plugin = plugin;
data->actor = actor;
g_signal_connect (apriv->tml_maximize, "completed",
G_CALLBACK (on_maximize_effect_complete),
data);
return; return;
} }
@ -630,22 +624,24 @@ unmaximize (MutterPlugin *plugin,
} }
static void static void
on_map_effect_complete (ClutterActor *actor, gpointer data) on_map_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
{ {
/* /*
* Must reverse the effect of the effect. * Must reverse the effect of the effect.
*/ */
MutterPlugin *plugin = data; MutterPlugin *plugin = data->plugin;
MutterWindow *mc_window = MUTTER_WINDOW (actor); MutterWindow *mc_window = MUTTER_WINDOW (data->actor);
ActorPrivate *apriv = get_actor_private (mc_window); ActorPrivate *apriv = get_actor_private (mc_window);
apriv->tml_map = NULL; apriv->tml_map = NULL;
clutter_actor_move_anchor_point_from_gravity (actor, clutter_actor_move_anchor_point_from_gravity (data->actor,
CLUTTER_GRAVITY_NORTH_WEST); CLUTTER_GRAVITY_NORTH_WEST);
/* Now notify the manager that we are done with this effect */ /* Now notify the manager that we are done with this effect */
mutter_plugin_effect_completed (plugin, mc_window, MUTTER_PLUGIN_MAP); mutter_plugin_effect_completed (plugin, mc_window, MUTTER_PLUGIN_MAP);
g_free (data);
} }
/* /*
@ -655,7 +651,6 @@ on_map_effect_complete (ClutterActor *actor, gpointer data)
static void static void
map (MutterPlugin *plugin, MutterWindow *mc_window) map (MutterPlugin *plugin, MutterWindow *mc_window)
{ {
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
MetaCompWindowType type; MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window); ClutterActor *actor = CLUTTER_ACTOR (mc_window);
@ -663,6 +658,8 @@ map (MutterPlugin *plugin, MutterWindow *mc_window)
if (type == META_COMP_WINDOW_NORMAL) if (type == META_COMP_WINDOW_NORMAL)
{ {
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
ActorPrivate *apriv = get_actor_private (mc_window); ActorPrivate *apriv = get_actor_private (mc_window);
clutter_actor_move_anchor_point_from_gravity (actor, clutter_actor_move_anchor_point_from_gravity (actor,
@ -671,13 +668,18 @@ map (MutterPlugin *plugin, MutterWindow *mc_window)
clutter_actor_set_scale (actor, 0.0, 0.0); clutter_actor_set_scale (actor, 0.0, 0.0);
clutter_actor_show (actor); clutter_actor_show (actor);
apriv->tml_map = clutter_effect_scale (priv->map_effect, animation = clutter_actor_animate (actor,
actor, CLUTTER_EASE_IN_SINE,
1.0, MAP_TIMEOUT,
1.0, "scale-x", 1.0,
(ClutterEffectCompleteFunc) "scale-y", 1.0,
on_map_effect_complete, NULL);
plugin); apriv->tml_map = clutter_animation_get_timeline (animation);
data->actor = actor;
data->plugin = plugin;
g_signal_connect (apriv->tml_map, "completed",
G_CALLBACK (on_map_effect_complete),
data);
apriv->is_minimized = FALSE; apriv->is_minimized = FALSE;
@ -692,10 +694,10 @@ map (MutterPlugin *plugin, MutterWindow *mc_window)
* further action than notifying the manager that the effect is completed. * further action than notifying the manager that the effect is completed.
*/ */
static void static void
on_destroy_effect_complete (ClutterActor *actor, gpointer data) on_destroy_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
{ {
MutterPlugin *plugin = data; MutterPlugin *plugin = data->plugin;
MutterWindow *mc_window = MUTTER_WINDOW (actor); MutterWindow *mc_window = MUTTER_WINDOW (data->actor);
ActorPrivate *apriv = get_actor_private (mc_window); ActorPrivate *apriv = get_actor_private (mc_window);
apriv->tml_destroy = NULL; apriv->tml_destroy = NULL;
@ -710,7 +712,6 @@ on_destroy_effect_complete (ClutterActor *actor, gpointer data)
static void static void
destroy (MutterPlugin *plugin, MutterWindow *mc_window) destroy (MutterPlugin *plugin, MutterWindow *mc_window)
{ {
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
MetaCompWindowType type; MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window); ClutterActor *actor = CLUTTER_ACTOR (mc_window);
@ -718,18 +719,25 @@ destroy (MutterPlugin *plugin, MutterWindow *mc_window)
if (type == META_COMP_WINDOW_NORMAL) if (type == META_COMP_WINDOW_NORMAL)
{ {
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
ActorPrivate *apriv = get_actor_private (mc_window); ActorPrivate *apriv = get_actor_private (mc_window);
clutter_actor_move_anchor_point_from_gravity (actor, clutter_actor_move_anchor_point_from_gravity (actor,
CLUTTER_GRAVITY_CENTER); CLUTTER_GRAVITY_CENTER);
apriv->tml_destroy = clutter_effect_scale (priv->destroy_effect, animation = clutter_actor_animate (actor,
actor, CLUTTER_EASE_IN_SINE,
1.0, DESTROY_TIMEOUT,
0.0, "scale-x", 0.0,
(ClutterEffectCompleteFunc) "scale-y", 1.0,
on_destroy_effect_complete, NULL);
plugin); apriv->tml_destroy = clutter_animation_get_timeline (animation);
data->plugin = plugin;
data->actor = actor;
g_signal_connect (apriv->tml_destroy, "completed",
G_CALLBACK (on_destroy_effect_complete),
data);
} }
else else
mutter_plugin_effect_completed (plugin, mc_window, mutter_plugin_effect_completed (plugin, mc_window,
@ -740,7 +748,6 @@ static void
kill_effect (MutterPlugin *plugin, MutterWindow *mc_window, gulong event) kill_effect (MutterPlugin *plugin, MutterWindow *mc_window, gulong event)
{ {
ActorPrivate *apriv; ActorPrivate *apriv;
ClutterActor *actor = CLUTTER_ACTOR (mc_window);
if (event & MUTTER_PLUGIN_SWITCH_WORKSPACE) if (event & MUTTER_PLUGIN_SWITCH_WORKSPACE)
{ {
@ -750,7 +757,7 @@ kill_effect (MutterPlugin *plugin, MutterWindow *mc_window, gulong event)
{ {
clutter_timeline_stop (priv->tml_switch_workspace1); clutter_timeline_stop (priv->tml_switch_workspace1);
clutter_timeline_stop (priv->tml_switch_workspace2); clutter_timeline_stop (priv->tml_switch_workspace2);
on_switch_workspace_effect_complete (priv->desktop1, priv->actors); g_signal_emit_by_name (priv->tml_switch_workspace1, "completed", NULL);
} }
if (!(event & ~MUTTER_PLUGIN_SWITCH_WORKSPACE)) if (!(event & ~MUTTER_PLUGIN_SWITCH_WORKSPACE))
@ -765,25 +772,25 @@ kill_effect (MutterPlugin *plugin, MutterWindow *mc_window, gulong event)
if ((event & MUTTER_PLUGIN_MINIMIZE) && apriv->tml_minimize) if ((event & MUTTER_PLUGIN_MINIMIZE) && apriv->tml_minimize)
{ {
clutter_timeline_stop (apriv->tml_minimize); clutter_timeline_stop (apriv->tml_minimize);
on_minimize_effect_complete (actor, NULL); g_signal_emit_by_name (apriv->tml_minimize, "completed", NULL);
} }
if ((event & MUTTER_PLUGIN_MAXIMIZE) && apriv->tml_maximize) if ((event & MUTTER_PLUGIN_MAXIMIZE) && apriv->tml_maximize)
{ {
clutter_timeline_stop (apriv->tml_maximize); clutter_timeline_stop (apriv->tml_maximize);
on_maximize_effect_complete (actor, NULL); g_signal_emit_by_name (apriv->tml_maximize, "completed", NULL);
} }
if ((event & MUTTER_PLUGIN_MAP) && apriv->tml_map) if ((event & MUTTER_PLUGIN_MAP) && apriv->tml_map)
{ {
clutter_timeline_stop (apriv->tml_map); clutter_timeline_stop (apriv->tml_map);
on_map_effect_complete (actor, NULL); g_signal_emit_by_name (apriv->tml_map, "completed", NULL);
} }
if ((event & MUTTER_PLUGIN_DESTROY) && apriv->tml_destroy) if ((event & MUTTER_PLUGIN_DESTROY) && apriv->tml_destroy)
{ {
clutter_timeline_stop (apriv->tml_destroy); clutter_timeline_stop (apriv->tml_destroy);
on_destroy_effect_complete (actor, NULL); g_signal_emit_by_name (apriv->tml_destroy, "completed", NULL);
} }
} }

View File

@ -102,7 +102,7 @@ tidy_texture_frame_paint (ClutterActor *self)
ty2 = CLUTTER_INT_TO_FIXED (tex_height - priv->bottom) / tex_height; ty2 = CLUTTER_INT_TO_FIXED (tex_height - priv->bottom) / tex_height;
col.alpha = clutter_actor_get_paint_opacity (self); col.alpha = clutter_actor_get_paint_opacity (self);
cogl_color (&col); cogl_set_source_color4ub (col.red, col.green, col.blue, col.alpha);
ex = width - priv->right; ex = width - priv->right;
if (ex < 0) if (ex < 0)
@ -115,8 +115,8 @@ tidy_texture_frame_paint (ClutterActor *self)
#define FX(x) CLUTTER_INT_TO_FIXED(x) #define FX(x) CLUTTER_INT_TO_FIXED(x)
/* top left corner */ /* top left corner */
cogl_texture_rectangle (cogl_texture, cogl_set_source_texture (cogl_texture);
0, cogl_rectangle_with_texture_coords (0,
0, 0,
FX(priv->left), /* FIXME: clip if smaller */ FX(priv->left), /* FIXME: clip if smaller */
FX(priv->top), FX(priv->top),
@ -126,19 +126,19 @@ tidy_texture_frame_paint (ClutterActor *self)
ty1); ty1);
/* top middle */ /* top middle */
cogl_texture_rectangle (cogl_texture, cogl_set_source_texture (cogl_texture);
FX(priv->left), cogl_rectangle_with_texture_coords (FX(priv->left),
FX(priv->top),
FX(ex),
0, 0,
FX(ex),
FX(priv->top),
tx1, tx1,
0, 0,
tx2, tx2,
ty1); ty1);
/* top right */ /* top right */
cogl_texture_rectangle (cogl_texture, cogl_set_source_texture (cogl_texture);
FX(ex), cogl_rectangle_with_texture_coords (FX(ex),
0, 0,
FX(width), FX(width),
FX(priv->top), FX(priv->top),
@ -148,7 +148,8 @@ tidy_texture_frame_paint (ClutterActor *self)
ty1); ty1);
/* mid left */ /* mid left */
cogl_texture_rectangle (cogl_texture, cogl_set_source_texture (cogl_texture);
cogl_rectangle_with_texture_coords (
0, 0,
FX(priv->top), FX(priv->top),
FX(priv->left), FX(priv->left),
@ -159,7 +160,8 @@ tidy_texture_frame_paint (ClutterActor *self)
ty2); ty2);
/* center */ /* center */
cogl_texture_rectangle (cogl_texture, cogl_set_source_texture (cogl_texture);
cogl_rectangle_with_texture_coords (
FX(priv->left), FX(priv->left),
FX(priv->top), FX(priv->top),
FX(ex), FX(ex),
@ -170,7 +172,8 @@ tidy_texture_frame_paint (ClutterActor *self)
ty2); ty2);
/* mid right */ /* mid right */
cogl_texture_rectangle (cogl_texture, cogl_set_source_texture (cogl_texture);
cogl_rectangle_with_texture_coords (
FX(ex), FX(ex),
FX(priv->top), FX(priv->top),
FX(width), FX(width),
@ -181,7 +184,8 @@ tidy_texture_frame_paint (ClutterActor *self)
ty2); ty2);
/* bottom left */ /* bottom left */
cogl_texture_rectangle (cogl_texture, cogl_set_source_texture (cogl_texture);
cogl_rectangle_with_texture_coords (
0, 0,
FX(ey), FX(ey),
FX(priv->left), FX(priv->left),
@ -192,7 +196,8 @@ tidy_texture_frame_paint (ClutterActor *self)
CFX_ONE); CFX_ONE);
/* bottom center */ /* bottom center */
cogl_texture_rectangle (cogl_texture, cogl_set_source_texture (cogl_texture);
cogl_rectangle_with_texture_coords (
FX(priv->left), FX(priv->left),
FX(ey), FX(ey),
FX(ex), FX(ex),
@ -203,7 +208,8 @@ tidy_texture_frame_paint (ClutterActor *self)
CFX_ONE); CFX_ONE);
/* bottom right */ /* bottom right */
cogl_texture_rectangle (cogl_texture, cogl_set_source_texture (cogl_texture);
cogl_rectangle_with_texture_coords (
FX(ex), FX(ex),
FX(ey), FX(ey),
FX(width), FX(width),