#1149139 libwlroots-0.19: constraint->region is empty on create when region is NULL (breaks gamescope pointer grab).

Package:
libwlroots-0.19
Source:
libwlroots-0.19
Description:
Modular wayland compositor library - shared library
Submitter:
Vitali Vinahradski
Date:
2026-09-27 09:19:02 UTC
Severity:
normal
Tags:
#1149139#5
Date:
2026-09-27 09:17:12 UTC
From:
To:
Dear Maintainer,

In libwlroots-0.19 (0.19.2-1), creating a pointer constraint with a NULL
region
(entire surface) leaves the effective confinement region completely empty
until
the client subsequently commits new surface state.

This severely breaks gamescope: 3.16.20+ds-1 (which Debian builds against
system libwlroots-0.19).
When Xwayland creates a pointer constraint for a game with a pointer grab
(such as Diablo II: Resurrected under Wine/Proton), it specifies a NULL
region.
Gamescope inspects constraint->region upon receiving the new_constraint
signal
to apply cursor confinement (wlr_region_confine). Because constraint->region
is empty (0 rectangles), all pointer motion events are rejected, completely
freezing the cursor.

Root cause:
Upstream wlroots commit b25f98d58387 ("pointer-constraints: use
wlr_surface_synced.commit hook") moved update_region() inside the
if (region_resource) block in pointer_constraint_create().

Per the zwp_pointer_constraints_v1 Wayland specification:
"The region is associated with the surface, and if the client does not
change
the region, the initial region remains in effect. If region is NULL, the
whole
surface is used as the region."

When region_resource is NULL, update_region() is never called at creation
time,
leaving constraint->region uninitialized (empty).

The fix is to call update_region(constraint) unconditionally in
pointer_constraint_create().

Upstream wlroots issue:
https://gitlab.freedesktop.org/wlroots/wlroots/-/work_items/4124

The following patch resolves the issue: