[gnome-shell] [linearView] Fix dnd to dash when zoomed out



commit b3794f1c171a2ef44382a6a00950ca994933db2b
Author: Florian Müllner <fmuellner src gnome org>
Date:   Thu May 20 16:13:27 2010 +0200

    [linearView] Fix dnd to dash when zoomed out
    
    While zoomed out, the workspaces view's drop target spans the entire
    monitor to implement reactive screen edges. When a drop event is not
    handled by the view, an attempt is made to pass it on down the stack,
    but it doesn't work properly. Fix it by iterating the target's parents
    as well.
    Also improve the code which translates dnd coordinates to target
    positions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=619203

 js/ui/dnd.js            |   18 ++++++++++--------
 js/ui/workspacesView.js |   16 ++++++++++------
 2 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index d27aa49..dad1cd0 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -302,13 +302,14 @@ _Draggable.prototype = {
             this._dragActor.show();
             while (target) {
                 if (target._delegate && target._delegate.handleDragOver) {
-                    let [targX, targY] = target.get_transformed_position();
+                    let [r, targX, targY] = target.transform_stage_point(stageX, stageY);
                     // We currently loop through all parents on drag-over even if one of the children has handled it.
                     // We can check the return value of the function and break the loop if it's true if we don't want
                     // to continue checking the parents.
-                    target._delegate.handleDragOver(this.actor._delegate, this._dragActor,
-                                                    (stageX - targX) / target.scale_x,
-                                                    (stageY - targY) / target.scale_y,
+                    target._delegate.handleDragOver(this.actor._delegate,
+                                                    this._dragActor,
+                                                    targX,
+                                                    targY,
                                                     event.get_time());
                 }
                 target = target.get_parent();
@@ -328,10 +329,11 @@ _Draggable.prototype = {
         this._dragActor.show();
         while (target) {
             if (target._delegate && target._delegate.acceptDrop) {
-                let [targX, targY] = target.get_transformed_position();
-                if (target._delegate.acceptDrop(this.actor._delegate, this._dragActor,
-                                                (dropX - targX) / target.scale_x,
-                                                (dropY - targY) / target.scale_y,
+                let [r, targX, targY] = target.transform_stage_point(dropX, dropY);
+                if (target._delegate.acceptDrop(this.actor._delegate,
+                                                this._dragActor,
+                                                targX,
+                                                targY,
                                                 event.get_time())) {
                     // If it accepted the drop without taking the actor,
                     // handle it ourselves.
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index cf8882b..b4b2058 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -1136,12 +1136,16 @@ SingleView.prototype = {
             let target = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
             dropActor.show();
 
-            if (target._delegate && target._delegate != this && target._delegate.acceptDrop) {
-                let [targX, targY] = target.get_transformed_position();
-                return target._delegate.acceptDrop(source, dropActor,
-                                                   (x - targX) / target.scale_x,
-                                                   (y - targY) / target.scale_y,
-                                                   time);
+            while (target) {
+                if (target._delegate &&
+                    target._delegate != this &&
+                    target._delegate.acceptDrop) {
+
+                    let [r, targX, targY] = target.transform_stage_point(x, y);
+                    return target._delegate.acceptDrop(source, dropActor,
+                                                       targX, targY, time);
+                }
+                target = target.get_parent();
             }
             return false;
         }



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