/** @internal */
typedef void (*Ecore_Wl2_Unbind_Cb)(struct wl_resource *resource);
+// TIZEN_ONLY(20230906) : add events for pointer_constraints
+/** @internal */
+typedef struct _Ecore_Wl2_Event_Pointer_Constraints
+{
+ unsigned int win;
+ int x;
+ int y;
+ Eina_Bool locked;
+ Eina_Bool confined;
+} Ecore_Wl2_Event_Pointer_Constraints;
+
EAPI extern int ECORE_WL2_EVENT_DISCONNECT; /** @since 1.18 */
EAPI extern int ECORE_WL2_EVENT_CONNECT; /** @since 1.18 */
EAPI extern int ECORE_WL2_EVENT_GLOBAL_ADDED; /** @since 1.17 */
EAPI extern int ECORE_WL2_EVENT_WINDOW_INTERACTIVE_RESIZE_DONE;
//
+// TIZEN_ONLY(20230906) : add events for pointer_constraints
+EAPI extern int ECORE_WL2_EVENT_POINTER_CONSTRAINTS;
+//
/**
* @internal
EAPI int ECORE_WL2_EVENT_WINDOW_INTERACTIVE_MOVE_DONE = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_INTERACTIVE_RESIZE_DONE = 0;
//
+// TIZEN_ONLY(20230906) : add events for pointer_constraints
+EAPI int ECORE_WL2_EVENT_POINTER_CONSTRAINTS = 0;
+//
EAPI int _ecore_wl2_event_window_www = -1;
EAPI int _ecore_wl2_event_window_www_drag = -1;
ECORE_WL2_EVENT_WINDOW_INTERACTIVE_MOVE_DONE = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_INTERACTIVE_RESIZE_DONE = ecore_event_type_new();
//
+// TIZEN_ONLY(20230906) : add events for pointer_constraints
+ ECORE_WL2_EVENT_POINTER_CONSTRAINTS = ecore_event_type_new();
+//
if (!no_session_recovery)
no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY");
ECORE_WL2_EVENT_WINDOW_DESTROY,
// TIZEN_ONLY(20211120)
ECORE_WL2_EVENT_WINDOW_INTERACTIVE_MOVE_DONE,
- ECORE_WL2_EVENT_WINDOW_INTERACTIVE_RESIZE_DONE
+ ECORE_WL2_EVENT_WINDOW_INTERACTIVE_RESIZE_DONE,
+//
+// TIZEN_ONLY(20230906) : add events for pointer_constraints
+ ECORE_WL2_EVENT_POINTER_CONSTRAINTS
//
);
static void
_locked_pointer_cb_locked(void *data, struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1 EINA_UNUSED)
{
- Ecore_Wl2_Input *input = (Ecore_Wl2_Input *)data;
+ Ecore_Wl2_Input *input;
+ Ecore_Wl2_Window *window;
+ Ecore_Wl2_Event_Pointer_Constraints *ev;
// For Debug
ERR("[locked pointer] locked");
+
+ input = data;
+ if (!input) return;
input->pointer_locked = EINA_TRUE;
+
+ window = input->focus.pointer;
+ if (!window) return;
+
+ ev = calloc(1, sizeof(Ecore_Wl2_Event_Pointer_Constraints));
+ if (!ev) return;
+
+ ev->win = window->id;
+ ev->locked = EINA_TRUE;
+ ev->confined = EINA_FALSE; // default
+ ev->x = input->pointer.sx;
+ ev->y = input->pointer.sy;
+
+ ERR("[Locked event] x=%d, y=%d", ev->x, ev->y);
+ ecore_event_add(ECORE_WL2_EVENT_POINTER_CONSTRAINTS, ev, NULL, NULL);
}
static void
_locked_pointer_cb_unlocked(void *data, struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1 EINA_UNUSED)
{
- Ecore_Wl2_Input *input = (Ecore_Wl2_Input *)data;
+ Ecore_Wl2_Input *input;
+ Ecore_Wl2_Window *window;
+ Ecore_Wl2_Event_Pointer_Constraints *ev;
// For Debug
ERR("[locked pointer] unlocked");
+
+ input = data;
+ if (!input) return;
input->pointer_locked = EINA_FALSE;
+
+ window = input->focus.pointer;
+ if (!window)
+ {
+ window = input->focus.prev_pointer;
+ if (!window)
+ return;
+ }
+
+ ev = calloc(1, sizeof(Ecore_Wl2_Event_Pointer_Constraints));
+ if (!ev) return;
+
+ ev->win = window->id;
+ ev->locked = EINA_FALSE;
+ ev->confined = EINA_FALSE; // default
+ ev->x = input->pointer.sx;
+ ev->y = input->pointer.sy;
+
+ ERR("[Unlocked event] x=%d, y=%d", ev->x, ev->y);
+ ecore_event_add(ECORE_WL2_EVENT_POINTER_CONSTRAINTS, ev, NULL, NULL);
}
static const struct zwp_locked_pointer_v1_listener _locked_pointer_listener = {