Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!rutgers!ucla-cs!zen!ucbvax!hplabs!hp-pcd!hpcvlo!julie From: julie@hpcvlo.HP.COM (Julie Skeen) Newsgroups: comp.windows.x Subject: Re: Xr11 Example Programs (fixes) Message-ID: <3940059@hpcvlo.HP.COM> Date: 28 Dec 87 22:19:48 GMT References: <3940058@hpcvlo.HP.COM> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 81 /* * Hello World using X */ #include main() { Display *display; int screen; GC gc; Window windowId; Font f; unsigned long border, background; XSetWindowAttributes wAttribs; /* 1. Open the display and default screen specified by the environment variable DISPLAY. */ if ((display=XOpenDisplay (0)) == 0) { printf ("cannot create a window on %s\n", getenv ("DISPLAY")); exit (1); } screen = DefaultScreen (display); border = BlackPixel (display, screen); background = WhitePixel (display, screen); /* 2. Create a window and put it on the display. */ windowId = XCreateSimpleWindow (display, RootWindow(display, screen), 50, 50, 400, 200, 3, border, background); wAttribs.override_redirect = 1; XChangeWindowAttributes (display, windowId, CWOverrideRedirect, &wAttribs); XMapWindow (display, windowId); /* 3. Create a Graphics Context. */ gc = XCreateGC (display, windowId, 0, 0); /* 4. Send "Hello World" to the window. */ XDrawString (display, windowId, gc, 100, 80, "Hello World", 11); /* 5. Send all of those instructions to the X window server to process. */ XFlush (display); /* 6. Sleep, Close Display, and exit. */ sleep (10); XCloseDisplay (display); }