Add printevent.c and -V (verbose) flag to print X events

This commit is contained in:
Kris Maglione 2007-02-09 12:45:52 -05:00
parent 83d52792b4
commit 46a973cf85
4 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -6,6 +6,7 @@
#include <stdlib.h>
#include <string.h>
#include <X11/keysym.h>
#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 */
}

7
main.c
View File

@ -19,7 +19,9 @@
#include <X11/Xatom.h>
#include <X11/Xproto.h>
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];

3
wmii.h
View File

@ -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);