This seems to work for X11, but under Wayland this doesn't properly capture the mouse pointer. In multi-display use, the mouse can leave the game window and causes all sorts of issues.
Camera control is lost
Clicking while cursor is off-window minimizes WT and sets focus to whatever was under the mouse pointer
I'm not too familiar with X11 and Wayland, but I suspect that using XGrabPointer and XUngrabPointer instead should fix the issue in Wayland, as Wayland has a compatibility layer to X11's API.
XGrabPointer has a confine_to parameter where the window the cursor should be confined to can be specified.
https://github.com/GaijinEntertainment/DagorEngine/blob/6221a23ace14a8d1af7ba6896fb15d8f52580cd2/prog/engine/drv/hid_mouse/linux_ms_api.cpp#L95
This seems to work for X11, but under Wayland this doesn't properly capture the mouse pointer. In multi-display use, the mouse can leave the game window and causes all sorts of issues.
I'm not too familiar with X11 and Wayland, but I suspect that using
XGrabPointer
andXUngrabPointer
instead should fix the issue in Wayland, as Wayland has a compatibility layer to X11's API.XGrabPointer
has aconfine_to
parameter where the window the cursor should be confined to can be specified.https://github.com/GaijinEntertainment/DagorEngine/blob/6221a23ace14a8d1af7ba6896fb15d8f52580cd2/prog/engine/drv/hid_mouse/linux_ms_api.cpp#L98
I suspect this should be implemented and call
XUngrabPointer
.