From cfcba1868487fc02c9fa3e6e1d24ae69239b596b Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Sat, 23 Aug 2014 10:10:25 +0200 Subject: [PATCH] clutter-settings: Mark window-scaling-factor as fixed when set by the app When an application sets the scaling factor manually we should mark it as fixed and not override it when the xsettings change. This matches GDKs behaviour. In order for this to work we cannot use the same path when setting the value internally so introduce a _clutter_settings_set_property_internal and use it for that. https://bugzilla.gnome.org/show_bug.cgi?id=735244 --- clutter/clutter-settings-private.h | 4 ++++ clutter/clutter-settings.c | 23 ++++++++++++++++++++++- clutter/gdk/clutter-backend-gdk.c | 13 +++++++------ clutter/x11/clutter-backend-x11.c | 7 ++++--- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/clutter/clutter-settings-private.h b/clutter/clutter-settings-private.h index 0e1c463f9..244122c1f 100644 --- a/clutter/clutter-settings-private.h +++ b/clutter/clutter-settings-private.h @@ -11,6 +11,10 @@ void _clutter_settings_set_backend (ClutterSettings *settings, void _clutter_settings_read_from_key_file (ClutterSettings *settings, GKeyFile *key_file); +void clutter_settings_set_property_internal (ClutterSettings *settings, + const char *property, + GValue *value); + G_END_DECLS #endif /* __CLUTTER_SETTINGS_PRIVATE_H__ */ diff --git a/clutter/clutter-settings.c b/clutter/clutter-settings.c index 7b0032978..a269c3a89 100644 --- a/clutter/clutter-settings.c +++ b/clutter/clutter-settings.c @@ -355,7 +355,10 @@ clutter_settings_set_property (GObject *gobject, case PROP_WINDOW_SCALING_FACTOR: if (!self->fixed_scaling_factor) - self->window_scaling_factor = g_value_get_int (value); + { + self->window_scaling_factor = g_value_get_int (value); + self->fixed_scaling_factor = TRUE; + } break; case PROP_UNSCALED_FONT_DPI: @@ -369,6 +372,24 @@ clutter_settings_set_property (GObject *gobject, } } +void +clutter_settings_set_property_internal (ClutterSettings *self, + const char *property, + GValue *value) +{ + + property = g_intern_string (property); + + if (property == I_("window-scaling-factor") && + self->fixed_scaling_factor) + return; + + g_object_set_property (G_OBJECT (self), property, value); + + if (property == I_("window-scaling-factor")) + self->fixed_scaling_factor = FALSE; +} + static void clutter_settings_get_property (GObject *gobject, guint prop_id, diff --git a/clutter/gdk/clutter-backend-gdk.c b/clutter/gdk/clutter-backend-gdk.c index 7a719aa0b..7f14feb6e 100644 --- a/clutter/gdk/clutter-backend-gdk.c +++ b/clutter/gdk/clutter-backend-gdk.c @@ -65,6 +65,7 @@ #include "clutter-event-private.h" #include "clutter-main.h" #include "clutter-private.h" +#include "clutter-settings-private.h" #define clutter_backend_gdk_get_type _clutter_backend_gdk_get_type G_DEFINE_TYPE (ClutterBackendGdk, clutter_backend_gdk, CLUTTER_TYPE_BACKEND); @@ -88,9 +89,9 @@ clutter_backend_gdk_init_settings (ClutterBackendGdk *backend_gdk) gdk_screen_get_setting (backend_gdk->screen, CLUTTER_SETTING_GDK_NAME(i), &val); - g_object_set_property (G_OBJECT (settings), - CLUTTER_SETTING_PROPERTY(i), - &val); + clutter_settings_set_property_internal (settings, + CLUTTER_SETTING_PROPERTY (i), + &val); g_value_unset (&val); } } @@ -112,9 +113,9 @@ _clutter_backend_gdk_update_setting (ClutterBackendGdk *backend_gdk, gdk_screen_get_setting (backend_gdk->screen, CLUTTER_SETTING_GDK_NAME (i), &val); - g_object_set_property (G_OBJECT (settings), - CLUTTER_SETTING_PROPERTY (i), - &val); + clutter_settings_set_property_internal (settings, + CLUTTER_SETTING_PROPERTY (i), + &val); g_value_unset (&val); break; diff --git a/clutter/x11/clutter-backend-x11.c b/clutter/x11/clutter-backend-x11.c index 5e5d50658..c9478c405 100644 --- a/clutter/x11/clutter-backend-x11.c +++ b/clutter/x11/clutter-backend-x11.c @@ -63,6 +63,7 @@ #include "clutter-event-private.h" #include "clutter-main.h" #include "clutter-private.h" +#include "clutter-settings-private.h" #define clutter_backend_x11_get_type _clutter_backend_x11_get_type @@ -203,9 +204,9 @@ clutter_backend_x11_xsettings_notify (const char *name, CLUTTER_SETTING_X11_NAME (i), CLUTTER_SETTING_PROPERTY (i)); - g_object_set_property (G_OBJECT (settings), - CLUTTER_SETTING_PROPERTY (i), - &value); + clutter_settings_set_property_internal (settings, + CLUTTER_SETTING_PROPERTY (i), + &value); g_value_unset (&value);