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.
26 static const char rcs_id
[] = "$Id: feedback.c,v 1.2 1996/12/19 19:40:41 fred Exp $";
29 set_ptr_feedback(Display
*display
,
37 XPtrFeedbackControl feedback
;
40 fprintf(stderr
, "usage: xinput %s %s\n", name
, desc
);
44 info
= find_device_info(display
, argv
[0], True
);
47 fprintf(stderr
, "unable to find device %s\n", argv
[0]);
51 device
= XOpenDevice(display
, info
->id
);
54 fprintf(stderr
, "unable to open device %s\n", argv
[0]);
58 feedback
.class = PtrFeedbackClass
;
59 feedback
.length
= sizeof(XPtrFeedbackControl
);
61 feedback
.threshold
= atoi(argv
[1]);
62 feedback
.accelNum
= atoi(argv
[2]);
63 feedback
.accelDenom
= atoi(argv
[3]);
65 XChangeFeedbackControl(display
, device
, DvAccelNum
|DvAccelDenom
|DvThreshold
,
66 (XFeedbackControl
*) &feedback
);
72 get_feedbacks(Display
*display
,
80 XFeedbackState
*state
;
85 XBellFeedbackState
*b
;
87 XIntegerFeedbackState
*i
;
88 XStringFeedbackState
*s
;
91 fprintf(stderr
, "usage: xinput %s %s\n", name
, desc
);
95 info
= find_device_info(display
, argv
[0], True
);
98 fprintf(stderr
, "unable to find device %s\n", argv
[0]);
102 device
= XOpenDevice(display
, info
->id
);
105 fprintf(stderr
, "unable to open device %s\n", argv
[0]);
109 state
= XGetFeedbackControl(display
, device
, &num_feedbacks
);
111 printf("%d feedback class%s\n", num_feedbacks
,
112 (num_feedbacks
> 1) ? "es" : "");
114 for(loop
=0; loop
<num_feedbacks
; loop
++) {
115 switch (state
->class) {
116 case KbdFeedbackClass
:
117 k
= (XKbdFeedbackState
*) state
;
118 printf("KbdFeedbackClass id=%d\n", state
->id
);
119 printf("\tclick is %d\n", k
->click
);
120 printf("\tpercent is %d\n", k
->percent
);
121 printf("\tpitch is %d\n", k
->pitch
);
122 printf("\tduration is %d\n", k
->duration
);
123 printf("\tled_mask is %d\n", k
->led_mask
);
124 printf("\tglobal_auto_repeat is %d\n", k
->global_auto_repeat
);
127 case PtrFeedbackClass
:
128 p
= (XPtrFeedbackState
*) state
;
129 printf("PtrFeedbackClass id=%d\n", state
->id
);
130 printf("\taccelNum is %d\n", p
->accelNum
);
131 printf("\taccelDenom is %d\n", p
->accelDenom
);
132 printf("\tthreshold is %d\n", p
->threshold
);
135 case StringFeedbackClass
:
136 s
= (XStringFeedbackState
*) state
;
137 printf("XStringFeedbackControl id=%d\n", state
->id
);
138 printf("\tmax_symbols is %d\n", s
->max_symbols
);
139 printf("\tnum_syms_supported is %d\n", s
->num_syms_supported
);
142 case IntegerFeedbackClass
:
143 i
= (XIntegerFeedbackState
*) state
;
144 printf("XIntegerFeedbackControl id=%d\n", state
->id
);
145 printf("\tresolution is %d\n", i
->resolution
);
146 printf("\tminVal is %d\n", i
->minVal
);
147 printf("\tmaxVal is %d\n", i
->maxVal
);
150 case LedFeedbackClass
:
151 l
= (XLedFeedbackState
*) state
;
152 printf("XLedFeedbackState id=%d\n", state
->id
);
153 printf("\tled_values is %d\n", l
->led_values
);
156 case BellFeedbackClass
:
157 b
= (XBellFeedbackState
*) state
;
158 printf("XBellFeedbackControl id=%d\n", state
->id
);
159 printf("\tpercent is %d\n", b
->percent
);
160 printf("\tpitch is %d\n", b
->pitch
);
161 printf("\tduration is %d\n", b
->duration
);
164 state
= (XFeedbackState
*) ((char*) state
+ state
->length
);