From 4fdbb466e1c6ae506d203682ed290694bb0acf7b Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 18 Mar 2014 17:41:22 -0400 Subject: [PATCH] meta-plugin: Remove some unused features And don't use properties for no reason. --- src/compositor/meta-plugin-manager.c | 15 +-- src/compositor/meta-plugin.c | 151 +++------------------------ src/meta/meta-plugin.h | 6 +- 3 files changed, 16 insertions(+), 156 deletions(-) diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c index 41589a32c..29bac00e5 100644 --- a/src/compositor/meta-plugin-manager.c +++ b/src/compositor/meta-plugin-manager.c @@ -100,7 +100,9 @@ meta_plugin_manager_new (MetaScreen *screen) plugin_mgr = g_new0 (MetaPluginManager, 1); plugin_mgr->screen = screen; - plugin_mgr->plugin = plugin = g_object_new (plugin_type, "screen", screen, NULL); + plugin_mgr->plugin = plugin = g_object_new (plugin_type, NULL); + + _meta_plugin_set_screen (plugin, screen); klass = META_PLUGIN_GET_CLASS (plugin); @@ -165,8 +167,6 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr, retval = TRUE; meta_plugin_manager_kill_window_effects (plugin_mgr, actor); - - _meta_plugin_effect_started (plugin); klass->minimize (plugin, actor); } break; @@ -176,8 +176,6 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr, retval = TRUE; meta_plugin_manager_kill_window_effects (plugin_mgr, actor); - - _meta_plugin_effect_started (plugin); klass->map (plugin, actor); } break; @@ -185,7 +183,6 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr, if (klass->destroy) { retval = TRUE; - _meta_plugin_effect_started (plugin); klass->destroy (plugin, actor); } break; @@ -230,8 +227,6 @@ meta_plugin_manager_event_maximize (MetaPluginManager *plugin_mgr, retval = TRUE; meta_plugin_manager_kill_window_effects (plugin_mgr, actor); - - _meta_plugin_effect_started (plugin); klass->maximize (plugin, actor, target_x, target_y, target_width, target_height); @@ -243,8 +238,6 @@ meta_plugin_manager_event_maximize (MetaPluginManager *plugin_mgr, retval = TRUE; meta_plugin_manager_kill_window_effects (plugin_mgr, actor); - - _meta_plugin_effect_started (plugin); klass->unmaximize (plugin, actor, target_x, target_y, target_width, target_height); @@ -283,8 +276,6 @@ meta_plugin_manager_switch_workspace (MetaPluginManager *plugin_mgr, { retval = TRUE; meta_plugin_manager_kill_switch_workspace (plugin_mgr); - - _meta_plugin_effect_started (plugin); klass->switch_workspace (plugin, from, to, direction); } diff --git a/src/compositor/meta-plugin.c b/src/compositor/meta-plugin.c index 444d81e85..61d99d0f8 100644 --- a/src/compositor/meta-plugin.c +++ b/src/compositor/meta-plugin.c @@ -47,91 +47,15 @@ G_DEFINE_ABSTRACT_TYPE (MetaPlugin, meta_plugin, G_TYPE_OBJECT); #define META_PLUGIN_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate)) -enum -{ - PROP_0, - PROP_SCREEN, - PROP_DEBUG_MODE, -}; - struct _MetaPluginPrivate { - MetaScreen *screen; - - gint running; - gboolean debug : 1; + MetaScreen *screen; }; -static void -meta_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - MetaPluginPrivate *priv = META_PLUGIN (object)->priv; - - switch (prop_id) - { - case PROP_SCREEN: - priv->screen = g_value_get_object (value); - break; - case PROP_DEBUG_MODE: - priv->debug = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -meta_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - MetaPluginPrivate *priv = META_PLUGIN (object)->priv; - - switch (prop_id) - { - case PROP_SCREEN: - g_value_set_object (value, priv->screen); - break; - case PROP_DEBUG_MODE: - g_value_set_boolean (value, priv->debug); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - - static void meta_plugin_class_init (MetaPluginClass *klass) { - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->set_property = meta_plugin_set_property; - gobject_class->get_property = meta_plugin_get_property; - - g_object_class_install_property (gobject_class, - PROP_SCREEN, - g_param_spec_object ("screen", - "MetaScreen", - "MetaScreen", - META_TYPE_SCREEN, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, - PROP_DEBUG_MODE, - g_param_spec_boolean ("debug-mode", - "Debug Mode", - "Debug Mode", - FALSE, - G_PARAM_READABLE)); - - g_type_class_add_private (gobject_class, sizeof (MetaPluginPrivate)); + g_type_class_add_private (klass, sizeof (MetaPluginPrivate)); } static void @@ -140,22 +64,6 @@ meta_plugin_init (MetaPlugin *self) self->priv = META_PLUGIN_GET_PRIVATE (self); } -gboolean -meta_plugin_running (MetaPlugin *plugin) -{ - MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv; - - return (priv->running > 0); -} - -gboolean -meta_plugin_debug_mode (MetaPlugin *plugin) -{ - MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv; - - return priv->debug; -} - const MetaPluginInfo * meta_plugin_get_info (MetaPlugin *plugin) { @@ -167,21 +75,6 @@ meta_plugin_get_info (MetaPlugin *plugin) return NULL; } -/** - * _meta_plugin_effect_started: - * @plugin: the plugin - * - * Mark that an effect has started for the plugin. This is called - * internally by MetaPluginManager. - */ -void -_meta_plugin_effect_started (MetaPlugin *plugin) -{ - MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv; - - priv->running++; -} - gboolean _meta_plugin_xevent_filter (MetaPlugin *plugin, XEvent *xev) @@ -208,15 +101,8 @@ void meta_plugin_switch_workspace_completed (MetaPlugin *plugin) { MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv; - MetaScreen *screen = priv->screen; - if (priv->running-- < 0) - { - g_warning ("Error in running effect accounting, adjusting."); - priv->running = 0; - } - meta_switch_workspace_completed (screen); } @@ -225,26 +111,6 @@ meta_plugin_window_effect_completed (MetaPlugin *plugin, MetaWindowActor *actor, unsigned long event) { - MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv; - - if (priv->running-- < 0) - { - g_warning ("Error in running effect accounting, adjusting."); - priv->running = 0; - } - - if (!actor) - { - const MetaPluginInfo *info; - const gchar *name = NULL; - - if (plugin && (info = meta_plugin_get_info (plugin))) - name = info->name; - - g_warning ("Plugin [%s] passed NULL for actor!", - name ? name : "unknown"); - } - meta_window_actor_effect_completed (actor, event); } @@ -339,9 +205,7 @@ meta_plugin_end_modal (MetaPlugin *plugin, * meta_plugin_get_screen: * @plugin: a #MetaPlugin * - * Gets the #MetaScreen corresponding to a plugin. Each plugin instance - * is associated with exactly one screen; if Metacity is managing - * multiple screens, multiple plugin instances will be created. + * Gets the #MetaScreen corresponding to a plugin. * * Return value: (transfer none): the #MetaScreen for the plugin */ @@ -353,6 +217,15 @@ meta_plugin_get_screen (MetaPlugin *plugin) return priv->screen; } +void +_meta_plugin_set_screen (MetaPlugin *plugin, + MetaScreen *screen) +{ + MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv; + + priv->screen = screen; +} + void meta_plugin_complete_display_change (MetaPlugin *plugin, gboolean ok) diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h index cef785397..df42f3e34 100644 --- a/src/meta/meta-plugin.h +++ b/src/meta/meta-plugin.h @@ -254,9 +254,6 @@ struct _MetaPluginInfo GType meta_plugin_get_type (void); -gboolean meta_plugin_running (MetaPlugin *plugin); -gboolean meta_plugin_debug_mode (MetaPlugin *plugin); - const MetaPluginInfo * meta_plugin_get_info (MetaPlugin *plugin); /** @@ -408,8 +405,7 @@ meta_plugin_end_modal (MetaPlugin *plugin, MetaScreen *meta_plugin_get_screen (MetaPlugin *plugin); -void -_meta_plugin_effect_started (MetaPlugin *plugin); +void _meta_plugin_set_screen (MetaPlugin *plugin, MetaScreen *screen); /* XXX: Putting this in here so it's in the public header. */ void meta_plugin_manager_set_plugin_type (GType gtype);