[mutter] meta-plugin: Kill off "features"



commit 9fa5aa98896f12d4183fc141c011437b271635f3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Apr 5 00:57:28 2012 -0400

    meta-plugin: Kill off "features"
    
    We already check that the plugin has the appropriate vfunc in the klass
    structure, so we shouldn't need to check for the same data again with
    a "features" long.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676855

 src/compositor/meta-plugin-manager.c |   33 +++++++-----------
 src/compositor/meta-plugin.c         |   61 ----------------------------------
 src/meta/meta-plugin.h               |    1 -
 3 files changed, 13 insertions(+), 82 deletions(-)
---
diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c
index bc4b9c7..f23e17f 100644
--- a/src/compositor/meta-plugin-manager.c
+++ b/src/compositor/meta-plugin-manager.c
@@ -223,9 +223,7 @@ meta_plugin_manager_kill_switch_workspace (MetaPluginManager *plugin_mgr)
       MetaPlugin        *plugin = l->data;
       MetaPluginClass   *klass = META_PLUGIN_GET_CLASS (plugin);
 
-      if (!meta_plugin_disabled (plugin)
-          && (meta_plugin_features (plugin) & META_PLUGIN_SWITCH_WORKSPACE)
-	  && klass->kill_switch_workspace)
+      if (!meta_plugin_disabled (plugin) && klass->kill_switch_workspace)
         klass->kill_switch_workspace (plugin);
 
       l = l->next;
@@ -258,16 +256,14 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
       MetaPlugin        *plugin = l->data;
       MetaPluginClass   *klass = META_PLUGIN_GET_CLASS (plugin);
 
