Blob


1 #include <X11/Intrinsic.h>
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 */
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;
18 if (!(dpy = XOpenDisplay(""))) {
19 printf("Failed to open display...\n");
20 exit(1);
21 }
22 screen = DefaultScreen(dpy);
24 window = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), 100, 100,
25 300, 200, 2, BlackPixel(dpy, screen), WhitePixel(dpy, screen));
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);
36 XMapWindow(dpy, window);
38 /* set this to false to make ShowEvent take up less vertival space */
39 use_separate_lines = True;
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 }