[gnome-control-center] display: Add support for mutter's global scale requirement
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] display: Add support for mutter's global scale requirement
- Date: Sun, 21 Jan 2018 14:27:32 +0000 (UTC)
commit 1fe3f5c5fe695c3be9e9e1c1029dcf055addf835
Author: Rui Matos <tiagomatos gmail com>
Date: Mon Dec 18 15:43:00 2017 +0100
display: Add support for mutter's global scale requirement
If mutter requires the same scale on all logical monitors we must
propagate a scale set on one monitor to the remaining ones or we'll
fail validation leaving users wondering why it doesn't work.
https://bugzilla.gnome.org/show_bug.cgi?id=790809
panels/display/cc-display-config-dbus.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index 26dbcdf..593cf01 100644
--- a/panels/display/cc-display-config-dbus.c
+++ b/panels/display/cc-display-config-dbus.c
@@ -870,6 +870,7 @@ struct _CcDisplayConfigDBus
guint32 serial;
gboolean supports_mirroring;
gboolean supports_changing_layout_mode;
+ gboolean global_scale_required;
CcDisplayLayoutMode layout_mode;
GList *monitors;
@@ -1192,6 +1193,7 @@ cc_display_config_dbus_init (CcDisplayConfigDBus *self)
self->serial = 0;
self->supports_mirroring = TRUE;
self->supports_changing_layout_mode = FALSE;
+ self->global_scale_required = FALSE;
self->layout_mode = CC_DISPLAY_LAYOUT_MODE_LOGICAL;
self->logical_monitors = g_hash_table_new (NULL, NULL);
}
@@ -1245,6 +1247,21 @@ register_logical_monitor (CcDisplayConfigDBus *self,
}
static void
+apply_global_scale_requirement (CcDisplayConfigDBus *self,
+ CcDisplayMonitor *monitor)
+{
+ GList *l;
+ double scale = cc_display_monitor_get_scale (monitor);
+
+ for (l = self->monitors; l != NULL; l = l->next)
+ {
+ CcDisplayMonitor *m = l->data;
+ if (m != monitor)
+ cc_display_monitor_set_scale (m, scale);
+ }
+}
+
+static void
construct_monitors (CcDisplayConfigDBus *self,
GVariantIter *monitors,
GVariantIter *logical_monitors)
@@ -1258,6 +1275,10 @@ construct_monitors (CcDisplayConfigDBus *self,
monitor = cc_display_monitor_dbus_new (variant, self);
self->monitors = g_list_prepend (self->monitors, monitor);
+ if (self->global_scale_required)
+ g_signal_connect_object (monitor, "scale",
+ G_CALLBACK (apply_global_scale_requirement),
+ self, G_CONNECT_SWAPPED);
g_variant_unref (variant);
}
@@ -1340,6 +1361,10 @@ cc_display_config_dbus_constructed (GObject *object)
{
g_variant_get (v, "b", &self->supports_changing_layout_mode);
}
+ else if (g_str_equal (s, "global-scale-required"))
+ {
+ g_variant_get (v, "b", &self->global_scale_required);
+ }
else if (g_str_equal (s, "layout-mode"))
{
guint32 u = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]