Skip to content

Commit

Permalink
WorkspaceManager: Make cleanup private
Browse files Browse the repository at this point in the history
Also make sure to only call it if there is no freeze ongoing.
  • Loading branch information
tintou authored and danirabbit committed May 5, 2024
1 parent d61501b commit 196d249
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/InternalUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ namespace Gala {
}

workspace_manager.thaw_remove ();
workspace_manager.cleanup ();
}

// Code ported from KWin present windows effect
Expand Down
8 changes: 5 additions & 3 deletions src/WorkspaceManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,16 @@ namespace Gala {
* Temporarily disables removing workspaces when they are empty
*/
public void freeze_remove () {
remove_freeze_count++;
GLib.AtomicInt.inc (ref remove_freeze_count);
}

/**
* Undo the effect of freeze_remove()
*/
public void thaw_remove () {
remove_freeze_count--;
if (GLib.AtomicInt.dec_and_test (ref remove_freeze_count)) {
cleanup ();
}

assert (remove_freeze_count >= 0);
}
Expand All @@ -256,7 +258,7 @@ namespace Gala {
* be removed. Particularly useful in conjunction with freeze/thaw_remove to
* cleanup after an operation that required stable workspace/window indices
*/
public void cleanup () {
private void cleanup () {
if (!Meta.Prefs.get_dynamic_workspaces ()) {
return;
}
Expand Down

0 comments on commit 196d249

Please sign in to comment.