Skip to content

Commit

Permalink
Don't create ALL BackgroundWindows new if monitors change
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Sep 24, 2024
1 parent c555053 commit 0ea8dea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/ShellClients/BackgroundWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ public class Gala.BackgroundWindow : Object {

providing_window = new_window;

providing_window.unmanaging.connect (on_window_unmanaging);

reposition ();
}

public void reposition () {
var monitor_geom = display.get_monitor_geometry (monitor_index);
providing_window.move_frame (false, monitor_geom.x, monitor_geom.y);

providing_window.unmanaging.connect (on_window_unmanaging);
}

private void on_window_unmanaging () {
Expand Down
9 changes: 7 additions & 2 deletions src/ShellClients/ShellClientsManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ public class Gala.ShellClientsManager : Object {
private void update_background_windows () {
var display = wm.get_display ();

background_windows = new BackgroundWindow[display.get_n_monitors ()];
background_windows.resize (display.get_n_monitors ());

for (int i = 0; i < background_windows.length; i++) {
background_windows[i] = new BackgroundWindow (display, i);
if (background_windows[i] == null) {
background_windows[i] = new BackgroundWindow (display, i);
} else {
background_windows[i].reposition ();
}
}
}

Expand Down

0 comments on commit 0ea8dea

Please sign in to comment.