Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mutter 3.3x crashes #635

Merged
merged 8 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/20_elementary.pantheon.wm.gschema.override
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
10 changes: 5 additions & 5 deletions src/Background/SystemBackground.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace Gala
{
#if HAS_MUTTER334
#if HAS_MUTTER332
public class SystemBackground : GLib.Object
#else
public class SystemBackground : Meta.BackgroundActor
Expand All @@ -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

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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;
Expand Down
20 changes: 7 additions & 13 deletions src/Widgets/MultitaskingView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -389,29 +392,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 ();
List<Workspace> 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<Meta.Workspace> 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)
Expand Down
2 changes: 1 addition & 1 deletion src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 13 additions & 3 deletions src/WorkspaceManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,16 @@ namespace Gala

void workspace_removed (Meta.WorkspaceManager manager, int index)
{
List<Workspace> 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 ();
}
}
Expand Down Expand Up @@ -389,9 +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;
List<Meta.Workspace> 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) {
var last_index = manager.get_n_workspaces () - 1;
if (Utils.get_n_windows (workspace) < 1
&& workspace.index () != last_index) {
remove_workspace (workspace);
Expand Down