From 60dafc9de224e2f1e53826858e5335916dc6d8c8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 20 Dec 2007 12:21:34 +1030 Subject: [PATCH] Add --loop to "xinput list". Re-prints devices when hierarchy changes. --- src/list.c | 32 +++++++++++++++++++++++++------- src/xinput.c | 12 ++++++------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/list.c b/src/list.c index d1bc086..85b766d 100644 --- a/src/list.c +++ b/src/list.c @@ -115,17 +115,35 @@ list(Display *display, XDeviceInfo *info; int loop; int shortformat = False; + int daemon = False; shortformat = (argc == 1 && strcmp(argv[0], "--short") == 0); + daemon = (argc == 1 && strcmp(argv[0], "--loop") == 0); - if (argc == 0 || shortformat) { + if (argc == 0 || shortformat || daemon) { int num_devices; - - info = XListInputDevices(display, &num_devices); - - for(loop=0; loop - * + * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that @@ -9,8 +9,8 @@ * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Frederic Lepied makes no * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * + * is provided "as is" without express or implied warranty. + * * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -32,7 +32,7 @@ typedef int (*prog)( #endif ); -typedef struct +typedef struct { char *func_name; char *arg_desc; @@ -66,7 +66,7 @@ static entry drivers[] = set_mode }, {"list", - "[--short || ...]", + "[--loop || --short || ...]", list }, {"query-state", @@ -106,7 +106,7 @@ is_xinput_present(Display *display) { XExtensionVersion *version; Bool present; - + version = XGetExtensionVersion(display, INAME); if (version && (version != (XExtensionVersion*) NoSuchExtension)) { -- 2.56.0