SDL boffins -
docs.html of SDL tarball says:
Please send bug reports or questions to the SDL mailing list:
http://www.libsdl.org/mailing-list.php
I’m using Gentoo Linux, kernel 2.6.8-rc2, single AMD Athlon XP, and SDL-1.2.7.
User “root” on my machine does not have X authorization.
If I forget to run “xhost +” before running an SDL application
as root, the screen goes blank and keyboard input (including
ctl-alt-del and ctl-alt-bkspc) is ignored. The only way out is
hardware reset or power off/on.
A crude workaround to fix this complaint is:
— src/video/x11/SDL_x11video.c.orig 2004-02-18 19:22:09.000000000 +0200
+++ src/video/x11/SDL_x11video.c 2004-07-22 08:45:59.926688576 +0200
@@ -94,6 +94,7 @@
display = XOpenDisplay(NULL);
if ( display != NULL ) {
XCloseDisplay(display);
-
exit; } return(display != NULL);
}
After a full rebuild of SDL with this change in place:
asterix:test> pwd
/home/bobb/SDL-1.2.7/test
asterix:test> id
uid=0(root) gid=0(root)
asterix:test> ./testwm
Xlib: connection to “:0.0” refused by server
Xlib: No protocol specified
Xlib: connection to “:0.0” refused by server
Xlib: No protocol specified
Couldn’t initialize SDL: No available video device
asterix:test>
Behavior is the same if the patch uses “_exit” instead of “exit”.
This still isn’t quite what I’d expect. A typical X utility gives:
asterix:test> /usr/X11R6/bin/xdpyinfo
Xlib: connection to “:0.0” refused by server
Xlib: No protocol specified
/usr/X11R6/bin/xdpyinfo: unable to open display “:0.0”.
asterix:test>
The X utility shows one pair of X error messages, while
the SDL utility shows two pair.
Can someone give me a clean and thorough fix for this,
so that applications using libsdl exit gracefully if the user
does not have X authorization, without additional X test
code in the application?
Thanks,
Bob Barry