e_plane: set correct cursor position in the case of rotation 29/164129/2
authorChangyeon Lee <cyeon.lee@samsung.com>
Wed, 13 Dec 2017 12:00:33 +0000 (21:00 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Sat, 16 Dec 2017 00:21:25 +0000 (00:21 +0000)
Change-Id: Iab50d73a2f0b52ac7d47a7fe2e2f29416713bce6

src/bin/e_plane.c

index e4c00bd..452f1f5 100644 (file)
@@ -265,6 +265,40 @@ _e_plane_aligned_width_get(tbm_surface_h tsurface)
    return aligned_width;
 }
 
+static void
+_e_plane_cursor_position_get(E_Pointer *ptr, int width, int height, int *x, int *y)
+{
+   int rotation;
+
+   rotation = ptr->rotation;
+
+   switch (rotation)
+     {
+      case 0:
+        *x = ptr->x - ptr->hot.x;
+        *y = ptr->y - ptr->hot.y;
+        break;
+      case 90:
+        *x = ptr->x - ptr->hot.y;
+        *y = ptr->y + ptr->hot.x - width;
+        break;
+      case 180:
+        *x = ptr->x + ptr->hot.x - width;
+        *y = ptr->y + ptr->hot.y - height;
+        break;
+      case 270:
+        *x = ptr->x + ptr->hot.y - height;
+        *y = ptr->y - ptr->hot.x;
+        break;
+      default:
+        *x = ptr->x - ptr->hot.x;
+        *y = ptr->y - ptr->hot.y;
+        break;
+     }
+
+   return;
+}
+
 static Eina_Bool
 _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
 {
@@ -296,8 +330,8 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
                   return EINA_FALSE;
                }
 
-             dst_x = pointer->x - pointer->hot.x;
-             dst_y = pointer->y - pointer->hot.y;
+             _e_plane_cursor_position_get(pointer, surf_info.width, surf_info.height,
+                                          &dst_x, &dst_y);
           }
         else
           {