Alexandros Frantzis (@afrantzis) commented about dlls/winewayland.drv/wayland_pointer.c:
if (!needs_lock && pointer->zwp_locked_pointer_v1) {
POINT cursor_pos;
struct wayland_win_data *data;
struct wayland_surface *surface;
int warp_x, warp_y;
NtUserGetCursorPos(&cursor_pos);
if (!(data = wayland_win_data_get(wl_surface_get_user_data(wl_surface))))
We would like to avoid acquiring the `win_data_mutex` while holding the `wayland_pointer.mutex` (which is always held while calling `wayland_pointer_update_constraint`), to avoid potential deadlocks (even if it's not a problem now, it could become one in the future). Perhaps calculate the cursor position externally and pass it in, like we do for the confine rect in `WAYLAND_ClipCursor`?
Passing in the cursor position in `wayland_pointer_clear_constraint` would be more involved (since the function itself is called under pointer mutex lock), but I think we can ignore that case anyway since we call that function only on surface destruction.