2 * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Frederic Lepied not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Frederic Lepied makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
27 set_ptr_feedback(Display
*display
,
35 XPtrFeedbackControl feedback
;
38 fprintf(stderr
, "usage: xinput %s %s\n", name
, desc
);
42 info
= find_device_info(display
, argv
[0], True
);
45 fprintf(stderr
, "unable to find device %s\n", argv
[0]);
49 device
= XOpenDevice(display
, info
->id
);
52 fprintf(stderr
, "unable to open device %s\n", argv
[0]);
56 feedback
.class = PtrFeedbackClass
;
57 feedback
.length
= sizeof(XPtrFeedbackControl
);
59 feedback
.threshold
= atoi(argv
[1]);
60 feedback
.accelNum
= atoi(argv
[2]);
61 feedback
.accelDenom
= atoi(argv
[3]);
63 XChangeFeedbackControl(display
, device
, DvAccelNum
|DvAccelDenom
|DvThreshold
,
64 (XFeedbackControl
*) &feedback
);
70 get_feedbacks(Display
*display
,
78 XFeedbackState
*state
;
83 XBellFeedbackState
*b
;
85 XIntegerFeedbackState
*i
;
86 XStringFeedbackState
*s
;
89 fprintf(stderr
, "usage: xinput %s %s\n", name
, desc
);
93 info
= find_device_info(display
, argv
[0], True
);
96 fprintf(stderr
, "unable to find device %s\n", argv
[0]);
100 device
= XOpenDevice(display
, info
->id
);
103 fprintf(stderr
, "unable to open device %s\n", argv
[0]);
107 state
= XGetFeedbackControl(display
, device
, &num_feedbacks
);
109 printf("%d feedback class%s\n", num_feedbacks
,
110 (num_feedbacks
> 1) ? "es" : "");
112 for(loop
=0; loop
<num_feedbacks
; loop
++) {
113 switch (state
->class) {
114 case KbdFeedbackClass
:
115 k
= (XKbdFeedbackState
*) state
;
116 printf("KbdFeedbackClass id=%ld\n", state
->id
);
117 printf("\tclick is %d\n", k
->click
);
118 printf("\tpercent is %d\n", k
->percent
);
119 printf("\tpitch is %d\n", k
->pitch
);
120 printf("\tduration is %d\n", k
->duration
);
121 printf("\tled_mask is %d\n", k
->led_mask
);
122 printf("\tglobal_auto_repeat is %d\n", k
->global_auto_repeat
);
125 case PtrFeedbackClass
:
126 p
= (XPtrFeedbackState
*) state
;
127 printf("PtrFeedbackClass id=%ld\n", state
->id
);
128 printf("\taccelNum is %d\n", p
->accelNum
);
129 printf("\taccelDenom is %d\n", p
->accelDenom
);
130 printf("\tthreshold is %d\n", p
->threshold
);
133 case StringFeedbackClass
:
134 s
= (XStringFeedbackState
*) state
;
135 printf("XStringFeedbackControl id=%ld\n", state
->id
);
136 printf("\tmax_symbols is %d\n", s
->max_symbols
);
137 printf("\tnum_syms_supported is %d\n", s
->num_syms_supported
);
140 case IntegerFeedbackClass
:
141 i
= (XIntegerFeedbackState
*) state
;
142 printf("XIntegerFeedbackControl id=%ld\n", state
->id
);
143 printf("\tresolution is %d\n", i
->resolution
);
144 printf("\tminVal is %d\n", i
->minVal
);
145 printf("\tmaxVal is %d\n", i
->maxVal
);
148 case LedFeedbackClass
:
149 l
= (XLedFeedbackState
*) state
;
150 printf("XLedFeedbackState id=%ld\n", state
->id
);
151 printf("\tled_values is %d\n", l
->led_values
);
154 case BellFeedbackClass
:
155 b
= (XBellFeedbackState
*) state
;
156 printf("XBellFeedbackControl id=%ld\n", state
->id
);
157 printf("\tpercent is %d\n", b
->percent
);
158 printf("\tpitch is %d\n", b
->pitch
);
159 printf("\tduration is %d\n", b
->duration
);
162 state
= (XFeedbackState
*) ((char*) state
+ state
->length
);
167 /* end of ptrfdbk.c */