Pointer confinement region calculated incorrectly with an offset surface input region
Affected version
- Fedora 35
- GNOME 41.5 on Wayland
Bug summary
When setting an input region on a surface and then confining the pointer with a set of constraints, the left edge of the confinement region is calculated based on the x coordinate of the input region, but the right side of the confinement region is calcuated based on the absolute coordinates of the confinement area + the width of the confinement region.
Steps to reproduce
A program that demonstrates the issue is below. A surface of 1920x1080 is created, a centered input region of 1024x1080 is created (offset by +448 on the x axis), and a confinement region with an offset of 0x0 and width/height of 1024x1080 is created.
What happened
The left edge of the confinement region aligns with the flashing area as it's offset based on the left edge of the surface input region, however the right edge of the confinement region is is the middle of the flashing zone (at position 576) as it's calculated based on the absolute left edge of the window + the width of the confinement region.
What did you expect to happen
The right edge of the confinement region should be calculated based the input region offset + the confinement region offset + the width, not the edge of the surface + the confinement region offset + the width.