[cairo] Cairo and multiple X11 windows

Jim Gettys jg at laptop.org
Fri Aug 1 09:13:09 PDT 2008

On Fri, 2008-08-01 at 15:30 +0200, W.Boeke wrote:

> Are you shure that creating many windows in X is inefficient? My program
> instantiates 100's of them, still the graphics are fast, even on an old
> slow box and on the Asus eeePC. Running the 'top' command reveals that the
> CPU is hardly occupied by the graphics, only when a window must be redrawn
> because it is becoming less obscured by other windows. In this case
> it probably makes no difference whether you have one big window or many
> subwindows however.

Subwindows in X are indeed quite efficient.

But most of the modern tookits (e.g. Qt, GTK+) are cross platform, and
written therefore to work despite the lack of efficient subwindows on
other platforms.... Ergo the decline in subwindow's use...
                       - Jim
> I searched on the internet for "many child windows", and came across the
> following text:
>     Our FGL2C-compiled programs generate many childwindows. The worst case
>     is 500 entrys,which is not possible under 16-bit(WIN32s),because the
>     resources are down after about 300 entrys. This is the point, where all
>     Tk-Window-Ports are slow. Under GNU/Linux with X11, 300 Childwindows don't
>     consume any time for creation an displaying, even a 368-machine runs with
>     satisfying results , but under Windows...
> Anyhow, using many windows has its advantages. E.g. you can set event masks
> for each window individually. If you use one big window and you need
> at one place the ButtonMotionMask, then this must be set for the whole
> window, which will generate an awful lot of unused events. And clearing
> a window will have to be done by painting it, which is slower then XClearWindow().
> And different cursor shapes for different window parts becomes (IMHO)
> impossible. Probably the last word isn't yet said about the subject.
> > FLTK's cairo support reuses exactly one cairo_t for drawing every 
> > window, because I had the same concerns about efficiency. This is the 
> > exact code it uses when it wants to change what window it draws into. 
> > Carl may have some comments on this?
> Thanks for this code! I am going to borrow it!
> Regards,
> Wouter
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
Jim Gettys <jg at laptop.org>
One Laptop Per Child

More information about the cairo mailing list