Daniel Drake
b7bc8e56b7
monitor-manager: use MonitorsConfig to track switch_config
When constructing MetaMonitorsConfig objects, store which type of switch_config they are for (or UNKNOWN if it is not such type of config). Stop unconditionally setting current_switch_config to UNKNOWN when handling monitors changed events. Instead, set it to the switch_config type stored in the MonitorsConfig in the codepath that updates logical state. In addition to being called in the hotplug case along the same code flow that generates monitors changed events, this is also called in the coldplug case where a secondary monitor was connected before mutter was started. When creating the default linear display config, create it as a switch_config so that internal state gets updated to represent linear mode when this config is used. The previous behaviour of unconditionally resetting current_switch_config to UNKNOWN was breaking the internal state machine for display config switching, causing misbehaviour in gnome-shell's switchMonitor UI when using display switch hotkeys. The lack of internal tracking when the displays are already in the default "Join Displays" linear mode was then causing the first display switch hotkey press to do nothing (it would attempt to select "Join Displays" mode, but that was already active). Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/281 https://gitlab.gnome.org/GNOME/mutter/merge_requests/213 (cherry picked from commit 6267732bec97773883ad76f99af76057a7957283)
Description
Languages
C
98.9%
Meson
0.7%
Python
0.3%