(source, actor, x, y, time)
| 875 | } |
| 876 | |
| 877 | acceptDrop(source, actor, x, y, time) { |
| 878 | if (this._dropWorkspace !== -1) { |
| 879 | return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, actor, time); |
| 880 | } else if (this._dropPlaceholderPos !== -1) { |
| 881 | if (!source.metaWindow && |
| 882 | (!source.app || !source.app.can_open_new_window()) && |
| 883 | (source.app || !source.shellWorkspaceLaunch)) |
| 884 | return false; |
| 885 | |
| 886 | const isWindow = !!source.metaWindow; |
| 887 | |
| 888 | let newWorkspaceIndex; |
| 889 | [newWorkspaceIndex, this._dropPlaceholderPos] = [this._dropPlaceholderPos, -1]; |
| 890 | this._spliceIndex = newWorkspaceIndex; |
| 891 | |
| 892 | Main.wm.insertWorkspace(newWorkspaceIndex); |
| 893 | |
| 894 | if (isWindow) { |
| 895 | // Move the window to our monitor first if necessary. |
| 896 | const thumbMonitor = this._thumbnails[newWorkspaceIndex].monitorIndex; |
| 897 | Main.moveWindowToMonitorAndWorkspace(source.metaWindow, |
| 898 | thumbMonitor, newWorkspaceIndex, true); |
| 899 | } else if (source.app && source.app.can_open_new_window()) { |
| 900 | if (source.animateLaunchAtPos) |
| 901 | source.animateLaunchAtPos(actor.x, actor.y); |
| 902 | |
| 903 | source.app.open_new_window(newWorkspaceIndex); |
| 904 | } else if (!source.app && source.shellWorkspaceLaunch) { |
| 905 | // While unused in our own drag sources, shellWorkspaceLaunch allows |
| 906 | // extensions to define custom actions for their drag sources. |
| 907 | source.shellWorkspaceLaunch({ |
| 908 | workspace: newWorkspaceIndex, |
| 909 | timestamp: time, |
| 910 | }); |
| 911 | } |
| 912 | |
| 913 | if (source.app || (!source.app && source.shellWorkspaceLaunch)) { |
| 914 | // This new workspace will be automatically removed if the application fails |
| 915 | // to open its first window within some time, as tracked by Shell.WindowTracker. |
| 916 | // Here, we only add a very brief timeout to avoid the _immediate_ removal of the |
| 917 | // workspace while we wait for the startup sequence to load. |
| 918 | const workspaceManager = global.workspace_manager; |
| 919 | Main.wm.keepWorkspaceAlive(workspaceManager.get_workspace_by_index(newWorkspaceIndex), |
| 920 | WORKSPACE_KEEP_ALIVE_TIME); |
| 921 | } |
| 922 | |
| 923 | // Start the animation on the workspace (which is actually |
| 924 | // an old one which just became empty) |
| 925 | const thumbnail = this._thumbnails[newWorkspaceIndex]; |
| 926 | this._setThumbnailState(thumbnail, ThumbnailState.NEW); |
| 927 | thumbnail.slide_position = 1; |
| 928 | thumbnail.collapse_fraction = 1; |
| 929 | |
| 930 | this._queueUpdateStates(); |
| 931 | |
| 932 | return true; |
| 933 | } else { |
| 934 | return false; |
nothing calls this directly
no test coverage detected