diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-11-08 10:21:21 +1030 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-11-08 10:21:21 +1030 |
commit | 1e0b1816a95910631a6b1c8572b9689c32aeb3a0 (patch) | |
tree | ee65e314a492ea36d5fed0acb0b4088026539cab |
xinput as straight from the tarball.
-rw-r--r-- | COPYRIGHT | 19 | ||||
-rw-r--r-- | ChangeLog | 38 | ||||
-rw-r--r-- | Imakefile | 49 | ||||
-rw-r--r-- | README | 22 | ||||
-rw-r--r-- | buttonmap.c | 94 | ||||
-rw-r--r-- | feedback.c | 170 | ||||
-rw-r--r-- | list.c | 118 | ||||
-rw-r--r-- | setint.c | 69 | ||||
-rw-r--r-- | setmode.c | 70 | ||||
-rw-r--r-- | setptr.c | 70 | ||||
-rw-r--r-- | state.c | 110 | ||||
-rw-r--r-- | test.c | 202 | ||||
-rw-r--r-- | version.c | 43 | ||||
-rw-r--r-- | xinput.c | 194 | ||||
-rw-r--r-- | xinput.h | 156 | ||||
-rw-r--r-- | xinput.man | 77 |
16 files changed, 1501 insertions, 0 deletions
diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 0000000..eef49c2 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,19 @@ +Copyright 1996-1997 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + +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 +copyright notice and this permission notice appear in supporting +documentation, and that the name of Frederic Lepied not be used in +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. + +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 +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..27a051d --- /dev/null +++ b/ChangeLog @@ -0,0 +1,38 @@ +Sat Jun 14 21:10:21 1997 Frederic Lepied <Frederic.Lepied@sugix.frmug.org> + + * version 1.2 released. + +Tue Jun 10 06:13:05 1997 Frederic Lepied <Frederic.Lepied@sugix.frmug.org> + + * state.c: new file. + * xinput.man: documented all function calls associated with commands. + +Sat Feb 1 19:20:19 1997 Frederic Lepied <Frederic.Lepied@sugix.frmug.org> + + * version 1.1.1 released. + + * test.c (test): added the option "-proximity" to handle proximity + events because I haven't found the way to know if a device reports + proximity events!!! + +Thu Dec 19 20:35:14 1996 Frederic Lepied <Frederic.Lepied@sugix.frmug.org> + + * version 1.1 released + +Wed Dec 18 22:39:18 1996 Frederic Lepied <Frederic.Lepied@sugix.frmug.org> + + * xinput.c (main): flush the X request queue before exiting. + + * setint.c: new file. + + * feedback.c (get_feedbacks): the switch was on state->id... + +Tue Oct 22 19:08:26 1996 Frederic Lepied <Frederic.Lepied@sugix.frmug.org> + + * version 1.0.1 released + +Thu Oct 17 17:21:39 1996 Frederic Lepied <Frederic.Lepied@sugix.frmug.org> + + * xinput.c (is_xinput_present): corrected the bug when the XInput + extension is unavailable (must test NoSuchExtension). + diff --git a/Imakefile b/Imakefile new file mode 100644 index 0000000..1a439f6 --- /dev/null +++ b/Imakefile @@ -0,0 +1,49 @@ +# +# Copyright 1996-1997 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> +# +# 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 +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Frederic Lepied not be used in +# 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. +# +# 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 +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# $Id: Imakefile,v 1.7 1997/06/14 19:11:49 fred Exp $ + +# must be kept in synch with version.c +VERSION = 1.2 + +DEPLIBS = $(DEPXILIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XILIB) $(XLIB) + +OBJS = xinput.o feedback.o buttonmap.o setptr.o setmode.o list.o test.o version.o setint.o state.o +SRCS = xinput.c feedback.c buttonmap.c setptr.c setmode.c list.c test.c version.c setint.c state.c +HDRS = xinput.h +AUX = xinput.man Imakefile README ChangeLog COPYRIGHT + +ComplexProgramTarget(xinput) + +distrib: + @test -f setptr.c + rm -rf xinput-$(VERSION) xinput-$(VERSION).tar.gz + mkdir xinput-$(VERSION) + ln $(AUX) $(HDRS) $(SRCS) xinput-$(VERSION) + tar cvf xinput-$(VERSION).tar xinput-$(VERSION) + gzip --best --verbose xinput-$(VERSION).tar + +clean:: + @test -f setptr.c + rm -rf xinput-$(VERSION) xinput-$(VERSION).tar.gz + +# end of Imakefile @@ -0,0 +1,22 @@ + xinput 1.x by Frederic Lepied <Frederic.Lepied@sugix.frmug.org> + +1. Introduction +=============== + +xinput is an utility I have built to configure and test my XInput +devices. The functionalities aren't complete but they fill my +needs. If you have some ideas or needs for improvement, feel free to +contact me. Any feedback welcome. + +2. Requirements +=============== + +You'll need an ANSI C compiler. I know it works under Linux +ELF/XFree86 and Solaris 2.4 Sparc/X11R6.1. + +3. Installation +=============== + +xmkmf -a +make install +make install.man diff --git a/buttonmap.c b/buttonmap.c new file mode 100644 index 0000000..1875ec1 --- /dev/null +++ b/buttonmap.c @@ -0,0 +1,94 @@ +/* + * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" + +static const char rcs_id[] = "$Id: buttonmap.c,v 1.1.1.2 1997/06/09 16:00:47 fred Exp $"; + +int +set_button_map(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + XDeviceInfo *info; + XDevice *device; + XAnyClassPtr ip; + int i; + int nbuttons; + + if (argc < 2) { + fprintf(stderr, "usage: xinput %s %s\n", name, desc); + return EXIT_FAILURE; + } + + info = find_device_info(display, argv[0], True); + + if (!info) { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return EXIT_FAILURE; + } + + ip = (XAnyClassPtr) info->inputclassinfo; + nbuttons = 0; + + /* try to find the number of buttons */ + for(i=0; i<info->num_classes; i++) { + if (ip->class == ButtonClass) { + nbuttons = ((XButtonInfoPtr)ip)->num_buttons; + break; + } + ip = (XAnyClassPtr) ((char *) ip + ip->length); + } + if (nbuttons == 0) { + fprintf(stderr, "device has no buttons\n"); + return EXIT_FAILURE; + } + + device = XOpenDevice(display, info->id); + if (device) { + int idx; + unsigned char *map; + int min; + + map = (unsigned char *) malloc(sizeof(unsigned char) * nbuttons); + + XGetDeviceButtonMapping(display, device, map, nbuttons); + + min = (argc > nbuttons + 1) ? nbuttons + 1 : argc; + + for(idx=1; idx < min; idx++) { + map[idx - 1] = atoi(argv[idx]); + } + XSetDeviceButtonMapping(display, device, map, nbuttons); + XCloseDevice(display, device); + return EXIT_SUCCESS; + } else { + fprintf(stderr, "Unable to open device\n"); + return EXIT_FAILURE; + } +} + +/* end of buttonmap.c + */ diff --git a/feedback.c b/feedback.c new file mode 100644 index 0000000..554642e --- /dev/null +++ b/feedback.c @@ -0,0 +1,170 @@ +/* + * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" + +static const char rcs_id[] = "$Id: feedback.c,v 1.2 1996/12/19 19:40:41 fred Exp $"; + +int +set_ptr_feedback(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + XDeviceInfo *info; + XDevice *device; + XPtrFeedbackControl feedback; + + if (argc != 4) { + fprintf(stderr, "usage: xinput %s %s\n", name, desc); + return 1; + } + + info = find_device_info(display, argv[0], True); + + if (!info) { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return 1; + } + + device = XOpenDevice(display, info->id); + + if (!device) { + fprintf(stderr, "unable to open device %s\n", argv[0]); + return 1; + } + + feedback.class = PtrFeedbackClass; + feedback.length = sizeof(XPtrFeedbackControl); + feedback.id = 0; + feedback.threshold = atoi(argv[1]); + feedback.accelNum = atoi(argv[2]); + feedback.accelDenom = atoi(argv[3]); + + XChangeFeedbackControl(display, device, DvAccelNum|DvAccelDenom|DvThreshold, + (XFeedbackControl*) &feedback); + return EXIT_SUCCESS; +} + + +int +get_feedbacks(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + XDeviceInfo *info; + XDevice *device; + XFeedbackState *state; + int num_feedbacks; + int loop; + XPtrFeedbackState *p; + XKbdFeedbackState *k; + XBellFeedbackState *b; + XLedFeedbackState *l; + XIntegerFeedbackState *i; + XStringFeedbackState *s; + + if (argc != 1) { + fprintf(stderr, "usage: xinput %s %s\n", name, desc); + return 1; + } + + info = find_device_info(display, argv[0], True); + + if (!info) { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return 1; + } + + device = XOpenDevice(display, info->id); + + if (!device) { + fprintf(stderr, "unable to open device %s\n", argv[0]); + return 1; + } + + state = XGetFeedbackControl(display, device, &num_feedbacks); + + printf("%d feedback class%s\n", num_feedbacks, + (num_feedbacks > 1) ? "es" : ""); + + for(loop=0; loop<num_feedbacks; loop++) { + switch (state->class) { + case KbdFeedbackClass: + k = (XKbdFeedbackState*) state; + printf("KbdFeedbackClass id=%d\n", state->id); + printf("\tclick is %d\n", k->click); + printf("\tpercent is %d\n", k->percent); + printf("\tpitch is %d\n", k->pitch); + printf("\tduration is %d\n", k->duration); + printf("\tled_mask is %d\n", k->led_mask); + printf("\tglobal_auto_repeat is %d\n", k->global_auto_repeat); + break; + + case PtrFeedbackClass: + p = (XPtrFeedbackState*) state; + printf("PtrFeedbackClass id=%d\n", state->id); + printf("\taccelNum is %d\n", p->accelNum); + printf("\taccelDenom is %d\n", p->accelDenom); + printf("\tthreshold is %d\n", p->threshold); + break; + + case StringFeedbackClass: + s = (XStringFeedbackState*) state; + printf("XStringFeedbackControl id=%d\n", state->id); + printf("\tmax_symbols is %d\n", s->max_symbols); + printf("\tnum_syms_supported is %d\n", s->num_syms_supported); + break; + + case IntegerFeedbackClass: + i = (XIntegerFeedbackState*) state; + printf("XIntegerFeedbackControl id=%d\n", state->id); + printf("\tresolution is %d\n", i->resolution); + printf("\tminVal is %d\n", i->minVal); + printf("\tmaxVal is %d\n", i->maxVal); + break; + + case LedFeedbackClass: + l = (XLedFeedbackState*) state; + printf("XLedFeedbackState id=%d\n", state->id); + printf("\tled_values is %d\n", l->led_values); + break; + + case BellFeedbackClass: + b = (XBellFeedbackState*) state; + printf("XBellFeedbackControl id=%d\n", state->id); + printf("\tpercent is %d\n", b->percent); + printf("\tpitch is %d\n", b->pitch); + printf("\tduration is %d\n", b->duration); + break; + } + state = (XFeedbackState*) ((char*) state + state->length); + } + return EXIT_SUCCESS; +} + +/* end of ptrfdbk.c +*/ @@ -0,0 +1,118 @@ +/* + * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" + +static const char rcs_id[] = "$Id: list.c,v 1.1.1.2 1997/06/09 16:00:48 fred Exp $"; + +static void +print_info(XDeviceInfo *info) +{ + int i,j; + XAnyClassPtr any; + XKeyInfoPtr k; + XButtonInfoPtr b; + XValuatorInfoPtr v; + XAxisInfoPtr a; + + printf("\"%s\"\tid=%ld\t[%s]\n", info->name, info->id, + (info->use == IsXExtensionDevice) ? "XExtensionDevice" : + ((info->use == IsXPointer) ? "XPointer" : "XKeyboard")); + + if (info->num_classes > 0) { + any = (XAnyClassPtr) (info->inputclassinfo); + for (i=0; i<info->num_classes; i++) { + switch (any->class) { + case KeyClass: + k = (XKeyInfoPtr) any; + printf("\tNum_keys is %d\n", k->num_keys); + printf("\tMin_keycode is %d\n", k->min_keycode); + printf("\tMax_keycode is %d\n", k->max_keycode); + break; + + case ButtonClass: + b = (XButtonInfoPtr) any; + printf("\tNum_buttons is %d\n", b->num_buttons); + break; + + case ValuatorClass: + v = (XValuatorInfoPtr) any; + a = (XAxisInfoPtr) ((char *) v + + sizeof (XValuatorInfo)); + printf("\tNum_axes is %d\n", v->num_axes); + printf("\tMode is %s\n", (v->mode == Absolute) ? "Absolute" : "Relative"); + printf("\tMotion_buffer is %ld\n", v->motion_buffer); + for (j=0; j<v->num_axes; j++, a++) { + printf("\tAxis %d :\n", j); + printf("\t\tMin_value is %d\n", a->min_value); + printf("\t\tMax_value is %d\n", a->max_value); + printf ("\t\tResolution is %d\n", a->resolution); + } + break; + + default: + printf ("unknown class\n"); + } + any = (XAnyClassPtr) ((char *) any + any->length); + } + } +} + +int +list(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + XDeviceInfo *info; + int loop; + + if (argc == 0) { + int num_devices; + + info = XListInputDevices(display, &num_devices); + + for(loop=0; loop<num_devices; loop++) { + print_info(info+loop); + } + } else { + int ret = EXIT_SUCCESS; + + for(loop=0; loop<argc; loop++) { + info = find_device_info(display, argv[0], False); + + if (!info) { + fprintf(stderr, "unable to find device %s\n", argv[0]); + ret = EXIT_FAILURE; + } else { + print_info(info); + } + } + return ret; + } + return EXIT_SUCCESS; +} + +/* end of list.c + */ diff --git a/setint.c b/setint.c new file mode 100644 index 0000000..408232d --- /dev/null +++ b/setint.c @@ -0,0 +1,69 @@ +/* + * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" + +static const char rcs_id[] = "$Id: setint.c,v 1.1 1996/12/19 19:41:10 fred Exp $"; + +int +set_integer_feedback(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + XDeviceInfo *info; + XDevice *device; + XIntegerFeedbackControl control; + + if (argc != 3) { + fprintf(stderr, "usage: xinput %s %s\n", name, desc); + return EXIT_FAILURE; + } + + control.class = IntegerFeedbackClass; + control.length = sizeof(XIntegerFeedbackControl); + control.id = atoi(argv[1]); + control.int_to_display = atoi(argv[2]); + + info = find_device_info(display, argv[0], True); + + if (!info) { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return EXIT_FAILURE; + } + + device = XOpenDevice(display, info->id); + + if (device) { + XChangeFeedbackControl(display, device, DvInteger, (XFeedbackControl *) &control); + + return EXIT_SUCCESS; + } else { + fprintf(stderr, "Unable to open device\n"); + return EXIT_FAILURE; + } +} + +/* end of setint.c + */ diff --git a/setmode.c b/setmode.c new file mode 100644 index 0000000..b7860b1 --- /dev/null +++ b/setmode.c @@ -0,0 +1,70 @@ +/* + * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" + +static const char rcs_id[] = "$Id: setmode.c,v 1.1.1.2 1997/06/09 16:00:47 fred Exp $"; + +int +set_mode(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + XDeviceInfo *info; + XDevice *device; + int mode; + + if (argc != 2) { + fprintf(stderr, "usage: xinput %s %s\n", name, desc); + return EXIT_FAILURE; + } + + info = find_device_info(display, argv[0], True); + + if (!info) { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return EXIT_FAILURE; + } + + if (strcmp(argv[1], "ABSOLUTE") == 0) { + mode = Absolute; + } else { + mode = Relative; + } + + device = XOpenDevice(display, info->id); + + if (device) { + XSetDeviceMode(display, device, mode); + + return EXIT_SUCCESS; + } else { + fprintf(stderr, "Unable to open device\n"); + return EXIT_FAILURE; + } +} + +/* end of setmode.c + */ diff --git a/setptr.c b/setptr.c new file mode 100644 index 0000000..c3dcf1c --- /dev/null +++ b/setptr.c @@ -0,0 +1,70 @@ +/* + * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" + +static const char rcs_id[] = "$Id: setptr.c,v 1.1.1.2 1997/06/09 16:00:47 fred Exp $"; + +int +set_pointer(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + XDeviceInfo *info; + XDevice *device; + int xaxis = 0; + int yaxis = 1; + + if ((argc != 1) && (argc != 3)) { + fprintf(stderr, "usage: xinput %s %s\n", name, desc); + return EXIT_FAILURE; + } + + if (argc == 3) { + xaxis = atoi(argv[1]); + yaxis = atoi(argv[2]); + } + + info = find_device_info(display, argv[0], True); + + if (!info) { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return EXIT_FAILURE; + } + + device = XOpenDevice(display, info->id); + + if (device) { + XChangePointerDevice(display, device, xaxis, yaxis); + + return EXIT_SUCCESS; + } else { + fprintf(stderr, "Unable to open device\n"); + return EXIT_FAILURE; + } +} + +/* end of setptr.c + */ @@ -0,0 +1,110 @@ +/* + * Copyright 1996-1997 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" + +static const char rcs_id[] = "$Id: state.c,v 1.2 1997/06/14 19:11:49 fred Exp $"; + +int +query_state(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + XDeviceInfo *info; + XDevice *device; + XDeviceState *state; + int loop; + int loop2; + XInputClass *cls; + XValuatorState *val_state; + XKeyState *key_state; + XButtonState *but_state; + + if (argc != 1) { + fprintf(stderr, "usage: xinput %s %s\n", name, desc); + return 1; + } + + info = find_device_info(display, argv[0], True); + + if (!info) { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return 1; + } + + device = XOpenDevice(display, info->id); + + if (!device) { + fprintf(stderr, "unable to open device %s\n", argv[0]); + return 1; + } + + state = XQueryDeviceState(display, device); + + if (state) { + cls = state->data; + printf("%d class%s :\n", state->num_classes, + (state->num_classes > 1) ? "es" : ""); + for(loop=0; loop<state->num_classes; loop++) { + switch(cls->class) { + case ValuatorClass: + val_state = (XValuatorState *) cls; + printf("ValuatorClass Mode=%s Proximity=%s\n", + val_state->mode & 1 ? "Absolute" : "Relative", + val_state->mode & 2 ? "Out" : "In"); + for(loop2=0; loop2<val_state->num_valuators; loop2++) { + printf("\tvaluator[%d]=%d\n", loop2, val_state->valuators[loop2]); + } + break; + + case ButtonClass: + but_state = (XButtonState *) cls; + printf("ButtonClass\n"); + for(loop2=1; loop2<=but_state->num_buttons; loop2++) { + printf("\tbutton[%d]=%s\n", loop2, + (but_state->buttons[loop2 / 8] & (1 << (loop2 % 8))) ? "down" : "up" ); + } + break; + + case KeyClass: + key_state = (XKeyState *) cls; + printf("KeyClass\n"); + for(loop2=0; loop2<key_state->num_keys; loop2++) { + printf("\tkey[%d]=%s\n", loop2, + (key_state->keys[loop2 / 8] & (1 << (loop2 % 8))) ? "down" : "up" ); + } + + break; + + } + cls = (XInputClass *) ((char *) cls + cls->length); + } + XFreeDeviceState(state); + } + return EXIT_SUCCESS; +} + +/* end of state.c +*/ @@ -0,0 +1,202 @@ +/* + * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" + +static const char rcs_id[] = "$Id: test.c,v 1.3 1997/06/09 16:06:31 fred Exp $"; + +#define INVALID_EVENT_TYPE -1 + +static int motion_type = INVALID_EVENT_TYPE; +static int button_press_type = INVALID_EVENT_TYPE; +static int button_release_type = INVALID_EVENT_TYPE; +static int key_press_type = INVALID_EVENT_TYPE; +static int key_release_type = INVALID_EVENT_TYPE; +static int proximity_in_type = INVALID_EVENT_TYPE; +static int proximity_out_type = INVALID_EVENT_TYPE; + +static int +register_events(Display *dpy, + XDeviceInfo *info, + char *dev_name, + Bool handle_proximity) +{ + int number = 0; /* number of events registered */ + XEventClass event_list[7]; + int i; + XAnyClassPtr any; + XDevice *device; + Window root_win; + unsigned long screen; + XInputClassInfo *ip; + + screen = DefaultScreen(dpy); + root_win = RootWindow(dpy, screen); + + device = XOpenDevice(dpy, info->id); + + if (!device) { + fprintf(stderr, "unable to open device %s\n", dev_name); + return 0; + } + + if (device->num_classes > 0) { + for (ip = device->classes, i=0; i<info->num_classes; ip++, i++) { + switch (ip->input_class) { + case KeyClass: + DeviceKeyPress(device, key_press_type, event_list[number]); number++; + DeviceKeyRelease(device, key_release_type, event_list[number]); number++; + break; + + case ButtonClass: + DeviceButtonPress(device, button_press_type, event_list[number]); number++; + DeviceButtonRelease(device, button_release_type, event_list[number]); number++; + break; + + case ValuatorClass: + DeviceMotionNotify(device, motion_type, event_list[number]); number++; + if (handle_proximity) { + ProximityIn(device, proximity_in_type, event_list[number]); number++; + ProximityOut(device, proximity_out_type, event_list[number]); number++; + } + break; + + default: + fprintf(stderr, "unknown class\n"); + break; + } + } + + if (XSelectExtensionEvent(dpy, root_win, event_list, number)) { + fprintf(stderr, "error selecting extended events\n"); + return 0; + } + } + return number; +} + +static void +print_events(Display *dpy) +{ + XEvent Event; + + while(1) { + XNextEvent(dpy, &Event); + + if (Event.type == motion_type) { + int loop; + XDeviceMotionEvent *motion = (XDeviceMotionEvent *) &Event; + + printf("motion "); + + for(loop=0; loop<motion->axes_count; loop++) { + printf("a[%d]=%d ", motion->first_axis + loop, motion->axis_data[loop]); + } + printf("\n"); + } else if ((Event.type == button_press_type) || + (Event.type == button_release_type)) { + int loop; + XDeviceButtonEvent *button = (XDeviceButtonEvent *) &Event; + + printf("button %s %d ", (Event.type == button_release_type) ? "release" : "press ", + button->button); + + for(loop=0; loop<button->axes_count; loop++) { + printf("a[%d]=%d ", button->first_axis + loop, button->axis_data[loop]); + } + printf("\n"); + } else if ((Event.type == key_press_type) || + (Event.type == key_release_type)) { + int loop; + XDeviceKeyEvent *key = (XDeviceKeyEvent *) &Event; + + printf("key %s %d ", (Event.type == key_release_type) ? "release" : "press ", + key->keycode); + + for(loop=0; loop<key->axes_count; loop++) { + printf("a[%d]=%d ", key->first_axis + loop, key->axis_data[loop]); + } + printf("\n"); + } else if ((Event.type == proximity_out_type) || + (Event.type == proximity_in_type)) { + int loop; + XProximityNotifyEvent *prox = (XProximityNotifyEvent *) &Event; + + printf("proximity %s ", (Event.type == proximity_in_type) ? "in " : "out"); + + for(loop=0; loop<prox->axes_count; loop++) { + printf("a[%d]=%d ", prox->first_axis + loop, prox->axis_data[loop]); + } + printf("\n"); + } + else { + printf("what's that %d\n", Event.type); + } + } +} + +int +test(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + XDeviceInfo *info; + + if (argc != 1 && argc != 2) { + fprintf(stderr, "usage: xinput %s %s\n", name, desc); + return EXIT_FAILURE; + } else { + Bool handle_proximity = False; + int idx = 0; + + if (argc == 2) { + if (strcmp("-proximity", argv[0]) != 0) { + fprintf(stderr, "usage: xinput %s %s\n", name, desc); + return EXIT_FAILURE; + } + handle_proximity = 1; + idx = 1; + } + + info = find_device_info(display, argv[idx], True); + + if (!info) { + fprintf(stderr, "unable to find device %s\n", argv[idx]); + return EXIT_FAILURE; + } else { + if (register_events(display, info, argv[idx], handle_proximity)) { + print_events(display); + } + else { + fprintf(stderr, "no event registered...\n"); + return EXIT_FAILURE; + } + } + } + return EXIT_FAILURE; +} + +/* end of test.c + */ diff --git a/version.c b/version.c new file mode 100644 index 0000000..ca7cc9f --- /dev/null +++ b/version.c @@ -0,0 +1,43 @@ +/* + * Copyright 1996-1997 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" + +static const char rcs_id[] = "$Id: version.c,v 1.5 1997/06/14 19:11:49 fred Exp $"; + +/* must be synched with Imakefile */ +static const char version_id[] = "1.2"; + +int +version(Display *display, + int argc, + char *argv[], + char *name, + char *desc) +{ + printf("%s %s\n", name, version_id); + return EXIT_SUCCESS; +} + +/* end of version.c + */ diff --git a/xinput.c b/xinput.c new file mode 100644 index 0000000..c25a4de --- /dev/null +++ b/xinput.c @@ -0,0 +1,194 @@ +/* + * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xinput.h" +#include <ctype.h> + +static const char rcs_id[] = "$Id: xinput.c,v 1.5 1997/06/09 16:06:31 fred Exp $"; + +typedef int (*prog)( +#if NeedFunctionPrototypes + Display* display, int argc, char *argv[], + char *prog_name, char *prog_desc +#endif +); + +typedef struct +{ + char *func_name; + char *arg_desc; + prog func; +} entry; + +static entry drivers[] = +{ + {"get-feedbacks", + "<device name>", + get_feedbacks + }, + {"set-ptr-feedback", + "<device name> <threshold> <num> <denom>", + set_ptr_feedback + }, + {"set-integer-feedback", + "<device name> <feedback id> <value>", + set_integer_feedback + }, + {"set-button-map", + "<device name> <map button 1> [<map button 2> [...]]", + set_button_map + }, + {"set-pointer", + "<device name> [<x index> <y index>]", + set_pointer + }, + {"set-mode", + "<device name> ABSOLUTE|RELATIVE", + set_mode + }, + {"list", + "[<device name>...]", + list + }, + {"query-state", + "<device name>", + query_state + }, + {"test", + "[-proximity] <device name>", + test + }, + {"version", + "", + version + }, + {0, 0, 0 + } +}; + +static Bool +is_xinput_present(Display *display) +{ + XExtensionVersion *version; + Bool present; + + version = XGetExtensionVersion(display, INAME); + + if (version && (version != (XExtensionVersion*) NoSuchExtension)) { + present = version->present; + XFree(version); + return present; + } else { + return False; + } +} + +XDeviceInfo* +find_device_info(Display *display, + char *name, + Bool only_extended) +{ + XDeviceInfo *devices; + int loop; + int num_devices; + int len = strlen(name); + Bool is_id = True; + XID id; + + for(loop=0; loop<len; loop++) { + if (!isdigit(name[loop])) { + is_id = False; + break; + } + } + + if (is_id) { + id = atoi(name); + } + + devices = XListInputDevices(display, &num_devices); + + for(loop=0; loop<num_devices; loop++) { + if ((!only_extended || (devices[loop].use == IsXExtensionDevice)) && + ((!is_id && strcmp(devices[loop].name, name) == 0) || + (is_id && devices[loop].id == id))) { + return &devices[loop]; + } + } + return NULL; +} + +static void +usage() +{ + entry *pdriver = drivers; + + fprintf(stderr, "usage :\n"); + + while(pdriver->func_name) { + fprintf(stderr, "\txinput %s %s\n", pdriver->func_name, + pdriver->arg_desc); + pdriver++; + } +} + +int +main(int argc, char * argv[]) +{ + Display *display; + entry *driver = drivers; + + if (argc < 2) { + usage(); + return EXIT_FAILURE; + } + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "Unable to connect to X server\n"); + return EXIT_FAILURE; + } + + if (!is_xinput_present(display)) { + fprintf(stderr, "%s extension not available\n", INAME); + return EXIT_FAILURE; + } + + while(driver->func_name) { + if (strcmp(driver->func_name, argv[1]) == 0) { + int r = (*driver->func)(display, argc-2, argv+2, + driver->func_name, driver->arg_desc); + XFlush(display); + return r; + } + driver++; + } + + usage(); + + return EXIT_FAILURE; +} + +/* end of xinput.c + */ diff --git a/xinput.h b/xinput.h new file mode 100644 index 0000000..02058a2 --- /dev/null +++ b/xinput.h @@ -0,0 +1,156 @@ +/* + * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org> + * + * 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 + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * 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. + * + * 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 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include <X11/Xlib.h> +#include <X11/extensions/XInput.h> +#include <X11/Xutil.h> +#include <stdio.h> +#include <stdlib.h> + +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 1 +#endif +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 0 +#endif + +XDeviceInfo* +find_device_info( +#if NeedFunctionPrototypes + Display *display, + char *name, + Bool only_extended +#endif + ); +int +get_feedbacks( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +set_ptr_feedback( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +set_button_map( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +set_pointer( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +set_mode( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +list( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +test( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +version( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +set_integer_feedback( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +query_state( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +/* end of xinput.h + */ diff --git a/xinput.man b/xinput.man new file mode 100644 index 0000000..410ecd0 --- /dev/null +++ b/xinput.man @@ -0,0 +1,77 @@ +.\" $Id: xinput.man,v 1.5 1997/06/09 16:06:31 fred Exp $ +.TH xinput 1 "$Date: 1997/06/09 16:06:31 $" "Frederic Lepied" + +.SH NAME +xinput - utility to configure and test XInput devices + +.SH SYNOPSIS +.B xinput +[version] [list [\fIdevice_name\fP]] [set-pointer \fIdevice_name\fP] +[get-feedbacks \fIdevice_name\fP] +[set-mode \fIdevice_name\fP \fIABSOLUTE|RELATIVE\fP] +[set-ptr-feedback \fIdevice_name\fP \fIthreshold\fP \fInum\fP \fIdenom\fP] +[set-integer-feedback \fIdevice_name\fP \fIindex\fP \fIvalue\fP] +[set-button-map \fIdevice_name\fP \fImap button 1\fP [\fImap button 2\fP [\fI...\fP]]] +[query-state \fIdevice_name\fP] +[test [-proximity] \fIdevice_name\fP] + +.SH DESCRIPTION +.TP 8 +.B xinput version +test if the XInput extension is available and return the version number +of the program. +.PP +.TP 8 +.B xinput list [\fIdevice_name\fP] +If no argument is given list all the input devices showing all their +features. If an argument is given, show all the feature of \fIdevice_name\fP. +Uses XListInputDevices(3). +.PP +.TP 8 +.B xinput get-feedbacks \fIdevice_name\fP +Display the feedbacks of \fIdevice_name\fP. Uses XGetFeedbackControl(3). +.PP +.TP 8 +.B xinput set-pointer \fIdevice_name\fP +Switch \fIdevice_name\fP in core pointer. Uses XChangePointerDevice(3). +.PP +.TP 8 +.B xinput set-mode \fIdevice_name\fP \fIABSOLUTE|RELATIVE\fP +Change the mode of \fIdevice_name\fP. Uses XSetDeviceMode(3). +.PP +.TP 8 +.B xinput set-ptr-feedback \fIdevice_name\fP \fIthreshold\fP \fInum\fP \fIdenom\fP +Change the acceleration of \fIdevice_name\fP. Uses XChangeFeedbackControl(3). +.PP +.TP 8 +.B xinput set-integer-feedback \fIdevice_name\fP \fIindex\fP \fIvalue\fP +Change the value of an integer feedback of \fIdevice_name\fP. Uses XChangeFeedbackControl(3). +.PP +.TP 8 +.B xinput set-button-map \fIdevice_name\fP \fImap button 1\fP [\fImap button 2\fP [\fI...\fP]] +Change the button mapping of \fIdevice_name\fP. Uses XSetDeviceButtonMapping(3). +.PP +.TP 8 +.B xinput query-state \fIdevice_name\fP +Query the device state. Uses XQueryDeviceState(3). +.PP +.TP 8 +.B xinput test [-proximity] \fIdevice_name\fP +Register all extended events from \fIdevice_name\fP and enter an endless +loop displaying events received. If the -proximity is given, ProximityIn +and ProximityOut are registered. +.PP +\fIdevice_name\fP can be the device name as a string or the XID of the +device. +.PP + +.SH COPYRIGHT +Copyright 1996,1997, Frederic Lepied. + +.SH AUTHOR + +.nf +Frederic Lepied, France <Frederic.Lepied@sugix.frmug.org> +.fi + +Patches, bug reports, and suggestions are welcome. |