e_dnd: ungrab input without feeding mouse out/in when pointer is constrainted 18/312818/1
authorduna.oh <duna.oh@samsung.com>
Fri, 14 Jun 2024 07:21:36 +0000 (16:21 +0900)
committerduna.oh <duna.oh@samsung.com>
Fri, 14 Jun 2024 09:22:10 +0000 (18:22 +0900)
If drag is cancelled by KVM service and pointer is already constrainted
(locked in Edge window), additional mouse out/in event onto the Edge results in
being unlocked and locked again.

Drag and drop sequence goes as follows:

1. Drag starts with a touch down event on Evas 1.
2. Dragging onto Evas 2 involves several steps:
Mouse OUT event on Evas 1 (Browser).
Mouse IN event on Evas 2 (Edge). --> locked
Mouse move event on Evas 2.
3. The drag ends with a touch up event on Evas 2:
Mouse OUT event on Evas 2. --> unlocked --> issue
Mouse IN event on Evas 2. --> locked --> issue

Change-Id: Ib5550ef087358a0e262fc59d97b0b7214d784870

src/bin/e_comp.c
src/bin/e_comp.h
src/bin/e_dnd.c
src/bin/e_dnd.h
src/bin/services/e_service_kvm.c

index 1a7012457593c3f7912da5048f74239bc79f3b01..35159fb74cb03a76991243a9a7a960f8741ed26b 100644 (file)
@@ -1550,3 +1550,33 @@ e_comp_focused_ec_get(void)
 
    return NULL;
 }
+
+EINTERN void
+e_comp_ungrab_input_without_inout(Eina_Bool mouse, Eina_Bool kbd)
+{
+   Ecore_Window mwin = 0, kwin = 0;
+
+   mouse = !!mouse;
+   kbd = !!kbd;
+   if (e_comp->input_mouse_grabs)
+     e_comp->input_mouse_grabs -= mouse;
+
+   if (e_comp->input_key_grabs)
+     e_comp->input_key_grabs -= kbd;
+
+   if (mouse && (!e_comp->input_mouse_grabs))
+     mwin = e_comp->ee_win;
+
+   if (kbd && (!e_comp->input_key_grabs))
+     kwin = e_comp->ee_win;
+
+   //e_comp_override_timed_pop(); //nocomp condition
+   if ((!mwin) && (!kwin)) return;
+   e_grabinput_release(mwin, kwin);
+   if (e_client_focused_get()) return;
+
+   E_Zone *zone = e_zone_current_get();
+   if (!zone) return;
+
+   e_zone_focus_reset(zone);
+}
index ee781651888dbc86440a5243d170de1356c6a946..ece78c037031e73ef1f2e87aa036a36c80dda736 100644 (file)
@@ -272,6 +272,7 @@ EINTERN void e_comp_idler_before(void);
 EINTERN void e_comp_visibility_calculation_set(Eina_Bool set);
 EINTERN Eina_Bool e_comp_visibility_calculation_get(void);
 EINTERN E_Client *e_comp_focused_ec_get(void);
+EINTERN void          e_comp_ungrab_input_without_inout(Eina_Bool mouse, Eina_Bool kbd);
 
 #endif
 #endif
index 5c8733e0ffa96e8bfc160e8c6042290eb0c43813..0f1b11209cae7fcb6e7aa6e9a9a3c18394b1ef5a 100644 (file)
@@ -277,7 +277,16 @@ _e_drag_end(E_Drag *drag, E_Dnd_Drop_Type type)
 
    if (drag->input_grab)
      {
-        e_comp_ungrab_input(1, 1);
+        if ((type == E_DND_DRAG_TYPE_CANCELLED_BY_KVM) &&
+            (e_comp_wl_input_pointer_constraint_activated_get()))
+          {
+             ELOGF("DnD", "Pointer Constraint activated. call e_comp_ungrab_input_without_inout", NULL);
+             e_comp_ungrab_input_without_inout(1, 1);
+          }
+        else
+          {
+             e_comp_ungrab_input(1, 1);
+          }
         drag->input_grab = EINA_FALSE;
      }
 
index 1efe1bd4f95b608323f2f812177685d55f86c6d0..6065780b242f0ce2edda25da439b0989fe33319d 100644 (file)
@@ -20,6 +20,7 @@ typedef enum _E_Dnd_Drop_Type
 {
    E_DND_DRAG_TYPE_DROPPED,
    E_DND_DRAG_TYPE_CANCELLED,
+   E_DND_DRAG_TYPE_CANCELLED_BY_KVM,
 } E_Dnd_Drop_Type;
 
 typedef void (*E_Drag_Hook_Cb)(void *data, E_Drag *drag);
index 7bbb89d9204115fd514e55a9dc1bd448cfdb9c9f..ed244d96f39a58c925623ae9885beee37eaf499b 100644 (file)
@@ -266,7 +266,7 @@ e_service_kvm_drag_cancel(E_Client *ec)
 
    ELOGF("KVM", "Cancel drag by kvm_service request! service:%p", ec, esk);
 
-   e_drag_end(e_comp_wl->drag, E_DND_DRAG_TYPE_CANCELLED);
+   e_drag_end(e_comp_wl->drag, E_DND_DRAG_TYPE_CANCELLED_BY_KVM);
 
    return EINA_TRUE;
 }