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>
This commit is contained in:
Jonas Ådahl 2021-02-25 15:58:56 +01:00 committed by Marge Bot
parent 9cd99ee7ac
commit f677e0cbfb
2 changed files with 9 additions and 32 deletions

View File

@ -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;
}
}

View File

@ -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