e_comp_wl_input: set/unset pointer relative motion handler when a pointer constraint... 12/292012/1
authorSungjin Park <sj76.park@samsung.com>
Tue, 25 Apr 2023 11:49:31 +0000 (20:49 +0900)
committerSungjin Park <sj76.park@samsung.com>
Wed, 26 Apr 2023 07:02:04 +0000 (16:02 +0900)
Change-Id: I5a279f8fe8186912850b50c0c1f09725a2258a4d
Signed-off-by: Sungjin Park <sj76.park@samsung.com>
src/bin/e_comp_wl_input.c

index 9e56197363ba03f6490ec3e4c49edfdd543d9fcf..04b31958a8e7f9d48b1234a309176fb5b25dfc00 100644 (file)
@@ -542,6 +542,19 @@ _e_comp_wl_input_cb_bind_relative_pointer_manager(struct wl_client *client,
                                   NULL, _e_comp_wl_input_cb_unbind_relative_pointer_manager);
 }
 
+void
+_e_comp_wl_input_relative_motion_handler(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], time_us);
+
+   if (!res)
+     {
+        ERR("Could not send relative_motion to ec(%p)", e_comp_wl->ptr_constraints.ec);
+     }
+}
+
 static void
 _e_comp_wl_input_convert_eina_tiler_to_pixman_region32(const Eina_Tiler *tiler,
                                                        pixman_region32_t *region)
@@ -579,6 +592,7 @@ _e_comp_wl_input_pointer_constraint_deactivate(E_Comp_Wl_Pointer_Constraint *con
    e_comp_wl->ptr_constraints.ec = NULL;
    e_comp_wl->relative_ptr.activated = EINA_FALSE;
    e_comp_wl->relative_ptr.ec = NULL;
+   e_input_relative_motion_handler_set(NULL);
    _e_comp_wl_input_pointer_constraint_notify_deactivated(constraint);
    wl_list_remove(&constraint->surface_unmap_listener.link);
    wl_list_init(&constraint->surface_unmap_listener.link);
@@ -665,6 +679,8 @@ _e_comp_wl_input_pointer_constraint_enable(E_Comp_Wl_Pointer_Constraint *constra
    _e_comp_wl_input_pointer_constraint_notify_activated(constraint);
    wl_signal_add(&e_comp_wl->ptr_constraints.surface_unmap_signal,
                  &constraint->surface_unmap_listener);
+   if (!e_input_relative_motion_handler_set(_e_comp_wl_input_relative_motion_handler))
+     ERR("ERROR! Could not set relative motion handler !");
 }
 
 static void