e_comp_wl_input: fixed to send relative motion event by setting relative_motion handler sandbox/sj76park/devel
authorSungjin Park <sj76.park@samsung.com>
Tue, 25 Apr 2023 04:41:13 +0000 (13:41 +0900)
committerSungjin Park <sj76.park@samsung.com>
Tue, 25 Apr 2023 04:41:13 +0000 (13:41 +0900)
Signed-off-by: Sungjin Park <sj76.park@samsung.com>
src/bin/e_comp_wl_input.c

index 9f4223963144dcfa086727ce1e92687868c179de..851cc36c96ff6bac9b459a25762ceb8ebb17b12b 100644 (file)
@@ -550,6 +550,19 @@ _e_comp_wl_input_cb_bind_relative_pointer_manager(struct wl_client *client, void
                                   NULL, _e_comp_wl_cb_unbind_relative_pointer_manager);
 }
 
+void
+_e_comp_wl_relative_motion_cb(double dx[2], double dy[2], uint64_t time_us)
+{
+   Eina_Bool res;
+   res = e_comp_wl_mouse_relative_motion_send(e_comp_wl->ptr_constraints.ec,
+                                              (int)dx[0], (int)dy[0], (int)dx[1], (int)dy[1], NULL, time_us);
+
+   if (!res)
+     {
+        ERR("Could not send relative_motion to ec(%p)", e_comp_wl->ptr_constraints.ec);
+     }
+}
+
 static void
 _e_comp_wl_convert_eina_tiler_to_pixman_region32(const Eina_Tiler *tiler,
                                                  pixman_region32_t *region)
@@ -587,6 +600,7 @@ _e_comp_wl_pointer_constraint_deactivate(E_Comp_Wl_Pointer_Constraint *constrain
    constraint->active = EINA_FALSE;
    e_comp_wl->ptr_constraints.activated = EINA_FALSE;
    e_comp_wl->ptr_constraints.ec = NULL;
+   e_input_relative_motion_handler_set(NULL);
    _e_comp_wl_pointer_constraint_notify_deactivated(constraint);
    wl_list_remove(&constraint->surface_unmap_listener.link);
    wl_list_init(&constraint->surface_unmap_listener.link);
@@ -670,6 +684,10 @@ _e_comp_wl_pointer_constraint_enable(E_Comp_Wl_Pointer_Constraint *constraint)
    e_comp_wl->ptr_constraints.activated = EINA_TRUE;
    e_comp_wl->ptr_constraints.ec = ec;
    _e_comp_wl_pointer_constraint_notify_activated(constraint);
+   if (!e_input_relative_motion_handler_set(_e_comp_wl_relative_motion_cb))
+     {
+        ERR("ERROR! Could not set relative motion handler !");
+     }
    wl_signal_add(&e_comp_wl->ptr_constraints.surface_unmap_signal,
                  &constraint->surface_unmap_listener);
 }