The SDL forums have moved to
This is just a read-only archive of the previous forums, to keep old links working.

SDL Forum Index
Simple Directmedia Layer Forums
[PATCH] Grabbing the keyboard in X11


I have just noticed that the Alt-Tab window management key combination
does not do its job of switching windows on X11 (with the Unity shell on
Ubuntu 12.04), in case window input is grabbed for a fullscreen window
using SDL_SetWindowGrab.

The reason: Keyboard input is grabbed. At least, you cannot change to a
different window using Alt-Tab, although other key combinations used for
desktop/window management seem to work (like Ctrl-Alt-RightArrow for
changing to a different workspace).

This post is also (sort of) an attempt to reply to an older post on the
list, which also had a minor patch. A copy of the patch, along with the
original post, may currently be found here (yeah, the "bin" file should
be opened as a textual one):

In case you don't trust this, I have also attached a copy of the patch
to this mail (using what is apparently the original filename).

Apart from this patch, there is a problematic workaround I can suggest:
Call SDL_SetWindowGrab(SDL_FALSE) if the window is fullscreen. There is
one limitation with that (which may not be the only one): If
SDL_SetRelativeMouseMode(SDL_TRUE) has also been called, then no
relative mouse motion event arrives while a mouse button is pressed. I
can't tell for sure what's the case with SDL_FALSE, as it's less relevant.


SDL mailing list