Locking mouse cursor to specific window

GTK has no API for this.

On X11, you want to look at the pointer warping API.

On Wayland, you want to read this topic.