[gnome-flashback] monitor-manager: pass the Logical mode when computing the monitor scale
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] monitor-manager: pass the Logical mode when computing the monitor scale
- Date: Sat, 23 Oct 2021 18:48:44 +0000 (UTC)
commit af1a1e5b9e5d9e34f930de55f4b38b8308ef490e
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Sep 12 22:29:48 2021 +0300
monitor-manager: pass the Logical mode when computing the monitor scale
Based on mutter commit:
https://gitlab.gnome.org/GNOME/mutter/-/commit/67eb60c19a93
backends/gf-monitor-config-manager.c | 9 +++++++--
backends/gf-monitor-config-migration.c | 10 ++++++++--
backends/gf-monitor-manager-kms.c | 7 ++++---
backends/gf-monitor-manager-private.h | 2 ++
backends/gf-monitor-manager-xrandr.c | 13 +++++++++----
backends/gf-monitor-manager.c | 17 ++++++++++++-----
backends/gf-monitor-private.h | 3 ++-
backends/gf-monitor.c | 12 +++++++-----
8 files changed, 51 insertions(+), 22 deletions(-)
---
diff --git a/backends/gf-monitor-config-manager.c b/backends/gf-monitor-config-manager.c
index 89c0d79..951473e 100644
--- a/backends/gf-monitor-config-manager.c
+++ b/backends/gf-monitor-config-manager.c
@@ -219,6 +219,7 @@ create_preferred_logical_monitor_config (GfMonitorManager *monitor_man
scale = primary_logical_monitor_config->scale;
else
scale = gf_monitor_manager_calculate_monitor_mode_scale (monitor_manager,
+ layout_mode,
monitor, mode);
switch (layout_mode)
@@ -276,6 +277,7 @@ create_for_switch_config_all_mirror (GfMonitorConfigManager *config_manager)
GList *l;
GfMonitorsConfig *monitors_config;
+ layout_mode = gf_monitor_manager_get_default_layout_mode (monitor_manager);
monitors = gf_monitor_manager_get_monitors (monitor_manager);
monitor = monitors->data;
modes = gf_monitor_get_modes (monitor);
@@ -347,7 +349,11 @@ create_for_switch_config_all_mirror (GfMonitorConfigManager *config_manager)
if (!mode)
continue;
- scale = gf_monitor_manager_calculate_monitor_mode_scale (monitor_manager, l_monitor, mode);
+ scale = gf_monitor_manager_calculate_monitor_mode_scale (monitor_manager,
+ layout_mode,
+ l_monitor,
+ mode);
+
best_scale = MAX (best_scale, scale);
monitor_configs = g_list_prepend (monitor_configs, gf_monitor_config_new (l_monitor, mode));
}
@@ -365,7 +371,6 @@ create_for_switch_config_all_mirror (GfMonitorConfigManager *config_manager)
};
logical_monitor_configs = g_list_append (NULL, logical_monitor_config);
- layout_mode = gf_monitor_manager_get_default_layout_mode (monitor_manager);
monitors_config = gf_monitors_config_new (monitor_manager,
logical_monitor_configs,
diff --git a/backends/gf-monitor-config-migration.c b/backends/gf-monitor-config-migration.c
index b9718fa..f90425e 100644
--- a/backends/gf-monitor-config-migration.c
+++ b/backends/gf-monitor-config-migration.c
@@ -1239,11 +1239,14 @@ gf_finish_monitors_config_migration (GfMonitorManager *monitor_manager,
{
GfMonitorConfigManager *config_manager;
GfMonitorConfigStore *config_store;
+ GfLogicalMonitorLayoutMode layout_mode;
GList *l;
config_manager = monitor_manager->config_manager;
config_store = gf_monitor_config_manager_get_store (config_manager);
+ layout_mode = gf_monitor_manager_get_default_layout_mode (monitor_manager);
+
for (l = config->logical_monitor_configs; l; l = l->next)
{
GfLogicalMonitorConfig *logical_monitor_config;
@@ -1268,12 +1271,15 @@ gf_finish_monitors_config_migration (GfMonitorManager *monitor_manager,
return FALSE;
}
- scale = gf_monitor_calculate_mode_scale (monitor, monitor_mode);
+ scale = gf_monitor_manager_calculate_monitor_mode_scale (monitor_manager,
+ layout_mode,
+ monitor,
+ monitor_mode);
logical_monitor_config->scale = scale;
}
- config->layout_mode = gf_monitor_manager_get_default_layout_mode (monitor_manager);
+ config->layout_mode = layout_mode;
config->flags &= ~GF_MONITORS_CONFIG_FLAG_MIGRATED;
if (!gf_verify_monitors_config (config, monitor_manager, error))
diff --git a/backends/gf-monitor-manager-kms.c b/backends/gf-monitor-manager-kms.c
index add74ec..ca41adb 100644
--- a/backends/gf-monitor-manager-kms.c
+++ b/backends/gf-monitor-manager-kms.c
@@ -110,9 +110,10 @@ gf_monitor_manager_kms_is_transform_handled (GfMonitorManager *manager,
}
static gfloat
-gf_monitor_manager_kms_calculate_monitor_mode_scale (GfMonitorManager *manager,
- GfMonitor *monitor,
- GfMonitorMode *monitor_mode)
+gf_monitor_manager_kms_calculate_monitor_mode_scale (GfMonitorManager *manager,
+ GfLogicalMonitorLayoutMode layout_mode,
+ GfMonitor *monitor,
+ GfMonitorMode *monitor_mode)
{
return 1.0;
}
diff --git a/backends/gf-monitor-manager-private.h b/backends/gf-monitor-manager-private.h
index f5d4f5a..e36f5b6 100644
--- a/backends/gf-monitor-manager-private.h
+++ b/backends/gf-monitor-manager-private.h
@@ -121,6 +121,7 @@ typedef struct
GfMonitorTransform transform);
gfloat (* calculate_monitor_mode_scale) (GfMonitorManager *manager,
+ GfLogicalMonitorLayoutMode layout_mode,
GfMonitor *monitor,
GfMonitorMode *monitor_mode);
@@ -187,6 +188,7 @@ void gf_monitor_manager_update_logical_state_derived (GfM
GfMonitorsConfig
*config);
gfloat gf_monitor_manager_calculate_monitor_mode_scale (GfMonitorManager
*manager,
+ GfLogicalMonitorLayoutMode
layout_mode,
GfMonitor
*monitor,
GfMonitorMode
*monitor_mode);
diff --git a/backends/gf-monitor-manager-xrandr.c b/backends/gf-monitor-manager-xrandr.c
index 1f7fee1..f4abc5b 100644
--- a/backends/gf-monitor-manager-xrandr.c
+++ b/backends/gf-monitor-manager-xrandr.c
@@ -1048,11 +1048,16 @@ gf_monitor_manager_xrandr_is_transform_handled (GfMonitorManager *manager,
}
static gfloat
-gf_monitor_manager_xrandr_calculate_monitor_mode_scale (GfMonitorManager *manager,
- GfMonitor *monitor,
- GfMonitorMode *monitor_mode)
+gf_monitor_manager_xrandr_calculate_monitor_mode_scale (GfMonitorManager *manager,
+ GfLogicalMonitorLayoutMode layout_mode,
+ GfMonitor *monitor,
+ GfMonitorMode *monitor_mode)
{
- return gf_monitor_calculate_mode_scale (monitor, monitor_mode);
+ GfMonitorScalesConstraint constraints;
+
+ constraints = GF_MONITOR_SCALES_CONSTRAINT_NO_FRAC;
+
+ return gf_monitor_calculate_mode_scale (monitor, monitor_mode, constraints);
}
static gfloat *
diff --git a/backends/gf-monitor-manager.c b/backends/gf-monitor-manager.c
index 06024fa..e209603 100644
--- a/backends/gf-monitor-manager.c
+++ b/backends/gf-monitor-manager.c
@@ -326,7 +326,9 @@ calculate_monitor_scale (GfMonitorManager *manager,
GfMonitorMode *monitor_mode;
monitor_mode = gf_monitor_get_current_mode (monitor);
- return gf_monitor_manager_calculate_monitor_mode_scale (manager, monitor,
+ return gf_monitor_manager_calculate_monitor_mode_scale (manager,
+ manager->layout_mode,
+ monitor,
monitor_mode);
}
@@ -1642,6 +1644,7 @@ gf_monitor_manager_handle_get_current_state (GfDBusDisplayConfig *skeleton,
preferred_scale =
gf_monitor_manager_calculate_monitor_mode_scale (manager,
+ manager->layout_mode,
monitor,
monitor_mode);
@@ -2609,15 +2612,19 @@ gf_monitor_manager_update_logical_state_derived (GfMonitorManager *manager,
}
gfloat
-gf_monitor_manager_calculate_monitor_mode_scale (GfMonitorManager *manager,
- GfMonitor *monitor,
- GfMonitorMode *monitor_mode)
+gf_monitor_manager_calculate_monitor_mode_scale (GfMonitorManager *manager,
+ GfLogicalMonitorLayoutMode layout_mode,
+ GfMonitor *monitor,
+ GfMonitorMode *monitor_mode)
{
GfMonitorManagerClass *manager_class;
manager_class = GF_MONITOR_MANAGER_GET_CLASS (manager);
- return manager_class->calculate_monitor_mode_scale (manager, monitor, monitor_mode);
+ return manager_class->calculate_monitor_mode_scale (manager,
+ layout_mode,
+ monitor,
+ monitor_mode);
}
gfloat *
diff --git a/backends/gf-monitor-private.h b/backends/gf-monitor-private.h
index 70b357d..39c6cc6 100644
--- a/backends/gf-monitor-private.h
+++ b/backends/gf-monitor-private.h
@@ -204,7 +204,8 @@ void gf_monitor_calculate_crtc_pos (GfMonitor
gint *out_y);
gfloat gf_monitor_calculate_mode_scale (GfMonitor *monitor,
- GfMonitorMode *monitor_mode);
+ GfMonitorMode *monitor_mode,
+ GfMonitorScalesConstraint constraints);
gfloat *gf_monitor_calculate_supported_scales (GfMonitor *monitor,
GfMonitorMode *monitor_mode,
diff --git a/backends/gf-monitor.c b/backends/gf-monitor.c
index fc11f6b..f84e321 100644
--- a/backends/gf-monitor.c
+++ b/backends/gf-monitor.c
@@ -226,8 +226,9 @@ gf_monitor_mode_spec_equals (GfMonitorModeSpec *spec,
}
static float
-calculate_scale (GfMonitor *monitor,
- GfMonitorMode *monitor_mode)
+calculate_scale (GfMonitor *monitor,
+ GfMonitorMode *monitor_mode,
+ GfMonitorScalesConstraint constraints)
{
gint resolution_width, resolution_height;
gint width_mm, height_mm;
@@ -1052,8 +1053,9 @@ gf_monitor_calculate_crtc_pos (GfMonitor *monitor,
}
gfloat
-gf_monitor_calculate_mode_scale (GfMonitor *monitor,
- GfMonitorMode *monitor_mode)
+gf_monitor_calculate_mode_scale (GfMonitor *monitor,
+ GfMonitorMode *monitor_mode,
+ GfMonitorScalesConstraint constraints)
{
GfMonitorPrivate *priv;
GfMonitorManager *monitor_manager;
@@ -1070,7 +1072,7 @@ gf_monitor_calculate_mode_scale (GfMonitor *monitor,
if (gf_settings_get_global_scaling_factor (settings, &global_scaling_factor))
return global_scaling_factor;
- return calculate_scale (monitor, monitor_mode);
+ return calculate_scale (monitor, monitor_mode, constraints);
}
gfloat *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]