summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-05-14 17:27:55 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-05-15 10:59:32 +1000
commit2c52e836b8e5a98a1faa5243cb4deb149091c52c (patch)
tree1e466ef2c507bca1973d3415207d05447c1102f5
parentbfac9503e99a266e19bc21805cb4fc38efd16612 (diff)
Add --enable/--disable support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--man/xinput.man10
-rw-r--r--src/property.c12
-rw-r--r--src/xinput.c10
-rw-r--r--src/xinput.h2
4 files changed, 34 insertions, 0 deletions
diff --git a/man/xinput.man b/man/xinput.man
index f70fe8c..540308b 100644
--- a/man/xinput.man
+++ b/man/xinput.man
@@ -148,6 +148,16 @@ detected or RandR 1.2 or later is not available, a Xinerama output may be
specified as "HEAD-N", with N being the Xinerama screen number. This option
has no effect on relative devices.
.PP
+.TP 8
+.B --enable \fIdevice\fP
+Enable the \fIdevice\fP. This call is equivalent to
+.B xinput --set-prop device \fI"Device Enabled"\fP 1
+.PP
+.TP 8
+.B --disable \fIdevice\fP
+Disable the \fIdevice\fP. This call is equivalent to
+.B xinput --set-prop device \fI"Device Enabled"\fP 0
+.PP
\fIdevice\fP can be the device name as a string or the XID of the
device.
.PP
diff --git a/src/property.c b/src/property.c
index 3ab2cb0..14e4308 100644
--- a/src/property.c
+++ b/src/property.c
@@ -824,3 +824,15 @@ int set_prop(Display *display, int argc, char *argv[], char *name,
return do_set_prop(display, type, format, argc, argv, name, desc);
}
+
+int disable(Display *display, int argc, char *argv[], char *name, char *desc)
+{
+ char *new_argv[3] = { argv[0], "Device Enabled", "0" };
+ return set_prop(display, 3, new_argv, name, desc);
+}
+
+int enable(Display *display, int argc, char *argv[], char *name, char *desc)
+{
+ char *new_argv[3] = { argv[0], "Device Enabled", "1" };
+ return set_prop(display, 3, new_argv, name, desc);
+}
diff --git a/src/xinput.c b/src/xinput.c
index a1bb221..0f86720 100644
--- a/src/xinput.c
+++ b/src/xinput.c
@@ -137,6 +137,16 @@ static entry drivers[] =
"<device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]",
set_prop
},
+ {
+ "disable",
+ "<device>",
+ disable,
+ },
+ {
+ "enable",
+ "<device>",
+ enable,
+ },
{NULL, NULL, NULL
}
};
diff --git a/src/xinput.h b/src/xinput.h
index b420e61..c37e6e6 100644
--- a/src/xinput.h
+++ b/src/xinput.h
@@ -69,6 +69,8 @@ int set_atom_prop( Display* display, int argc, char *argv[], char *prog_name, ch
int watch_props( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
int delete_prop( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
int set_prop( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int disable( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int enable( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
/* X Input 2.0 */
int create_master( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);