mirror of
https://github.com/elementary/gala.git
synced 2024-08-17 02:50:38 +03:00
Fix mutter 3.3x crashes (#635)
* Make gala build against Mutter 3.32 * Add schemas override for Mutter 3.3x * Fix Gala.WorkspaceManager.workspace_removed callback that cause a SIGABRT * Fix Gala.WorkspaceManager.cleanup method which causes SIGABRT by trying to get non-existing workspaces * Fix Gala.WorkspaceManager.cleanup method which deletes all workspace instead of keeping at least the last workspace * Fix Multitasking-View remove_workspace callback which has an incorrect algorithm to remove destroyed workspaces * Add missing manager.workspace_reordered callback for Mutter 3.34
This commit is contained in:
parent
8540e84549
commit
70cfe7e6c8
6
data/20_elementary.pantheon.wm.gschema.override
Normal file
6
data/20_elementary.pantheon.wm.gschema.override
Normal file
@ -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
|
@ -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'))
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
});
|
||||
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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 ();
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user