diff --git a/js/ui/workspace.js b/js/ui/workspace.js index e1096f16f..2bf98da5d 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -1159,14 +1159,15 @@ class Workspace extends St.Widget { this.connect('destroy', this._onDestroy.bind(this)); - let windows = global.get_window_actors().filter(this._isMyWindow, this); + const windows = global.get_window_actors().map(a => a.meta_window) + .filter(this._isMyWindow, this); // Create clones for windows that should be // visible in the Overview this._windows = []; for (let i = 0; i < windows.length; i++) { if (this._isOverviewWindow(windows[i])) - this._addWindowClone(windows[i], true); + this._addWindowClone(windows[i].get_compositor_private(), true); } // Track window changes @@ -1514,10 +1515,10 @@ class Workspace extends St.Widget { if (this._lookupIndex(metaWin) != -1) return; - if (!this._isMyWindow(win)) + if (!this._isMyWindow(metaWin)) return; - if (!this._isOverviewWindow(win)) { + if (!this._isOverviewWindow(metaWin)) { if (metaWin.get_transient_for() == null) return; @@ -1798,16 +1799,16 @@ class Workspace extends St.Widget { this._recalculateWindowPositions(WindowPositionFlags.INITIAL); } - // Tests if @actor belongs to this workspaces and monitor - _isMyWindow(actor) { - let win = actor.meta_window; - return (this.metaWorkspace == null || win.located_on_workspace(this.metaWorkspace)) && - (win.get_monitor() == this.monitorIndex); + _isMyWindow(window) { + const isOnWorkspace = this.metaWorkspace === null || + window.located_on_workspace(this.metaWorkspace); + const isOnMonitor = window.get_monitor() === this.monitorIndex; + + return isOnWorkspace && isOnMonitor; } - // Tests if @win should be shown in the Overview - _isOverviewWindow(win) { - return !win.get_meta_window().skip_taskbar; + _isOverviewWindow(window) { + return !window.skip_taskbar; } // Create a clone of a (non-desktop) window and add it to the window list @@ -1961,7 +1962,7 @@ class Workspace extends St.Widget { // Draggable target interface handleDragOver(source, _actor, _x, _y, _time) { - if (source.realWindow && !this._isMyWindow(source.realWindow)) + if (source.metaWindow && !this._isMyWindow(source.metaWindow)) return DND.DragMotionResult.MOVE_DROP; if (source.app && source.app.can_open_new_window()) return DND.DragMotionResult.COPY_DROP; @@ -1977,29 +1978,27 @@ class Workspace extends St.Widget { ? this.metaWorkspace.index() : workspaceManager.get_active_workspace_index(); - if (source.realWindow) { - let win = source.realWindow; - if (this._isMyWindow(win)) + if (source.metaWindow) { + const window = source.metaWindow; + if (this._isMyWindow(window)) return false; // Set a hint on the Mutter.Window so its initial position // in the new workspace will be correct - win._overviewHint = { + window.get_compositor_private()._overviewHint = { x: actor.x, y: actor.y, width: actor.width, heigth: actor.height, }; - let metaWindow = win.get_meta_window(); - // We need to move the window before changing the workspace, because // the move itself could cause a workspace change if the window enters // the primary monitor - if (metaWindow.get_monitor() != this.monitorIndex) - metaWindow.move_to_monitor(this.monitorIndex); + if (window.get_monitor() != this.monitorIndex) + window.move_to_monitor(this.monitorIndex); - metaWindow.change_workspace_by_index(workspaceIndex, false); + window.change_workspace_by_index(workspaceIndex, false); return true; } else if (source.app && source.app.can_open_new_window()) { if (source.animateLaunchAtPos) diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 506667809..73f8b7ec9 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -567,7 +567,8 @@ var WorkspaceThumbnail = GObject.registerClass({ if (this.state > ThumbnailState.NORMAL) return DND.DragMotionResult.CONTINUE; - if (source.realWindow && !this._isMyWindow(source.realWindow)) + if (source.metaWindow && + !this._isMyWindow(source.metaWindow.get_compositor_private())) return DND.DragMotionResult.MOVE_DROP; if (source.app && source.app.can_open_new_window()) return DND.DragMotionResult.COPY_DROP; @@ -581,8 +582,8 @@ var WorkspaceThumbnail = GObject.registerClass({ if (this.state > ThumbnailState.NORMAL) return false; - if (source.realWindow) { - let win = source.realWindow; + if (source.metaWindow) { + let win = source.metaWindow.get_compositor_private(); if (this._isMyWindow(win)) return false; @@ -795,7 +796,7 @@ var ThumbnailsBox = GObject.registerClass({ // Draggable target interface handleDragOver(source, actor, x, y, time) { - if (!source.realWindow && + if (!source.metaWindow && (!source.app || !source.app.can_open_new_window()) && (source.app || !source.shellWorkspaceLaunch) && source != Main.xdndHandler) @@ -846,7 +847,7 @@ var ThumbnailsBox = GObject.registerClass({ if (this._dropWorkspace != -1) return this._thumbnails[this._dropWorkspace].handleDragOverInternal(source, actor, time); else if (this._dropPlaceholderPos != -1) - return source.realWindow ? DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.COPY_DROP; + return source.metaWindow ? DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.COPY_DROP; else return DND.DragMotionResult.CONTINUE; } @@ -855,12 +856,12 @@ var ThumbnailsBox = GObject.registerClass({ if (this._dropWorkspace != -1) { return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, actor, time); } else if (this._dropPlaceholderPos != -1) { - if (!source.realWindow && + if (!source.metaWindow && (!source.app || !source.app.can_open_new_window()) && (source.app || !source.shellWorkspaceLaunch)) return false; - let isWindow = !!source.realWindow; + let isWindow = !!source.metaWindow; let newWorkspaceIndex; [newWorkspaceIndex, this._dropPlaceholderPos] = [this._dropPlaceholderPos, -1];