Restore the ability to use the default effect implementations

The addition of method implementations in the base class in the
plugin-gobject branch broke the logic for checking to see
if a plugin didn't implement an effect. Requiring a mandatory
chain up to the base class is a fiddly anyways, so this patch
does the 'running' count computations in a different (and more
robust) way.

mutter-plugin.h mutter-plugin.c: Add _mutter_plugin_effect_started()
 to increment the running count.
mutter-plugin-manager.c: Call _mutter_plugin_effect_started()
 as necessary.
mutter-plugin.c: Remove the "real" methods that did nothing
 but implement the runnning count.
plugins/default.c: Remove chain-ups.
This commit is contained in:
Owen W. Taylor 2008-12-22 16:53:10 -05:00
parent e083742426
commit e11100e584
4 changed files with 25 additions and 98 deletions

View File

@ -399,6 +399,7 @@ mutter_plugin_manager_event_simple (MutterPluginManager *plugin_mgr,
actor,
ALL_BUT_SWITCH);
_mutter_plugin_effect_started (plugin);
klass->minimize (plugin, actor);
}
break;
@ -410,12 +411,14 @@ mutter_plugin_manager_event_simple (MutterPluginManager *plugin_mgr,
actor,
ALL_BUT_SWITCH);
_mutter_plugin_effect_started (plugin);
klass->map (plugin, actor);
}
break;
case MUTTER_PLUGIN_DESTROY:
if (klass->destroy)
{
_mutter_plugin_effect_started (plugin);
klass->destroy (plugin, actor);
}
break;
@ -471,6 +474,7 @@ mutter_plugin_manager_event_maximize (MutterPluginManager *plugin_mgr,
actor,
ALL_BUT_SWITCH);
_mutter_plugin_effect_started (plugin);
klass->maximize (plugin, actor,
target_x, target_y,
target_width, target_height);
@ -483,6 +487,8 @@ mutter_plugin_manager_event_maximize (MutterPluginManager *plugin_mgr,
plugin_mgr,
actor,
ALL_BUT_SWITCH);
_mutter_plugin_effect_started (plugin);
klass->unmaximize (plugin, actor,
target_x, target_y,
target_width, target_height);
@ -534,6 +540,7 @@ mutter_plugin_manager_switch_workspace (MutterPluginManager *plugin_mgr,
MUTTER_WINDOW ((*actors)->data),
MUTTER_PLUGIN_SWITCH_WORKSPACE);
_mutter_plugin_effect_started (plugin);
klass->switch_workspace (plugin, actors, from, to, direction);
}
}

View File

