From 1d981f836a9fcaacb4de31539c89645b6aa23fd4 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 13 Dec 2017 21:00:33 +0900 Subject: [PATCH] e_plane: set correct cursor position in the case of rotation Change-Id: Iab50d73a2f0b52ac7d47a7fe2e2f29416713bce6 --- src/bin/e_plane.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/bin/e_plane.c b/src/bin/e_plane.c index e4c00bd..452f1f5 100644 --- a/src/bin/e_plane.c +++ b/src/bin/e_plane.c @@ -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 { -- 2.7.4