[gnome-shell/wip/exalm/gestures2: 38/39] workspaceAnimation: Group sticky windows and moving window
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/exalm/gestures2: 38/39] workspaceAnimation: Group sticky windows and moving window
- Date: Fri, 3 Jul 2020 15:17:40 +0000 (UTC)
commit 7b3ebc1d04b809aa901fbe9b5e151aede0e5e9e5
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sat Jun 20 23:44:24 2020 +0500
workspaceAnimation: Group sticky windows and moving window
Since the transitions consists of window clones now, all the clones appear
above sticky windows. Clone sticky windows as well, and treat them same as
moving window instead.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326
js/ui/workspaceAnimation.js | 102 +++++++++++++++++++++++++++++++-------------
1 file changed, 73 insertions(+), 29 deletions(-)
---
diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js
index 4d5b2f55bb..c5d800462a 100644
--- a/js/ui/workspaceAnimation.js
+++ b/js/ui/workspaceAnimation.js
@@ -89,6 +89,75 @@ class WorkspaceGroup extends Clutter.Actor {
}
});
+const StickyGroup = GObject.registerClass(
+class StickyGroup extends Clutter.Actor {
+ _init(controller) {
+ super._init();
+
+ this._controller = controller;
+ this._windows = [];
+
+ this._refreshWindows();
+
+ this.connect('destroy', this._onDestroy.bind(this));
+ this._restackedId = global.display.connect('restacked',
+ this._refreshWindows.bind(this));
+ }
+
+ _shouldShowWindow(window) {
+ if (!window.showing_on_its_workspace())
+ return false;
+
+ return window.is_on_all_workspaces() || window === this._controller.movingWindow;
+ }
+
+ _refreshWindows() {
+ if (this._windows.length > 0)
+ this._removeWindows();
+
+ let windows = global.get_window_actors();
+ windows = windows.filter(w => this._shouldShowWindow(w.meta_window));
+
+ for (let window of windows) {
+ let clone = new Clutter.Clone({
+ source: window,
+ x: window.x,
+ y: window.y,
+ });
+
+ this.add_actor(clone);
+ window.hide();
+
+ let record = { window, clone };
+
+ record.windowDestroyId = window.connect('destroy', () => {
+ clone.destroy();
+ this._windows.splice(this._windows.indexOf(record), 1);
+ });
+
+ this._windows.push(record);
+ }
+ }
+
+ _removeWindows() {
+ for (let i = 0; i < this._windows.length; i++) {
+ let w = this._windows[i];
+
+ w.window.disconnect(w.windowDestroyId);
+ w.clone.destroy();
+
+ w.window.show();
+ }
+
+ this._windows = [];
+ }
+
+ _onDestroy() {
+ global.display.disconnect(this._restackedId);
+ this._removeWindows();
+ }
+});
+
var WorkspaceAnimationController = class {
constructor() {
this._movingWindow = null;
@@ -126,15 +195,14 @@ var WorkspaceAnimationController = class {
let switchData = {};
this._switchData = switchData;
- switchData.movingWindowBin = new Clutter.Actor();
- switchData.movingWindow = null;
+ switchData.stickyGroup = new StickyGroup(this);
switchData.workspaces = [];
switchData.gestureActivated = false;
switchData.inProgress = false;
switchData.container = new Clutter.Actor();
- wgroup.add_actor(switchData.movingWindowBin);
+ wgroup.add_actor(switchData.stickyGroup);
wgroup.add_actor(switchData.container);
let x = 0;
@@ -191,38 +259,14 @@ var WorkspaceAnimationController = class {
else
switchData.container.x = -switchData.workspaces[activeWorkspaceIndex].x;
- wgroup.set_child_above_sibling(switchData.movingWindowBin, null);
-
- if (this.movingWindow) {
- let actor = this.movingWindow.get_compositor_private();
-
- switchData.movingWindow = {
- window: actor,
- parent: actor.get_parent(),
- };
-
- switchData.movingWindow.parent.remove_child(actor);
- switchData.movingWindowBin.add_child(actor);
- switchData.movingWindow.windowDestroyId = actor.connect('destroy', () => {
- switchData.movingWindow = null;
- });
- }
+ wgroup.set_child_above_sibling(switchData.stickyGroup, null);
}
_finishWorkspaceSwitch(switchData) {
this._switchData = null;
- if (switchData.movingWindow) {
- let record = switchData.movingWindow;
- record.window.disconnect(record.windowDestroyId);
- record.window.get_parent().remove_child(record.window);
- record.parent.add_child(record.window);
-
- switchData.movingWindow = null;
- }
-
switchData.container.destroy();
- switchData.movingWindowBin.destroy();
+ switchData.stickyGroup.destroy();
this.movingWindow = null;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]