What’s the least hacky way to get something similar happening on wayland since there’s no easy way to just move the cursor to another position?
Yes, pointer warping is somewhat of an anti-feature, but in this particular case, it enables infinite panning which is really convenient to use with unconstrained input devices such as trackballs.
For infinite scroll, as mentioned already, you can use the pointer constraints extension. If you to use a pointer cursor moving around and jumping from side to side as a frame of reference, you create a pointer sprite subsurface and move it around freely. It has the added bonus of eliminating the lag that otherwise can be visible when dragging the view around. When the pointer lock is done, you can provide a hint of where the actual pointer should move to upon release.
I also came across this, but couldn’t quite figure out how to integrate it into my application. Let’s say I locked the pointer using Pointer constraints protocol | Wayland Explorer, do I still receive events via Gdk, or do I now need to get the events from wayland myself?
you create a pointer sprite subsurface
That’s exactly the kind of complexity I tried to avoid.
I just remembered something, the use of a subsurface is only necessary if you want to have the pointer still draw outside of the bounds of the window. For a “panning canvas” type GUI, I think it may be better to hide the cursor and then draw your own inside the canvas while the pointer lock is held. To make it have the appearance of wrapping around the edges you may want to draw the pointer up to four times using an algorithm like this pseudocode: