[mutter/wip/carlosg/backendless-clutter: 10/15] clutter: Drop Xsettings client code




commit 01a8b07fa10d48de475b0c51bfc771cb75b2b63e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon May 10 22:40:21 2021 +0200

    clutter: Drop Xsettings client code
    
    We only listen to it for 2 settings (drag threshold, double click
    time), and we already have the stock ClutterSettings object tracking
    the source of these. This code is redundant.

 clutter/clutter/meson.build                      |   9 -
 clutter/clutter/x11/clutter-backend-x11.c        | 105 ----
 clutter/clutter/x11/clutter-backend-x11.h        |   5 -
 clutter/clutter/x11/clutter-settings-x11.h       |  18 -
 clutter/clutter/x11/xsettings/xsettings-client.c | 609 -----------------------
 clutter/clutter/x11/xsettings/xsettings-client.h |  79 ---
 clutter/clutter/x11/xsettings/xsettings-common.c | 265 ----------
 clutter/clutter/x11/xsettings/xsettings-common.h | 132 -----
 8 files changed, 1222 deletions(-)
---
diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build
index 35a0afefc0..f65b91da22 100644
--- a/clutter/clutter/meson.build
+++ b/clutter/clutter/meson.build
@@ -249,17 +249,8 @@ if have_x11
 
   clutter_x11_private_headers = [
     'x11/clutter-backend-x11.h',
-    'x11/clutter-settings-x11.h',
   ]
   clutter_backend_private_headers += clutter_x11_private_headers
