e_comp_wl: Don't trigger constraint lock/unlock if mouse in/out has no time 90/309390/1
authorduna.oh <duna.oh@samsung.com>
Tue, 9 Apr 2024 08:02:42 +0000 (17:02 +0900)
committerduna.oh <duna.oh@samsung.com>
Tue, 9 Apr 2024 09:04:11 +0000 (18:04 +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 a8c063c8119b3d1a0ed7af03335171a19125bcd0..73f500aec99b21a60fdf3b8ce0c3e866e89baa07 100644 (file)
@@ -1312,8 +1312,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
@@ -1369,7 +1371,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 054dd3757a9bc5e54b0b7c7beddb5024f1154991..dbc3433b286ff1c172999c45e4d4b602273ee704 100644 (file)
@@ -897,7 +897,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);
@@ -908,6 +907,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;