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
This commit is contained in:
Adel Gadllah 2014-08-23 10:10:25 +02:00
parent ee59a458d2
commit cfcba18684
4 changed files with 37 additions and 10 deletions

View File

@ -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__ */

View File

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

View File

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

View File

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