summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlessandro Guido <ag@alessandroguido.name>2010-12-03 11:55:00 +0100
committerPeter Hutterer <peter.hutterer@who-t.net>2010-12-06 11:15:33 +1000
commit6f61aa776332b99e0d3cc035bff11d87d2735a47 (patch)
tree81783cb68d26391d8c1182738cb4bf7413d0fdcb /tools
parent4d22aa06fd2b53e11233ebd3a25045cd96bf67ab (diff)
syndaemon: decouple background mode from quietness
syndaemon currently outputs lots of stuff when not running in background mode. However, current init daemons and session managers can manage to launch the daemon in background without "-b" just fine (if not better), by doing the fork() themselves. Indeed, if one uses that setup, ie. by having syndaemon launched by GNOME at login, it gets the ~/.xsession-errors file spammed by Enable/Disabled messages. This patch fixes this by introducing a new verbose (-v) flag that enables those messages and makes syndaemon quiet by default. Signed-off-by: Alessandro Guido <ag@alessandroguido.name> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/syndaemon.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/syndaemon.c b/tools/syndaemon.c
index d06fe5f..0309fb5 100644
--- a/tools/syndaemon.c
+++ b/tools/syndaemon.c
@@ -64,6 +64,7 @@ static XDevice *dev;
static Atom touchpad_off_prop;
static TouchpadState previous_state;
static TouchpadState disable_state = TouchpadOff;
+static int verbose;
#define KEYMAP_SIZE 32
static unsigned char keyboard_mask[KEYMAP_SIZE];
@@ -82,6 +83,7 @@ usage(void)
fprintf(stderr, " -k Ignore modifier keys when monitoring keyboard activity.\n");
fprintf(stderr, " -K Like -k but also ignore Modifier+Key combos.\n");
fprintf(stderr, " -R Use the XRecord extension.\n");
+ fprintf(stderr, " -v Print diagnostic messages.\n");
exit(1);
}
@@ -110,7 +112,7 @@ toggle_touchpad(Bool enable)
if (pad_disabled && enable) {
data = previous_state;
pad_disabled = False;
- if (!background)
+ if (verbose)
printf("Enable\n");
} else if (!pad_disabled && !enable &&
previous_state != disable_state &&
@@ -118,7 +120,7 @@ toggle_touchpad(Bool enable)
store_current_touchpad_state();
pad_disabled = True;
data = disable_state;
- if (!background)
+ if (verbose)
printf("Disable\n");
} else
return;
@@ -290,7 +292,7 @@ Bool check_xrecord(Display *display) {
&first_error);
status = XRecordQueryVersion(display, version, version+1);
- if (!background && status) {
+ if (verbose && status) {
printf("X RECORD extension version %d.%d\n", version[0], version[1]);
}
return found;
@@ -433,7 +435,7 @@ void record_main_loop(Display* display, double idle_time) {
if (ret == 0 && pad_disabled) { /* timeout => enable event */
toggle_touchpad(True);
- if (!background) printf("enable touchpad\n");
+ if (verbose) printf("enable touchpad\n");
}
} /* end while(1) */
@@ -516,7 +518,7 @@ main(int argc, char *argv[])
int use_xrecord = 0;
/* Parse command line parameters */
- while ((c = getopt(argc, argv, "i:m:dtp:kKR?")) != EOF) {
+ while ((c = getopt(argc, argv, "i:m:dtp:kKR?v")) != EOF) {
switch(c) {
case 'i':
idle_time = atof(optarg);
@@ -543,6 +545,9 @@ main(int argc, char *argv[])
case 'R':
use_xrecord = 1;
break;
+ case 'v':
+ verbose = 1;
+ break;
default:
usage();
break;