[gnome-flashback] backends: take device orientation into account for new configs
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] backends: take device orientation into account for new configs
- Date: Tue, 18 Feb 2020 19:47:42 +0000 (UTC)
commit e3516e7eb44db922f743149d523c916d8211ab86
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Feb 18 19:40:00 2020 +0200
backends: take device orientation into account for new configs
https://gitlab.gnome.org/GNOME/mutter/commit/e4d5cb72eef0ce9019353
backends/gf-monitor-config-manager.c | 42 ++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
---
diff --git a/backends/gf-monitor-config-manager.c b/backends/gf-monitor-config-manager.c
index a2a3998..6acaafa 100644
--- a/backends/gf-monitor-config-manager.c
+++ b/backends/gf-monitor-config-manager.c
@@ -153,6 +153,37 @@ find_primary_monitor (GfMonitorManager *monitor_manager)
}
}
+static GfMonitorTransform
+get_monitor_transform (GfMonitorManager *monitor_manager,
+ GfMonitor *monitor)
+{
+ GfBackend *backend;
+ GfOrientationManager *orientation_manager;
+
+ if (!gf_monitor_is_laptop_panel (monitor))
+ return GF_MONITOR_TRANSFORM_NORMAL;
+
+ backend = gf_monitor_manager_get_backend (monitor_manager);
+ orientation_manager = gf_backend_get_orientation_manager (backend);
+
+ switch (gf_orientation_manager_get_orientation (orientation_manager))
+ {
+ case GF_ORIENTATION_BOTTOM_UP:
+ return GF_MONITOR_TRANSFORM_180;
+
+ case GF_ORIENTATION_LEFT_UP:
+ return GF_MONITOR_TRANSFORM_90;
+
+ case GF_ORIENTATION_RIGHT_UP:
+ return GF_MONITOR_TRANSFORM_270;
+
+ case GF_ORIENTATION_UNDEFINED:
+ case GF_ORIENTATION_NORMAL:
+ default:
+ return GF_MONITOR_TRANSFORM_NORMAL;
+ }
+}
+
static GfLogicalMonitorConfig *
create_preferred_logical_monitor_config (GfMonitorManager *monitor_manager,
GfMonitor *monitor,
@@ -164,6 +195,7 @@ create_preferred_logical_monitor_config (GfMonitorManager *monitor_man
GfMonitorMode *mode;
int width, height;
float scale;
+ GfMonitorTransform transform;
GfMonitorConfig *monitor_config;
GfLogicalMonitorConfig *logical_monitor_config;
@@ -191,6 +223,15 @@ create_preferred_logical_monitor_config (GfMonitorManager *monitor_man
}
monitor_config = gf_monitor_config_new (monitor, mode);
+ transform = get_monitor_transform (monitor_manager, monitor);
+
+ if (gf_monitor_transform_is_rotated (transform))
+ {
+ int temp = width;
+
+ width = height;
+ height = temp;
+ }
logical_monitor_config = g_new0 (GfLogicalMonitorConfig, 1);
*logical_monitor_config = (GfLogicalMonitorConfig) {
@@ -200,6 +241,7 @@ create_preferred_logical_monitor_config (GfMonitorManager *monitor_man
.width = width,
.height = height
},
+ .transform = transform,
.scale = scale,
.monitor_configs = g_list_append (NULL, monitor_config)
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]