summaryrefslogtreecommitdiffstats
path: root/src/cmd/rio/showevent/sample.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-01-30 10:29:17 -0500
committerRuss Cox <rsc@swtch.com>2008-01-30 10:29:17 -0500
commit0206bd5113e727870d4eb24fbd5f17843745237d (patch)
tree584bad99ee188d7582a5732d7ee106c022c9775f /src/cmd/rio/showevent/sample.c
parent52abe8e13010b21ae13d05f1428caca05aa24bdf (diff)
downloadplan9port-0206bd5113e727870d4eb24fbd5f17843745237d.tar.gz
plan9port-0206bd5113e727870d4eb24fbd5f17843745237d.zip
rio: make full-screen work properly; add showevent
Diffstat (limited to 'src/cmd/rio/showevent/sample.c')
-rw-r--r--src/cmd/rio/showevent/sample.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/cmd/rio/showevent/sample.c b/src/cmd/rio/showevent/sample.c
new file mode 100644
index 00000000..7b22e970
--- /dev/null
+++ b/src/cmd/rio/showevent/sample.c
@@ -0,0 +1,48 @@
+#include <X11/Intrinsic.h>
+
+/*
+ * Disclaimer: No I don't actually code like this but this is a simple,
+ * "Quick-n-Dirty", plain, vanilla, "No ups, No extras" piece of code.
+ */
+
+main(argc, argv)
+int argc;
+char **argv;
+{
+ Display *dpy;
+ int screen;
+ Window window;
+ XEvent event;
+ extern Boolean use_separate_lines;
+
+ if (!(dpy = XOpenDisplay(""))) {
+ printf("Failed to open display...\n");
+ exit(1);
+ }
+ screen = DefaultScreen(dpy);
+
+ window = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), 100, 100,
+ 300, 200, 2, BlackPixel(dpy, screen), WhitePixel(dpy, screen));
+
+ XSelectInput(dpy, window, KeyPressMask | KeyReleaseMask | ButtonPressMask |
+ ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
+ PointerMotionMask | PointerMotionHintMask | Button1MotionMask |
+ Button2MotionMask | Button3MotionMask | Button4MotionMask |
+ Button5MotionMask | ButtonMotionMask | KeymapStateMask |
+ ExposureMask | VisibilityChangeMask | StructureNotifyMask |
+ SubstructureNotifyMask | SubstructureRedirectMask | FocusChangeMask |
+ PropertyChangeMask | ColormapChangeMask | OwnerGrabButtonMask);
+
+ XMapWindow(dpy, window);
+
+ /* set this to false to make ShowEvent take up less vertival space */
+ use_separate_lines = True;
+
+ while (1) {
+ XNextEvent(dpy, &event);
+ printf("Detail of %s event:\n", GetType(&event));
+ ShowEvent(&event);
+ printf("\n\n");
+ }
+}
+