Graphics code in SDL_main.c seems to prohibit text mode interface in Mac OS X

Hi,

my SDL application provides a text mode interface for users who want to
run it remotely without graphics via a SSH login.

Unfortunately this doesn’t seem to work in Mac OS X. Before my main()
function is reached, the program already terminates with the following
message if the SSH user is not the same who is currently logged in
graphically:

“kCGErrorRangeCheck : Window Server communications from outside of
session allowed for root and console user only
INIT_Processeses(), could not establish the default connection to the
WindowServer.Abort trap”

I suspect that the problem are all the graphical things done in
SDL_main.c, which require a connection to the WindowServer…?

I found other messages on the list, which also requested that this
graphics initialization code should move to SDL_Init for various reasons.

Does it make sense if I move the code out of SDL_main.c and submit a
patch, or is there a good reason why it has to be this way?

Thanks for your help and comments,
Elmar

Hi again,

after some fiddling, I found a hack, which I post here for everyone who
also needs a solution desperately. This hack checks for a command line
parameter ‘-txt’ and runs your application’s main() directly, without
first connecting to the WindowServer:

In src/main/macosx/SDLMain.m

insert
int i;
for (i=0;i<argc;i++)
{ if (!strcmp(argv[i],"-txt")) return(SDL_main(argc,argv)); }
before
#if SDL_USE_NIB_FILE
[SDLApplication poseAsClass:[NSApplication class]];
NSApplicationMain (argc, argv);
#else
CustomApplicationMain (argc, argv);
#endif

Elmar Krieger wrote:> Hi,

my SDL application provides a text mode interface for users who want to
run it remotely without graphics via a SSH login.

Unfortunately this doesn’t seem to work in Mac OS X. Before my main()
function is reached, the program already terminates with the following
message if the SSH user is not the same who is currently logged in
graphically:

“kCGErrorRangeCheck : Window Server communications from outside of
session allowed for root and console user only
INIT_Processeses(), could not establish the default connection to the
WindowServer.Abort trap”

I suspect that the problem are all the graphical things done in
SDL_main.c, which require a connection to the WindowServer…?

I found other messages on the list, which also requested that this
graphics initialization code should move to SDL_Init for various reasons.

Does it make sense if I move the code out of SDL_main.c and submit a
patch, or is there a good reason why it has to be this way?

Thanks for your help and comments,
Elmar


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