( karesz5613 | 2012. 12. 26., sze - 21:12 )

Ez pedig a forrás:

/*
* This is an X window program using X11 API,
* that opens the display and creates a window, waits
* 60 seconds, then destroys the window before ending.
*/
#include
#include
#include

main(argc, argv)
int argc;
char *argv[];
{
Display *dp;
Window w;
/*
* X will lookup the value of the DISPLAY global variable in
* the CENV group when passed a NULL pointer in XOpenDisplay.
*/

dp = XOpenDisplay(NULL);

/*
* Create a 200X200 window at xy(40,40) with black border and name.
*/

w = XCreateSimpleWindow(dp, RootWindow(dp, 0),
40, 40, 200, 200, 2, BlackPixel(dp, 0),
WhitePixel(dp, 0));
XStoreName(dp, w, “VM/CMS X Sample”);
XSetIconName(dp, w, “X Sample”);

/*
* Map the window to the display.
* This will cause the window to become visible on the screen.
*/

XMapWindow(dp, w);

/*
* Force X to write buffered requests.
*/

XFlush(dp);

fprintf(stderr, “Going to sleep now.... 60 seconds...\n”);
system(“CP SLEEP 60 SEC”);
fprintf(stderr, “Okay, back!\n”);

/*
* Destroy the window and end the connection to the X Server.
*/

XDestroyWindow(dp, w);
XCloseDisplay(dp);
}

Nem én írtam csak tanulási céllal foglalkozok vele. Neten találtam már meg nem mondom, hol.