next up previous index
Next: ProTcXlECLiPSe Up: Introduction Previous: Why Tcl/Tk?

Why Xlib?

Xlib, the X library, is the lowest level of programming interface to the X11 window system. It is a complete interface to the X server and it offers more features than most of X11 toolkits, because the toolkits are built on top of it and they usually do not provide all of the low-level functions to the user.

The main advantage of Xlib is its speed. Xlib functions do nothing but modify the display or handle events, they have no internal memory management, active objects or other features. The disadvantage, on the other hand, is that it is necessary to understand the full Xlib concept of windows, attributes, graphics contexts, color etc. in order to use Xlib and even then it is quite difficult to set up a display using Xlib. It is thus very much the opposite of Tcl/Tk, which is easy to use, quite powerful, but on the other hand sometimes too slow as far as simple display is concerned.

The combination of these two interfaces promises to offer an optimal functionality for most GUIs. While Tk gives the access to various widgets like buttons, canvases, scrollbars and to a geometry manager, a direct Xlib interface makes it possible to perform very fast graphical output and/or to display a large number of graphical elements. Tk alone is not suitable for this, because is stores data for all displayed objects in its private memory. When a program displays the content of a large external database, the data from the database is effectively copied into Tk's private memory, which is not only redundant, it is also much less efficient than data handling in the database itself.

Xlib can be used inside ProTcXl for two main purposes:



next up previous index
Next: ProTcXlECLiPSe Up: Introduction Previous: Why Tcl/Tk?



Micha Meier
Tue Jul 2 09:49:39 MET DST 1996