[mutter] display: Make the display handle its own prefs handlers



commit f677e0cbfb6cc088fc414bf8cb1c05dfbb785e4c
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Feb 25 15:58:56 2021 +0100

    display: Make the display handle its own prefs handlers
    
    Two prefs were handled by display.c itself, and another in main.c.
    Unscattter things a bit by moving the one in main.c to the others in
    display.c.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>

 src/core/display.c | 11 +++++++++--
 src/core/main.c    | 30 ------------------------------
 2 files changed, 9 insertions(+), 32 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index f23618e560..0a50d4209f 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -2657,10 +2657,17 @@ prefs_changed_callback (MetaPreference pref,
 {
   MetaDisplay *display = data;
 
-  if (pref == META_PREF_CURSOR_THEME ||
-      pref == META_PREF_CURSOR_SIZE)
+  switch (pref)
     {
+    case META_PREF_DRAGGABLE_BORDER_WIDTH:
+      meta_display_queue_retheme_all_windows (display);
+      break;
+    case META_PREF_CURSOR_THEME:
+    case META_PREF_CURSOR_SIZE:
       meta_display_reload_cursor (display);
+      break;
+    default:
+      break;
     }
 }
 
diff --git a/src/core/main.c b/src/core/main.c
index 0668208505..70efc0f8bf 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -109,9 +109,6 @@ static MetaExitCode meta_exit_code = META_EXIT_SUCCESS;
  */
 static GMainLoop *meta_main_loop = NULL;
 
-static void prefs_changed_callback (MetaPreference pref,
-                                    gpointer       data);
-
 #ifdef HAVE_NATIVE_BACKEND
 static void release_virtual_monitors (void);
 #endif
@@ -854,7 +851,6 @@ void
 meta_start (void)
 {
   meta_prefs_init ();
-  meta_prefs_add_listener (prefs_changed_callback, NULL);
 
   if (!meta_display_open ())
     meta_exit (META_EXIT_ERROR);
@@ -910,32 +906,6 @@ meta_get_exit_code (void)
   return meta_exit_code;
 }
 
-/**
- * prefs_changed_callback:
- * @pref:  Which preference has changed
- * @data:  Arbitrary data (which we ignore)
- *
- * Called on pref changes. (One of several functions of its kind and purpose.)
- *
- * FIXME: Why are these particular prefs handled in main.c and not others?
- *        Should they be?
- */
-static void
-prefs_changed_callback (MetaPreference pref,
-                        gpointer       data)
-{
-  switch (pref)
-    {
-    case META_PREF_DRAGGABLE_BORDER_WIDTH:
-      meta_display_queue_retheme_all_windows (meta_get_display ());
-      break;
-
-    default:
-      /* handled elsewhere or otherwise */
-      break;
-    }
-}
-
 static MetaDisplayPolicy x11_display_policy_override = -1;
 
 void


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