overview: Only accept AppIcon drops if the app can open a new window

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/121
This commit is contained in:
Jonas Dreßler 2019-05-02 17:04:03 +02:00 committed by Florian Müllner
parent 00e95de114
commit 23344701de
2 changed files with 7 additions and 7 deletions

View File

@ -1994,7 +1994,7 @@ var Workspace = class {
handleDragOver(source, _actor, _x, _y, _time) { handleDragOver(source, _actor, _x, _y, _time) {
if (source.realWindow && !this._isMyWindow(source.realWindow)) if (source.realWindow && !this._isMyWindow(source.realWindow))
return DND.DragMotionResult.MOVE_DROP; return DND.DragMotionResult.MOVE_DROP;
if (source.app) if (source.app && source.app.can_open_new_window())
return DND.DragMotionResult.COPY_DROP; return DND.DragMotionResult.COPY_DROP;
if (!source.app && source.shellWorkspaceLaunch) if (!source.app && source.shellWorkspaceLaunch)
return DND.DragMotionResult.COPY_DROP; return DND.DragMotionResult.COPY_DROP;
@ -2031,7 +2031,7 @@ var Workspace = class {
metaWindow.change_workspace_by_index(workspaceIndex, false); metaWindow.change_workspace_by_index(workspaceIndex, false);
return true; return true;
} else if (source.app) { } else if (source.app && source.app.can_open_new_window()) {
source.app.open_new_window(workspaceIndex); source.app.open_new_window(workspaceIndex);
return true; return true;
} else if (!source.app && source.shellWorkspaceLaunch) { } else if (!source.app && source.shellWorkspaceLaunch) {

View File

@ -572,7 +572,7 @@ var WorkspaceThumbnail = GObject.registerClass({
if (source.realWindow && !this._isMyWindow(source.realWindow)) if (source.realWindow && !this._isMyWindow(source.realWindow))
return DND.DragMotionResult.MOVE_DROP; return DND.DragMotionResult.MOVE_DROP;
if (source.app) if (source.app && source.app.can_open_new_window())
return DND.DragMotionResult.COPY_DROP; return DND.DragMotionResult.COPY_DROP;
if (!source.app && source.shellWorkspaceLaunch) if (!source.app && source.shellWorkspaceLaunch)
return DND.DragMotionResult.COPY_DROP; return DND.DragMotionResult.COPY_DROP;
@ -599,7 +599,7 @@ var WorkspaceThumbnail = GObject.registerClass({
metaWindow.change_workspace_by_index(this.metaWorkspace.index(), false); metaWindow.change_workspace_by_index(this.metaWorkspace.index(), false);
return true; return true;
} else if (source.app) { } else if (source.app && source.app.can_open_new_window()) {
source.app.open_new_window(this.metaWorkspace.index()); source.app.open_new_window(this.metaWorkspace.index());
return true; return true;
} else if (!source.app && source.shellWorkspaceLaunch) { } else if (!source.app && source.shellWorkspaceLaunch) {
@ -787,7 +787,7 @@ var ThumbnailsBox = GObject.registerClass({
// Draggable target interface // Draggable target interface
handleDragOver(source, actor, x, y, time) { handleDragOver(source, actor, x, y, time) {
if (!source.realWindow && if (!source.realWindow &&
!source.app && (!source.app || !source.app.can_open_new_window()) &&
(source.app || !source.shellWorkspaceLaunch) && (source.app || !source.shellWorkspaceLaunch) &&
source != Main.xdndHandler) source != Main.xdndHandler)
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
@ -847,7 +847,7 @@ var ThumbnailsBox = GObject.registerClass({
return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, time); return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, time);
} else if (this._dropPlaceholderPos != -1) { } else if (this._dropPlaceholderPos != -1) {
if (!source.realWindow && if (!source.realWindow &&
!source.app && (!source.app || !source.app.can_open_new_window()) &&
(source.app || !source.shellWorkspaceLaunch)) (source.app || !source.shellWorkspaceLaunch))
return false; return false;
@ -865,7 +865,7 @@ var ThumbnailsBox = GObject.registerClass({
if (source.metaWindow.get_monitor() != thumbMonitor) if (source.metaWindow.get_monitor() != thumbMonitor)
source.metaWindow.move_to_monitor(thumbMonitor); source.metaWindow.move_to_monitor(thumbMonitor);
source.metaWindow.change_workspace_by_index(newWorkspaceIndex, true); source.metaWindow.change_workspace_by_index(newWorkspaceIndex, true);
} else if (source.app) { } else if (source.app && source.app.can_open_new_window()) {
source.app.open_new_window(newWorkspaceIndex); source.app.open_new_window(newWorkspaceIndex);
} else if (!source.app && source.shellWorkspaceLaunch) { } else if (!source.app && source.shellWorkspaceLaunch) {
// While unused in our own drag sources, shellWorkspaceLaunch allows // While unused in our own drag sources, shellWorkspaceLaunch allows