// For Debug
ERR("[locked pointer] locked");
- input = data;
- if (!input) return;
- input->pointer_locked = EINA_TRUE;
-
- window = input->focus.pointer;
+ window = data;
if (!window) return;
+ window->ptr_constraints.pointer_locked = EINA_TRUE;
+
+ input = ecore_wl2_input_default_input_get(window->display);
+ if (!input) return;
ev = calloc(1, sizeof(Ecore_Wl2_Event_Pointer_Constraints));
if (!ev) return;
// For Debug
ERR("[locked pointer] unlocked");
- input = data;
- if (!input) return;
- input->pointer_locked = EINA_FALSE;
+ window = data;
+ if (!window) return;
+ window->ptr_constraints.pointer_locked = EINA_FALSE;
- window = input->focus.pointer;
- if (!window)
- {
- window = input->focus.prev_pointer;
- if (!window)
- return;
- }
+ input = ecore_wl2_input_default_input_get(window->display);
+ if (!input) return;
ev = calloc(1, sizeof(Ecore_Wl2_Event_Pointer_Constraints));
if (!ev) return;
input->repeat.delay = input->repeat.horizontal.delay = input->repeat.vertical.delay = 0.4;
input->repeat.enabled = EINA_TRUE;
input->repeat.changed = EINA_FALSE;
- input->want_lock_pointer = EINA_FALSE;
- input->pointer_locked = EINA_FALSE;
wl_array_init(&input->data.selection.types);
wl_array_init(&input->data.drag.types);
ERR("Failed to lock pointer. constraints is NULL");
return EINA_FALSE;
}
- if (!input->wl.locked_pointer)
+ if (!win->ptr_constraints.locked_pointer)
{
- INF("Pointer Constraint: lock pointer. (region: %p)", input->lock_region);
- input->wl.locked_pointer =
+ INF("Pointer Constraint: lock pointer. (region: %p)", win->ptr_constraints.lock_region);
+ win->ptr_constraints.locked_pointer =
zwp_pointer_constraints_v1_lock_pointer(ewd->wl.pointer_constraints,
win->surface,
input->wl.pointer,
- input->lock_region,
+ win->ptr_constraints.lock_region,
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
- zwp_locked_pointer_v1_add_listener(input->wl.locked_pointer,
- &_locked_pointer_listener, input);
+ zwp_locked_pointer_v1_add_listener(win->ptr_constraints.locked_pointer,
+ &_locked_pointer_listener, win);
}
if (ewd->wl.relative_pointer_manager &&
input->wl.pointer);
zwp_relative_pointer_v1_add_listener(input->wl.relative_pointer, &_relative_pointer_listener, input);
}
- input->want_lock_pointer = EINA_TRUE;
+ win->ptr_constraints.want_lock_pointer = EINA_TRUE;
return EINA_TRUE;
}
EAPI Eina_Bool
ecore_wl2_window_pointer_constraints_unlock_pointer(Ecore_Wl2_Window *win)
{
- Ecore_Wl2_Display *ewd;
- Ecore_Wl2_Input *input;
-
EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
- ewd = win->display;
- input = ecore_wl2_input_default_input_get(ewd);
- EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE);
-
- if (input->wl.locked_pointer)
+ if (win->ptr_constraints.locked_pointer)
{
INF("Pointer Constraint: Destroy locked pointer");
- zwp_locked_pointer_v1_destroy(input->wl.locked_pointer);
- input->wl.locked_pointer = NULL;
+ zwp_locked_pointer_v1_destroy(win->ptr_constraints.locked_pointer);
+ win->ptr_constraints.locked_pointer = NULL;
}
- input->want_lock_pointer = EINA_FALSE;
+ win->ptr_constraints.want_lock_pointer = EINA_FALSE;
return EINA_TRUE;
}
ecore_wl2_window_locked_pointer_region_set(Ecore_Wl2_Window *win, int x, int y, int w, int h)
{
Ecore_Wl2_Display *ewd;
- Ecore_Wl2_Input *input;
EINA_SAFETY_ON_NULL_RETURN(win);
- ewd = win->display;
- input = ecore_wl2_input_default_input_get(ewd);
- EINA_SAFETY_ON_NULL_RETURN(input);
-
- if (input->lock_region)
+ if (win->ptr_constraints.lock_region)
{
- wl_region_destroy(input->lock_region);
- input->lock_region = NULL;
+ wl_region_destroy(win->ptr_constraints.lock_region);
+ win->ptr_constraints.lock_region = NULL;
}
if ((w > 0) && (h > 0))
{
struct wl_region *region;
+ ewd = win->display;
region = wl_compositor_create_region(ewd->wl.compositor);
if (!region)
return;
}
- input->lock_region = region;
- wl_region_add(input->lock_region, x, y, w, h);
+ win->ptr_constraints.lock_region = region;
+ wl_region_add(win->ptr_constraints.lock_region, x, y, w, h);
- if (!input->wl.locked_pointer)
+ if (!win->ptr_constraints.locked_pointer)
{
INF("No locked_pointer available. region (%d, %d) (w:%d, h:%d)", x, y, w, h);
return;
}
INF("Set region for locked_pointer (%d, %d) (w:%d, h:%d)", x, y, w, h);
- zwp_locked_pointer_v1_set_region(input->wl.locked_pointer, input->lock_region);
+ zwp_locked_pointer_v1_set_region(win->ptr_constraints.locked_pointer, win->ptr_constraints.lock_region);
}
else
{
- if (!input->wl.locked_pointer)
+ if (!win->ptr_constraints.locked_pointer)
{
INF("No locked_pointer available. region (%d, %d) (w:%d, h:%d)", x, y, w, h);
return;
}
INF("Set region for locked_pointer. NULL region");
- zwp_locked_pointer_v1_set_region(input->wl.locked_pointer, NULL);
+ zwp_locked_pointer_v1_set_region(win->ptr_constraints.locked_pointer, NULL);
}
}
EAPI void
ecore_wl2_window_locked_pointer_cursor_position_hint_set(Ecore_Wl2_Window *win, int x, int y)
{
- Ecore_Wl2_Display *ewd;
- Ecore_Wl2_Input *input;
-
EINA_SAFETY_ON_NULL_RETURN(win);
- ewd = win->display;
- input = ecore_wl2_input_default_input_get(ewd);
- EINA_SAFETY_ON_NULL_RETURN(input);
-
- if (!input->wl.locked_pointer)
+ if (!win->ptr_constraints.locked_pointer)
{
INF("No locked pointer available. cursor position hint (%d, %d)", x, y);
return;
}
INF("Set cursor position hint (%d, %d) for locked_pointer", x, y);
- zwp_locked_pointer_v1_set_cursor_position_hint(input->wl.locked_pointer,
+ zwp_locked_pointer_v1_set_cursor_position_hint(win->ptr_constraints.locked_pointer,
wl_fixed_from_int(x),
wl_fixed_from_int(y));
}