From 52afce379963f2caf6551cce827f76c6f75a70a3 Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 8 Nov 2019 18:12:34 +0100 Subject: [PATCH 1/8] Make gala build against Mutter 3.32 --- src/Background/SystemBackground.vala | 10 +++++----- src/WindowManager.vala | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Background/SystemBackground.vala b/src/Background/SystemBackground.vala index 4ca70ab04..18210be2a 100644 --- a/src/Background/SystemBackground.vala +++ b/src/Background/SystemBackground.vala @@ -17,7 +17,7 @@ namespace Gala { -#if HAS_MUTTER334 +#if HAS_MUTTER332 public class SystemBackground : GLib.Object #else public class SystemBackground : Meta.BackgroundActor @@ -26,7 +26,7 @@ namespace Gala const Clutter.Color DEFAULT_BACKGROUND_COLOR = { 0x2e, 0x34, 0x36, 0xff }; static Meta.Background? system_background = null; -#if HAS_MUTTER334 +#if HAS_MUTTER332 public Meta.BackgroundActor background_actor { get; construct; } #endif @@ -35,7 +35,7 @@ namespace Gala #if HAS_MUTTER330 public SystemBackground (Meta.Display display) { -#if HAS_MUTTER334 +#if HAS_MUTTER332 Object (background_actor: new Meta.BackgroundActor (display, 0)); #else Object (meta_display: display, monitor: 0); @@ -57,7 +57,7 @@ namespace Gala } if (system_background == null) { -#if HAS_MUTTER334 +#if HAS_MUTTER332 system_background = new Meta.Background (background_actor.meta_display); #elif HAS_MUTTER330 system_background = new Meta.Background (meta_display); @@ -68,7 +68,7 @@ namespace Gala system_background.set_file (background_file, GDesktop.BackgroundStyle.WALLPAPER); } -#if HAS_MUTTER334 +#if HAS_MUTTER332 background_actor.background = system_background; #else background = system_background; diff --git a/src/WindowManager.vala b/src/WindowManager.vala index 5b1e8f877..ae4098919 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -211,7 +211,7 @@ namespace Gala var system_background = new SystemBackground (screen); #endif -#if HAS_MUTTER334 +#if HAS_MUTTER332 system_background.background_actor.add_constraint (new Clutter.BindConstraint (stage, Clutter.BindCoordinate.ALL, 0)); stage.insert_child_below (system_background.background_actor, null); From cd54f327bfb4226a7ac0d02912b14f5bcd03e24a Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 8 Nov 2019 18:13:43 +0100 Subject: [PATCH 2/8] Add schemas override for Mutter 3.3x --- data/20_elementary.pantheon.wm.gschema.override | 6 ++++++ data/meson.build | 1 + 2 files changed, 7 insertions(+) create mode 100644 data/20_elementary.pantheon.wm.gschema.override diff --git a/data/20_elementary.pantheon.wm.gschema.override b/data/20_elementary.pantheon.wm.gschema.override new file mode 100644 index 000000000..ef292ee16 --- /dev/null +++ b/data/20_elementary.pantheon.wm.gschema.override @@ -0,0 +1,6 @@ +[org.gnome.mutter:Pantheon] +dynamic-workspaces = true +attach-modal-dialogs = false +button-layout = 'close:maximize' +edge-tiling = true +enable-animations = true diff --git a/data/meson.build b/data/meson.build index b99cfc081..c05d093fc 100644 --- a/data/meson.build +++ b/data/meson.build @@ -25,6 +25,7 @@ i18n.merge_file( install_dir: join_paths(data_dir, 'applications') ) install_data(['gala.desktop', 'gala-daemon.desktop', 'gala-wayland.desktop'], install_dir: join_paths(data_dir, 'applications')) +install_data(files('20_elementary.pantheon.wm.gschema.override'), install_dir: join_paths(data_dir, 'glib-2.0', 'schemas')) icons_dir = join_paths(get_option('datadir'), 'icons', 'hicolor') install_data('icons/32x32/multitasking-view.svg', install_dir: join_paths(icons_dir, '32x32', 'apps')) From fb2082e7ed4412073a52e0765dd082cd22512986 Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 8 Nov 2019 18:16:20 +0100 Subject: [PATCH 3/8] Fix Gala.WorkspaceManager.workspace_removed callback that cause a SIGABRT --- src/WorkspaceManager.vala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/WorkspaceManager.vala b/src/WorkspaceManager.vala index dd4a09eb2..24515e625 100644 --- a/src/WorkspaceManager.vala +++ b/src/WorkspaceManager.vala @@ -132,10 +132,16 @@ namespace Gala void workspace_removed (Meta.WorkspaceManager manager, int index) { + unowned List existing_workspaces = null; + for (int i = 0; i < manager.get_n_workspaces (); i++) { + existing_workspaces.append (manager.get_workspace_by_index (i)); + } + var it = workspaces_marked_removed.iterator (); while (it.next ()) { var workspace = it.@get (); - if (workspace.index () < 0) + + if (existing_workspaces.index (workspace) < 0) it.remove (); } } From a2ad78387b10814215034aa6fac54ad4a151d498 Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 8 Nov 2019 18:18:20 +0100 Subject: [PATCH 4/8] Fix Gala.WorkspaceManager.cleanup method which causes SIGABRT by trying to get non-existing workspaces --- src/WorkspaceManager.vala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/WorkspaceManager.vala b/src/WorkspaceManager.vala index 24515e625..86c413374 100644 --- a/src/WorkspaceManager.vala +++ b/src/WorkspaceManager.vala @@ -396,8 +396,12 @@ namespace Gala unowned Meta.Display display = wm.get_display (); unowned Meta.WorkspaceManager manager = display.get_workspace_manager (); var last_index = manager.get_n_workspaces () - 1; + unowned List workspaces = null; for (int i = 0; i < manager.get_n_workspaces (); i++) { - unowned Meta.Workspace workspace = manager.get_workspace_by_index (i); + workspaces.append (manager.get_workspace_by_index (i)); + } + + foreach (var workspace in workspaces) { if (Utils.get_n_windows (workspace) < 1 && workspace.index () != last_index) { remove_workspace (workspace); From b9f9ff6836f0e23f65fd3a9192a53f356649844a Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 8 Nov 2019 18:19:44 +0100 Subject: [PATCH 5/8] Fix Gala.WorkspaceManager.cleanup method which deletes all workspace instead of keeping at least the last workspace --- src/WorkspaceManager.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WorkspaceManager.vala b/src/WorkspaceManager.vala index 86c413374..bc6558dc3 100644 --- a/src/WorkspaceManager.vala +++ b/src/WorkspaceManager.vala @@ -395,13 +395,13 @@ namespace Gala #if HAS_MUTTER330 unowned Meta.Display display = wm.get_display (); unowned Meta.WorkspaceManager manager = display.get_workspace_manager (); - var last_index = manager.get_n_workspaces () - 1; unowned List workspaces = null; for (int i = 0; i < manager.get_n_workspaces (); i++) { workspaces.append (manager.get_workspace_by_index (i)); } foreach (var workspace in workspaces) { + var last_index = manager.get_n_workspaces () - 1; if (Utils.get_n_windows (workspace) < 1 && workspace.index () != last_index) { remove_workspace (workspace); From ffbc52575f7feb8e94d28016a0a4d3dab575e2d4 Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 8 Nov 2019 18:22:22 +0100 Subject: [PATCH 6/8] Fix Multitasking-View remove_workspace callback which has an incorrect algorithm to remove destroyed workspaces --- src/Widgets/MultitaskingView.vala | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Widgets/MultitaskingView.vala b/src/Widgets/MultitaskingView.vala index cede706ad..ef997dfa1 100644 --- a/src/Widgets/MultitaskingView.vala +++ b/src/Widgets/MultitaskingView.vala @@ -389,29 +389,20 @@ namespace Gala // FIXME is there a better way to get the removed workspace? #if HAS_MUTTER330 unowned Meta.WorkspaceManager manager = display.get_workspace_manager (); + unowned List existing_workspaces = null; + for (int i = 0; i < manager.get_n_workspaces (); i++) { + existing_workspaces.append (manager.get_workspace_by_index (i)); + } #else unowned List existing_workspaces = screen.get_workspaces (); #endif foreach (var child in workspaces.get_children ()) { unowned WorkspaceClone clone = (WorkspaceClone) child; -#if HAS_MUTTER330 - for (int i = 0; i < manager.get_n_workspaces (); i++) { - if (manager.get_workspace_by_index (i) == clone.workspace) { - workspace = clone; - break; - } - } - - if (workspace != null) { - break; - } -#else if (existing_workspaces.index (clone.workspace) < 0) { workspace = clone; break; } -#endif } if (workspace == null) From a86d20f27c0e499a357b15a5b3f718c09515378c Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 8 Nov 2019 18:24:13 +0100 Subject: [PATCH 7/8] Add missing manager.workspace_reordered callback for Mutter 3.34 --- src/Widgets/MultitaskingView.vala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Widgets/MultitaskingView.vala b/src/Widgets/MultitaskingView.vala index ef997dfa1..cdeb779de 100644 --- a/src/Widgets/MultitaskingView.vala +++ b/src/Widgets/MultitaskingView.vala @@ -92,6 +92,9 @@ namespace Gala manager.workspace_added.connect (add_workspace); manager.workspace_removed.connect (remove_workspace); +#if HAS_MUTTER334 + manager.workspaces_reordered.connect (() => update_positions (false)); +#endif manager.workspace_switched.connect_after ((from, to, direction) => { update_positions (opened); }); From 8ac3690ccdd587fb245cd2c9ab540f79229b6e87 Mon Sep 17 00:00:00 2001 From: Julian Date: Wed, 13 Nov 2019 21:25:55 +0100 Subject: [PATCH 8/8] Fix memory management --- src/Widgets/MultitaskingView.vala | 2 +- src/WorkspaceManager.vala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Widgets/MultitaskingView.vala b/src/Widgets/MultitaskingView.vala index cdeb779de..4217b91f4 100644 --- a/src/Widgets/MultitaskingView.vala +++ b/src/Widgets/MultitaskingView.vala @@ -392,7 +392,7 @@ namespace Gala // FIXME is there a better way to get the removed workspace? #if HAS_MUTTER330 unowned Meta.WorkspaceManager manager = display.get_workspace_manager (); - unowned List existing_workspaces = null; + List existing_workspaces = null; for (int i = 0; i < manager.get_n_workspaces (); i++) { existing_workspaces.append (manager.get_workspace_by_index (i)); } diff --git a/src/WorkspaceManager.vala b/src/WorkspaceManager.vala index bc6558dc3..52deb6c52 100644 --- a/src/WorkspaceManager.vala +++ b/src/WorkspaceManager.vala @@ -132,7 +132,7 @@ namespace Gala void workspace_removed (Meta.WorkspaceManager manager, int index) { - unowned List existing_workspaces = null; + List existing_workspaces = null; for (int i = 0; i < manager.get_n_workspaces (); i++) { existing_workspaces.append (manager.get_workspace_by_index (i)); } @@ -395,7 +395,7 @@ namespace Gala #if HAS_MUTTER330 unowned Meta.Display display = wm.get_display (); unowned Meta.WorkspaceManager manager = display.get_workspace_manager (); - unowned List workspaces = null; + List workspaces = null; for (int i = 0; i < manager.get_n_workspaces (); i++) { workspaces.append (manager.get_workspace_by_index (i)); }