From 207e7203a33781cc538b19658f19f4f14f8614a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Wed, 5 Aug 2020 16:07:16 +0200 Subject: [PATCH 01/19] rotateinfo: Fix indentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guido Günther --- src/rotateinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rotateinfo.c b/src/rotateinfo.c index 5cd3ccf7..b673fa3d 100644 --- a/src/rotateinfo.c +++ b/src/rotateinfo.c @@ -59,7 +59,7 @@ set_state (PhoshRotateInfo *self) monitor_is_landscape = ((double)monitor->width / (double)monitor->height) > 1.0; portrait = monitor_is_landscape ? !portrait : portrait; - g_debug ("Potrait: %d, width: %d, height: %d", portrait, monitor->width , monitor->height); + g_debug ("Potrait: %d, width: %d, height: %d", portrait, monitor->width, monitor->height); if (portrait) { phosh_status_icon_set_icon_name (PHOSH_STATUS_ICON (self), "screen-rotation-portrait-symbolic"); phosh_status_icon_set_info (PHOSH_STATUS_ICON (self), _("Portrait")); -- GitLab From b5545e2428c5816f9e5efd84b41c28a383988983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 26 Mar 2021 09:37:13 +0100 Subject: [PATCH 02/19] monitor-manager: Fix doc string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make function name match the actual definition. Signed-off-by: Guido Günther --- src/monitor-manager.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/monitor-manager.c b/src/monitor-manager.c index d67f073b..6e48ce26 100644 --- a/src/monitor-manager.c +++ b/src/monitor-manager.c @@ -1369,9 +1369,10 @@ phosh_monitor_manager_get_num_monitors (PhoshMonitorManager *self) } /** - * phosh_monitor_set_transform: + * phosh_monitor_manager_set_monitor_transform: * @self: A #PhoshMonitor - * @mode: The #PhoshMonitorPowerSaveMode + * @monitor: The #PhoshMonitor to set the tansform on + * @transform: The #PhoshMonitorTransform to set * * Sets monitor's transform. This will become active after the next * call to #phosh_monitor_manager_apply_monitor_config(). -- GitLab From ee3cb76591469a608d4ea2113853c9bf0e4d1be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 7 Jan 2021 16:39:12 +0100 Subject: [PATCH 03/19] shell: Create sensor-manager early MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want that before the panels since those might use other managers that need the sensor-manager (e.g. rotation-manager) Signed-off-by: Guido Günther --- src/shell.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shell.c b/src/shell.c index 0aad5403..cb596b45 100644 --- a/src/shell.c +++ b/src/shell.c @@ -469,6 +469,8 @@ setup_idle_cb (PhoshShell *self) priv->session_manager = phosh_session_manager_new (); priv->mode_manager = phosh_mode_manager_new (); + priv->sensor_proxy_manager = phosh_sensor_proxy_manager_get_default_failable (); + panels_create (self); /* Create background after panel since it needs the panel's size */ priv->background_manager = phosh_background_manager_new (); @@ -502,8 +504,8 @@ setup_idle_cb (PhoshShell *self) if (priv->sensor_proxy_manager) { priv->proximity = phosh_proximity_new (priv->sensor_proxy_manager, priv->lockscreen_manager); - /* TODO: accelerometer */ } + priv->mount_manager = phosh_mount_manager_new (); phosh_session_manager_register (priv->session_manager, -- GitLab From 9f3856df6f2cbe817c70cc3ce915c5117a192624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 7 Jan 2021 16:36:12 +0100 Subject: [PATCH 04/19] shell: Don't bother with accelerometer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rotation-manager takes care of that Signed-off-by: Guido Günther --- src/shell.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/shell.c b/src/shell.c index cb596b45..0bcf6558 100644 --- a/src/shell.c +++ b/src/shell.c @@ -340,13 +340,6 @@ phosh_shell_dispose (GObject *object) PhoshShell *self = PHOSH_SHELL (object); PhoshShellPrivate *priv = phosh_shell_get_instance_private(self); - if (priv->sensor_proxy_manager) { - phosh_dbus_sensor_proxy_call_release_accelerometer_sync ( - PHOSH_DBUS_SENSOR_PROXY(priv->sensor_proxy_manager), - NULL, NULL); - g_clear_object (&priv->sensor_proxy_manager); - } - panels_dispose (self); g_clear_pointer (&priv->faders, g_ptr_array_unref); -- GitLab From 4064988c7efeb1b74ebf32bbd2df02e8154392cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 7 Jan 2021 20:32:06 +0100 Subject: [PATCH 05/19] shell: Decruft builtin monitor setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just look it up on start since it can't change. Signed-off-by: Guido Günther --- src/shell.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/shell.c b/src/shell.c index 0bcf6558..b8a71053 100644 --- a/src/shell.c +++ b/src/shell.c @@ -611,6 +611,32 @@ on_monitor_removed (PhoshShell *self, PhoshMonitor *monitor) } +static PhoshMonitor * +find_builtin_monitor (PhoshShell *self) +{ + PhoshShellPrivate *priv; + PhoshMonitor *monitor = NULL; + + g_return_val_if_fail (PHOSH_IS_SHELL (self), NULL); + priv = phosh_shell_get_instance_private (self); + + if (priv->builtin_monitor) + return priv->builtin_monitor; + + for (int i = 0; i < phosh_monitor_manager_get_num_monitors (priv->monitor_manager); i++) { + monitor = phosh_monitor_manager_get_monitor (priv->monitor_manager, i); + if (phosh_monitor_is_builtin (monitor)) + break; + } + + if (!monitor) + monitor = phosh_monitor_manager_get_monitor (priv->monitor_manager, 0); + g_return_val_if_fail (monitor, NULL); + + return monitor; +} + + static void phosh_shell_constructed (GObject *object) { @@ -634,7 +660,7 @@ phosh_shell_constructed (GObject *object) phosh_wayland_roundtrip (phosh_wayland_get_default ()); if (phosh_monitor_manager_get_num_monitors(priv->monitor_manager)) { - priv->builtin_monitor = phosh_shell_get_builtin_monitor (self); + priv->builtin_monitor = g_object_ref (find_builtin_monitor (self)); g_debug ("Builtin monitor is %s, %d", priv->builtin_monitor->name, phosh_monitor_is_configured (priv->builtin_monitor)); @@ -819,25 +845,12 @@ PhoshMonitor * phosh_shell_get_builtin_monitor (PhoshShell *self) { PhoshShellPrivate *priv; - PhoshMonitor *monitor = NULL; g_return_val_if_fail (PHOSH_IS_SHELL (self), NULL); priv = phosh_shell_get_instance_private (self); + g_return_val_if_fail (PHOSH_IS_MONITOR (priv->builtin_monitor), NULL); - if (priv->builtin_monitor) - return priv->builtin_monitor; - - for (int i = 0; i < phosh_monitor_manager_get_num_monitors (priv->monitor_manager); i++) { - monitor = phosh_monitor_manager_get_monitor (priv->monitor_manager, i); - if (phosh_monitor_is_builtin (monitor)) - break; - } - - if (!monitor) - monitor = phosh_monitor_manager_get_monitor (priv->monitor_manager, 0); - g_return_val_if_fail (monitor, NULL); - - return monitor; + return priv->builtin_monitor; } -- GitLab From b8c08549e293471e07d19d06c04ebab84a111687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Mon, 29 Mar 2021 17:51:52 +0200 Subject: [PATCH 06/19] Avoid sensor-proxy singleton Treat it as regular initable that is fetched from the shell like other managers. --- src/sensor-proxy-manager.c | 30 ++++++++---------------------- src/sensor-proxy-manager.h | 2 +- src/shell.c | 6 ++++-- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/sensor-proxy-manager.c b/src/sensor-proxy-manager.c index 89b5e8f1..473a6b21 100644 --- a/src/sensor-proxy-manager.c +++ b/src/sensor-proxy-manager.c @@ -52,27 +52,13 @@ phosh_sensor_proxy_manager_init (PhoshSensorProxyManager *self) PhoshSensorProxyManager * -phosh_sensor_proxy_manager_get_default_failable (void) +phosh_sensor_proxy_manager_new (GError **err) { - static PhoshSensorProxyManager *instance; - GError *err = NULL; - GInitable *ret; - - if (instance == NULL) { - ret = g_initable_new (PHOSH_TYPE_SENSOR_PROXY_MANAGER, NULL, &err, - "g-flags", G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, - "g-name", IIO_SENSOR_PROXY_DBUS_NAME, - "g-bus-type", G_BUS_TYPE_SYSTEM, - "g-object-path", IIO_SENSOR_PROXY_DBUS_OBJECT, - "g-interface-name", IIO_SENSOR_PROXY_DBUS_IFACE_NAME, - NULL); - if (ret != NULL) { - instance = PHOSH_SENSOR_PROXY_MANAGER (ret); - } else { - g_warning ("Can't connect to iio-sensor-sensor proxy: %s", err->message); - return NULL; - } - g_object_add_weak_pointer (G_OBJECT (instance), (gpointer *)&instance); - } - return instance; + return g_initable_new (PHOSH_TYPE_SENSOR_PROXY_MANAGER, NULL, err, + "g-flags", G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, + "g-name", IIO_SENSOR_PROXY_DBUS_NAME, + "g-bus-type", G_BUS_TYPE_SYSTEM, + "g-object-path", IIO_SENSOR_PROXY_DBUS_OBJECT, + "g-interface-name", IIO_SENSOR_PROXY_DBUS_IFACE_NAME, + NULL); } diff --git a/src/sensor-proxy-manager.h b/src/sensor-proxy-manager.h index 9d140bae..32664a6d 100644 --- a/src/sensor-proxy-manager.h +++ b/src/sensor-proxy-manager.h @@ -13,6 +13,6 @@ G_DECLARE_FINAL_TYPE (PhoshSensorProxyManager, phosh_sensor_proxy_manager, PHOSH, SENSOR_PROXY_MANAGER, PhoshDBusSensorProxyProxy) -PhoshSensorProxyManager *phosh_sensor_proxy_manager_get_default_failable (void); +PhoshSensorProxyManager *phosh_sensor_proxy_manager_new (GError **err); gboolean phosh_sensor_proxy_manager_claim_proximity_sync (PhoshSensorProxyManager *self, GError **err); diff --git a/src/shell.c b/src/shell.c index b8a71053..6f0d3663 100644 --- a/src/shell.c +++ b/src/shell.c @@ -457,12 +457,15 @@ on_fade_out_timeout (PhoshShell *self) static gboolean setup_idle_cb (PhoshShell *self) { + g_autoptr (GError) err = NULL; PhoshShellPrivate *priv = phosh_shell_get_instance_private (self); priv->session_manager = phosh_session_manager_new (); priv->mode_manager = phosh_mode_manager_new (); - priv->sensor_proxy_manager = phosh_sensor_proxy_manager_get_default_failable (); + priv->sensor_proxy_manager = phosh_sensor_proxy_manager_new (&err); + if (!priv->sensor_proxy_manager) + g_warning ("Failed to connect to sensor-proxy: %s", err->message); panels_create (self); /* Create background after panel since it needs the panel's size */ @@ -493,7 +496,6 @@ setup_idle_cb (PhoshShell *self) G_CONNECT_SWAPPED); priv->location_manager = phosh_location_manager_new (); - priv->sensor_proxy_manager = phosh_sensor_proxy_manager_get_default_failable (); if (priv->sensor_proxy_manager) { priv->proximity = phosh_proximity_new (priv->sensor_proxy_manager, priv->lockscreen_manager); -- GitLab From f6e1b8b77fb9a13ea84735c94f8c674886f8a6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 23 Jun 2020 14:05:57 +0200 Subject: [PATCH 07/19] Add rotation-manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rotation manager listens to device orientation changes and adjusts the primary display accordingly. This interfaces with lockscreen, iio-sensor-proxy and gsettings to figure out the correct screen orientation. The manager has two modes: off (don't rotate any output) and sensor (adjust due to sensor values). Signed-off-by: Guido Günther --- docs/phosh-docs.xml | 1 + src/meson.build | 3 + src/phosh-enums.c.in | 1 + src/rotation-manager.c | 546 +++++++++++++++++++++++++++++++++++++++++ src/rotation-manager.h | 45 ++++ src/shell.c | 22 ++ src/shell.h | 2 + 7 files changed, 620 insertions(+) create mode 100644 src/rotation-manager.c create mode 100644 src/rotation-manager.h diff --git a/docs/phosh-docs.xml b/docs/phosh-docs.xml index e6c0a9db..9900a4ae 100644 --- a/docs/phosh-docs.xml +++ b/docs/phosh-docs.xml @@ -102,6 +102,7 @@ + diff --git a/src/meson.build b/src/meson.build index 7935b17a..5a0ea2b3 100644 --- a/src/meson.build +++ b/src/meson.build @@ -23,6 +23,7 @@ phosh_enum_headers = [ 'notifications/notification.h', 'notifications/notify-manager.h', 'phosh-wayland.h', + 'rotation-manager.h', 'shell.h', ] + schema_enum_headers @@ -162,6 +163,8 @@ libphosh_sources = [ 'polkit-auth-prompt.h', 'proximity.h', 'proximity.c', + 'rotation-manager.h', + 'rotation-manager.c', 'sensor-proxy-manager.c', 'sensor-proxy-manager.h', 'rotateinfo.c', diff --git a/src/phosh-enums.c.in b/src/phosh-enums.c.in index f001d726..293b97d9 100644 --- a/src/phosh-enums.c.in +++ b/src/phosh-enums.c.in @@ -11,6 +11,7 @@ #include "notifications/notification.h" #include "notifications/notify-manager.h" #include "phosh-wayland.h" +#include "rotation-manager.h" #include "shell.h" #include "wwan/phosh-wwan-backend.h" diff --git a/src/rotation-manager.c b/src/rotation-manager.c new file mode 100644 index 00000000..ba847553 --- /dev/null +++ b/src/rotation-manager.c @@ -0,0 +1,546 @@ +/* + * Copyright (C) 2021 Purism SPC + * + * SPDX-License-Identifier: GPL-3.0-or-later + * Author: Guido Günther + */ + +#define G_LOG_DOMAIN "phosh-rotation-manager" + +#include "config.h" +#include "rotation-manager.h" +#include "shell.h" +#include "sensor-proxy-manager.h" +#include "util.h" + +#define ORIENTATION_LOCK_SCHEMA_ID "org.gnome.settings-daemon.peripherals.touchscreen" +#define ORIENTATION_LOCK_KEY "orientation-lock" + +/** + * SECTION:rotation-manager + * @short_description: The Rotation Manager + * @Title: PhoshRotationManager + * + * #PhoshRotationManager is responsible for managing the rotation of + * a given #PhoshMonitor. Depending on the #PhoshRotationManagerMode + * this can happen by interfacing with a #PhoshSensorProxyManager or + * by setting the #PhoshMonitorTransform explicitly. + * It also takes the #PhoshLockscreenManager:locked status into account + * to ensure the lockscreen is rotated accordingly on small phones. + */ + +enum { + PROP_0, + PROP_SENSOR_PROXY_MANAGER, + PROP_LOCKSCREEN_MANAGER, + PROP_ORIENTATION_LOCKED, + PROP_MONITOR, + PROP_MODE, + LAST_PROP, +}; +static GParamSpec *props[LAST_PROP]; + +typedef struct _PhoshRotationManager { + GObject parent; + + gboolean claimed; + PhoshSensorProxyManager *sensor_proxy_manager; + PhoshLockscreenManager *lockscreen_manager; + PhoshMonitor *monitor; + + GSettings *settings; + gboolean orientation_locked; + + PhoshRotationManagerMode mode; +} PhoshRotationManager; + +G_DEFINE_TYPE (PhoshRotationManager, phosh_rotation_manager, G_TYPE_OBJECT); + + +static void +apply_transform (PhoshRotationManager *self, PhoshMonitorTransform transform) +{ + PhoshMonitorTransform current; + PhoshMonitorManager *monitor_manager = phosh_shell_get_monitor_manager (phosh_shell_get_default()); + + g_return_if_fail (PHOSH_IS_MONITOR_MANAGER (monitor_manager)); + g_return_if_fail (PHOSH_IS_MONITOR (self->monitor)); + + g_debug ("Rotating %s: %d", self->monitor->name, transform); + + current = phosh_monitor_get_transform (self->monitor); + if (current == transform) + return; + + phosh_monitor_manager_set_monitor_transform (monitor_manager, + self->monitor, + transform); + phosh_monitor_manager_apply_monitor_config (monitor_manager); +} + +/** + * match_orientation: + * @self: The #PhoshRotationManager + * + * Match the screen orientation to the sensor output. + * Do nothing if orientation lock is on or there's no + * sensor claimed. + */ +static void +match_orientation (PhoshRotationManager *self) +{ + const gchar *orient; + PhoshMonitorTransform transform; + + if (self->orientation_locked || !self->claimed || + self->mode == PHOSH_ROTATION_MANAGER_MODE_OFF) + return; + + orient = phosh_dbus_sensor_proxy_get_accelerometer_orientation ( + PHOSH_DBUS_SENSOR_PROXY (self->sensor_proxy_manager)); + + g_debug ("Orientation changed: %s, locked: %d, claimed: %d", + orient, self->orientation_locked, self->claimed); + + if (!g_strcmp0 ("normal", orient)) { + transform = PHOSH_MONITOR_TRANSFORM_NORMAL; + } else if (!g_strcmp0 ("right-up", orient)) { + transform = PHOSH_MONITOR_TRANSFORM_270; + } else if (!g_strcmp0 ("bottom-up", orient)) { + transform = PHOSH_MONITOR_TRANSFORM_180; + } else if (!g_strcmp0 ("left-up", orient)) { + transform = PHOSH_MONITOR_TRANSFORM_90; + } else if (!g_strcmp0 ("undefined", orient)) { + return; /* just leave as is */ + } else { + g_warning ("Unknown orientation '%s'", orient); + return; + } + + apply_transform (self, transform); +} + +static void +on_accelerometer_claimed (PhoshSensorProxyManager *sensor_proxy_manager, + GAsyncResult *res, + PhoshRotationManager *self) +{ + g_autoptr (GError) err = NULL; + gboolean success; + + g_return_if_fail (PHOSH_IS_SENSOR_PROXY_MANAGER (sensor_proxy_manager)); + g_return_if_fail (PHOSH_IS_ROTATION_MANAGER (self)); + g_return_if_fail (sensor_proxy_manager == self->sensor_proxy_manager); + + success = phosh_dbus_sensor_proxy_call_claim_accelerometer_finish ( + PHOSH_DBUS_SENSOR_PROXY (sensor_proxy_manager), + res, &err); + if (success) { + g_debug ("Claimed accelerometer"); + self->claimed = TRUE; + } else { + g_warning ("Failed to claim accelerometer: %s", err->message); + } + match_orientation (self); + g_object_unref (self); +} + +static void +on_accelerometer_released (PhoshSensorProxyManager *sensor_proxy_manager, + GAsyncResult *res, + PhoshRotationManager *self) +{ + g_autoptr (GError) err = NULL; + gboolean success; + + g_return_if_fail (PHOSH_IS_SENSOR_PROXY_MANAGER (sensor_proxy_manager)); + g_return_if_fail (PHOSH_IS_ROTATION_MANAGER (self)); + g_return_if_fail (sensor_proxy_manager == self->sensor_proxy_manager); + + success = phosh_dbus_sensor_proxy_call_release_accelerometer_finish ( + PHOSH_DBUS_SENSOR_PROXY (sensor_proxy_manager), + res, &err); + if (success) { + g_debug ("Released rotation sensor"); + } else { + g_warning ("Failed to release rotation sensor: %s", err->message); + } + self->claimed = FALSE; + g_object_unref (self); +} + +static void +phosh_rotation_manager_claim_accelerometer (PhoshRotationManager *self, gboolean claim) +{ + if (claim == self->claimed) + return; + + if (!self->sensor_proxy_manager) + return; + + if (claim) { + phosh_dbus_sensor_proxy_call_claim_accelerometer ( + PHOSH_DBUS_SENSOR_PROXY (self->sensor_proxy_manager), + NULL, + (GAsyncReadyCallback)on_accelerometer_claimed, + g_object_ref (self)); + } else { + phosh_dbus_sensor_proxy_call_release_accelerometer ( + PHOSH_DBUS_SENSOR_PROXY (self->sensor_proxy_manager), + NULL, + (GAsyncReadyCallback)on_accelerometer_released, + g_object_ref (self)); + } +} + +static void +on_has_accelerometer_changed (PhoshRotationManager *self, + GParamSpec *pspec, + PhoshSensorProxyManager *proxy) +{ + gboolean has_accel; + PhoshRotationManagerMode mode; + + has_accel = phosh_dbus_sensor_proxy_get_has_accelerometer ( + PHOSH_DBUS_SENSOR_PROXY (self->sensor_proxy_manager)); + + g_debug ("Found %s accelerometer", has_accel ? "a" : "no"); + + mode = has_accel ? PHOSH_ROTATION_MANAGER_MODE_SENSOR : PHOSH_ROTATION_MANAGER_MODE_OFF; + phosh_rotation_manager_set_mode (self, mode); +} + +static void +on_lockscreen_manager_locked (PhoshRotationManager *self, GParamSpec *pspec, + PhoshLockscreenManager *lockscreen_manager) +{ + gboolean claim; + + g_return_if_fail (PHOSH_IS_ROTATION_MANAGER (self)); + g_return_if_fail (PHOSH_IS_LOCKSCREEN_MANAGER (lockscreen_manager)); + + if (self->mode == PHOSH_ROTATION_MANAGER_MODE_OFF) + claim = FALSE; + else + claim = !phosh_lockscreen_manager_get_locked (self->lockscreen_manager); + + phosh_rotation_manager_claim_accelerometer (self, claim); +} + +static void +on_accelerometer_orientation_changed (PhoshRotationManager *self, + GParamSpec *pspec, + PhoshSensorProxyManager *sensor) +{ + g_return_if_fail (PHOSH_IS_ROTATION_MANAGER (self)); + g_return_if_fail (self->sensor_proxy_manager == sensor); + + match_orientation (self); +} + +static void +phosh_rotation_manager_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + PhoshRotationManager *self = PHOSH_ROTATION_MANAGER (object); + + switch (property_id) { + case PROP_SENSOR_PROXY_MANAGER: + /* construct only */ + self->sensor_proxy_manager = g_value_dup_object (value); + break; + case PROP_LOCKSCREEN_MANAGER: + /* construct only */ + self->lockscreen_manager = g_value_dup_object (value); + break; + case PROP_MONITOR: + /* construct only */ + self->monitor = g_value_dup_object (value); + break; + case PROP_ORIENTATION_LOCKED: + phosh_rotation_manager_set_orientation_locked (self, + g_value_get_boolean (value)); + break; + case PROP_MODE: + phosh_rotation_manager_set_mode (self, g_value_get_enum (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +phosh_rotation_manager_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + PhoshRotationManager *self = PHOSH_ROTATION_MANAGER (object); + + switch (property_id) { + case PROP_SENSOR_PROXY_MANAGER: + g_value_set_object (value, self->sensor_proxy_manager); + break; + case PROP_LOCKSCREEN_MANAGER: + g_value_set_object (value, self->lockscreen_manager); + break; + case PROP_ORIENTATION_LOCKED: + g_value_set_boolean (value, self->orientation_locked); + break; + case PROP_MODE: + g_value_set_enum (value, self->mode); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +phosh_rotation_manager_constructed (GObject *object) +{ + PhoshRotationManager *self = PHOSH_ROTATION_MANAGER (object); + + G_OBJECT_CLASS (phosh_rotation_manager_parent_class)->constructed (object); + + self->settings = g_settings_new (ORIENTATION_LOCK_SCHEMA_ID); + + g_settings_bind (self->settings, + ORIENTATION_LOCK_KEY, + self, + "orientation-locked", + G_BINDING_SYNC_CREATE + | G_BINDING_BIDIRECTIONAL); + + g_signal_connect_swapped (self->lockscreen_manager, + "notify::locked", + (GCallback) on_lockscreen_manager_locked, + self); + on_lockscreen_manager_locked (self, NULL, self->lockscreen_manager); + + if (!self->sensor_proxy_manager) + return; + + g_signal_connect_swapped (self->sensor_proxy_manager, + "notify::accelerometer-orientation", + (GCallback) on_accelerometer_orientation_changed, + self); + + g_signal_connect_swapped (self->sensor_proxy_manager, + "notify::has-accelerometer", + (GCallback) on_has_accelerometer_changed, + self); + on_has_accelerometer_changed (self, NULL, self->sensor_proxy_manager); +} + + +static void +phosh_rotation_manager_dispose (GObject *object) +{ + PhoshRotationManager *self = PHOSH_ROTATION_MANAGER (object); + + g_clear_object (&self->settings); + + if (self->sensor_proxy_manager) { + g_signal_handlers_disconnect_by_data (self->sensor_proxy_manager, + self); + /* Sync call since we're going away */ + phosh_dbus_sensor_proxy_call_release_accelerometer_sync ( + PHOSH_DBUS_SENSOR_PROXY (self->sensor_proxy_manager), NULL, NULL); + g_clear_object (&self->sensor_proxy_manager); + } + + if (self->lockscreen_manager) { + g_signal_handlers_disconnect_by_data (self->lockscreen_manager, + self); + g_clear_object (&self->lockscreen_manager); + } + g_clear_object (&self->monitor); + + G_OBJECT_CLASS (phosh_rotation_manager_parent_class)->dispose (object); +} + +static void +phosh_rotation_manager_class_init (PhoshRotationManagerClass *klass) +{ + GObjectClass *object_class = (GObjectClass *)klass; + + object_class->constructed = phosh_rotation_manager_constructed; + object_class->dispose = phosh_rotation_manager_dispose; + + object_class->set_property = phosh_rotation_manager_set_property; + object_class->get_property = phosh_rotation_manager_get_property; + + props[PROP_SENSOR_PROXY_MANAGER] = + g_param_spec_object ( + "sensor-proxy-manager", + "Sensor proxy manager", + "The object inerfacing with iio-sensor-proxy", + PHOSH_TYPE_SENSOR_PROXY_MANAGER, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + props[PROP_LOCKSCREEN_MANAGER] = + g_param_spec_object ( + "lockscreen-manager", + "Lockscren manager", + "The object managing the lock screen", + PHOSH_TYPE_LOCKSCREEN_MANAGER, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + props[PROP_MONITOR] = + g_param_spec_object ( + "monitor", + "Monitor", + "The monitor to rotate", + PHOSH_TYPE_MONITOR, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + props[PROP_ORIENTATION_LOCKED] = + g_param_spec_boolean ( + "orientation-locked", + "Screen orientation locked", + "Whether the screen orientation is locked", + TRUE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + props[PROP_MODE] = + g_param_spec_enum ( + "mode", + "Rotation mode", + "The current rotation mode", + PHOSH_TYPE_ROTATION_MANAGER_MODE, + PHOSH_ROTATION_MANAGER_MODE_OFF, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, LAST_PROP, props); +} + +static void +phosh_rotation_manager_init (PhoshRotationManager *self) +{ +} + + +PhoshRotationManager * +phosh_rotation_manager_new (PhoshSensorProxyManager *sensor_proxy_manager, + PhoshLockscreenManager *lockscreen_manager, + PhoshMonitor *monitor) +{ + return g_object_new (PHOSH_TYPE_ROTATION_MANAGER, + "sensor-proxy-manager", sensor_proxy_manager, + "lockscreen-manager", lockscreen_manager, + "monitor", monitor, + NULL); +} + +void +phosh_rotation_manager_set_orientation_locked (PhoshRotationManager *self, gboolean locked) +{ + g_return_if_fail (PHOSH_IS_ROTATION_MANAGER (self)); + + if (locked == self->orientation_locked) + return; + + self->orientation_locked = locked; + g_object_notify_by_pspec (G_OBJECT (self), props[PROP_ORIENTATION_LOCKED]); + match_orientation (self); +} + +gboolean +phosh_rotation_manager_get_orientation_locked (PhoshRotationManager *self) +{ + g_return_val_if_fail (PHOSH_IS_ROTATION_MANAGER (self), TRUE); + + return self->orientation_locked; +} + +PhoshRotationManagerMode +phosh_rotation_manager_get_mode (PhoshRotationManager *self) +{ + g_return_val_if_fail (PHOSH_IS_ROTATION_MANAGER (self), PHOSH_ROTATION_MANAGER_MODE_OFF); + + return self->mode; +} + +/** + * phosh_rotation_manager_set_mode: + * @self: The #PhoshRotationManager + * @mode: The #PhoshRotationManagerMode to set + * + * Sets the given mode. + * Returns: %TRUE if setting the mode was possible, otherwise %FALSE (e.g. when trying + * to set %PHOSH_ROTATION_MANAGER_MODE_SENSOR without having a sensor. + */ +gboolean +phosh_rotation_manager_set_mode (PhoshRotationManager *self, PhoshRotationManagerMode mode) +{ + gboolean has_accel; + + g_return_val_if_fail (PHOSH_IS_ROTATION_MANAGER (self), FALSE); + + if (mode == self->mode) + return TRUE; + + has_accel = phosh_dbus_sensor_proxy_get_has_accelerometer ( + PHOSH_DBUS_SENSOR_PROXY (self->sensor_proxy_manager)); + + if (mode == PHOSH_ROTATION_MANAGER_MODE_SENSOR && !has_accel) + return FALSE; + + self->mode = mode; + + g_debug ("Setting mode: %d", mode); + switch (mode) { + case PHOSH_ROTATION_MANAGER_MODE_OFF: + phosh_rotation_manager_claim_accelerometer (self, FALSE); + break; + case PHOSH_ROTATION_MANAGER_MODE_SENSOR: + /* Don't claim during screen lock, enables runtime pm and will be + claimed on unlock */ + if (!phosh_lockscreen_manager_get_locked (self->lockscreen_manager)) + phosh_rotation_manager_claim_accelerometer (self, TRUE); + break; + default: + g_assert_not_reached (); + } + + g_object_notify_by_pspec (G_OBJECT (self), props[PROP_MODE]); + return TRUE; +} + + +void +phosh_rotation_manager_set_transform (PhoshRotationManager *self, + PhoshMonitorTransform transform) +{ + g_return_if_fail (PHOSH_IS_ROTATION_MANAGER (self)); + g_return_if_fail (self->mode == PHOSH_ROTATION_MANAGER_MODE_OFF); + + apply_transform (self, transform); +} + +PhoshMonitorTransform +phosh_rotation_manager_get_transform (PhoshRotationManager *self) +{ + g_return_val_if_fail (PHOSH_IS_ROTATION_MANAGER (self), + PHOSH_MONITOR_TRANSFORM_NORMAL); + + return self->monitor->transform; +} + +/** + * phosh_rotation_manager_get_monitor: + * @self: The PhoshRotationManager + * + * Returns: The #PhoshMonitor this manager acts on + */ +PhoshMonitor * +phosh_rotation_manager_get_monitor (PhoshRotationManager *self) +{ + g_return_val_if_fail (PHOSH_IS_ROTATION_MANAGER (self), NULL); + + return self->monitor; +} diff --git a/src/rotation-manager.h b/src/rotation-manager.h new file mode 100644 index 00000000..b09926b5 --- /dev/null +++ b/src/rotation-manager.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 Purism SPC + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ +#pragma once + +#include "lockscreen-manager.h" +#include "sensor-proxy-manager.h" +#include "monitor/monitor.h" + +G_BEGIN_DECLS + +/** + * PhoshRotationManagerMode: + * @PHOSH_ROTATION_MANAGER_MODE_OFF: automatic rotation off + * @PHOSH_ROTATION_MANAGER_MODE_SENSOR: rotation driven by sensor orientation + * + * The mode of a #PhoshRotationManager + */ +typedef enum { + PHOSH_ROTATION_MANAGER_MODE_OFF, + PHOSH_ROTATION_MANAGER_MODE_SENSOR, +} PhoshRotationManagerMode; + +#define PHOSH_TYPE_ROTATION_MANAGER (phosh_rotation_manager_get_type ()) + +G_DECLARE_FINAL_TYPE (PhoshRotationManager, phosh_rotation_manager, PHOSH, ROTATION_MANAGER, GObject); + +PhoshRotationManager *phosh_rotation_manager_new (PhoshSensorProxyManager *sensor_proxy_manager, + PhoshLockscreenManager *lockscreen_manager, + PhoshMonitor *monitor); +void phosh_rotation_manager_set_orientation_locked (PhoshRotationManager *self, + gboolean locked); +gboolean phosh_rotation_manager_get_orientation_locked (PhoshRotationManager *self); + +PhoshRotationManagerMode phosh_rotation_manager_get_mode (PhoshRotationManager *self); +gboolean phosh_rotation_manager_set_mode (PhoshRotationManager *self, + PhoshRotationManagerMode mode); +void phosh_rotation_manager_set_transform (PhoshRotationManager *self, + PhoshMonitorTransform tranform); +PhoshMonitorTransform phosh_rotation_manager_get_transform (PhoshRotationManager *self); +PhoshMonitor *phosh_rotation_manager_get_monitor (PhoshRotationManager *self); + +G_END_DECLS diff --git a/src/shell.c b/src/shell.c index 6f0d3663..57caff0d 100644 --- a/src/shell.c +++ b/src/shell.c @@ -59,6 +59,7 @@ #include "proximity.h" #include "quick-setting.h" #include "rotateinfo.h" +#include "rotation-manager.h" #include "sensor-proxy-manager.h" #include "screen-saver-manager.h" #include "session-manager.h" @@ -129,6 +130,7 @@ typedef struct /* sensors */ PhoshSensorProxyManager *sensor_proxy_manager; PhoshProximity *proximity; + PhoshRotationManager *rotation_manager; gboolean startup_finished; PhoshMonitorTransform transform; /* current rotation of primary monitor */ @@ -372,7 +374,9 @@ phosh_shell_dispose (GObject *object) /* sensors */ g_clear_object (&priv->proximity); + g_clear_object (&priv->rotation_manager); g_clear_object (&priv->sensor_proxy_manager); + phosh_system_prompter_unregister (); g_clear_object (&priv->session_manager); @@ -1094,6 +1098,24 @@ phosh_shell_get_session_manager (PhoshShell *self) } +PhoshRotationManager * +phosh_shell_get_rotation_manager (PhoshShell *self) +{ + PhoshShellPrivate *priv; + + g_return_val_if_fail (PHOSH_IS_SHELL (self), NULL); + priv = phosh_shell_get_instance_private (self); + + if (!priv->rotation_manager) + priv->rotation_manager = phosh_rotation_manager_new (priv->sensor_proxy_manager, + priv->lockscreen_manager, + priv->builtin_monitor); + + g_return_val_if_fail (PHOSH_IS_ROTATION_MANAGER (priv->rotation_manager), NULL); + + return priv->rotation_manager; +} + /** * Returns the usable area in pixels usable by a client on the phone * display diff --git a/src/shell.h b/src/shell.h index 1b21eef8..d7cfcdbd 100644 --- a/src/shell.h +++ b/src/shell.h @@ -17,6 +17,7 @@ #include "monitor-manager.h" #include "monitor/monitor.h" #include "osk-manager.h" +#include "rotation-manager.h" #include "session-manager.h" #include "toplevel-manager.h" #include "torch-manager.h" @@ -79,6 +80,7 @@ PhoshWifiManager *phosh_shell_get_wifi_manager (PhoshShell *self); PhoshFeedbackManager *phosh_shell_get_feedback_manager (PhoshShell *self); PhoshBtManager *phosh_shell_get_bt_manager (PhoshShell *self); PhoshWWan *phosh_shell_get_wwan (PhoshShell *self); +PhoshRotationManager *phosh_shell_get_rotation_manager (PhoshShell *self); PhoshTorchManager *phosh_shell_get_torch_manager (PhoshShell *self); PhoshDockedManager *phosh_shell_get_docked_manager (PhoshShell *self); PhoshHksManager * phosh_shell_get_hks_manager (PhoshShell *self); -- GitLab From 9acef9b62ec219016b20c56640cb55bf8cfe0fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 23 Jun 2020 14:08:53 +0200 Subject: [PATCH 08/19] rotateinfo: Display either rotation lock or orientation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on the rotation managers mode dislay appropriate information. Closes: #18 Signed-off-by: Guido Günther --- src/rotateinfo.c | 82 +++++++++++++++++++++++++++++++++++------------- src/rotateinfo.h | 16 +++++++++- 2 files changed, 76 insertions(+), 22 deletions(-) diff --git a/src/rotateinfo.c b/src/rotateinfo.c index b673fa3d..1227d65d 100644 --- a/src/rotateinfo.c +++ b/src/rotateinfo.c @@ -15,28 +15,35 @@ /** * SECTION:rotateinfo - * @short_description: A widget to display the rotate status + * @short_description: A widget to display the rotate lock status * @Title: PhoshRotateInfo * - * Rotate Info widget + * A #PhoshStatusIcon to display the rotation lock status. + * It can either display whether a rotation lock is currently active or + * if the output is in portrait/landscape mode. */ typedef struct _PhoshRotateInfo { - PhoshStatusIcon parent; + PhoshStatusIcon parent; + + PhoshRotationManager *manager; } PhoshRotateInfo; G_DEFINE_TYPE (PhoshRotateInfo, phosh_rotate_info, PHOSH_TYPE_STATUS_ICON) - static void -set_state (PhoshRotateInfo *self) +on_transform_changed (PhoshRotateInfo *self) { PhoshShell *shell = phosh_shell_get_default (); PhoshMonitor *monitor = phosh_shell_get_primary_monitor (shell); gboolean monitor_is_landscape; gboolean portrait; + if (phosh_rotation_manager_get_mode (self->manager) != PHOSH_ROTATION_MANAGER_MODE_OFF) { + return; + } + switch (phosh_shell_get_transform (shell)) { case PHOSH_MONITOR_TRANSFORM_NORMAL: case PHOSH_MONITOR_TRANSFORM_FLIPPED: @@ -71,37 +78,70 @@ set_state (PhoshRotateInfo *self) static void -phosh_rotate_info_finalize (GObject *object) +on_orientation_lock_changed (PhoshRotateInfo *self) { - PhoshRotateInfo *self = PHOSH_ROTATE_INFO(object); + gboolean locked = phosh_rotation_manager_get_orientation_locked (self->manager); + const char *icon_name; - g_signal_handlers_disconnect_by_data (phosh_shell_get_default (), self); + if (phosh_rotation_manager_get_mode (self->manager) != PHOSH_ROTATION_MANAGER_MODE_SENSOR) + return; - G_OBJECT_CLASS (phosh_rotate_info_parent_class)->finalize (object); + g_debug ("Orientation locked: %d", locked); + + icon_name = locked ? "rotation-locked-symbolic" : "rotation-allowed-symbolic"; + phosh_status_icon_set_icon_name (PHOSH_STATUS_ICON (self), icon_name); + /* Translators: Automatic screen orientation is either on (enabled) or off (locked/disabled) */ + phosh_status_icon_set_info (PHOSH_STATUS_ICON (self), locked ? _("Off") : _("On")); + + return; } static void -phosh_rotate_info_class_init (PhoshRotateInfoClass *klass) +on_mode_changed (PhoshRotateInfo *self) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->finalize = phosh_rotate_info_finalize; + PhoshRotationManagerMode mode = phosh_rotation_manager_get_mode (self->manager); + + g_debug ("Rotation manager mode: %d", mode); + switch (mode) { + case PHOSH_ROTATION_MANAGER_MODE_OFF: + on_transform_changed (self); + break; + case PHOSH_ROTATION_MANAGER_MODE_SENSOR: + on_orientation_lock_changed (self); + break; + default: + g_assert_not_reached (); + } } static void -phosh_rotate_info_init (PhoshRotateInfo *self) +phosh_rotate_info_class_init (PhoshRotateInfoClass *klass) { - g_signal_connect_swapped (phosh_shell_get_default (), - "notify::transform", - G_CALLBACK (set_state), - self); - set_state (self); } -GtkWidget * -phosh_rotate_info_new (void) +static void +phosh_rotate_info_init (PhoshRotateInfo *self) { - return g_object_new (PHOSH_TYPE_ROTATE_INFO, NULL); + self->manager = phosh_shell_get_rotation_manager (phosh_shell_get_default()); + + /* We don't use property bindings since we flip info/icon based on rotation and lock */ + g_signal_connect_object (phosh_shell_get_default (), + "notify::transform", + G_CALLBACK (on_transform_changed), + self, + G_CONNECT_SWAPPED); + g_signal_connect_object (self->manager, + "notify::orientation-locked", + G_CALLBACK (on_orientation_lock_changed), + self, + G_CONNECT_SWAPPED); + g_signal_connect_object (self->manager, + "notify::mode", + G_CALLBACK (on_mode_changed), + self, + G_CONNECT_SWAPPED); + on_mode_changed (self); } diff --git a/src/rotateinfo.h b/src/rotateinfo.h index 2e05f818..1195fed6 100644 --- a/src/rotateinfo.h +++ b/src/rotateinfo.h @@ -11,10 +11,24 @@ G_BEGIN_DECLS +/** + * PhoshRotateInfoMode: + * @PHOSH_ROTATE_INFO_MODE_LOCK: Button toggles rotation lock + * @PHOSH_ROTATE_INFO_MODE_TOGGLE: Button toggles potrait/landscape + * + * The power save mode of a monitor + */ +typedef enum { + PHOSH_ROTATE_INFO_MODE_LOCK, + PHOSH_ROTATE_INFO_MODE_TOGGLE, +} PhoshRotateInfoMode; + #define PHOSH_TYPE_ROTATE_INFO (phosh_rotate_info_get_type()) G_DECLARE_FINAL_TYPE (PhoshRotateInfo, phosh_rotate_info, PHOSH, ROTATE_INFO, PhoshStatusIcon) -GtkWidget * phosh_rotate_info_new (void); +GtkWidget *phosh_rotate_info_new (void); +PhoshRotateInfoMode phosh_rotate_info_get_mode (PhoshRotateInfo *self); +void phosh_rotate_info_set_mode (PhoshRotateInfo *self, PhoshRotateInfoMode mode); G_END_DECLS -- GitLab From a30f0717605e0b79076da433e093774b77085b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 23 Jun 2020 14:10:38 +0200 Subject: [PATCH 09/19] settings: Add orientation lock to rotate quick setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Long press switches between potrait/landscape and rotation lock. Signed-off-by: Guido Günther --- src/settings.c | 54 ++++++++++++++++++++++++++++++++++++++--- src/ui/settings-menu.ui | 1 + 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/settings.c b/src/settings.c index eb55486e..57d48182 100644 --- a/src/settings.c +++ b/src/settings.c @@ -20,6 +20,7 @@ #include "feedback-manager.h" #include "notifications/notify-manager.h" #include "notifications/notification-frame.h" +#include "rotateinfo.h" #include #include "gvc-mixer-control.h" @@ -82,16 +83,60 @@ static void rotation_setting_clicked_cb (PhoshSettings *self) { PhoshShell *shell = phosh_shell_get_default (); + PhoshRotationManager *rotation_manager; + PhoshRotationManagerMode mode; PhoshMonitorTransform transform; + gboolean locked; g_return_if_fail (PHOSH_IS_SETTINGS (self)); - transform = phosh_shell_get_transform (shell); - phosh_shell_set_transform (shell, transform == PHOSH_MONITOR_TRANSFORM_NORMAL - ? PHOSH_MONITOR_TRANSFORM_270 - : PHOSH_MONITOR_TRANSFORM_NORMAL); + + rotation_manager = phosh_shell_get_rotation_manager (shell); + g_return_if_fail (rotation_manager); + mode = phosh_rotation_manager_get_mode (PHOSH_ROTATION_MANAGER (rotation_manager)); + + switch (mode) { + case PHOSH_ROTATION_MANAGER_MODE_OFF: + transform = phosh_shell_get_transform (shell); + phosh_shell_set_transform (shell, transform == PHOSH_MONITOR_TRANSFORM_NORMAL + ? PHOSH_MONITOR_TRANSFORM_270 + : PHOSH_MONITOR_TRANSFORM_NORMAL); + break; + case PHOSH_ROTATION_MANAGER_MODE_SENSOR: + locked = phosh_rotation_manager_get_orientation_locked (rotation_manager); + phosh_rotation_manager_set_orientation_locked (rotation_manager, !locked); + break; + default: + g_assert_not_reached (); + } + g_signal_emit (self, signals[SETTING_DONE], 0); } +static void +rotation_setting_long_pressed_cb (PhoshSettings *self) +{ + PhoshShell *shell = phosh_shell_get_default (); + PhoshRotateInfoMode mode; + PhoshRotationManager *rotation_manager; + + rotation_manager = phosh_shell_get_rotation_manager (shell); + g_return_if_fail (rotation_manager); + + mode = phosh_rotation_manager_get_mode (rotation_manager); + switch (mode) { + case PHOSH_ROTATION_MANAGER_MODE_OFF: + mode = PHOSH_ROTATION_MANAGER_MODE_SENSOR; + break; + case PHOSH_ROTATION_MANAGER_MODE_SENSOR: + mode = PHOSH_ROTATION_MANAGER_MODE_OFF; + break; + default: + g_assert_not_reached (); + } + g_debug ("Rotation manager mode: %d", mode); + phosh_rotation_manager_set_mode (rotation_manager, mode); +} + static void feedback_setting_clicked_cb (PhoshSettings *self) { @@ -481,6 +526,7 @@ phosh_settings_class_init (PhoshSettingsClass *klass) gtk_widget_class_bind_template_callback (widget_class, feedback_setting_long_pressed_cb); gtk_widget_class_bind_template_callback (widget_class, on_media_player_raised); gtk_widget_class_bind_template_callback (widget_class, rotation_setting_clicked_cb); + gtk_widget_class_bind_template_callback (widget_class, rotation_setting_long_pressed_cb); gtk_widget_class_bind_template_callback (widget_class, torch_setting_clicked_cb); gtk_widget_class_bind_template_callback (widget_class, wifi_setting_clicked_cb); gtk_widget_class_bind_template_callback (widget_class, wwan_setting_clicked_cb); diff --git a/src/ui/settings-menu.ui b/src/ui/settings-menu.ui index da196806..af7ee9ce 100644 --- a/src/ui/settings-menu.ui +++ b/src/ui/settings-menu.ui @@ -95,6 +95,7 @@ True False + True -- GitLab From 48235828793eb44971e59a725cfaab7a9102ea65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 26 Mar 2021 10:00:37 +0100 Subject: [PATCH 10/19] Move Lockscreen rotation fixup to rotation-manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need to have several objects involved. This avoids lockscreen and rotation manager racing since we can do it past the unclaim of the accelerometer. Signed-off-by: Guido Günther --- src/lockscreen-manager.c | 38 ------------------- src/rotation-manager.c | 82 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 40 deletions(-) diff --git a/src/lockscreen-manager.c b/src/lockscreen-manager.c index 54041c5c..0c8c16b0 100644 --- a/src/lockscreen-manager.c +++ b/src/lockscreen-manager.c @@ -77,10 +77,6 @@ lockscreen_unlock_cb (PhoshLockscreenManager *self, PhoshLockscreen *lockscreen) g_return_if_fail (PHOSH_IS_LOCKSCREEN (lockscreen)); g_return_if_fail (lockscreen == PHOSH_LOCKSCREEN (self->lockscreen)); - /* Fixup transform in case the lockscreen needed to rotate to unlock */ - g_debug ("Restoring transform %d", self->transform); - phosh_shell_set_transform (shell, self->transform); - g_signal_handlers_disconnect_by_data (monitor_manager, self); g_signal_handlers_disconnect_by_data (primary_monitor, self); g_signal_handlers_disconnect_by_data (shell, self); @@ -171,35 +167,6 @@ on_monitor_added (PhoshLockscreenManager *self, lock_monitor (self, monitor); } -static void -on_primary_monitor_power_mode_changed (PhoshLockscreenManager *self, - GParamSpec *pspec, - PhoshMonitor *monitor) -{ - PhoshShell *shell = phosh_shell_get_default (); - PhoshModeManager *mode_manager = phosh_shell_get_mode_manager(shell); - - /* - * Only phones need to switch orientation so that the lock screen fits - * https://source.puri.sm/Librem5/phosh/-/issues/388 - */ - if (phosh_mode_manager_get_device_type(mode_manager) != PHOSH_MODE_DEVICE_TYPE_PHONE) - return; - - /* Don't mess with transforms on external screens either */ - if (!phosh_monitor_is_builtin (monitor)) - return; - - switch (phosh_monitor_get_power_save_mode (monitor)) { - case PHOSH_MONITOR_POWER_SAVE_MODE_ON: - phosh_shell_set_transform (shell, PHOSH_MONITOR_TRANSFORM_NORMAL); - break; - case PHOSH_MONITOR_POWER_SAVE_MODE_OFF: - break; - default: - g_warn_if_reached (); - } -} static void lock_primary_monitor (PhoshLockscreenManager *self) @@ -209,7 +176,6 @@ lock_primary_monitor (PhoshLockscreenManager *self) PhoshShell *shell = phosh_shell_get_default (); primary_monitor = phosh_shell_get_primary_monitor (shell); - self->transform = phosh_shell_get_transform (shell); /* The primary output gets the clock, keypad, ... */ self->lockscreen = PHOSH_LOCKSCREEN (phosh_lockscreen_new ( @@ -222,10 +188,6 @@ lock_primary_monitor (PhoshLockscreenManager *self) "swapped-object-signal::wakeup-output", G_CALLBACK (lockscreen_wakeup_output_cb), self, NULL); - g_signal_connect_swapped (primary_monitor, "notify::power-mode", - G_CALLBACK(on_primary_monitor_power_mode_changed), - self); - gtk_widget_show (GTK_WIDGET (self->lockscreen)); /* Old lockscreen gets remove due to `layer_surface_closed` */ } diff --git a/src/rotation-manager.c b/src/rotation-manager.c index ba847553..b22b58de 100644 --- a/src/rotation-manager.c +++ b/src/rotation-manager.c @@ -47,6 +47,7 @@ typedef struct _PhoshRotationManager { PhoshSensorProxyManager *sensor_proxy_manager; PhoshLockscreenManager *lockscreen_manager; PhoshMonitor *monitor; + PhoshMonitorTransform prelock_transform; GSettings *settings; gboolean orientation_locked; @@ -210,6 +211,67 @@ on_has_accelerometer_changed (PhoshRotationManager *self, phosh_rotation_manager_set_mode (self, mode); } +/** + * fixup_lockscreen_orientation: + * @self: The PhoshRotationManager + * @force: Whether to force the monitor to normal orientation + * + * On phones the lock screen doesn't work in landscape so fix that + * until https://source.puri.sm/Librem5/phosh/-/issues/388 + * is fixed. Keep all of this local to this function. + */ +static void +fixup_lockscreen_orientation (PhoshRotationManager *self, gboolean force) +{ + PhoshShell *shell = phosh_shell_get_default (); + PhoshModeManager *mode_manager = phosh_shell_get_mode_manager(shell); + + g_return_if_fail (PHOSH_IS_MODE_MANAGER (mode_manager)); + g_return_if_fail (PHOSH_IS_MONITOR (self->monitor)); + + /* Only bother on phones */ + if (phosh_mode_manager_get_device_type(mode_manager) != PHOSH_MODE_DEVICE_TYPE_PHONE && + phosh_mode_manager_get_device_type(mode_manager) != PHOSH_MODE_DEVICE_TYPE_UNKNOWN) + return; + + /* Don't mess with transforms on external screens either */ + if (!phosh_monitor_is_builtin (self->monitor)) + return; + + if (phosh_lockscreen_manager_get_locked (self->lockscreen_manager)) { + if (force) { + g_debug ("Forcing normal transform"); + apply_transform (self, PHOSH_MONITOR_TRANSFORM_NORMAL); + } else { + self->prelock_transform = phosh_monitor_get_transform (self->monitor); + g_debug ("Saving transform %d", self->prelock_transform); + } + } else { + g_debug ("Restoring transform %d", self->prelock_transform); + apply_transform (self, self->prelock_transform); + } +} + + +static void +on_power_mode_changed (PhoshRotationManager *self, + GParamSpec *pspec, + PhoshMonitor *monitor) +{ + PhoshMonitorPowerSaveMode mode; + + g_return_if_fail (PHOSH_IS_ROTATION_MANAGER (self)); + g_return_if_fail (PHOSH_IS_MONITOR (monitor)); + + mode = phosh_monitor_get_power_save_mode (monitor); + g_debug ("Mode: %d", mode); + if (mode != PHOSH_MONITOR_POWER_SAVE_MODE_ON) + return; + + fixup_lockscreen_orientation (self, TRUE); +} + + static void on_lockscreen_manager_locked (PhoshRotationManager *self, GParamSpec *pspec, PhoshLockscreenManager *lockscreen_manager) @@ -225,6 +287,8 @@ on_lockscreen_manager_locked (PhoshRotationManager *self, GParamSpec *pspec, claim = !phosh_lockscreen_manager_get_locked (self->lockscreen_manager); phosh_rotation_manager_claim_accelerometer (self, claim); + + fixup_lockscreen_orientation (self, FALSE); } static void @@ -321,8 +385,17 @@ phosh_rotation_manager_constructed (GObject *object) self); on_lockscreen_manager_locked (self, NULL, self->lockscreen_manager); - if (!self->sensor_proxy_manager) + g_signal_connect_swapped (self->monitor, + "notify::power-mode", + (GCallback) on_power_mode_changed, + self); + on_power_mode_changed (self, NULL, self->monitor); + + + if (!self->sensor_proxy_manager) { + g_warning ("Got not sensor-proxy, no automatic rotation"); return; + } g_signal_connect_swapped (self->sensor_proxy_manager, "notify::accelerometer-orientation", @@ -358,7 +431,12 @@ phosh_rotation_manager_dispose (GObject *object) self); g_clear_object (&self->lockscreen_manager); } - g_clear_object (&self->monitor); + + if (self->monitor) { + g_signal_handlers_disconnect_by_data (self->monitor, + self); + g_clear_object (&self->monitor); + } G_OBJECT_CLASS (phosh_rotation_manager_parent_class)->dispose (object); } -- GitLab From e4fd28cd54c1a03c9afb1ca209eda0bd333089ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 26 Mar 2021 10:14:54 +0100 Subject: [PATCH 11/19] settings: Use rotation-manager instead of shell to rotate output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sure the same output is rotated via manual rotation and sensor. Signed-off-by: Guido Günther --- src/settings.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/settings.c b/src/settings.c index 57d48182..54a60d9a 100644 --- a/src/settings.c +++ b/src/settings.c @@ -96,10 +96,9 @@ rotation_setting_clicked_cb (PhoshSettings *self) switch (mode) { case PHOSH_ROTATION_MANAGER_MODE_OFF: - transform = phosh_shell_get_transform (shell); - phosh_shell_set_transform (shell, transform == PHOSH_MONITOR_TRANSFORM_NORMAL - ? PHOSH_MONITOR_TRANSFORM_270 - : PHOSH_MONITOR_TRANSFORM_NORMAL); + transform = phosh_rotation_manager_get_transform (rotation_manager) ? + PHOSH_MONITOR_TRANSFORM_NORMAL : PHOSH_MONITOR_TRANSFORM_270; + phosh_rotation_manager_set_transform (rotation_manager, transform); break; case PHOSH_ROTATION_MANAGER_MODE_SENSOR: locked = phosh_rotation_manager_get_orientation_locked (rotation_manager); -- GitLab From 7e574bd2ccaad5861d1c8f8d22ade1f2f96207cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 26 Mar 2021 10:31:31 +0100 Subject: [PATCH 12/19] rotateinfo: Use monitor form rotation-manager consistently MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far this was dependent on mode Signed-off-by: Guido Günther --- src/rotateinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rotateinfo.c b/src/rotateinfo.c index 1227d65d..ecfc9cf3 100644 --- a/src/rotateinfo.c +++ b/src/rotateinfo.c @@ -35,8 +35,7 @@ G_DEFINE_TYPE (PhoshRotateInfo, phosh_rotate_info, PHOSH_TYPE_STATUS_ICON) static void on_transform_changed (PhoshRotateInfo *self) { - PhoshShell *shell = phosh_shell_get_default (); - PhoshMonitor *monitor = phosh_shell_get_primary_monitor (shell); + PhoshMonitor *monitor; gboolean monitor_is_landscape; gboolean portrait; @@ -44,7 +43,7 @@ on_transform_changed (PhoshRotateInfo *self) return; } - switch (phosh_shell_get_transform (shell)) { + switch (phosh_rotation_manager_get_transform (self->manager)) { case PHOSH_MONITOR_TRANSFORM_NORMAL: case PHOSH_MONITOR_TRANSFORM_FLIPPED: case PHOSH_MONITOR_TRANSFORM_180: @@ -63,6 +62,7 @@ on_transform_changed (PhoshRotateInfo *self) } /* If we have a landscape monitor (tv, laptop) flip the rotation */ + monitor = phosh_rotation_manager_get_monitor (self->manager); monitor_is_landscape = ((double)monitor->width / (double)monitor->height) > 1.0; portrait = monitor_is_landscape ? !portrait : portrait; -- GitLab From 9e56eb92a30f6d25d44294bc9221a1818c6ea8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 26 Mar 2021 10:31:31 +0100 Subject: [PATCH 13/19] rotateinfo: Use monitor form rotation-manager consistently MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Priort to the rotation-manager this incorrectly tracked the primary monitor, track the rotated monitor instead. Signed-off-by: Guido Günther --- src/rotateinfo.c | 2 +- src/rotation-manager.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/rotateinfo.c b/src/rotateinfo.c index ecfc9cf3..149b5d4d 100644 --- a/src/rotateinfo.c +++ b/src/rotateinfo.c @@ -128,7 +128,7 @@ phosh_rotate_info_init (PhoshRotateInfo *self) self->manager = phosh_shell_get_rotation_manager (phosh_shell_get_default()); /* We don't use property bindings since we flip info/icon based on rotation and lock */ - g_signal_connect_object (phosh_shell_get_default (), + g_signal_connect_object (self->manager, "notify::transform", G_CALLBACK (on_transform_changed), self, diff --git a/src/rotation-manager.c b/src/rotation-manager.c index b22b58de..1a4263d9 100644 --- a/src/rotation-manager.c +++ b/src/rotation-manager.c @@ -36,6 +36,7 @@ enum { PROP_ORIENTATION_LOCKED, PROP_MONITOR, PROP_MODE, + PROP_TRANSFORM, LAST_PROP, }; static GParamSpec *props[LAST_PROP]; @@ -47,6 +48,7 @@ typedef struct _PhoshRotationManager { PhoshSensorProxyManager *sensor_proxy_manager; PhoshLockscreenManager *lockscreen_manager; PhoshMonitor *monitor; + PhoshMonitorTransform transform; PhoshMonitorTransform prelock_transform; GSettings *settings; @@ -302,6 +304,26 @@ on_accelerometer_orientation_changed (PhoshRotationManager *self, match_orientation (self); } + +static void +on_monitor_configured (PhoshRotationManager *self, + PhoshMonitor *monitor) +{ + PhoshMonitorTransform transform; + + g_return_if_fail (PHOSH_IS_ROTATION_MANAGER (self)); + g_return_if_fail (PHOSH_IS_MONITOR (monitor)); + + transform = phosh_monitor_get_transform (monitor); + if (transform == self->transform) + return; + + self->transform = transform; + g_debug ("Rotation-manager transform %d", transform); + g_object_notify_by_pspec (G_OBJECT (self), props[PROP_TRANSFORM]); +} + + static void phosh_rotation_manager_set_property (GObject *object, guint property_id, @@ -357,6 +379,9 @@ phosh_rotation_manager_get_property (GObject *object, case PROP_MODE: g_value_set_enum (value, self->mode); break; + case PROP_TRANSFORM: + g_value_set_enum (value, self->transform); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -391,6 +416,11 @@ phosh_rotation_manager_constructed (GObject *object) self); on_power_mode_changed (self, NULL, self->monitor); + g_signal_connect_swapped (self->monitor, + "configured", + G_CALLBACK (on_monitor_configured), + self); + on_monitor_configured (self, self->monitor); if (!self->sensor_proxy_manager) { g_warning ("Got not sensor-proxy, no automatic rotation"); @@ -493,6 +523,14 @@ phosh_rotation_manager_class_init (PhoshRotationManagerClass *klass) PHOSH_ROTATION_MANAGER_MODE_OFF, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + props[PROP_TRANSFORM] = + g_param_spec_enum ("transform", + "Transform", + "Monitor transform of the rotation monitor", + PHOSH_TYPE_MONITOR_TRANSFORM, + PHOSH_MONITOR_TRANSFORM_NORMAL, + G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (object_class, LAST_PROP, props); } -- GitLab From 54f2e80e2a5b5e977130aaf005deb26ddf232db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 26 Mar 2021 10:45:19 +0100 Subject: [PATCH 14/19] shell: Drop transform handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is done by the rotation-manager which always acts on the given monitor. Closes: #56 Signed-off-by: Guido Günther --- src/shell.c | 36 ------------------------------------ src/shell.h | 2 -- 2 files changed, 38 deletions(-) diff --git a/src/shell.c b/src/shell.c index 57caff0d..3fcd83ba 100644 --- a/src/shell.c +++ b/src/shell.c @@ -512,10 +512,6 @@ setup_idle_cb (PhoshShell *self) g_getenv ("DESKTOP_AUTOSTART_ID")); g_unsetenv ("DESKTOP_AUTOSTART_ID"); - /* If we start rotated, fix this up */ - if (phosh_shell_get_transform (self) != PHOSH_MONITOR_TRANSFORM_NORMAL) - phosh_shell_set_transform (self, PHOSH_MONITOR_TRANSFORM_NORMAL); - priv->gnome_shell_manager = phosh_gnome_shell_manager_get_default (); priv->startup_finished = TRUE; @@ -772,38 +768,6 @@ phosh_shell_init (PhoshShell *self) } -PhoshMonitorTransform -phosh_shell_get_transform (PhoshShell *self) -{ - PhoshShellPrivate *priv; - - g_return_val_if_fail (PHOSH_IS_SHELL (self), PHOSH_MONITOR_TRANSFORM_NORMAL); - priv = phosh_shell_get_instance_private (self); - g_return_val_if_fail (priv->primary_monitor, PHOSH_MONITOR_TRANSFORM_NORMAL); - return phosh_monitor_get_transform (priv->primary_monitor); -} - - -void -phosh_shell_set_transform (PhoshShell *self, - PhoshMonitorTransform transform) -{ - PhoshShellPrivate *priv = phosh_shell_get_instance_private (self); - PhoshMonitorTransform current; - - g_return_if_fail (priv->primary_monitor); - current = phosh_monitor_get_transform (priv->primary_monitor); - if (current == transform) - return; - - phosh_monitor_manager_set_monitor_transform (priv->monitor_manager, - priv->primary_monitor, - transform); - phosh_monitor_manager_apply_monitor_config (priv->monitor_manager); - /* Notification change signalled in on_primary_monitor_configured */ -} - - void phosh_shell_set_primary_monitor (PhoshShell *self, PhoshMonitor *monitor) { diff --git a/src/shell.h b/src/shell.h index d7cfcdbd..d7aee9d5 100644 --- a/src/shell.h +++ b/src/shell.h @@ -57,8 +57,6 @@ G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (PhoshShell, phosh_shell, PHOSH, SHELL, GObject) PhoshShell *phosh_shell_get_default (void); -void phosh_shell_set_transform (PhoshShell *self, PhoshMonitorTransform transform); -PhoshMonitorTransform phosh_shell_get_transform (PhoshShell *self); void phosh_shell_get_usable_area (PhoshShell *self, int *x, int *y, -- GitLab From 1b08c29410e6eb5327b59928226e2d62e6707384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 26 Mar 2021 15:01:24 +0100 Subject: [PATCH 15/19] rotation-manager: Mess with transform as little as possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On phones when we're already using portrait orientation don't bother fixing this up. This allows for e.g. upside down operation. Signed-off-by: Guido Günther --- src/rotation-manager.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rotation-manager.c b/src/rotation-manager.c index 1a4263d9..c5d8d541 100644 --- a/src/rotation-manager.c +++ b/src/rotation-manager.c @@ -216,9 +216,9 @@ on_has_accelerometer_changed (PhoshRotationManager *self, /** * fixup_lockscreen_orientation: * @self: The PhoshRotationManager - * @force: Whether to force the monitor to normal orientation + * @force: Whether to force the monitor to portait orientation * - * On phones the lock screen doesn't work in landscape so fix that + * On phones the lock screen doesn't work in landscape so fix that up * until https://source.puri.sm/Librem5/phosh/-/issues/388 * is fixed. Keep all of this local to this function. */ @@ -242,8 +242,12 @@ fixup_lockscreen_orientation (PhoshRotationManager *self, gboolean force) if (phosh_lockscreen_manager_get_locked (self->lockscreen_manager)) { if (force) { - g_debug ("Forcing normal transform"); - apply_transform (self, PHOSH_MONITOR_TRANSFORM_NORMAL); + PhoshMonitorTransform transform; + /* Use prelock transform if portrait, else use normal */ + transform = (self->prelock_transform % 2) == 0 ? self->prelock_transform : + PHOSH_MONITOR_TRANSFORM_NORMAL; + g_debug ("Forcing portrait transform: %d", transform); + apply_transform (self, transform); } else { self->prelock_transform = phosh_monitor_get_transform (self->monitor); g_debug ("Saving transform %d", self->prelock_transform); -- GitLab From 6e306eca5bfa8a73f53d99bbce9de123b8e1e595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sun, 28 Mar 2021 19:27:06 +0200 Subject: [PATCH 16/19] settings: Don't close menu when toggling rotation lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it consistent with other toggles like feedback toggle. Signed-off-by: Guido Günther --- src/settings.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/settings.c b/src/settings.c index 54a60d9a..81a095c9 100644 --- a/src/settings.c +++ b/src/settings.c @@ -99,6 +99,7 @@ rotation_setting_clicked_cb (PhoshSettings *self) transform = phosh_rotation_manager_get_transform (rotation_manager) ? PHOSH_MONITOR_TRANSFORM_NORMAL : PHOSH_MONITOR_TRANSFORM_270; phosh_rotation_manager_set_transform (rotation_manager, transform); + g_signal_emit (self, signals[SETTING_DONE], 0); break; case PHOSH_ROTATION_MANAGER_MODE_SENSOR: locked = phosh_rotation_manager_get_orientation_locked (rotation_manager); @@ -107,8 +108,6 @@ rotation_setting_clicked_cb (PhoshSettings *self) default: g_assert_not_reached (); } - - g_signal_emit (self, signals[SETTING_DONE], 0); } static void -- GitLab From e7727ada0a5a9c9e3e197af914be145d1d735525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Mon, 29 Mar 2021 17:18:16 +0200 Subject: [PATCH 17/19] monitor: Update org.gnome.Mutter.DisplayConfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is from mutter's 331b5f356311f1dcfc1b580e349a60d25fc0e34f Signed-off-by: Guido Günther --- src/monitor/org.gnome.Mutter.DisplayConfig.xml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/monitor/org.gnome.Mutter.DisplayConfig.xml b/src/monitor/org.gnome.Mutter.DisplayConfig.xml index fe8e0229..044244e4 100644 --- a/src/monitor/org.gnome.Mutter.DisplayConfig.xml +++ b/src/monitor/org.gnome.Mutter.DisplayConfig.xml @@ -101,7 +101,7 @@ or not - "presentation" (b): whether this output is for presentation only - Note: properties might be ignored if not consistenly + Note: properties might be ignored if not consistently applied to all outputs in the same clone group. In general, it's expected that presentation or primary outputs will not be cloned. @@ -282,6 +282,14 @@ --> + + +