-      if (!meta_plugin_disabled (plugin) &&
-          (meta_plugin_features (plugin) & event))
+      if (!meta_plugin_disabled (plugin))
         {
-          retval = TRUE;
-
           switch (event)
             {
             case META_PLUGIN_MINIMIZE:
               if (klass->minimize)
                 {
+                  retval = TRUE;
                   meta_plugin_manager_kill_window_effects (
 		      plugin_mgr,
 		      actor);
@@ -279,6 +275,7 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
             case META_PLUGIN_MAP:
               if (klass->map)
                 {
+                  retval = TRUE;
                   meta_plugin_manager_kill_window_effects (
 		      plugin_mgr,
 		      actor);
@@ -290,6 +287,7 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
             case META_PLUGIN_DESTROY:
               if (klass->destroy)
                 {
+                  retval = TRUE;
                   _meta_plugin_effect_started (plugin);
                   klass->destroy (plugin, actor);
                 }
@@ -335,16 +333,14 @@ meta_plugin_manager_event_maximize (MetaPluginManager *plugin_mgr,
       MetaPlugin        *plugin = l->data;
       MetaPluginClass   *klass = META_PLUGIN_GET_CLASS (plugin);
 
-      if (!meta_plugin_disabled (plugin) &&
-          (meta_plugin_features (plugin) & event))
+      if (!meta_plugin_disabled (plugin))
         {
-          retval = TRUE;
-
           switch (event)
             {
             case META_PLUGIN_MAXIMIZE:
               if (klass->maximize)
                 {
+                  retval = TRUE;
                   meta_plugin_manager_kill_window_effects (
 		      plugin_mgr,
 		      actor);
@@ -358,6 +354,7 @@ meta_plugin_manager_event_maximize (MetaPluginManager *plugin_mgr,
             case META_PLUGIN_UNMAXIMIZE:
               if (klass->unmaximize)
                 {
+                  retval = TRUE;
                   meta_plugin_manager_kill_window_effects (
 		      plugin_mgr,
 		      actor);
@@ -405,17 +402,13 @@ meta_plugin_manager_switch_workspace (MetaPluginManager   *plugin_mgr,
       MetaPlugin        *plugin = l->data;
       MetaPluginClass   *klass = META_PLUGIN_GET_CLASS (plugin);
 
-      if (!meta_plugin_disabled (plugin) &&
-          (meta_plugin_features (plugin) & META_PLUGIN_SWITCH_WORKSPACE))
+      if (!meta_plugin_disabled (plugin) && klass->switch_workspace)
         {
-          if (klass->switch_workspace)
-            {
-              retval = TRUE;
-              meta_plugin_manager_kill_switch_workspace (plugin_mgr);
+          retval = TRUE;
+          meta_plugin_manager_kill_switch_workspace (plugin_mgr);
 
-              _meta_plugin_effect_started (plugin);
-              klass->switch_workspace (plugin, from, to, direction);
-            }
+          _meta_plugin_effect_started (plugin);
+          klass->switch_workspace (plugin, from, to, direction);
         }
 
       l = l->next;
diff --git a/src/compositor/meta-plugin.c b/src/compositor/meta-plugin.c
index dd60d66..840e3ae 100644
--- a/src/compositor/meta-plugin.c
+++ b/src/compositor/meta-plugin.c
@@ -44,7 +44,6 @@ enum
 {
   PROP_0,
   PROP_SCREEN,
-  PROP_FEATURES,
   PROP_DISABLED,
   PROP_DEBUG_MODE,
 };
@@ -52,7 +51,6 @@ enum
 struct _MetaPluginPrivate
 {
   MetaScreen   *screen;
-  gulong        features;
 
   gint          running;
 
@@ -61,45 +59,6 @@ struct _MetaPluginPrivate
 };
 
 static void
-meta_plugin_set_features (MetaPlugin *plugin)
-{
-  MetaPluginPrivate  *priv     = plugin->priv;
-  MetaPluginClass    *klass    = META_PLUGIN_GET_CLASS (plugin);
-
-  priv->features = 0;
-
-  /*
-   * Feature flags: identify events that the plugin can handle; a plugin can
-   * handle one or more events.
-   */
-  if (klass->minimize)
-    priv->features |= META_PLUGIN_MINIMIZE;
-
-  if (klass->maximize)
-    priv->features |= META_PLUGIN_MAXIMIZE;
-
-  if (klass->unmaximize)
-    priv->features |= META_PLUGIN_UNMAXIMIZE;
-
-  if (klass->map)
-    priv->features |= META_PLUGIN_MAP;
-
-  if (klass->destroy)
-    priv->features |= META_PLUGIN_DESTROY;
-
-  if (klass->switch_workspace)
-    priv->features |= META_PLUGIN_SWITCH_WORKSPACE;
-}
-
-static void
-meta_plugin_constructed (GObject *object)
-{
-  meta_plugin_set_features (META_PLUGIN (object));
-
-  G_OBJECT_CLASS (meta_plugin_parent_class)->constructed (object);
-}
-
-static void
 meta_plugin_set_property (GObject      *object,
                           guint         prop_id,
                           const GValue *value,
@@ -143,9 +102,6 @@ meta_plugin_get_property (GObject    *object,
     case PROP_DEBUG_MODE:
       g_value_set_boolean (value, priv->debug);
       break;
-    case PROP_FEATURES:
-      g_value_set_ulong (value, priv->features);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -158,7 +114,6 @@ meta_plugin_class_init (MetaPluginClass *klass)
 {
   GObjectClass      *gobject_class = G_OBJECT_CLASS (klass);
 
-  gobject_class->constructed     = meta_plugin_constructed;
   gobject_class->set_property    = meta_plugin_set_property;
   gobject_class->get_property    = meta_plugin_get_property;
 
@@ -171,14 +126,6 @@ meta_plugin_class_init (MetaPluginClass *klass)
                                                         G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
-				   PROP_FEATURES,
-				   g_param_spec_ulong ("features",
-                                                       "Features",
-                                                       "Plugin Features",
-                                                       0 , G_MAXULONG, 0,
-                                                       G_PARAM_READABLE));
-
-  g_object_class_install_property (gobject_class,
 				   PROP_DISABLED,
 				   g_param_spec_boolean ("disabled",
                                                       "Plugin disabled",
@@ -205,14 +152,6 @@ meta_plugin_init (MetaPlugin *self)
   self->priv = priv = META_PLUGIN_GET_PRIVATE (self);
 }
 
-gulong
-meta_plugin_features (MetaPlugin *plugin)
-{
-  MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
-
-  return priv->features;
-}
-
 gboolean
 meta_plugin_disabled (MetaPlugin *plugin)
 {
diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h
index 8e46ec8..8dae83a 100644
--- a/src/meta/meta-plugin.h
+++ b/src/meta/meta-plugin.h
@@ -123,7 +123,6 @@ struct _MetaPluginInfo
 
 GType meta_plugin_get_type (void);
 
-gulong        meta_plugin_features            (MetaPlugin *plugin);
 gboolean      meta_plugin_disabled            (MetaPlugin *plugin);
 gboolean      meta_plugin_running             (MetaPlugin *plugin);
 gboolean      meta_plugin_debug_mode          (MetaPlugin *plugin);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]