mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
monitor-manager: Check if all monitor scales are matching in global mode
When global scaling is set we need to ensure that all the requested scale configurations are matching, otherwise we'd end up in a mixed setup that we don't support in this scenario. Fixes https://gitlab.gnome.org/GNOME/mutter/issues/407 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/336>
This commit is contained in:
parent
1ac63fcd77
commit
7c87c1c24f
@ -125,6 +125,10 @@ meta_monitor_manager_get_active_monitor (MetaMonitorManager *manager);
|
||||
static void
|
||||
meta_monitor_manager_real_read_current_state (MetaMonitorManager *manager);
|
||||
|
||||
static gboolean
|
||||
is_global_scale_matching_in_config (MetaMonitorsConfig *config,
|
||||
float scale);
|
||||
|
||||
MetaBackend *
|
||||
meta_monitor_manager_get_backend (MetaMonitorManager *manager)
|
||||
{
|
||||
@ -1761,6 +1765,43 @@ meta_monitor_manager_is_scale_supported (MetaMonitorManager *manager,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_global_scale_matching_in_config (MetaMonitorsConfig *config,
|
||||
float scale)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = config->logical_monitor_configs; l; l = l->next)
|
||||
{
|
||||
MetaLogicalMonitorConfig *logical_monitor_config = l->data;
|
||||
|
||||
if (!G_APPROX_VALUE (logical_monitor_config->scale, scale, FLT_EPSILON))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_monitor_manager_is_scale_supported_for_config (MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
float scale)
|
||||
{
|
||||
if (meta_monitor_manager_is_scale_supported (manager, config->layout_mode,
|
||||
monitor, monitor_mode, scale))
|
||||
{
|
||||
if (meta_monitor_manager_get_capabilities (manager) &
|
||||
META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED)
|
||||
return is_global_scale_matching_in_config (config, scale);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_monitor_manager_is_config_applicable (MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config,
|
||||
@ -1799,11 +1840,11 @@ meta_monitor_manager_is_config_applicable (MetaMonitorManager *manager,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!meta_monitor_manager_is_scale_supported (manager,
|
||||
config->layout_mode,
|
||||
monitor,
|
||||
monitor_mode,
|
||||
scale))
|
||||
if (!meta_monitor_manager_is_scale_supported_for_config (manager,
|
||||
config,
|
||||
monitor,
|
||||
monitor_mode,
|
||||
scale))
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Scale not supported by backend");
|
||||
|
Loading…
Reference in New Issue
Block a user