[mutter] display: Simplify cursor theme handling
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] display: Simplify cursor theme handling
- Date: Thu, 24 Apr 2014 15:26:36 +0000 (UTC)
commit 490f1a62496c7ee619cbd352969a7c2bb367b460
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Apr 24 10:48:47 2014 -0400
display: Simplify cursor theme handling
src/core/display-private.h | 3 ---
src/core/display.c | 33 ++++++++++++++++++++++-----------
src/core/main.c | 5 -----
3 files changed, 22 insertions(+), 19 deletions(-)
---
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 8a18ffd..df4fa00 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -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_retheme_all (void);
-void meta_display_set_cursor_theme (const char *theme,
- int size);
-
void meta_display_ping_window (MetaWindow *window,
guint32 timestamp,
MetaWindowPingFunc ping_reply_func,
diff --git a/src/core/display.c b/src/core/display.c
index 15d51a6..9551335 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -144,10 +144,12 @@ static MetaDisplay *the_display = NULL;
static const char *gnome_wm_keybindings = "Mutter";
static const char *net_wm_name = "Mutter";
+static void update_cursor_theme (void);
static void update_window_grab_modifiers (MetaDisplay *display);
static void prefs_changed_callback (MetaPreference pref,
void *data);
+
static void
meta_display_get_property(GObject *object,
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");
}
- {
- XcursorSetTheme (the_display->xdisplay, meta_prefs_get_cursor_theme ());
- XcursorSetDefaultSize (the_display->xdisplay, meta_prefs_get_cursor_size ());
- }
+ update_cursor_theme ();
/* Create the leader window here. Set its properties and
* use the timestamp from one of the PropertyNotify events
@@ -2281,16 +2280,23 @@ meta_display_retheme_all (void)
meta_display_queue_retheme_all_windows (meta_get_display ());
}
-void
-meta_display_set_cursor_theme (const char *theme,
- int size)
+static void
+set_cursor_theme (Display *xdisplay)
{
- MetaDisplay *display = meta_get_display ();
+ XcursorSetTheme (xdisplay, meta_prefs_get_cursor_theme ());
+ XcursorSetDefaultSize (xdisplay, meta_prefs_get_cursor_size ());
+}
- XcursorSetTheme (display->xdisplay, theme);
- XcursorSetDefaultSize (display->xdisplay, size);
+static void
+update_cursor_theme (void)
+{
+ {
+ MetaDisplay *display = meta_get_display ();
+ set_cursor_theme (display->xdisplay);
- meta_screen_update_cursor (display->screen);
+ if (display->screen)
+ meta_screen_update_cursor (display->screen);
+ }
}
/*
@@ -2973,6 +2979,11 @@ prefs_changed_callback (MetaPreference pref,
{
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
diff --git a/src/core/main.c b/src/core/main.c
index 7d2e9af..b3cf2c9 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -544,11 +544,6 @@ prefs_changed_callback (MetaPreference pref,
meta_display_retheme_all ();
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:
/* handled elsewhere or otherwise */
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]