e_comp_wl: Don't trigger constraint lock/unlock if mouse in/out has no time
authorduna.oh <duna.oh@samsung.com>
Tue, 9 Apr 2024 08:02:42 +0000 (17:02 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 9 Apr 2024 08:47:39 +0000 (17:47 +0900)
Mouse in/out events may occur without timestamps when calling
evas_event_feed_mouse_out/in() in functions like e_comp_ungrab_input, etc.
Since these events do not necessarily indicate that the mouse has entered or
exited Evas (the client application), it should not to trigger pointer
constraint lock/unlock based on these events alone.

Change-Id: I88a009fadc701687feb56573535405e38ba6a110

src/bin/e_comp_wl.c
src/bin/e_input_evdev.c

index cca966805ef6602b80db9f3e18a170966910caf7..89dbd37076d8fae755de723d06b38a221013a009 100644 (file)
@@ -1344,8 +1344,10 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
                               wl_fixed_from_int(ev->canvas.y - ec->client.y));
         ec->pointer_enter_sent = EINA_TRUE;
      }
-
-   wl_signal_emit(&e_comp_wl->ptr_constraints.surface_mousein_signal, ec);
+   if (ev->timestamp)
+     wl_signal_emit(&e_comp_wl->ptr_constraints.surface_mousein_signal, ec);
+   else
+     ELOGF("Mouse", "In. Event doesn't have timestamp. no need to send signal", NULL);
 }
 
 static void
@@ -1401,7 +1403,10 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
         wl_pointer_send_leave(res, serial, surface);
         ec->pointer_enter_sent = EINA_FALSE;
      }
-   wl_signal_emit(&e_comp_wl->ptr_constraints.surface_mouseout_signal, ec);
+   if (ev->timestamp)
+     wl_signal_emit(&e_comp_wl->ptr_constraints.surface_mouseout_signal, ec);
+   else
+     ELOGF("Mouse", "Out. Event doesn't have timestamp. no need to send signal", NULL);
 }
 
 static void
index 1386b924aded4049f8a02656e32717285d544876..d731175dc5d7ac523b272687dd6a98ba622e706a 100644 (file)
@@ -6,6 +6,7 @@
 #include "e_device_intern.h"
 #include "e_comp_screen_intern.h"
 #include "e_output_intern.h"
+#include "e_utils_intern.h"
 
 #include <glib.h>
 #include <ctype.h>
@@ -874,7 +875,6 @@ _device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event
    ev->window = (Ecore_Window)input->dev->window;
    ev->event_window = (Ecore_Window)input->dev->window;
    ev->root_window = (Ecore_Window)input->dev->window;
-   if (event) ev->timestamp = libinput_event_pointer_get_time(event);
    ev->same_screen = 1;
 
    _device_modifiers_update(edev);
@@ -885,6 +885,17 @@ _device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event
    ev->root.x = ev->x;
    ev->root.y = ev->y;
 
+   if (event)
+     {
+        ev->timestamp = libinput_event_pointer_get_time(event);
+     }
+   else
+     {
+        ev->timestamp = e_util_timestamp_get();
+        ELOGF("Mouse", "Move (x: %d, y: %d, timestamp: %u (current time), device: %s)", NULL,
+              ev->x, ev->y, ev->timestamp, ecore_device_name_get(ecore_dev));
+     }
+
    ev->multi.device = edev->mt_slot;
    ev->multi.radius = 1;
    ev->multi.radius_x = 1;