woohyun pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=2ab054022ce1288def918ab8018027bade538827

commit 2ab054022ce1288def918ab8018027bade538827
Author: Thiep Ha <thie...@gmail.com>
Date:   Tue Apr 1 09:39:16 2014 +0900

    [Elm_Dnd] Correct drag position when rotation
    
    Summary:
    When window is rotated, the drag position is not updated.
    It makes dnd cannot find out correct dropable objects.
    This patch updates the drag position when window is rotated, so that dnd 
can find correct dropable objects.
    @fix
    
    P/S: This patch is originated from JackDanielZ (Daniel Zaoui). I update it 
to conform with lastest code.
    
    Reviewers: JackDanielZ, raster
    
    Reviewed By: JackDanielZ
    
    CC: woohyun
    
    Differential Revision: https://phab.enlightenment.org/D680
---
 src/lib/elm_cnp.c | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 0d08c01..35af060 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -1244,12 +1244,46 @@ static void
 _x11_dropable_coords_adjust(Dropable *dropable, Evas_Coord *x, Evas_Coord *y)
 {
    Ecore_Evas *ee;
-   int ex = 0, ey = 0;
+   int ex = 0, ey = 0, ew = 0, eh = 0;
+   Evas_Object *win;
+   Evas_Coord x2, y2;
 
    ee = ecore_evas_ecore_evas_get(evas_object_evas_get(dropable->obj));
-   ecore_evas_geometry_get(ee, &ex, &ey, NULL, NULL);
+   ecore_evas_geometry_get(ee, &ex, &ey, &ew, &eh);
    *x = *x - ex;
    *y = *y - ey;
+
+   if (elm_widget_is(dropable->obj))
+     {
+        win = elm_widget_top_get(dropable->obj);
+        if (win && !strcmp(evas_object_type_get(win), "elm_win"))
+          {
+             int rot = elm_win_rotation_get(win);
+             switch (rot)
+               {
+                case 90:
+                   x2 = ew - *y;
+                   y2 = *x;
+                   break;
+                case 180:
+                   x2 = ew - *x;
+                   y2 = eh - *y;
+                   break;
+                case 270:
+                   x2 = *y;
+                   y2 = eh - *x;
+                   break;
+                default:
+                   x2 = *x;
+                   y2 = *y;
+                   break;
+               }
+             cnp_debug("rotation %d, w %d, h %d - x:%d->%d, y:%d->%d\n",
+                       rot, ew, eh, *x, x2, *y, y2);
+             *x = x2;
+             *y = y2;
+          }
+     }
 }
 
 static Eina_Bool

-- 


Reply via email to