ecore_evas: fix dnd motion coordinates after rotation 75/307175/4 accepted/tizen/unified/20240311.170335 accepted/tizen/unified/x/20240313.092104
authorPatryk Kaczmarek <patryk.k@partner.samsung.com>
Tue, 5 Mar 2024 16:49:35 +0000 (17:49 +0100)
committerPatryk Kaczmarek <patryk.k@partner.samsung.com>
Wed, 6 Mar 2024 15:22:02 +0000 (16:22 +0100)
Change-Id: Ie6308635ab80f4d5114d84c4571838645113574f

src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c

index 1f5962d..5d98a7d 100644 (file)
@@ -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