From 79a5a936b57f075116703bd67797b598998fc084 Mon Sep 17 00:00:00 2001 From: Duna Oh Date: Fri, 23 Sep 2016 16:56:42 +0900 Subject: [PATCH] e_comp_wl: when canvas is rotated, change uv of cursor image and calls ecore_drm_device_pointer_rotation_set() Signed-off-by: Duna Oh Change-Id: I809b9ba1d4c688e0d5fab4276935d324d8780b52 --- src/bin/e_client.c | 9 --------- src/bin/e_client.h | 1 - src/bin/e_comp_wl.c | 20 ++++++++++++++++++++ src/bin/e_pointer.c | 34 +++++++--------------------------- 4 files changed, 27 insertions(+), 37 deletions(-) diff --git a/src/bin/e_client.c b/src/bin/e_client.c index d929360..21e028c 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -5277,15 +5277,6 @@ e_client_ping(E_Client *ec) _e_client_cb_ping_poller, ec); } -//////////////////////////////////////////// -E_API void -e_client_cursor_map_apply(E_Client *ec, int rotation, int x, int y) -{ - // TODO: repace the e_client_cursor_map_apply to e_pointer_rotation_set - // remove(deprecate) the e_client_cursor_map_apply. - e_pointer_rotation_set(e_comp->pointer, rotation); -} - E_API void e_client_move_cancel(void) { diff --git a/src/bin/e_client.h b/src/bin/e_client.h index c4b896d..dffef6f 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -1012,7 +1012,6 @@ E_API Eina_Bool e_client_first_mapped_get(E_Client *ec); 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_wl.c b/src/bin/e_comp_wl.c index 90fbe80..f3e6d1b 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -1606,6 +1606,9 @@ _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj ec->comp_data->on_focus_timer = ecore_timer_add(((e_config->xkb.delay_held_key_input_to_focus)/1000.0), (Ecore_Task_Cb)_e_comp_wl_evas_cb_focus_in_timer, ec); + int rotation = ec->e.state.rot.ang.curr; + if (e_comp->pointer->rotation != rotation) + e_pointer_rotation_set(e_comp->pointer, rotation); } static void @@ -2035,6 +2038,22 @@ _e_comp_wl_cb_zone_display_state_change(void *d EINA_UNUSED, int t EINA_UNUSED, return ECORE_CALLBACK_PASS_ON; } +static Eina_Bool +_e_comp_wl_cb_client_rot_change_end(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client_Rotation_Change_End *ev EINA_UNUSED) +{ + E_Client *focused_ec; + int rotation; + + focused_ec = e_client_focused_get(); + if (!focused_ec) return ECORE_CALLBACK_PASS_ON; + + rotation = focused_ec->e.state.rot.ang.curr; + if (e_comp->pointer->rotation != rotation) + e_pointer_rotation_set(e_comp->pointer, rotation); + + return ECORE_CALLBACK_PASS_ON; +} + static void _e_comp_wl_subsurface_restack(E_Client *ec) { @@ -4703,6 +4722,7 @@ e_comp_wl_init(void) E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE, _e_comp_wl_cb_mouse_move, NULL); E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_CANCEL, _e_comp_wl_cb_mouse_button_cancel, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DISPLAY_STATE_CHANGE, _e_comp_wl_cb_zone_display_state_change, NULL); + E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ROTATION_CHANGE_END, _e_comp_wl_cb_client_rot_change_end, NULL); /* add hooks to catch e_client events */ e_client_hook_add(E_CLIENT_HOOK_NEW_CLIENT, _e_comp_wl_client_cb_new, NULL); diff --git a/src/bin/e_pointer.c b/src/bin/e_pointer.c index f54884e..925a17e 100644 --- a/src/bin/e_pointer.c +++ b/src/bin/e_pointer.c @@ -1,4 +1,5 @@ #include "e.h" +#include /* local variables */ static Eina_List *_ptrs = NULL; @@ -47,9 +48,6 @@ _e_pointer_rotation_apply(E_Pointer *ptr) int32_t width, height; int cursor_w, cursor_h; uint32_t transform; - int rot_x, rot_y, x, y; - int zone_w, zone_h; - double awh, ahw; E_Client *ec; int rotation; @@ -59,8 +57,6 @@ _e_pointer_rotation_apply(E_Pointer *ptr) ec = e_comp_object_client_get(ptr->o_ptr); EINA_SAFETY_ON_NULL_RETURN(ec); - x = ptr->x; - y = ptr->y; rotation = ptr->rotation; evas_object_geometry_get(ec->frame, NULL, NULL, &cursor_w, &cursor_h); @@ -69,37 +65,23 @@ _e_pointer_rotation_apply(E_Pointer *ptr) { evas_object_map_set(ec->frame, NULL); evas_object_map_enable_set(ec->frame, EINA_FALSE); - _e_pointer_position_update(ptr); return; } - zone_w = ec->zone->w; - zone_h = ec->zone->h; - awh = ((double)zone_w / (double)zone_h); - ahw = ((double)zone_h / (double)zone_w); - - rot_x = x; - rot_y = y; 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; @@ -109,14 +91,6 @@ _e_pointer_rotation_apply(E_Pointer *ptr) break; } - if (ptr->device == E_POINTER_MOUSE) - { - ec->client.x = rot_x, ec->client.y = rot_y; - ec->x = rot_x, ec->y = rot_y; - ptr->x = rot_x; - ptr->y = rot_y; - } - map = evas_map_new(4); evas_map_util_points_populate_from_geometry(map, ec->x, ec->y, @@ -320,10 +294,16 @@ e_pointer_is_hidden(E_Pointer *ptr) E_API void e_pointer_rotation_set(E_Pointer *ptr, int rotation) { + const Eina_List *l; + Ecore_Drm_Device *dev; + ptr->rotation = rotation; _e_pointer_rotation_apply(ptr); _e_pointer_position_update(ptr); + + EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev) + ecore_drm_device_pointer_rotation_set(dev, rotation); } E_API void -- 2.7.4