diff --git a/@imports/ui/workspaceAnimation.d.ts b/@imports/ui/workspaceAnimation.d.ts index ca03dda..346a1c9 100644 --- a/@imports/ui/workspaceAnimation.d.ts +++ b/@imports/ui/workspaceAnimation.d.ts @@ -19,4 +19,6 @@ export class WorkspaceGroup extends Actor { }> _createWindows(): void; _removeWindows(): void; + _syncStacking(): void; + _shouldShowWindow(win: Window): boolean; } diff --git a/src/extension.ts b/src/extension.ts index cb992b4..27cc30e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -37,6 +37,7 @@ export class Extension { // The methods of gnome-shell to monkey patch private _orig_add_window !: (_: Window) => void private _orig_create_windows !: () => void + private _orig_sync_stacking !: () => void private _orig_size_changed !: (wm: WM, actor: WindowActor) => void private _add_background_menu !: typeof BackgroundMenu.addBackgroundMenu @@ -55,6 +56,7 @@ export class Extension { // extensions is disabled this._orig_add_window = WindowPreview.prototype._addWindow this._orig_create_windows = WorkspaceGroup.prototype._createWindows + this._orig_sync_stacking = WorkspaceGroup.prototype._syncStacking this._orig_size_changed = WindowManager.prototype._sizeChangeWindowDone this._add_background_menu = BackgroundMenu.addBackgroundMenu @@ -234,12 +236,29 @@ export class Extension { clone.translation_z + 0.006) ) + // Add reference shadow clone for clone actor, so that we + // can restack position of shadow when we need + ;(clone as WsAnimationActor)._shadow_clone = shadow_clone + clone.bind_property ('visible', shadow_clone, 'visible', 0) this.insert_child_below (shadow_clone, clone) - this.set_child_below_sibling (shadow_clone, clone) } }) } + // Let shadow actor always behind the window clone actor when we + // switch workspace by Ctrl+Alt+Left/Right + // + // Fix #55 + WorkspaceGroup.prototype._syncStacking = function () { + self._orig_sync_stacking.apply (this, []) + for (const { clone } of this._windowRecords) { + const shadow_clone = (clone as WsAnimationActor)._shadow_clone + if (shadow_clone && shadow_clone.visible) { + this.set_child_below_sibling (shadow_clone, clone) + } + } + } + // Window Size Changed WindowManager.prototype._sizeChangeWindowDone = function ( shell_wm, @@ -295,6 +314,7 @@ export class Extension { // Restore patched methods WindowPreview.prototype._addWindow = this._orig_add_window WorkspaceGroup.prototype._createWindows = this._orig_create_windows + WorkspaceGroup.prototype._syncStacking = this._orig_sync_stacking WindowManager.prototype._sizeChangeWindowDone = this._orig_size_changed BackgroundMenu.addBackgroundMenu = this._add_background_menu @@ -401,3 +421,5 @@ const OverviewShadowActor = registerClass ( } } ) + +type WsAnimationActor = Clutter.Actor & { _shadow_clone?: Clutter.Actor }