cs349 - s10 - Lecture 7

CS349 - Implementing User Interfaces - Spring 2010

Public Service Annoucements

  1. Assignment 1

Clean-up


display = XOpenDisplay( "" )  // Argument is the display (e.g. citrine:0.0)
screen = DefaultScreen( display )
    bg = WhitePixel( display, screen )
    fg = BlackPixel( display, screen )
//
initSizeHints ( ..., &sizeHints )
window = XCreateSimpleWindow( display,
         DefaultRootWindow( display ),
         hint.s, hint.y, hint.width, hint.height,
         borderwidth, bordercolour, bg )
XSetStandardProperties( display, window, name, iconName, iconPixmap, argv, argc, &sizeHints )
gc = XCreateGC( diplay, window, valuemask, values )
    XSetBackground( display, gc, bg )
    XSetForeground( display, gc, fg )
XSelectInput( display, window, ButtonPressMask | KeyPressMask | ExposureMask )
XMapRaised( display, window )
// Now ready to start the event loop
while( true ) {
    start = gettimeofday( );
    if ( XEventsQueued( display, QueuedAlready ) > 0 ) {
        XNextEvent( display, &evt )
        switch ( evt.type ) {
        case ExposureEvent:
            while ( evt.count > ) XNextEvent( display, &evt );
            break;
        ...
        }
    step-animation-forward( )
    repaint( )
    now = gettimeofday( );
    working = now - start
    if ( working > LoopTime ) {
        // Report overtime
    } else {
         utime( LoopTime - working )
    }
}

Lecture 7 - Events in Transition

Better than X

The Event Loop is

For full-featured interfaces X has

There are two important steps in the evolution of interface architectures since X

  1. Allow the server to execute code provided by the client
    1. E.g., NeWS Network Extensible Window System
    2. A James Gosling production
    3. NeWS provides a PostScript engine in the server
    4. Client downloads Object-Oriented PostScript code to the server
      • repaint is conceptually simple
      • input can be defined
    5. Only obsessives liked it = Not a success.
  2. Put the entire interface on the server
    1. Special language for programming interfaces: Java
    2. The server is now `thick', running a general-purpose programming language.
      • brings Unix into line with MacOS and Windows
      • which assume that the server & client are monolithic
    3. The JFC have a rich library of interface components

This is called the `wheel of reincarnation'.


Return to: