From 63b92002a0c9b9dc29e4ff4018dc19e4515e2afa Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarek Date: Tue, 5 Mar 2024 17:49:35 +0100 Subject: [PATCH] ecore_evas: fix dnd motion coordinates after rotation Change-Id: Ie6308635ab80f4d5114d84c4571838645113574f --- .../engines/wayland/ecore_evas_wayland_common.c | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 1f5962d..5d98a7d 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -3840,13 +3840,21 @@ _wl_selection_dnd_leave(void *data, int type EINA_UNUSED, void *event) Eina_Position2D cpos; Eina_Position2D fpos = EINA_POSITION2D(0, 0); Ecore_Wl2_Event_Dnd_Leave *ev = event; + // TIZEN_ONLY(20240306): fix dnd motion coordinates after rotation + EINA_SAFETY_ON_NULL_RETURN_VAL(ee, ECORE_CALLBACK_PASS_ON); + EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON); + // Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data; if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON; - //evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL); ecore_wl2_input_pointer_xy_get(ecore_wl2_display_input_find(ev->display, ev->seat), &cpos.x, &cpos.y); - ecore_evas_dnd_leave(data, ev->seat, EINA_POSITION2D(cpos.x - fpos.x, cpos.y - fpos.y)); + // TIZEN_ONLY(20240306): fix dnd motion coordinates after rotation + if (ECORE_EVAS_PORTRAIT(ee)) + ecore_evas_dnd_leave(data, ev->seat, EINA_POSITION2D(cpos.x - fpos.x, cpos.y - fpos.y)); + else + ecore_evas_dnd_leave(data, ev->seat, EINA_POSITION2D(ee->h - cpos.y - fpos.y, cpos.x - fpos.x)); + // wdata->external_offer = NULL; return ECORE_CALLBACK_PASS_ON; @@ -3857,12 +3865,22 @@ _wl_selection_dnd_motion(void *data, int type EINA_UNUSED, void *event) { Ecore_Evas *ee = data; Ecore_Wl2_Event_Dnd_Motion *ev = event; - Eina_Position2D fpos = EINA_POSITION2D(0, 0); + // TIZEN_ONLY(20240306): fix dnd motion coordinates after rotation + int fx = 0; + int fy = 0; + EINA_SAFETY_ON_NULL_RETURN_VAL(ee, ECORE_CALLBACK_PASS_ON); + EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON); if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON; - evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL); - ecore_evas_dnd_position_set(data, ev->seat, EINA_POSITION2D(ev->x - fpos.x, ev->y - fpos.y)); + if (!ee->prop.fullscreen) + evas_output_framespace_get(ee->evas, &fx, &fy, NULL, NULL); + + if (ECORE_EVAS_PORTRAIT(ee)) + ecore_evas_dnd_position_set(data, ev->seat, EINA_POSITION2D(ev->x - fx, ev->y - fy)); + else + ecore_evas_dnd_position_set(data, ev->seat, EINA_POSITION2D(ee->h - ev->y - fx, ev->x - fy)); + // return ECORE_CALLBACK_PASS_ON; } static Eina_Bool -- 2.7.4