From 60695fd89a8b5fe35c893123e3fbaf8f9eefac5e Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Tue, 7 Oct 2008 16:29:03 +0100 Subject: [PATCH] Refactored plugin API to use MetaCompWindow. --- src/compositor/clutter-plugins/Makefile.am | 2 +- src/compositor/clutter-plugins/default.c | 114 +++++++++++------- .../compositor-clutter-plugin-manager.c | 54 +++++---- .../compositor-clutter-plugin-manager.h | 18 ++- src/compositor/compositor-clutter.c | 36 ++---- src/include/compositor-clutter-plugin.h | 33 ++--- src/include/compositor-clutter.h | 14 ++- 7 files changed, 138 insertions(+), 133 deletions(-) diff --git a/src/compositor/clutter-plugins/Makefile.am b/src/compositor/clutter-plugins/Makefile.am index 3899b6a10..05fad571d 100644 --- a/src/compositor/clutter-plugins/Makefile.am +++ b/src/compositor/clutter-plugins/Makefile.am @@ -7,7 +7,7 @@ INCLUDES=@METACITY_CFLAGS@ -I $(top_srcdir)/src/include -DMETACITY_LIBEXECDIR=\" default_la_CFLAGS = -fPIC default_la_SOURCES = default.c -default_la_LDFLAGS = -module -avoid-version +default_la_LDFLAGS = -module -avoid-version -no-undefined default_la_LIBADD = @CLUTTER_LIBS@ pkglib_LTLIBRARIES = default.la diff --git a/src/compositor/clutter-plugins/default.c b/src/compositor/clutter-plugins/default.c index ecfd009f3..181f4472a 100644 --- a/src/compositor/clutter-plugins/default.c +++ b/src/compositor/clutter-plugins/default.c @@ -23,6 +23,7 @@ #define META_COMPOSITOR_CLUTTER_BUILDING_PLUGIN 1 #include "compositor-clutter-plugin.h" +#include "compositor-clutter.h" #include #define _(x) dgettext (GETTEXT_PACKAGE, x) @@ -43,22 +44,17 @@ typedef struct PluginPrivate PluginPrivate; typedef struct ActorPrivate ActorPrivate; -static void minimize (ClutterActor *actor, MetaCompWindowType type, - gint workspace); -static void map (ClutterActor *actor, MetaCompWindowType type, - gint workspace); -static void destroy (ClutterActor *actor, MetaCompWindowType type, - gint workspace); -static void maximize (ClutterActor *actor, MetaCompWindowType type, - gint workspace, +static void minimize (MetaCompWindow *actor); +static void map (MetaCompWindow *actor); +static void destroy (MetaCompWindow *actor); +static void maximize (MetaCompWindow *actor, gint x, gint y, gint width, gint height); -static void unmaximize (ClutterActor *actor, MetaCompWindowType type, - gint workspace, +static void unmaximize (MetaCompWindow *actor, gint x, gint y, gint width, gint height); static void switch_workspace (const GList **actors, gint from, gint to); -static void kill_effect (ClutterActor *actor, gulong event); +static void kill_effect (MetaCompWindow *actor, gulong event); static gboolean reload (void); @@ -146,7 +142,7 @@ struct ActorPrivate * Actor private data accessor */ static ActorPrivate * -get_actor_private (ClutterActor *actor) +get_actor_private (MetaCompWindow *actor) { ActorPrivate * priv = g_object_get_data (G_OBJECT (actor), ACTOR_DATA_KEY); @@ -165,12 +161,13 @@ on_switch_workspace_effect_complete (ClutterActor *group, gpointer data) MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; PluginPrivate *ppriv = plugin->plugin_private; GList *l = *((GList**)data); - ClutterActor *actor_for_cb = l->data; + MetaCompWindow *actor_for_cb = l->data; while (l) { - ClutterActor *a = l->data; - ActorPrivate *priv = get_actor_private (a); + ClutterActor *a = l->data; + MetaCompWindow *mcw = META_COMP_WINDOW (a); + ActorPrivate *priv = get_actor_private (mcw); if (priv->orig_parent) { @@ -234,12 +231,12 @@ switch_workspace (const GList **actors, gint from, gint to) while (l) { - ClutterActor *a = l->data; - ActorPrivate *priv = get_actor_private (a); - gint workspace; + MetaCompWindow *mcw = l->data; + ActorPrivate *priv = get_actor_private (mcw); + ClutterActor *a = CLUTTER_ACTOR (mcw); + gint workspace; - workspace = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (a), - META_COMPOSITOR_CLUTTER_PLUGIN_WORKSPACE_KEY)); + workspace = meta_comp_window_get_workspace (mcw); priv->workspace = workspace; @@ -301,8 +298,10 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer data) * that the restoration will not be visible. */ MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; - ActorPrivate *apriv = get_actor_private (actor); + ActorPrivate *apriv; + MetaCompWindow *mcw = META_COMP_WINDOW (actor); + apriv = get_actor_private (META_COMP_WINDOW (actor)); apriv->tml_minimize = NULL; clutter_actor_hide (actor); @@ -316,7 +315,7 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer data) /* Now notify the manager that we are done with this effect */ if (plugin->completed) - plugin->completed (plugin, actor, META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); + plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); } /* @@ -324,15 +323,21 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer data) * completion). */ static void -minimize (ClutterActor *actor, MetaCompWindowType type, gint workspace) +minimize (MetaCompWindow *mcw) { MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; PluginPrivate *priv = plugin->plugin_private; + MetaCompWindowType type; + ClutterActor *actor = CLUTTER_ACTOR (mcw); + + type = meta_comp_window_get_window_type (mcw); if (type == META_COMP_WINDOW_NORMAL) { - ActorPrivate *apriv = get_actor_private (actor); + ActorPrivate *apriv = get_actor_private (mcw); + + printf ("running minimize effect\n"); apriv->is_minimized = TRUE; @@ -350,7 +355,7 @@ minimize (ClutterActor *actor, MetaCompWindowType type, gint workspace) NULL); } else if (plugin->completed) - plugin->completed (plugin, actor, META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); + plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); } /* @@ -364,7 +369,8 @@ on_maximize_effect_complete (ClutterActor *actor, gpointer data) * Must reverse the effect of the effect. */ MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; - ActorPrivate *apriv = get_actor_private (actor); + MetaCompWindow *mcw = META_COMP_WINDOW (actor); + ActorPrivate *apriv = get_actor_private (mcw); apriv->tml_maximize = NULL; @@ -377,7 +383,7 @@ on_maximize_effect_complete (ClutterActor *actor, gpointer data) /* Now notify the manager that we are done with this effect */ if (plugin->completed) - plugin->completed (plugin, actor, META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); + plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); } /* @@ -389,20 +395,24 @@ on_maximize_effect_complete (ClutterActor *actor, gpointer data) * (Something like a sound would be more appropriate.) */ static void -maximize (ClutterActor *actor, MetaCompWindowType type, gint workspace, +maximize (MetaCompWindow *mcw, gint end_x, gint end_y, gint end_width, gint end_height) { MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; PluginPrivate *priv = plugin->plugin_private; + MetaCompWindowType type; + ClutterActor *actor = CLUTTER_ACTOR (mcw); gdouble scale_x = 1.0; gdouble scale_y = 1.0; gint anchor_x = 0; gint anchor_y = 0; + type = meta_comp_window_get_window_type (mcw); + if (type == META_COMP_WINDOW_NORMAL) { - ActorPrivate *apriv = get_actor_private (actor); + ActorPrivate *apriv = get_actor_private (mcw); guint width, height; gint x, y; @@ -437,7 +447,7 @@ maximize (ClutterActor *actor, MetaCompWindowType type, gint workspace, } if (plugin->completed) - plugin->completed (plugin, actor, META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); + plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); } /* @@ -446,14 +456,17 @@ maximize (ClutterActor *actor, MetaCompWindowType type, gint workspace, * (Just a skeleton code.) */ static void -unmaximize (ClutterActor *actor, MetaCompWindowType type, gint workspace, +unmaximize (MetaCompWindow *mcw, gint end_x, gint end_y, gint end_width, gint end_height) { MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; + MetaCompWindowType type; + + type = meta_comp_window_get_window_type (mcw); if (type == META_COMP_WINDOW_NORMAL) { - ActorPrivate *apriv = get_actor_private (actor); + ActorPrivate *apriv = get_actor_private (mcw); apriv->is_maximized = FALSE; @@ -462,7 +475,7 @@ unmaximize (ClutterActor *actor, MetaCompWindowType type, gint workspace, } /* Do this conditionally, if the effect requires completion callback. */ - plugin->completed (plugin, actor, META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE); + plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE); } static void @@ -472,7 +485,8 @@ on_map_effect_complete (ClutterActor *actor, gpointer data) * Must reverse the effect of the effect. */ MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; - ActorPrivate *apriv = get_actor_private (actor); + MetaCompWindow *mcw = META_COMP_WINDOW (actor); + ActorPrivate *apriv = get_actor_private (mcw); apriv->tml_map = NULL; @@ -484,7 +498,7 @@ on_map_effect_complete (ClutterActor *actor, gpointer data) /* Now notify the manager that we are done with this effect */ if (plugin->completed) - plugin->completed (plugin, actor, META_COMPOSITOR_CLUTTER_PLUGIN_MAP); + plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAP); } /* @@ -492,14 +506,18 @@ on_map_effect_complete (ClutterActor *actor, gpointer data) * completion). */ static void -map (ClutterActor *actor, MetaCompWindowType type, gint workspace) +map (MetaCompWindow *mcw) { MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; PluginPrivate *priv = plugin->plugin_private; + MetaCompWindowType type; + ClutterActor *actor = CLUTTER_ACTOR (mcw); + + type = meta_comp_window_get_window_type (mcw); if (type == META_COMP_WINDOW_NORMAL) { - ActorPrivate *apriv = get_actor_private (actor); + ActorPrivate *apriv = get_actor_private (mcw); clutter_actor_move_anchor_point_from_gravity (actor, CLUTTER_GRAVITY_CENTER); @@ -521,7 +539,7 @@ map (ClutterActor *actor, MetaCompWindowType type, gint workspace) } else if (plugin->completed) - plugin->completed (plugin, actor, META_COMPOSITOR_CLUTTER_PLUGIN_MAP); + plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAP); } /* @@ -533,28 +551,33 @@ static void on_destroy_effect_complete (ClutterActor *actor, gpointer data) { MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; - ActorPrivate *apriv = get_actor_private (actor); + MetaCompWindow *mcw = META_COMP_WINDOW (actor); + ActorPrivate *apriv = get_actor_private (mcw); apriv->tml_destroy = NULL; plugin->running--; if (plugin->completed) - plugin->completed (plugin, actor, META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); + plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); } /* * Simple TV-out like effect. */ static void -destroy (ClutterActor *actor, MetaCompWindowType type, gint workspace) +destroy (MetaCompWindow *mcw) { MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; PluginPrivate *priv = plugin->plugin_private; + MetaCompWindowType type; + ClutterActor *actor = CLUTTER_ACTOR (mcw); + + type = meta_comp_window_get_window_type (mcw); if (type == META_COMP_WINDOW_NORMAL) { - ActorPrivate *apriv = get_actor_private (actor); + ActorPrivate *apriv = get_actor_private (mcw); clutter_actor_move_anchor_point_from_gravity (actor, CLUTTER_GRAVITY_CENTER); @@ -570,14 +593,15 @@ destroy (ClutterActor *actor, MetaCompWindowType type, gint workspace) NULL); } else if (plugin->completed) - plugin->completed (plugin, actor, META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); + plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); } static void -kill_effect (ClutterActor *actor, gulong event) +kill_effect (MetaCompWindow *mcw, gulong event) { MetaCompositorClutterPlugin *plugin = &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT; ActorPrivate *apriv; + ClutterActor *actor = CLUTTER_ACTOR (mcw); if (!(plugin->features & event)) { @@ -603,7 +627,7 @@ kill_effect (ClutterActor *actor, gulong event) } } - apriv = get_actor_private (actor); + apriv = get_actor_private (mcw); if ((event & META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE) && apriv->tml_minimize) { diff --git a/src/compositor/compositor-clutter-plugin-manager.c b/src/compositor/compositor-clutter-plugin-manager.c index f9acff926..1707b0ee2 100644 --- a/src/compositor/compositor-clutter-plugin-manager.c +++ b/src/compositor/compositor-clutter-plugin-manager.c @@ -58,7 +58,7 @@ struct MetaCompositorClutterPluginPrivate */ static void meta_compositor_clutter_effect_completed (MetaCompositorClutterPlugin *plugin, - ClutterActor *actor, + MetaCompWindow *actor, unsigned long event) { if (!actor) @@ -347,8 +347,13 @@ meta_compositor_clutter_plugin_manager_load (MetaCompositorClutterPluginManager plg, params))) mgr->plugins = g_list_prepend (mgr->plugins, p); else - g_module_close (plg); + { + g_message ("Plugin load for [%s] failed\n", path); + g_module_close (plg); + } } + else + g_message ("Unable to load plugin [%s]\n", path); g_free (path); g_free (plg_string); @@ -451,10 +456,10 @@ meta_compositor_clutter_plugin_manager_new (MetaScreen *screen, return mgr; } -void +static void meta_compositor_clutter_plugin_manager_kill_effect (MetaCompositorClutterPluginManager *mgr, - ClutterActor *actor, - unsigned long events) + MetaCompWindow *actor, + unsigned long events) { GList *l = mgr->plugins; @@ -484,10 +489,8 @@ meta_compositor_clutter_plugin_manager_kill_effect (MetaCompositorClutterPluginM */ gboolean meta_compositor_clutter_plugin_manager_event_simple (MetaCompositorClutterPluginManager *mgr, - ClutterActor *actor, - unsigned long event, - MetaCompWindowType type, - gint workspace) + MetaCompWindow *actor, + unsigned long event) { GList *l = mgr->plugins; gboolean retval = FALSE; @@ -509,7 +512,7 @@ meta_compositor_clutter_plugin_manager_event_simple (MetaCompositorClutterPlugin meta_compositor_clutter_plugin_manager_kill_effect (mgr, actor, ALL_BUT_SWITCH); - plg->minimize (actor, type, workspace); + plg->minimize (actor); } break; case META_COMPOSITOR_CLUTTER_PLUGIN_MAP: @@ -518,13 +521,13 @@ meta_compositor_clutter_plugin_manager_event_simple (MetaCompositorClutterPlugin meta_compositor_clutter_plugin_manager_kill_effect (mgr, actor, ALL_BUT_SWITCH); - plg->map (actor, type, workspace); + plg->map (actor); } break; case META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY: if (plg->destroy) { - plg->destroy (actor, type, workspace); + plg->destroy (actor); } break; default: @@ -549,14 +552,12 @@ meta_compositor_clutter_plugin_manager_event_simple (MetaCompositorClutterPlugin */ gboolean meta_compositor_clutter_plugin_manager_event_maximize (MetaCompositorClutterPluginManager *mgr, - ClutterActor *actor, - unsigned long event, - MetaCompWindowType type, - gint workspace, - gint target_x, - gint target_y, - gint target_width, - gint target_height) + MetaCompWindow *actor, + unsigned long event, + gint target_x, + gint target_y, + gint target_width, + gint target_height) { GList *l = mgr->plugins; gboolean retval = FALSE; @@ -578,7 +579,7 @@ meta_compositor_clutter_plugin_manager_event_maximize (MetaCompositorClutterPlug meta_compositor_clutter_plugin_manager_kill_effect (mgr, actor, ALL_BUT_SWITCH); - plg->maximize (actor, type, workspace, + plg->maximize (actor, target_x, target_y, target_width, target_height); } @@ -589,7 +590,7 @@ meta_compositor_clutter_plugin_manager_event_maximize (MetaCompositorClutterPlug meta_compositor_clutter_plugin_manager_kill_effect (mgr, actor, ALL_BUT_SWITCH); - plg->unmaximize (actor, type, workspace, + plg->unmaximize (actor, target_x, target_y, target_width, target_height); } @@ -635,7 +636,7 @@ meta_compositor_clutter_plugin_manager_switch_workspace (MetaCompositorClutterPl { retval = TRUE; meta_compositor_clutter_plugin_manager_kill_effect (mgr, - CLUTTER_ACTOR ((*actors)->data), + META_COMP_WINDOW ((*actors)->data), META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE); plg->switch_workspace (actors, from, to); } @@ -659,7 +660,12 @@ gboolean meta_compositor_clutter_plugin_manager_xevent_filter (MetaCompositorClutterPluginManager *mgr, XEvent *xev) { - GList *l = mgr->plugins; + GList *l; + + if (!mgr) + return FALSE; + + l = mgr->plugins; while (l) { diff --git a/src/compositor/compositor-clutter-plugin-manager.h b/src/compositor/compositor-clutter-plugin-manager.h index 3dfc3da14..a2ca52168 100644 --- a/src/compositor/compositor-clutter-plugin-manager.h +++ b/src/compositor/compositor-clutter-plugin-manager.h @@ -32,19 +32,15 @@ typedef struct MetaCompositorClutterPluginManager MetaCompositorClutterPluginMan MetaCompositorClutterPluginManager * meta_compositor_clutter_plugin_manager_new (MetaScreen *screen, ClutterActor *stage); gboolean meta_compositor_clutter_plugin_manager_event_simple (MetaCompositorClutterPluginManager *mgr, - ClutterActor *actor, - unsigned long event, - MetaCompWindowType type, - gint workspace); + MetaCompWindow *actor, + unsigned long event); gboolean meta_compositor_clutter_plugin_manager_event_maximize (MetaCompositorClutterPluginManager *mgr, - ClutterActor *actor, - unsigned long event, - MetaCompWindowType type, - gint workspace, - gint target_x, - gint target_y, - gint target_width, + MetaCompWindow *actor, + unsigned long event, + gint target_x, + gint target_y, + gint target_width, gint target_height); void meta_compositor_clutter_plugin_manager_update_workspaces (MetaCompositorClutterPluginManager *mgr); diff --git a/src/compositor/compositor-clutter.c b/src/compositor/compositor-clutter.c index d671cbf58..21ec77df8 100644 --- a/src/compositor/compositor-clutter.c +++ b/src/compositor/compositor-clutter.c @@ -772,13 +772,13 @@ meta_compositor_clutter_finish_workspace_switch (MetaCompScreen *info) } void -meta_compositor_clutter_window_effect_completed (ClutterActor *actor, - gulong event) +meta_compositor_clutter_window_effect_completed (MetaCompWindow *cw, + gulong event) { - MetaCompWindow *cw = META_COMP_WINDOW (actor); MetaCompWindowPrivate *priv = cw->priv; MetaScreen *screen = priv->screen; MetaCompScreen *info = meta_screen_get_compositor_data (screen); + ClutterActor *actor = CLUTTER_ACTOR (cw); switch (event) { @@ -1051,9 +1051,8 @@ map_win (MetaCompWindow *cw) */ if (info->switch_workspace_in_progress || !info->plugin_mgr || !meta_compositor_clutter_plugin_manager_event_simple (info->plugin_mgr, - CLUTTER_ACTOR (cw), - META_COMPOSITOR_CLUTTER_PLUGIN_MAP, - cw->priv->type, 0)) + cw, + META_COMPOSITOR_CLUTTER_PLUGIN_MAP)) { clutter_actor_show_all (CLUTTER_ACTOR (cw)); priv->map_in_progress--; @@ -1947,9 +1946,8 @@ clutter_cmp_destroy_window (MetaCompositor *compositor, if (!info->plugin_mgr || !meta_compositor_clutter_plugin_manager_event_simple (info->plugin_mgr, - CLUTTER_ACTOR (cw), - META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY, - cw->priv->type, 0)) + cw, + META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY)) { priv->destroy_in_progress--; clutter_actor_destroy (CLUTTER_ACTOR (cw)); @@ -1984,9 +1982,8 @@ clutter_cmp_minimize_window (MetaCompositor *compositor, MetaWindow *window) if (!info->plugin_mgr || !meta_compositor_clutter_plugin_manager_event_simple (info->plugin_mgr, - CLUTTER_ACTOR (cw), - META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE, - cw->priv->type, 0)) + cw, + META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE)) { ClutterActor *a = CLUTTER_ACTOR (cw); gint height = clutter_actor_get_height (a); @@ -2022,9 +2019,9 @@ clutter_cmp_maximize_window (MetaCompositor *compositor, MetaWindow *window, if (!info->plugin_mgr || !meta_compositor_clutter_plugin_manager_event_maximize (info->plugin_mgr, - CLUTTER_ACTOR (cw), + cw, META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE, - cw->priv->type, 0, x, y, width, height)) + x, y, width, height)) { cw->priv->maximize_in_progress--; } @@ -2055,9 +2052,9 @@ clutter_cmp_unmaximize_window (MetaCompositor *compositor, MetaWindow *window, if (!info->plugin_mgr || !meta_compositor_clutter_plugin_manager_event_maximize (info->plugin_mgr, - CLUTTER_ACTOR (cw), + cw, META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE, - cw->priv->type, 0, x, y, width, height)) + x, y, width, height)) { cw->priv->unmaximize_in_progress--; } @@ -2130,13 +2127,6 @@ clutter_cmp_switch_workspace (MetaCompositor *compositor, } } - /* - * Attach workspace number to the actor, so the plugin can use it. - */ - g_object_set_data (G_OBJECT (cw), - META_COMPOSITOR_CLUTTER_PLUGIN_WORKSPACE_KEY, - GINT_TO_POINTER (workspace)); - l = l->next; } diff --git a/src/include/compositor-clutter-plugin.h b/src/include/compositor-clutter-plugin.h index 2d7374628..34464030a 100644 --- a/src/include/compositor-clutter-plugin.h +++ b/src/include/compositor-clutter-plugin.h @@ -27,6 +27,7 @@ #include "types.h" #include "config.h" #include "compositor.h" +#include "compositor-clutter.h" #include @@ -93,12 +94,6 @@ typedef struct MetaCompositorClutterPlugin MetaCompositorClutterPlugin; #define META_COMPOSITOR_CLUTTER_PLUGIN_ALL_EFFECTS 0xffffffffUL -/* - * A key that the switch_workspace() handler can use to retrive workspace - * the actor is on. - */ -#define META_COMPOSITOR_CLUTTER_PLUGIN_WORKSPACE_KEY "MCCP-Manager-workspace" - struct MetaCompositorClutterPlugin { /* @@ -136,33 +131,23 @@ struct MetaCompositorClutterPlugin * On completion, each event handler must call the manager completed() * callback function. */ - void (*minimize) (ClutterActor *actor, - MetaCompWindowType type, - gint workspace); + void (*minimize) (MetaCompWindow *actor); - void (*maximize) (ClutterActor *actor, - MetaCompWindowType type, - gint workspace, + void (*maximize) (MetaCompWindow *actor, gint x, gint y, gint width, gint height); - void (*unmaximize) (ClutterActor *actor, - MetaCompWindowType type, - gint workspace, + void (*unmaximize) (MetaCompWindow *actor, gint x, gint y, gint width, gint height); - void (*map) (ClutterActor *actor, - MetaCompWindowType type, - gint workspace); + void (*map) (MetaCompWindow *actor); - void (*destroy) (ClutterActor *actor, - MetaCompWindowType type, - gint workspace); + void (*destroy) (MetaCompWindow *actor); /* * Each actor in the list has a workspace number attached to it using @@ -179,7 +164,7 @@ struct MetaCompositorClutterPlugin * The events parameter is a bitmask indicating which effects are to be * killed. */ - void (*kill_effect) (ClutterActor *actor, + void (*kill_effect) (MetaCompWindow *actor, gulong events); @@ -190,7 +175,7 @@ struct MetaCompositorClutterPlugin gboolean (*reload) (void); /* General XEvent filter. This is fired *before* metacity itself handles - * an event. Return TRUE to block any further processing. + * an event. Return TRUE to block any further processing. */ gboolean (*xevent_filter) (XEvent *event); @@ -253,7 +238,7 @@ struct MetaCompositorClutterPlugin * actor list, but the actor parameter must not be NULL. */ void (*completed) (MetaCompositorClutterPlugin *plugin, - ClutterActor *actor, + MetaCompWindow *actor, unsigned long event); /* Private; manager private data. */ diff --git a/src/include/compositor-clutter.h b/src/include/compositor-clutter.h index cefdb6f05..6eab55fde 100644 --- a/src/include/compositor-clutter.h +++ b/src/include/compositor-clutter.h @@ -25,12 +25,9 @@ #ifndef META_COMPOSITOR_CLUTTER_H_ #define META_COMPOSITOR_CLUTTER_H_ +#include + #include "types.h" -#include "compositor-clutter-plugin.h" - -MetaCompositor *meta_compositor_clutter_new (MetaDisplay *display); - -void meta_compositor_clutter_window_effect_completed (ClutterActor *actor, gulong event); /* * MetaCompWindow object (ClutterGroup sub-class) @@ -64,4 +61,11 @@ Window meta_comp_window_get_x_window (MetaCompWindow *mcw); MetaCompWindowType meta_comp_window_get_window_type (MetaCompWindow *mcw); gint meta_comp_window_get_workspace (MetaCompWindow *mcw); + +/* Compositor API */ +MetaCompositor *meta_compositor_clutter_new (MetaDisplay *display); + +void meta_compositor_clutter_window_effect_completed (MetaCompWindow *actor, gulong event); + + #endif