summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMC <mc@hack.org>2010-06-24 17:28:16 +0200
committerMC <mc@hack.org>2010-06-24 17:28:16 +0200
commitd6ed181eee6f2dd3439e0e6057c868c2d5d4a8d0 (patch)
treeccb10065d6a039f3371139906a518ca6f44e6903
parent9b89fb40a58caed77c53732eb440db936592a837 (diff)
downloadmcwm-d6ed181eee6f2dd3439e0e6057c868c2d5d4a8d0.zip
Added debug printouts for incoming events.
-rw-r--r--Makefile6
-rw-r--r--events.h39
-rw-r--r--mcwm.c18
3 files changed, 58 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index c8833f9..cd92e2a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,20 @@
VERSION=201000624-3
DIST=mcwm-$(VERSION)
-DISTFILES=LICENSE Makefile NEWS README TODO WISHLIST config.h mcwm.c
+DISTFILES=LICENSE Makefile NEWS README TODO WISHLIST config.h mcwm.c \
+ events.h
CC=gcc
CFLAGS=-g -std=c99 -Wall -I/usr/local/include -L/usr/local/lib -lxcb \
-lxcb-keysyms -lxcb-icccm -lxcb-atom #-DDEBUG
RM=/bin/rm
+PREFIX=/usr/local
TARGETS=mcwm
all: $(TARGETS)
-mcwm: mcwm.c config.h
+mcwm: mcwm.c config.h events.h Makefile
mcwm-static: mcwm.c config.h
$(CC) -o mcwm-static mcwm.c -static -g -std=c99 -Wall \
diff --git a/events.h b/events.h
new file mode 100644
index 0000000..27c23e4
--- /dev/null
+++ b/events.h
@@ -0,0 +1,39 @@
+#define MAXEVENTS 34
+
+static char *evnames[] = {
+ "",
+ "",
+ "KeyPress",
+ "KeyRelease",
+ "ButtonPress",
+ "ButtonRelease",
+ "MotionNotify",
+ "EnterNotify",
+ "LeaveNotify",
+ "FocusIn",
+ "FocusOut",
+ "KeymapNotify",
+ "Expose",
+ "GraphicsExpose",
+ "NoExpose",
+ "VisibilityNotify",
+ "CreateNotify",
+ "DestroyNotify",
+ "UnmapNotify",
+ "MapNotify",
+ "MapRequest",
+ "ReparentNotify",
+ "ConfigureNotify",
+ "ConfigureRequest",
+ "GravityNotify",
+ "ResizeRequest",
+ "CirculateNotify",
+ "CirculateRequest",
+ "PropertyNotify",
+ "SelectionClear",
+ "SelectionRequest",
+ "SelectionNotify",
+ "ColormapNotify",
+ "ClientMessage",
+ "MappingNotify"
+};
diff --git a/mcwm.c b/mcwm.c
index 9221adf..ca0ca78 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -40,6 +40,10 @@
#include <X11/keysym.h>
+#ifdef DEBUG
+#include "events.h"
+#endif
+
/* Check here for user configurable parts: */
#include "config.h"
@@ -1124,8 +1128,17 @@ void events(void)
fprintf(stderr, "mcwm: Couldn't get event. Exiting...\n");
exit(1);
}
-
- PDEBUG("Event: %d\n", ev->response_type);
+
+#ifdef DEBUG
+ if (ev->response_type <= MAXEVENTS)
+ {
+ PDEBUG("Event: %s\n", evnames[ev->response_type]);
+ }
+ else
+ {
+ PDEBUG("Event: #%d. Not known.\n", ev->response_type);
+ }
+#endif
switch (ev->response_type & ~0x80)
{
@@ -1344,7 +1357,6 @@ void events(void)
if (e->mode == XCB_NOTIFY_MODE_NORMAL
|| e->mode == XCB_NOTIFY_MODE_UNGRAB)
{
-
/*
* If we're entering the same window we focus now,
* then don't bother focusing.