[gnome-control-center/benzea/fix-single-display-405: 12/12] display: Fix Apply button showing for changes to disabled monitor



commit 1b9080426c46520f7d603bb62e0f0b589a7a1ae9
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Mar 7 19:31:14 2019 +0100

    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.

 panels/display/cc-display-config-dbus.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index efb91b346..8c04119c9 100644
--- a/panels/display/cc-display-config-dbus.c
+++ b/panels/display/cc-display-config-dbus.c
@@ -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;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]