Programming with X Starter Toolkit - 3

Programming with Xt and Xlib functions. The full power of X, but you build on top of what you have already done. The example also offers the opportunity to discuss the asynchronous operation of client/server.

/*	Window that keeps disappearing    */

#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>

void hello(Widget w)
{
	put_text("The end of the world is near", 20,  20);
	xflush();
	sleep(1);
	XBell(XtDisplay(w), 100);
	xflush();
	XtVaSetValues(XtParent(w), XtNiconic, False, NULL);
	XtVaSetValues(XtParent(w), XtNiconic, True, NULL);
}

main()
{
	vis_window(hello);
}

xflush(), as well as put_text(), and vis_window() are Starter Toolkit functions.