Passes through the plugin manager and default plugin trying to rename

terse variable names, simplify the plugin interface or consider tweaks
for maintainability.

* Renames plg -> plugin
* Renames mgr ->plugin_mgr (since in a combined window and composite
manager I think "mgr" will end up being ambiguous in places)
* Renames PluginWorkspaceRectangle -> MetaRectangle (We are no longer
concerned about mbwm2 portability)
* Renames a few one letter variable names e.g. a -> window, r ->rect
* Renames some vars to indicate what they represent not their data type,
e.g. group1, group2 ->workspace0, workspace1
* Renames the variable mcw -> mc_window to make it more immediately
obvious what it represents.
* Removes the verbose META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE macro,
and just uses metacity_plugin instead.
* Instead of hanging data of the plugins global descriptor, we just use a
standalone static global variable.
* Make do_init a function pointer inside the plugin descriptors instead of
special casing it and using another g_module_symbol call. This also removes
the need for the META_COMPOSITOR_CLUTTER_PLUGIN_INIT_FUNC macro.
* A bunch of anal 80char fixes
* Removes the screen_width,height variables from the plugin descriptor struct
and add a plugin API instead.
This commit is contained in:
Robert Bragg 2008-10-13 12:23:47 +01:00
parent 74b34fe239
commit c4fe54d004
3 changed files with 498 additions and 512 deletions

View File

