|
|
HP Xlib Extensions: > Chapter 5 X Input Device Extension FunctionsFeedback Control |
|
These functions are provided to manipulate input devices that support feedbacks. A BadMatch error will be generated if the requested device does not support feedbacks. Whether or not a given device supports feedbacks can be determined by examining the information returned by the XOpenDevice request. For those devices that support feedbacks, XOpenDevice will return an XInputClassInfo structure with the input_class field equal to the constant FeedbackClass (defined in the file XI.h). Each class of feedback is described by a structure specific to that class. These structures are defined in the file XInput.h. XFeedbackState and XFeedbackControl are generic structures that contain three fields that are at the beginning of each class of feedback:
The XKbdFeedbackState structure defines the attributes that are returned for feedbacks equivalent to those on the X keyboard.
The click field specifies the key-click volume, with values in the range of 0 (off) to 100 (loud). The percent field specifies the bell volume, with a range of 0 (off) to 100 (loud). The pitch field specifies the bell pitch in Hz. The range of the value is implementation-dependent. The duration field specifies the duration in milliseconds of the bell. The led_mask field is a bit mask that describes the current state of up to 32 LEDs. A value of 1 in a bit indicates that the corresponding LED is on. The global_auto_repeat field has a value of AutoRepeatModeOn or AutoRepeatModeOff. The auto_repeats field is a bit vector. Each bit set to 1 indicates that the auto-repeat is enabled for the corresponding key. The XPtrFeedbackState structure defines the attributes that are returned for feedbacks equivalent to those on the X pointer.
The accelNum field returns the numerator for the acceleration multiplier. The accelDenom field returns the denominator for the acceleration multiplier. The threshold field returns the threshold for the acceleration. The XIntegerFeedbackState structure defines the attributes that are returned for integer feedbacks.
The resolution field specifies the number of digits that the feedback can display. The minVal field specifies the minimum value that the feedback can display. The maxVal field specifies the maximum value that the feedback can display. The XStringFeedbackState structure defines the attributes that are returned for string feedbacks.
The max_symbols field specifies the maximum number of symbols that can be displayed. The syms_supported field is a pointer to the list of supported symbols. The num_syms_supported field specifies the length of the list of supported symbols. The XBellFeedbackState structure defines the attributes that are returned for Bell feedbacks.
Bell feedbacks are those that can generate a sound. Some implementations may support a bell as part of a KbdFeedback feedback. Class BellFeedback is provided for implementations that do not choose to do so, and for devices that support multiple feedbacks that can produce sound. The meaning of the fields is the same as that of the corresponding fields in the XKbdFeedbackState structure. The XLedFeedbackState structure defines the attributes that are returned for Led feedbacks.
LED feedbacks are those that can generate a light. Up to 32 lights per feedback are supported. Each bit in led_mask corresponds to one light, and the corresponding bit in led_values indicates whether that light should be on or off. Some implementations may support LEDs as part of a KbdFeedback feedback. Class LedFeedback is provided for implementations that do not choose to do so, and for devices that support multiple LED feedbacks. The meaning of the led_values field is the same as that in the XKbdFeedbackState structure. The XPtrFeedbackControl structure defines the attributes that can be controlled for feedbacks equivalent to those on the X pointer.
The acceleration, expressed as a fraction, is a multiplier for movement. For example, specifying 3/1 means that the device moves three times as fast as normal. The fraction may be rounded arbitrarily by the X server. Accelerations only takes effect if the device moves more that the threshold pixels at once and only applies to the amount beyond the value in the threshold argument. Setting a value to -1 restores the default. The values of the accelNum and threshold fields must be nonzero for the pointer values to be set. Otherwise, the parameter will be unchanged. The XKbdFeedbackControl structure defines the attributes that can be controlled for feedbacks equivalent to those on the X keyboard.
The XStringFeedbackControl structure defines the attributes that can be controlled for String feedbacks.
The XIntegerFeedbackControl structure defines the attributes that can be controlled for integer feedbacks.
The XBellFeedbackControl structure defines the attributes that can be controlled for Bell feedbacks.
The XLedFeedbackControl structure defines the attributes that can be controlled for Led feedbacks.
To query input device feedbacks, use XGetFeedbackControl.
Title not available (Querying Input Device Feedbacks )
The XGetFeedbackControl function returns a pointer to a list of XFeedbackState structures. Each item in this list describes one of the feedbacks supported by the device. The items are variable length, so each contains its length to allow traversal to the next item in the list. The feedback classes that are currently defined are: KbdFeedbackClass, PtrFeedbackClass, StringFeedbackClass, IntegerFeedbackClass, LedFeedbackClass, and BellFeedbackClass. These constants are defined in the file XI.h. An input device may support zero or more classes of feedback, and may support multiple feedbacks of the same class. Each feedback contains a class identifier and an id that is unique within that class for that input device. The id is used to identify the feedback when making an XChangeFeedbackControl request. XGetFeedbackControl can generate a BadDevice or BadMatch error. To change input device feedbacks, use XChangeFeedbackControl.
Title not available (Changing Input Device Feedbacks )
The XChangeFeedbackControl function modifies the values of one feedback on the specified device. The feedback is identified by the id field of the XFeedbackControl structure that is passed with the request. The fields of the feedback that are to be modified are identified by the bits of the mask that is passed with the request. XChangeFeedbackControl can generate a BadDevice, BadMatch, or BadValue error. |
|