Alexandros Frantzis (@afrantzis) commented about dlls/winewayland.drv/wayland_pointer.c:
wayland_win_data_release(data); pthread_mutex_lock(&pointer->mutex);
- if (wl_surface && pointer->pending_warp)
- {
/* If a warp is pending, ensure the pointer is locked at least
* temporarily before updating the position hint. It'll be unlocked
* after setting the position hint if it wasn't locked previously. */
wayland_pointer_update_constraint(wl_surface,
clip ? &confine_rect : NULL,
covers_vscreen);
Since the warp emulation relies on multiple calls on this function to work, I think it's clearer if we implemented the logic completely externally. Perhaps something along the lines of:
``` static void wayland_pointer_update_constraint(struct wl_surface *wl_surface, RECT *confine_rect, BOOL covers_vscreen, BOOL force_lock) ...
if (wl_surface && pointer->pending_warp) { wayland_pointer_update_constraint(wl_surface, NULL, FALSE, TRUE); pointer->pending_warp = FALSE; } ```
As a bonus `wayland_pointer_update_constraint` function remains idempotent (for the same arguments) in terms of the final constraint state.