Inside SWT

Wednesday, March 28, 2007

Insights from the Xlib Programming Manual

If you think X is dead, you are wrong. Widget toolkits like GTK try to hide it, but in the end, X is still the thing that handles events and puts pixels to the screen. Sometimes we need to reach through the muck and program it. Bogdan Gheorghe, a committer in training, discovered this the other day in the official Xib Programming Manual (it's been there from day one, I knew it was there but had forgotten):


Virtual Focus Crossing and the detail Member

We will now embark on specifying the types of events sent to each window and the detail member in each event, depending on the relative position in the hierarchy of the origin window (old focus), destination window (new focus), and the pointer window (window containing pointer at time of focus change). Don't even try to figure this out unless you have to.

At least these guys are honest, but how about defining API that is simple enough that it doesn't need to come with a warning?

Steve

8 Comments:

  • Perhaps they lacked the hubris to call this API a simple one.

    By Anonymous Anonymous, at 11:42 AM  

  • Well anon-y-mouse, at the point where they had determined that the API was too complex and needed the disclaimer, they could have considered simplifying it such that they thought the disclaimer was no longer necessary.

    This post is intended to be fun, not a swipe at X Windows.

    By Blogger Steve, at 12:19 PM  

  • xlib intended to be compatible.
    there are xcb, which have lots of improvement.

    both of them allow low level access to the x protocol, which is very complex. (and you can't change the x protocol without breaking everything)

    By Anonymous Anonymous, at 12:48 PM  

  • I agree. They have shipped and cannot change it (nor did I expect them to).

    Considering when X was written, they did a bang up job of specifying and implementing it.

    By Blogger Steve, at 2:09 PM  

  • I remember mucking through that code in university, which dates both me and X.

    I remember trying to decide between X and NeWS for my thesis work, guess which won!

    Although programming your desktop application using PostScript had some cool advantages, until you got yourself into an infinite loop :(

    By Blogger Doug Schaefer, at 2:28 PM  

  • they could have considered simplifying it such that they thought the disclaimer was no longer necessary.
    They could have, and probably did.

    1. the effort needed to do that could have outweighed its benefits
    2. the problem space could be irreducibly complex
    3. the Xlib people called a spade a spade, instead of declaring that the API was simple despite evidence to the contrary.

    By Anonymous Anonymous, at 2:44 PM  

  • Anon-y-mouse, do you have an axe to grind? I have already stated that I think X Windows did a pretty good job and I am just having some fun with something in a manual.

    The 'API was simple' link you provide describes the implementation of SWT and makes no statement about the SWT API being either simple or complex.

    If you have such a statement to make, please make it directly, identify yourself and provide a concrete example rather than grep'ing the bug system for quotes that do not apply.

    By Blogger Steve, at 3:44 PM  

  • Reminds me of my favorite quote from the C++ spec:
    14.7.3-7 : The placement of explicit specialization declarations for function templates, class templates, [...], member class templates of class templates, etc., can affect whether a program is wellformed according to the relative positioning
    of the explicit specialization declarations and their points of instantiation in the translation unit as specified above and below. When writing a specialization, be careful about its location; or to make it compile will be such a trial as to kindle its selfimmolation.

    By Blogger Unknown, at 7:03 PM  

Post a Comment

<< Home