[mutter] prefs: Update cursor size based on xsettings
- From: Adel Gadllah <agadllah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] prefs: Update cursor size based on xsettings
- Date: Sun, 14 Sep 2014 08:22:26 +0000 (UTC)
commit 493c0f71d2084210e8420d26f12dfb4439376d8f
Author: Adel Gadllah <adel gadllah gmail com>
Date: Mon Jul 28 11:02:03 2014 +0200
prefs: Update cursor size based on xsettings
We shouldn't scale the cursor size in mutter we g-s-d exports
the correct size on hidpi so use gtk-cursor-theme-size.
This way we also catch changes on resolution updates.
https://bugzilla.gnome.org/show_bug.cgi?id=729337
src/core/prefs.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/core/prefs.c b/src/core/prefs.c
index ed73e5d..336bc33 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -137,6 +137,10 @@ static void xsettings_overrides_changed (GSettings *settings,
gchar *key,
gpointer data);
+static void update_cursor_size (GtkSettings *settings,
+ GParamSpec *pspec,
+ gpointer data);
+
static void queue_changed (MetaPreference pref);
static void maybe_give_disable_workarounds_warning (void);
@@ -1012,6 +1016,9 @@ meta_prefs_init (void)
xsettings_overrides_changed (settings, KEY_XSETTINGS_OVERRIDES, NULL);
}
+ g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size",
+ G_CALLBACK (update_cursor_size), NULL);
+
settings = g_settings_new (SCHEMA_INPUT_SOURCES);
g_signal_connect (settings, "changed::" KEY_XKB_OPTIONS,
G_CALLBACK (settings_changed), NULL);
@@ -1032,6 +1039,8 @@ meta_prefs_init (void)
handle_preference_init_string_array ();
handle_preference_init_int ();
+ update_cursor_size (gtk_settings_get_default (), NULL, NULL);
+
init_bindings ();
}
@@ -1270,6 +1279,29 @@ out:
queue_changed (META_PREF_BUTTON_LAYOUT);
}
+static void
+update_cursor_size (GtkSettings *settings,
+ GParamSpec *pspec,
+ gpointer data)
+{
+ GdkScreen *screen = gdk_screen_get_default ();
+ GValue value = G_VALUE_INIT;
+ int xsettings_cursor_size = 24;
+
+ g_value_init (&value, G_TYPE_INT);
+ if (gdk_screen_get_setting (screen, "gtk-cursor-theme-size", &value))
+ {
+ xsettings_cursor_size = g_value_get_int (&value);
+ }
+
+ if (xsettings_cursor_size != cursor_size)
+ {
+ cursor_size = xsettings_cursor_size;
+ queue_changed (META_PREF_CURSOR_SIZE);
+ }
+}
+
+
/**
* maybe_give_disable_workaround_warning:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]