@ -42,9 +42,7 @@
#define ACTOR_DATA_KEY "MCCP-Default-actor-data" #define ACTOR_DATA_KEY "MCCP-Default-actor-data"
static GQuark actor_data_quark = 0; static GQuark actor_data_quark = 0;
typedef struct PluginPrivate PluginPrivate; static gboolean do_init (const char *params);
typedef struct ActorPrivate ActorPrivate;
static void minimize (MetaCompWindow *actor); static void minimize (MetaCompWindow *actor);
static void map (MetaCompWindow *actor); static void map (MetaCompWindow *actor);
static void destroy (MetaCompWindow *actor); static void destroy (MetaCompWindow *actor);
@ -58,14 +56,15 @@ static void switch_workspace (const GList **actors, gint from, gint to,
static void kill_effect (MetaCompWindow *actor, gulong event); static void kill_effect (MetaCompWindow *actor, gulong event);
static gboolean reload (void); static gboolean reload (const char *params);
/* /*
* First we create the header struct and initialize its static members. * First we create the header struct and initialize its static members.
* Any dynamically allocated data should be initialized in the * Any dynamically allocated data should be initialized in the
* init () function below. * init () function below.
*/ */
MetaCompositorClutterPlugin META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT = G_MODULE_EXPORT MetaCompositorClutterPlugin metacity_plugin =
{ {
/* /*
* These are predefined values; do not modify. * These are predefined values; do not modify.
@ -78,6 +77,9 @@ MetaCompositorClutterPlugin META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT =
/* Human readable name (for use in UI) */ /* Human readable name (for use in UI) */
.name = "Default Effects", .name = "Default Effects",
/* Plugin load time initialiser */
.do_init = do_init,
/* Which types of events this plugin supports */ /* Which types of events this plugin supports */
.features = META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE | .features = META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE |
META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY | META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY |
@ -104,7 +106,7 @@ MetaCompositorClutterPlugin META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT =
/* /*
* Plugin private data that we store in the .plugin_private member. * Plugin private data that we store in the .plugin_private member.
*/ */
struct PluginPrivate typedef struct _DefaultPluginState
{ {
ClutterEffectTemplate *destroy_effect; ClutterEffectTemplate *destroy_effect;
ClutterEffectTemplate *minimize_effect; ClutterEffectTemplate *minimize_effect;
@ -120,12 +122,12 @@ struct PluginPrivate
ClutterActor *desktop2; ClutterActor *desktop2;
gboolean debug_mode : 1; gboolean debug_mode : 1;
}; } DefaultPluginState;
/* /*
* Per actor private data we attach to each actor. * Per actor private data we attach to each actor.
*/ */
struct ActorPrivate typedef struct _ActorPrivate
{ {
ClutterActor *orig_parent; ClutterActor *orig_parent;
@ -136,7 +138,9 @@ struct ActorPrivate
gboolean is_minimized : 1; gboolean is_minimized : 1;
gboolean is_maximized : 1; gboolean is_maximized : 1;
}; } ActorPrivate;
static DefaultPluginState *plugin_state;
/* /*
* Actor private data accessor * Actor private data accessor
@ -168,26 +172,18 @@ get_actor_private (MetaCompWindow *actor)
return priv; return priv;
} }
static inline
MetaCompositorClutterPlugin *
get_plugin ()
{
return &META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT;
}
static void static void
on_switch_workspace_effect_complete (ClutterActor *group, gpointer data) on_switch_workspace_effect_complete (ClutterActor *group, gpointer data)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin (); DefaultPluginState *state = plugin_state;
PluginPrivate *ppriv = plugin->plugin_private; GList *l = *((GList**)data);
GList *l = *((GList**)data); MetaCompWindow *actor_for_cb = l->data;
MetaCompWindow *actor_for_cb = l->data;
while (l) while (l)
{ {
ClutterActor *a = l->data; ClutterActor *a = l->data;
MetaCompWindow *mcw = META_COMP_WINDOW (a); MetaCompWindow *mc_window = META_COMP_WINDOW (a);
ActorPrivate *priv = get_actor_private (mcw); ActorPrivate *priv = get_actor_private (mc_window);
if (priv->orig_parent) if (priv->orig_parent)
{ {
@ -198,16 +194,16 @@ on_switch_workspace_effect_complete (ClutterActor *group, gpointer data)
l = l->next; l = l->next;
} }
clutter_actor_destroy (ppriv->desktop1); clutter_actor_destroy (state->desktop1);
clutter_actor_destroy (ppriv->desktop2); clutter_actor_destroy (state->desktop2);
ppriv->actors = NULL; state->actors = NULL;
ppriv->tml_switch_workspace1 = NULL; state->tml_switch_workspace1 = NULL;
ppriv->tml_switch_workspace2 = NULL; state->tml_switch_workspace2 = NULL;
ppriv->desktop1 = NULL; state->desktop1 = NULL;
ppriv->desktop2 = NULL; state->desktop2 = NULL;
meta_comp_clutter_plugin_effect_completed (plugin, actor_for_cb, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, actor_for_cb,
META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE); META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE);
} }
@ -215,33 +211,35 @@ static void
switch_workspace (const GList **actors, gint from, gint to, switch_workspace (const GList **actors, gint from, gint to,
MetaMotionDirection direction) MetaMotionDirection direction)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin (); MetaCompositorClutterPlugin *plugin = &metacity_plugin;
PluginPrivate *ppriv = plugin->plugin_private; DefaultPluginState *state = plugin_state;
GList *l; GList *l;
gint n_workspaces; gint n_workspaces;
ClutterActor *group1 = clutter_group_new (); ClutterActor *workspace0 = clutter_group_new ();
ClutterActor *group2 = clutter_group_new (); ClutterActor *workspace1 = clutter_group_new ();
ClutterActor *stage; ClutterActor *stage;
int screen_width, screen_height;
stage = meta_comp_clutter_plugin_get_stage (plugin); stage = meta_comp_clutter_plugin_get_stage (plugin);
#if 1 meta_comp_clutter_plugin_query_screen_size (plugin,
clutter_actor_set_anchor_point (group2, &screen_width,
plugin->screen_width, &screen_height);
plugin->screen_height); clutter_actor_set_anchor_point (workspace1,
clutter_actor_set_position (group2, screen_width,
plugin->screen_width, screen_height);
plugin->screen_height); clutter_actor_set_position (workspace1,
#endif screen_width,
screen_height);
clutter_actor_set_scale (group2, 0.0, 0.0); clutter_actor_set_scale (workspace1, 0.0, 0.0);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group2); clutter_container_add_actor (CLUTTER_CONTAINER (stage), workspace1);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group1); clutter_container_add_actor (CLUTTER_CONTAINER (stage), workspace0);
if (from == to) if (from == to)
{ {
meta_comp_clutter_plugin_effect_completed (plugin, NULL, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, NULL,
META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE); META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE);
return; return;
} }
@ -252,28 +250,29 @@ switch_workspace (const GList **actors, gint from, gint to,
while (l) while (l)
{ {
MetaCompWindow *mcw = l->data; MetaCompWindow *mc_window = l->data;
ActorPrivate *priv = get_actor_private (mcw); ActorPrivate *priv = get_actor_private (mc_window);
ClutterActor *a = CLUTTER_ACTOR (mcw); ClutterActor *window = CLUTTER_ACTOR (mc_window);
gint workspace; gint win_workspace;
workspace = meta_comp_window_get_workspace (mcw); win_workspace = meta_comp_window_get_workspace (mc_window);
if (workspace == to || workspace == from) if (win_workspace == to || win_workspace == from)
{ {
gint x, y; gint x, y;
guint w, h; guint w, h;
clutter_actor_get_position (a, &x, &y); clutter_actor_get_position (window, &x, &y);
clutter_actor_get_size (a, &w, &h); clutter_actor_get_size (window, &w, &h);
priv->orig_parent = clutter_actor_get_parent (a); priv->orig_parent = clutter_actor_get_parent (window);
clutter_actor_reparent (a, workspace == to ? group2 : group1); clutter_actor_reparent (window,
clutter_actor_show_all (a); win_workspace == to ? workspace1 : workspace0);
clutter_actor_raise_top (a); clutter_actor_show_all (window);
clutter_actor_raise_top (window);
} }
else if (workspace < 0) else if (win_workspace < 0)
{ {
/* Sticky window */ /* Sticky window */
priv->orig_parent = NULL; priv->orig_parent = NULL;
@ -281,27 +280,27 @@ switch_workspace (const GList **actors, gint from, gint to,
else else
{ {
/* Window on some other desktop */ /* Window on some other desktop */
clutter_actor_hide (a); clutter_actor_hide (window);
priv->orig_parent = NULL; priv->orig_parent = NULL;
} }
l = l->prev; l = l->prev;
} }
ppriv->actors = (GList **)actors; state->actors = (GList **)actors;
ppriv->desktop1 = group1; state->desktop1 = workspace0;
ppriv->desktop2 = group2; state->desktop2 = workspace1;
ppriv->tml_switch_workspace2 = clutter_effect_scale ( state->tml_switch_workspace2 =
ppriv->switch_workspace_effect, clutter_effect_scale (state->switch_workspace_effect,
group2, 1.0, 1.0, workspace1, 1.0, 1.0,
on_switch_workspace_effect_complete, on_switch_workspace_effect_complete,
(gpointer)actors); (gpointer)actors);
ppriv->tml_switch_workspace1 = clutter_effect_scale ( state->tml_switch_workspace1 =
ppriv->switch_workspace_effect, clutter_effect_scale (state->switch_workspace_effect,
group1, 0.0, 0.0, workspace0, 0.0, 0.0,
NULL, NULL); NULL, NULL);
} }
@ -316,24 +315,24 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer 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.
*/ */
MetaCompositorClutterPlugin *plugin = get_plugin ();
ActorPrivate *apriv; ActorPrivate *apriv;
MetaCompWindow *mcw = META_COMP_WINDOW (actor); MetaCompWindow *mc_window = META_COMP_WINDOW (actor);
apriv = get_actor_private (META_COMP_WINDOW (actor)); apriv = get_actor_private (META_COMP_WINDOW (actor));
apriv->tml_minimize = NULL; apriv->tml_minimize = NULL;
clutter_actor_hide (actor); clutter_actor_hide (actor);
/* FIXME - we shouldn't assume the original scale, it should be saved
* at the start of the effect */
clutter_actor_set_scale (actor, 1.0, 1.0); clutter_actor_set_scale (actor, 1.0, 1.0);
clutter_actor_move_anchor_point_from_gravity (actor, clutter_actor_move_anchor_point_from_gravity (actor,
CLUTTER_GRAVITY_NORTH_WEST); CLUTTER_GRAVITY_NORTH_WEST);
/* Decrease the running effect counter */ /* Decrease the running effect counter */
plugin->running--; metacity_plugin.running--;
/* Now notify the manager that we are done with this effect */ /* Now notify the manager that we are done with this effect */
meta_comp_clutter_plugin_effect_completed (plugin, mcw, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, mc_window,
META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE);
} }
@ -342,28 +341,26 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer data)
* completion). * completion).
*/ */
static void static void
minimize (MetaCompWindow *mcw) minimize (MetaCompWindow *mc_window)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin (); DefaultPluginState *state = plugin_state;
PluginPrivate *priv = plugin->plugin_private; MetaCompWindowType type;
MetaCompWindowType type; ClutterActor *actor = CLUTTER_ACTOR (mc_window);
ClutterActor *actor = CLUTTER_ACTOR (mcw);
type = meta_comp_window_get_window_type (mcw); type = meta_comp_window_get_window_type (mc_window);
if (type == META_COMP_WINDOW_NORMAL) if (type == META_COMP_WINDOW_NORMAL)
{ {
ActorPrivate *apriv = get_actor_private (mcw); ActorPrivate *apriv = get_actor_private (mc_window);
apriv->is_minimized = TRUE; apriv->is_minimized = TRUE;
clutter_actor_move_anchor_point_from_gravity (actor, clutter_actor_move_anchor_point_from_gravity (actor,
CLUTTER_GRAVITY_CENTER); CLUTTER_GRAVITY_CENTER);
META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT.running++; metacity_plugin.running++;
apriv->tml_minimize = clutter_effect_scale (priv->minimize_effect, apriv->tml_minimize = clutter_effect_scale (state->minimize_effect,
actor, actor,
0.0, 0.0,
0.0, 0.0,
@ -372,7 +369,7 @@ minimize (MetaCompWindow *mcw)
NULL); NULL);
} }
else else
meta_comp_clutter_plugin_effect_completed (plugin, mcw, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, mc_window,
META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE);
} }
@ -386,21 +383,21 @@ on_maximize_effect_complete (ClutterActor *actor, gpointer data)
/* /*
* Must reverse the effect of the effect. * Must reverse the effect of the effect.
*/ */
MetaCompositorClutterPlugin *plugin = get_plugin (); MetaCompWindow *mc_window = META_COMP_WINDOW (actor);
MetaCompWindow *mcw = META_COMP_WINDOW (actor); ActorPrivate *apriv = get_actor_private (mc_window);
ActorPrivate *apriv = get_actor_private (mcw);
apriv->tml_maximize = NULL; apriv->tml_maximize = NULL;
/* FIXME - don't assume the original scale was 1.0 */
clutter_actor_set_scale (actor, 1.0, 1.0); clutter_actor_set_scale (actor, 1.0, 1.0);
clutter_actor_move_anchor_point_from_gravity (actor, clutter_actor_move_anchor_point_from_gravity (actor,
CLUTTER_GRAVITY_NORTH_WEST); CLUTTER_GRAVITY_NORTH_WEST);
/* Decrease the running effect counter */ /* Decrease the running effect counter */
plugin->running--; metacity_plugin.running--;
/* Now notify the manager that we are done with this effect */ /* Now notify the manager that we are done with this effect */
meta_comp_clutter_plugin_effect_completed (plugin, mcw, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, mc_window,
META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE);
} }
@ -413,24 +410,22 @@ on_maximize_effect_complete (ClutterActor *actor, gpointer data)
* (Something like a sound would be more appropriate.) * (Something like a sound would be more appropriate.)
*/ */
static void static void
maximize (MetaCompWindow *mcw, maximize (MetaCompWindow *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)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin (); MetaCompWindowType type;
PluginPrivate *priv = plugin->plugin_private; ClutterActor *actor = CLUTTER_ACTOR (mc_window);
MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mcw);
gdouble scale_x = 1.0; gdouble scale_x = 1.0;
gdouble scale_y = 1.0; gdouble scale_y = 1.0;
gint anchor_x = 0; gint anchor_x = 0;
gint anchor_y = 0; gint anchor_y = 0;
type = meta_comp_window_get_window_type (mcw); type = meta_comp_window_get_window_type (mc_window);
if (type == META_COMP_WINDOW_NORMAL) if (type == META_COMP_WINDOW_NORMAL)
{ {
ActorPrivate *apriv = get_actor_private (mcw); ActorPrivate *apriv = get_actor_private (mc_window);
guint width, height; guint width, height;
gint x, y; gint x, y;
@ -453,18 +448,19 @@ maximize (MetaCompWindow *mcw,
clutter_actor_move_anchor_point (actor, anchor_x, anchor_y); clutter_actor_move_anchor_point (actor, anchor_x, anchor_y);
apriv->tml_maximize = clutter_effect_scale (priv->maximize_effect, apriv->tml_maximize =
actor, clutter_effect_scale (plugin_state->maximize_effect,
scale_x, actor,
scale_y, scale_x,
(ClutterEffectCompleteFunc) scale_y,
on_maximize_effect_complete, (ClutterEffectCompleteFunc)
NULL); on_maximize_effect_complete,
NULL);
return; return;
} }
meta_comp_clutter_plugin_effect_completed (plugin, mcw, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, mc_window,
META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE);
} }
@ -474,23 +470,20 @@ maximize (MetaCompWindow *mcw,
* (Just a skeleton code.) * (Just a skeleton code.)
*/ */
static void static void
unmaximize (MetaCompWindow *mcw, unmaximize (MetaCompWindow *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)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin (); MetaCompWindowType type = meta_comp_window_get_window_type (mc_window);
MetaCompWindowType type;
type = meta_comp_window_get_window_type (mcw);
if (type == META_COMP_WINDOW_NORMAL) if (type == META_COMP_WINDOW_NORMAL)
{ {
ActorPrivate *apriv = get_actor_private (mcw); ActorPrivate *apriv = get_actor_private (mc_window);
apriv->is_maximized = FALSE; apriv->is_maximized = FALSE;
} }
/* Do this conditionally, if the effect requires completion callback. */ /* Do this conditionally, if the effect requires completion callback. */
meta_comp_clutter_plugin_effect_completed (plugin, mcw, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, mc_window,
META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE); META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE);
} }
@ -500,9 +493,8 @@ on_map_effect_complete (ClutterActor *actor, gpointer data)
/* /*
* Must reverse the effect of the effect. * Must reverse the effect of the effect.
*/ */
MetaCompositorClutterPlugin *plugin = get_plugin (); MetaCompWindow *mc_window = META_COMP_WINDOW (actor);
MetaCompWindow *mcw = META_COMP_WINDOW (actor); ActorPrivate *apriv = get_actor_private (mc_window);
ActorPrivate *apriv = get_actor_private (mcw);
apriv->tml_map = NULL; apriv->tml_map = NULL;
@ -510,10 +502,10 @@ on_map_effect_complete (ClutterActor *actor, gpointer data)
CLUTTER_GRAVITY_NORTH_WEST); CLUTTER_GRAVITY_NORTH_WEST);
/* Decrease the running effect counter */ /* Decrease the running effect counter */
plugin->running--; metacity_plugin.running--;
/* Now notify the manager that we are done with this effect */ /* Now notify the manager that we are done with this effect */
meta_comp_clutter_plugin_effect_completed (plugin, mcw, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, mc_window,
META_COMPOSITOR_CLUTTER_PLUGIN_MAP); META_COMPOSITOR_CLUTTER_PLUGIN_MAP);
} }
@ -522,28 +514,26 @@ on_map_effect_complete (ClutterActor *actor, gpointer data)
* completion). * completion).
*/ */
static void static void
map (MetaCompWindow *mcw) map (MetaCompWindow *mc_window)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin ();
PluginPrivate *priv = plugin->plugin_private;
MetaCompWindowType type; MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mcw); ClutterActor *actor = CLUTTER_ACTOR (mc_window);
type = meta_comp_window_get_window_type (mcw); type = meta_comp_window_get_window_type (mc_window);
if (type == META_COMP_WINDOW_NORMAL) if (type == META_COMP_WINDOW_NORMAL)
{ {
ActorPrivate *apriv = get_actor_private (mcw); 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);
META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT.running++; metacity_plugin.running++;
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, apriv->tml_map = clutter_effect_scale (plugin_state->map_effect,
actor, actor,
1.0, 1.0,
1.0, 1.0,
@ -555,7 +545,7 @@ map (MetaCompWindow *mcw)
} }
else else
meta_comp_clutter_plugin_effect_completed (plugin, mcw, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, mc_window,
META_COMPOSITOR_CLUTTER_PLUGIN_MAP); META_COMPOSITOR_CLUTTER_PLUGIN_MAP);
} }
@ -567,15 +557,15 @@ map (MetaCompWindow *mcw)
static void static void
on_destroy_effect_complete (ClutterActor *actor, gpointer data) on_destroy_effect_complete (ClutterActor *actor, gpointer data)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin (); MetaCompositorClutterPlugin *plugin = &metacity_plugin;
MetaCompWindow *mcw = META_COMP_WINDOW (actor); MetaCompWindow *mc_window = META_COMP_WINDOW (actor);
ActorPrivate *apriv = get_actor_private (mcw); ActorPrivate *apriv = get_actor_private (mc_window);
apriv->tml_destroy = NULL; apriv->tml_destroy = NULL;
plugin->running--; metacity_plugin.running--;
meta_comp_clutter_plugin_effect_completed (plugin, mcw, meta_comp_clutter_plugin_effect_completed (plugin, mc_window,
META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY);
} }
@ -583,25 +573,23 @@ on_destroy_effect_complete (ClutterActor *actor, gpointer data)
* Simple TV-out like effect. * Simple TV-out like effect.
*/ */
static void static void
destroy (MetaCompWindow *mcw) destroy (MetaCompWindow *mc_window)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin (); MetaCompWindowType type;
PluginPrivate *priv = plugin->plugin_private; ClutterActor *actor = CLUTTER_ACTOR (mc_window);
MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mcw);
type = meta_comp_window_get_window_type (mcw); type = meta_comp_window_get_window_type (mc_window);
if (type == META_COMP_WINDOW_NORMAL) if (type == META_COMP_WINDOW_NORMAL)
{ {
ActorPrivate *apriv = get_actor_private (mcw); 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);
plugin->running++; metacity_plugin.running++;
apriv->tml_destroy = clutter_effect_scale (priv->destroy_effect, apriv->tml_destroy = clutter_effect_scale (plugin_state->destroy_effect,
actor, actor,
1.0, 1.0,
0.0, 0.0,
@ -610,16 +598,16 @@ destroy (MetaCompWindow *mcw)
NULL); NULL);
} }
else else
meta_comp_clutter_plugin_effect_completed (plugin, mcw, meta_comp_clutter_plugin_effect_completed (&metacity_plugin, mc_window,
META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY);
} }
static void static void
kill_effect (MetaCompWindow *mcw, gulong event) kill_effect (MetaCompWindow *mc_window, gulong event)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin (); MetaCompositorClutterPlugin *plugin = &metacity_plugin;
ActorPrivate *apriv; ActorPrivate *apriv;
ClutterActor *actor = CLUTTER_ACTOR (mcw); ClutterActor *actor = CLUTTER_ACTOR (mc_window);
if (!(plugin->features & event)) if (!(plugin->features & event))
{ {
@ -629,13 +617,13 @@ kill_effect (MetaCompWindow *mcw, gulong event)
if (event & META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE) if (event & META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE)
{ {
PluginPrivate *ppriv = plugin->plugin_private; DefaultPluginState *state = plugin_state;
if (ppriv->tml_switch_workspace1) if (state->tml_switch_workspace1)
{ {
clutter_timeline_stop (ppriv->tml_switch_workspace1); clutter_timeline_stop (state->tml_switch_workspace1);
clutter_timeline_stop (ppriv->tml_switch_workspace2); clutter_timeline_stop (state->tml_switch_workspace2);
on_switch_workspace_effect_complete (ppriv->desktop1, ppriv->actors); on_switch_workspace_effect_complete (state->desktop1, state->actors);
} }
if (!(event & ~META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE)) if (!(event & ~META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE))
@ -645,7 +633,7 @@ kill_effect (MetaCompWindow *mcw, gulong event)
} }
} }
apriv = get_actor_private (mcw); apriv = get_actor_private (mc_window);
if ((event & META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE) && apriv->tml_minimize) if ((event & META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE) && apriv->tml_minimize)
{ {
@ -694,36 +682,23 @@ g_module_check_init (GModule *module)
* by the reload() function. Returns TRUE on success. * by the reload() function. Returns TRUE on success.
*/ */
static gboolean static gboolean
do_init () do_init (const char *params)
{ {
MetaCompositorClutterPlugin *plugin = get_plugin (); guint destroy_timeout = DESTROY_TIMEOUT;
guint minimize_timeout = MINIMIZE_TIMEOUT;
guint maximize_timeout = MAXIMIZE_TIMEOUT;
guint map_timeout = MAP_TIMEOUT;
guint switch_timeout = SWITCH_TIMEOUT;
PluginPrivate *priv = g_new0 (PluginPrivate, 1); plugin_state = g_new0 (DefaultPluginState, 1);
const gchar *params;
guint destroy_timeout = DESTROY_TIMEOUT;
guint minimize_timeout = MINIMIZE_TIMEOUT;
guint maximize_timeout = MAXIMIZE_TIMEOUT;
guint map_timeout = MAP_TIMEOUT;
guint switch_timeout = SWITCH_TIMEOUT;
const gchar *name;
plugin->plugin_private = priv;
name = plugin->name;
plugin->name = _(name);
params = plugin->params;
if (params) if (params)
{ {
gchar *p;
if (strstr (params, "debug")) if (strstr (params, "debug"))
{ {
g_debug ("%s: Entering debug mode.", g_debug ("%s: Entering debug mode.", metacity_plugin.name);
META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT.name);
priv->debug_mode = TRUE; plugin_state->debug_mode = TRUE;
/* /*
* Double the effect duration to make them easier to observe. * Double the effect duration to make them easier to observe.
@ -734,60 +709,30 @@ do_init ()
map_timeout *= 2; map_timeout *= 2;
switch_timeout *= 2; switch_timeout *= 2;
} }
if ((p = strstr (params, "disable:")))
{
gchar *d = g_strdup (p+8);
p = strchr (d, ';');
if (p)
*p = 0;
if (strstr (d, "minimize"))
plugin->features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE;
if (strstr (d, "maximize"))
plugin->features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE;
if (strstr (d, "unmaximize"))
plugin->features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE;
if (strstr (d, "map"))
plugin->features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_MAP;
if (strstr (d, "destroy"))
plugin->features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY;
if (strstr (d, "switch-workspace"))
plugin->features &= ~META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE;
g_free (d);
}
} }
priv->destroy_effect plugin_state->destroy_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration ( = clutter_effect_template_new (clutter_timeline_new_for_duration (
destroy_timeout), destroy_timeout),
CLUTTER_ALPHA_SINE_INC); CLUTTER_ALPHA_SINE_INC);
priv->minimize_effect plugin_state->minimize_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration ( = clutter_effect_template_new (clutter_timeline_new_for_duration (
minimize_timeout), minimize_timeout),
CLUTTER_ALPHA_SINE_INC); CLUTTER_ALPHA_SINE_INC);
priv->maximize_effect plugin_state->maximize_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration ( = clutter_effect_template_new (clutter_timeline_new_for_duration (
maximize_timeout), maximize_timeout),
CLUTTER_ALPHA_SINE_INC); CLUTTER_ALPHA_SINE_INC);
priv->map_effect plugin_state->map_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration ( = clutter_effect_template_new (clutter_timeline_new_for_duration (
map_timeout), map_timeout),
CLUTTER_ALPHA_SINE_INC); CLUTTER_ALPHA_SINE_INC);
priv->switch_workspace_effect plugin_state->switch_workspace_effect
= clutter_effect_template_new (clutter_timeline_new_for_duration ( = clutter_effect_template_new (clutter_timeline_new_for_duration (
switch_timeout), switch_timeout),
CLUTTER_ALPHA_SINE_INC); CLUTTER_ALPHA_SINE_INC);
@ -795,22 +740,15 @@ do_init ()
return TRUE; return TRUE;
} }
META_COMPOSITOR_CLUTTER_PLUGIN_INIT_FUNC
{
return do_init ();
}
static void static void
free_plugin_private (PluginPrivate *priv) free_plugin_private (DefaultPluginState *state)
{ {
g_object_unref (priv->destroy_effect); g_object_unref (state->destroy_effect);
g_object_unref (priv->minimize_effect); g_object_unref (state->minimize_effect);
g_object_unref (priv->maximize_effect); g_object_unref (state->maximize_effect);
g_object_unref (priv->switch_workspace_effect); g_object_unref (state->switch_workspace_effect);
g_free (priv); g_free (state);
META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT.plugin_private = NULL;
} }
/* /*
@ -818,22 +756,22 @@ free_plugin_private (PluginPrivate *priv)
* changed. * changed.
*/ */
static gboolean static gboolean
reload () reload (const char *params)
{ {
PluginPrivate *priv; DefaultPluginState *state;
priv = META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT.plugin_private; state = plugin_state;
if (do_init ()) if (do_init (params))
{ {
/* Success; free the old private struct */ /* Success; free the old state */
free_plugin_private (priv); free_plugin_private (plugin_state);
return TRUE; return TRUE;
} }
else else
{ {
/* Fail -- fall back to the old private. */ /* Fail -- fall back to the old state. */
META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT.plugin_private = priv; plugin_state = state;
} }
return FALSE; return FALSE;
@ -842,12 +780,10 @@ reload ()
/* /*
* GModule unload function -- do any cleanup required. * GModule unload function -- do any cleanup required.
*/ */
void g_module_unload (GModule *module); G_MODULE_EXPORT void g_module_unload (GModule *module);
void g_module_unload (GModule *module) G_MODULE_EXPORT void
g_module_unload (GModule *module)
{ {
PluginPrivate *priv; free_plugin_private (plugin_state);
priv = META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT.plugin_private;
free_plugin_private (priv);
} }

View File

@ -30,7 +30,8 @@
#include <gmodule.h> #include <gmodule.h>
#include <string.h> #include <string.h>
static gboolean meta_compositor_clutter_plugin_manager_reload (MetaCompositorClutterPluginManager *mgr); static gboolean meta_compositor_clutter_plugin_manager_reload (
MetaCompositorClutterPluginManager *plugin_mgr);
struct MetaCompositorClutterPluginManager struct MetaCompositorClutterPluginManager
{ {
@ -42,23 +43,23 @@ struct MetaCompositorClutterPluginManager
guint idle_unload_id; guint idle_unload_id;
}; };
typedef struct MetaCompositorClutterPluginPrivate MetaCompositorClutterPluginPrivate; typedef struct MetaCompositorClutterPluginPrivate
struct MetaCompositorClutterPluginPrivate
{ {
char *name;
MetaCompositorClutterPluginManager *self; MetaCompositorClutterPluginManager *self;
GModule *module; GModule *module;
gulong features;
gboolean disabled : 1; gboolean disabled : 1;
}; } MetaCompositorClutterPluginPrivate;
static void static void
free_plugin_workspaces (MetaCompositorClutterPlugin *plg) free_plugin_workspaces (MetaCompositorClutterPlugin *plugin)
{ {
GList *l; GList *l;
l = plg->work_areas; l = plugin->work_areas;
while (l) while (l)
{ {
@ -66,21 +67,21 @@ free_plugin_workspaces (MetaCompositorClutterPlugin *plg)
l = l->next; l = l->next;
} }
if (plg->work_areas) if (plugin->work_areas)
g_list_free (plg->work_areas); g_list_free (plugin->work_areas);
plg->work_areas = NULL; plugin->work_areas = NULL;
} }
/* /*
* Gets work area geometry and stores it in list in the plugin. * Gets work area geometry and stores it in list in the plugin.
* *
* If the plg list is already populated, we simply replace it (we are dealing * If the plugin list is already populated, we simply replace it (we are
* with a small number of items in the list and unfrequent changes). * dealing with a small number of items in the list and unfrequent changes).
*/ */
static void static void
update_plugin_workspaces (MetaScreen *screen, update_plugin_workspaces (MetaScreen *screen,
MetaCompositorClutterPlugin *plg) MetaCompositorClutterPlugin *plugin)
{ {
GList *l, *l2 = NULL; GList *l, *l2 = NULL;
@ -89,9 +90,9 @@ update_plugin_workspaces (MetaScreen *screen,
while (l) while (l)
{ {
MetaWorkspace *w = l->data; MetaWorkspace *w = l->data;
PluginWorkspaceRectangle *r; MetaRectangle *r;
r = g_new0 (PluginWorkspaceRectangle, 1); r = g_new0 (MetaRectangle, 1);
meta_workspace_get_work_area_all_xineramas (w, (MetaRectangle*)r); meta_workspace_get_work_area_all_xineramas (w, (MetaRectangle*)r);
@ -100,9 +101,57 @@ update_plugin_workspaces (MetaScreen *screen,
l = l->next; l = l->next;
} }
free_plugin_workspaces (plg); free_plugin_workspaces (plugin);
plg->work_areas = l2; plugin->work_areas = l2;
}
/**
* parse_disable_params:
* @params: as read from gconf, a ':' seperated list of plugin options
* @features: The mask of features the plugin advertises
*
* This function returns a new mask of features removing anything that
* the user has disabled.
*/
static gulong
parse_disable_params (const char *params, gulong features)
{
char *p;
if (!params)
return features;
if ((p = strstr (params, "disable:")))
{
gchar *d = g_strdup (p+8);
p = strchr (d, ';');
if (p)
*p = 0;
if (strstr (d, "minimize"))
features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE;
if (strstr (d, "maximize"))
features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE;
if (strstr (d, "unmaximize"))
features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE;
if (strstr (d, "map"))
features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_MAP;
if (strstr (d, "destroy"))
features &= ~ META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY;
if (strstr (d, "switch-workspace"))
features &= ~META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE;
g_free (d);
}
return features;
} }
/* /*
@ -110,51 +159,48 @@ update_plugin_workspaces (MetaScreen *screen,
* struct. * struct.
*/ */
static MetaCompositorClutterPlugin * static MetaCompositorClutterPlugin *
meta_compositor_clutter_plugin_load (MetaCompositorClutterPluginManager *mgr, meta_compositor_clutter_plugin_load (
GModule *module, MetaCompositorClutterPluginManager *plugin_mgr,
const gchar *params) GModule *module,
const gchar *params)
{ {
MetaCompositorClutterPlugin *plg; MetaCompositorClutterPlugin *plugin;
if (g_module_symbol (module, if (g_module_symbol (module, "metacity_plugin", (gpointer *)&plugin))
META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT_NAME,
(gpointer *)&plg))
{ {
if (plg->version_api == METACITY_CLUTTER_PLUGIN_API_VERSION) if (plugin->version_api == METACITY_CLUTTER_PLUGIN_API_VERSION)
{ {
MetaCompositorClutterPluginPrivate *priv; MetaCompositorClutterPluginPrivate *priv;
gboolean (*init_func) (void);
priv = g_new0 (MetaCompositorClutterPluginPrivate, 1); priv = g_new0 (MetaCompositorClutterPluginPrivate, 1);
plg->params = g_strdup (params); priv->name = _(plugin->name);
plg->manager_private = priv; priv->module = module;
priv->module = module; priv->self = plugin_mgr;
priv->self = mgr;
meta_screen_get_size (mgr->screen, /* FIXME: instead of hanging private data of the plugin descriptor
&plg->screen_width, &plg->screen_height); * we could make the descriptor const if we were to hang it off
* a plugin manager structure */
plugin->manager_private = priv;
update_plugin_workspaces (mgr->screen, plg); update_plugin_workspaces (plugin_mgr->screen, plugin);
priv->features = parse_disable_params (params, plugin->features);
/* /*
* Check for and run the plugin init function. * Check for and run the plugin init function.
*/ */
if (g_module_symbol (module, if (!plugin->do_init || !(plugin->do_init (params)))
META_COMPOSITOR_CLUTTER_PLUGIN_INIT_FUNC_NAME,
(gpointer *)&init_func) &&
!init_func())
{ {
g_free (plg->params);
g_free (priv); g_free (priv);
free_plugin_workspaces (plg); free_plugin_workspaces (plugin);
return NULL; return NULL;
} }
meta_verbose ("Loaded plugin [%s]\n", plg->name); meta_verbose ("Loaded plugin [%s]\n", priv->name);
return plg; return plugin;
} }
} }
@ -167,25 +213,22 @@ meta_compositor_clutter_plugin_load (MetaCompositorClutterPluginManager *mgr,
* removal later. * removal later.
*/ */
static gboolean static gboolean
meta_compositor_clutter_plugin_unload (MetaCompositorClutterPlugin *plg) meta_compositor_clutter_plugin_unload (MetaCompositorClutterPlugin *plugin)
{ {
MetaCompositorClutterPluginPrivate *priv; MetaCompositorClutterPluginPrivate *priv;
GModule *module; GModule *module;
priv = plg->manager_private; priv = plugin->manager_private;
module = priv->module; module = priv->module;
if (plg->running) if (plugin->running)
{ {
priv->disabled = TRUE; priv->disabled = TRUE;
return FALSE; return FALSE;
} }
g_free (plg->params);
plg->params = NULL;
g_free (priv); g_free (priv);
plg->manager_private = NULL; plugin->manager_private = NULL;
g_module_close (module); g_module_close (module);
@ -197,23 +240,24 @@ meta_compositor_clutter_plugin_unload (MetaCompositorClutterPlugin *plg)
* pending for removal. * pending for removal.
*/ */
static gboolean static gboolean
meta_compositor_clutter_plugin_manager_idle_unload (MetaCompositorClutterPluginManager *mgr) meta_compositor_clutter_plugin_manager_idle_unload (
MetaCompositorClutterPluginManager *plugin_mgr)
{ {
GList *l = mgr->unload; GList *l = plugin_mgr->unload;
gboolean dont_remove = TRUE; gboolean dont_remove = TRUE;
while (l) while (l)
{ {
MetaCompositorClutterPlugin *plg = l->data; MetaCompositorClutterPlugin *plugin = l->data;
if (meta_compositor_clutter_plugin_unload (plg)) if (meta_compositor_clutter_plugin_unload (plugin))
{ {
/* Remove from list */ /* Remove from list */
GList *p = l->prev; GList *p = l->prev;
GList *n = l->next; GList *n = l->next;
if (!p) if (!p)
mgr->unload = n; plugin_mgr->unload = n;
else else
p->next = n; p->next = n;
@ -228,11 +272,11 @@ meta_compositor_clutter_plugin_manager_idle_unload (MetaCompositorClutterPluginM
l = l->next; l = l->next;
} }
if (!mgr->unload) if (!plugin_mgr->unload)
{ {
/* If no more unloads are pending, remove the handler as well */ /* If no more unloads are pending, remove the handler as well */
dont_remove = FALSE; dont_remove = FALSE;
mgr->idle_unload_id = 0; plugin_mgr->idle_unload_id = 0;
} }
return dont_remove; return dont_remove;
@ -242,47 +286,48 @@ meta_compositor_clutter_plugin_manager_idle_unload (MetaCompositorClutterPluginM
* Unloads all plugins * Unloads all plugins
*/ */
static void static void
meta_compositor_clutter_plugin_manager_unload (MetaCompositorClutterPluginManager *mgr) meta_compositor_clutter_plugin_manager_unload (
MetaCompositorClutterPluginManager *plugin_mgr)
{ {
GList *plugins = mgr->plugins; GList *plugins = plugin_mgr->plugins;
while (plugins) while (plugins)
{ {
MetaCompositorClutterPlugin *plg = plugins->data; MetaCompositorClutterPlugin *plugin = plugins->data;
/* If the plugin could not be removed, move it to the unload list */ /* If the plugin could not be removed, move it to the unload list */
if (!meta_compositor_clutter_plugin_unload (plg)) if (!meta_compositor_clutter_plugin_unload (plugin))
{ {
mgr->unload = g_list_prepend (mgr->unload, plg); plugin_mgr->unload = g_list_prepend (plugin_mgr->unload, plugin);
if (!mgr->idle_unload_id) if (!plugin_mgr->idle_unload_id)
{ {
mgr->idle_unload_id = g_idle_add ((GSourceFunc) plugin_mgr->idle_unload_id = g_idle_add ((GSourceFunc)
meta_compositor_clutter_plugin_manager_idle_unload, meta_compositor_clutter_plugin_manager_idle_unload,
mgr); plugin_mgr);
} }
} }
plugins = plugins->next; plugins = plugins->next;
} }
g_list_free (mgr->plugins); g_list_free (plugin_mgr->plugins);
mgr->plugins = NULL; plugin_mgr->plugins = NULL;
} }
static void static void
prefs_changed_callback (MetaPreference pref, prefs_changed_callback (MetaPreference pref,
void *data) void *data)
{ {
MetaCompositorClutterPluginManager *mgr = data; MetaCompositorClutterPluginManager *plugin_mgr = data;
if (pref == META_PREF_CLUTTER_PLUGINS) if (pref == META_PREF_CLUTTER_PLUGINS)
{ {
meta_compositor_clutter_plugin_manager_reload (mgr); meta_compositor_clutter_plugin_manager_reload (plugin_mgr);
} }
else if (pref == META_PREF_NUM_WORKSPACES) else if (pref == META_PREF_NUM_WORKSPACES)
{ {
meta_compositor_clutter_plugin_manager_update_workspaces (mgr); meta_compositor_clutter_plugin_manager_update_workspaces (plugin_mgr);
} }
} }
@ -290,7 +335,8 @@ prefs_changed_callback (MetaPreference pref,
* Loads all plugins listed in gconf registry. * Loads all plugins listed in gconf registry.
*/ */
static gboolean static gboolean
meta_compositor_clutter_plugin_manager_load (MetaCompositorClutterPluginManager *mgr) meta_compositor_clutter_plugin_manager_load (
MetaCompositorClutterPluginManager *plugin_mgr)
{ {
const gchar *dpath = METACITY_PKGLIBDIR "/plugins/clutter/"; const gchar *dpath = METACITY_PKGLIBDIR "/plugins/clutter/";
GSList *plugins, *fallback = NULL; GSList *plugins, *fallback = NULL;
@ -308,17 +354,17 @@ meta_compositor_clutter_plugin_manager_load (MetaCompositorClutterPluginManager
while (plugins) while (plugins)
{ {
gchar *plg_string; gchar *plugin_string;
gchar *params; gchar *params;
plg_string = g_strdup (plugins->data); plugin_string = g_strdup (plugins->data);
if (plg_string) if (plugin_string)
{ {
GModule *plg; GModule *plugin;
gchar *path; gchar *path;
params = strchr (plg_string, ':'); params = strchr (plugin_string, ':');
if (params) if (params)
{ {
@ -326,26 +372,26 @@ meta_compositor_clutter_plugin_manager_load (MetaCompositorClutterPluginManager
++params; ++params;
} }
path = g_strconcat (dpath, plg_string, ".so", NULL); path = g_strconcat (dpath, plugin_string, ".so", NULL);
if ((plg = g_module_open (path, 0))) if ((plugin = g_module_open (path, 0)))
{ {
MetaCompositorClutterPlugin *p; MetaCompositorClutterPlugin *p;
if ((p = meta_compositor_clutter_plugin_load (mgr, if ((p = meta_compositor_clutter_plugin_load (plugin_mgr,
plg, params))) plugin, params)))
mgr->plugins = g_list_prepend (mgr->plugins, p); plugin_mgr->plugins = g_list_prepend (plugin_mgr->plugins, p);
else else
{ {
g_message ("Plugin load for [%s] failed\n", path); g_message ("Plugin load for [%s] failed\n", path);
g_module_close (plg); g_module_close (plugin);
} }
} }
else else
g_message ("Unable to load plugin [%s]\n", path); g_message ("Unable to load plugin [%s]\n", path);
g_free (path); g_free (path);
g_free (plg_string); g_free (plugin_string);
} }
plugins = plugins->next; plugins = plugins->next;
@ -355,9 +401,9 @@ meta_compositor_clutter_plugin_manager_load (MetaCompositorClutterPluginManager
if (fallback) if (fallback)
g_slist_free (fallback); g_slist_free (fallback);
if (mgr->plugins != NULL) if (plugin_mgr->plugins != NULL)
{ {
meta_prefs_add_listener (prefs_changed_callback, mgr); meta_prefs_add_listener (prefs_changed_callback, plugin_mgr);
return TRUE; return TRUE;
} }
@ -368,44 +414,47 @@ meta_compositor_clutter_plugin_manager_load (MetaCompositorClutterPluginManager
* Reloads all plugins * Reloads all plugins
*/ */
static gboolean static gboolean
meta_compositor_clutter_plugin_manager_reload (MetaCompositorClutterPluginManager *mgr) meta_compositor_clutter_plugin_manager_reload (
MetaCompositorClutterPluginManager *plugin_mgr)
{ {
/* TODO -- brute force; should we build a list of plugins to load and list of /* TODO -- brute force; should we build a list of plugins to load and list of
* plugins to unload? We are probably not going to have large numbers of * plugins to unload? We are probably not going to have large numbers of
* plugins loaded at the same time, so it might not be worth it. * plugins loaded at the same time, so it might not be worth it.
*/ */
meta_compositor_clutter_plugin_manager_unload (mgr); meta_compositor_clutter_plugin_manager_unload (plugin_mgr);
return meta_compositor_clutter_plugin_manager_load (mgr); return meta_compositor_clutter_plugin_manager_load (plugin_mgr);
} }
static gboolean static gboolean
meta_compositor_clutter_plugin_manager_init (MetaCompositorClutterPluginManager *mgr) meta_compositor_clutter_plugin_manager_init (
MetaCompositorClutterPluginManager *plugin_mgr)
{ {
return meta_compositor_clutter_plugin_manager_load (mgr); return meta_compositor_clutter_plugin_manager_load (plugin_mgr);
} }
void void
meta_compositor_clutter_plugin_manager_update_workspace (MetaCompositorClutterPluginManager *mgr, MetaWorkspace *w) meta_compositor_clutter_plugin_manager_update_workspace (
MetaCompositorClutterPluginManager *plugin_mgr, MetaWorkspace *workspace)
{ {
GList *l; GList *l;
gint n; gint index;
n = meta_workspace_index (w); index = meta_workspace_index (workspace);
l = mgr->plugins; l = plugin_mgr->plugins;
while (l) while (l)
{ {
MetaCompositorClutterPlugin *plg = l->data; MetaCompositorClutterPlugin *plugin = l->data;
PluginWorkspaceRectangle *r = g_list_nth_data (plg->work_areas, n); MetaRectangle *rect = g_list_nth_data (plugin->work_areas, index);
if (r) if (rect)
{ {
meta_workspace_get_work_area_all_xineramas (w, (MetaRectangle*)r); meta_workspace_get_work_area_all_xineramas (workspace, rect);
} }
else else
{ {
/* Something not entirely right; redo the whole thing */ /* Something not entirely right; redo the whole thing */
update_plugin_workspaces (mgr->screen, plg); update_plugin_workspaces (plugin_mgr->screen, plugin);
return; return;
} }
@ -414,16 +463,17 @@ meta_compositor_clutter_plugin_manager_update_workspace (MetaCompositorClutterPl
} }
void void
meta_compositor_clutter_plugin_manager_update_workspaces (MetaCompositorClutterPluginManager *mgr) meta_compositor_clutter_plugin_manager_update_workspaces (
MetaCompositorClutterPluginManager *plugin_mgr)
{ {
GList *l; GList *l;
l = mgr->plugins; l = plugin_mgr->plugins;
while (l) while (l)
{ {
MetaCompositorClutterPlugin *plg = l->data; MetaCompositorClutterPlugin *plugin = l->data;
update_plugin_workspaces (mgr->screen, plg); update_plugin_workspaces (plugin_mgr->screen, plugin);
l = l->next; l = l->next;
} }
@ -432,35 +482,38 @@ meta_compositor_clutter_plugin_manager_update_workspaces (MetaCompositorClutterP
MetaCompositorClutterPluginManager * MetaCompositorClutterPluginManager *
meta_compositor_clutter_plugin_manager_new (MetaScreen *screen) meta_compositor_clutter_plugin_manager_new (MetaScreen *screen)
{ {
MetaCompositorClutterPluginManager *mgr; MetaCompositorClutterPluginManager *plugin_mgr;
mgr = g_new0 (MetaCompositorClutterPluginManager, 1); plugin_mgr = g_new0 (MetaCompositorClutterPluginManager, 1);
mgr->screen = screen; plugin_mgr->screen = screen;
if (!meta_compositor_clutter_plugin_manager_init (mgr)) if (!meta_compositor_clutter_plugin_manager_init (plugin_mgr))
{ {
g_free (mgr); g_free (plugin_mgr);
mgr = NULL; plugin_mgr = NULL;
} }
return mgr; return plugin_mgr;
} }
static void static void
meta_compositor_clutter_plugin_manager_kill_effect (MetaCompositorClutterPluginManager *mgr, meta_compositor_clutter_plugin_manager_kill_effect (
MetaCompWindow *actor, MetaCompositorClutterPluginManager *plugin_mgr,
unsigned long events) MetaCompWindow *actor,
unsigned long events)
{ {
GList *l = mgr->plugins; GList *l = plugin_mgr->plugins;
while (l) while (l)
{ {
MetaCompositorClutterPlugin *plg = l->data; MetaCompositorClutterPlugin *plugin = l->data;
MetaCompositorClutterPluginPrivate *priv = plg->manager_private; MetaCompositorClutterPluginPrivate *priv = plugin->manager_private;
if (!priv->disabled && (plg->features & events) && plg->kill_effect) if (!priv->disabled
plg->kill_effect (actor, events); && (plugin->features & events)
&& plugin->kill_effect)
plugin->kill_effect (actor, events);
l = l->next; l = l->next;
} }
@ -479,46 +532,51 @@ meta_compositor_clutter_plugin_manager_kill_effect (MetaCompositorClutterPluginM
* appropriate post-effect cleanup is carried out. * appropriate post-effect cleanup is carried out.
*/ */
gboolean gboolean
meta_compositor_clutter_plugin_manager_event_simple (MetaCompositorClutterPluginManager *mgr, meta_compositor_clutter_plugin_manager_event_simple (
MetaCompWindow *actor, MetaCompositorClutterPluginManager *plugin_mgr,
unsigned long event) MetaCompWindow *actor,
unsigned long event)
{ {
GList *l = mgr->plugins; GList *l = plugin_mgr->plugins;
gboolean retval = FALSE; gboolean retval = FALSE;
while (l) while (l)
{ {
MetaCompositorClutterPlugin *plg = l->data; MetaCompositorClutterPlugin *plugin = l->data;
MetaCompositorClutterPluginPrivate *priv = plg->manager_private; MetaCompositorClutterPluginPrivate *priv = plugin->manager_private;
if (!priv->disabled && (plg->features & event)) if (!priv->disabled && (plugin->features & event))
{ {
retval = TRUE; retval = TRUE;
switch (event) switch (event)
{ {
case META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE: case META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE:
if (plg->minimize) if (plugin->minimize)
{ {
meta_compositor_clutter_plugin_manager_kill_effect (mgr, meta_compositor_clutter_plugin_manager_kill_effect (
actor, plugin_mgr,
ALL_BUT_SWITCH); actor,
plg->minimize (actor); ALL_BUT_SWITCH);
plugin->minimize (actor);
} }
break; break;
case META_COMPOSITOR_CLUTTER_PLUGIN_MAP: case META_COMPOSITOR_CLUTTER_PLUGIN_MAP:
if (plg->map) if (plugin->map)
{ {
meta_compositor_clutter_plugin_manager_kill_effect (mgr, meta_compositor_clutter_plugin_manager_kill_effect (
actor, plugin_mgr,
ALL_BUT_SWITCH); actor,
plg->map (actor); ALL_BUT_SWITCH);
plugin->map (actor);
} }
break; break;
case META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY: case META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY:
if (plg->destroy) if (plugin->destroy)
{ {
plg->destroy (actor); plugin->destroy (actor);
} }
break; break;
default: default:
@ -542,46 +600,50 @@ meta_compositor_clutter_plugin_manager_event_simple (MetaCompositorClutterPlugin
* appropriate post-effect cleanup is carried out. * appropriate post-effect cleanup is carried out.
*/ */
gboolean gboolean
meta_compositor_clutter_plugin_manager_event_maximize (MetaCompositorClutterPluginManager *mgr, meta_compositor_clutter_plugin_manager_event_maximize (
MetaCompWindow *actor, MetaCompositorClutterPluginManager *plugin_mgr,
unsigned long event, MetaCompWindow *actor,
gint target_x, unsigned long event,
gint target_y, gint target_x,
gint target_width, gint target_y,
gint target_height) gint target_width,
gint target_height)
{ {
GList *l = mgr->plugins; GList *l = plugin_mgr->plugins;
gboolean retval = FALSE; gboolean retval = FALSE;
while (l) while (l)
{ {
MetaCompositorClutterPlugin *plg = l->data; MetaCompositorClutterPlugin *plugin = l->data;
MetaCompositorClutterPluginPrivate *priv = plg->manager_private; MetaCompositorClutterPluginPrivate *priv = plugin->manager_private;
if (!priv->disabled && (plg->features & event)) if (!priv->disabled && (plugin->features & event))
{ {
retval = TRUE; retval = TRUE;
switch (event) switch (event)
{ {
case META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE: case META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE:
if (plg->maximize) if (plugin->maximize)
{ {
meta_compositor_clutter_plugin_manager_kill_effect (mgr, meta_compositor_clutter_plugin_manager_kill_effect (
actor, plugin_mgr,
ALL_BUT_SWITCH); actor,
plg->maximize (actor, ALL_BUT_SWITCH);
plugin->maximize (actor,
target_x, target_y, target_x, target_y,
target_width, target_height); target_width, target_height);
} }
break; break;
case META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE: case META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE:
if (plg->unmaximize) if (plugin->unmaximize)
{ {
meta_compositor_clutter_plugin_manager_kill_effect (mgr, meta_compositor_clutter_plugin_manager_kill_effect (
actor, plugin_mgr,
ALL_BUT_SWITCH); actor,
plg->unmaximize (actor, ALL_BUT_SWITCH);
plugin->unmaximize (actor,
target_x, target_y, target_x, target_y,
target_width, target_height); target_width, target_height);
} }
@ -606,31 +668,34 @@ meta_compositor_clutter_plugin_manager_event_maximize (MetaCompositorClutterPlug
* appropriate post-effect cleanup is carried out. * appropriate post-effect cleanup is carried out.
*/ */
gboolean gboolean
meta_compositor_clutter_plugin_manager_switch_workspace (MetaCompositorClutterPluginManager *mgr, meta_compositor_clutter_plugin_manager_switch_workspace (
const GList **actors, MetaCompositorClutterPluginManager *plugin_mgr,
gint from, const GList **actors,
gint to, gint from,
MetaMotionDirection direction) gint to,
MetaMotionDirection direction)
{ {
GList *l = mgr->plugins; GList *l = plugin_mgr->plugins;
gboolean retval = FALSE; gboolean retval = FALSE;
while (l) while (l)
{ {
MetaCompositorClutterPlugin *plg = l->data; MetaCompositorClutterPlugin *plugin = l->data;
MetaCompositorClutterPluginPrivate *priv = plg->manager_private; MetaCompositorClutterPluginPrivate *priv = plugin->manager_private;
if (!priv->disabled && if (!priv->disabled &&
(plg->features & META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE) && (plugin->features & META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE) &&
(actors && *actors)) (actors && *actors))
{ {
if (plg->switch_workspace) if (plugin->switch_workspace)
{ {
retval = TRUE; retval = TRUE;
meta_compositor_clutter_plugin_manager_kill_effect (mgr, meta_compositor_clutter_plugin_manager_kill_effect (
META_COMP_WINDOW ((*actors)->data), plugin_mgr,
META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE); META_COMP_WINDOW ((*actors)->data),
plg->switch_workspace (actors, from, to, direction); META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE);
plugin->switch_workspace (actors, from, to, direction);
} }
} }
@ -649,23 +714,23 @@ meta_compositor_clutter_plugin_manager_switch_workspace (MetaCompositorClutterPl
* appropriate post-effect cleanup is carried out. * appropriate post-effect cleanup is carried out.
*/ */
gboolean gboolean
meta_compositor_clutter_plugin_manager_xevent_filter meta_compositor_clutter_plugin_manager_xevent_filter (
(MetaCompositorClutterPluginManager *mgr, XEvent *xev) MetaCompositorClutterPluginManager *plugin_mgr, XEvent *xev)
{ {
GList *l; GList *l;
if (!mgr) if (!plugin_mgr)
return FALSE; return FALSE;
l = mgr->plugins; l = plugin_mgr->plugins;
while (l) while (l)
{ {
MetaCompositorClutterPlugin *plg = l->data; MetaCompositorClutterPlugin *plugin = l->data;
if (plg->xevent_filter) if (plugin->xevent_filter)
{ {
if (plg->xevent_filter (xev) == TRUE) if (plugin->xevent_filter (xev) == TRUE)
return TRUE; return TRUE;
} }
@ -682,18 +747,18 @@ ClutterActor *
meta_comp_clutter_plugin_get_overlay_group (MetaCompositorClutterPlugin *plugin) meta_comp_clutter_plugin_get_overlay_group (MetaCompositorClutterPlugin *plugin)
{ {
MetaCompositorClutterPluginPrivate *priv = plugin->manager_private; MetaCompositorClutterPluginPrivate *priv = plugin->manager_private;
MetaCompositorClutterPluginManager *mgr = priv->self; MetaCompositorClutterPluginManager *plugin_mgr = priv->self;
return meta_compositor_clutter_get_overlay_group_for_screen (mgr->screen); return meta_compositor_clutter_get_overlay_group_for_screen (plugin_mgr->screen);
} }
ClutterActor * ClutterActor *
meta_comp_clutter_plugin_get_stage (MetaCompositorClutterPlugin *plugin) meta_comp_clutter_plugin_get_stage (MetaCompositorClutterPlugin *plugin)
{ {
MetaCompositorClutterPluginPrivate *priv = plugin->manager_private; MetaCompositorClutterPluginPrivate *priv = plugin->manager_private;
MetaCompositorClutterPluginManager *mgr = priv->self; MetaCompositorClutterPluginManager *plugin_mgr = priv->self;
return meta_compositor_clutter_get_stage_for_screen (mgr->screen); return meta_compositor_clutter_get_stage_for_screen (plugin_mgr->screen);
} }
void void
@ -710,3 +775,14 @@ meta_comp_clutter_plugin_effect_completed (MetaCompositorClutterPlugin *plugin,
meta_compositor_clutter_window_effect_completed (actor, event); meta_compositor_clutter_window_effect_completed (actor, event);
} }
void
meta_comp_clutter_plugin_query_screen_size (MetaCompositorClutterPlugin *plugin,
int *width,
int *height)
{
MetaCompositorClutterPluginPrivate *priv = plugin->manager_private;
MetaCompositorClutterPluginManager *plugin_mgr = priv->self;
meta_screen_get_size (plugin_mgr->screen, width, height);
}

View File

@ -34,65 +34,27 @@
/* /*
* This file defines the plugin API. * This file defines the plugin API.
* *
* Effects plugin is shared library loaded via dlopen(); it is recommended * Effects plugin is shared library loaded via g_module_open(); it is
* that the GModule API is used (otherwise you are on your own to do proper * recommended that the GModule API is used (otherwise you are on your own to
* plugin clean up when the module is unloaded). * do proper plugin clean up when the module is unloaded).
* *
* The plugin interface is exported via the MetaCompositorClutterPlugin struct. * The plugin interface is exported via the MetaCompositorClutterPlugin struct.
*/ */
/*
* Alias MetaRectangle to PluginWorkspaceRectangle in anticipation of
* making this file metacity-independent (we want the plugins to be portable
* between different WMs.
*/
typedef MetaRectangle PluginWorkspaceRectangle;
/*
* The name of the header struct; use as:
*
* MetaCompositorClutterPlugin META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT =
* {
* ...
* };
*
* See clutter-plugins/simple.c for example code.
*/
#define META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT MCCPS__
/*
* Definition for the plugin init function; use as:
*
* META_COMPOSITOR_CLUTTER_PLUGIN_INIT_FUNC
* {
* init code ...
* }
*
* See clutter-plugins/simple.c for example code.
*/
#define META_COMPOSITOR_CLUTTER_PLUGIN_INIT_FUNC \
gboolean mccp_init__(void); \
gboolean mccp_init__()
/* Private; must match the above */
#define META_COMPOSITOR_CLUTTER_PLUGIN_STRUCT_NAME "MCCPS__"
#define META_COMPOSITOR_CLUTTER_PLUGIN_INIT_FUNC_NAME "mccp_init__"
typedef struct MetaCompositorClutterPlugin MetaCompositorClutterPlugin; typedef struct MetaCompositorClutterPlugin MetaCompositorClutterPlugin;
/* /*
* Feature flags: identify events that the plugin can handle; a plugin can * Feature flags: identify events that the plugin can handle; a plugin can
* handle one or more events. * handle one or more events.
*/ */
#define META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE 0x00000001UL #define META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE (1<<0)
#define META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE 0x00000002UL #define META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE (1<<1)
#define META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE 0x00000004UL #define META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE (1<<2)
#define META_COMPOSITOR_CLUTTER_PLUGIN_MAP 0x00000008UL #define META_COMPOSITOR_CLUTTER_PLUGIN_MAP (1<<3)
#define META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY 0x00000010UL #define META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY (1<<4)
#define META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE 0x00000020UL #define META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE (1<<5)
#define META_COMPOSITOR_CLUTTER_PLUGIN_ALL_EFFECTS 0xffffffffUL #define META_COMPOSITOR_CLUTTER_PLUGIN_ALL_EFFECTS (~0)
struct MetaCompositorClutterPlugin struct MetaCompositorClutterPlugin
{ {
@ -117,6 +79,47 @@ struct MetaCompositorClutterPlugin
#endif #endif
gchar *name; /* Human-readable name for UI */ gchar *name; /* Human-readable name for UI */
gulong features; /* or-ed feature flags */ gulong features; /* or-ed feature flags */
/*
* This function is called once the plugin has been loaded.
*
* @params is a string containing additional parameters for the plugin and is
* specified after the plugin name in the gconf database, separated by a
* colon.
*
* The following parameter tokens need to be handled by all
* plugins:
*
* 'debug'
* Indicates running in debug mode; the plugin
* might want to print useful debug info, or
* extend effect duration, etc.
*
* 'disable: ...;'
*
* The disable token indicates that the effects
* listed after the colon should be disabled.
*
* The list is comma-separated, terminated by a
* semicolon and consisting of the following
* tokens:
*
* minimize
* maximize
* unmaximize
* map
* destroy
* switch-workspace
*
* FIXME: ^^^ Instead of configuring in terms of what should be
* disabled, and needing a mechanism for coping with the user
* mistakenly not disabling the right things, it might be neater
* if plugins were enabled on a per effect basis in the first
* place. I.e. in gconf we could have effect:plugin key value
* pairs.
*/
gboolean (*do_init) (const char *params);
/* /*
* Event handlers * Event handlers
@ -153,6 +156,7 @@ struct MetaCompositorClutterPlugin
* Each actor in the list has a workspace number attached to it using * Each actor in the list has a workspace number attached to it using
* g_object_set_data() with key META_COMPOSITOR_CLUTTER_PLUGIN_WORKSPACE_KEY; * g_object_set_data() with key META_COMPOSITOR_CLUTTER_PLUGIN_WORKSPACE_KEY;
* workspace < 0 indicates the window is sticky (i.e., on all desktops). * workspace < 0 indicates the window is sticky (i.e., on all desktops).
* TODO: Add accessor for sticky bit in new MetaCompWindow structure
*/ */
void (*switch_workspace) (const GList **actors, void (*switch_workspace) (const GList **actors,
gint from, gint from,
@ -168,58 +172,22 @@ struct MetaCompositorClutterPlugin
void (*kill_effect) (MetaCompWindow *actor, void (*kill_effect) (MetaCompWindow *actor,
gulong events); gulong events);
/* /*
* The plugin manager will call this function when module should be reloaded. * The plugin manager will call this function when module should be reloaded.
* This happens, for example, when the parameters for the plugin changed. * This happens, for example, when the parameters for the plugin changed.
*/ */
gboolean (*reload) (void); gboolean (*reload) (const char *params);
/* General XEvent filter. This is fired *before* metacity itself handles /* 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); gboolean (*xevent_filter) (XEvent *event);
/* List of PluginWorkspaceRectangles defining the geometry of individual
#ifdef META_COMPOSITOR_CLUTTER_BUILDING_PLUGIN * workspaces. */
const GList *work_areas;
#endif
gchar *params; /* String containing additional parameters for the plugin; /* FIXME: It should be possible to hide this from plugins */
* this is specified after the pluing name in the gconf
* database, separated by a colon.
*
* The following parameter tokens need to be handled by all
* plugins:
*
* 'debug'
* Indicates running in debug mode; the plugin
* might want to print useful debug info, or
* extend effect duration, etc.
*
* 'disable: ...;'
*
* The disable token indicates that the effects
* listed after the colon should be disabled.
*
* The list is comma-separated, terminated by a
* semicolon and consisting of the following
* tokens:
*
* minimize
* maximize
* unmaximize
* map
* destroy
* switch-workspace
*/
gint screen_width;
gint screen_height;
GList *work_areas; /* List of PluginWorkspaceRectangles defining the
* geometry of individual workspaces.
*/
gint running; /* Plugin must increase this counter for each effect it starts gint running; /* Plugin must increase this counter for each effect it starts
* decrease it again once the effect finishes. * decrease it again once the effect finishes.
*/ */
@ -243,4 +211,10 @@ meta_comp_clutter_plugin_get_overlay_group (MetaCompositorClutterPlugin *plugin)
ClutterActor * ClutterActor *
meta_comp_clutter_plugin_get_stage (MetaCompositorClutterPlugin *plugin); meta_comp_clutter_plugin_get_stage (MetaCompositorClutterPlugin *plugin);
#endif
void
meta_comp_clutter_plugin_query_screen_size (MetaCompositorClutterPlugin *plugin,
int *width,
int *height);
#endif /* META_COMPOSITOR_CLUTTER_PLUGIN_H_ */