Commit 7cb5f217 authored by Marco Trevisan's avatar Marco Trevisan 🎺

monitor-manager: Allow to temporary disable scaling for a monitor

It might be requested by a fullscreen application to disable the scaling for
the monitor where it's painted, and in such case we can generate a temporary
configuration with no scaling on the given monitor and apply it.

When requested, this can be disabled again or transferred to other monitor.
parent 5497e716
......@@ -129,6 +129,7 @@ struct _MetaMonitorManager
GList *gpus;
GList *monitors;
GList *scale_override_monitors;
GList *logical_monitors;
MetaLogicalMonitor *primary_logical_monitor;
......@@ -373,6 +374,9 @@ gboolean meta_monitor_manager_is_scale_supported (MetaMonitorManager
float meta_monitor_manager_get_maximum_scale (MetaMonitorManager *manager);
gboolean meta_monitor_manager_disable_scale_for_monitor (MetaMonitorManager *manager,
MetaLogicalMonitor *monitor);
MetaMonitorManagerCapability
meta_monitor_manager_get_capabilities (MetaMonitorManager *manager);
......
......@@ -476,6 +476,9 @@ meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager
MetaMonitorManagerClass *manager_class =
META_MONITOR_MANAGER_GET_CLASS (manager);
if (g_list_find (manager->scale_override_monitors, monitor))
return 1.0f;
return manager_class->calculate_monitor_mode_scale (manager,
layout_mode,
monitor,
......@@ -591,7 +594,8 @@ static gboolean
should_use_stored_config (MetaMonitorManager *manager)
{
return (manager->in_init ||
!meta_monitor_manager_has_hotplug_mode_update (manager));
(!manager->scale_override_monitors &&
!meta_monitor_manager_has_hotplug_mode_update (manager)));
}
MetaMonitorsConfig *
......@@ -1409,6 +1413,35 @@ request_persistent_confirmation (MetaMonitorManager *manager)
g_signal_emit (manager, signals[CONFIRM_DISPLAY_CHANGE], 0);
}
gboolean
meta_monitor_manager_disable_scale_for_monitor (MetaMonitorManager *manager,
MetaLogicalMonitor *monitor)
{
if (manager->layout_mode != META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL)
return FALSE;
if (monitor && monitor->scale != 1.0f)
{
if (manager->scale_override_monitors)
{
g_clear_pointer (&manager->scale_override_monitors, g_list_free);
g_object_unref (meta_monitor_config_manager_pop_previous (manager->config_manager));
}
manager->scale_override_monitors = g_list_copy (monitor->monitors);
meta_monitor_manager_ensure_configured (manager);
return TRUE;
}
if (manager->scale_override_monitors)
{
g_clear_pointer (&manager->scale_override_monitors, g_list_free);
restore_previous_config (manager);
}
return FALSE;
}
#define META_DISPLAY_CONFIG_MODE_FLAGS_PREFERRED (1 << 0)
#define META_DISPLAY_CONFIG_MODE_FLAGS_CURRENT (1 << 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment