Linux and SDL_WINDOW_INPUT_GRABBED window flag

When creating windows with the SDL_WINDOW_INPUT_GRABBED flag, the mouse is locked to the window as expected, but I am unable to alt-tab or in any way navigate away from the window once it has grabbed focus. I am essentially locked forever until conditions that call SDL_QUIT occur. Normally I wouldn’t care about this, but when doing live debugging and performance analysis, I can’t switch out of the running window because it’s locked for eternity! When active breakpoints are hit in my debugger (MonoDevelop), the window will actually go into the background as if the debugger is taking over, but the mouse is locked to the borders of the window even though it’s no longer visible.

This seems to only occur on my Linux box (Debian, XFCE desktop). On my Windows box (8.1), I can alt-tab as normal to switch to another window.

Anyone have suggestions?

I’m also interested in this.

When I was implementing input grabbing for OpenTK http://www.opentk.com,
I faced the same issue in the X11 backend. IIRC, my workaround was to avoid
grabbing in favor of warping the cursor to the middle of the window, iff
the cursor is invisible.

A quick look shows that the XInput 2.1 extension might offer a better
solution with XIGrabDevicehttp://www.x.org/archive/X11R7.5/doc/man/man3/XIGrabDevice.3.htmland
XIGrabDeviceWithConfine:

The X server automatically performs an XIUngrabDevice request if the event

window for an active device grab becomes not viewable.

If anyone has any better ideas, I’d love to hear them. Wine has also
struggled with this issue, so it might be worth taking a look at their new
XInput 2/2.1 backend.

2014-02-22 15:32 GMT+01:00 arosian <justin.d.skiles at gmail.com>:> When creating windows with the SDL_WINDOW_INPUT_GRABBED flag, the mouse

is locked to the window as expected, but I am unable to alt-tab or in any
way navigate away from the window once it has grabbed focus. I am
essentially locked forever until conditions that call SDL_QUIT occur.
Normally I wouldn’t care about this, but when doing live debugging and
performance analysis, I can’t switch out of the running window because it’s
locked for eternity! When active breakpoints are hit in my debugger
(MonoDevelop), the window will actually go into the background as if the
debugger is taking over, but the mouse is locked to the borders of the
window even though it’s no longer visible.

This seems to only occur on my Linux box (Debian, XFCE desktop). On my
Windows box (8.1), I can alt-tab as normal to switch to another window.

Anyone have suggestions?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

No idea if you’re using fullscreen, but if you do:
Does it work if you use SDL_WINDOW_FULLSCREEN_DESKTOP instead of SDL_WINDOW_FULLSCREEN?