If ClipCursor is called while the seat doesn't have a pointer and the call qualifies for locking the pointer, it would have tried to lock a null wl_pointer.
For example, I'm launching a fullscreen application (which causes ClipCursor calls on startup) in a headless compositor before I launch my virtual keyboard/pointer client. While the pointer is deinitialized and there cannot be a focused hwnd, the cursor wl_surface will not be set, making it qualify for pointer locking.
-- v2: winewayland: Require wl_pointer for pointer constraints.
From: Attila Fidan dev@print0.net
If ClipCursor is called while the seat doesn't have a pointer and the call qualifies for locking the pointer, it would have tried to lock a null wl_pointer. --- dlls/winewayland.drv/wayland_pointer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_pointer.c b/dlls/winewayland.drv/wayland_pointer.c index 6c852292c1d..509301cada4 100644 --- a/dlls/winewayland.drv/wayland_pointer.c +++ b/dlls/winewayland.drv/wayland_pointer.c @@ -688,9 +688,10 @@ static void wayland_pointer_update_constraint(struct wl_surface *wl_surface, }
needs_lock = wl_surface && (((confine_rect || covers_vscreen) && - !pointer->cursor.wl_surface) || force_lock); + !pointer->cursor.wl_surface) || force_lock) && + pointer->wl_pointer; needs_confine = wl_surface && confine_rect && pointer->cursor.wl_surface && - !force_lock; + !force_lock && pointer->wl_pointer;
if (!needs_confine && pointer->zwp_confined_pointer_v1) {
On Sat Apr 26 05:16:37 2025 +0000, Alexandros Frantzis wrote:
Another alternative would be to encode the wl_pointer requirement in `needs_lock` and `needs_confine` in `wayland_pointer_update_constraint`. This has the extra benefit that it moves us towards better handling of dynamic removals, since we will then destroy any inert zwp constraint proxies without any special code paths (we are not completely there yet, since we don't guarantee reapplication of the cursor clip on wl_pointer removal, but it's a step in the right direction). Does such a change work for your use case?
Sure, I moved it there.
This merge request was approved by Alexandros Frantzis.