Hello there!
I imagine this is a fairly common problem, but I haven’t been able to find
anything to help me in the archives of this mailing list. I’m somewhat of a
newbie to Xlib, GLX, and SDL, so bear with me here.
My application is a 3D engine which I am porting from Win32 to linux. I made
two versions: one where I used Xlib, GLX, DGA, etc., myself, and one in which I
simply use SDL to handle everything for me (OpenAL is used for sound in both
cases, though). You should know that the version of SDL I am working with is
1.1.8–I’m afraid I haven’t had a chance to check out 1.2.0 yet.
My application calls SDL_SetVideoMode() to achieve fullscreen under OpenGL. I
also grab the input, though this is somewhat redundant I believe in fullscreen.
When a new window from another application (specifically gaim or kit, my AIM
clones) gains keyboard focus, SDL automatically drops out of fullscreen, and
lets the new window raise itself over the engine window. Although the new
window technically has keyboard focus, I cannot give it any input (possibly
because the SDL X11 Grab of the keyboard is still in effect?). Mouse is also
unresponsive. I end up having to switch to a VC to kill the 3D engine
process, but that means SDL didn’t properly release the DGA mouse, so my mouse
is still unresponsive, requiring me to navigate to a shell in X11 via keyboard
and start up another program that uses DGA to get my mouse back. (Note: Tux
Racer (www.tuxracer.com) behaves in the same exact manner.) This isn’t
exactly something that I would normally bitch about, but it is a problem if I
ever hope to release the application to the public. I can get around this
slightly by simply releasing my input grab upon receipt of a SDL_APPINPUTFOCUS
loss event, but I’d much rather have SDL just not even budge in the first
place when it gets a FocusOut: that is, don’t let keyboard focus change, don’t
let the foreign window raise itself over ours, and don’t toggle fullscreen.
This is exactly how my native linux/X11, non-SDL port of the engine works.
I’ve been experimenting with various Xlib hacks within my app’s SDL code to no
avail. Does anyone know a way of getting SDL to stay on top of the screen,
come hell or high water? I hope it’s not just something that I missed in the
docs…
Possibly pertinent information:
Window Manager: WindowMaker
XFree86 4.0.2
SDL 1.1.8
Thank you very much in advance…
Harris