ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
- ERR("[Relative Move] timestamp=%u dx=%d, dy=%d, dx_unaccel=%d, dy_unaccel=%d", ev->timestamp, ev->dx, ev->dy, ev->dx_unaccel, ev->dy_unaccel);
+ ERR("[Relative Move] window = %p time=%u dx=%d, dy=%d, unaccel=(%d, %d)", window, ev->timestamp, ev->dx, ev->dy, ev->dx_unaccel, ev->dy_unaccel);
ecore_event_add(ECORE_EVENT_MOUSE_RELATIVE_MOVE, ev, NULL, NULL);
}
//
uint32_t ts_high, uint32_t ts_low, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t dx_unaccel, wl_fixed_t dy_unaccel)
{
Ecore_Wl2_Input *input;
- Ecore_Wl2_Window *window;
+ Ecore_Wl2_Window *window = NULL;
(void) relative_pointer;
input = data;
input->timestamp = (unsigned int)ts_low;
- /* get currently focused window */
- window = input->focus.pointer;
+// TIZEN_ONLY(20240718) : add relative_motion grab/ungrab API
+ if (input->focus.pointer && input->focus.pointer->ptr_constraints.want_lock_pointer)
+ {
+ /* get currently focused window */
+ window = input->focus.pointer;
+ }
+ else if (input->devmgr.last_event_boundary > 0 &&
+ input->devmgr.last_event_boundary <= ECORE_WL2_POINTER_BOUNDARY_MAX &&
+ input->devmgr.grabbed_pointer[input->devmgr.last_event_boundary] != NULL)
+ {
+ window = input->devmgr.grabbed_pointer[input->devmgr.last_event_boundary];
+ }
+
if (!window) return;
+//
_ecore_wl2_input_mouse_relative_move_send(input, window, wl_fixed_to_int(dx), wl_fixed_to_int(dy),
wl_fixed_to_int(dx_unaccel), wl_fixed_to_int(dy_unaccel));
}
}
+static void
+_ecore_wl2_input_device_manager_cb_event_boundary(void *data, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, uint32_t serial EINA_UNUSED, int32_t boundary)
+{
+ Ecore_Wl2_Display *ewd = (Ecore_Wl2_Display *)data;
+ Ecore_Wl2_Input *input;
+
+ if (!ewd) return;
+ input = ecore_wl2_input_default_input_get(ewd);
+ if (!input) return;
+
+ ERR("[tz device manager] event_boundary. (%d --> %d)", input->devmgr.last_event_boundary, boundary);
+ input->devmgr.last_event_boundary = boundary;
+}
+
static const struct tizen_input_device_manager_listener _tz_input_device_mgr_listener =
{
_ecore_wl2_input_device_manager_cb_device_add,
_ecore_wl2_input_device_manager_cb_error,
_ecore_wl2_input_device_manager_cb_block_expired,
_ecore_wl2_input_device_manager_cb_max_touch_count,
+ _ecore_wl2_input_device_manager_cb_event_boundary,
};
void
_ecore_wl2_input_device_manager_setup(Ecore_Wl2_Display *ewd, unsigned int id, unsigned int version EINA_UNUSED)
{
ewd->wl.tz_input_device_manager =
- wl_registry_bind(ewd->wl.registry, id, &tizen_input_device_manager_interface, 6);
+ wl_registry_bind(ewd->wl.registry, id, &tizen_input_device_manager_interface, 7);
tizen_input_device_manager_add_listener(ewd->wl.tz_input_device_manager,
&_tz_input_device_mgr_listener, ewd);
return EINA_TRUE;
}
//
+
+// TIZEN_ONLY(20240718) : add relative_motion grab/ungrab API
+EAPI Eina_Bool
+ecore_wl2_window_relative_motion_grab(Ecore_Wl2_Window *win, Ecore_Wl2_Pointer_Boundary boundary)
+{
+ Ecore_Wl2_Display *ewd;
+ Ecore_Wl2_Input *input;
+
+ if (!win || !win->surface) return EINA_FALSE;
+ ewd = win->display;
+ if (!ewd || !ewd->wl.tz_input_device_manager) return EINA_FALSE;
+
+ uint32_t ver = wl_proxy_get_version((struct wl_proxy *)ewd->wl.tz_input_device_manager);
+#ifdef TIZEN_INPUT_DEVICE_MANAGER_GRAB_RELATIVE_MOTION_SINCE_VERSION
+ _devicemgr_error = -1;
+ tizen_input_device_manager_grab_relative_motion(ewd->wl.tz_input_device_manager,
+ win->surface, boundary);
+ ecore_wl2_display_sync(ewd);
+
+ if (_devicemgr_error != TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE)
+ {
+ ERR("Relative motion grab failed.");
+ return EINA_FALSE;
+ }
+
+ input = ecore_wl2_input_default_input_get(ewd);
+ if (input)
+ {
+ if (boundary > 0 && boundary <= ECORE_WL2_POINTER_BOUNDARY_MAX)
+ input->devmgr.grabbed_pointer[boundary] = win;
+ }
+
+ // For Debug
+ ERR("Relative motion grab succeeded.");
+ return EINA_TRUE;
+#else
+ // For Debug
+ ERR("Relative motion grab is not supported on this version(%d).", ver);
+ return EINA_FALSE;
+#endif
+}
+
+EAPI Eina_Bool
+ecore_wl2_window_relative_motion_ungrab(Ecore_Wl2_Window *win)
+{
+ Ecore_Wl2_Display *ewd;
+ Ecore_Wl2_Input *input;
+ unsigned int boundary = 0;
+
+ if (!win || !win->surface) return EINA_FALSE;
+ ewd = win->display;
+ if (!ewd || !ewd->wl.tz_input_device_manager) return EINA_FALSE;
+
+ uint32_t ver = wl_proxy_get_version((struct wl_proxy *)ewd->wl.tz_input_device_manager);
+#ifdef TIZEN_INPUT_DEVICE_MANAGER_UNGRAB_RELATIVE_MOTION_SINCE_VERSION
+ _devicemgr_error = -1;
+ tizen_input_device_manager_ungrab_relative_motion(ewd->wl.tz_input_device_manager,
+ win->surface);
+ ecore_wl2_display_sync(ewd);
+
+ if (_devicemgr_error != TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE)
+ {
+ ERR("Relative motion ungrab failed.");
+ return EINA_FALSE;
+ }
+
+ input = ecore_wl2_input_default_input_get(ewd);
+ if (input)
+ {
+ for (int i = 1; i < ECORE_WL2_POINTER_BOUNDARY_MAX + 1; i++)
+ {
+ if (input->devmgr.grabbed_pointer[i] == win)
+ input->devmgr.grabbed_pointer[i] = NULL;
+ }
+ }
+
+ // For Debug
+ ERR("Relative motion ungrab succeeded.");
+ return EINA_TRUE;
+#else
+ // For Debug
+ ERR("Relative motion ungrab is not supported on this version(%d).", ver);
+ return EINA_FALSE;
+#endif
+}
+//