X Input Extension Library
__vendorversion__
XAllowDeviceEvents
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XAllowDeviceEvents
release queued events
Syntax
#include <X11/extensions/XInput.h>
int XAllowDeviceEvents
Display *display
XDevice *device
int event_mode
Time time
Arguments
display
Specifies the connection to the X server.
device
Specifies the device from which events are
to be allowed.
event_mode
Specifies the event mode.You can pass
AsyncThisDevice,
SyncThisDevice,
ReplayThisDevice,
AsyncOtherDevices,
SyncAll,or
AsyncAll.
time
Specifies the time.You can pass either a
timestamp or CurrentTime.
Description
The XAllowDeviceEvents function releases some
queued events if the client has caused a device to freeze. It has no
effect if the specified time is earlier than the last-grab time of
the most recent active grab for the client and device, or if the
specified time is later than the current X server time.
The following describes the processing that occurs depending on what
constant you pass to the event_mode argument.
AsyncThisDevice If the specified device is
frozen by the client, event processing for that device continues
as usual. If the device is frozen multiple times by the client on
behalf of multiple separate grabs,
AsyncThisDevice thaws for
all.AsyncThisDevice has no effect if the
specified device is not frozen by the client, but the device need
not be grabbed by the client.
SyncThisDevice If the specified device is
frozen and actively grabbed by the client, event processing for
that device continues normally until the next key or button event
is reported to the client. At this time, the specified device
again appears to freeze. However, if the reported event causes the
grab to be released, the specified device does not freeze.
SyncThisDevice has no effect if the specified
device is not frozen by the client or is not grabbed by the
client.
ReplayThisDevice If the specified device is
actively grabbed by the client and is frozen as the result of an
event having been sent to the client (either from the activation
of a GrabDeviceButton or from a previous AllowDeviceEvents with
mode SyncThisDevice, but not from a GrabDevice), the grab is
released and that event is completely reprocessed. This time,
however, the request ignores any passive grabs at or above (toward
the root) that the grab-window of the grab just released. The
request has no effect if the specified device is not grabbed by
the client or if it is not frozen as the result of an event.
AsyncOtherDevices If the remaining devices
are frozen by the client, event processing for them continues as
usual. If the other devices are frozen multiple times by the
client on behalf of multiple grabs,
AsyncOtherDevices "thaws" for all.
AsyncOtherDevices has no effect if the
devices are not frozen by the client.
SyncAll If all devices are frozen by the
client, event processing (for all devices) continues normally
until the next button or key event is reported to the client for a
grabbed device, at which time all devices again appear to freeze.
However, if the reported event causes the grab to be released,
then the devices do not freeze. If any device is still grabbed,
then a subsequent event for it will still cause all devices to
freeze. SyncAll has no effect unless all
devices are frozen by the client. If any device is frozen twice by
the client on behalf of two separate grabs,
SyncAll thaws for both. A subsequent freeze
for SyncAll will only freeze each device
once.
AsyncAll If all devices are frozen by the
client, event processing for all devices continues normally. If
any device is frozen multiple times by the client on behalf of
multiple separate grabs, AsyncAll thaws for
all. AsyncAll has no effect unless all
devices are frozen by the client.
AsyncThisDevice,
SyncThisDevice, and
ReplayThisDevice have no effect on the
processing of events from the remaining
devices.AsyncOtherDevices has no effect on
the processing of events from the specified device. When the
event_mode is SyncAll or
AsyncAll, the device parameter is ignored.
It is possible for several grabs of different devices by the same
or different clients to be active simultaneously. If a device is
frozen on behalf of any grab, no event processing is performed for
the device. It is possible for a single device to be frozen
because of several grabs. In this case, the freeze must be
released on behalf of each grab before events can again be
processed.
XAllowDeviceEvents can generate a
BadDevice or BadValue
error.
Diagnostics
BadDevice
An invalid device was specified. The specified device does
not exist or has not been opened by this client
via XOpenInputDevice. This error may
also occur if the specified device is the X keyboard or X
pointer device.
BadValue
An invalid mode was specified on the request.
See also
XGrabDevice(3)
__vendorversion__
XChangeDeviceDontPropagateList
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XChangeDeviceDontPropagateList
XGetDeviceDontPropagateList
query or change the dont-propagate-list for extension devices
Syntax
#include <X11/extensions/XInput.h>
int XChangeDeviceDontPropagateList
Display *display
Window*window
int *count
XEventClass *event_list
intmode
XEventClass* XGetDeviceDontPropagateList
Display *display
Window *window
int *count
Arguments
display
Specifies the connection to the X server.
window
Specifies the window whose
dont-propagate-list is to be queried or modified.
event_list
Specifies a pointer to a list of event
classes.
mode
Specifies the mode.You can pass
AddToList, or
DeleteFromList.
count
Specifies the number of event classes in
the list.
Description
The XChangeDeviceDontPropagateList request
modifies the list of events that should not be propagated to
ancestors of the event window. This request allows extension
events to be added to or deleted from that list. By default, all
events are propagated to ancestor windows. Once modified, the list
remains modified for the life of the window. Events are not
removed from the list because the client that added them has
terminated.
Suppression of event propagation is not allowed for all input
extension events. If a specified event class is one that cannot be
suppressed, a BadClass error will result.
Events that can be suppressed include
DeviceKeyPress,
DeviceKeyRelease,
DeviceButtonPress,
DeviceButtonRelease,
DeviceMotionNotify,
ProximityIn, and
ProximityOut.
XChangeDeviceDontPropagateList can generate a
BadDevice, BadClass, or
BadValue error.
The XGetDeviceDontPropagateList request
queries the list of events that should not be propagated to
ancestors of the event window.
XGetDeviceDontPropagateList can generate a
BadClass or BadWindow
error.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if some other client has caused the
specified device to become the X keyboard or X
pointer device via the
XChangeKeyboardDevice or
XChangePointerDevice
requests.
BadValue
Some numeric value falls outside the range
of values accepted by the request. Unless a
specific range is specified for an argument, the
full range defined by the argument's type is
accepted. Any argument defined as a set of
alternatives can generate this error.
BadWindow
An invalid window id was specified.
BadClass
An invalid event class was specified.
__vendorversion__
XChangeKeyboardDevice
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XChangeKeyboardDevice
change which device is used as the X keyboard
Syntax
#include <X11/extensions/XInput.h>
Status XChangeKeyboardDevice
Display *display
XDevice*device
Arguments
display
Specifies the connection to the X server.
device
Specifies the device to be used as the X
keyboard.
Description
The XChangeKeyboardDevice request causes the
server to use the specified device as the X keyboard. The device
must have been previously opened by the requesting client via
XOpenDevice or a
BadDevice error will result. The device must
support input class Keys, or a
BadMatch error will result. If the server
implementation does not support using the requested device as the
X keyboard, a BadDevice error will result.
If the specified device is grabbed by another client,
AlreadyGrabbed is returned. If the specified
device is frozen by a grab on another device,
GrabFrozen is returned. If the request is
successful, Success is returned.
If the request succeeds, a ChangeDeviceNotify
event is sent to all clients that have selected that event. A
MappingNotify event with request =
MappingKeyboard is sent to all clients. The
specified device becomes the X keyboard and the old X keyboard
becomes accessible through the input extension protocol requests.
XChangeKeyboardDevice can generate a
BadDevice or a BadMatch
error.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist, has not been
opened by this client via
XOpenInputDevice, or is
already one of the core X device (pointer or
keyboard). This error may also occur if the server
implementation does not support using the
specified device as the X keyboard.
BadMatch
This error may occur if an
XChangeKeyboardDevice request
was made specifying a device that has no keys.
See also
XChangePointerDevice
__vendorversion__
XChangePointerDevice
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XChangePointerDevice
change which device is the X pointer
Syntax
#include <X11/extensions/XInput.h>
Status XChangePointerDevice
Display *display
XDevice *device
int xaxis
int yaxis
Arguments
display
Specifies the connection to the X server.
device
Specifies the device to be used as the X
pointer.
xaxis
Specifies the axis of the device to be
used as the X pointer x-axis.
yaxis
Specifies the axis of the device to be
used as the X pointer y-axis.
Description
The XChangePointerDevice request causes the
server to use the specified device as the X pointer. The device
must have been opened by the client via
XOpenDevice or a
BadDevice error will result. The device must
support input class Valuators or a
BadMatch error will result. If the
implementation does not support use of the specified device as the
X pointer, a BadDevice error will result.
If the specified device is grabbed by another client,
AlreadyGrabbed is returned. If the specified
device is frozen by a grab on another device,
GrabFrozen is returned. If the request is
successful, Success is returned.
If the request succeeds, a ChangeDeviceNotify
event is sent to all clients that have selected that event. A
MappingNotify event with request =
MappingPointer is sent to all clients. The
specified device becomes the X pointer, and the old X pointer
becomes accessible through the input extension protocol requests.
XChangePointerDevice can generate a
BadDevice or a BadMatch
error.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist, has not been
opened by this client via
XOpenInputDevice, or is
already one of the core X input devices (pointer
or keyboard). This error may also occur if the
server implementation does not support using the
specified device as the X pointer.
BadMatch
This error may occur if an
XChangePointerDevice request
was made specifying a device that has less than
two valuators, or specifying a valuator index
beyond the range supported by the device.
See also
XChangeKeyboardDevice
__vendorversion__
XDeviceBell
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XDeviceBell
ring a bell on a device supported through the input extension
Syntax
#include <X11/extensions/XInput.h>
Status XDeviceBell
Display *display
XDevice *device
XID *feedbackclass
XID *feedbackid
int *percent
Arguments
display
Specifies the connection to the X server.
device
Specifies the device with which the bell
is associated.
feedbackclass
Specifies the class of the feedback with
which the bell is associated.
feedbackid
Specifies the id of the feedback with
which the bell is associated.
percent
Specifies the volume in the range -100 to
100 at which the bell should be rung.
Description
The XDeviceBell request causes the server to
ring a bell on the specified feedback of the specified device, if
possible. The specified volume is relative to the base volume for
the bell. If an invalid device is specified, a
BadDevice error will be returned. The
feedbackclass and feedbackid parameters contain values returned by
an XGetFeedbackControl request and uniquely
identify the bell to ring. If a feedbackclass is specified that
does not support a bell, or if a nonexistent feedbackid is
specified, or a percent value is specified that is not in the
range -100 to 100, a BadValue error will be
returned.
The volume at which the bell is rung when the percent argument is
nonnegative is: base - [(base * percent) / 100] + percent
The volume at which the bell rings when the percent argument is
negative is: base + [(base * percent) / 100]
To change the base volume of the bell, use
XChangeFeedbackControl.
XDeviceBell can generate a
BadDevice or a BadValue
error.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist, or has not been
opened by this client via
XOpenInputDevice.
BadValue
An invalid feedbackclass, feedbackid, or
percent value was specified.
See also
XChangeFeedbackControl(3), XBell(3)
__vendorversion__
XGetDeviceControl
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XGetDeviceControl
XChangeDeviceControl
query and change input device controls
Syntax
#include <X11/extensions/XInput.h>
XDeviceControl *XGetDeviceControl
Display *display
XDevice*device
int *controlType
int XChangeDeviceControl
Display *display
XDevice*device
int controlType
XDeviceControl *control
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose control is to
be interrogated or modified.
controlType
Specifies the type of control to be
interrogated or changed.
control
Specifies the address of an
XDeviceControl structure that
contains the new values for the Device.
Description
These requests are provided to manipulate those input devices that
support device control. A BadMatch error will
be generated if the requested device does not support any device
controls.
Valid device control types that can be used with these requests
include the following:
DEVICE_RESOLUTION Queries or changes the resolution of valuators
on input devices.
The XGetDeviceControl request returns a
pointer to an XDeviceControl structure.
XGetDeviceControl can generate a
BadDevice or BadMatch
error.
The XChangeDeviceControl request modifies the
values of one control on the specified device. The control is
identified by the id field of the
XDeviceControl structure that is passed with
the request.
XChangeDeviceControl can generate a
BadDevice, BadMatch, or
BadValue error..SH STRUCTURES Each control
is described by a structure specific to that control. These
structures are defined in the file XInput.h.
XDeviceControl is a generic structure that
contains two fields that are at the beginning of each class of
control:
typedef struct {
XID class;
int length;
} XDeviceControl;
The XDeviceResolutionState structure defines
the information that is returned for device resolution for devices
with valuators.
typedef struct {
XID control;
int length;
int num_valuators;
int* resolutions;
int* min_resolutions;
int* max_resolutions;
} XDeviceResolutionState;
The XDeviceResolutionControl structure
defines the attributes that can be controlled for keyboard
Devices.
typedef struct {
XID control;
int length;
int first_valuator;
int num_valuators;
int* resolutions;
} XDeviceResolutionControl;
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if some other client has caused the
specified device to become the X keyboard or X
pointer device via the
XChangeKeyboardDevice or
XChangePointerDevice
requests.
BadMatch
This error may occur if an
XGetDeviceControl request was
made specifying a device that has no controls or
an XChangeDeviceControl
request was made with an
XDeviceControl structure that
contains an invalid Device type. It may also occur
if an invalid combination of mask bits is
specified ( DvKey but no
DvAutoRepeatMode for keyboard
Devices), or if an invalid KeySym is specified for
a string Device.
BadValue
Some numeric value falls outside the range
of values accepted by the
XChangeDeviceControl request.
Unless a specific range is specified for an
argument, the full range defined by the argument's
type is accepted. Any argument defined as a set of
alternatives can generate this error.
See also
__vendorversion__
XGetDeviceKeyMapping
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XGetDeviceKeyMapping
XChangeDeviceKeyMapping
query or change device key mappings
Syntax
#include <X11/extensions/XInput.h>
KeySym *XGetDeviceKeyMapping
Display *display
XDevice *device
KeyCode first_keycode
int keycode_count
int *keysyms_per_keycode_return
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose key mapping is
to be queried or modified.
first_keycode
Specifies the first KeyCode to be
returned.
keycode_count
Specifies the number of KeyCodes to be
returned or modified.
keysyms_per_keycode
Specifies the number of KeySyms per
KeyCode.
keysyms_per_keycode_return
Specifies the address of a variable into
which the number of KeySyms per KeyCodewill be
returned.
keysyms
Specifies the address of an array of
KeySyms.
Description
For the specified device, the
XGetDeviceKeyMapping request returns the
symbols for the specified number of KeyCodes starting with
first_keycode. The value specified in first_keycode must be
greater than or equal to min_keycode as returned by
XListInputDevices, or a
BadValue error results. In addition, the
following expression must be less than or equal to max_keycode as
returned by XListInputDevices:
first_keycode + keycode_count - 1
If this is not the case, a BadValue error
results. The number of elements in the KeySyms list is:
keycode_count * keysyms_per_keycode_return
KeySym number N, counting from zero, for KeyCode K has the
following index in the list, counting from zero:
(K - first_code) * keysyms_per_code_return + N
The X server arbitrarily chooses the keysyms_per_keycode_return
value to be large enough to report all requested symbols. A
special KeySym value of NoSymbol is used to
fill in unused elements for individual KeyCodes. To free the
storage returned by XGetDeviceKeyMapping, use
XFree.
If the specified device does not support input class keys, a
BadMatch error will result.
XGetDeviceKeyMapping can generate a
BadDevice, BadMatch, or
BadValue error.
For the specified device, the
XChangeDeviceKeyMapping request defines the
symbols for the specified number of KeyCodes starting with
first_keycode. The symbols for KeyCodes outside this range remain
unchanged. The number of elements in keysyms must be:
num_codes * keysyms_per_keycode
The specified first_keycode must be greater than or equal to
min_keycode returned by XListInputDevices, or
a BadValue error results. In addition, the
following expression must be less than or equal to max_keycode as
returned by XListInputDevices, or a
BadValue error results:
first_keycode + num_codes - 1
KeySym number N, counting from zero, for KeyCode K has the
following index in keysyms, counting from zero:
(K - first_keycode) * keysyms_per_keycode + N
The specified keysyms_per_keycode can be chosen arbitrarily by the
client to be large enough to hold all desired symbols. A special
KeySym value of NoSymbol should be used to
fill in unused elements for individual KeyCodes. It is legal for
NoSymbol to appear in nontrailing positions
of the effective list for a
KeyCode.XChangeDeviceKeyMapping generates a
DeviceMappingNotify event that is sent to all
clients that have selected that type of event.
There is no requirement that the X server interpret this mapping.
It is merely stored for reading and writing by clients.
If the specified device does not support input class keys, a
BadMatch error results.
XChangeDeviceKeyMapping can generate a
BadDevice, BadMatch,
BadAlloc, or BadValue
error.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if the specified device is the X
keyboard or X pointer device.
BadMatch
This error may occur if an
XGetDeviceKeyMapping or
XChangeDeviceKeyMapping
request was made specifying a device that has no
keys.
BadValue
Some numeric value falls outside the range
of values accepted by the request. Unless a
specific range is specified for an argument, the
full range defined by the argument's type is
accepted. Any argument defined as a set of
alternatives can generate this error.
BadAlloc
The server failed to allocate the
requested resource or server memory.
See also
XSetDeviceButtonMapping(3), XSetDeviceModifierMapping(3)
__vendorversion__
XGetDeviceModifierMapping
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XGetDeviceModifierMapping
XSetDeviceModifierMapping
query or change device modifier mappings
Syntax
#include <X11/extensions/XInput.h>
int XSetDeviceModifierMapping
Display *display
XDevice *device
XModifierKeymap *modmap
XModifierKeymap *XGetDeviceModifierMapping
Display *display
XDevice *device
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose modifier
mapping is to be queried or modified.
modmap
Specifies a pointer to the
XModifierKeymap structure.
Description
The XSetDeviceModifierMapping request
specifies the KeyCodes of the keys (if any) that are to be used as
modifiers for the specified device. If it succeeds, the X server
generates a DeviceMappingNotify event, and
XSetDeviceModifierMapping returns
MappingSuccess. X permits at most eight
modifier keys. If more than eight are specified in the
XModifierKeymap structure, a
BadLength error results.
The modifiermap member of the XModifierKeymap
structure contains eight sets of max_keypermod KeyCodes, one for
each modifier in the order Shift,
Lock, Control,
Mod1, Mod2,
Mod3, Mod4, and
Mod5. Only nonzero KeyCodes have meaning in
each set, and zero KeyCodes are ignored. In addition, all of the
nonzero KeyCodes must be in the range specified by min_keycode and
max_keycode as returned by XListInputDevices,
or a BadValue error results. No KeyCode may
appear twice in the entire map, or a BadValue
error results.
An X server can impose restrictions on how modifiers can be
changed, for example, if certain keys do not generate up
transitions in hardware, if auto-repeat cannot be disabled on
certain keys, or if multiple modifier keys are not supported. If
some such restriction is violated, the status reply is
MappingFailed, and none of the modifiers are
changed. If the new KeyCodes specified for a modifier differ from
those currently defined and any (current or new) keys for that
modifier are in the logically down state,
XSetDeviceModifierMapping returns
MappingBusy, and none of the modifiers is
changed.
XSetDeviceModifierMapping can generate
BadLength, BadDevice,
BadMatch, BadAlloc, and
BadValue errors.
The XGetDeviceModifierMapping request returns
a pointer to a newly created XModifierKeymap
structure that contains the keys being used as modifiers. The
structure should be freed after use by calling
XFreeModifierMapping . If only zero values
appear in the set for any modifier, that modifier is disabled.
XGetDeviceModifierMapping can generate
BadDevice and BadMatch
errors.
Structures
The XModifierKeymap structure contains:
typedef struct {
int max_keypermod;
KeyCode *modifiermap;
} XModifierKeymap;
Diagnostics
BadLength
More than eight keys were specified in the
XModifierKeymap structure.
BadAlloc
The server failed to allocate the
requested resource or server memory.
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if the specified device is the X
keyboard or X pointer device.
BadMatch
This error may occur if an
XGetDeviceModifierMapping or
XChangeDeviceModifierMapping
request was made specifying a device that has no
keys.
BadValue
Some numeric value falls outside the range
of values accepted by the request. Unless a
specific range is specified for an argument, the
full range defined by the argument's type is
accepted. Any argument defined as a set of
alternatives can generate this error.
See also
XSetDeviceKeyMapping(3), XSetDeviceButtonMapping(3)
__vendorversion__
XGetDeviceMotionEvents
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XGetDeviceMotionEvents
XDeviceTimeCoord
get device motion history
Syntax
#include <X11/extensions/XInput.h>
XDeviceTimeCoord *XGetDeviceMotionEvents
Display *display
XDevice *device
Time start
Time stop
int *nevents_return
int *mode_return
int *axis_count_return
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose motion history is to
be queried.
start
stop
Specify the time interval in which the events
are returned from the motionhistory buffer.You can
pass a timestamp or CurrentTime.
nevents_return
Returns the number of events from the motion
history buffer.
mode_return
Returns the mode of the device
(Absolute or
Relative).
axis_count_return
Returns the count of axes being reported.
Description
The server may retain the recent history of the device motion
and do so to a finer granularity than is reported by
DeviceMotionNotify events. The
XGetDeviceMotionEvents request makes this
history available.
The XGetDeviceMotionEvents request returns
all events in the motion history buffer that fall between the
specified start and stop times, inclusive. If the start time is
later than the stop time or if the start time is in the future, no
events are returned. If the stop time is in the future, it is
equivalent to specifying CurrentTime.
The mode indicates whether the device is
reporting absolute positional data (mode =
Absolute ) or relative motion data (mode =
Relative ). Some devices allow their mode to
be changed via the XSetDeviceMode request.
These constants are defined in the file XI.h. The
axis_count returns the number of axes or
valuators being reported by the device.
XGetDeviceMotionEvents can generate a
BadDevice, or BadMatch
error.
Structures
The XDeviceTimeCoord structure contains:
typedef struct {
Time time;
int *data;
} XDeviceTimeCoord;
The time member is set to the time, in milliseconds. The data
member is a pointer to an array of integers. These integers are
set to the values of each valuator or axis reported by the device.
There is one element in the array per axis of motion reported by
the device. The value of the array elements depends on the mode of
the device. If the mode is Absolute, the
values are the raw values generated by the device. These may be
scaled by client programs using the maximum values that the device
can generate. The maximum value for each axis of the device is
reported in the max_val field of the
XAxisInfo returned by the
XListInputDevices request. If the mode is
Relative, the data values are the relative
values generated by the device.
You should use XFreeDeviceMotionEvents to
free the data returned by this request.
Errors returned by this request: BadDevice,
BadMatch.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if the specified device is the X
keyboard or X pointer device.
BadMatch
This error may occur if an
XGetDeviceMotionEvents
request is made specifying a device that has no
valuators and reports no axes of motion.
__vendorversion__
XGetExtensionVersion
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XQueryInputVersion
XGetExtensionVersion
query the version of the input extension.
Syntax
#include <X11/extensions/XInput.h>
XExtensionVersion *XQueryInputVersion
Display *display
int major
int minor
XExtensionVersion *XGetExtensionVersion
Display *display
char *name
Arguments
display
Specifies the connection to the X server.
name
Specifies the extension to be queried.
The input extension name is definedin the header
file XI.h.
major
Specifies the major version as supported
by the client.
minor
Specifies the minor version as supported
by the client.
Description
The XQueryInputVersion request queries the
version of the input extension and returns an
XExtensionVersion structure. This structure
contains a major_version and minor_version number which can be
compared with constants defined in XI.h. The
client must specify the highest version numbers it can supports.
The XGetExtensionVersion request is
deprecated and should not be used. Clients issuing a
XgetExtensionVersion request will not be
able to use MPX features. The
XGetExtensionVersion request queries the
version of the input extension, and returns an
XExtensionVersion structure. This structure
contains a major_version and minor_version number which can be
compared with constants defined in XI.h.
Support for additional protocol requests added to the input
extension after its initial release is indicated by a version
number corresponding to the added requests. Each version contains
all the protocol requests contained by previous versions.
You should use XFree to free the
XExtensionVersion structure.
Structures
This request returns an XExtensionVersion structure.
typedef struct {
int present;
short major_version;
short minor_version;
} XExtensionVersion;
__vendorversion__
XGetFeedbackControl
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XGetFeedbackControl
XChangeFeedbackControl
query and change input device feedbacks
Syntax
#include <X11/extensions/XInput.h>
XFeedbackState *XGetFeedbackControl
Display *display
XDevice *device
int *num_feedbacks
int XChangeFeedbackControl
Display *display
XDevice* device
Mask mask
XFeedbackControl *control
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose feedbacks are
to be queried or modified.
num_feedbacks
Specifies an address into which the number
of feedbacks supported by thedevice is to be
returned.
mask
Specifies a mask specific to each type of
feedback that describes howthe feedback is to be
modified.
control
Specifies the address of an
XFeedbackControl structure
that containsthe new values for the feedback.
Description
These requests are provided to manipulate those 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).
The XGetFeedbackControl request 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.
The XChangeFeedbackControl request 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.
Structures
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:
typedef struct {
XID class;
int length;
XID id;
} XFeedbackState,
XFeedbackControl;
The XKbdFeedbackState structure defines the
attributes that are returned for feedbacks equivalent to those on
the X keyboard.
typedef struct {
XID class;
int length;
XID id;
int click;
int percent;
int pitch;
int duration;
int led_mask;
int global_auto_repeat;
char auto_repeats[32];
} XKbdFeedbackState;
The XPtrFeedbackState structure defines the
attributes that are returned for feedbacks equivalent to those on
the the X pointer.
typedef struct {
XID class;
int length;
XID id;
int accelNum;
int accelDenom;
int threshold;
} XPtrFeedbackState;
The XIntegerFeedbackState structure defines
attributes that are returned for integer feedbacks.
typedef struct {
XID class;
int length;
XID id;
int resolution;
int minVal;
int maxVal;
} XIntegerFeedbackState;
The XStringFeedbackState structure defines
the attributes that are returned for string feedbacks.
typedef struct {
XID class;
int length;
XID id;
int max_symbols;
int num_syms_supported;
KeySym *syms_supported;
} XStringFeedbackState;
The XBellFeedbackState structure defines
the attributes that are returned for bell feedbacks.
typedef struct {
XID class;
int length;
XID id;
int percent;
int pitch;
int duration;
} XBellFeedbackState;
The XLedFeedbackState structure defines the
attributes that are returned for LED feedbacks.
typedef struct { XID class;
int length;
XID id;
int led_values;
} XLedFeedbackState;
The XPrtFeedbackControl structure defines
the attributes that can be controlled for pointer feedbacks.
typedef struct {
XID class;
int length;
XID id;
int accelNum;
int accelDenom;
int threshold;
} XPtrFeedbackControl;
The XKbdFeedbackControl structure defines
the attributes that can be controlled for keyboard feedbacks.
typedef struct {
XID class;
int length;
XID id;
int click;
int percent;
int pitch;
int duration;
int led_mask;
int led_value;
int key;
int auto_repeat_mode;
} XKbdFeedbackControl;
The XStringFeedbackControl structure
defines the attributes that can be controlled for string
feedbacks.
typedef struct {
XID class;
int length;
XID id;
int num_keysyms;
KeySym *syms_to_display;
} XStringFeedbackControl;
The XIntegerFeedbackControl structure
defines the attributes that can be controlled for integer
feedbacks.
typedef struct {
XID class;
int length;
XID id;
int int_to_display;
} XIntegerFeedbackControl;
The XBellFeedbackControl structure defines
the attributes that can be controlled for bell feedbacks.
typedef struct {
XID class;
int length;
XID id;
int percent;
int pitch;
int duration;
} XBellFeedbackControl;
The XLedFeedbackControl structure defines
the attributes that can be controlled for LED feedbacks.
typedef struct {
XID class;
int length;
XID id;
int led_mask;
int led_values;
} XLedFeedbackControl;
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if some other client has caused the
specified device to become the X keyboard or X
pointer device via the
XChangeKeyboardDevice or
XChangePointerDevice
requests.
BadMatch
This error may occur if an
XGetFeedbackControl request
was made specifying a device that has no
feedbacks, or an
XChangeFeedbackControl
request was made with an
XFeedbackControl structure
that contains an invalid feedback type. It may
also occur if an invalid combination of mask bits
is specified ( DvKey but no
DvAutoRepeatMode for
keyboard feedbacks), or if an invalid KeySym is
specified for a string feedback.
BadValue
Some numeric value falls outside the range
of values accepted by the
XChangeFeedbackControl
request. Unless a specific range is specified for
an argument, the full range defined by the
argument's type is accepted. Any argument defined
as a set of alternatives can generate this error.
__vendorversion__
XGrabDeviceButton
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XGrabDeviceButton
XUngrabDeviceButton
grab/ungrab extension input device buttons
Syntax
#include <X11/extensions/XInput.h>
int XGrabDeviceButton
Display *display
XDevice *device
unsigned int button
unsigned int modifiers
XDevice*modifier_device
Window grab_window
Boolowner_events
unsigned int event_count
XEventClass*event_list
int this_device_mode
intother_devices_mode
int XUngrabDeviceButton
Display *display
XDevice *device
unsigned int button
unsigned int modifiers
XDevice*modifier_device
Window grab_window
Arguments
display
Specifies the connection to the X server.
device
Specifies the device that is to be
grabbed or released
button
Specifies the device button that is to
be grabbed or released or AnyButton.
modifiers
Specifies the set of keymasks or
AnyModifier.The mask is
the bitwise inclusive OR of the valid keymask
bits. Valid bits are:
Shiftmask,
LockMask,
ControlMask,
Mod1Mask,
Mod2Mask,Mod3Mask,
Mod4Mask,
Mod5Mask.
modifier_device
specifies the device whose modifiers are
to be used. If the modifier_devicespecified is
NULL, the X keyboard will be used as the
modifier_device.
grab_window
Specifies the grab window.
owner_events
Specifies a Boolean value that indicates
whether the deviceevents are to be reported as
usual or reported with respect to the grab
windowif selected by the event list.
event_count
Specifies the number of event classes in
the event list.
event_list
Specifies which events are reported to the
client.
this_device_mode
Specifies further processing of events
from this device.You can pass
GrabModeSync or
GrabModeAsync.
other_devices_mode
Specifies further processing of events
from all other devices.You can pass
GrabModeSync or
GrabModeAsync.
Description
The XGrabDeviceButton request establishes a
passive grab. In the future, the device is actively grabbed (as
for XGrabDevice, the last-grab time is set
to the time at which the button was pressed (as transmitted in the
DeviceButtonPress event), and the
DeviceButtonPress event is reported if all
of the following conditions are true:
The device is not grabbed, and the specified button is
logically pressed when the specified modifier keys are
logically down on the specified modifier device and no
other buttons or modifier keys are logically down.
Either the grab window is an ancestor of (or is) the
focus window, OR the grab window is a descendent of the
focus window and contains the device.
A passive grab on the same button/modifier combination
does not exist on any ancestor of grab_window.
The interpretation of the remaining arguments is as for
XGrabDevice. The active grab is terminated
automatically when the logical state of the device has all buttons
released (independent of the logical state of the modifier keys).
Note that the logical state of a device (as seen by client
applications) may lag the physical state if device event
processing is frozen.
This request overrides all previous grabs by the same client on
the same button/modifier combinations on the same window. A
modifiers of AnyModifier is equivalent to
issuing the grab request for all possible modifier combinations
(including the combination of no modifiers). It is not required
that all modifiers specified have currently assigned KeyCodes. A
button of AnyButton is equivalent to
issuing the request for all possible buttons. Otherwise, it is not
required that the specified button currently be assigned to a
physical button.
A modifier_device of NULL indicates that the X keyboard is to be
used as the modifier_device.
If some other client has already issued a
XGrabDeviceButton with the same
button/modifier combination on the same window, a
BadAccess error results. When using
AnyModifier or
AnyButton , the request fails completely, and
a BadAccess error results (no grabs are
established) if there is a conflicting grab for any combination.
XGrabDeviceButton has no effect on an active
grab.
XGrabDeviceButton can generate
BadClass, BadDevice,
BadMatch, BadValue, and
BadWindow errors..P The
XUngrabDeviceButton request releases the
passive grab for a button/modifier combination on the specified
window if it was grabbed by this client. A modifier of
AnyModifier is equivalent to issuing the
ungrab request for all possible modifier combinations, including
the combination of no modifiers. A button of
AnyButton is equivalent to issuing the
request for all possible buttons.
XUngrabDeviceButton has no effect on an
active grab.
A modifier_device of NULL indicates that the X keyboard should be
used as the modifier_device.
XUngrabDeviceButton can generate
BadDevice, BadMatch,
BadValue and BadWindow
errors.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if the specified device is the X
keyboard or X pointer device.
BadMatch
This error may occur if an
XGrabDeviceButton request
was made specifying a device that has no buttons,
or specifying a modifier device that has no keys.
BadValue
Some numeric value falls outside the range
of values accepted by the request. Unless a
specific range is specified for an argument, the
full range defined by the argument's type is
accepted. Any argument defined as a set of
alternatives can generate this error.
BadWindow
A value for a Window argument does not name a defined Window.
See also
XAllowDeviceEvents(3), XGrabDevice(3), XGrabDeviceKey(3)
__vendorversion__
XGrabDeviceKey
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XGrabDeviceKey
XUngrabDeviceKey
grab/ungrab extension input device Keys
Syntax
#include <X11/extensions/XInput.h>
int XGrabDeviceKey
Display *display
XDevice *device
unsigned int Key
unsigned int modifiers
XDevice *modifier_device
Window grab_window
Bool owner_events
unsigned int event_count
XEventClass event_list
int this_device_mode
int other_devices_mode
int XUngrabDeviceKey
Display *display
XDevice *device
unsigned int Key
unsigned int modifiers
XDevice *modifier_device
Window grab_window
Arguments
display
Specifies the connection to the X server.
device
Specifies the device that is to be
grabbed or released.
Key
Specifies the device Key that is to be
grabbed released or AnyKey.
modifiers
Specifies the set of keymasks or
AnyModifier.The mask is the
bitwise inclusive OR of the valid keymask
bits.Valid bits are: ShiftMask, LockMask,
ControlMask, Mod1Mask, Mod2Mask,Mod3Mask,
Mod4Mask, Mod5Mask.
modifier_device
Specifies the device whose modifiers are
to be used. If a modifier_device ofNULL is
specified, the X keyboard will be used as the
modifier_device.
grab_window
Specifies the grab window.
owner_events
Specifies a Boolean value that indicates
whether the deviceevents are to be reported as
usual or reported with respect to the grab
windowif selected by the event list.
event_count
Specifies the number of event classes in
the event list.
event_list
Specifies which device events are reported
to the client.
this_device_mode
Specifies further processing of events
from this device.You can pass
GrabModeSync or
GrabModeAsync.
other_devices_mode
Specifies further processing of events
from other devices.You can pass
GrabModeSyncor
GrabModeAsync.
Description
The XGrabDeviceKey request establishes a
passive grab. In the future, the device is actively grabbed (as
for XGrabDevice, the last-device-grab time is
set to the time at which the Key was pressed (as transmitted in
the DeviceKeyPress event), and the
DeviceKeyPress event is reported if all of
the following conditions are true:
The device is not grabbed, and the specified key is
logically pressed when the specified modifier keys are
logically down, and no other keys or modifier keys are
logically down.
The grab_window is an ancestor (or is) the focus
window OR the grab window is a descendant of the focus
window and contains the device.
The confine_to window (if any) is
viewable.
A passive grab on the same key/modifier combination
does not exist on any ancestor of grab_window.
The interpretation of the remaining arguments is as for
XGrabDevice. The active grab is terminated
automatically when the logical state of the device has the
specified key released.
Note that the logical state of a device (as seen by means of the X
protocol ) may lag the physical state if device event processing
is frozen.
If the key is not AnyKey, it must be in the
range specified by min_keycode and max_keycode as returned by the
XListInputDevices request. Otherwise, a
BadValue error results.
This request overrides all previous grabs by the same client on
the same Key/modifier combinations on the same window. A modifier
of AnyModifier is equivalent to issuing the
grab request for all possible modifier combinations (including the
combination of no modifiers). It is not required that all
modifiers specified have currently assigned KeyCodes. A key of
AnyKey is equivalent to issuing the request
for all possible keys. Otherwise, it is not required that the
specified key currently be assigned to a physical Key.
If a modifier_device of NULL is specified, the X keyboard will be
used as the modifier_device.
If some other client has already issued a
XGrabDeviceKey with the same Key/modifier
combination on the same window, a BadAccess
error results. When using AnyModifier or
AnyKey, the request fails completely, and a
BadAccess error results (no grabs are
established) if there is a conflicting grab for any
combination.XGrabDeviceKey has no effect on
an active grab.
XGrabDeviceKey can generate
BadAccess, BadClass,
BadDevice, BadMatch,
BadValue, and BadWindow
errors. It returns Success on successful
completion of the request.
The XUngrabDeviceKey request releases the
passive grab for a key/modifier combination on the specified
window if it was grabbed by this client. A modifier of
AnyModifier is equivalent to issuing the
ungrab request for all possible modifier combinations, including
the combination of no modifiers. A Key of
AnyKey is equivalent to issuing the request
for all possible Keys.XUngrabDeviceKey has no
effect on an active grab.
If a modifier_device of NULL is specified, the X keyboard will be
used as the modifier_device.
XUngrabDeviceKey can generate
BadDevice, BadMatch,
BadValue and BadWindow
errors.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if the specified device is the X
keyboard or X pointer device.
BadMatch
This error may occur if an
XGrabDeviceKey request was
made specifying a device that has no keys, or a
modifier device that has no keys.
BadValue
Some numeric value falls outside the range
of values accepted by the request. Unless a
specific range is specified for an argument, the
full range defined by the argument's type is
accepted. Any argument defined as a set of
alternatives can generate this error.
BadWindow
A value for a Window argument does not
name a defined Window.
See also
XAllowDeviceEvents(3), XGrabDevice(3), XGrabDeviceButton(3)
__vendorversion__
XGrabDevice
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XGrabDevice
XUngrabDevice
grab/release the specified extension device
Syntax
#include <X11/extensions/XInput.h>
int XGrabDevice
Display *display
XDevice *device
Window grab_window
Bool owner_events
int event_count
XEventClass *event_list
int this_device_mode
int other_devices_mode
Time time
int XUngrabDevice
Display *display
XDevice *device
Time time
Arguments
display
Specifies the connection to the X server.
device
Specifies the device to be grabbed or
released.
grab_window
Specifies the id of a window to be
associated with the device.
owner_events
Specifies a Boolean value that indicates
whether theevents from the deviceare to be
reported as usual or reported with respect to the
grab windowif selected by the event list.
event_count
Specifies the number of elements in the
event_list array.
event_list
Specifies a pointer to a list of event
classes that indicates which eventsthe client
wishes to receive. These event classes must have
beenobtained specifying the device being grabbed.
this_device_mode
Specifies further processing of events
from this device.You can pass
GrabModeSyncor
GrabModeAsync.
other_devices_mode
Specifies further processing of events
from other devices.You can pass
GrabModeSyncor
GrabModeAsync.
time
Specifies the time.You can pass either a
timestamp or CurrentTime.
Description
The XGrabDevice request actively grabs
control of the device and generates
DeviceFocusIn and
DeviceFocusOut events. Further device events
are reported only to the grabbing
client.XGrabDevice overrides any active
device grab by this client. event_list is a pointer to a list of
event classes. This list indicates which events the client wishes
to receive while the grab is active. If owner_events is
False, all generated device events are
reported with respect to grab_window if selected. If owner_events
is True and if a generated device event would
normally be reported to this client, it is reported normally;
otherwise, the event is reported with respect to the grab_window,
and is only reported if specified in the event_list.
If the this_device_mode argument is
GrabModeAsync, device event processing
continues as usual. If the device is currently frozen by this
client, then processing of device events is resumed. If the
this_device_mode argument is GrabModeSync,
the state of the device (as seen by client applications) appears
to freeze, and the X server generates no further device events
until the grabbing client issues a releasing
XAllowDeviceEvents call or until the device
grab is released. Actual device changes are not lost while the
device is frozen; they are simply queued in the server for later
processing.
If other_devices_mode is GrabModeAsync,
processing of events from other devices is unaffected by
activation of the grab. If other_devices_mode is
GrabModeSync, the state of all devices except
the grabbed device (as seen by client applications) appears to
freeze, and the X server generates no further events from those
devices until the grabbing client issues a releasing
XAllowDeviceEvents call or until the device
grab is released. Actual events are not lost while the devices are
frozen; they are simply queued in the server for later processing.
If the device is actively grabbed by some other client,
XGrabDevice fails and returns
AlreadyGrabbed. If grab_window is not
viewable, it fails and returns
GrabNotViewable. If the device is frozen by
an active grab of another client, it fails and returns
GrabFrozen. If the specified time is earlier
than the last-device-grab time or later than the current X server
time, it fails and returns GrabInvalidTime.
Otherwise, the last-device-grab time is set to the specified time
( CurrentTime is replaced by the current X
server time).
If a grabbed device is closed by a client while an active grab by
that client is in effect, the active grab is released. If the
device is frozen only by an active grab of the requesting client,
it is thawed.
XGrabDevice can generate
BadClass, BadDevice,
BadValue, and BadWindow
errors.
The XUngrabDevice request releases the device
and any queued events if this client has it actively grabbed from
either XGrabDevice or
XGrabDeviceKey. If other devices are frozen
by the grab, XUngrabDevice thaws
them.XUngrabDevice does not release the
device and any queued events if the specified time is earlier than
the last-device-grab time or is later than the current X server
time. It also generates DeviceFocusIn and
DeviceFocusOut events. The X server
automatically performs an UngrabDevice
request if the event window for an active device grab becomes not
viewable.
XUngrabDevice can generate a
BadDevice error.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if the specified device is the X
keyboard or X pointer device.
BadValue
Some numeric value falls outside the range
of values accepted by the request. Unless a
specific range is specified for an argument, the
full range defined by the argument's type is
accepted. Any argument defined as a set of
alternatives can generate this error.
BadWindow
A value for a Window argument does not
name a defined Window.
See also
XAllowDeviceEvents(3),XGrabDeviceButton(3),XGrabDeviceKey(3)
__vendorversion__
XListInputDevices
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XListInputDevices
XFreeDeviceList
list available input devices
Syntax
#include <X11/extensions/XInput.h>
XDeviceInfo *XListInputDevices
Display *display
int *ndevices_return
int XFreeDeviceList
XDeviceInfo *list
Arguments
display
Specifies the connection to the X server.
ndevices_return
Specifies a pointer to a variable where
the number of available devices canbe returned.
list
Specifies the list of devices to free. The
XFreeDeviceList functionfrees
the list of available extension input devices.
Description
The XListInputDevices request lists the
available input devices. This list includes all master pointers
and master keyboards as well as the physical input devices
currently accessible through the X server, and any input devices
that are not currently accessible through the X server but could
be accessed if requested.
A master pointer is a virtual pointer device that does not
represent a physical device. It is visually represented through a
cursor. A master keyboard is a virtual keyboard device that does
not represent a physical device. It is virtually representd
through a keyboard focus. A master pointer and a master keyboard
are always paired (i.e. if shift is pressed on the master
keyboard, a pointer click would be a shift-click). Multiple master
pointer/keyboard pairs can exist.
Physical devices (so-called slave devices) are attached to either
a master pointer or a master keyboard, depending on their
capabilities. If a slave device generates an event, the event is
also generated by the respective master device. Multiple slave
devices can be attached to a single master device.
Some server implementations may make all physical input devices
available at the time the server is initialized. Others may wait
until requested by a client to access an input device. In the
latter case, it is possible that an input device will be listed as
available at one time but not at another.
For each input device available to the server, the
XListInputDevices request returns an XDeviceInfo structure. That
structure contains a pointer to a list of structures, each of
which contains information about one class of input supported by
the device. The XDeviceInfo structure is defined as follows:
typedef struct _XDeviceInfo {
XID id;
Atom type;
char *name;
int num_classes;
int use;
XAnyClassPtr inputclassinfo;
} XDeviceInfo;
The id is a number in the range 0-128 that uniquely identifies the
device. It is assigned to the device when it is initialized by the
server.
The type field is of type Atom and indicates the nature of the
device.
The name field contains a pointer to a null-terminated string that
corresponds to one of the defined device types. The name will
correspond to one of the following strings (defined in the header
file XI.h:
XI_MOUSE
XI_TABLET
XI_KEYBOARD
XI_TOUCHSCREEN
XI_TOUCHPAD
XI_BUTTONBOX
XI_BARCODE
XI_TRACKBALL
XI_QUADRATURE
XI_ID_MODULE
XI_ONE_KNOB
XI_NINE_KNOB
XI_KNOB_BOX
XI_SPACEBALL
XI_DATAGLOVE
XI_EYETRACKER
XI_CURSORKEYS
XI_FOOTMOUSE
XI_JOYSTICK
These names may be directly compared with the name field of the
XDeviceInfo structure, or used in an XInternAtom request to return
an atom that can be compared with the type field of the
XDeviceInfo structure.
The num_classes field is a number in the range 0-255 that
specifies the number of input classes supported by the device for
which information is returned by ListInputDevices. Some input
classes, such as class Focus and class Proximity do not have any
information to be returned by ListInputDevices.
All devices provide an AttachClass. This class specifies the
master device a given slave device is attached to. For master
devices, the class specifies the respective paired master device.
The use field specifies how the device is currently being used. If
the value is IsXKeyboard, the device is a
master keyboard. If the value is IsXPointer,
the device is a master pointer. If the value is
IsXExtensionPointer, the device is a slave
pointer. If the value is
IsXExtensionKeyboard, the device is a slave
keyboard. If the value is IsXExtensionDevice,
the device is available for use as an extension device.
The inputclassinfo field contains a pointer to the first
input-class specific data. The first two fields are common to all
classes.
The class field is a number in the range 0-255. It uniquely
identifies the class of input for which information is returned.
Currently defined classes are KeyClass, ButtonClass, and
ValuatorClass.
The length field is a number in the range 0- 255. It specifies the
number of bytes of data that are contained in this input class.
The length includes the class and length fields.
The XKeyInfo structure describes the characteristics of the keys
on the device. It is defined as follows:
typedef struct _XKeyInfo {
XID class;
int length;
unsigned short min_keycode;
unsigned short max_keycode;
unsigned short num_keys;
} XKeyInfo;
min_keycode is of type KEYCODE. It specifies the minimum keycode
that the device will report. The minimum keycode will not be
smaller than 8.
max_keycode is of type KEYCODE. It specifies the maximum keycode
that the device will report. The maximum keycode will not be
larger than 255.
num_keys specifies the number of keys that the device has.
The XButtonInfo structure defines the characteristics of the
buttons on the device. It is defined as follows:
typedef struct _XButtonInfo {
XID class;
int length;
short num_buttons;
} XButtonInfo;
num_buttons specifies the number of buttons that the device has.
The XValuatorInfo structure defines the characteristics of the
valuators on the device. It is defined as follows:
typedef struct _XValuatorInfo {
XID class;
int length;
unsigned char num_axes;
unsigned char mode;
unsigned long motion_buffer;
XAxisInfoPtr axes;
} XValuatorInfo;
num_axes contains the number of axes the device supports.
mode is a constant that has one of the following values: Absolute
or Relative. Some devices allow the mode to be changed dynamically
via the SetDeviceMode request.
motion_buffer_size is a cardinal number that specifies the number
of elements that can be contained in the motion history buffer for
the device.
The axes field contains a pointer to an XAxisInfo structure.
The XAxisInfo structure is defined as follows:
typedef struct _XAxisInfo {
int resolution;
int min_value;
int max_value;
} XAxisInfo;
The resolution contains a number in counts/meter.
The min_val field contains a number that specifies the minimum
value the device reports for this axis. For devices whose mode is
Relative, the min_val field will contain 0.
The max_val field contains a number that specifies the maximum
value the device reports for this axis. For devices whose mode is
Relative, the max_val field will contain 0.
The XAttachInfo structure is defined as follows:
typedef struct _XAttachInfo {
int attached;
} XAttachInfo;
If the device is a slave device, attached specifies the device ID
of the master device this device is attached to. If the device is
not attached to a master device, attached is
Floating. If the device is a master device,
attached specifies the device ID of the master device this device
is paired with.
To free the XDeviceInfo array created by
XListInputDevices, use
XFreeDeviceList.
__vendorversion__
XOpenDevice
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XOpenDevice
XCloseDevice
open or close an extension input device
Syntax
#include <X11/extensions/XInput.h>
XDevice *XOpenDevice
Display *display
XID device_id
XCloseDevice
Display *display
XDevice *device
Arguments
display
Specifies the connection to the X server.
device_id
Specifies the id of the device to be
opened
device
Specifies the device to be
closed
Description
The XOpenDevice request makes an input
device accessible to a client through input extension protocol
requests. If successful, it returns a pointer to an
XDevice structure.
The XCloseDevice request makes an input
device inaccessible to a client through input extension protocol
requests. Before terminating, and client that has opened input
devices through the input extension should close them via
CloseDevice.
When a client makes an XCloseDevice request,
any active grabs that the client has on the device are released.
Any event selections that the client has are deleted, as well as
any passive grabs. If the requesting client is the last client
accessing the device, the server may disable all access by X to
the device.
XOpenDevice and
XCloseDevice can generate a
BadDevice error.
Structures
The XDevice structure returned by
XOpenDevice contains:
typedef struct {
XID device_id;
int num_classes;
XInputClassInfo *classes;
} XDevice;
The classes field is a pointer to an array of XInputClassInfo
structures. Each element of this array contains an event type base
for a class of input supported by the specified device. The
num_classes field indicates the number of elements in the classes
array.
The XInputClassInfo structure contains:
typedef struct {
unsigned char input_class;
unsigned char event_type_base;
} XInputClassInfo;
The input_class field identifies one class of input supported by
the device. Defined types include KeyClass,
ButtonClass,
ValuatorClass,
ProximityClass,
FeedbackClass,
FocusClass, and
OtherClass. The event_type_base identifies
the event type of the first event in that class.
The information contained in the
XInputClassInfo structure is used by macros
to obtain the event classes that clients use in making
XSelectExtensionEvent requests. Currently
defined macros include DeviceKeyPress,
DeviceKeyRelease,
DeviceButtonPress,
DeviceButtonRelese,
DeviceMotionNotify,
DeviceFocusIn,
DeviceFocusOut,
ProximityIn,
ProximityOut,
DeviceStateNotify,
DeviceMappingNotify,
ChangeDeviceNotify,
DevicePointerMotionHint,
DeviceButton1Motion,
DeviceButton2Motion,
DeviceButton3Motion,
DeviceButton4Motion,
DeviceButton5Motion,
DeviceButtonMotion,
DeviceOwnerGrabButton,
DeviceButtonPressGrab, and
NoExtensionEvent.
To obtain the proper event class for a particular device, one of
the above macros is invoked using the XDevice
structure for that device. For example,
DeviceKeyPress (*device, type, eventclass);
returns the DeviceKeyPress event type and the
eventclass for DeviceKeyPress events from the
specified device.
This eventclass can then be used in an
XSelectExtensionEvent request to ask the
server to send DeviceKeyPress events from
this device. When a selected event is received via
XNextEvent, the type can
be used for comparison with the type in the event.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist, or is the X
keyboard or X pointer. This error may also occur
if some other client has caused the specified
device to become the X keyboard or X pointer
device via the
XChangeKeyboardDevice or
XChangePointerDevice
requests.
__vendorversion__
XQueryDeviceState
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XQueryDeviceState
query the state of an extension input device.
Syntax
#include <X11/extensions/XInput.h>
int XQueryDeviceState
Display *display
XDevice *device
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose state is to be
queried.
Description
The XQueryDeviceState request queries the
state of an input device. The current state of keys and buttons
(up or down), and valuators (current value) on the device is
reported by this request. Each key or button is represented by a
bit in the XDeviceState structure that is
returned. Valuators on the device report 0 if they are reporting
relative information, and the current value if they are reporting
absolute information.
XQueryDeviceState can generate a
BadDevice error.
Structures
The XDeviceState structure contains:
typedef struct {
XID device_id;
int num_classes;
XInputClass *data;
} XDeviceState;
The XValuatorState structure contains:
typedef struct {
unsigned char class;
unsigned char length;
unsigned char num_valuators;
unsigned char mode;
int *valuators;
} XValuatorState;
The XKeyState structure contains:
typedef struct {
unsigned char class;
unsigned char length;
short num_keys;
char keys[32];
} XKeyState;
The XButtonState structure contains:
typedef struct {
unsigned char class;
unsigned char length;
short num_buttons;
char buttons[32];
} XButtonState;
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if some other client has caused the
specified device to become the X keyboard or X
pointer device via the
XChangeKeyboardDevice or
XChangePointerDevice
requests.
__vendorversion__
XSelectExtensionEvent
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XSelectExtensionEvent
XGetSelectedExtensionEvents
select extension events, get the list of currently
selected extension events
Syntax
#include <X11/extensions/XInput.h>
XSelectExtensionEvent
Display *display
Window w
XEventClass *event_list
int event_count
XGetSelectedExtensionEvents
Display *display
Window w
int this_client_event_count_return
XEventClass *this_client_event_list_return
int all_clients_event_count_return
XEventClass *all_clients_event_list_return
Arguments
display
Specifies the connection to the X server.
w
Specifies the window whose events you
are interested in.
event_list
Specifies the list of event classes
that describe the events you are interested
in.
event_count
Specifies the count of event classes
in the event list.
this_client_event_count_return
Returns the count of event classes
selected by this client.
this_client_event_list_return
Returns a pointer to the list of event
classes
selected by this client.
all_clients_event_count_return
Returns the count of event classes
selected by all clients.
all_clients_event_list_return
Returns a pointer to the list of event
classes selected by all clients.
Description
The XSelectExtensionEvent request causes
the X server to report the events associated with the
specified list of event classes. Initially, X will not report
any of these events. Events are reported relative to a
window. If a window is not interested in a device event, it
usually propagates to the closest ancestor that is interested,
unless the do_not_propagate mask prohibits it.
Multiple clients can select for the same events on the same window
with the following restrictions:
Multiple clients can select events on the same
window because their event masks are disjoint.
When the X server generates an event, it reports
it to all interested clients.
Only one client at a time can select a
DeviceButtonPress event with
automatic passive grabbing enabled, which is
associated with the event class
DeviceButtonPressGrab. To
receive DeviceButtonPress
events without automatic passive grabbing, use
event class DeviceButtonPress
but do not specify event class
DeviceButtonPressGrab.
The server reports the event to all interested clients.
Information contained in the XDevice
structure returned by XOpenDevice is used by
macros to obtain the event classes that clients use in making
XSelectExtensionEvent requests. Currently
defined macros include DeviceKeyPress,
DeviceKeyRelease,
DeviceButtonPress,
DeviceButtonRelese,
DeviceMotionNotify,
DeviceFocusIn,
DeviceFocusOut,
ProximityIn,
ProximityOut,
DeviceStateNotify,
DeviceMappiingNotify,
ChangeDeviceNotify,
DevicePointerMotionHint,
DeviceButton1Motion,
DeviceButton2Motion,
DeviceButton3Motion,
DeviceButton4Motion,
DeviceButton5Motion,
DeviceButtonMotion,
DeviceOwnerGrabButton,
DeviceButtonPressGrab, and
NoExtensionEvent.
To obtain the proper event class for a particular device, one of the above
macros is invoked using the XDevice structure
for that device. For example,
DeviceKeyPress (*device, type, eventclass);
returns the DeviceKeyPress event type and the
eventclass for selecting DeviceKeyPress
events from this device.
XSelectExtensionEvent can generate a
BadWindow or BadClass
error. The XGetSelectedExtensionEvents
request reports the extension events selected by this client and
all clients for the specified window. This request returns
pointers to two XEventClass arrays. One
lists the input extension events selected by this client from the
specified window. The other lists the event classes selected by
all clients from the specified window. You should use
XFree to free these
two arrays.
XGetSelectedExtensionEvents
can generate a BadWindow error.
Diagnosis
BadWindow
A value for a Window argument does not
name a defined window.
BadClass
A value for an XEventClass is
invalid.
__vendorversion__
XSendExtensionEvent
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XSendExtensionEvent
send input extension events to a client
Syntax
#include <X11/extensions/XInput.h>
Status XSendExtensionEvent
Display *display
XDevice *device
Window destination
Bool propagate
int event_count
XEventClass *event_list
XEvent *event_send
Arguments
display
Specifies the connection to the X
server.
device
Specifies the device from which the
events are to be sent.
destination
Specifies the window the event is to
be sent to. You can pass window id,
PointerWindow,or
InputFocus.
propagate
Specifies a Boolean value that is
either True or False.
event_count
Specifies the count of XEventClasses
in event_list.
event_list
Specifies the list of event selections
to be used.
event_send
Specifies a pointer to the event that
is to be sent.
Description
The XSendExtensionEvent request
identifies the destination
window, determines which clients should receive the specified
events, and ignores any active grabs. This request requires you
to pass an event class list. For a discussion of the valid event
class names, see
XOpenDevice(__libmansuffix__)
This request uses the w argument to identify the destination
window as follows:
If w is PointerWindow,the
destination window is the window that contains the
pointer.
If w is InputFocusand if the
focus window contains the pointer,the destination
window is the window that contains the pointer;
otherwise, the destination window is the focus window.
To determine which clients should receive the specified events,
XSendExtensionEventuses the propagate
argument as follows:
If event_list is the empty set,the event is sent to
the client that created the destination window. If
that client no longer exists,no event is sent.
If propagate is False,the event
is sent to every client selecting on destination any
of the eventtypes specified by the event_list array.
If propagate is Trueand no
clients have selected on destination any ofthe events
specified by the event_list array,the destination is
replaced with theclosest ancestor of destination for
which some client has selected atype specified by the
event-list array and for which no interveningwindow
has that type in itsdo-not-propagate-mask. If no such
window exists or if the window isan ancestor of the
focus window and InputFocuswas
originally specifiedas the destination, the event is
not sent to any clients. Otherwise, the event is
reported to every client selecting on the
finaldestination any of the events specified in the
event_list array.
The event in the XEventstructure must be one
of the events defined by the input extension (or a
BadValueerror results) so that the X server
can correctly byte-swapthe contents as necessary. The contents of
the event areotherwise unaltered and unchecked by the X server
except to force send_event to Truein the
forwarded event and to set the serial number in the event
correctly.
XSendExtensionEventreturns zero if the
conversion to wire protocol format failedand returns nonzero
otherwise.XSendExtensionEventcan generate
BadClass, BadDevice,
BadValue, and BadWindow
errors.
Diagnosis
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if the specified device is the X
keyboard or X pointer device.
BadValue
Some numeric value falls outside the range of
values accepted by the request. Unless a specific
range is specified for an argument, the full range
defined by the argument's type is accepted. Any
argument defined as a set of alternatives can
generate this error.
BadWindow
A value for a Window argument does not
name a defined window.
__vendorversion__
XSetDeviceButtonMapping
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XSetDeviceButtonMapping
XGetDeviceButtonMapping
query or change device button mappings
Syntax
#include <X11/extensions/XInput.h>
int XSetDeviceButtonMapping
Display *display
XDevice *device
unsigned char map[]
int nmap
int XGetDeviceButtonMapping
Display *display
XDevice *device
unsigned char map_return[]
int nmap
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose button mapping
is to be queried or changed.
map
Specifies the mapping list.
map_return
Returns the mapping list.
nmap
Specifies the number of items in the
mapping list.
Description
The XSetDeviceButtonMapping request sets
the mapping of the specified device. If it succeeds, the X server
generates a DeviceMappingNotify event, and
XSetDeviceButtonMapping returns
MappingSuccess. Element map[i] defines the
logical button number for the physical button i+1. The length of
the list must be the same as
XGetDeviceButtonMapping would return, or a
BadValue error results. A zero element
disables a button, and elements are not restricted in value by the
number of physical buttons. However, no two elements can have the
same nonzero value, or a BadValue error
results. If any of the buttons to be altered are logically in the
down state, XSetDeviceButtonMapping returns
MappingBusy, and the mapping is not changed.
XSetDeviceButtonMapping can generate
BadDevice, BadMatch, and
BadValue errors.
The XGetDeviceButtonMapping request returns
the current mapping of the specified device. Buttons are numbered
starting from one.XGetDeviceButtonMapping
returns the number of physical buttons actually on the device. The
nominal mapping for a device is map[i]=i+1. The nmap argument
specifies the length of the array where the device mapping is
returned, and only the first nmap elements are returned in
map_return.
XGetDeviceButtonMapping can generate
BadDevice or BadMatch
errors.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if the specified device is the X
keyboard or X pointer device.
BadMatch
This error may occur if an
XGetDeviceButtonMapping or
XSetDeviceButtonMapping
request was made specifying a device that has no
buttons.
BadValue
Some numeric value falls outside the range
of values accepted by the request. Unless a
specific range is specified for an argument, the
full range defined by the argument's type is
accepted. Any argument defined as a set of
alternatives can generate this error.
See also
XChangeDeviceKeyboardControl(3), XChangeDeviceKeyMapping(3),
XChangeDeviceModifierMapping(3)
__vendorversion__
XSetDeviceFocus
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XSetDeviceFocus
XGetDeviceFocus
control extension input device focus
Syntax
#include <X11/extensions/XInput.h>
XSetDeviceFocus
Display *display
XDevice *device
Window focus
int revert_to
Time time
XGetDeviceFocus
Display *display
XDevice *device
Window *focus_return
int *revert_to_return
int * time_return
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose focus is to be
queried or changed.
focus
Specifies the window,
PointerRoot,
FollowKeyboard,or
None.
focus_return
Returns the focus window,
PointerRoot,
FollowKeyboard,or
None.
revert_to
Specifies where the input focus reverts to
if the window becomes notviewable.You can pass
RevertToParent,
RevertToPointerRoot,
RevertToFollowKeyboard,or
RevertToNone.
revert_to_return
Returns the current focus state
RevertToParent,
RevertToPointerRoot,
RevertToFollowKeyboard,or
RevertToNone.
time_return
Returns the last_focus_time for the
device.
time
Specifies the time.You can pass either a
timestamp or CurrentTime.
Description
The XSetDeviceFocus request changes the
focus of the specified device and its last-focus-change time. It
has no effect if the specified time is earlier than the current
last-focus-change time or is later than the current X server time.
Otherwise, the last-focus-change time is set to the specified time
CurrentTime is replaced by the current X
server time). XSetDeviceFocus causes the X
server to generate DeviceFocusIn and
DeviceFocusOut events.
Depending on the focus argument, the following occurs:
If focus is None , all
device events are discarded until a new focus window
is set, and the revert_to argument is ignored.
If focus is a window, it becomes the device's
focus window. If a generated device event would
normally be reported to this window or one of its
inferiors, the event is reported as usual. Otherwise,
the event is reported relative to the focus window.
If focus is PointerRoot, the
focus window is dynamically taken to be the root
window of whatever screen the pointer is on at each
event from the specified device. In this case, the
revert_to argument is ignored.
If focus is FollowKeyboard, the
focus window is dynamically taken to be the window to
which the X keyboard focus is set at each input event.
The specified focus window must be viewable at the time
XSetDeviceFocus is called, or a
BadMatch error results. If the focus window
later becomes not viewable, the X server evaluates the revert_to
argument to determine the new focus window as follows:
If revert_to is
RevertToParent, the focus reverts
to the parent (or the closest viewable ancestor), and
the new revert_to value is taken to be
RevertToNone.
If revert_to is
RevertToPointerRoot,
RevertToFollowKeyboard, or
RevertToNone, the focus reverts
to PointerRoot,
FollowKeyboard, or
None, respectively.
When the focus reverts, the X server generates
DeviceFocusIn and
DeviceFocusOut events, but the
last-focus-change time is not affected.
Input extension devices are not required to support the ability
to be focused. Attempting to set the focus of a device that does
not support this request will result in a
BadMatch error. Whether or not given device
can support this request can be determined by the
information returned by XOpenDevice. For
those devices that support focus,
XOpenDevice will return an
XInputClassInfo structure with the
input_class field equal to the constant
FocusClass (defined in the file
XI.h).
XSetDeviceFocus can generate
BadDevice, BadMatch,
BadValue, and
BadWindow errors.
The XGetDeviceFocus request returns the
focus window and the current focus state.
Not all input extension devices can be focused. Attempting to
query the focus state of a device that can't be focused results in
a BadMatch error. A device that can be
focused returns information for input Class Focus when an
XOpenDevice request is made.
XGetDeviceFocus can generate
BadDevice, and BadMatch
errors.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if the specified device is the X
keyboard or X pointer device.
BadValue
Some numeric value falls outside the range
of values accepted by the request. Unless a
specific range is specified for an argument, the
full range defined by the argument's type is
accepted. Any argument defined as a set of
alternatives can generate this error.
BadWindow
A value for a Window argument does not
name a defined Window.
BadMatch
This error may occur if an
XGetDeviceFocus or
XSetDeviceFocus request was
made specifying a device that the server
implementation does not allow to be focused.
__vendorversion__
XSetDeviceMode
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XSetDeviceMode
change the mode of a device
Syntax
#include <X11/extensions/XInput.h>
XSetDeviceMode
Display *display
XDevice *device
int mode
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose mode is to be
changed.
mode
Specifies the mode.You can pass
Absolute,or
Relative.
Description
The XSetDeviceMode request changes the
mode of an input device that is capable of reporting either
absolute positional information or relative motion information.
Not all input devices are capable of reporting motion data, and
not all are capable of changing modes from
Absolute to Relative.
XSetDeviceMode can generate a
BadDevice or BadMode
error.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice. This error
may also occur if some other client has caused the
specified device to become the X keyboard or X
pointer device via the
XChangeKeyboardDevice or
XChangePointerDevice
requests.
BadMatch
This error may occur if an
XSetDeviceMode request is
made specifying a device that has no valuators and
reports no axes of motion.
BadMode
An invalid mode was specified. This error
will also be returned if the specified device is
not capable of supporting the
XSetDeviceMode request.
__vendorversion__
XSetDeviceValuators
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XSetDeviceValuators
initialize the valuators on an extension input device
Syntax
#include <X11/extensions/XInput.h>
XSetDeviceValuators
Display *display
XDevice *device
int *valuators
int first_valuator
int num_valuators
Arguments
display
Specifies the connection to the X server.
device
Specifies the device whose valuators are
to be initialized.
valuators
Specifies a pointer to an array of integer
values to be used to initialize thedevice
valuators.
first_valuator
Specifies the first valuator to be set.
Valuators are numbered beginning withzero.
num_valuators
Specifies the number of valuators to be
set.
Description
The XSetDeviceValuators request sets the
current values of the valuators of an input device. The valuators
in the range first_valuator to (first_valuator + num_valuators)
are set to the specified values. Valuators are numbered beginning
with 0. Not all input devices support initialization of valuator
values. If this request is made to a device that does not support
valuators initialization, a BadMatch error
will occur.
If the request succeeds, a status of Success is returned. If
another client has the device grabbed, a status of AlreadyGrabbed
is returned.
XSetDeviceValuators can generate a
BadLength, BadDevice ,
BadMatch, or BadValue
error.
Diagnostics
BadDevice
An invalid device was specified. The
specified device does not exist or has not been
opened by this client via
XOpenInputDevice.
BadMatch
This error may occur if an
XSetDeviceValuators request
is made specifying a device that has no valuators
and reports no axes of motion, or if such a
request is made specifying a device that does not
support valuator initialization.
BadValue
An invalid first_valuator or num_valuators
values was specified.
__vendorversion__
February 14, 2008
PeterHutterer
Specification and implementation.
XSetClientPointer, XGetClientPointer
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XSetClientPointer
XGetClientPointer
set or get the ClientPointer setting.
Syntax
#include <X11/extensions/XInput.h>
XSetClientPointer
Display *display
Window win
XDevice *device
Bool XGetClientPointer
Display *display
Window win
XID *device
Arguments
display
Specifies the connection to the X server.
win
Specifies a window belonging to the
client. May be None.
device
Specifies the device to set as
ClientPointer.
Description
The ClientPointer is the device that is percieved to be the core
pointer for non-XI protocol requests and replies. Each time a
protocol message needs device-dependent data and the device is
not explicitly given, the ClientPointer device is used to obtain
the data. For example, a XQueryPointer
request will return the coordinates of the ClientPointer.
XSetClientPointer request sets the
ClientPointer device for the client that owns the given window. If
win is None, the
requesting client's ClientPointer is set to the
device. Only master pointer devices can be
set as ClientPointer.
XSetClientPointer and can generate a
BadDevice and a
BadWindow error.
The XGetClientPointer request returns the
ClientPointer's device ID for the client that owns the given
window. If win is
None, the requesting client's ClientPointer
is returned.
win may be a client ID instead
of a window.
XGetClientPointer can generate a
BadWindow error.
Diagnosis
BadDevice
An invalid device was specified. The device does
not exist or is not a master pointer device.
BadWindow
A value for a Window argument does not
name a defined window.
__vendorversion__
February 14, 2008
PeterHutterer
Specification and implementation.
XQueryDevicePointer
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XQueryDevicePointer
get device pointer coordinates.
Syntax
#include <X11/extensions/XInput.h>
Bool XQueryDevicePointer
Display *display
XDevice *device
Window win
Window *root_return
Window *child_return
int *root_x_return
int *root_y_return
int *win_x_return
int *win_y_return
unsigned int *mask_return
Arguments
child_return
Returns the child window that the pointer is
located in, if any.
device
Specifies the device to query.
display
Specifies the connection to the X server.
mask_return
Returns the current state of the modifier keys and
pointer buttons.
root_return
Returns the root window that the pointer is in.
root_x_return
root_y_return
Return the pointer coordinates relative to the root
window's origin.
win
Specifies the window.
win_x_return
win_y_return
Return the pointer coordinates relative to the
specified window.
Description
The XQueryDevicePointer function returns the root
window the device's pointer is logically on and the pointer
coordinates relative to the root window's origin. If
XQueryDevicePointer returns
False, the pointer is not on the same screen as
the specified window, and
XQueryDevicePointer returns
None to child_return and
zero to win_x_return and
win_y_return. If
XQueryDevicePointer returns
True, the pointer coordinates returned to
win_x_return and
win_y_return are relative to the origin of the
specified window. In this case,
XQueryDevicePointer returns the child that
contains the pointer, if any, or else None to
child_return.
XQueryDevicePointer returns the current
logical state of the keyboard buttons and the modifier keys in
mask_return. The keyboard paired with the
master pointer is selected to obtain this data. It sets
mask_return to the bitwise inclusive OR of
one or more of the button or modifier key bitmasks to match the
current state of the mouse buttons and the modifier keys.
XQueryDevicePointer is identical to
XQueryPointer but specifies the device
explicitly.
XQueryDevicePointer can generate a
BadDevice and a
BadWindow error.
Diagnosis
BadDevice
An invalid device was specified. The device does
not exist or is not a pointer device.
BadWindow
A value for a Window argument does not
name a defined window.
See also
XQueryPointer
__vendorversion__
February 14, 2008
PeterHutterer
Specification and implementation.
XDefineDeviceCursor, XUndefineDeviceCursor
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XDefineDeviceCursor
XUndefineDeviceCursor
define device cursors.
Syntax
#include <X11/extensions/XInput.h>
int XDefineCursor
Display *display
XDevice *device
Window win
Cursor cursor
int XUndefineCursor
Display *display
XDevice *device
Window win
Arguments
cursor
Specifies the cursor that is to be displayed or
None.
device
Specifies the device whose cursor is to
change.
display
Specifies the connection to the X server.
win
Specifies the window.
Description
If a cursor is set, it will be used when the device's pointer is in the
window. If the cursor is None, it is equivalent to
XUndefineDefineCursor.
XDefineDeviceCursor can generate
BadCursor and
BadWindow.
The XUndefineDeviceCursor function undoes the
effect of a previous XDefineDeviceCursor for
this window. When the pointer is in the window, the window's
default cursor will now be used. If no default cursor is defined,
the parent's cursor for this device will be used (if defined) or
the parent's default cursor will be used.
XDefineDeviceCursor and
XUndefineDeviceCursor are identical to
XDefineCursor and
XUndefineCursor but specify the device
explicitly.
XUndefineDevicePointer can generate a
BadDevice and a
BadWindow error.
Diagnosis
BadDevice
An invalid device was specified. The
device does not exist or is not a pointer
device.
BadWindow
A value for a Window argument does not
name a defined window.
See also
XDefineCursor,
XUndefineCursor
__vendorversion__
February 14, 2008
PeterHutterer
Specification and implementation.
XWarpDevicePointer
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XWarpDevicePointer
move device pointer.
Syntax
#include <X11/extensions/XInput.h>
Bool XWarpDevicePointer
Display *display
XDevice *device
Window src_w
Window dest_w
int src_x
int src_y
int src_width
int src_height
int dest_x
int dest_y
Arguments
dest_w
Specifies the destination window or
None.
dest_x
dest_y
Specify the x and y coordinates within the
destination window.
device
Specifies the device to move.
display
Specifies the connection to the X server.
src_x
src_y
src_width
src_height
Specify a rectangle in the source window.
src_w
Specifies the source window or
None.
Description
If dest_w is None,
XWarpDevicePointer moves the pointer by the
offsets (dest_x,
dest_y) relative to the current position
of the pointer. If
dest_w is a window,
XWarpDevicePointer moves the pointer to the
offsets
(dest_x, dest_y)
relative to the origin of dest_w.
However, if src_w is a window, the move
only takes place if the window src_w
contains the pointer and if the specified rectangle of
src_w contains the pointer.
The src_x and src_y
coordinates are relative to the origin of
src_w. If
src_height is zero, it is replaced with the
current height of src_w minus
src_y. If src_width
is zero, it is replaced with the current width of
src_w minus src_x.
There is seldom any reason for calling this function. The pointer
should normally be left to the user. If you do use this function,
however, it generates events just as if the user had
instantaneously moved the pointer from one position to another.
Note that you cannot use XWarpDevicePointer
to move the pointer outside the confine_to window of an active
pointer grab. An attempt to do so will only move the pointer as
far as the closest edge of the confine_to window.
XWarpDevicePointer is identical to
XWarpPointer but specifies the device
explicitly.
XWarpDevicePointer can generate a
BadDevice and a
BadWindow error.
Diagnosis
BadDevice
An invalid device was specified. The
device does not exist or is not a pointer
device.
BadWindow
A value for a Window argument does not
name a defined window.
See also
XWarpPointer
__vendorversion__
February 14, 2008
PeterHutterer
Specification and implementation.
XChangeDeviceHierarchy
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XChangeDeviceHierarchy
change the device hierarchy.
Syntax
#include <X11/extensions/XInput.h>
Status XChangeDeviceHierarchy
Display *display
XAnyHierarchyChangeInfo *changes
int num_changes
Arguments
display
Specifies the connection to the X server.
num_changes
Specifies the number of elements in changes.
changes
Specifies the changes to be made.
Description
XChangeDeviceHierarchy modifies the device
hierarchy by creating or removing master devices or changing the
attachment of slave devices. If num_changes
is non-zero, changes is an array of
XAnyHierarchyChangeInfo structures.
XChangeDeviceHierarchy processes
changes in order, effective immediately. If
an error occurs, processing is aborted and the error is reported
to the client. Changes already made remain effective.
The list of changes is any combination of
XAnyHierarchyChangeInfo. The
type of a hierarchy change can be
CH_CreateMasterDevice,
CH_RemoveMasterDevice or
CH_ChangeAttachment.
typedef union {
int type;
XCreateMasterInfo create;
XRemoveMasterInfo remove;
XChangeAttachmentInfo change;
} XAnyHierarchyChangeInfo;
typedef struct {
int type; /* CH_CreateMasterDevice */
char* name;
Bool sendCore;
Bool enable;
} XCreateMasterInfo;
typedef struct {
int type; /* CH_RemoveMasterDevice */
XDevice* device;
int returnMode;
XDevice* returnPointer;
XDevice* returnKeyboard;
} XRemoveMasterInfo;
typedef struct {
int type; /* CH_ChangeAttachment */
XDevice* device;
int changeMode;
XDevice* newMaster;
} XChangeAttachmentInfo;
XCreateMasterInfo creates a new master
pointer and a new master keyboard labelled
"name pointer" and
"name keyboard" respectively.
If sendCore is
True, the devices will send core events. If
enable is True,
the device is enabled immediately.
XCreateMasterInfo can generate a
BadValue error.
XRemoveMasterInfo removes
device and its paired master device. If
returnMode is
AttachToMaster, all pointers attached to
device or its paired master device are
attached to returnPointer. Likewise,
all keyboards are attached to
returnKeyboard. If
returnMode is
Floating, all attached devices are set to
floating.
XRemoveMasterInfo can generate a
BadValue and a
BadDevice error.
XChangeAttachmentInfo changes the
attachment of device to
newMaster if
changeMode is
AttachToMaster. Otherwise, if
changeMode is
Floating, device
is set floating.
XChangeAttachmentInfo can generate a
BadDevice and a
BadValue error.
Diagnosis
BadDevice
An invalid device was specified. The device does
not exist or is not a appropriate for the type of
change.
BadValue
Some numeric value falls out of the allowed range.
__vendorversion__
February 14, 2008
PeterHutterer
Specification and implementation.
XiSelectEvent
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XiSelectEvent
select for generic events on the window.
Syntax
#include <X11/extensions/XInput.h>
Status XiSelectEvent
Display *display
Window win
XDevice *device
Mask mask
Arguments
display
Specifies the connection to the X server.
device
The device to select
mask for. May be
NULL.
mask
Generic event mask.
win
Specifies the window.
Description
Events available through the X Generic Event extension (XGE)
cannot be selected with XSelectExtensionEvent.
For these events, XiSelectEvent must be used.
XiSelectEvent causes the X server to report
the events defined by mask on
win. The mask
overrides the previously selected event mask. A
mask of zero de-registers
win from any generic
events.
If device is a valid device, the event mask
is selected only for this device. If
device is NULL, the
event mask is selected for all devices.
A mask set for a device is stored
seperately for the mask for all devices. Thus, if a mask is set
for all devices, it cannot be unset for a single device. It has to
be unset for all devices first by supplying
NULL and then re-set one-by-one for all
devices.
XiSelectEvent can generate a
BadValue, a
BadDevice, and a
BadWindow error.
Diagnosis
BadValue
A value is outside of the permitted range.
BadWindow
A value for a Window argument does not
name a defined window.
BadDevice
An invalid device was specified. The
device does not exist.
See also
XSelectExtensionEvent
__vendorversion__
February 14, 2008
PeterHutterer
Specification and implementation.
XExtendedGrabDevice
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XExtendedGrabDevice
actively grab the device.
Syntax
#include <X11/extensions/XInput.h>
Status XExtendedGrabDevice
Display *display
XDevice *device
Window grab_window
int device_mode
Bool owner_events
Window confine_to
Cursor cursor
int event_count
XEventClass *event_list
int generic_event_count
XGenericEventMask *generic_events
Arguments
confine_to
Specifies the window to confine the pointer
in or None.
cursor
Specifies the cursor that is to be
displayed during the grab or None.
display
Specifies the connection to the X server.
device
The device to grab.
device_mode
Specifies further processing of device
events. You can pass GrabModeSync or
GrabModeAsync.
event_count
Specifies the number of elements in the event_list array.
event_list
Specifies a pointer to a list of event
classes that indicates which events the client wishes to receive. These event
classes must have been obtained specifying the device being grabbed.
generic_event_count
Specifies the number of elements in the generic_event_list array.
generic_event_list
Specifies a pointer to a list of generic event masks
that indicates which generic events the client wishes to receive.
grab_window
Specifies the grab window.
time
Specifies the time. You can pass either a timestamp or CurrentTime.
owner_events
Specifies a Boolean value that indicates
whether the pointer events are to be reported as usual or reported with respect
to the grab window if selected by the event mask.
Description
The XExtendedGrabDevice request actively grabs control
of the device and generates DeviceFocusIn and
DeviceFocusOut events if the device is a keyboard and
DeviceEnterNotify and
DeviceLeaveNotify if the device is a pointer. Further
device events are reported only to the grabbing client.
XExtendedGrabDevice overrides any active device grab by
this client.event_list is a pointer to a list of event
classes. This list indicates which events the client wishes to receive
while the grab is active. generic_event_list is
a pointer to a list of generic event masks. These masks indicates which generic
events the client wishes to receive while the grab is active.
If owner_events is False, all generated device
events are reported with respect to grab_window if selected. If owner_events
is True and if a generated device event would normally be reported
to this client, it is reported normally; otherwise, the event is
reported with respect to the grab_window, and is only reported if specified in
the event_list or generic_event_list.
If the device_mode argument is
GrabModeAsync, device event processing continues as
usual. If the device is currently frozen by this client, then processing of
device events is resumed. If the device_mode
argument is GrabModeSync, the state of the device (as
seen by client applications) appears to freeze, and the X server generates no
further device events until the grabbing client issues a releasing
XAllowDeviceEvents call or until the device grab is
released. Actual device changes are not lost while the device is frozen; they
are simply queued in the server for later processing.
If a cursor is specified and the device is a master pointer, it is
displayed regardless of what window the device's pointer is in.
If None is specified, the normal cursor for that window is
displayed when the pointer is in grab_window or one of its
subwindows; otherwise, the cursor for grab_window is displayed.
If a confine_to window is specified and the device is a master
pointer, the device's pointer is restricted to stay contained in
that window. The confine_to window need have no
relationship to the grab_window. If the
pointer is not initially in the confine_to
window, it is warped automatically to the closest edge just before
the grab activates and enter/leave events are generated as usual.
If the confine_to window is subsequently
reconfigured, the pointer is warped automatically, as
necessary, to keep it contained in the window.
The time argument allows you to avoid
certain circumstances that come up if applications take a long
time to respond or if there are long network delays. Consider a
situation where you have two applications, both of which normally
grab the pointer when clicked on. If both applications specify
the timestamp from the event, the second application may wake up
faster and successfully grab the pointer before the first
application. The first application then will get an indication
that the other application grabbed the pointer before its request
was processed.
If the device is actively grabbed by some other client,
XExtendedGrabDevice fails and returns
AlreadyGrabbed. If
grab_window is not viewable, it fails and
returns GrabNotViewable. If the device is
frozen by an active grab of another client, it fails and returns
GrabFrozen. If the specified time is earlier
than the last-device-grab time or later than the current X server
time, it fails and returns GrabInvalidTime.
Otherwise, the last-device-grab time is set to the specified time
(CurrentTime is replaced by the current X
server time).
XExtendedGrabDevice is mostly identical to
XGrabPointer and
XGrabDevice but enables a client to register
for generic event masks.
XExtendedGrabDevice can generate a
BadValue, a
BadDevice, and a
BadWindow error.
Diagnosis
BadValue
A value is outside of the permitted range.
BadWindow
A value for a Window argument does not
name a defined window.
BadDevice
An invalid device was specified. The
device does not exist.
See also
XGrabDevice,
XUngrabDevice,
XGrabPointer
__vendorversion__
July 9, 2008
PeterHutterer
Specification and implementation.
XListDeviceProperties
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XListDeviceProperties
List a device's properties.
Syntax
#include <X11/extensions/XInput.h>
Atom* XListDeviceProperties
Display *display
XDevice *device
int *nprops_return
Arguments
display
Specifies the connection to the X server.
device
The device to grab.
nprops_return
Specifies the number of Atoms returned.
num_values
Specifies the number of elements in the
values list.
property
Specifies the property to modify or query.
Description
The XListDeviceProperties function returns a
list of the properties associated with the input device specified
in device.
Each device may have an arbitrary number of properties attached,
some of which were created by the driver and/or server, others
created by clients at runtime.
The client is expected to free the list of properties using
XFree.
XListDeviceProperties can generate a
BadDevice error.
Diagnosis
BadAtom
A value does not describe a valid named
identifier.
BadWindow
A value for a Window argument does not
name a defined window.
BadDevice
An invalid device was specified. The
device does not exist.
See also
XChangeDeviceProperty,
XGetDeviceProperty,
XDeleteDeviceProperty.
__vendorversion__
July 9, 2008
PeterHutterer
Specification and implementation.
XGetDeviceProperty
__libmansuffix__
__xorgversion__
XINPUT FUNCTIONS
XGetDeviceProperty
XChangeDeviceProperty
XDeleteDeviceProperty
Get, change or delete a device's property.
Syntax
#include <X11/extensions/XInput.h>
int XGetDeviceProperty
Display *display
XDevice *device
Atom property
long offset
long length
Bool delete
Bool pending
Atom req_type
Atom *actual_type_return
int *actual_format_return
unsigned long *nitems_return
unsigned long *bytes_after_return
unsigned char **prop_return
void XChangeDeviceProperty
Display *display
XDevice *device
Atom property
Atom type
int format
int mode
const char *data
int nelements
void XDeleteDeviceProperty
Display *display
XDevice *device
Atom property
Arguments
actual_type_return
Returns an atom identifier that defines
the actual type of the property.
actual_format_return
Returns the actual format of the property.
bytes_after_return
Returns the number of bytes remaining to
be read in the property if a partial read was
performed.
data
Specifies the property data.
delete
Specifies a Boolean value that determines
wether the property is deleted.
display
Specifies the connection to the X server.
device
The device to grab.
format
Specifies whether the data should be
viewed as a list of 8-bit, 16-bit, or 32-bit
quantities. Possible values are 8, 16, and 32.
This information allows the X server to correctly
perform byte-swap operations as necessary. If the
format is 16-bit or 32-bit, you must explicitly
cast the data pointer to an (unsigned char*) in
the call to
XChangeDeviceProperty.
length
Specifies the length in 32-bit multiplies
of the data to be retrieved.
mode
Specifies the mode of operation. You can
pass PropModeReplace,
PropModePrepend, or
PropModeAppend.
nelements
Specifies the number of elements in data.
nitems_return
Returns the actual number of 8-bit,
16-bit, or 32-bit items stored in the prop_return
array.
num_values
Specifies the number of elements in the
values list.
offset
Specifies the offset in the specified
property (in 32-bit quantities) where the data is
to be retrieved.
pending
Specifies whether to retrieve the pending
state of the property or the current state.
property
Specifies the property to modify or query.
prop_return
Returns the data in the specified format.
If the returned format is 8, the returned data is
represented as a char array. If the returned
format is 16, the returned data is represented as
an array of short int type and should be cast to
that type to obtain the elements. If the returned
format is 32, the property data will be stored as
an array of longs (which in a 64-bit application
will be 64-bit values that are padded in the upper
4 bytes).
req_type
Specifies the atom identifier associated
with the property type or
AnyPropertyType.
Description
The XGetDeviceProperty function returns
the actual type of the property; the actual format of the property;
the number of 8-bit, 16-bit, or 32-bit items transferred; the number of bytes
remaining to be read in the property; and a pointer to the data actually
returned.
For a detailed description of this function, see the man page
to XGetWindowProperty.
The XChangeDeviceProperty function alters the
property for the specified device and causes the server to
generate a XPropertyNotifyEvent event on that
device.
For a detailed description of this function, see the man page to
XChangeProperty.
The XDeleteDeviceProperty function
deletes the specified device property. Note that a client cannot
delete a property created by a driver or the server. Attempting to
do so will result in a BadAtom error.
XGetDeviceProperty can generate a
BadAtom,
BadDevice error.
XChangeDeviceProperty can generate a
BadDevice, a
BadMatch, a
BadAtom, and a
BadValue error.
XDeleteDeviceProperty can generate a
BadDevice, and a
BadAtom error.
Diagnosis
BadAtom
A value does not describe a valid named
identifier or the client attempted to remove
a driver-allocated property.
BadDevice
An invalid device was specified. The
device does not exist.
See also
XListDeviceProperties,
XQueryDeviceProperty,
XConfigureDeviceProperty.