#include <X11/extensions/xf86misc.h> Bool XF86MiscQueryExtension( Display *display, int *event_base_return, int *error_base_return); Bool XF86MiscQueryVersion( Display *display, int *major_version_return, int *minor_version_return); Status XF86MiscGetMouseSettings( Display *display, XF86MiscMouseSettings *mseinfo); Status XF86MiscSetMouseSettings( Display *display, XF86MiscMouseSettings *mseinfo); Status XF86MiscGetKbdSettings( Display *display, XF86MiscKbdSettings *kbdinfo); Status XF86MiscSetKbdSettings( Display *display, XF86MiscKbdSettings *kbdinfo);
Mouse: typedef struct { char *device; /* returned path to device */ int type; /* mouse protocol */ int baudrate; /* 1200, 2400, 4800, or 9600 */ int samplerate; /* samples per second */ int resolution; /* resolution, count per inch */ int buttons; /* number of buttons */ Bool emulate3buttons; /* Button1+Button3 -> Button2 ? */ int emulate3timeout; /* in milliseconds */ Bool chordmiddle; /* Button1+Button3 == Button2 ? */ int flags; /* Device open flags */ } XF86MiscMouseSettings; Keyboard: typedef struct { int type; /* of keyboard: 84-key, 101-key, Xqueue */ int rate; /* repeat rate */ int delay; /* delay until repeat starts */ Bool servnumlock; /* Server handles NumLock ? */ } XF86MiscKbdSettings;
Not all fields are valid in all cases. For example, when the protocol indicates a bus mouse (i.e. the type field has value MTYPE_BUSMOUSE as defined in xf86misc.h), then the value in the baudrate field should be ignored as it does not apply to bus mice.
The samplerate field contains the resolution in lines per inch when using the Hitachi tablet protocol.
The device field of the structure points to dynamically allocated storage which should be freed by the caller.
Any of the fields of the structure can be altered and then passed to the XF86MiscSetMouseSettings function to change their value in the server, with the following restrictions:
Invalid combinations of parameters are not allowed
- The device can not be changed
- The protocol can not be changed to or from Xqueue or OsMouse
- The buttons field can not be changed
The server will generate an error if any of the above is attempted, except the first - the contents of the device field are simply ignored.
A change of the protocol causes the device to be closed and reopened. Changes to the baud rate, sample rate, resolution or flags, when applicable to the selected protocol, also cause a reopen of the device. A reopen can be forced by using the MF_REOPEN flag, except in the case of the OsMouse and Xqueue protocols which ignore all attempts to reopen the device.
Using the XF86MiscSetKbdSettings function, the keyboard autorepeat delay and rate can be set. Requests to change the type and servnumlock fields are ignored (except for checking for an invalid keyboard type). This is expected to change in a future release.