1 0206bd51 2008-01-30 rsc #include <X11/Intrinsic.h>
4 0206bd51 2008-01-30 rsc * Disclaimer: No I don't actually code like this but this is a simple,
5 0206bd51 2008-01-30 rsc * "Quick-n-Dirty", plain, vanilla, "No ups, No extras" piece of code.
8 0206bd51 2008-01-30 rsc main(argc, argv)
12 0206bd51 2008-01-30 rsc Display *dpy;
14 0206bd51 2008-01-30 rsc Window window;
15 0206bd51 2008-01-30 rsc XEvent event;
16 0206bd51 2008-01-30 rsc extern Boolean use_separate_lines;
18 0206bd51 2008-01-30 rsc if (!(dpy = XOpenDisplay(""))) {
19 0206bd51 2008-01-30 rsc printf("Failed to open display...\n");
22 0206bd51 2008-01-30 rsc screen = DefaultScreen(dpy);
24 0206bd51 2008-01-30 rsc window = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), 100, 100,
25 0206bd51 2008-01-30 rsc 300, 200, 2, BlackPixel(dpy, screen), WhitePixel(dpy, screen));
27 0206bd51 2008-01-30 rsc XSelectInput(dpy, window, KeyPressMask | KeyReleaseMask | ButtonPressMask |
28 0206bd51 2008-01-30 rsc ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
29 0206bd51 2008-01-30 rsc PointerMotionMask | PointerMotionHintMask | Button1MotionMask |
30 0206bd51 2008-01-30 rsc Button2MotionMask | Button3MotionMask | Button4MotionMask |
31 0206bd51 2008-01-30 rsc Button5MotionMask | ButtonMotionMask | KeymapStateMask |
32 0206bd51 2008-01-30 rsc ExposureMask | VisibilityChangeMask | StructureNotifyMask |
33 0206bd51 2008-01-30 rsc SubstructureNotifyMask | SubstructureRedirectMask | FocusChangeMask |
34 0206bd51 2008-01-30 rsc PropertyChangeMask | ColormapChangeMask | OwnerGrabButtonMask);
36 0206bd51 2008-01-30 rsc XMapWindow(dpy, window);
38 0206bd51 2008-01-30 rsc /* set this to false to make ShowEvent take up less vertival space */
39 0206bd51 2008-01-30 rsc use_separate_lines = True;
42 0206bd51 2008-01-30 rsc XNextEvent(dpy, &event);
43 0206bd51 2008-01-30 rsc printf("Detail of %s event:\n", GetType(&event));
44 0206bd51 2008-01-30 rsc ShowEvent(&event);
45 0206bd51 2008-01-30 rsc printf("\n\n");