From hin-tak.leung at cimr.cam.ac.uk  Mon Jun 18 13:56:40 2007
From: hin-tak.leung at cimr.cam.ac.uk (Hin-Tak Leung)
Date: Mon, 18 Jun 2007 12:56:40 +0100
Subject: [Rd] X11 help please
In-Reply-To: <Pine.LNX.4.64.0706180419440.7264@gannet.stats.ox.ac.uk>
References: <46759924.5020103@stats.uwo.ca>
	<Pine.LNX.4.64.0706180419440.7264@gannet.stats.ox.ac.uk>
Message-ID: <467672F8.9040105@cimr.cam.ac.uk>

Prof Brian Ripley wrote:
> rgl normally works under Xvfb on Linux: we've been using that for the 
> testing 'for ever'.
> 
> However R should not 'crash' on an error in a package, and the X11 device 
> has error handlers set up by
> 
>  	XSetErrorHandler(R_X11Err);
>  	XSetIOErrorHandler(R_X11IOErr);
> 
> I don't see anything comparable in rgl.
> 
> The error seems to be in the attributes, so I would have a closer look at 
> those.  In particular, how are you running Xvfb?: you may need something 
> like
> 
> Xvfb :5 -screen 0 1280x1024x24 &
> setenv DISPLAY :5
> 
> to ensure that you have a reasonable visual and hence colormap.
> (On my system the default is 12 bit.)

That's interesting - my first thought of Duncan's problem was unusual
colour depth as well, but I thought very few people run their X servers
in anything other than 24-bit or true-color mode these days (and any
MacOSX hardware should be capable of that anyway); if 12-bit is the
Xvfb default it is hightly likely that's the reason.

I have also seen that sort of error messages in CJK related issues,
if the X server's font path has some unsual and broken fonts; so it 
might be a good idea to disable any non-english locale, etc and try not 
to do anything clever in that direction for the time being.

- I do run my old laptop at 16-bit only, as it is old and I get better 
performance that way with little sacrifice on visual appearance,
but that's my choice...

> On Sun, 17 Jun 2007, Duncan Murdoch wrote:
> 
>> The rgl package currently crashes R when running under Xvfb (the
>> "virtual frame buffer" server), at least on MacOSX.  It makes sense that
>> it shouldn't be able to work there (it needs interactivity), but I don't
>> know how to detect the problems before they cause the crash.
>>
>> Currently the error happens the first time you try to open an rgl
>> window; when rgl calls XCreateWindow R crashes with the error message
>>
>> X Error of failed request:  BadMatch (invalid parameter attributes)
>>  Major opcode of failed request:  1 (X_CreateWindow)
>>  Serial number of failed request:  28
>>  Current serial number in output stream:  29
>>
>> I've checked and as far as I can see all the parameters we're sending to
>> XCreateWindow are valid, but I might have missed something:  I don't
>> know much about X11 programming.  (The call is
>>
>>  ::Window xwindow = XCreateWindow(
>>    xdisplay, RootWindow(xdisplay, DefaultScreen(xdisplay)),
>>    0, 0, 256, 256, 0,
>>    xvisualinfo->depth,
>>    InputOutput,
>>    xvisualinfo->visual,
>>    valuemask,
>>    &attrib
>>  );
>>
>> but without context that's probably not worth much to others.)
>>
>>
>> Are there any experienced X11 programmers out there who can suggest what
>> to do next?
>>
>> Duncan Murdoch
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>



[Rd] X11 help please
Hin-Tak Leung