[gnome-shell] overview: Only accept AppIcon drops if the app can open a new window



commit 23344701de22bbaf402447d4abb5ad54e41a699c
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Thu May 2 17:04:03 2019 +0200

    overview: Only accept AppIcon drops if the app can open a new window
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/121

 js/ui/workspace.js          |  4 ++--
 js/ui/workspaceThumbnail.js | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 39b59f9d58..7ffec352b8 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -1994,7 +1994,7 @@ var Workspace = class {
     handleDragOver(source, _actor, _x, _y, _time) {
         if (source.realWindow && !this._isMyWindow(source.realWindow))
             return DND.DragMotionResult.MOVE_DROP;
-        if (source.app)
+        if (source.app && source.app.can_open_new_window())
             return DND.DragMotionResult.COPY_DROP;
         if (!source.app && source.shellWorkspaceLaunch)
             return DND.DragMotionResult.COPY_DROP;
@@ -2031,7 +2031,7 @@ var Workspace = class {
 
             metaWindow.change_workspace_by_index(workspaceIndex, false);
             return true;
-        } else if (source.app) {
+        } else if (source.app && source.app.can_open_new_window()) {
             source.app.open_new_window(workspaceIndex);
             return true;
         } else if (!source.app && source.shellWorkspaceLaunch) {
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index e3a24e9d4f..91286e2b35 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -572,7 +572,7 @@ var WorkspaceThumbnail = GObject.registerClass({
 
         if (source.realWindow && !this._isMyWindow(source.realWindow))
             return DND.DragMotionResult.MOVE_DROP;
-        if (source.app)
+        if (source.app && source.app.can_open_new_window())
             return DND.DragMotionResult.COPY_DROP;
         if (!source.app && source.shellWorkspaceLaunch)
             return DND.DragMotionResult.COPY_DROP;
@@ -599,7 +599,7 @@ var WorkspaceThumbnail = GObject.registerClass({
 
             metaWindow.change_workspace_by_index(this.metaWorkspace.index(), false);
             return true;
-        } else if (source.app) {
+        } else if (source.app && source.app.can_open_new_window()) {
             source.app.open_new_window(this.metaWorkspace.index());
             return true;
         } else if (!source.app && source.shellWorkspaceLaunch) {
@@ -787,7 +787,7 @@ var ThumbnailsBox = GObject.registerClass({
     // Draggable target interface
     handleDragOver(source, actor, x, y, time) {
         if (!source.realWindow &&
-            !source.app &&
+            (!source.app || !source.app.can_open_new_window()) &&
             (source.app || !source.shellWorkspaceLaunch) &&
             source != Main.xdndHandler)
             return DND.DragMotionResult.CONTINUE;
@@ -847,7 +847,7 @@ var ThumbnailsBox = GObject.registerClass({
             return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, time);
         } else if (this._dropPlaceholderPos != -1) {
             if (!source.realWindow &&
-                !source.app &&
+                (!source.app || !source.app.can_open_new_window()) &&
                 (source.app || !source.shellWorkspaceLaunch))
                 return false;
 
@@ -865,7 +865,7 @@ var ThumbnailsBox = GObject.registerClass({
                 if (source.metaWindow.get_monitor() != thumbMonitor)
                     source.metaWindow.move_to_monitor(thumbMonitor);
                 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);
             } else if (!source.app && source.shellWorkspaceLaunch) {
                 // While unused in our own drag sources, shellWorkspaceLaunch allows


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]