[Xr] What happended to the idea of getting rid of the xrs argument?

Bill Spitzak spitzak at d2.com
Wed Jun 11 09:22:48 PDT 2003


On Thursday 05 June 2003 04:41 pm, Robert Wittams wrote:

> So how the hell does fltk draw on X? Does it just pull Drawables out of
> the air? No, it stores them in global variables. If the rendering
> handle for one system is in a global variable, then its very likely
> that the handle for any other rendering system should be too...

I don't seem to be explaining the problem I'm having.

Of course fltk can be written to store the xrs in a global variable, and that 
is exactly what I'm going to do.

The problem is that the programmer now has to call "fltkRectangle" rather 
than "XrRectangle". This immediately makes their drawing code non-portable to 
other toolkits, which are unlikely to implement "fltkRectangle".

I think this non-portability is a handicap. My "proof" (if there is any) is 
in the popularity of OpenGL and the fact that people can call OpenGL directly 
from every toolkit in the world, but nobody calls Xlib or GDI32 or DirectX 
without making lots of toolkit-specific code. I have certainly found that a 
block of Glut code that draws OpenGL can be cut and pasted with NO changes 
into an fltk program, into a Qt program, and into an MFC program. This is 
despite the fact that the "context creation" is vastly different in each of 
these toolkits. Therefore I believe the reason for this is that there is no 
"context" argument.

If code could be cut & pasted without changes it would help a lot for 
matching appearances between programs or making portable "theme plugins". It 
would also make it lots easier to write libraries that lie atop Xr that can 
be called from different toolkits. And it would make demos of how to use Xr 
much easier to write and test.

-- 
                   ,~,~,~,~ ~ ~ ~ ~
     /\_       _|_========___         Bill Spitzak
 ~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com




More information about the cairo mailing list