-
-  clutter_x11_nonintrospected_sources = [
-    'x11/xsettings/xsettings-client.c',
-    'x11/xsettings/xsettings-client.h',
-    'x11/xsettings/xsettings-common.c',
-    'x11/xsettings/xsettings-common.h',
-  ]
-  clutter_backend_nonintrospected_sources += clutter_x11_nonintrospected_sources
 endif
 
 cally_headers = [
diff --git a/clutter/clutter/x11/clutter-backend-x11.c b/clutter/clutter/x11/clutter-backend-x11.c
index 8e0631c5ce..3d1856a970 100644
--- a/clutter/clutter/x11/clutter-backend-x11.c
+++ b/clutter/clutter/x11/clutter-backend-x11.c
@@ -34,11 +34,8 @@
 #include <errno.h>
 
 #include "clutter-backend-x11.h"
-#include "clutter-settings-x11.h"
 #include "clutter-x11.h"
 
-#include "xsettings/xsettings-common.h"
-
 #include <X11/extensions/Xcomposite.h>
 #include <X11/extensions/XInput2.h>
 
@@ -110,22 +107,6 @@ static gboolean clutter_synchronise = FALSE;
 static int TrappedErrorCode = 0;
 static int (* old_error_handler) (Display *, XErrorEvent *);
 
-static ClutterX11FilterReturn
-xsettings_filter (XEvent       *xevent,
-                  ClutterEvent *event,
-                  gpointer      data)
-{
-  ClutterBackendX11 *backend_x11 = data;
-
-  _clutter_xsettings_client_process_event (backend_x11->xsettings, xevent);
-
-  /* we always want the rest of the stack to get XSettings events, even
-   * if Clutter already handled them
-   */
-
-  return CLUTTER_X11_FILTER_CONTINUE;
-}
-
 static ClutterX11FilterReturn
 cogl_xlib_filter (XEvent       *xevent,
                   ClutterEvent *event,
@@ -151,78 +132,6 @@ cogl_xlib_filter (XEvent       *xevent,
   return retval;
 }
 
-static void
-clutter_backend_x11_xsettings_notify (const char       *name,
-                                      XSettingsAction   action,
-                                      XSettingsSetting *setting,
-                                      void             *cb_data)
-{
-  ClutterSettings *settings = clutter_settings_get_default ();
-  gint i;
-
-  if (name == NULL || *name == '\0')
-    return;
-
-  if (setting == NULL)
-    return;
-
-  g_object_freeze_notify (G_OBJECT (settings));
-
-  for (i = 0; i < _n_clutter_settings_map; i++)
-    {
-      if (g_strcmp0 (name, CLUTTER_SETTING_X11_NAME (i)) == 0)
-        {
-          GValue value = G_VALUE_INIT;
-
-          switch (setting->type)
-            {
-            case XSETTINGS_TYPE_INT:
-              g_value_init (&value, G_TYPE_INT);
-              g_value_set_int (&value, setting->data.v_int);
-              break;
-
-            case XSETTINGS_TYPE_STRING:
-              g_value_init (&value, G_TYPE_STRING);
-              g_value_set_string (&value, setting->data.v_string);
-              break;
-
-            case XSETTINGS_TYPE_COLOR:
-              {
-                ClutterColor color;
-
-                color.red   = (guint8) ((float) setting->data.v_color.red
-                            / 65535.0 * 255);
-                color.green = (guint8) ((float) setting->data.v_color.green
-                            / 65535.0 * 255);
-                color.blue  = (guint8) ((float) setting->data.v_color.blue
-                            / 65535.0 * 255);
-                color.alpha = (guint8) ((float) setting->data.v_color.alpha
-                            / 65535.0 * 255);
-
-                g_value_init (&value, G_TYPE_BOXED);
-                clutter_value_set_color (&value, &color);
-              }
-              break;
-            }
-
-          CLUTTER_NOTE (BACKEND,
-                        "Mapping XSETTING '%s' to 'ClutterSettings:%s'",
-                        CLUTTER_SETTING_X11_NAME (i),
-                        CLUTTER_SETTING_PROPERTY (i));
-
-          clutter_settings_set_property_internal (settings,
-                                                  CLUTTER_SETTING_PROPERTY (i),
-                                                  &value);
-
-          g_value_unset (&value);
-
-          break;
-        }
-    }
-
-  g_object_thaw_notify (G_OBJECT (settings));
-}
-
 static gboolean
 clutter_backend_x11_pre_parse (ClutterBackend  *backend,
                                GError         **error)
@@ -312,17 +221,6 @@ clutter_backend_x11_post_parse (ClutterBackend  *backend,
 
   backend_x11->display_name = g_strdup (clutter_display_name);
 
-  /* create XSETTINGS client */
-  backend_x11->xsettings =
-    _clutter_xsettings_client_new (backend_x11->xdpy,
-                                   backend_x11->xscreen_num,
-                                   clutter_backend_x11_xsettings_notify,
-                                   NULL,
-                                   backend_x11);
-
-  /* add event filter for XSETTINGS events */
-  clutter_x11_add_filter (xsettings_filter, backend_x11);
-
   if (clutter_synchronise)
     XSynchronize (backend_x11->xdpy, True);
 
@@ -398,9 +296,6 @@ clutter_backend_x11_finalize (GObject *gobject)
 
   clutter_x11_remove_filter (cogl_xlib_filter, gobject);
 
-  clutter_x11_remove_filter (xsettings_filter, backend_x11);
-  _clutter_xsettings_client_destroy (backend_x11->xsettings);
-
   XCloseDisplay (backend_x11->xdpy);
 
   G_OBJECT_CLASS (clutter_backend_x11_parent_class)->finalize (gobject);
diff --git a/clutter/clutter/x11/clutter-backend-x11.h b/clutter/clutter/x11/clutter-backend-x11.h
index d08c5409d5..84db2e2541 100644
--- a/clutter/clutter/x11/clutter-backend-x11.h
+++ b/clutter/clutter/x11/clutter-backend-x11.h
@@ -31,8 +31,6 @@
 
 #include "clutter-backend-private.h"
 
-#include "xsettings/xsettings-client.h"
-
 G_BEGIN_DECLS
 
 #define CLUTTER_TYPE_BACKEND_X11                (clutter_backend_x11_get_type ())
@@ -85,9 +83,6 @@ struct _ClutterBackendX11
   Atom atom_UTF8_STRING;
 
   Time last_event_time;
-
-  XSettingsClient *xsettings;
-  Window xsettings_xwin;
 };
 
 struct _ClutterBackendX11Class


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