Removed plugin .features member (no longer required); reanambled all effects in scratch plugin by popular demand.

This commit is contained in:
Tomas Frydrych 2008-10-20 13:04:46 +01:00
parent 73f90dfd69
commit 775cb1f4a4
4 changed files with 36 additions and 72 deletions

View File

@ -55,7 +55,7 @@ typedef struct MutterPluginPrivate
/* 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;
gint running;
gboolean disabled : 1;
} MutterPluginPrivate;
@ -122,9 +122,32 @@ update_plugin_workspaces (MetaScreen *screen,
* the user has disabled.
*/
static gulong
parse_disable_params (const char *params, gulong features)
parse_disable_params (const char *params, MutterPlugin *plugin)
{
char *p;
char *p;
gulong features = 0;
/*
* Feature flags: identify events that the plugin can handle; a plugin can
* handle one or more events.
*/
if (plugin->minimize)
features |= MUTTER_PLUGIN_MINIMIZE;
if (plugin->maximize)
features |= MUTTER_PLUGIN_MAXIMIZE;
if (plugin->unmaximize)
features |= MUTTER_PLUGIN_UNMAXIMIZE;
if (plugin->map)
features |= MUTTER_PLUGIN_MAP;
if (plugin->destroy)
features |= MUTTER_PLUGIN_DESTROY;
if (plugin->switch_workspace)
features |= MUTTER_PLUGIN_SWITCH_WORKSPACE;
if (!params)
return features;
@ -191,7 +214,7 @@ mutter_plugin_load (
update_plugin_workspaces (plugin_mgr->screen, plugin);
priv->features = parse_disable_params (params, plugin->features);
priv->features = parse_disable_params (params, plugin);
/*
* Check for and run the plugin init function.
@ -516,7 +539,7 @@ mutter_plugin_manager_kill_effect (
MutterPluginPrivate *priv = plugin->manager_private;
if (!priv->disabled
&& (plugin->features & events)
&& (priv->features & events)
&& plugin->kill_effect)
plugin->kill_effect (actor, events);
@ -550,7 +573,7 @@ mutter_plugin_manager_event_simple (
MutterPlugin *plugin = l->data;
MutterPluginPrivate *priv = plugin->manager_private;
if (!priv->disabled && (plugin->features & event))
if (!priv->disabled && (priv->features & event))
{
retval = TRUE;
@ -625,7 +648,7 @@ mutter_plugin_manager_event_maximize (
MutterPlugin *plugin = l->data;
MutterPluginPrivate *priv = plugin->manager_private;
if (!priv->disabled && (plugin->features & event))
if (!priv->disabled && (priv->features & event))
{
retval = TRUE;
@ -692,7 +715,7 @@ mutter_plugin_manager_switch_workspace (
MutterPluginPrivate *priv = plugin->manager_private;
if (!priv->disabled &&
(plugin->features & MUTTER_PLUGIN_SWITCH_WORKSPACE) &&
(priv->features & MUTTER_PLUGIN_SWITCH_WORKSPACE) &&
(actors && *actors))
{
if (plugin->switch_workspace)

View File

@ -79,16 +79,7 @@ G_MODULE_EXPORT MutterPlugin mutter_plugin =
/* Plugin load time initialiser */
.do_init = do_init,
/* Which types of events this plugin supports */
.features = MUTTER_PLUGIN_MINIMIZE |
MUTTER_PLUGIN_DESTROY |
MUTTER_PLUGIN_MAP |
MUTTER_PLUGIN_MAXIMIZE |
MUTTER_PLUGIN_UNMAXIMIZE |
MUTTER_PLUGIN_SWITCH_WORKSPACE,
/* And the corresponding handlers */
/* Effect handlers */
.minimize = minimize,
.destroy = destroy,
.map = map,
@ -590,12 +581,6 @@ kill_effect (MutterWindow *mc_window, gulong event)
ActorPrivate *apriv;
ClutterActor *actor = CLUTTER_ACTOR (mc_window);
if (!(plugin->features & event))
{
/* Event we do not support */
return;
}
if (event & MUTTER_PLUGIN_SWITCH_WORKSPACE)
{
PluginState *state = plugin_state;

View File

@ -83,12 +83,7 @@ G_MODULE_EXPORT MutterPlugin mutter_plugin =
/* Plugin load time initialiser */
.do_init = do_init,
/* Which types of events this plugin supports */
/* This plugin only uses the xevent callback for now */
.features = 0,
/* And the corresponding handlers */
/* Effect handlers */
.minimize = minimize,
.destroy = destroy,
.map = map,
@ -649,12 +644,6 @@ kill_effect (MutterWindow *mcw, gulong event)
ActorPrivate *apriv;
ClutterActor *actor = CLUTTER_ACTOR (mcw);
if (!(plugin->features & event))
{
/* Event we do not support */
return;
}
if (event & MUTTER_PLUGIN_SWITCH_WORKSPACE)
{
PluginPrivate *ppriv = plugin->plugin_private;
@ -814,8 +803,6 @@ do_init (const char *params)
if (params)
{
gchar *p;
if (strstr (params, "debug"))
{
g_debug ("%s: Entering debug mode.",
@ -832,36 +819,6 @@ do_init (const char *params)
map_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 &= ~ MUTTER_PLUGIN_MINIMIZE;
if (strstr (d, "maximize"))
plugin->features &= ~ MUTTER_PLUGIN_MAXIMIZE;
if (strstr (d, "unmaximize"))
plugin->features &= ~ MUTTER_PLUGIN_UNMAXIMIZE;
if (strstr (d, "map"))
plugin->features &= ~ MUTTER_PLUGIN_MAP;
if (strstr (d, "destroy"))
plugin->features &= ~ MUTTER_PLUGIN_DESTROY;
if (strstr (d, "switch-workspace"))
plugin->features &= ~MUTTER_PLUGIN_SWITCH_WORKSPACE;
g_free (d);
}
}
priv->destroy_effect

View File

@ -44,8 +44,8 @@
typedef struct MutterPlugin MutterPlugin;
/*
* Feature flags: identify events that the plugin can handle; a plugin can
* handle one or more events.
* Effect flags: identify events that the plugin can handle, used by kill_effect
* function.
*/
#define MUTTER_PLUGIN_MINIMIZE (1<<0)
#define MUTTER_PLUGIN_MAXIMIZE (1<<1)
@ -78,7 +78,6 @@ struct MutterPlugin
const
#endif
gchar *name; /* Human-readable name for UI */
gulong features; /* or-ed feature flags */
/*
* This function is called once the plugin has been loaded.
@ -170,7 +169,7 @@ struct MutterPlugin
* killed.
*/
void (*kill_effect) (MutterWindow *actor,
gulong events);
gulong events);
/*
* The plugin manager will call this function when module should be reloaded.