I replied to a reply that snipped too much of this (I was thinking more of the full-screen fully immersive use case).

If all you are looking for is some way to prevent the cursor from leaving a Window, there might be a way to do it, but the implications of this would need to be carefully thought through. And there would need to be a way (at least by default) to exit out of this mode like there is for full-screen. I'm still unsure about the "mouse doesn't move" part of this.

-- Kevin



On 12/17/2020 9:17 AM, Almas Baimagambetov wrote:
Hi,

Johan Vos and I had a quick chat about this feature and he suggested it
might be a good idea to start a discussion.

*Use case:* 3D games or 3D modelling tools, where the application "grabs"
(gets exclusive control of) the mouse and moving the mouse doesn't move the
cursor.

*Feature:* Allow to confine the mouse to a window. The cursor is centered
on the window and does not move/leave the window, whilst all mouse move
events are reported normally. Since this is already provided by native code
(e.g. Windows API), an implementation of this would probably be a wrapper,
similar to the wrapper that the SDL library provides:
https://wiki.libsdl.org/SDL_SetWindowGrab

*Possible high-level API:*

Window window = ...
window.setMouseGrabbed(true);

*Alternatives*:

I've tried working around this by using Robot API, but it isn't quite the
same.

Kind regards, Almas

Reply via email to