URI: 
       tsample.c - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tsample.c (1431B)
       ---
            1 #include <X11/Intrinsic.h>
            2 
            3 /*
            4  * Disclaimer: No I don't actually code like this but this is a simple,
            5  * "Quick-n-Dirty", plain, vanilla, "No ups, No extras" piece of code.
            6  */
            7 
            8 main(argc, argv)
            9 int argc;
           10 char **argv;
           11 {
           12     Display *dpy;
           13     int screen;
           14     Window window;
           15     XEvent event;
           16     extern Boolean use_separate_lines;
           17 
           18     if (!(dpy = XOpenDisplay(""))) {
           19         printf("Failed to open display...\n");
           20         exit(1);
           21     }
           22     screen = DefaultScreen(dpy);
           23 
           24     window = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), 100, 100,
           25       300, 200, 2, BlackPixel(dpy, screen), WhitePixel(dpy, screen));
           26 
           27     XSelectInput(dpy, window, KeyPressMask | KeyReleaseMask | ButtonPressMask |
           28       ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
           29       PointerMotionMask | PointerMotionHintMask | Button1MotionMask |
           30       Button2MotionMask | Button3MotionMask | Button4MotionMask |
           31       Button5MotionMask | ButtonMotionMask | KeymapStateMask |
           32       ExposureMask | VisibilityChangeMask | StructureNotifyMask |
           33       SubstructureNotifyMask | SubstructureRedirectMask | FocusChangeMask |
           34       PropertyChangeMask | ColormapChangeMask | OwnerGrabButtonMask);
           35 
           36     XMapWindow(dpy, window);
           37 
           38     /* set this to false to make ShowEvent take up less vertival space */
           39     use_separate_lines = True;
           40 
           41     while (1) {
           42         XNextEvent(dpy, &event);
           43         printf("Detail of %s event:\n", GetType(&event));
           44         ShowEvent(&event);
           45         printf("\n\n");
           46     }
           47 }