From 66b90c239040a6556afa5039b1557c8775aa2cb2 Mon Sep 17 00:00:00 2001 From: Leonhard <106322251+leolost2605@users.noreply.github.com> Date: Mon, 27 May 2024 18:10:55 +0200 Subject: [PATCH] Fix some apply unsensitive issues (#385) --- src/Widgets/DisplaysOverlay.vala | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Widgets/DisplaysOverlay.vala b/src/Widgets/DisplaysOverlay.vala index 8441fb11..e1d682ea 100644 --- a/src/Widgets/DisplaysOverlay.vala +++ b/src/Widgets/DisplaysOverlay.vala @@ -242,6 +242,18 @@ public class Display.DisplaysOverlay : Gtk.Box { private void check_configuration_change () { // check if valid (connected) + int active_display_count = 0; + foreach (unowned var dw in display_widgets) { + if (dw.virtual_monitor.is_active) { + active_display_count++; + } + } + + if (active_display_count == 1) { // always valid if only one display + configuration_changed (true); + return; + } + var result = true; foreach (unowned var dw in display_widgets) { dw.connected = false; @@ -250,10 +262,8 @@ public class Display.DisplaysOverlay : Gtk.Box { foreach (unowned var dw1 in display_widgets) { foreach (unowned var dw2 in display_widgets) { if (dw2 == dw1) { - warning ("Skip %s", dw2.display_name); continue; } else if (dw1.connected) { - warning ("%s already connected", dw1.display_name); break; } @@ -265,7 +275,7 @@ public class Display.DisplaysOverlay : Gtk.Box { } foreach (unowned var dw in display_widgets) { - if (!dw.connected) { + if (!dw.connected && dw.virtual_monitor.is_active) { result = false; break; }