mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
monitor-manager: Find active monitor when deriving global scale
When deriving the global scale directly from the current hardware state (as done when using the X11 backend) we are inspecting the logical state they had prior to the most recent hot plug. That means that a primary monitor might have been disabled, and a new primary monitor may not have been assigned yet. Stop assuming a primary monitor has an active mode before having reconstructed the logical state by finding some active monitor if the old primary monitor was disabled. This avoids a crash when trying to derive the global scale from a disabled monitor. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/130
This commit is contained in:
parent
423c5f8e77
commit
0b3a1c9c31
@ -89,6 +89,9 @@ static gboolean
|
|||||||
meta_monitor_manager_is_config_complete (MetaMonitorManager *manager,
|
meta_monitor_manager_is_config_complete (MetaMonitorManager *manager,
|
||||||
MetaMonitorsConfig *config);
|
MetaMonitorsConfig *config);
|
||||||
|
|
||||||
|
static MetaMonitor *
|
||||||
|
meta_monitor_manager_get_active_monitor (MetaMonitorManager *manager);
|
||||||
|
|
||||||
MetaBackend *
|
MetaBackend *
|
||||||
meta_monitor_manager_get_backend (MetaMonitorManager *manager)
|
meta_monitor_manager_get_backend (MetaMonitorManager *manager)
|
||||||
{
|
{
|
||||||
@ -198,13 +201,17 @@ calculate_monitor_scale (MetaMonitorManager *manager,
|
|||||||
static float
|
static float
|
||||||
derive_calculated_global_scale (MetaMonitorManager *manager)
|
derive_calculated_global_scale (MetaMonitorManager *manager)
|
||||||
{
|
{
|
||||||
MetaMonitor *primary_monitor;
|
MetaMonitor *monitor = NULL;
|
||||||
|
|
||||||
primary_monitor = meta_monitor_manager_get_primary_monitor (manager);
|
monitor = meta_monitor_manager_get_primary_monitor (manager);
|
||||||
if (!primary_monitor)
|
|
||||||
|
if (!monitor || !meta_monitor_is_active (monitor))
|
||||||
|
monitor = meta_monitor_manager_get_active_monitor (manager);
|
||||||
|
|
||||||
|
if (!monitor)
|
||||||
return 1.0;
|
return 1.0;
|
||||||
|
|
||||||
return calculate_monitor_scale (manager, primary_monitor);
|
return calculate_monitor_scale (manager, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float
|
static float
|
||||||
@ -2378,6 +2385,12 @@ meta_monitor_manager_get_laptop_panel (MetaMonitorManager *manager)
|
|||||||
return find_monitor (manager, meta_monitor_is_laptop_panel);
|
return find_monitor (manager, meta_monitor_is_laptop_panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MetaMonitor *
|
||||||
|
meta_monitor_manager_get_active_monitor (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
return find_monitor (manager, meta_monitor_is_active);
|
||||||
|
}
|
||||||
|
|
||||||
MetaMonitor *
|
MetaMonitor *
|
||||||
meta_monitor_manager_get_monitor_from_connector (MetaMonitorManager *manager,
|
meta_monitor_manager_get_monitor_from_connector (MetaMonitorManager *manager,
|
||||||
const char *connector)
|
const char *connector)
|
||||||
|
Loading…
Reference in New Issue
Block a user