From 4e9649849fe06c900f9ccff32466d01026e9a192 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Sun, 16 Mar 2008 19:22:21 -0300 Subject: [PATCH] Allow using xkbevd as a debug tool for xkb events. The option -all will print events in a way very close to xev. This just slightly implement what is commented in the manual page, about using it as a possible xev counterpart, or even replacement. --- Makefile.am | 4 ++-- xkbevd.c | 14 +++++++++++--- xkbevd.cf | 7 +++++++ xkbevd.man | 3 +++ 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 xkbevd.cf diff --git a/Makefile.am b/Makefile.am index 299550f..7c9904d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,8 +40,8 @@ appman_PRE = \ BUILT_SOURCES = cfgparse.c MAINTAINERCLEANFILES = $(BUILT_SOURCES) -# Sample configuration file -EXTRA_DIST = example.cf +# Sample configuration files +EXTRA_DIST = example.cf xkbevd.cf appmandir = $(APP_MAN_DIR) diff --git a/xkbevd.c b/xkbevd.c index 36fd809..d2f5d9f 100644 --- a/xkbevd.c +++ b/xkbevd.c @@ -95,6 +95,7 @@ Usage(int argc, char *argv[]) M("-bg Run in background\n"); M("-synch Force synchronization\n"); M("-v Print verbose messages\n"); + M("-all Print all events\n"); return; } @@ -195,6 +196,10 @@ register int i; Usage(argc,argv); exit(0); } + else if (strcmp(argv[i], "-all") == 0) { + eventMask = XkbAllEventsMask; + verbose++; + } else { uError("Unknown flag \"%s\" on command line\n",argv[i]); Usage(argc,argv); @@ -382,8 +387,11 @@ char buf[1024],*cmd; int ok; cfg= FindMatchingConfig(ev); - if (!cfg) + if (!cfg) { + if (verbose) + PrintXkbEvent(stdout,ev); return False; + } if (cfg->action.type==UnknownAction) { if (cfg->action.text==NULL) cfg->action.type= NoAction; @@ -478,7 +486,7 @@ Bool ok; } sprintf(buf,DFLT_SYS_XKBEVD_CONFIG,DFLT_XKB_CONFIG_ROOT); file= fopen(cfgFileName,"r"); - if (file==NULL) { + if (file==NULL && !eventMask) { if (verbose) { uError("Couldn't find a config file anywhere\n"); uAction("Exiting\n"); @@ -502,7 +510,7 @@ Bool ok; ok= True; setScanState(cfgFileName,1); CFGParseFile(file); - if (!config) { + if (!config && !eventMask) { uError("No configuration specified in \"%s\"\n",cfgFileName); goto BAILOUT; } diff --git a/xkbevd.cf b/xkbevd.cf new file mode 100644 index 0000000..398e974 --- /dev/null +++ b/xkbevd.cf @@ -0,0 +1,7 @@ +// See directory /usr/share/sounds contents or example.cf for example on +// how to used sounds +soundDirectory = "/usr/share/sounds" + +Bell() printEvent +AccessX() printEvent +Message() printEvent diff --git a/xkbevd.man b/xkbevd.man index ec235f3..09b6b45 100644 --- a/xkbevd.man +++ b/xkbevd.man @@ -89,6 +89,9 @@ Forces synchronization of all X requests. Slow. .B \-v Print more information, including debugging messages. Multiple specifications of \fI-v\fP cause more output, to a point. +.TP 8 +.B \-all +Prints information about all known XKB event types. Implies \fB-v\fP option. .SH "SEE ALSO" X(__miscmansuffix__) .SH COPYRIGHT -- 1.5.3.2