mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
Removes the running counter from the plugins and instead manage it internally
to the plugin manager
This commit is contained in:
parent
b422faa4fe
commit
08c3c187eb
@ -52,6 +52,10 @@ typedef struct MutterPluginPrivate
|
||||
MutterPluginManager *self;
|
||||
GModule *module;
|
||||
gulong features;
|
||||
/* We use this to track the number of effects currently being managed
|
||||
* by a plugin. Currently this is used to block unloading while effects
|
||||
* are in progress. */
|
||||
gint running;
|
||||
|
||||
gboolean disabled : 1;
|
||||
} MutterPluginPrivate;
|
||||
@ -224,7 +228,7 @@ mutter_plugin_unload (MutterPlugin *plugin)
|
||||
priv = plugin->manager_private;
|
||||
module = priv->module;
|
||||
|
||||
if (plugin->running)
|
||||
if (priv->running)
|
||||
{
|
||||
priv->disabled = TRUE;
|
||||
return FALSE;
|
||||
@ -560,6 +564,7 @@ mutter_plugin_manager_event_simple (
|
||||
actor,
|
||||
ALL_BUT_SWITCH);
|
||||
|
||||
priv->running++;
|
||||
plugin->minimize (actor);
|
||||
}
|
||||
break;
|
||||
@ -571,12 +576,14 @@ mutter_plugin_manager_event_simple (
|
||||
actor,
|
||||
ALL_BUT_SWITCH);
|
||||
|
||||
priv->running++;
|
||||
plugin->map (actor);
|
||||
}
|
||||
break;
|
||||
case MUTTER_PLUGIN_DESTROY:
|
||||
if (plugin->destroy)
|
||||
{
|
||||
priv->running++;
|
||||
plugin->destroy (actor);
|
||||
}
|
||||
break;
|
||||
@ -767,6 +774,10 @@ mutter_plugin_effect_completed (MutterPlugin *plugin,
|
||||
MutterWindow *actor,
|
||||
unsigned long event)
|
||||
{
|
||||
MutterPluginPrivate *priv = plugin->manager_private;
|
||||
|
||||
priv->running--;
|
||||
|
||||
if (!actor)
|
||||
{
|
||||
g_warning ("Plugin [%s] passed NULL for actor!",
|
||||
|
@ -328,8 +328,6 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer data)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_NORTH_WEST);
|
||||
|
||||
/* Decrease the running effect counter */
|
||||
mutter_plugin.running--;
|
||||
/* Now notify the manager that we are done with this effect */
|
||||
mutter_plugin_effect_completed (&mutter_plugin, mc_window,
|
||||
MUTTER_PLUGIN_MINIMIZE);
|
||||
@ -357,8 +355,6 @@ minimize (MutterWindow *mc_window)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
mutter_plugin.running++;
|
||||
|
||||
apriv->tml_minimize = clutter_effect_scale (state->minimize_effect,
|
||||
actor,
|
||||
0.0,
|
||||
@ -392,9 +388,6 @@ on_maximize_effect_complete (ClutterActor *actor, gpointer data)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_NORTH_WEST);
|
||||
|
||||
/* Decrease the running effect counter */
|
||||
mutter_plugin.running--;
|
||||
|
||||
/* Now notify the manager that we are done with this effect */
|
||||
mutter_plugin_effect_completed (&mutter_plugin, mc_window,
|
||||
MUTTER_PLUGIN_MAXIMIZE);
|
||||
@ -500,9 +493,6 @@ on_map_effect_complete (ClutterActor *actor, gpointer data)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_NORTH_WEST);
|
||||
|
||||
/* Decrease the running effect counter */
|
||||
mutter_plugin.running--;
|
||||
|
||||
/* Now notify the manager that we are done with this effect */
|
||||
mutter_plugin_effect_completed (&mutter_plugin, mc_window, MUTTER_PLUGIN_MAP);
|
||||
}
|
||||
@ -526,8 +516,6 @@ map (MutterWindow *mc_window)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
mutter_plugin.running++;
|
||||
|
||||
clutter_actor_set_scale (actor, 0.0, 0.0);
|
||||
clutter_actor_show (actor);
|
||||
|
||||
@ -549,8 +537,7 @@ map (MutterWindow *mc_window)
|
||||
|
||||
/*
|
||||
* Destroy effect completion callback; this is a simple effect that requires no
|
||||
* further action than decreasing the running effect counter and notifying the
|
||||
* manager that the effect is completed.
|
||||
* further action than notifying the manager that the effect is completed.
|
||||
*/
|
||||
static void
|
||||
on_destroy_effect_complete (ClutterActor *actor, gpointer data)
|
||||
@ -561,8 +548,6 @@ on_destroy_effect_complete (ClutterActor *actor, gpointer data)
|
||||
|
||||
apriv->tml_destroy = NULL;
|
||||
|
||||
mutter_plugin.running--;
|
||||
|
||||
mutter_plugin_effect_completed (plugin, mc_window,
|
||||
MUTTER_PLUGIN_DESTROY);
|
||||
}
|
||||
@ -585,8 +570,6 @@ destroy (MutterWindow *mc_window)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
mutter_plugin.running++;
|
||||
|
||||
apriv->tml_destroy = clutter_effect_scale (plugin_state->destroy_effect,
|
||||
actor,
|
||||
1.0,
|
||||
|
@ -340,9 +340,6 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer data)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_NORTH_WEST);
|
||||
|
||||
/* Decrease the running effect counter */
|
||||
plugin->running--;
|
||||
|
||||
/* Now notify the manager that we are done with this effect */
|
||||
mutter_plugin_effect_completed (plugin, mcw,
|
||||
MUTTER_PLUGIN_MINIMIZE);
|
||||
@ -372,8 +369,6 @@ minimize (MutterWindow *mcw)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
plugin->running++;
|
||||
|
||||
apriv->tml_minimize = clutter_effect_scale (priv->minimize_effect,
|
||||
actor,
|
||||
0.0,
|
||||
@ -406,9 +401,6 @@ on_maximize_effect_complete (ClutterActor *actor, gpointer data)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_NORTH_WEST);
|
||||
|
||||
/* Decrease the running effect counter */
|
||||
plugin->running--;
|
||||
|
||||
/* Now notify the manager that we are done with this effect */
|
||||
mutter_plugin_effect_completed (plugin, mcw, MUTTER_PLUGIN_MAXIMIZE);
|
||||
}
|
||||
@ -516,9 +508,6 @@ on_map_effect_complete (ClutterActor *actor, gpointer data)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_NORTH_WEST);
|
||||
|
||||
/* Decrease the running effect counter */
|
||||
plugin->running--;
|
||||
|
||||
/* Now notify the manager that we are done with this effect */
|
||||
mutter_plugin_effect_completed (plugin, mcw, MUTTER_PLUGIN_MAP);
|
||||
}
|
||||
@ -544,8 +533,6 @@ map (MutterWindow *mcw)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
plugin->running++;
|
||||
|
||||
clutter_actor_set_scale (actor, 0.0, 0.0);
|
||||
clutter_actor_show (actor);
|
||||
|
||||
@ -566,8 +553,7 @@ map (MutterWindow *mcw)
|
||||
|
||||
/*
|
||||
* Destroy effect completion callback; this is a simple effect that requires no
|
||||
* further action than decreasing the running effect counter and notifying the
|
||||
* manager that the effect is completed.
|
||||
* further action than notifying the manager that the effect is completed.
|
||||
*/
|
||||
static void
|
||||
on_destroy_effect_complete (ClutterActor *actor, gpointer data)
|
||||
@ -578,8 +564,6 @@ on_destroy_effect_complete (ClutterActor *actor, gpointer data)
|
||||
|
||||
apriv->tml_destroy = NULL;
|
||||
|
||||
plugin->running--;
|
||||
|
||||
mutter_plugin_effect_completed (plugin, mcw, MUTTER_PLUGIN_DESTROY);
|
||||
}
|
||||
|
||||
@ -603,8 +587,6 @@ destroy (MutterWindow *mcw)
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
plugin->running++;
|
||||
|
||||
apriv->tml_destroy = clutter_effect_scale (priv->destroy_effect,
|
||||
actor,
|
||||
1.0,
|
||||
|
@ -187,11 +187,6 @@ struct MutterPlugin
|
||||
* workspaces. */
|
||||
GList *work_areas;
|
||||
|
||||
/* FIXME: It should be possible to hide this from plugins */
|
||||
gint running; /* Plugin must increase this counter for each effect it starts
|
||||
* decrease it again once the effect finishes.
|
||||
*/
|
||||
|
||||
void *plugin_private; /* Plugin private data go here; use the plugin init
|
||||
* function to allocate and initialize any private
|
||||
* data.
|
||||
|
Loading…
Reference in New Issue
Block a user