display: Fix Apply button showing for changes to disabled monitor

Disabled monitors may or may not have a mode selected. This means, we
need to skip the mode comparison if the two compared monitors are
disabled (i.e. have no logical monitor).
Move the mode check to the end and skip it if both monitors are disabled.

This fixes cases where identical configurations are misdetected, because
we applied a mode to a monitor and disabled the monitor again. This
happens for example when switching the active monitor in "single" mode.
This commit is contained in:
Benjamin Berg 2019-03-07 19:31:14 +01:00 committed by Georges Basile Stavracas Neto
parent 1f29dad46f
commit 37c768ab0f

View file

@ -1066,11 +1066,15 @@ cc_display_config_dbus_equal (CcDisplayConfig *pself,
if (m1->underscanning != m2->underscanning)
return FALSE;
if (!cc_display_mode_dbus_equal (CC_DISPLAY_MODE_DBUS (m1->current_mode),
CC_DISPLAY_MODE_DBUS (m2->current_mode)))
if (!cc_display_logical_monitor_equal (m1->logical_monitor, m2->logical_monitor))
return FALSE;
if (!cc_display_logical_monitor_equal (m1->logical_monitor, m2->logical_monitor))
/* Modes should not be compared if both monitors have no logical monitor. */
if (m1->logical_monitor == NULL && m2->logical_monitor == NULL)
continue;
if (!cc_display_mode_dbus_equal (CC_DISPLAY_MODE_DBUS (m1->current_mode),
CC_DISPLAY_MODE_DBUS (m2->current_mode)))
return FALSE;
}