summaryrefslogtreecommitdiffstats
path: root/src/cmd/rio/xevents.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-07-13 03:59:24 +0000
committerrsc <devnull@localhost>2005-07-13 03:59:24 +0000
commit0b1c1f414ddda722072bb7c84783db0279d3f7f9 (patch)
tree2f8abfe01604f5a2d21c180164a30314dd63c5f7 /src/cmd/rio/xevents.c
parent9c8fc12873460c9b8d390fe1c5aed9f03feb6029 (diff)
downloadplan9port-0b1c1f414ddda722072bb7c84783db0279d3f7f9.tar.gz
plan9port-0b1c1f414ddda722072bb7c84783db0279d3f7f9.zip
more files
Diffstat (limited to 'src/cmd/rio/xevents.c')
-rw-r--r--src/cmd/rio/xevents.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/cmd/rio/xevents.c b/src/cmd/rio/xevents.c
new file mode 100644
index 00000000..d42ddbab
--- /dev/null
+++ b/src/cmd/rio/xevents.c
@@ -0,0 +1,45 @@
+/*
+ * Original code posted to comp.sources.x (see printevent.c).
+ * Modifications by Russ Cox <rsc@swtch.com>.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Intrinsic.h>
+#include "printevent.h"
+
+int
+main(int argc, char **argv)
+{
+ int screen;
+ Display *dpy;
+ Window window;
+ XEvent event;
+
+ 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);
+
+ for(;;){
+ XNextEvent(dpy, &event);
+ printevent(&event);
+ }
+}
+