[mutter] monitor-config-manager: Put logical monitor size scaling into helper
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-config-manager: Put logical monitor size scaling into helper
- Date: Mon, 15 Aug 2022 10:43:35 +0000 (UTC)
commit b2ba653dd9d3d08eb1c8906e31ee512f83177569
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Jun 23 12:41:22 2022 +0200
monitor-config-manager: Put logical monitor size scaling into helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
src/backends/meta-monitor-config-manager.c | 35 +++++++++++++++++++++---------
1 file changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index da3f1dd544..eafc6c6b69 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -716,6 +716,29 @@ get_monitor_transform (MetaMonitorManager *monitor_manager,
return meta_monitor_transform_from_orientation (orientation);
}
+static void
+scale_logical_monitor_width (MetaLogicalMonitorLayoutMode layout_mode,
+ float scale,
+ int mode_width,
+ int mode_height,
+ int *width,
+ int *height)
+{
+ switch (layout_mode)
+ {
+ case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
+ *width = (int) roundf (mode_width / scale);
+ *height = (int) roundf (mode_height / scale);
+ return;
+ case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
+ *width = mode_width;
+ *height = mode_height;
+ return;
+ }
+
+ g_assert_not_reached ();
+}
+
static MetaLogicalMonitorConfig *
create_preferred_logical_monitor_config (MetaMonitorManager *monitor_manager,
MetaMonitor *monitor,
@@ -732,16 +755,8 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma
mode = meta_monitor_get_preferred_mode (monitor);
meta_monitor_mode_get_resolution (mode, &width, &height);
-
- switch (layout_mode)
- {
- case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
- width = (int) roundf (width / scale);
- height = (int) roundf (height / scale);
- break;
- case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
- break;
- }
+ scale_logical_monitor_width (layout_mode, scale,
+ width, height, &width, &height);
monitor_config = create_monitor_config (monitor, mode);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]