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.
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.
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.