display: Simplify cursor theme handling

This commit is contained in:
Jasper St. Pierre 2014-04-24 10:48:47 -04:00
parent 5b83bfb1db
commit 490f1a6249
3 changed files with 22 additions and 19 deletions

View File

@ -400,9 +400,6 @@ const char* meta_event_detail_to_string (int d);
void meta_display_queue_retheme_all_windows (MetaDisplay *display); void meta_display_queue_retheme_all_windows (MetaDisplay *display);
void meta_display_retheme_all (void); void meta_display_retheme_all (void);
void meta_display_set_cursor_theme (const char *theme,
int size);
void meta_display_ping_window (MetaWindow *window, void meta_display_ping_window (MetaWindow *window,
guint32 timestamp, guint32 timestamp,
MetaWindowPingFunc ping_reply_func, MetaWindowPingFunc ping_reply_func,

View File

@ -144,10 +144,12 @@ static MetaDisplay *the_display = NULL;
static const char *gnome_wm_keybindings = "Mutter"; static const char *gnome_wm_keybindings = "Mutter";
static const char *net_wm_name = "Mutter"; static const char *net_wm_name = "Mutter";
static void update_cursor_theme (void);
static void update_window_grab_modifiers (MetaDisplay *display); static void update_window_grab_modifiers (MetaDisplay *display);
static void prefs_changed_callback (MetaPreference pref, static void prefs_changed_callback (MetaPreference pref,
void *data); void *data);
static void static void
meta_display_get_property(GObject *object, meta_display_get_property(GObject *object,
guint prop_id, guint prop_id,
@ -722,10 +724,7 @@ meta_display_open (void)
meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n"); meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
} }
{ update_cursor_theme ();
XcursorSetTheme (the_display->xdisplay, meta_prefs_get_cursor_theme ());
XcursorSetDefaultSize (the_display->xdisplay, meta_prefs_get_cursor_size ());
}
/* Create the leader window here. Set its properties and /* Create the leader window here. Set its properties and
* use the timestamp from one of the PropertyNotify events * use the timestamp from one of the PropertyNotify events
@ -2281,17 +2280,24 @@ meta_display_retheme_all (void)
meta_display_queue_retheme_all_windows (meta_get_display ()); meta_display_queue_retheme_all_windows (meta_get_display ());
} }
void static void
meta_display_set_cursor_theme (const char *theme, set_cursor_theme (Display *xdisplay)
int size) {
XcursorSetTheme (xdisplay, meta_prefs_get_cursor_theme ());
XcursorSetDefaultSize (xdisplay, meta_prefs_get_cursor_size ());
}
static void
update_cursor_theme (void)
{
{ {
MetaDisplay *display = meta_get_display (); MetaDisplay *display = meta_get_display ();
set_cursor_theme (display->xdisplay);
XcursorSetTheme (display->xdisplay, theme); if (display->screen)
XcursorSetDefaultSize (display->xdisplay, size);
meta_screen_update_cursor (display->screen); meta_screen_update_cursor (display->screen);
} }
}
/* /*
* Stores whether syncing is currently enabled. * Stores whether syncing is currently enabled.
@ -2973,6 +2979,11 @@ prefs_changed_callback (MetaPreference pref,
{ {
meta_bell_set_audible (display, meta_prefs_bell_is_audible ()); meta_bell_set_audible (display, meta_prefs_bell_is_audible ());
} }
else if (pref == META_PREF_CURSOR_THEME ||
pref == META_PREF_CURSOR_SIZE)
{
update_cursor_theme ();
}
} }
void void

View File

@ -544,11 +544,6 @@ prefs_changed_callback (MetaPreference pref,
meta_display_retheme_all (); meta_display_retheme_all ();
break; break;
case META_PREF_CURSOR_THEME:
case META_PREF_CURSOR_SIZE:
meta_display_set_cursor_theme (meta_prefs_get_cursor_theme (),
meta_prefs_get_cursor_size ());
break;
default: default:
/* handled elsewhere or otherwise */ /* handled elsewhere or otherwise */
break; break;