From: duna.oh Date: Tue, 6 Aug 2024 09:46:49 +0000 (+0900) Subject: e_dnd: Send mouse down/up event to KVM service when drag cancelled by KVM X-Git-Tag: accepted/tizen/unified/20240926.050059~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F96%2F317996%2F2;p=platform%2Fupstream%2Fenlightenment.git e_dnd: Send mouse down/up event to KVM service when drag cancelled by KVM The basic DnD operation involves E20 sending a mouse up event to client once dragging begins on the client, followed by the actual DnD operation. This patch adresses the issue where the KVM service needs to be informed when is mouse is released, even after the KVM itself cancels the drag. < Scenario > 1. Draggging starts on the Browser. 2. The KVM service app requests cancel drag. 3. When the mouse button is released, KVM service has no way to detect it since no mouse up event is sent to. Change-Id: I8501e12294129211ff941742703fe29edaa975b8 --- diff --git a/src/bin/windowmgr/e_dnd.c b/src/bin/windowmgr/e_dnd.c index 7ce32206a8..6b6574d722 100644 --- a/src/bin/windowmgr/e_dnd.c +++ b/src/bin/windowmgr/e_dnd.c @@ -8,6 +8,8 @@ #include "e_view_client_intern.h" #include "e_view_edje_intern.h" #include "e_view_rect.h" +#include "e_input.h" +#include "services/e_service_kvm_intern.h" struct _E_Drag_Hook { @@ -32,6 +34,7 @@ static Eina_List *_zone_event_handlers = NULL; static Ecore_Window _drag_win = 0; static E_Drag *_drag_current = NULL; +static Eina_Bool _mouse_down_sent = EINA_FALSE; static int _e_drag_hooks_delete = 0; @@ -287,11 +290,30 @@ _e_drag_end(E_Drag *drag, E_Dnd_Drop_Type type) if (drag->input_grab) { - if ((type == E_DND_DRAG_TYPE_CANCELLED_BY_KVM) && - (e_comp_wl_input_pointer_constraint_activated_get())) + if (type == E_DND_DRAG_TYPE_CANCELLED_BY_KVM) { - ELOGF("DnD", "Pointer Constraint activated. call e_comp_ungrab_input_without_inout", NULL); - e_comp_ungrab_input_without_inout(1, 1); + if (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); + } + if (e_devicemgr && e_devicemgr->last_device_ptr) + { + if (e_input_device_is_virtual(NULL, e_devicemgr->last_device_ptr->identifier, ECORE_DEVICE_CLASS_MOUSE)) + { + ELOGF("DnD", "Cancelled by KVM. using virtual device", NULL); + } + else if (e_service_kvm_service_get(e_comp_wl->ptr.ec)) + { + ELOGF("DnD", "Cancelled by KVM. send mouse button DOWN event to KVM", NULL); + e_comp_wl_mouse_button_send(e_comp_wl->ptr.ec, 1, 1, NULL, 0); + _mouse_down_sent = EINA_TRUE; + } + } } else { @@ -381,6 +403,16 @@ _e_dnd_cb_mouse_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) Ecore_Event_Mouse_Button *ev = event; int device_id = e_comp_wl_data_current_device_id_get(); + if (_mouse_down_sent) + { + if (e_service_kvm_service_get(e_comp_wl->ptr.ec)) + { + ELOGF("DnD", "Mouse Up. send mouse button UP event to KVM", NULL); + e_comp_wl_mouse_button_send(e_comp_wl->ptr.ec, 1, 0, NULL, 0); + } + _mouse_down_sent = EINA_FALSE; + } + if (!_drag_current) return ECORE_CALLBACK_PASS_ON; if (ev->window != _drag_win) return ECORE_CALLBACK_PASS_ON; if ((device_id >= 0) &&