From 46a973cf858bba435b7eb57ac669808e875b2c67 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 9 Feb 2007 12:45:52 -0500 Subject: [PATCH] Add printevent.c and -V (verbose) flag to print X events --- Makefile | 3 ++- event.c | 3 +++ main.c | 7 ++++++- wmii.h | 3 ++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6fe220e4..2ab22786 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ include config.mk SRC = area.c bar.c client.c column.c draw.c event.c \ - frame.c fs.c geom.c key.c main.c mouse.c rule.c view.c + frame.c fs.c geom.c key.c main.c mouse.c rule.c view.c \ + printevent.c OBJ = ${SRC:.c=.o} all: options wmiiwm diff --git a/event.c b/event.c index da3c8bc1..b43ac991 100644 --- a/event.c +++ b/event.c @@ -6,6 +6,7 @@ #include #include #include +#include "printevent.h" unsigned int flush_masked_events(long even_mask) { @@ -282,6 +283,8 @@ check_x_event(IXPConn *c) { XEvent ev; while(XPending(blz.dpy)) { /* main event loop */ XNextEvent(blz.dpy, &ev); + if(verbose) + printevent(&ev); if(handler[ev.type]) (handler[ev.type]) (&ev); /* call handler */ } diff --git a/main.c b/main.c index 2eb717f7..7a92b9af 100644 --- a/main.c +++ b/main.c @@ -19,7 +19,9 @@ #include #include -Bool check_other_wm; +Bool verbose; +Bool starting; +static Bool check_other_wm; static int (*x_error_handler) (Display *, XErrorEvent *); static char version[] = "wmiiwm - " VERSION ", (C)opyright MMIV-MMVI Anselm R. Garbe\n"; @@ -200,6 +202,9 @@ main(int argc, char *argv[]) { fprintf(stdout, "%s", version); exit(0); break; + case 'V': + verbose = True; + break; case 'a': if(i + 1 < argc) address = argv[++i]; diff --git a/wmii.h b/wmii.h index 2f5f9d48..9035d1bd 100644 --- a/wmii.h +++ b/wmii.h @@ -239,7 +239,8 @@ Pixmap pmap; void (*handler[LASTEvent]) (XEvent *); /* Misc */ -Bool starting; +extern Bool starting; +extern Bool verbose; /* wm.c */ extern char *message_root(char *message);