@ -218,91 +218,17 @@ mutter_plugin_get_property (GObject *object,
}
}
static void
mutter_plugin_real_minimize (MutterPlugin *plugin, MutterWindow *actor)
{
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
priv->running++;
}
static void
mutter_plugin_real_maximize (MutterPlugin *plugin,
MutterWindow *actor,
gint x,
gint y,
gint width,
gint height)
{
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
priv->running++;
}
static void
mutter_plugin_real_unmaximize (MutterPlugin *plugin,
MutterWindow *actor,
gint x,
gint y,
gint width,
gint height)
{
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
priv->running++;
}
static void
mutter_plugin_real_map (MutterPlugin *plugin, MutterWindow *actor)
{
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
priv->running++;
}
static void
mutter_plugin_real_destroy (MutterPlugin *plugin, MutterWindow *actor)
{
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
priv->running++;
}
static void
mutter_plugin_real_switch_workspace (MutterPlugin *plugin,
const GList **actors,
gint from,
gint to,
MetaMotionDirection direction)
{
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
priv->running++;
}
static void
mutter_plugin_class_init (MutterPluginClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
MutterPluginClass *plugin_class = MUTTER_PLUGIN_CLASS (klass);
gobject_class->finalize = mutter_plugin_finalize;
gobject_class->dispose = mutter_plugin_dispose;
gobject_class->set_property = mutter_plugin_set_property;
gobject_class->get_property = mutter_plugin_get_property;
plugin_class->map = mutter_plugin_real_map;
plugin_class->minimize = mutter_plugin_real_minimize;
plugin_class->maximize = mutter_plugin_real_maximize;
plugin_class->unmaximize = mutter_plugin_real_unmaximize;
plugin_class->destroy = mutter_plugin_real_destroy;
plugin_class->switch_workspace = mutter_plugin_real_switch_workspace;
g_object_class_install_property (gobject_class,
PROP_SCREEN,
g_param_spec_object ("screen",
@ -423,6 +349,21 @@ mutter_plugin_get_window_group (MutterPlugin *plugin)
return mutter_get_window_group_for_screen (priv->screen);
}
/**
* _mutter_plugin_effect_started:
* @plugin: the plugin
*
* Mark that an effect has started for the plugin. This is called
* internally by MutterPluginManager.
*/
void
_mutter_plugin_effect_started (MutterPlugin *plugin)
{
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
priv->running++;
}
void
mutter_plugin_effect_completed (MutterPlugin *plugin,
MutterWindow *actor,

View File

@ -361,10 +361,6 @@ switch_workspace (MutterPlugin *plugin,
MetaScreen *screen = mutter_plugin_get_screen (plugin);
SwitchWorkspaceData *sw_data = g_new (SwitchWorkspaceData, 1);
/* Must chain up first */
MUTTER_PLUGIN_CLASS (mutter_default_plugin_parent_class)->
switch_workspace (plugin, actors, from, to, direction);
sw_data->plugin = plugin;
sw_data->actors = actors;
@ -494,10 +490,6 @@ minimize (MutterPlugin *plugin, MutterWindow *mc_window)
MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window);
/* Must chain up first */
MUTTER_PLUGIN_CLASS (mutter_default_plugin_parent_class)->
minimize (plugin, mc_window);
type = mutter_window_get_window_type (mc_window);
if (type == META_COMP_WINDOW_NORMAL)
@ -570,10 +562,6 @@ maximize (MutterPlugin *plugin,
gint anchor_x = 0;
gint anchor_y = 0;
/* Must chain up first */
MUTTER_PLUGIN_CLASS (mutter_default_plugin_parent_class)->
maximize (plugin, mc_window, end_x, end_y, end_width, end_height);
type = mutter_window_get_window_type (mc_window);
if (type == META_COMP_WINDOW_NORMAL)
@ -629,10 +617,6 @@ unmaximize (MutterPlugin *plugin,
{
MetaCompWindowType type = mutter_window_get_window_type (mc_window);
/* Must chain up first */
MUTTER_PLUGIN_CLASS (mutter_default_plugin_parent_class)->
unmaximize (plugin, mc_window, end_x, end_y, end_width, end_height);
if (type == META_COMP_WINDOW_NORMAL)
{
ActorPrivate *apriv = get_actor_private (mc_window);
@ -675,10 +659,6 @@ map (MutterPlugin *plugin, MutterWindow *mc_window)
MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window);
/* Must chain up first */
MUTTER_PLUGIN_CLASS (mutter_default_plugin_parent_class)->
map (plugin, mc_window);
type = mutter_window_get_window_type (mc_window);
if (type == META_COMP_WINDOW_NORMAL)
@ -734,10 +714,6 @@ destroy (MutterPlugin *plugin, MutterWindow *mc_window)
MetaCompWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window);
/* Must chain up first */
MUTTER_PLUGIN_CLASS (mutter_default_plugin_parent_class)->
destroy (plugin, mc_window);
type = mutter_window_get_window_type (mc_window);
if (type == META_COMP_WINDOW_NORMAL)

View File

@ -264,4 +264,7 @@ mutter_plugin_get_xdisplay (MutterPlugin *plugin);
MetaScreen *
mutter_plugin_get_screen (MutterPlugin *plugin);
void
_mutter_plugin_effect_started (MutterPlugin *plugin);
#endif /* MUTTER_PLUGIN_H_ */