Skip to content

Commit

Permalink
Fix some apply unsensitive issues
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed May 25, 2024
1 parent 5c2fa07 commit d93a6d9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Widgets/DisplaysOverlay.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
}
Expand Down

0 comments on commit d93a6d9

Please sign in to comment.