From: Duna Oh Date: Tue, 15 Mar 2016 10:56:26 +0000 (+0900) Subject: e_comp_object: apply evas_map to cursor when the zone is rotated X-Git-Tag: accepted/tizen/common/20160323.184110~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c1978a5753d6ddb0b1e3ed807d1069fec720bfad;p=platform%2Fupstream%2Fenlightenment.git e_comp_object: apply evas_map to cursor when the zone is rotated Signed-off-by: Duna Oh Change-Id: Ic75290b75daafe4893965cc3e08748a8f82c2aff --- diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 11d613d..e0541b1 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -4911,7 +4911,106 @@ e_client_ping(E_Client *ec) _e_client_cb_ping_poller, ec); } +static void +_e_client_map_transform(int width, int height, uint32_t transform, + int sx, int sy, int *dx, int *dy) +{ + switch (transform) + { + case WL_OUTPUT_TRANSFORM_NORMAL: + default: + *dx = sx, *dy = sy; + break; + case WL_OUTPUT_TRANSFORM_90: + *dx = height - sy, *dy = sx; + break; + case WL_OUTPUT_TRANSFORM_180: + *dx = width - sx, *dy = height - sy; + break; + case WL_OUTPUT_TRANSFORM_270: + *dx = sy, *dy = width - sx; + break; + } +} + //////////////////////////////////////////// +E_API void +e_client_cursor_map_apply(E_Client *ec, int rotation, int x, int y) +{ + Evas_Map *map; + int x1, y1, x2, y2, dx, dy; + int32_t width, height; + int cursor_w, cursor_h; + uint32_t transform; + int rot_x = x, rot_y = y; + int zone_w = ec->zone->w; + int zone_h = ec->zone->h; + double awh = ((double)zone_w / (double)zone_h); + double ahw = ((double)zone_h / (double)zone_w); + + evas_object_geometry_get(ec->frame, NULL, NULL, &cursor_w, &cursor_h); + width = cursor_w; + height = cursor_h; + + switch(rotation) + { + case 90: + rot_x = y * awh; + rot_y = ahw * (zone_w - x); + transform = WL_OUTPUT_TRANSFORM_90; + width = cursor_h; + height = cursor_w; + break; + case 180: + rot_x = zone_w - x; + rot_y = zone_h - y; + transform = WL_OUTPUT_TRANSFORM_180; + break; + case 270: + rot_x = awh * (zone_h - y); + rot_y = ahw * x; + transform = WL_OUTPUT_TRANSFORM_270; + width = cursor_h; + height = cursor_w; + break; + default: + transform = WL_OUTPUT_TRANSFORM_NORMAL; + break; + } + ec->client.x = rot_x, ec->client.y = rot_y; + ec->x = rot_x, ec->y = rot_y; + + map = evas_map_new(4); + evas_map_util_points_populate_from_geometry(map, + ec->x, ec->y, + width, height, 0); + + x1 = 0.0; + y1 = 0.0; + x2 = width; + y2 = height; + + _e_client_map_transform(width, height, transform, + x1, y1, &dx, &dy); + evas_map_point_image_uv_set(map, 0, dx, dy); + + _e_client_map_transform(width, height, transform, + x2, y1, &dx, &dy); + evas_map_point_image_uv_set(map, 1, dx, dy); + + _e_client_map_transform(width, height, transform, + x2, y2, &dx, &dy); + evas_map_point_image_uv_set(map, 2, dx, dy); + + _e_client_map_transform(width, height, transform, + x1, y2, &dx, &dy); + evas_map_point_image_uv_set(map, 3, dx, dy); + + evas_object_map_set(ec->frame, map); + evas_object_map_enable_set(ec->frame, map ? EINA_TRUE : EINA_FALSE); + + evas_map_free(map); +} E_API void e_client_move_cancel(void) diff --git a/src/bin/e_client.h b/src/bin/e_client.h index 7e9bf14..1a02c50 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -967,6 +967,7 @@ E_API void e_client_visibility_calculate(void); E_API void e_client_transform_update(E_Client *ec); E_API void e_client_transform_apply(E_Client *ec, double degree, double zoom, int cx, int cy); E_API void e_client_transform_clear(E_Client *ec); +E_API void e_client_cursor_map_apply(E_Client *ec, int rotation, int x, int y); YOLO E_API void e_client_focus_stack_set(Eina_List *l); diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index 1d8dee5..45c1fc8 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -977,6 +977,12 @@ _e_comp_intercept_move(void *data, Evas_Object *obj, int x, int y) if (!e_util_strcmp("wl_pointer-cursor", cw->ec->icccm.window_role)) { + if (cw->ec->zone->rot.curr != 0) + { + e_client_cursor_map_apply(cw->ec, cw->ec->zone->rot.curr, x, y); + return; + } + cw->ec->client.x = x, cw->ec->client.y = y; cw->ec->x = x, cw->ec->y = y; evas_object_move(obj, x, y);