Reload workspace clones when monitors change (#1788)

Co-authored-by: Danielle Foré <danielle@elementary.io>
This commit is contained in:
Leo 2023-11-08 04:46:38 +09:00 committed by GitHub
parent 3fbdea91ae
commit ad90feec44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

View File

@ -40,6 +40,9 @@
<issue url="https://github.com/elementary/gala/issues/695">Wrong workspaces behavior</issue>
<issue url="https://github.com/elementary/gala/issues/1109">Use gestures for "move to workspace"</issue>
<issue url="https://github.com/elementary/gala/issues/1261">Alt + Shift unnecessarily blocked when there is only one keyboard layout</issue>
<issue url="https://github.com/elementary/gala/issues/1518">Multitasking view breaks when switching displays &amp; strange Wingpanel position</issue>
<issue url="https://github.com/elementary/gala/issues/1750">Disconnecting external monitor breaks the multi-tasking view</issue>
<issue url="https://github.com/elementary/gala/issues/1753">Workspace wallpaper's aspect ratio with different monitors</issue>
<issue url="https://github.com/elementary/gala/discussions/1764">Counter Strike 2 causes segfault in libmutter on exit</issue>
<issue url="https://github.com/elementary/gala/issues/1774">Scheduled switch to dark style does not dim the wallpaper after cold reboot on elementary OS 7.1</issue>
<issue url="https://github.com/elementary/gala/issues/1783">Notifications appear in the middle of the screen</issue>

View File

@ -82,11 +82,7 @@ namespace Gala {
add_child (primary_monitor_container);
add_child (dock_clones);
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
for (int i = 0; i < manager.get_n_workspaces (); i++) {
add_workspace (i);
}
unowned var manager = display.get_workspace_manager ();
manager.workspace_added.connect (add_workspace);
manager.workspace_removed.connect (remove_workspace);
manager.workspaces_reordered.connect (() => update_positions (false));
@ -141,6 +137,8 @@ namespace Gala {
* MonitorClones at the right positions
*/
private void update_monitors () {
update_workspaces ();
foreach (var monitor_clone in window_containers_monitors) {
monitor_clone.destroy ();
}
@ -176,6 +174,19 @@ namespace Gala {
}
}
private void update_workspaces () {
foreach (unowned var child in workspaces.get_children ()) {
unowned var workspace_clone = (WorkspaceClone) child;
icon_groups.remove_group (workspace_clone.icon_group);
workspace_clone.destroy ();
}
unowned var manager = display.get_workspace_manager ();
for (int i = 0; i < manager.get_n_workspaces (); i++) {
add_workspace (i);
}
}
/**
* Scroll through workspaces with the mouse wheel. Smooth scrolling is handled by
* GestureTracker.

View File

@ -245,6 +245,8 @@ namespace Gala {
listener.window_no_longer_on_all_workspaces.disconnect (add_window);
background.destroy ();
window_container.destroy ();
icon_group.destroy ();
}
private void reallocate () {