diff options
61 files changed, 8690 insertions, 0 deletions
diff --git a/man/XAllowDeviceEvents.man b/man/XAllowDeviceEvents.man new file mode 100644 index 0000000..bc954d8 --- /dev/null +++ b/man/XAllowDeviceEvents.man @@ -0,0 +1,149 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XAllDvEv.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XAllowDeviceEvents 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XAllowDeviceEvents \- release queued events +.SH SYNTAX +XAllowDeviceEvents\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIevent_mode\fP\^, \fItime\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + int \fIevent_mode\fP\^; +.br + Time \fItime\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device from which events are to be allowed. +.TP 12 +.I event_mode +Specifies the event mode. +You can pass +\fIAsyncThisDevice\fP, +\fISyncThisDevice\fP, +\fIReplayThisDevice\fP, +\fIAsyncOtherDevices\fP, +\fISyncAll\fP, +or +\fIAsyncAll\fP. +.TP 12 +.I time +Specifies the time. +You can pass either a timestamp or +\fICurrentTime\fP. +.SH DESCRIPTION +The +\fIXAllowDeviceEvents\fP +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. +.LP +The following describes the processing that occurs depending on what +constant you pass to the event_mode argument. +.TP 12 +\fIAsyncThisDevice\fP +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, \fIAsyncThisDevice\fP thaws for all. +\fIAsyncThisDevice\fP has no effect if the specified device is not frozen by +the client, but the device need not be grabbed by the client. +.TP 12 +\fISyncThisDevice\fP +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. \fISyncThisDevice\fP +has no effect if the specified device is not frozen by the client or is not +grabbed by the client. +.TP 12 +\fIReplayThisDevice\fP +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. +.TP 12 +\fIAsyncOtherDevices\fP +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, \fIAsyncOtherDevices\fP "thaws" for +all. \fIAsyncOtherDevices\fP has no effect if the devices are not frozen +by the client. +.TP 12 +\fISyncAll\fP +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. \fISyncAll\fP 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, \fISyncAll\fP thaws +for both. A subsequent freeze for \fISyncAll\fP will only +freeze each device once. +.TP 12 +\fIAsyncAll\fP +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, \fIAsyncAll\fP thaws for +all. \fIAsyncAll\fP has no effect unless all devices are frozen by +the client. +.LP +\fIAsyncThisDevice\fP, +\fISyncThisDevice\fP, +and +\fIReplayThisDevice\fP +have no effect on the processing of events from the remaining devices. +\fIAsyncOtherDevices\fP +has no effect on the processing of events from the specified device. When +the event_mode is +\fISyncAll\fP +or +\fIAsyncAll\fP, +the device parameter is ignored. +.LP +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. +.LP +\fIXAllowDeviceEvents\fP +can generate a \fIBadDevice\fP or +\fIBadValue\fP +error. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadValue\fP +An invalid mode was specified on the request. +.SH "SEE ALSO" +XGrabDevice(3X11) +.br +\fI\*(xL\fP diff --git a/man/XChangeDeviceDontPropagateList.man b/man/XChangeDeviceDontPropagateList.man new file mode 100644 index 0000000..b3e854e --- /dev/null +++ b/man/XChangeDeviceDontPropagateList.man @@ -0,0 +1,104 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XChProp.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XChangeDeviceDontPropagateList 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XChangeDeviceDontPropagateList, XGetDeviceDontPropagateList \- query or change the dont-propagate-list for extension devices +.SH SYNTAX +XChangeDeviceDontPropagateList\^(\^\fIdisplay\fP, \fIwindow\fP\^, +\fIcount\fP\^, \fIevent_list\fP\^, \fImode\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + Window *\fIwindow\fP\^; +.br + int *\fIcount\fP\^; +.br + XEventClass *\fIevent_list\fP\^; +.br + int \fImode\fP\^; +.br +XEventClass *XGetDeviceDontPropagateList\^(\^\fIdisplay\fP, \fIwindow\fP\^, +\fIcount\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + Window *\fIwindow\fP\^; +.br + int *\fIcount\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I window +Specifies the window whose dont-propagate-list is to be queried or modified. +.TP 12 +.I event_list +Specifies a pointer to a list of event classes. +.TP 12 +.I mode +Specifies the mode. +You can pass +\fIAddToList\fP , +or +\fIDeleteFromList\fP. +.TP 12 +.I count +Specifies the number of event classes in the list. +.SH DESCRIPTION +The \fIXChangeDeviceDontPropagateList\fP 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. +.LP +Suppression of event propagation is not allowed for all input extension +events. If a specified event class is one that cannot be suppressed, +a \fIBadClass\fP error will result. Events that can be suppressed +include \fIDeviceKeyPress\fP, \fIDeviceKeyRelease\fP, \fIDeviceButtonPress\fP, +\fIDeviceButtonRelease\fP, \fIDeviceMotionNotify\fP, \fIProximityIn\fP, +and \fIProximityOut\fP. +.LP +\fIXChangeDeviceDontPropagateList\fP +can generate a \fIBadDevice\fP, \fIBadClass\fP, or \fIBadValue\fP error. +.LP +The \fIXGetDeviceDontPropagateList\fP request queries the list +of events that should not be propagated to ancestors of the event window. +.LP +\fIXGetDeviceDontPropagateList\fP +can generate a \fIBadClass\fP or \fIBadWindow\fP error. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. 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 \fIXChangeKeyboardDevice\fP or +\fIXChangePointerDevice\fP requests. +.TP 12 +\fIBadValue\fP +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. +.TP 12 +\fIBadWindow\fP +An invalid window id was specified. +.TP 12 +\fIBadClass\fP +An invalid event class was specified. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XChangeKeyboardDevice.man b/man/XChangeKeyboardDevice.man new file mode 100644 index 0000000..53c2cf3 --- /dev/null +++ b/man/XChangeKeyboardDevice.man @@ -0,0 +1,69 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XChgKbd.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XChangeKeyboardDevice 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XChangeKeyboardDevice \- change which device is used as the X keyboard +.SH SYNTAX +Status XChangeKeyboardDevice\^(\^\fIdisplay\fP, \fIdevice\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device to be used as the X keyboard. +.SH DESCRIPTION +The \fIXChangeKeyboardDevice\fP 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 \fIXOpenDevice\fP or a \fIBadDevice\fP error will result. +The device must support input class \fIKeys\fP, or a \fIBadMatch\fP error +will result. If the server implementation does not support using the requested +device as the X keyboard, a \fIBadDevice\fP error will result. +.LP +If the specified device is grabbed by another client, \fIAlreadyGrabbed\fP +is returned. If the specified device is frozen by a grab on another device, +\fIGrabFrozen\fP is returned. +If the request is successful, \fISuccess\fP is returned. +.LP +If the request succeeds, +a \fIChangeDeviceNotify\fP event is sent to all clients that have selected that +event. A \fIMappingNotify\fP event with request = \fIMappingKeyboard\fP +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. +.LP +\fIXChangeKeyboardDevice\fP can generate a \fIBadDevice\fP or a \fIBadMatch\fP +error. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist, has +not been opened by this client via \fIXOpenInputDevice\fP, 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. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXChangeKeyboardDevice\fP request was made +specifying a device that has no keys. +.SH "SEE ALSO" +XChangePointerDevice +.br +\fI\*(xL\fP diff --git a/man/XChangePointerDevice.man b/man/XChangePointerDevice.man new file mode 100644 index 0000000..6122c3b --- /dev/null +++ b/man/XChangePointerDevice.man @@ -0,0 +1,79 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XChgPtr.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XChangePointerDevice 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XChangePointerDevice \- change which device is the X pointer +.SH SYNTAX +Status XChangePointerDevice\^(\^\fIdisplay\fP, \fIdevice\fP\^ \fIxaxis\fP\^, \fIyaxis\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + int \fIxaxis\fP\^; +.br + int \fIyaxis\fP\^; +.br +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device to be used as the X pointer. +.TP 12 +.I xaxis +Specifies the axis of the device to be used as the X pointer x-axis. +.TP 12 +.I yaxis +Specifies the axis of the device to be used as the X pointer y-axis. +.SH DESCRIPTION +The \fIXChangePointerDevice\fP request causes the server to use the specified +device as the X pointer. The device must have been opened by the client via +\fIXOpenDevice\fP or a \fIBadDevice\fP error will result. The device must +support input class \fIValuators\fP or a \fIBadMatch\fP error will result. +If the implementation does not support use of the specified device as the +X pointer, a \fIBadDevice\fP error will result. +.LP +If the specified device is grabbed by another client, \fIAlreadyGrabbed\fP +is returned. If the specified device is frozen by a grab on another device, +\fIGrabFrozen\fP is returned. +If the request is successful, \fISuccess\fP is returned. +.LP +If the request succeeds, +a \fIChangeDeviceNotify\fP event is sent to all clients that have selected that +event. A \fIMappingNotify\fP event with request = \fIMappingPointer\fP 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. +.LP +\fIXChangePointerDevice\fP can generate a \fIBadDevice\fP or a \fIBadMatch\fP +error. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist, has +not been opened by this client via \fIXOpenInputDevice\fP, 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. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXChangePointerDevice\fP request was made +specifying a device that has less than two valuators, or specifying a +valuator index beyond the range supported by the device. +.SH "SEE ALSO" +XChangeKeyboardDevice +.br +\fI\*(xL\fP diff --git a/man/XDeviceBell.man b/man/XDeviceBell.man new file mode 100644 index 0000000..5b44667 --- /dev/null +++ b/man/XDeviceBell.man @@ -0,0 +1,83 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XDevBell.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XDeviceBell 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XDeviceBell \- ring a bell on a device supported through the input extension +.SH SYNTAX +Status XDeviceBell\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIfeedbackclass\fP\^, \fIfeedbackid\fP\^, \fIpercent\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + XID *\fIfeedbackclass\fP\^; +.br + XID *\fIfeedbackid\fP\^; +.br + int *\fIpercent\fP\^; +.br +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device with which the bell is associated. +.TP 12 +.I feedbackclass +Specifies the class of the feedback with which the bell is associated. +.TP 12 +.I feedbackid +Specifies the id of the feedback with which the bell is associated. +.TP 12 +.I percent +Specifies the volume in the range -100 to 100 at which the bell should be rung. +.SH DESCRIPTION +The \fIXDeviceBell\fP 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 \fIBadDevice\fP error will be returned. The feedbackclass and feedbackid +parameters contain values returned by an \fIXGetFeedbackControl\fP 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 \fIBadValue\fP error will be returned. +.LP +The volume at which the bell is rung when the percent argument is +nonnegative is: +.IP +base \- [(base * percent) / 100] + percent +.LP +The volume at which the bell rings +when the percent argument is negative is: +.IP +base + [(base * percent) / 100] +.LP +To change the base volume of the bell, use \fIXChangeFeedbackControl\fP. +.LP +\fIXDeviceBell\fP can generate a \fIBadDevice\fP or a \fIBadValue\fP +error. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist, or has +not been opened by this client via \fIXOpenInputDevice\fP. +.TP 12 +\fIBadValue\fP +An invalid feedbackclass, feedbackid, or percent value was specified. +.SH "SEE ALSO" +XChangeFeedbackControl(3X), +XBell(3X) +.br +\fI\*(xL\fP diff --git a/man/XGetDeviceControl.man b/man/XGetDeviceControl.man new file mode 100644 index 0000000..ecae869 --- /dev/null +++ b/man/XGetDeviceControl.man @@ -0,0 +1,149 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XChDCtl.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XGetDeviceControl 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XGetDeviceControl, XChangeDeviceControl \- query and change input device controls +.SH SYNTAX +XDeviceControl * +XGetDeviceControl\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIcontrol\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + int *\fIcontrolType\fP\^; +.br +.sp +int XChangeDeviceControl\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIcontrolType\fP\^, \fIcontrol\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + int \fIcontrolType\fP\^; +.br + XDeviceControl *\fIcontrol\fP\^; +.SH ARGUMENTS +.TP 15 +.I display +Specifies the connection to the X server. +.TP 15 +.I device +Specifies the device whose control is to be interrogated or modified. +.TP 15 +.I controlType +Specifies the type of control to be interrogated or changed. +.TP 15 +.I control +Specifies the address of an \fIXDeviceControl\fP structure that contains +the new values for the Device. +.SH DESCRIPTION +These requests are provided to manipulate those input devices that +support device control. A \fIBadMatch\fP error will be generated if the +requested device does not support any device controls. +.LP +Valid device control types that can be used with these requests include the +following: +.TP 20 +DEVICE_RESOLUTION +Queries or changes the resolution of valuators on input devices. +.LP +The \fIXGetDeviceControl\fP request returns a pointer to an +\fIXDeviceControl\fP structure. +.LP +\fIXGetDeviceControl\fP can generate a \fIBadDevice\fP or +\fIBadMatch\fP error. +.LP +The \fIXChangeDeviceControl\fP request modifies the values of one +control on the specified device. The control is identified by the id +field of the \fIXDeviceControl\fP structure that is passed with the +request. +.LP +\fIXChangeDeviceControl\fP can generate a \fIBadDevice\fP, +\fIBadMatch\fP, or \fIBadValue\fP error. +.SH STRUCTURES +Each control is described by a structure specific to that control. +These structures are defined in the file \fIXInput.h\fP. +.LP +\fIXDeviceControl\fP is a generic +structure that contains two fields that are at the beginning of each class +of control: +.LP +.DS +.nf +typedef struct { +.br + XID class; +.br + int length; +.br +} XDeviceControl; +.fi +.DE +.LP +The \fIXDeviceResolutionState\fP structure defines the information that is +returned for device resolution for devices with valuators. +.LP +.DS +.nf +typedef struct { + XID control; + int length; + int num_valuators; + int *resolutions; + int *min_resolutions; + int *max_resolutions; +} XDeviceResolutionState; +.fi +.DE +.LP +The \fIXDeviceResolutionControl\fP structure defines the attributes that can be +controlled for keyboard Devices. +.LP +.DS +.nf +typedef struct { + XID control; + int length; + int first_valuator; + int num_valuators; + int *resolutions; +} XDeviceResolutionControl; +.fi +.DE +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. 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 \fIXChangeKeyboardDevice\fP or +\fIXChangePointerDevice\fP requests. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXGetDeviceControl\fP request was made specifying +a device that has no controls or an \fIXChangeDeviceControl\fP request was +made with an \fIXDeviceControl\fP structure that contains an invalid Device +type. It may also occur if an invalid combination of mask bits is specified +(\fIDvKey\fP but no \fIDvAutoRepeatMode\fP for keyboard Devices), or if an +invalid KeySym is specified for a string Device. +.TP 12 +\fIBadValue\fP +Some numeric value falls outside the range of values accepted by the +\fIXChangeDeviceControl\fP 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. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XGetDeviceKeyMapping.man b/man/XGetDeviceKeyMapping.man new file mode 100644 index 0000000..ba52b7c --- /dev/null +++ b/man/XGetDeviceKeyMapping.man @@ -0,0 +1,187 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XChKMap.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XGetDeviceKeyMapping 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XGetDeviceKeyMapping, XChangeDeviceKeyMapping \- query or change device key mappings +.SH SYNTAX +\fB +XChangeDeviceKeyMapping(\^\fIdisplay\fP, \fIdevice\fP, \fIfirst_keycode\fP, +\fIkeysyms_per_keycode\fP, \fIkeysyms\fP, \fIkeycode_count\fP\^) +.nf + Display *\fIdisplay\fP\^; + XDevice *\fIdevice\fP\^; + int \fIfirst_keycode\fP\^; + int \fIkeysyms_per_keycode\fP\^; + KeySym *\fIkeysyms\fP\^; + int \fIkeycode_count\fP\^; + +KeySym *XGetDeviceKeyMapping(\^\fIdisplay\fP, \fIdevice\fP, \fIfirst_keycode\fP, \fIkeycode_count\fP, +\fIkeysyms_per_keycode_return\fP\^) + Display *\fIdisplay\fP\^; + XDevice *\fIdevice\fP\^; + KeyCode \fIfirst_keycode\fP\^; + int \fIkeycode_count\fP\^; + int *\fIkeysyms_per_keycode_return\fP\^; +.fi +\fP +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device whose key mapping is to be queried or modified. +.TP 12 +.I first_keycode +Specifies the first KeyCode to be returned. +.TP 12 +.I keycode_count +Specifies the number of KeyCodes to be returned or modified. +.TP 12 +.I keysyms_per_keycode +Specifies the number of KeySyms per KeyCode. +.TP 12 +.I keysyms_per_keycode_return +Specifies the address of a variable into which the number of KeySyms per KeyCode +will be returned. +.TP 12 +.I keysyms +Specifies the address of an array of KeySyms. +.SH DESCRIPTION +For the specified device, +the \fIXGetDeviceKeyMapping\fP 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 +\fIXListInputDevices\fP, +or a +\fIBadValue\fP +error results. +In addition, the following expression must be less than or equal +to max_keycode as returned by +\fIXListInputDevices\fP: +.LP +.DS +first_keycode + keycode_count \- 1 +.DE +.LP +If this is not the case, a +\fIBadValue\fP +error results. +The number of elements in the KeySyms list is: +.LP +.DS +keycode_count * keysyms_per_keycode_return +.DE +.LP +KeySym number N, counting from zero, for KeyCode K has the following index +in the list, counting from zero: +.DS +(K \- first_code) * keysyms_per_code_return + N +.DE +.LP +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 +\fINoSymbol\fP +is used to fill in unused elements for +individual KeyCodes. +To free the storage returned by +\fIXGetDeviceKeyMapping\fP, +use +\fIXFree\fP. +.LP +If the specified device does not support input class keys, a \fIBadMatch\fP +error will result. +.LP +\fIXGetDeviceKeyMapping\fP +can generate a \fIBadDevice\fP, \fIBadMatch\fP, or \fIBadValue\fP +error. +.LP +For the specified device, the \fIXChangeDeviceKeyMapping\fP +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: +.LP +.DS +num_codes * keysyms_per_keycode +.DE +.LP +The specified first_keycode must be greater than or equal to min_keycode +returned by \fIXListInputDevices\fP, or a \fIBadValue\fP error results. +In addition, the following expression must be less than or equal to +max_keycode as returned by +\fIXListInputDevices\fP, or a \fIBadValue\fP error results: +.LP +.DS +first_keycode + num_codes \- 1 +.DE +.LP +KeySym number N, counting from zero, for KeyCode K has the following index +in keysyms, counting from zero: +.LP +.DS +(K \- first_keycode) * keysyms_per_keycode + N +.DE +.LP +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 +\fINoSymbol\fP +should be used to fill in unused elements +for individual KeyCodes. +It is legal for +\fINoSymbol\fP +to appear in nontrailing positions +of the effective list for a KeyCode. +\fIXChangeDeviceKeyMapping\fP generates a \fIDeviceMappingNotify\fP +event that is sent to all clients that have selected that type of event. +.LP +There is no requirement that the X server interpret this mapping. +It is merely stored for reading and writing by clients. +.LP +If the specified device does not support input class keys, a \fIBadMatch\fP +error results. +.LP +\fIXChangeDeviceKeyMapping\fP can generate a \fIBadDevice\fP, +\fIBadMatch\fP, \fIBadAlloc\fP, or \fIBadValue\fP error. +.LP +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXGetDeviceKeyMapping\fP or +\fIXChangeDeviceKeyMapping\fP request was made +specifying +a device that has no keys. +.TP 12 +\fIBadValue\fP +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. +.TP 12 +\fIBadAlloc\fP +The server failed to allocate the requested resource or server memory. +.SH "SEE ALSO" +XSetDeviceButtonMapping(3X11) +.br +XSetDeviceModifierMapping(3X11) +.br +\fI\*(xL\fP diff --git a/man/XGetDeviceModifierMapping.man b/man/XGetDeviceModifierMapping.man new file mode 100644 index 0000000..0175d83 --- /dev/null +++ b/man/XGetDeviceModifierMapping.man @@ -0,0 +1,145 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XChMMap.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XGetDeviceModifierMapping 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XGetDeviceModifierMapping, XSetDeviceModifierMapping \- query or change device modifier mappings +.SH SYNTAX +\fB +XSetDeviceModifierMapping(\^\fIdisplay\fP, \fIdevice\fP, \fImodmap\fP\^) +.nf + Display *\fIdisplay\fP\^; + XDevice *\fIdevice\fP\^; + XModifierKeymap *\fImodmap\fP\^; + +XModifierKeymap *XGetDeviceModifierMapping(\^\fIdisplay\fP, \fIdevice\fP\^) + Display *\fIdisplay\fP\^; + XDevice *\fIdevice\fP\^; +.fi +\fP +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device whose modifier mapping is to be queried or modified. +.TP 12 +.I modmap +Specifies a pointer to the \fIXModifierKeymap\fP structure. +.SH DESCRIPTION +The \fIXSetDeviceModifierMapping\fP +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 \fIDeviceMappingNotify\fP +event, and \fIXSetDeviceModifierMapping\fP returns \fIMappingSuccess\fP. +X permits at most eight modifier keys. +If more than eight are specified in the +\fIXModifierKeymap\fP structure, a \fIBadLength\fP +error results. +.LP +The modifiermap member of the \fIXModifierKeymap\fP +structure contains eight sets of max_keypermod KeyCodes, +one for each modifier in the order +\fIShift\fP, +\fILock\fP, +\fIControl\fP, +\fIMod1\fP, +\fIMod2\fP, +\fIMod3\fP, +\fIMod4\fP, +and +\fIMod5\fP. +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 +\fIXListInputDevices\fP, or a \fIBadValue\fP +error results. +No KeyCode may appear twice in the entire map, +or a +\fIBadValue\fP +error results. +.LP +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 +\fIMappingFailed\fP, +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, +\fIXSetDeviceModifierMapping\fP +returns \fIMappingBusy\fP, +and none of the modifiers is changed. +.LP +\fIXSetDeviceModifierMapping\fP +can generate \fIBadLength\P, \fIBadDevice\fP, \fIBadMatch\fP, \fIBadAlloc\fP, +and \fIBadValue\fP errors. +.LP +The +\fIXGetDeviceModifierMapping\fP +request returns a pointer to a newly created +\fIXModifierKeymap\fP +structure that contains the keys being used as modifiers. +The structure should be freed after use by calling +\fIXFreeModifierMapping \fP. +If only zero values appear in the set for any modifier, +that modifier is disabled. +.LP +\fIXGetDeviceModifierMapping\fP +can generate \fIBadDevice\fP and \fIBadMatch\fP errors. +.SH STRUCTURES +The \fIXModifierKeymap\fP structure contains: +.LP +.nf +typedef struct { + int max_keypermod; + KeyCode *modifiermap; +} XModifierKeymap; +.fi +.LP +.SH DIAGNOSTICS +.TP 12 +\fIBadLength\fP +More than eight keys were specified in the +\fIXModifierKeymap\fP structure. +.TP 12 +\fIBadAlloc\fP +The server failed to allocate the requested resource or server memory. +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXGetDeviceModifierMapping\fP +or \fIXChangeDeviceModifierMapping\fP request was made +specifying +a device that has no keys. +.TP 12 +\fIBadValue\fP +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. +.SH "SEE ALSO" +XSetDeviceKeyMapping(3X11) +.br +XSetDeviceButtonMapping(3X11) +.br +\fI\*(xL\fP diff --git a/man/XGetDeviceMotionEvents.man b/man/XGetDeviceMotionEvents.man new file mode 100644 index 0000000..cf8d732 --- /dev/null +++ b/man/XGetDeviceMotionEvents.man @@ -0,0 +1,125 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XGetDvMo.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XGetDeviceMotionEvents 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XGetDeviceMotionEvents, XDeviceTimeCoord \- get device motion history +.SH SYNTAX +XDeviceTimeCoord *XGetDeviceMotionEvents\^(\fIdisplay\fP\^, \fIdevice\fP\^, +\fIstart\fP\^, \fIstop\fP\^, +.br +\fInevents_return\fP\^, \fImode_return\fP\^, \fIaxis_count_return\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + Time \fIstart\fP\^, \fIstop\fP\^; +.br + int *\fInevents_return\fP\^; +.br + int *\fImode_return\fP\^; +.br + int *\fIaxis_count_return\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device whose motion history is to be queried. +.TP 12 +.I start +.br +.ns +.TP 12 +.I stop +Specify the time interval in which the events are returned from the motion +history buffer. +You can pass a timestamp or \fICurrentTime\fP. +.TP 12 +.I nevents_return +Returns the number of events from the motion history buffer. +.TP 12 +.I mode_return +Returns the mode of the device (\fIAbsolute\fP or \fIRelative\fP). +.TP 12 +.I axis_count_return +Returns the count of axes being reported. +.SH DESCRIPTION +The server may retain the recent history of the device motion +and do so to a finer granularity than is reported by +\fIDeviceMotionNotify\fP +events. +The \fIXGetDeviceMotionEvents\fP request makes this history available. +.LP +The +\fIXGetDeviceMotionEvents\fP +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 +\fICurrentTime\fP. +.LP +The \fImode\fP indicates whether the device is reporting absolute positional +data (mode=\fIAbsolute\fP) or relative motion data (mode=\fIRelative\fP). +Some devices allow their mode to be changed via the \fIXSetDeviceMode\fP +request. +These constants are defined in the file XI.h. The \fIaxis_count\fP +returns the number of axes or valuators being reported by the device. +.LP +\fIXGetDeviceMotionEvents\fP can generate a \fIBadDevice\fP, or \fIBadMatch\fP +error. +.SH STRUCTURES +The +\fIXDeviceTimeCoord\fP +structure contains: +.LP +.nf +typedef struct { + Time time; + int *data; +} XDeviceTimeCoord; +.fi +.LP +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 \fIAbsolute\fP, 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 \fIXAxisInfo\fP returned by the \fIXListInputDevices\fP +request. If the mode is \fIRelative\fP, the data values are the relative +values generated by the device. +.LP +You should use \fIXFreeDeviceMotionEvents\fP to free the data returned by +this request. +.LP +Errors returned by this request: \fIBadDevice\fP, \fIBadMatch\fP. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXGetDeviceMotionEvents\fP request is made +specifying +a device that has no valuators and reports no axes of motion. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XGetExtensionVersion.man b/man/XGetExtensionVersion.man new file mode 100644 index 0000000..29f7acf --- /dev/null +++ b/man/XGetExtensionVersion.man @@ -0,0 +1,53 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XGetExtV.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XGetExtensionVersion 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XGetExtensionVersion \- query the version of the input extension. +.SH SYNTAX +XExtensionVersion *XGetExtensionVersion\^(\^\fIdisplay\fP, \fIname\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + char *\fIname\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I name +Specifies the extension to be queried. The input extension name is defined +in the header file \fIXI.h\fP. +.SH DESCRIPTION +The \fIXGetExtensionVersion\fP request queries the version of the input +extension, and returns an \fIXExtensionVersion\fP structure. This structure +contains a major_version and minor_version number which can be compared +with constants defined in \fIXI.h\fP. 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. +.LP +You should use \fIXFree\fP to free the \fIXExtensionVersion\fP structure. +.SH STRUCTURES +This request returns an XExtensionVersion structure. +.DS +typedef struct { + int present; + short major_version; + short minor_version; +} XExtensionVersion; +.DE +.SH DIAGNOSTICS +none +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XGetFeedbackControl.man b/man/XGetFeedbackControl.man new file mode 100644 index 0000000..959052a --- /dev/null +++ b/man/XGetFeedbackControl.man @@ -0,0 +1,329 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XChFCtl.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XGetFeedbackControl 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XGetFeedbackControl, XChangeFeedbackControl \- query and change input device feedbacks +.SH SYNTAX +XFeedbackState * +XGetFeedbackControl\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fInum_feedbacks\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + int *\fInum_feedbacks\fP\^; +.br +.sp +int XChangeFeedbackControl\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fImask\fP\^, \fIcontrol\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + Mask \fImask\fP\^; +.br + XFeedbackControl *\fIcontrol\fP\^; +.SH ARGUMENTS +.TP 15 +.I display +Specifies the connection to the X server. +.TP 15 +.I device +Specifies the device whose feedbacks are to be queried or modified. +.TP 15 +.I num_feedbacks +Specifies an address into which the number of feedbacks supported by the +device is to be returned. +.TP 15 +.I mask +Specifies a mask specific to each type of feedback that describes how +the feedback is to be modified. +.TP 15 +.I control +Specifies the address of an \fIXFeedbackControl\fP structure that contains +the new values for the feedback. +.SH DESCRIPTION +These requests are provided to manipulate those input devices that +support feedbacks. A \fIBadMatch\fP 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 \fIXOpenDevice\fP request. For those devices that +support feedbacks, \fIXOpenDevice\fP will return an +\fIXInputClassInfo\fP structure with the input_class field +equal to the constant \fIFeedbackClass\fP (defined in the file \fIXI.h\fP). +.LP +The \fIXGetFeedbackControl\fP request returns a pointer to a list of +\fIXFeedbackState\fP 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. +.LP +The feedback classes that are currently defined are: \fIKbdFeedbackClass\fP, +\fIPtrFeedbackClass\fP, \fIStringFeedbackClass\fP, \fIIntegerFeedbackClass\fP, +\fILedFeedbackClass\fP, and \fIBellFeedbackClass\fP. These constants are +defined in the file \fIXI.h\fP. 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 \fIXChangeFeedbackControl\fP request. +.LP +\fIXGetFeedbackControl\fP can generate a \fIBadDevice\fP or +\fIBadMatch\fP error. +.LP +The \fIXChangeFeedbackControl\fP request modifies the values of one +feedback on the specified device. The feedback is identified by the id +field of the \fIXFeedbackControl\fP 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. +.LP +\fIXChangeFeedbackControl\fP can generate a \fIBadDevice\fP, +\fIBadMatch\fP, or \fIBadValue\fP error. +.SH STRUCTURES +Each class of feedback is described by a structure specific to that class. +These structures are defined in the file \fIXInput.h\fP. +\fIXFeedbackState\fP and \fIXFeedbackControl\fP are generic +structures that contain three fields that are at the beginning of each class +of feedback: +.LP +.DS +typedef struct { +.br + XID class; +.br + int length; +.br + XID id; +.br +} XFeedbackState, XFeedbackControl; +.DE +.LP +The \fIXKbdFeedbackState\fP structure defines the attributes that are +returned for feedbacks equivalent to those on the X keyboard. +.LP +.DS +.nf +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; +.fi +.DE +.LP +The \fIXPtrFeedbackState\fP structure defines the attributes that are +returned for feedbacks equivalent to those on the the X pointer. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int accelNum; + int accelDenom; + int threshold; +} XPtrFeedbackState; +.fi +.DE +.LP +The \fIXIntegerFeedbackState\fP structure defines attributes that are +returned for integer feedbacks. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int resolution; + int minVal; + int maxVal; +} XIntegerFeedbackState; +.fi +.DE +.LP +The \fIXStringFeedbackState\fP structure defines the attributes that are +returned for string feedbacks. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int max_symbols; + int num_syms_supported; + KeySym *syms_supported; +} XStringFeedbackState; +.fi +.DE +.LP +The \fIXBellFeedbackState\fP structure defines the attributes that are +returned for bell feedbacks. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int percent; + int pitch; + int duration; +} XBellFeedbackState; +.fi +.DE +.LP +The \fIXLedFeedbackState\fP structure defines the attributes that are +returned for LED feedbacks. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int led_values; +} XLedFeedbackState; +.fi +.DE +.LP +The \fIXPrtFeedbackControl\fP structure defines the attributes that can be +controlled for pointer feedbacks. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int accelNum; + int accelDenom; + int threshold; +} XPtrFeedbackControl; +.fi +.DE +.LP +The \fIXKbdFeedbackControl\fP structure defines the attributes that can be +controlled for keyboard feedbacks. +.LP +.DS +.nf +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; +.fi +.DE +.LP +The \fIXStringFeedbackControl\fP structure defines the attributes that can be +controlled for string feedbacks. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int num_keysyms; + KeySym *syms_to_display; +} XStringFeedbackControl; +.fi +.DE +.LP +The \fIXIntegerFeedbackControl\fP structure defines the attributes that can +be controlled for integer feedbacks. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int int_to_display; +} XIntegerFeedbackControl; +.fi +.DE +.LP +The \fIXBellFeedbackControl\fP structure defines the attributes that can be +controlled for bell feedbacks. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int percent; + int pitch; + int duration; +} XBellFeedbackControl; +.fi +.DE +.LP +The \fIXLedFeedbackControl\fP structure defines the attributes that can be +controlled for LED feedbacks. +.LP +.DS +.nf +typedef struct { + XID class; + int length; + XID id; + int led_mask; + int led_values; +} XLedFeedbackControl; +.fi +.DE +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. 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 \fIXChangeKeyboardDevice\fP or +\fIXChangePointerDevice\fP requests. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXGetFeedbackControl\fP request was made specifying +a device that has no feedbacks, or an \fIXChangeFeedbackControl\fP request was +made with an \fIXFeedbackControl\fP structure that contains an invalid feedback +type. It may also occur if an invalid combination of mask bits is specified +(\fIDvKey\fP but no \fIDvAutoRepeatMode\fP for keyboard feedbacks), or if an +invalid KeySym is specified for a string feedback. +.TP 12 +\fIBadValue\fP +Some numeric value falls outside the range of values accepted by the +\fIXChangeFeedbackControl\fP 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. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XGrabDevice.man b/man/XGrabDevice.man new file mode 100644 index 0000000..8a5608c --- /dev/null +++ b/man/XGrabDevice.man @@ -0,0 +1,207 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XGrabDev.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XGrabDevice 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XGrabDevice, XUngrabDevice \- grab/release the specified extension device +.SH SYNTAX +.nf +\fB +int XGrabDevice\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIgrab_window\fP\^, \fIowner_events\fP\^, \fIevent_count\fP\^, \fIevent_list\fP\^, +\fIthis_device_mode\fP\^, \fIother_devices_mode\fP\^, \fItime\fP\^) + Display *\fIdisplay\fP\^; + XDevice *\fIdevice\fP\^; + Window \fIgrab_window\fP\^; + Bool \fIowner_events\fP\^; + int \fIevent_count\fP\^; + XEventClass *\fIevent_list\fP\^; + int \fIthis_device_mode\fP\^, \fIother_devices_mode\fP\^; + Time \fItime\fP\^; + +XUngrabDevice\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fItime\fP\^) + Display *\fIdisplay\fP\^; + XDevice *\fIdevice\fP\^; + Time \fItime\fP\^; +.fi +\fP +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device to be grabbed or released. +.TP 12 +.I grab_window +Specifies the id of a window to be associated with the device. +.TP 12 +.I owner_events +Specifies a Boolean value that indicates whether the +events from the device +are to be reported as usual or reported with respect to the grab window +if selected by the event list. +.TP 12 +.I event_count +Specifies the number of elements in the event_list array. +.TP 12 +.I 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. +.TP 12 +.I this_device_mode +Specifies further processing of events from this device. +You can pass +\fIGrabModeSync\fP +or +\fIGrabModeAsync\fP. +.TP 12 +.I other_devices_mode +Specifies further processing of events from other devices. +You can pass +\fIGrabModeSync\fP +or +\fIGrabModeAsync\fP. +.TP 12 +.I time +Specifies the time. +You can pass either a timestamp or +\fICurrentTime\fP. +.SH DESCRIPTION +The +\fIXGrabDevice\fP +request actively grabs control of the device and generates +\fIDeviceFocusIn\fP +and +\fIDeviceFocusOut\fP +events. +Further device events are reported only to the +grabbing client. +\fIXGrabDevice\fP +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 +\fIFalse\fP , +all generated device events are reported with +respect to grab_window if selected. +If owner_events is +\fITrue\fP +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. +.LP +If the this_device_mode argument is +\fIGrabModeAsync\fP , +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 +\fIGrabModeSync\fP , +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 +\fIXAllowDeviceEvents\fP +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. +.LP +If other_devices_mode is +\fIGrabModeAsync\fP , +processing of events from other devices is unaffected +by activation of the grab. +If other_devices_mode is +\fIGrabModeSync\fP, +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 +\fIXAllowDeviceEvents\fP +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. +.LP +If the device is actively grabbed by some other client, +\fIXGrabDevice\fP +fails and returns +\fIAlreadyGrabbed\fP. +If grab_window is not viewable, +it fails and returns +\fIGrabNotViewable\fP. +If the device is frozen by an active grab of another client, +it fails and returns +\fIGrabFrozen\fP. +If the specified time is earlier than the last-device-grab time +or later than the current X server time, +it fails and returns +\fIGrabInvalidTime\fP. +Otherwise, the last-device-grab time is set to the specified time +\fI( CurrentTime\fP +is replaced by the current X server time). +.LP +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. +.LP +\fIXGrabDevice\fP +can generate +\fIBadClass\fP, \fIBadDevice\fP, \fIBadValue\fP, and \fIBadWindow\fP +errors. +.LP +The +\fIXUngrabDevice\fP +request +releases the device and any queued events if this client has it actively +grabbed from either +\fIXGrabDevice\fP +or +\fIXGrabDeviceKey\fP. +If other devices are frozen by the grab, \fIXUngrabDevice\fP thaws them. +\fIXUngrabDevice\fP +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 +\fIDeviceFocusIn\fP +and +\fIDeviceFocusOut\fP +events. +The X server automatically performs an +\fIUngrabDevice\fP +request if the event window for an +active device grab becomes not viewable. +.LP +\fIXUngrabDevice\fP +can generate a \fIBadDevice\fP error. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadValue\fP +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. +.TP 12 +\fIBadWindow\fP +A value for a Window argument does not name a defined Window. +.SH "SEE ALSO" +XAllowDeviceEvents(3X), +XGrabDeviceButton(3X), +XGrabDeviceKey(3X), +.br +\fI\*(xL\fP diff --git a/man/XGrabDeviceButton.man b/man/XGrabDeviceButton.man new file mode 100644 index 0000000..bb42011 --- /dev/null +++ b/man/XGrabDeviceButton.man @@ -0,0 +1,217 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XGrDvBut.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XGrabDeviceButton 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XGrabDeviceButton, XUngrabDeviceButton \- grab/ungrab extension input device buttons +.SH SYNTAX +\fB +.nf +XGrabDeviceButton\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIbutton\fP\^, \fImodifiers\fP\^, \fImodifier_device\fP\^, \fIgrab_window\fP\^, +\fIowner_events\fP\^, \fIevent_count\fP\^, \fIevent_list\fP\^, \fIthis_device_mode\fP\^, \fIother_devices_mode\fP\^) + Display *\fIdisplay\fP\^; + XDevice *\fIdevice\fP\^; + unsigned int \fIbutton\fP\^; + unsigned int \fImodifiers\fP\^; + XDevice *\fImodifier_device\fP\^; + Window \fIgrab_window\fP\^; + Bool \fIowner_events\fP\^; + unsigned int \fIevent_count\fP\^; + XEventClass *\fIevent_list\fP\^; + int \fIthis_device_mode\fP\^, \fIother_devices_mode\fP\^; + +XUngrabDeviceButton\^(\^\fIdisplay\fP\^, \fIdevice\fP\^, \fIbutton\fP\^, \fImodifiers\fP\^, \fImodifier_device\fP\^, \fIgrab_window\fP\^) + Display *\fIdisplay\fP\^; + XDevice *\fIdevice\fP\^; + unsigned int \fIbutton\fP\^; + unsigned int \fImodifiers\fP\^; + XDevice *\fImodifier_device\fP\^; + Window \fIgrab_window\fP\^; +.fi +\fP +.SH ARGUMENTS +.ds Bu grabbed or released +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device that is to be \*(Bu +.TP 12 +.I button +Specifies the device button that is to be \*(Bu or +\fIAnyButton\fP. +.TP 12 +.I modifiers +Specifies the set of keymasks or +\fIAnyModifier\fP. +The mask is the bitwise inclusive OR of the valid keymask bits. +Valid bits are: Shiftmask, LockMask, ControlMask, Mod1Mask, Mod2Mask, +Mod3Mask, Mod4Mask, Mod5Mask. +.TP 12 +.I modifier_device +specifies the device whose modifiers are to be used. If the modifier_device +specified is NULL, the X keyboard will be used as the modifier_device. +.TP 12 +.I grab_window +Specifies the grab window. +.TP 12 +.I owner_events +Specifies a Boolean value that indicates whether the device +events are to be reported as usual or reported with respect to the grab window +if selected by the event list. +.TP 12 +.I event_count +Specifies the number of event classes in the event list. +.TP 12 +.I event_list +Specifies which events are reported to the client. +.TP 12 +.I this_device_mode +Specifies further processing of events from this device. +You can pass \fIGrabModeSync\fP or \fIGrabModeAsync\fP. +.TP 12 +.I other_devices_mode +Specifies further processing of events from all other devices. +You can pass \fIGrabModeSync\fP or \fIGrabModeAsync\fP. +.SH DESCRIPTION +The \fIXGrabDeviceButton\fP request establishes a passive grab. +In the future, +the device is actively grabbed (as for \fIXGrabDevice\fP, +the last-grab time is set to the time at which the button was pressed +(as transmitted in the +\fIDeviceButtonPress\fP +event), and the +\fIDeviceButtonPress\fP +event is reported if all of the following conditions are true: +.IP \(bu 5 +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. +.IP \(bu 5 +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. +.IP \(bu 5 +A passive grab on the same button/modifier combination does not exist +on any ancestor of grab_window. +.LP +The interpretation of the remaining arguments is as for +\fIXGrabDevice\fP. +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). +.LP +Note that the logical state of a device (as seen by client applications) +may lag the physical state if device event processing is frozen. +.LP +This request overrides all previous grabs by the same client on the same +button/modifier combinations on the same window. +A modifiers of +\fIAnyModifier\fP +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 +\fIAnyButton\fP +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. +.LP +A modifier_device of NULL indicates that the X keyboard is to be used as the +modifier_device. +.LP +If some other client has already issued a +\fIXGrabDeviceButton\fP +with the same button/modifier combination on the same window, a +\fIBadAccess\fP +error results. +When using +\fIAnyModifier\fP +or +\fIAnyButton\fP , +the request fails completely, +and a +\fIBadAccess\fP +error results (no grabs are +established) if there is a conflicting grab for any combination. +\fIXGrabDeviceButton\fP +has no effect on an active grab. +.LP +\fIXGrabDeviceButton\fP +can generate +\fIBadClass\fP, +\fIBadDevice\fP, +\fIBadMatch\fP, +\fIBadValue\fP, +and +\fIBadWindow\fP +errors. +.P +The \fIXUngrabDeviceButton\fP +request releases the passive grab for a +button/modifier combination on the specified window if +it was grabbed by this client. +A modifier of \fIAnyModifier\fP is +equivalent to issuing +the ungrab request for all possible modifier combinations, including +the combination of no modifiers. +A button of +\fIAnyButton\fP +is equivalent to issuing the +request for all possible buttons. +\fIXUngrabDeviceButton\fP +has no effect on an active grab. +.LP +A modifier_device of NULL indicates that the X keyboard should be used as +the modifier_device. +.LP +\fIXUngrabDeviceButton\fP +can generate +\fIBadDevice\fP, +\fIBadMatch\fP, +\fIBadValue\fP +and +\fIBadWindow\fP +errors. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXGrabDeviceButton\fP request was made +specifying +a device that has no buttons, or specifying a modifier device +that has no keys. +.TP 12 +\fIBadValue\fP +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. +.TP 12 +\fIBadWindow\fP +A value for a Window argument does not name a defined Window. +.SH "SEE ALSO" +XAllowDeviceEvents(3X), +.br +XGrabDevice(3X), +.br +XGrabDeviceKey(3X), +.br +\fI\*(xL\fP diff --git a/man/XGrabDeviceKey.man b/man/XGrabDeviceKey.man new file mode 100644 index 0000000..4f92451 --- /dev/null +++ b/man/XGrabDeviceKey.man @@ -0,0 +1,231 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XGrDvKey.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XGrabDeviceKey 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XGrabDeviceKey, XUngrabDeviceKey \- grab/ungrab extension input device Keys +.SH SYNTAX +XGrabDeviceKey\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIKey\fP\^, \fImodifiers\fP\^, +\fImodifier_device\fP\^, \fIgrab_window\fP\^, \fIowner_events\fP\^, +.br +\fIevent_count\fP\^, \fIevent_list\fP\^, \fIthis_device_mode\fP\^, +\fIother_devices_mode\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + unsigned int \fIKey\fP\^; +.br + unsigned int \fImodifiers\fP\^; +.br + XDevice *\fImodifier_device\fP\^; +.br + Window \fIgrab_window\fP\^; +.br + Bool \fIowner_events\fP\^; +.br + unsigned int \fIevent_count\fP\^; +.br + XEventClass \fIevent_list\fP\^; +.br + int \fIthis_device_mode\fP\^, \fIother_devices_mode\fP\^; +.sp +XUngrabDeviceKey\^(\fIdisplay\fP\^, \fIdevice\fP\^, \fIKey\fP\^, \fImodifiers\fP\^, +\fImodifier_device\fP\^, \fIgrab_window\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + unsigned int \fIKey\fP\^; +.br + unsigned int \fImodifiers\fP\^; +.br + XDevice *\fImodifier_device\fP\^; +.br + Window \fIgrab_window\fP\^; +.SH ARGUMENTS +.ds Bu grabbed or released +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device that is to be \*(Bu +.TP 12 +.I Key +Specifies the device Key that is to be \*(Bu or +\fIAnyKey\fP. +.TP 12 +.I modifiers +Specifies the set of keymasks or +\fIAnyModifier\fP. +The mask is the bitwise inclusive OR of the valid keymask bits. +Valid bits are: ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, +Mod3Mask, Mod4Mask, Mod5Mask. +.TP 12 +.I modifier_device +Specifies the device whose modifiers are to be used. If a modifier_device of +NULL is specified, the X keyboard will be used as the modifier_device. +.TP 12 +.I grab_window +Specifies the grab window. +.TP 12 +.I owner_events +Specifies a Boolean value that indicates whether the device +events are to be reported as usual or reported with respect to the grab window +if selected by the event list. +.TP 12 +.I event_count +Specifies the number of event classes in the event list. +.TP 12 +.I event_list +Specifies which device events are reported to the client. +.TP 12 +.I this_device_mode +Specifies further processing of events from this device. +You can pass \fIGrabModeSync\fP or \fIGrabModeAsync\fP. +.TP 12 +.I other_devices_mode +Specifies further processing of events from other devices. +You can pass +\fIGrabModeSync\fP +or +\fIGrabModeAsync\fP. +.SH DESCRIPTION +The \fIXGrabDeviceKey\fP request establishes a passive grab. +In the future, +the device is actively grabbed (as for +\fIXGrabDevice\fP, +the last-device-grab time is set to the time at which the Key was pressed +(as transmitted in the +\fIDeviceKeyPress\fP +event), and the +\fIDeviceKeyPress\fP +event is reported if all of the following conditions are true: +.IP \(bu 5 +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. +.IP \(bu 5 +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. +.IP \(bu 5 +The confine_to window (if any) is viewable. +.IP \(bu 5 +A passive grab on the same key/modifier combination does not exist +on any ancestor of grab_window. +.LP +The interpretation of the remaining arguments is as for +\fIXGrabDevice\fP . +The active grab is terminated automatically when the logical state of the +device has the specified key released. +.LP +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. +.LP +If the key is not \fIAnyKey\fP, it must be in the range specified by +min_keycode and max_keycode as returned by the \fIXListInputDevices\fP +request. Otherwise, a \fIBadValue\fP error results. +.LP +This request overrides all previous grabs by the same client on the same +Key/modifier combinations on the same window. +A modifier of +\fIAnyModifier\fP +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 +\fIAnyKey\fP +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. +.LP +If a modifier_device of NULL is specified, the X keyboard will be used as +the modifier_device. +.LP +If some other client has already issued a +\fIXGrabDeviceKey\fP +with the same Key/modifier combination on the same window, a +\fIBadAccess\fP +error results. +When using +\fIAnyModifier\fP +or +\fIAnyKey\fP , +the request fails completely, +and a +\fIBadAccess\fP +error results (no grabs are +established) if there is a conflicting grab for any combination. +\fIXGrabDeviceKey\fP +has no effect on an active grab. +.LP +\fIXGrabDeviceKey\fP +can generate +\fIBadAccess\fP, +\fIBadClass\fP, +\fIBadDevice\fP, +\fIBadMatch\fP, +\fIBadValue\fP, +and +\fIBadWindow\fP +errors. It returns \fISuccess\fP on successful completion of the request. +.P +The \fIXUngrabDeviceKey\fP +request releases the passive grab for a key/modifier combination on the +specified window if it was grabbed by this client. +A modifier of \fIAnyModifier\fP is +equivalent to issuing +the ungrab request for all possible modifier combinations, including +the combination of no modifiers. +A Key of \fIAnyKey\fP +is equivalent to issuing the request for all possible Keys. +\fIXUngrabDeviceKey\fP has no effect on an active grab. +.LP +If a modifier_device of NULL is specified, the X keyboard will be used as the +modifier_device. +.LP +\fIXUngrabDeviceKey\fP can generate \fIBadDevice\fP, \fIBadMatch\fP, +\fIBadValue\fP and \fIBadWindow\fP errors. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXGrabDeviceKey\fP request was made +specifying a device that has no keys, or a modifier device that has no +keys. +.TP 12 +\fIBadValue\fP +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. +.TP 12 +\fIBadWindow\fP +A value for a Window argument does not name a defined Window. +.SH "SEE ALSO" +XAllowDeviceEvents(3X), +.br +XGrabDevice(3X), +.br +XGrabDeviceButton(3X), +.br +.br +\fI\*(xL\fP diff --git a/man/XListInputDevices.man b/man/XListInputDevices.man new file mode 100644 index 0000000..ea780c6 --- /dev/null +++ b/man/XListInputDevices.man @@ -0,0 +1,234 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XListDev.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XListInputDevices 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XListInputDevices, XFreeDeviceList \- list available input devices +.SH SYNTAX +XDeviceInfo *XListInputDevices\^(\^\fIdisplay\fP, \fIndevices_return\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + int *\fIndevices_return\fP\^; +.sp +XFreeDeviceList\^(\^\fIlist\fP\^) +.br + XDeviceInfo *\fIlist\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I ndevices_return +Specifies a pointer to a variable where the number of available devices can +be returned. +.TP 12 +.I list +Specifies the list of devices to free. The \fIXFreeDeviceList\fP function +frees the list of available extension input devices. +.SH DESCRIPTION +The \fIXListInputDevices\fP +request lists the available extension input devices. This list includes the +X pointer and X keyboard, any other input devices that are 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. +.LP +Some server implementations may make all 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. +.LP +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: + +.DS +.nf +typedef struct _XDeviceInfo +{ + XID id; + Atom type; + char *name; + int num_classes; + int use; + XAnyClassPtr inputclassinfo; +} XDeviceInfo; +.fi +.DE +.LP +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. +.LP +The type field is of type Atom and indicates the nature +of the device. +.LP +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 \fIXI.h\fP: +.LP +.DS +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 +.DE +.LP +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. +.LP +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. +.LP +The use field specifies how the device is currently +being used. If the value is \fIIsXKeyboard\fP, the device is +currently being used as the X keyboard. If the value +is \fIIsXPointer\fP, the device is currently being used as +the X pointer. If the value is \fIIsXExtensionDevice\fP, the +device is available for use as an extension device. +.LP +The inputclassinfo field contains a pointer to the first input-class +specific data. The first two fields are common to all +classes. +.LP +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. +.LP +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. +.LP +The XKeyInfo structure describes the characteristics of the keys on the +device. It is defined as follows: +.LP +.DS +.nf +typedef struct _XKeyInfo { + XID class; + int length; + unsigned short min_keycode; + unsigned short max_keycode; + unsigned short num_keys; +} XKeyInfo; +.fi +.DE +.LP +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. +.LP +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. +.LP +num_keys specifies the number of keys that the device has. +.LP +The XButtonInfo structure defines the characteristics of the buttons +on the device. It is defined as follows: +.LP +.DS +.nf +typedef struct _XButtonInfo { + XID class; + int length; + short num_buttons; +} XButtonInfo; +.fi +.DE +.LP +num_buttons specifies the number of buttons that the device has. +.LP +The XValuatorInfo structure defines the characteristics of the valuators +on the device. It is defined as follows: +.LP +.DE +.nf +typedef struct _XValuatorInfo { + XID class; + int length; + unsigned char num_axes; + unsigned char mode; + unsigned long motion_buffer; + XAxisInfoPtr axes; +} XValuatorInfo; +.fi +.DS +num_axes contains the number of axes the device supports. +.LP +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. +.LP +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. +.LP +The axes field contains a pointer to an XAxisInfo structure. +.LP +The XAxisInfo structure is defined as follows: +.LP +.DS +.nf +typedef struct _XAxisInfo { + int resolution; + int min_value; + int max_value; +} XAxisInfo; +.fi +.DE +.LP +The resolution contains a number in counts/meter. +.LP +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. +.LP +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. +.LP +To free the \fIXDeviceInfo\fP array created by \fIXListInputDevices\fP, +use \fIXFreeDeviceList\fP. +.SH DIAGNOSTICS +none. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XOpenDevice.man b/man/XOpenDevice.man new file mode 100644 index 0000000..915865e --- /dev/null +++ b/man/XOpenDevice.man @@ -0,0 +1,128 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XOpenDev.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XOpenDevice 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XOpenDevice, XCloseDevice \- open or close an extension input device +.SH SYNTAX +\fB +.nf +XDevice *XOpenDevice\^(\^\fIdisplay\fP, \fIdevice_id\fP\^) + Display *\fIdisplay\fP\^; + XID \fIdevice_id\fP\^; + +XCloseDevice\^(\^\fIdisplay\fP, \fIdevice\fP\^) + Display *\fIdisplay\fP\^; + XDevice *\fIdevice\fP\^; +.fi +\fP +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device_id +Specifies the id of the device to be opened +.TP 12 +.I device +Specifies the device to be closed +.SH DESCRIPTION +The \fIXOpenDevice\fP +request makes an input device accessible to a client through input extension +protocol requests. If successful, it returns a pointer to an \fBXDevice\fP +structure. +.LP +The \fIXCloseDevice\fP 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 \fICloseDevice\fP. +.LP +When a client makes an \fIXCloseDevice\fP 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. +.LP +\fIXOpenDevice\fP and \fIXCloseDevice\fP can generate a \fIBadDevice\fP +error. +.SH STRUCTURES +The +\fIXDevice\fP structure returned by \fIXOpenDevice\fP contains: +.nf +typedef struct { + XID device_id; + int num_classes; + XInputClassInfo *classes; +} XDevice; +.fi +.LP +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. +.LP +The +\fIXInputClassInfo\fP +structure contains: +.LP +.nf +typedef struct { + unsigned char input_class; + unsigned char event_type_base; +} XInputClassInfo; +.fi +.LP +The input_class field identifies one class of input +supported by the device. Defined types include \fIKeyClass\fP, +\fIButtonClass\fP, \fIValuatorClass\fP, \fIProximityClass\fP, +\fIFeedbackClass\fP, \fIFocusClass\fP, and \fIOtherClass\fP. +The event_type_base identifies the event type of the first event in that class. +.LP +The information contained in the \fIXInputClassInfo\fP structure is used +by macros to obtain the event classes that clients use in making +\fIXSelectExtensionEvent\fP requests. Currently defined macros include +\fIDeviceKeyPress\fP, \fIDeviceKeyRelease\fP, \fIDeviceButtonPress\fP, +\fIDeviceButtonRelese\fP, \fIDeviceMotionNotify\fP, \fIDeviceFocusIn\fP, +\fIDeviceFocusOut\fP, \fIProximityIn\fP, \fIProximityOut\fP, +\fIDeviceStateNotify\fP, \fIDeviceMappiingNotify\fP, +\fIChangeDeviceNotify\fP, \fIDevicePointerMotionHint\fP, +\fIDeviceButton1Motion\fP, \fIDeviceButton2Motion\fP, \fIDeviceButton3Motion\fP, +\fIDeviceButton4Motion\fP, \fIDeviceButton5Motion\fP, \fIDeviceButtonMotion\fP, +\fIDeviceOwnerGrabButton\fP, \fIDeviceButtonPressGrab\fP, and +\fINoExtensionEvent\fP. +.LP +To obtain the proper event class for a particular device, one of the above +macros is invoked using the \fIXDevice\fP structure for that device. For +example, +.LP +.nf +DeviceKeyPress (*device, type, eventclass); +.fi +.LP +returns the \fIDeviceKeyPress\fP event type and the eventclass for +\fIDeviceKeyPress\fP events from the specified device. +.LP +This \fIeventclass\fP can then be used in an \fIXSelectExtensionEvent\fP +request to ask the server to send \fIDeviceKeyPress\fP events from this device. +When a selected event is received via \fIXNextEvent\fP, the \fItype\fP can be +used for comparison with the type in the event. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +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 \fIXChangeKeyboardDevice\fP or +\fIXChangePointerDevice\fP requests. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XQueryDeviceState.man b/man/XQueryDeviceState.man new file mode 100644 index 0000000..195d5e4 --- /dev/null +++ b/man/XQueryDeviceState.man @@ -0,0 +1,99 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XQueryDv.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XQueryDeviceState 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XQueryDeviceState \- query the state of an extension input device. +.SH SYNTAX +XQueryDeviceState\^(\^\fIdisplay\fP, \fIdevice\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device whose state is to be queried. +.SH DESCRIPTION +The +\fIXQueryDeviceState\fP +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 \fIXDeviceState\fP 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. +.LP +\fIXQueryDeviceState\fP +can generate a \fIBadDevice\fP error. +.SH STRUCTURES +The +\fIXDeviceState\fP +structure contains: +.LP +.nf +typedef struct { + XID device_id; + int num_classes; + XInputClass *data; +} XDeviceState; +.fi +.LP +The +\fIXValuatorState\fP +structure contains: +.LP +.nf +typedef struct { + unsigned char class; + unsigned char length; + unsigned char num_valuators; + unsigned char mode; + int *valuators; +} XValuatorState; +.fi +.LP +The \fIXKeyState\fP structure contains: +.LP +.nf +typedef struct { + unsigned char class; + unsigned char length; + short num_keys; + char keys[32]; +} XKeyState; +.fi +.LP +The \fIXButtonState\fP structure contains: +.LP +.nf +typedef struct { + unsigned char class; + unsigned char length; + short num_buttons; + char buttons[32]; +} XButtonState; +.fi +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. 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 \fIXChangeKeyboardDevice\fP or +\fIXChangePointerDevice\fP requests. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XSelectExtensionEvent.man b/man/XSelectExtensionEvent.man new file mode 100644 index 0000000..95ec1bc --- /dev/null +++ b/man/XSelectExtensionEvent.man @@ -0,0 +1,148 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XSelExtEv.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XSelectExtensionEvent 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XSelectExtensionEvent, XGetSelectedExtensionEvents \- select extension events, get the list of currently selected extension events +.SH SYNTAX +XSelectExtensionEvent\^(\^\fIdisplay\fP, \fIw\fP\^, \fIevent_list\fP\^, \fIevent_count\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + Window \fIw\fP\^; +.br + XEventClass *\fIevent_list\fP\^; +.br + int \fIevent_count\fP\^; +.sp +XGetSelectedExtensionEvents\^(\^\fIdisplay\fP, \fIw\fP\^, \fIthis_client_event_count_return\fP\^, +.br +\fIthis_client_event_list_return\fP\^, \fIall_clients_event_count_return\fP\^, +\fIall_clients_event_list_return\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + Window \fIw\fP\^; +.br + int \fIthis_client_event_count_return\fP\^; +.br + XEventClass *\fIthis_client_event_list_return\fP\^; +.br + int \fIall_clients_event_count_return\fP\^; +.br + XEventClass *\fIall_clients_event_list_return\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.ds Wi whose events you are interested in +.TP 12 +.I w +Specifies the window \*(Wi. +.TP 12 +.I event_list +Specifies the list of event classes that describe the events you are interested in. +.TP 12 +.I event_count +Specifies the count of event classes in the event list. +.TP 12 +.I this_client_event_count_return +Returns the count of event classes selected by this client. +.TP 12 +.I this_client_event_list_return +Returns a pointer to the list of event classes selected by this client. +.TP 12 +.I all_clients_event_count_return +Returns the count of event classes selected by all clients. +.TP 12 +.I all_clients_event_list_return +Returns a pointer to the list of event classes selected by all clients. +.SH DESCRIPTION +The +\fIXSelectExtensionEvent\fP 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. +.LP +Multiple clients can select for the same events on the same window +with the following restrictions: +.IP \(bu 5 +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. +.IP \(bu 5 +Only one client at a time can select a +\fIDeviceButtonPress\fP +event with automatic passive grabbing enabled, which is associated with +the event class \fIDeviceButtonPressGrab\fP. +To receive \fIDeviceButtonPress\fP events without automatic passive +grabbing, use event class \fIDeviceButtonPress\fP but do not specify +event class \fIDeviceButtonPressGrab\fP. +.LP +The server reports the event to all interested clients. +.LP +Information contained in the \fIXDevice\fP structure returned by +\fIXOpenDevice\fP is used +by macros to obtain the event classes that clients use in making +\fIXSelectExtensionEvent\fP requests. Currently defined macros include +\fIDeviceKeyPress\fP, \fIDeviceKeyRelease\fP, \fIDeviceButtonPress\fP, +\fIDeviceButtonRelese\fP, \fIDeviceMotionNotify\fP, \fIDeviceFocusIn\fP, +\fIDeviceFocusOut\fP, \fIProximityIn\fP, \fIProximityOut\fP, +\fIDeviceStateNotify\fP, \fIDeviceMappiingNotify\fP, +\fIChangeDeviceNotify\fP, \fIDevicePointerMotionHint\fP, +\fIDeviceButton1Motion\fP, \fIDeviceButton2Motion\fP, \fIDeviceButton3Motion\fP, +\fIDeviceButton4Motion\fP, \fIDeviceButton5Motion\fP, \fIDeviceButtonMotion\fP, +\fIDeviceOwnerGrabButton\fP, \fIDeviceButtonPressGrab\fP, and +\fINoExtensionEvent\fP. +.LP +To obtain the proper event class for a particular device, one of the above +macros is invoked using the \fIXDevice\fP structure for that device. For +example, +.LP +.DS 0 +.TA .5i +.ta .5i +DeviceKeyPress (*device, type, eventclass); +.DE +.LP +returns the \fIDeviceKeyPress\fP event type and the eventclass for selecting +\fIDeviceKeyPress\fP events from this device. +.LP +\fIXSelectExtensionEvent\fP +can generate a \fIBadWindow\fP or \fIBadClass\fP error. +The +\fIXGetSelectedExtensionEvents\fP +request reports the extension events selected by this client and all clients +for the specified window. This request returns pointers to two +\fIXEventClass\fP +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 \fIXFree\fP to free these +two arrays. +.LP +\fIXGetSelectedExtensionEvents\fP +can generate a \fIBadWindow\fP error. +.SH DIAGNOSTICS +.TP 12 +\fIBadWindow\fP +A value for a Window argument does not name a defined Window. +.TP 12 +\fIBadClass\fP +A value for an XEventClass argument is invalid. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XSendExtensionEvent.man b/man/XSendExtensionEvent.man new file mode 100644 index 0000000..ad66beb --- /dev/null +++ b/man/XSendExtensionEvent.man @@ -0,0 +1,149 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XSExEvnt.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XSendExtensionEvent 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XSendExtensionEvent \- send input extension events to a client +.SH SYNTAX +Status XSendExtensionEvent\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIdestination\fP\^, \fIpropagate\fP\^, \fIevent_count\fP\^, \fIevent_list\fP\^, \fIevent_send\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + Window \fIdestination\fP\^; +.br + Bool \fIpropagate\fP\^; +.br + int \fIevent_count\fP\^; +.br + XEventClass *\fIevent_list\fP\^; +.br + XEvent *\fIevent_send\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device from which the events are to be sent. +.TP 12 +.I destination +Specifies the window the event is to be sent to. You can pass window id, +\fIPointerWindow\fP, \ +or \ +\fIInputFocus\fP. +.TP 12 +.I propagate +Specifies a Boolean value that is either True or False. +.TP 12 +.I event_count +Specifies the count of XEventClasses in event_list. +.TP 12 +.I event_list +Specifies the list of event selections to be used. +.TP 12 +.I event_send +Specifies a pointer to the event that is to be sent. +.TP 12 +.SH DESCRIPTION +The +\fIXSendExtensionEvent\fP +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 \fIXOpenDevice(3X11)\fP. +This request uses the w argument to identify the destination window as follows: +.IP \(bu 5 +If w is +\fIPointerWindow\fP , +the destination window is the window that contains the pointer. +.IP \(bu 5 +If w is +\fIInputFocus\fP +and 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. +.LP +To determine which clients should receive the specified events, +\fIXSendExtensionEvent\fP +uses the propagate argument as follows: +.IP \(bu 5 +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. +.IP \(bu 5 +If propagate is +\fIFalse\fP, +the event is sent to every client selecting on destination any of the event +types specified by the event_list array. +.IP \(bu 5 +If propagate is +\fITrue\fP +and no clients have selected on destination any of +the events specified by the event_list array, +the destination is replaced with the +closest ancestor of destination for which some client has selected a +type specified by the event-list array and for which no intervening +window has that type in its +do-not-propagate-mask. +If no such window exists or if the window is +an ancestor of the focus window and +\fIInputFocus\fP +was originally specified +as the destination, the event is not sent to any clients. +Otherwise, the event is reported to every client selecting on the final +destination any of the events specified in the event_list array. +.LP +The event in the +\fIXEvent\fP +structure must be one of the events defined by the input extension (or a +\fIBadValue\fP +error results) so that the X server can correctly byte-swap +the contents as necessary. +The contents of the event are +otherwise unaltered and unchecked by the X server except to force send_event to +\fITrue\fP +in the forwarded event and to set the serial number in the event correctly. +.LP +\fIXSendExtensionEvent\fP +returns zero if the conversion to wire protocol format failed +and returns nonzero otherwise. +\fIXSendExtensionEvent\fP +can generate +\fIBadClass\fP, +\fIBadDevice\fP, +\fIBadValue\fP, +and +\fIBadWindow\fP +errors. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadValue\fP +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. +.TP 12 +\fIBadWindow\fP +A value for a Window argument does not name a defined Window. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XSetDeviceButtonMapping.man b/man/XSetDeviceButtonMapping.man new file mode 100644 index 0000000..e6635db --- /dev/null +++ b/man/XSetDeviceButtonMapping.man @@ -0,0 +1,113 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XSeBMap.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming With Xlib +.TH XSetDeviceButtonMapping 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XSetDeviceButtonMapping, XGetDeviceButtonMapping \- query or change device button mappings +.SH SYNTAX +int XSetDeviceButtonMapping\^(\^\fIdisplay\fP, \fIdevice\fP, \fImap\fP, \fInmap\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + unsigned char \fImap\fP\^[]\^; +.br + int \fInmap\fP\^; +.sp +int XGetDeviceButtonMapping\^(\^\fIdisplay\fP, \fIdevice\fP, \fImap_return\fP, +\fInmap\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + unsigned char \fImap_return\fP\^[]\^; +.br + int \fInmap\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device whose button mapping is to be queried or changed. +.TP 12 +.I map +Specifies the mapping list. +.TP 12 +.I map_return +Returns the mapping list. +.TP 12 +.I nmap +Specifies the number of items in the mapping list. +.SH DESCRIPTION +The \fIXSetDeviceButtonMapping\fP +request sets the mapping of the specified device. +If it succeeds, the X server generates a +\fIDeviceMappingNotify\fP event, and +\fIXSetDeviceButtonMapping\fP returns \fIMappingSuccess\fP. +Element map[i] defines the logical button number for the physical button +i+1. +The length of the list must be the same as +\fIXGetDeviceButtonMapping\fP +would return, or a \fIBadValue\fP +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 \fIBadValue\fP error results. +If any of the buttons to be altered are logically in the down state, +\fIXSetDeviceButtonMapping\fP returns \fIMappingBusy\fP, +and the mapping is not changed. +.LP +\fIXSetDeviceButtonMapping\fP +can generate \fIBadDevice\fP, \fIBadMatch\fP, and \fIBadValue\fP errors. +.LP +The \fIXGetDeviceButtonMapping\fP +request returns the current mapping of the specified device. +Buttons are numbered starting from one. +\fIXGetDeviceButtonMapping\fP +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. +.LP +\fIXGetDeviceButtonMapping\fP +can generate \fIBadDevice\fP or \fIBadMatch\fP errors. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXGetDeviceButtonMapping\fP or +\fIXSetDeviceButtonMapping\fP request was made +specifying a device that has no buttons. +.TP 12 +\fIBadValue\fP +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. +.SH "SEE ALSO" +XChangeDeviceKeyboardControl(3X), +.br +XChangeDeviceKeyMapping(3X) +.br +XChangeDeviceModifierMapping(3X) +.br +.br +\fI\*(xL\fP diff --git a/man/XSetDeviceFocus.man b/man/XSetDeviceFocus.man new file mode 100644 index 0000000..b07764b --- /dev/null +++ b/man/XSetDeviceFocus.man @@ -0,0 +1,216 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XSeDvFoc.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XSetDeviceFocus 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XSetDeviceFocus, XGetDeviceFocus \- control extension input device focus +.SH SYNTAX +XSetDeviceFocus\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIfocus\fP\^, \fIrevert_to\fP\^, \fItime\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + Display *\fIdevice\fP\^; +.br + Window \fIfocus\fP\^; +.br + int \fIrevert_to\fP\^; +.br + Time \fItime\fP\^; +.sp +XGetDeviceFocus\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIfocus_return\fP\^, +\fIrevert_to_return\fP, \fItime_return\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + Display *\fIdevice\fP\^; +.br + Window *\fIfocus_return\fP\^; +.br + int *\fIrevert_to_return\fP\^; +.br + int *\fItime_return\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device whose focus is to be queried or changed. +.TP 12 +.I focus +Specifies the window, +\fIPointerRoot\fP, +\fIFollowKeyboard\fP, +or +\fINone\fP. +.TP 12 +.I focus_return +Returns the focus window, +\fIPointerRoot\fP, +\fIFollowKeyboard\fP, +or +\fINone\fP. +.TP 12 +.I revert_to +Specifies where the input focus reverts to if the window becomes not +viewable. +You can pass +\fIRevertToParent\fP, +\fIRevertToPointerRoot\fP, +\fIRevertToFollowKeyboard\fP, +or +\fIRevertToNone\fP. +.TP 12 +.I revert_to_return +Returns the current focus state +\fIRevertToParent\fP, +\fIRevertToPointerRoot\fP, +\fIRevertToFollowKeyboard\fP, +or +\fIRevertToNone\fP. +.TP 12 +.I time_return +Returns the last_focus_time for the device. +.TP 12 +.I time +Specifies the time. +You can pass either a timestamp or +\fICurrentTime\fP. +.SH DESCRIPTION +The \fIXSetDeviceFocus\fP +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 +\fICurrentTime\fP +is replaced by the current X server time). +\fIXSetDeviceFocus\fP +causes the X server to generate +\fIDeviceFocusIn\fP +and +\fIDeviceFocusOut\fP +events. +.LP +Depending on the focus argument, +the following occurs: +.IP \(bu 5 +If focus is +\fINone\fP , +all device events are discarded until a new focus window is set, +and the revert_to argument is ignored. +.IP \(bu 5 +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. +.IP \(bu 5 +If focus is +\fIPointerRoot\fP, +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. +.IP \(bu 5 +If focus is +\fIFollowKeyboard\fP, +the focus window is dynamically taken to be the window to which the X keyboard +focus is set at each input event. +.LP +The specified focus window must be viewable at the time +\fIXSetDeviceFocus\fP +is called, +or a +\fIBadMatch\fP +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: +.IP \(bu 5 +If revert_to is +\fIRevertToParent\fP, +the focus reverts to the parent (or the closest viewable ancestor), +and the new revert_to value is taken to be +\fIRevertToNone\fP. +.IP \(bu 5 +If revert_to is +\fIRevertToPointerRoot\fP, +\fIRevertToFollowKeyboard\fP, +or +\fIRevertToNone\fP, +the focus reverts to +\fIPointerRoot\fP, +\fIFollowKeyboard\fP, +or +\fINone\fP, +respectively. +.LP +When the focus reverts, +the X server generates +\fIDeviceFocusIn\fP +and +\fIDeviceFocusOut\fP +events, but the last-focus-change time is not affected. +.LP +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 \fIBadMatch\fP error. Whether or not given device can +support this request can be determined by the information returned by +\fIXOpenDevice\fP. +For those devices that +support focus, \fIXOpenDevice\fP will return an +\fIXInputClassInfo\fP structure with the input_class field +equal to the constant \fIFocusClass\fP (defined in the file \fIXI.h\fP). +.LP +\fIXSetDeviceFocus\fP +can generate +\fIBadDevice\fP, +\fIBadMatch\fP, +\fIBadValue\fP, +and +\fIBadWindow\fP +errors. +.LP +The +\fIXGetDeviceFocus\fP +request returns the focus window and the current focus state. +.LP +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 \fIBadMatch\fP +error. A device that can be focused returns information for input Class +Focus when an \fIXOpenDevice\fP request is made. +.LP +\fIXGetDeviceFocus\fP can generate \fIBadDevice\fP, +and \fIBadMatch\fP errors. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. This error may +also occur if the specified device is the X keyboard or X pointer device. +.TP 12 +\fIBadValue\fP +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. +.TP 12 +\fIBadWindow\fP +A value for a Window argument does not name a defined Window. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXGetDeviceFocus\fP or \fIXSetDeviceFocus\fP +request was made specifying a device that the server implementation does not +allow to be focused. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XSetDeviceMode.man b/man/XSetDeviceMode.man new file mode 100644 index 0000000..0f30233 --- /dev/null +++ b/man/XSetDeviceMode.man @@ -0,0 +1,69 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XSetMode.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XSetDeviceMode 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XSetDeviceMode \- change the mode of a device +.SH SYNTAX +XSetDeviceMode\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fImode\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + int \fI_mode\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device whose mode is to be changed. +.TP 12 +.I mode +Specifies the mode. +You can pass +\fIAbsolute\fP , +or +\fIRelative\fP. +.SH DESCRIPTION +The +\fIXSetDeviceMode\fP +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 \fIAbsolute\fP to \fIRelative\fP. +.LP +\fIXSetDeviceMode\fP +can generate a \fIBadDevice\fP or +\fIBadMode\fP +error. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. 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 \fIXChangeKeyboardDevice\fP or +\fIXChangePointerDevice\fP requests. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXSetDeviceMode\fP request is made +specifying a device that has no valuators and reports no axes of motion. +.TP 12 +\fIBadMode\fP +An invalid mode was specified. This error will also be returned if the +specified device is not capable of supporting the \fIXSetDeviceMode\fP +request. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/man/XSetDeviceValuators.man b/man/XSetDeviceValuators.man new file mode 100644 index 0000000..1b3a054 --- /dev/null +++ b/man/XSetDeviceValuators.man @@ -0,0 +1,79 @@ +.\" +.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer, +.\" +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Ardent, and Hewlett-Packard make no representations about the +.\" suitability for any purpose of the information in this document. It is +.\" provided \`\`as is'' without express or implied warranty. +.\" +.\" $Xorg: XSetDVal.man,v 1.4 2001/03/16 17:51:13 pookie Exp $ +.ds xL Programming with Xlib +.TH XSetDeviceValuators 3X11 "Release 6.6" "X Version 11" "X FUNCTIONS" +.SH NAME +XSetDeviceValuators \- initialize the valuators on an extension input device +.SH SYNTAX +XSetDeviceValuators\^(\^\fIdisplay\fP, \fIdevice\fP\^, \fIvaluators\fP\^, \fIfirst_valuator\fP\^, \fInum_valuators\fP\^) +.br + Display *\fIdisplay\fP\^; +.br + XDevice *\fIdevice\fP\^; +.br + int *\fIvaluators\fP\^; +.br + int \fIfirst_valuator\fP\^; +.br + int \fInum_valuators\fP\^; +.SH ARGUMENTS +.TP 12 +.I display +Specifies the connection to the X server. +.TP 12 +.I device +Specifies the device whose valuators are to be initialized. +.TP 12 +.I valuators +Specifies a pointer to an array of integer values to be used to initialize the +device valuators. +.TP 12 +.I first_valuator +Specifies the first valuator to be set. Valuators are numbered beginning with +zero. +.TP 12 +.I num_valuators +Specifies the number of valuators to be set. +.SH DESCRIPTION +The +\fIXSetDeviceValuators\fP +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 \fIBadMatch\fP error will occur. +.LP +If the request succeeds, a status of Success is returned. If another +client has the device grabbed, a status of AlreadyGrabbed is returned. +.LP +\fIXSetDeviceValuators\fP +can generate a \fIBadLength\fP, \fIBadDevice\fP , \fIBadMatch\fP, or +\fIBadValue\fP error. +.SH DIAGNOSTICS +.TP 12 +\fIBadDevice\fP +An invalid device was specified. The specified device does not exist or has +not been opened by this client via \fIXOpenInputDevice\fP. +.TP 12 +\fIBadMatch\fP +This error may occur if an \fIXSetDeviceValuators\fP 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. +.TP 12 +\fIBadValue\fP +An invalid first_valuator or num_valuators values was specified. +.SH "SEE ALSO" +.br +\fI\*(xL\fP diff --git a/src/XAllowDv.c b/src/XAllowDv.c new file mode 100644 index 0000000..200bb4b --- /dev/null +++ b/src/XAllowDv.c @@ -0,0 +1,86 @@ +/* $Xorg: XAllowDv.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XAllowDeviceEvents - Thaw a frozen extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XAllowDeviceEvents (dpy, dev, event_mode, time) + register Display *dpy; + XDevice *dev; + int event_mode; + Time time; + { + xAllowDeviceEventsReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(AllowDeviceEvents,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_AllowDeviceEvents; + req->deviceid = dev->device_id; + req->mode = event_mode; + req->time = time; + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } + diff --git a/src/XChgDCtl.c b/src/XChgDCtl.c new file mode 100644 index 0000000..038136a --- /dev/null +++ b/src/XChgDCtl.c @@ -0,0 +1,128 @@ +/* $Xorg: XChgDCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XChangeDeviceControl - Change the control attributes of an extension + * input device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XChangeDeviceControl (dpy, dev, control, d) + register Display *dpy; + XDevice *dev; + int control; + XDeviceControl *d; + { + int length; + xChangeDeviceControlReq *req; + xChangeDeviceControlReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl) == -1) + return (NoSuchExtension); + + GetReq(ChangeDeviceControl,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_ChangeDeviceControl; + req->deviceid = dev->device_id; + req->control = control; + + switch (control) + { + case DEVICE_RESOLUTION: + { + XDeviceResolutionControl *R; + xDeviceResolutionCtl r; + + R = (XDeviceResolutionControl *) d; + r.control = DEVICE_RESOLUTION; + r.length = sizeof (xDeviceResolutionCtl) + + R->num_valuators * sizeof(int); + r.first_valuator = R->first_valuator; + r.num_valuators = R->num_valuators; + req->length += ((unsigned)(r.length + 3) >> 2); + length = sizeof (xDeviceResolutionCtl); + Data (dpy, (char *) &r, length); + length = r.num_valuators * sizeof(int); + Data (dpy, (char *) R->resolutions, length); + if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (NoSuchExtension); + } + else + return (rep.status); + } + default: + { + xDeviceCtl u; + + u.control = d->control; + u.length = d->length - sizeof (int); + length = ((unsigned)(u.length + 3) >> 2); + req->length += length; + length <<= 2; + Data (dpy, (char *) &u, length); + } + } + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } + diff --git a/src/XChgFCtl.c b/src/XChgFCtl.c new file mode 100644 index 0000000..75fe93c --- /dev/null +++ b/src/XChgFCtl.c @@ -0,0 +1,205 @@ +/* $Xorg: XChgFCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XChangeFeedbackControl - Change the control attributes of feedbacks on + * an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XChangeFeedbackControl (dpy, dev, mask, f) + register Display *dpy; + XDevice *dev; + unsigned long mask; + XFeedbackControl *f; + { + int length; + xChangeFeedbackControlReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(ChangeFeedbackControl,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_ChangeFeedbackControl; + req->deviceid = dev->device_id; + req->mask = mask; + req->feedbackid = f->class; + + if (f->class == KbdFeedbackClass) + { + XKbdFeedbackControl *K; + xKbdFeedbackCtl k; + + K = (XKbdFeedbackControl *) f; + k.class = KbdFeedbackClass; + k.length = sizeof (xKbdFeedbackCtl); + k.id = K->id; + k.click = K->click; + k.percent = K->percent; + k.pitch = K->pitch; + k.duration = K->duration; + k.led_mask = K->led_mask; + k.led_values = K->led_value; + k.key = K->key; + k.auto_repeat_mode = K->auto_repeat_mode; + length = ((unsigned)(k.length + 3) >> 2); + req->length += length; + length <<= 2; + Data (dpy, (char *) &k, length); + } + else if (f->class == PtrFeedbackClass) + { + XPtrFeedbackControl *P; + xPtrFeedbackCtl p; + + P = (XPtrFeedbackControl *) f; + p.class = PtrFeedbackClass; + p.length = sizeof (xPtrFeedbackCtl); + p.id = P->id; + p.num = P->accelNum; + p.denom = P->accelDenom; + p.thresh = P->threshold; + length = ((unsigned)(p.length + 3) >> 2); + req->length += length; + length <<= 2; + Data (dpy, (char *) &p, length); + } + else if (f->class == IntegerFeedbackClass) + { + XIntegerFeedbackControl *I; + xIntegerFeedbackCtl i; + + I = (XIntegerFeedbackControl *) f; + i.class = IntegerFeedbackClass; + i.length = sizeof (xIntegerFeedbackCtl); + i.id = I->id; + i.int_to_display = I->int_to_display; + length = ((unsigned)(i.length + 3) >> 2); + req->length += length; + length <<= 2; + Data (dpy, (char *) &i, length); + } + else if (f->class == StringFeedbackClass) + { + XStringFeedbackControl *S; + xStringFeedbackCtl s; + + S = (XStringFeedbackControl *) f; + s.class = StringFeedbackClass; + s.length = sizeof (xStringFeedbackCtl) + + (S->num_keysyms * sizeof (KeySym)); + s.id = S->id; + s.num_keysyms = S->num_keysyms; + req->length += ((unsigned)(s.length + 3) >> 2); + length = sizeof (xStringFeedbackCtl); + Data (dpy, (char *) &s, length); + length = (s.num_keysyms * sizeof (KeySym)); + Data (dpy, (char *) S->syms_to_display, length); + } + else if (f->class == BellFeedbackClass) + { + XBellFeedbackControl *B; + xBellFeedbackCtl b; + + B = (XBellFeedbackControl *) f; + b.class = BellFeedbackClass; + b.length = sizeof (xBellFeedbackCtl); + b.id = B->id; + b.percent = B->percent; + b.pitch = B->pitch; + b.duration = B->duration; + length = ((unsigned)(b.length + 3) >> 2); + req->length += length; + length <<= 2; + Data (dpy, (char *) &b, length); + } + else if (f->class == LedFeedbackClass) + { + XLedFeedbackControl *L; + xLedFeedbackCtl l; + + L = (XLedFeedbackControl *) f; + l.class = LedFeedbackClass; + l.length = sizeof (xLedFeedbackCtl); + l.id = L->id; + l.led_mask = L->led_mask; + l.led_values = L->led_values; + length = ((unsigned)(l.length + 3) >> 2); + req->length += length; + length <<= 2; + Data (dpy, (char *) &l, length); + } + else + { + xFeedbackCtl u; + + u.class = f->class; + u.length = f->length - sizeof (int); + u.id = f->id; + length = ((unsigned)(u.length + 3) >> 2); + req->length += length; + length <<= 2; + Data (dpy, (char *) &u, length); + } + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } + diff --git a/src/XChgKMap.c b/src/XChgKMap.c new file mode 100644 index 0000000..74c1481 --- /dev/null +++ b/src/XChgKMap.c @@ -0,0 +1,92 @@ +/* $Xorg: XChgKMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XChangeDeviceKeyMapping - change the keymap of an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XChangeDeviceKeyMapping (dpy, dev, first, syms_per_code, keysyms, count) + register Display *dpy; + XDevice *dev; + int first; + int syms_per_code; + KeySym *keysyms; + int count; + { + register long nbytes; + xChangeDeviceKeyMappingReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(ChangeDeviceKeyMapping,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_ChangeDeviceKeyMapping; + req->deviceid = dev->device_id; + req->firstKeyCode = first; + req->keyCodes = count; + req->keySymsPerKeyCode = syms_per_code; + req->length += count * syms_per_code; + nbytes = syms_per_code * count * sizeof (CARD32); + Data (dpy, (char *)keysyms, nbytes); + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } diff --git a/src/XChgKbd.c b/src/XChgKbd.c new file mode 100644 index 0000000..089f124 --- /dev/null +++ b/src/XChgKbd.c @@ -0,0 +1,86 @@ +/* $Xorg: XChgKbd.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XChangeKeyboardDevice - Change the device used as the X keyboard. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XChangeKeyboardDevice (dpy, dev) + register Display *dpy; + XDevice *dev; + { + xChangeKeyboardDeviceReq *req; + xChangeKeyboardDeviceReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(ChangeKeyboardDevice,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_ChangeKeyboardDevice; + req->deviceid = dev->device_id; + rep.status = Success; + + (void) _XReply (dpy, (xReply *) &rep, 0, xTrue); + + UnlockDisplay(dpy); + SyncHandle(); + return (rep.status); + } + diff --git a/src/XChgPnt.c b/src/XChgPnt.c new file mode 100644 index 0000000..e1dbb1e --- /dev/null +++ b/src/XChgPnt.c @@ -0,0 +1,90 @@ +/* $Xorg: XChgPnt.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XChangePointerDevice - Change the device used as the X Pointer. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XChangePointerDevice (dpy, dev, xaxis, yaxis) + register Display *dpy; + XDevice *dev; + int xaxis; + int yaxis; + { + xChangePointerDeviceReq *req; + xChangePointerDeviceReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(ChangePointerDevice,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_ChangePointerDevice; + req->deviceid = dev->device_id; + req->xaxis = xaxis; + req->yaxis = yaxis; + rep.status = Success; + + (void) _XReply (dpy, (xReply *) &rep, 0, xTrue); + + UnlockDisplay(dpy); + SyncHandle(); + return (rep.status); + } + diff --git a/src/XChgProp.c b/src/XChgProp.c new file mode 100644 index 0000000..2426759 --- /dev/null +++ b/src/XChgProp.c @@ -0,0 +1,96 @@ +/* $Xorg: XChgProp.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XChangeDeviceDontPropagateList - Get the dont_propagate_list for a + * window. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XChangeDeviceDontPropagateList (dpy, window, count, events, mode) + register Display *dpy; + Window window; + int count; + XEventClass *events; + int mode; + { + xChangeDeviceDontPropagateListReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(ChangeDeviceDontPropagateList,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_ChangeDeviceDontPropagateList; + req->window = window; + req->count = count; + req->mode = mode; + req->length += count; + + /* note: Data is a macro that uses its arguments multiple + times, so "nvalues" is changed in a separate assignment + statement */ + + count <<= 2; + Data32 (dpy, (long *) events, count); + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } + diff --git a/src/XCloseDev.c b/src/XCloseDev.c new file mode 100644 index 0000000..f4da25e --- /dev/null +++ b/src/XCloseDev.c @@ -0,0 +1,83 @@ +/* $Xorg: XCloseDev.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XCloseDevice - Request the server to close an extension device. + * + */ + +#include "XIproto.h" +#include "Xlibint.h" +#include "XI.h" +#include "XInput.h" +#include "extutil.h" + +int +XCloseDevice(dpy, dev) + register Display *dpy; + register XDevice *dev; + { + xCloseDeviceReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(CloseDevice,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_CloseDevice; + req->deviceid = dev->device_id; + + XFree ((char *)dev); + UnlockDisplay (dpy); + SyncHandle(); + return (Success); + } + diff --git a/src/XDevBell.c b/src/XDevBell.c new file mode 100644 index 0000000..b352a06 --- /dev/null +++ b/src/XDevBell.c @@ -0,0 +1,87 @@ +/* $Xorg: XDevBell.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XDeviceBell - Ring a bell on an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XDeviceBell (dpy, dev, feedbackclass, feedbackid, percent) + register Display *dpy; + XDevice *dev; + XID feedbackclass, feedbackid; + int percent; + { + xDeviceBellReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Add_XDeviceBell) == -1) + return (NoSuchExtension); + + GetReq(DeviceBell,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_DeviceBell; + req->deviceid = dev->device_id; + req->feedbackclass = feedbackclass; + req->feedbackid = feedbackid; + req->percent = percent; + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } + diff --git a/src/XExtInt.c b/src/XExtInt.c new file mode 100644 index 0000000..b8da8a0 --- /dev/null +++ b/src/XExtInt.c @@ -0,0 +1,660 @@ +/* $Xorg: XExtInt.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * Input Extension library internal functions. + * + */ + +#define NEED_EVENTS +#define NEED_REPLIES +#include <stdio.h> +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +#define ENQUEUE_EVENT True +#define DONT_ENQUEUE False + +static XExtensionInfo *xinput_info; +static /* const */ char *xinput_extension_name = INAME; +static int XInputClose(); +static char *XInputError(); +static Bool XInputWireToEvent(); +Status _XiEventToWire(); +static /* const */ XEvent emptyevent; + +typedef struct _XInputData + { + XEvent data; + XExtensionVersion *vers; + } XInputData; + +#define XInputCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, xinput_extension_name, val) + +static /* const */ XExtensionHooks xinput_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + XInputClose, /* close_display */ + XInputWireToEvent, /* wire_to_event */ + _XiEventToWire, /* event_to_wire */ + NULL, /* error */ + XInputError, /* error_string */ +}; + +static char *XInputErrorList[] = { + "BadDevice, invalid or uninitialized input device", /* BadDevice */ + "BadEvent, invalid event type", /* BadEvent */ + "BadMode, invalid mode parameter", /* BadMode */ + "DeviceBusy, device is busy", /* DeviceBusy */ + "BadClass, invalid event class", /* BadClass */ +}; + +XEXT_GENERATE_FIND_DISPLAY (XInput_find_display, xinput_info, + xinput_extension_name, &xinput_extension_hooks, IEVENTS, NULL) + +static XEXT_GENERATE_ERROR_STRING (XInputError, xinput_extension_name, + IERRORS, XInputErrorList) +/******************************************************************* + * + * Input extension versions. + * + */ + +static XExtensionVersion versions[] = {{XI_Absent,0,0}, + {XI_Present, XI_Initial_Release_Major, XI_Initial_Release_Minor}, + {XI_Present, XI_Add_XDeviceBell_Major, XI_Add_XDeviceBell_Minor}, + {XI_Present, XI_Add_XSetDeviceValuators_Major, + XI_Add_XSetDeviceValuators_Minor}, + {XI_Present, XI_Add_XChangeDeviceControl_Major, + XI_Add_XChangeDeviceControl_Minor}}; + +/*********************************************************************** + * + * Return errors reported by this extension. + * + */ + +void _xibaddevice (dpy, error) + Display *dpy; + int *error; + { + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + *error = info->codes->first_error + XI_BadDevice; + } + +void _xibadclass (dpy, error) + Display *dpy; + int *error; + { + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + *error = info->codes->first_error + XI_BadClass; + } + +void _xibadevent (dpy, error) + Display *dpy; + int *error; + { + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + *error = info->codes->first_error + XI_BadEvent; + } + +void _xibadmode (dpy, error) + Display *dpy; + int *error; + { + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + *error = info->codes->first_error + XI_BadMode; + } + +void _xidevicebusy (dpy, error) + Display *dpy; + int *error; + { + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + *error = info->codes->first_error + XI_DeviceBusy; + } + +/*********************************************************************** + * + * Check to see if the input extension is installed in the server. + * Also check to see if the version is >= the requested version. + * + */ + +_XiCheckExtInit(dpy, version_index) + register Display *dpy; + register int version_index; + { + XExtensionVersion *ext; + XExtDisplayInfo *info = XInput_find_display (dpy); + + XInputCheckExtension (dpy, info, -1); + + if (info->data == NULL) + { + info->data = (XPointer) Xmalloc (sizeof (XInputData)); + if (!info->data) + { + UnlockDisplay(dpy); + return (-1); + } + ((XInputData *) info->data)->vers = + XGetExtensionVersion (dpy, "XInputExtension"); + } + + if (versions[version_index].major_version > Dont_Check) + { + ext = ((XInputData *) info->data)->vers; + if ((ext->major_version < versions[version_index].major_version) || + ((ext->major_version == versions[version_index].major_version) && + (ext->minor_version < versions[version_index].minor_version))) + { + UnlockDisplay(dpy); + return (-1); + } + } + return (0); + } + +/*********************************************************************** + * + * Close display routine. + * + */ + +static int +XInputClose (dpy, codes) + Display *dpy; + XExtCodes *codes; + { + XExtDisplayInfo *info = XInput_find_display (dpy); + + if(info->data != NULL) { + XFree((char *)((XInputData *) info->data)->vers); + XFree((char *)info->data); + } + return XextRemoveDisplay (xinput_info, dpy); + } + + +static int +Ones(mask) + Mask mask; +{ + register Mask y; + + y = (mask >> 1) &033333333333; + y = mask - y - ((y >>1) & 033333333333); + return (((y + (y >> 3)) & 030707070707) % 077); +} + +/*********************************************************************** + * + * Handle Input extension events. + * Reformat a wire event into an XEvent structure of the right type. + * + */ + +static Bool +XInputWireToEvent (dpy, re, event) + Display *dpy; + XEvent *re; + xEvent *event; + { + unsigned int type, reltype; + unsigned int i,j; + XExtDisplayInfo *info = XInput_find_display (dpy); + XEvent *save = (XEvent *) info->data; + + type = event->u.u.type & 0x7f; + reltype = (type - info->codes->first_event); + + + + if (reltype != XI_DeviceValuator && + reltype != XI_DeviceKeystateNotify && + reltype != XI_DeviceButtonstateNotify) + { + *save = emptyevent; + save->type = type; + ((XAnyEvent *)save)->serial = _XSetLastRequestRead(dpy, + (xGenericReply *)event); + ((XAnyEvent *)save)->send_event = ((event->u.u.type & 0x80) != 0); + ((XAnyEvent *)save)->display = dpy; + } + + switch (reltype) + { + case XI_DeviceMotionNotify: + { + register XDeviceMotionEvent *ev = (XDeviceMotionEvent*) save; + deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event; + + ev->root = ev2->root; + ev->window = ev2->event; + ev->subwindow = ev2->child; + ev->time = ev2->time; + ev->x_root = ev2->root_x; + ev->y_root = ev2->root_y; + ev->x = ev2->event_x; + ev->y = ev2->event_y; + ev->state = ev2->state; + ev->same_screen = ev2->same_screen; + ev->is_hint = ev2->detail; + ev->deviceid = ev2->deviceid & DEVICE_BITS; + return (DONT_ENQUEUE); + } + break; + case XI_DeviceKeyPress: + case XI_DeviceKeyRelease: + { + register XDeviceKeyEvent *ev = (XDeviceKeyEvent*) save; + deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event; + + ev->root = ev2->root; + ev->window = ev2->event; + ev->subwindow = ev2->child; + ev->time = ev2->time; + ev->x_root = ev2->root_x; + ev->y_root = ev2->root_y; + ev->x = ev2->event_x; + ev->y = ev2->event_y; + ev->state = ev2->state; + ev->same_screen = ev2->same_screen; + ev->keycode = ev2->detail; + ev->deviceid = ev2->deviceid & DEVICE_BITS; + if (ev2->deviceid & MORE_EVENTS) + return (DONT_ENQUEUE); + else + { + *re = *save; + return (ENQUEUE_EVENT); + } + } + break; + case XI_DeviceButtonPress: + case XI_DeviceButtonRelease: + { + register XDeviceButtonEvent *ev = (XDeviceButtonEvent*) save; + deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event; + + ev->root = ev2->root; + ev->window = ev2->event; + ev->subwindow = ev2->child; + ev->time = ev2->time; + ev->x_root = ev2->root_x; + ev->y_root = ev2->root_y; + ev->x = ev2->event_x; + ev->y = ev2->event_y; + ev->state = ev2->state; + ev->same_screen = ev2->same_screen; + ev->button = ev2->detail; + ev->deviceid = ev2->deviceid & DEVICE_BITS; + if (ev2->deviceid & MORE_EVENTS) + return (DONT_ENQUEUE); + else + { + *re = *save; + return (ENQUEUE_EVENT); + } + } + break; + case XI_ProximityIn: + case XI_ProximityOut: + { + register XProximityNotifyEvent *ev = + (XProximityNotifyEvent *) save; + deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event; + + ev->root = ev2->root; + ev->window = ev2->event; + ev->subwindow = ev2->child; + ev->time = ev2->time; + ev->x_root = ev2->root_x; + ev->y_root = ev2->root_y; + ev->x = ev2->event_x; + ev->y = ev2->event_y; + ev->state = ev2->state; + ev->same_screen = ev2->same_screen; + ev->deviceid = ev2->deviceid & DEVICE_BITS; + if (ev2->deviceid & MORE_EVENTS) + return (DONT_ENQUEUE); + else + { + *re = *save; + return (ENQUEUE_EVENT); + } + } + break; + case XI_DeviceValuator: + { + deviceValuator *xev = (deviceValuator *) event; + int save_type = save->type - info->codes->first_event; + + if (save_type == XI_DeviceKeyPress || + save_type == XI_DeviceKeyRelease) + { + XDeviceKeyEvent *kev = (XDeviceKeyEvent*) save; + kev->device_state = xev->device_state; + kev->axes_count = xev->num_valuators; + kev->first_axis = xev->first_valuator; + i = xev->num_valuators; + if (i > 6) i = 6; + switch (i) + { + case 6: kev->axis_data[5] = xev->valuator5; + case 5: kev->axis_data[4] = xev->valuator4; + case 4: kev->axis_data[3] = xev->valuator3; + case 3: kev->axis_data[2] = xev->valuator2; + case 2: kev->axis_data[1] = xev->valuator1; + case 1: kev->axis_data[0] = xev->valuator0; + } + } + else if (save_type == XI_DeviceButtonPress || + save_type == XI_DeviceButtonRelease) + { + XDeviceButtonEvent *bev = (XDeviceButtonEvent*) save; + bev->device_state = xev->device_state; + bev->axes_count = xev->num_valuators; + bev->first_axis = xev->first_valuator; + i = xev->num_valuators; + if (i > 6) i = 6; + switch (i) + { + case 6: bev->axis_data[5] = xev->valuator5; + case 5: bev->axis_data[4] = xev->valuator4; + case 4: bev->axis_data[3] = xev->valuator3; + case 3: bev->axis_data[2] = xev->valuator2; + case 2: bev->axis_data[1] = xev->valuator1; + case 1: bev->axis_data[0] = xev->valuator0; + } + } + else if (save_type == XI_DeviceMotionNotify) + { + XDeviceMotionEvent *mev = (XDeviceMotionEvent*) save; + mev->device_state = xev->device_state; + mev->axes_count = xev->num_valuators; + mev->first_axis = xev->first_valuator; + i = xev->num_valuators; + if (i > 6) i = 6; + switch (i) + { + case 6: mev->axis_data[5] = xev->valuator5; + case 5: mev->axis_data[4] = xev->valuator4; + case 4: mev->axis_data[3] = xev->valuator3; + case 3: mev->axis_data[2] = xev->valuator2; + case 2: mev->axis_data[1] = xev->valuator1; + case 1: mev->axis_data[0] = xev->valuator0; + } + } + else if (save_type == XI_ProximityIn || + save_type == XI_ProximityOut) + { + XProximityNotifyEvent *pev = + (XProximityNotifyEvent*) save; + pev->device_state = xev->device_state; + pev->axes_count = xev->num_valuators; + pev->first_axis = xev->first_valuator; + i = xev->num_valuators; + if (i > 6) i = 6; + switch (i) + { + case 6: pev->axis_data[5] = xev->valuator5; + case 5: pev->axis_data[4] = xev->valuator4; + case 4: pev->axis_data[3] = xev->valuator3; + case 3: pev->axis_data[2] = xev->valuator2; + case 2: pev->axis_data[1] = xev->valuator1; + case 1: pev->axis_data[0] = xev->valuator0; + } + } + else if (save_type == XI_DeviceStateNotify) + { + XDeviceStateNotifyEvent *sev = + (XDeviceStateNotifyEvent*) save; + XInputClass *any = (XInputClass *) &sev->data[0]; + XValuatorStatus *v; + + for (i=0; i<sev->num_classes; i++) + if (any->class != ValuatorClass) + any = (XInputClass *) ((char *) any + any->length); + v = (XValuatorStatus *) any; + i = v->num_valuators; + j = xev->num_valuators; + if (j > 3) j = 3; + switch (j) + { + case 3: v->valuators[i + 2] = xev->valuator2; + case 2: v->valuators[i + 1] = xev->valuator1; + case 1: v->valuators[i + 0] = xev->valuator0; + } + v->num_valuators += j; + + } + *re = *save; + return (ENQUEUE_EVENT); + } + break; + case XI_DeviceFocusIn: + case XI_DeviceFocusOut: + { + register XDeviceFocusChangeEvent *ev = + (XDeviceFocusChangeEvent *) re; + deviceFocus *fev = (deviceFocus *) event; + + *ev = *((XDeviceFocusChangeEvent *) save); + ev->window = fev->window; + ev->time = fev->time; + ev->mode = fev->mode; + ev->detail = fev->detail; + ev->deviceid = fev->deviceid & DEVICE_BITS; + return (ENQUEUE_EVENT); + } + break; + case XI_DeviceStateNotify: + { + XDeviceStateNotifyEvent *stev = + (XDeviceStateNotifyEvent *) save; + deviceStateNotify *sev = (deviceStateNotify *) event; + char *data; + + stev->window = None; + stev->deviceid = sev->deviceid & DEVICE_BITS; + stev->time = sev->time; + stev->num_classes = Ones ((Mask)sev->classes_reported & InputClassBits); + data = (char *) &stev->data[0]; + if (sev->classes_reported & (1 << KeyClass)) + { + register XKeyStatus *kstev = (XKeyStatus *) data; + kstev->class = KeyClass; + kstev->length = sizeof (XKeyStatus); + kstev->num_keys = sev->num_keys; + memcpy ((char *) &kstev->keys[0], (char *) &sev->keys[0], 4); + data += sizeof (XKeyStatus); + } + if (sev->classes_reported & (1 << ButtonClass)) + { + register XButtonStatus *bev = (XButtonStatus *) data; + bev->class = ButtonClass; + bev->length = sizeof (XButtonStatus); + bev->num_buttons = sev->num_buttons; + memcpy ((char *) bev->buttons, (char *) sev->buttons, 4); + data += sizeof (XButtonStatus); + } + if (sev->classes_reported & (1 << ValuatorClass)) + { + register XValuatorStatus *vev = (XValuatorStatus *) data; + vev->class = ValuatorClass; + vev->length = sizeof (XValuatorStatus); + vev->num_valuators = sev->num_valuators; + vev->mode = sev->classes_reported >> ModeBitsShift; + j = sev->num_valuators; + if (j > 3) j = 3; + switch (j) + { + case 3: vev->valuators[2] = sev->valuator2; + case 2: vev->valuators[1] = sev->valuator1; + case 1: vev->valuators[0] = sev->valuator0; + } + data += sizeof (XValuatorStatus); + } + if (sev->deviceid & MORE_EVENTS) + return (DONT_ENQUEUE); + else + { + *re = *save; + stev = (XDeviceStateNotifyEvent *) re; + return (ENQUEUE_EVENT); + } + } + break; + case XI_DeviceKeystateNotify: + { + int i; + XInputClass *anyclass; + register XKeyStatus *kv; + deviceKeyStateNotify *ksev = (deviceKeyStateNotify *) event; + XDeviceStateNotifyEvent *kstev = + (XDeviceStateNotifyEvent *) save; + + anyclass = (XInputClass *) &kstev->data[0]; + for (i=0; i<kstev->num_classes; i++) + if (anyclass->class == KeyClass) + break; + else + anyclass = (XInputClass *) ((char *) anyclass + + anyclass->length); + + kv = (XKeyStatus *) anyclass; + kv->num_keys = 256; + memcpy ((char *) &kv->keys[4], (char *) ksev->keys, 28); + if (ksev->deviceid & MORE_EVENTS) + return (DONT_ENQUEUE); + else + { + *re = *save; + kstev = (XDeviceStateNotifyEvent *) re; + return (ENQUEUE_EVENT); + } + } + break; + case XI_DeviceButtonstateNotify: + { + int i; + XInputClass *anyclass; + register XButtonStatus *bv; + deviceButtonStateNotify *bsev = (deviceButtonStateNotify *) event; + XDeviceStateNotifyEvent *bstev = + (XDeviceStateNotifyEvent *) save; + + + anyclass = (XInputClass *) &bstev->data[0]; + for (i=0; i<bstev->num_classes; i++) + if (anyclass->class == ButtonClass) + break; + else + anyclass = (XInputClass *) ((char *) anyclass + + anyclass->length); + + bv = (XButtonStatus *) anyclass; + bv->num_buttons = 256; + memcpy ((char *) &bv->buttons[4], (char *) bsev->buttons, 28); + if (bsev->deviceid & MORE_EVENTS) + return (DONT_ENQUEUE); + else + { + *re = *save; + bstev = (XDeviceStateNotifyEvent *) re; + return (ENQUEUE_EVENT); + } + } + break; + case XI_DeviceMappingNotify: + { + register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re; + deviceMappingNotify *ev2 = (deviceMappingNotify *) event; + + *ev = *((XDeviceMappingEvent *) save); + ev->window = 0; + ev->first_keycode = ev2->firstKeyCode; + ev->request = ev2->request; + ev->count = ev2->count; + ev->time = ev2->time; + ev->deviceid = ev2->deviceid & DEVICE_BITS; + return (ENQUEUE_EVENT); + } + break; + case XI_ChangeDeviceNotify: + { + register XChangeDeviceNotifyEvent *ev = + (XChangeDeviceNotifyEvent *) re; + changeDeviceNotify *ev2 = (changeDeviceNotify *) event; + + *ev = *((XChangeDeviceNotifyEvent *) save); + ev->window = 0; + ev->request = ev2->request; + ev->time = ev2->time; + ev->deviceid = ev2->deviceid & DEVICE_BITS; + return (ENQUEUE_EVENT); + } + break; + default: + printf ("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n",type); + break; + } + + return (DONT_ENQUEUE); + } diff --git a/src/XExtToWire.c b/src/XExtToWire.c new file mode 100644 index 0000000..abdaf14 --- /dev/null +++ b/src/XExtToWire.c @@ -0,0 +1,450 @@ +/* $Xorg: XExtToWire.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/**************************************************************** + * + * XExtToWire.c - reformat an XEvent into a wire event. + */ + +#define NEED_EVENTS +#define NEED_REPLIES + +#include "Xlibint.h" +#include "XInput.h" +#include "XIproto.h" +#include "extutil.h" + +Status +_XiEventToWire(dpy, re, event, count) + register Display *dpy; /* pointer to display structure */ + register XEvent *re; /* pointer to client event */ + register xEvent **event; /* wire protocol event */ + register int *count; + { + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + int i; + + switch ((re->type & 0x7f) - info->codes->first_event) + { + case XI_DeviceKeyPress: + case XI_DeviceKeyRelease: + { + register XDeviceKeyEvent *ev = (XDeviceKeyEvent*) re; + register deviceKeyButtonPointer *kev; + register deviceValuator *vev; + + *count = 2; + kev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent)); + if (!kev) + return(_XUnknownNativeEvent(dpy, re, event)); + *event = (xEvent *) kev; + + kev->type = ev->type; + kev->root = ev->root; + kev->event = ev->window; + kev->child = ev->subwindow; + kev->time = ev->time; + kev->event_x = ev->x ; + kev->event_y = ev->y ; + kev->root_x = ev->x_root; + kev->root_y = ev->y_root; + kev->state = ev->state; + kev->same_screen = ev->same_screen; + kev->detail = ev->keycode; + kev->deviceid = ev->deviceid | MORE_EVENTS; + + vev = (deviceValuator *) ++kev; + vev->type = info->codes->first_event + XI_DeviceValuator; + vev->deviceid = ev->deviceid; + vev->device_state = ev->device_state; + vev->first_valuator = ev->first_axis; + vev->num_valuators = ev->axes_count; + i = vev->num_valuators; + if (i > 6) i = 6; + switch (i) + { + case 6: vev->valuator5 = ev->axis_data[5]; + case 5: vev->valuator4 = ev->axis_data[4]; + case 4: vev->valuator3 = ev->axis_data[3]; + case 3: vev->valuator2 = ev->axis_data[2]; + case 2: vev->valuator1 = ev->axis_data[1]; + case 1: vev->valuator0 = ev->axis_data[0]; + } + break; + } + case XI_ProximityIn: + case XI_ProximityOut: + { + register XProximityNotifyEvent *ev = + (XProximityNotifyEvent *) re; + register deviceKeyButtonPointer *pev; + register deviceValuator *vev; + + *count = 2; + pev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent)); + if (!pev) + return(_XUnknownNativeEvent(dpy, re, event)); + *event = (xEvent *) pev; + + pev->type = ev->type; + pev->root = ev->root; + pev->event = ev->window; + pev->child = ev->subwindow; + pev->time = ev->time; + pev->event_x = ev->x ; + pev->event_y = ev->y ; + pev->root_x = ev->x_root; + pev->root_y = ev->y_root; + pev->state = ev->state; + pev->same_screen = ev->same_screen; + pev->deviceid = ev->deviceid | MORE_EVENTS; + + vev = (deviceValuator *) ++pev; + vev->type = info->codes->first_event + XI_DeviceValuator; + vev->deviceid = ev->deviceid; + vev->device_state = ev->device_state; + vev->first_valuator = ev->first_axis; + vev->num_valuators = ev->axes_count; + + i = vev->num_valuators; + if (i > 6) i = 6; + switch (i) + { + case 6: vev->valuator5 = ev->axis_data[5]; + case 5: vev->valuator4 = ev->axis_data[4]; + case 4: vev->valuator3 = ev->axis_data[3]; + case 3: vev->valuator2 = ev->axis_data[2]; + case 2: vev->valuator1 = ev->axis_data[1]; + case 1: vev->valuator0 = ev->axis_data[0]; + } + break; + } + case XI_DeviceButtonPress: + case XI_DeviceButtonRelease: + { + register XDeviceButtonEvent *ev = + (XDeviceButtonEvent *) re; + register deviceKeyButtonPointer *bev; + register deviceValuator *vev; + + *count = 2; + bev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent)); + if (!bev) + return(_XUnknownNativeEvent(dpy, re, event)); + *event = (xEvent *) bev; + + bev->type = ev->type; + bev->root = ev->root; + bev->event = ev->window; + bev->child = ev->subwindow; + bev->time = ev->time; + bev->event_x = ev->x ; + bev->event_y = ev->y ; + bev->root_x = ev->x_root; + bev->root_y = ev->y_root; + bev->state = ev->state; + bev->same_screen = ev->same_screen; + bev->detail = ev->button; + bev->deviceid = ev->deviceid | MORE_EVENTS; + + vev = (deviceValuator *) ++bev; + vev->type = info->codes->first_event + XI_DeviceValuator; + vev->deviceid = ev->deviceid; + vev->device_state = ev->device_state; + vev->first_valuator = ev->first_axis; + vev->num_valuators = ev->axes_count; + + i = vev->num_valuators; + if (i > 6) i = 6; + switch (i) + { + case 6: vev->valuator5 = ev->axis_data[5]; + case 5: vev->valuator4 = ev->axis_data[4]; + case 4: vev->valuator3 = ev->axis_data[3]; + case 3: vev->valuator2 = ev->axis_data[2]; + case 2: vev->valuator1 = ev->axis_data[1]; + case 1: vev->valuator0 = ev->axis_data[0]; + } + break; + } + case XI_DeviceMotionNotify: + { + register XDeviceMotionEvent *ev = + (XDeviceMotionEvent *)re; + register deviceKeyButtonPointer *mev; + register deviceValuator *vev; + + *count = 2; + mev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent)); + if (!mev) + return(_XUnknownNativeEvent(dpy, re, event)); + *event = (xEvent *) mev; + + mev->type = ev->type; + mev->root = ev->root; + mev->event = ev->window; + mev->child = ev->subwindow; + mev->time = ev->time; + mev->event_x = ev->x ; + mev->event_y = ev->y ; + mev->root_x = ev->x_root; + mev->root_y = ev->y_root; + mev->state = ev->state; + mev->same_screen = ev->same_screen; + mev->detail = ev->is_hint; + mev->deviceid = ev->deviceid | MORE_EVENTS; + + vev = (deviceValuator *) ++mev; + vev->type = info->codes->first_event + XI_DeviceValuator; + vev->deviceid = ev->deviceid; + vev->device_state = ev->device_state; + vev->first_valuator = ev->first_axis; + vev->num_valuators = ev->axes_count; + + i = vev->num_valuators; + if (i > 6) i = 6; + switch (i) + { + case 6: vev->valuator5 = ev->axis_data[5]; + case 5: vev->valuator4 = ev->axis_data[4]; + case 4: vev->valuator3 = ev->axis_data[3]; + case 3: vev->valuator2 = ev->axis_data[2]; + case 2: vev->valuator1 = ev->axis_data[1]; + case 1: vev->valuator0 = ev->axis_data[0]; + } + break; + } + case XI_DeviceFocusIn: + case XI_DeviceFocusOut: + { + register XDeviceFocusChangeEvent *ev = + (XDeviceFocusChangeEvent *) re; + register deviceFocus *fev; + + *count = 1; + fev = (deviceFocus *) Xmalloc (*count * sizeof (xEvent)); + if (!fev) + return(_XUnknownNativeEvent(dpy, re, event)); + *event = (xEvent *) fev; + + fev->type = ev->type; + fev->window = ev->window; + fev->mode = ev->mode; + fev->detail = ev->detail; + fev->time = ev->time; + fev->deviceid = ev->deviceid; + break; + } + case XI_DeviceMappingNotify: + { + register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re; + register deviceMappingNotify *mev; + + *count = 1; + mev = (deviceMappingNotify *) Xmalloc (*count * sizeof (xEvent)); + if (!mev) + return(_XUnknownNativeEvent(dpy, re, event)); + *event = (xEvent *) mev; + + mev->type = ev->type; + mev->firstKeyCode = ev->first_keycode; + mev->request = ev->request; + mev->count = ev->count; + mev->time = ev->time; + mev->deviceid = ev->deviceid; + break; + } + case XI_DeviceStateNotify: + { + register XDeviceStateNotifyEvent *ev = + (XDeviceStateNotifyEvent *) re; + register deviceStateNotify *sev; + register xEvent *tev; + XInputClass *any = (XInputClass *) &ev->data[0]; + unsigned char *sav_id; + *count = 1; + + for (i=0; i<ev->num_classes; i++) + { + if (any->class == KeyClass) + { + XKeyStatus *k = (XKeyStatus *) any; + if (k->num_keys > 32) + (*count)++; + } + else if (any->class == ButtonClass) + { + XButtonStatus *b = (XButtonStatus *) any; + if (b->num_buttons > 32) + (*count)++; + } + else if (any->class == ValuatorClass) + { + XValuatorStatus *v = (XValuatorStatus *) any; + if (v->num_valuators > 3) + (*count)++; + } + any = (XInputClass *) ((char *) any + any->length); + } + + sev = (deviceStateNotify *) Xmalloc (*count * sizeof (xEvent)); + if (!sev) + return(_XUnknownNativeEvent(dpy, re, event)); + *event = (xEvent *) sev; + tev = (xEvent *) (sev+1); + + sev->type = ev->type; + sev->deviceid = ev->deviceid; + sav_id = &(sev->deviceid); + sev->time = ev->time; + sev->classes_reported = 0; + + any = (XInputClass *) &ev->data[0]; + for (i=0; i<ev->num_classes; i++) + { + if (any->class == KeyClass) + { + XKeyStatus *k = (XKeyStatus *) any; + register deviceKeyStateNotify *kev; + + sev->classes_reported |= (1 << KeyClass); + sev->num_keys = k->num_keys; + memcpy ((char *) (sev->keys), (char *) (k->keys), 4); + if (k->num_keys > 32) + { + kev = (deviceKeyStateNotify *) tev++; + kev->type = info->codes->first_event + + XI_DeviceKeystateNotify; + kev->deviceid = ev->deviceid; + *sav_id |= MORE_EVENTS; + sav_id = &(kev->deviceid); + memcpy ((char *) (kev->keys), (char *) (&k->keys[4]), + 28); + } + } + else if (any->class == ButtonClass) + { + XButtonStatus *b = (XButtonStatus *) any; + register deviceButtonStateNotify *bev; + + sev->classes_reported |= (1 << ButtonClass); + sev->num_buttons = b->num_buttons; + memcpy ((char *) (sev->buttons), (char *) (b->buttons), 4); + if (b->num_buttons > 32) + { + bev = (deviceButtonStateNotify *) tev++; + bev->type = info->codes->first_event + + XI_DeviceButtonstateNotify; + bev->deviceid = ev->deviceid; + *sav_id |= MORE_EVENTS; + sav_id = &(bev->deviceid); + memcpy ((char *)(bev->buttons), (char *)(&b->buttons[4]), + 28); + } + } + else if (any->class == ValuatorClass) + { + XValuatorStatus *val = (XValuatorStatus *) any; + register deviceValuator *vev; + + sev->classes_reported |= (1 << ValuatorClass); + sev->num_valuators = val->num_valuators < 3 ? + val->num_valuators : 3; + switch (sev->num_valuators) + { + case 3: sev->valuator2 = val->valuators[2]; + case 2: sev->valuator1 = val->valuators[1]; + case 1: sev->valuator0 = val->valuators[0]; + } + if (val->num_valuators > 3) + { + vev = (deviceValuator *) tev++; + vev->type = info->codes->first_event + + XI_DeviceValuator; + vev->deviceid = ev->deviceid; + vev->first_valuator = 3; + vev->num_valuators = val->num_valuators - 3; + *sav_id |= MORE_EVENTS; + sav_id = &(vev->deviceid); + i = val->num_valuators; + if (i > 6) i = 6; + switch (i) + { + case 6: vev->valuator2 = val->valuators[5]; + case 5: vev->valuator1 = val->valuators[4]; + case 4: vev->valuator0 = val->valuators[3]; + } + } + } + any = (XInputClass *) ((char *) any + any->length); + } + break; + } + case XI_ChangeDeviceNotify: + { + register XChangeDeviceNotifyEvent *ev = + (XChangeDeviceNotifyEvent *) re; + register changeDeviceNotify *cev; + + *count = 1; + cev = (changeDeviceNotify *) Xmalloc (*count * sizeof (xEvent)); + if (!cev) + return(_XUnknownNativeEvent(dpy, re, event)); + *event = (xEvent *) cev; + + cev->type = ev->type; + cev->request = ev->request; + cev->time = ev->time; + cev->deviceid = ev->deviceid; + break; + } + default: + return(_XUnknownNativeEvent(dpy, re, event)); + } + return(1); + } diff --git a/src/XFreeLst.c b/src/XFreeLst.c new file mode 100644 index 0000000..63a5946 --- /dev/null +++ b/src/XFreeLst.c @@ -0,0 +1,72 @@ +/* $Xorg: XFreeLst.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XFreeDeviceList - free the input device list. + * + */ + +#include <stdio.h> +#include "Xlib.h" + +/*********************************************************************** + * + * Free the list of input devices. + * + */ + +XFreeDeviceList (list) + XDeviceList *list; + { + if (list != NULL) + { + XFree ((list->name) - sizeof(XDeviceList)); + XFree ((XDeviceList *) list); + } + } diff --git a/src/XGMotion.c b/src/XGMotion.c new file mode 100644 index 0000000..14d2cba --- /dev/null +++ b/src/XGMotion.c @@ -0,0 +1,140 @@ +/* $Xorg: XGMotion.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetDeviceMotionEvents - Get the motion history of an input device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +XDeviceTimeCoord +*XGetDeviceMotionEvents (dpy, dev, start, stop, nEvents, mode, axis_count) + register Display *dpy; + XDevice *dev; + Time start; + Time stop; + int *nEvents; + int *mode; + int *axis_count; + { + xGetDeviceMotionEventsReq *req; + xGetDeviceMotionEventsReply rep; + XDeviceTimeCoord *tc; + int *data, *bufp, *readp, *savp; + long size, size2; + int i, j; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return ((XDeviceTimeCoord *) NoSuchExtension); + + GetReq(GetDeviceMotionEvents,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetDeviceMotionEvents; + req->start = start; + req->stop = stop; + req->deviceid = dev->device_id; + + if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + *nEvents = 0; + return (NULL); + } + + *mode = rep.mode; + *axis_count = rep.axes; + *nEvents = rep.nEvents; + if (!rep.nEvents) + { + UnlockDisplay(dpy); + SyncHandle(); + return (NULL); + } + size = rep.length << 2; + size2 = rep.nEvents * + (sizeof (XDeviceTimeCoord) + (rep.axes * sizeof (int))); + savp = readp = (int *) Xmalloc (size); + bufp = (int *) Xmalloc (size2); + if (!bufp || !savp) + { + *nEvents = 0; + _XEatData (dpy, (unsigned long) size); + UnlockDisplay(dpy); + SyncHandle(); + return (NULL); + } + _XRead (dpy, (char *) readp, size); + + tc = (XDeviceTimeCoord *) bufp; + data = (int *) (tc + rep.nEvents); + for (i=0; i<*nEvents; i++,tc++) + { + tc->time = *readp++; + tc->data = data; + for (j=0; j<*axis_count; j++) + *data++ = *readp++; + } + XFree ((char *)savp); + UnlockDisplay(dpy); + SyncHandle(); + return ((XDeviceTimeCoord *) bufp); + } + +void XFreeDeviceMotionEvents (events) + XDeviceTimeCoord *events; + { + XFree ((char *)events); + } diff --git a/src/XGetBMap.c b/src/XGetBMap.c new file mode 100644 index 0000000..7c814fe --- /dev/null +++ b/src/XGetBMap.c @@ -0,0 +1,105 @@ +/* $Xorg: XGetBMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetDeviceButtonMapping - Get the button mapping of an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" +#ifdef MIN /* some systems define this in <sys/param.h> */ +#undef MIN +#endif +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +int +XGetDeviceButtonMapping (dpy, device, map, nmap) + register Display *dpy; + XDevice *device; + unsigned char map[]; + unsigned int nmap; + { + int status = 0; + unsigned char mapping[256]; /* known fixed size */ + long nbytes; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + register xGetDeviceButtonMappingReq *req; + xGetDeviceButtonMappingReply rep; + + LockDisplay(dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + GetReq(GetDeviceButtonMapping, req); + + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetDeviceButtonMapping; + req->deviceid = device->device_id; + + status = _XReply (dpy, (xReply *)&rep, 0, xFalse); + if (status == 1) + { + nbytes = (long)rep.length << 2; + _XRead (dpy, (char *)mapping, nbytes); + + /* don't return more data than the user asked for. */ + if (rep.nElts) + memcpy ((char *) map, (char *) mapping, MIN((int)rep.nElts, nmap)); + status = rep.nElts; + } + else + status = 0; + UnlockDisplay(dpy); + SyncHandle(); + return (status); + } diff --git a/src/XGetDCtl.c b/src/XGetDCtl.c new file mode 100644 index 0000000..65c270c --- /dev/null +++ b/src/XGetDCtl.c @@ -0,0 +1,171 @@ +/* $Xorg: XGetDCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetDeviceControl - get the Device control state of an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "Xlib.h" +#include "XInput.h" +#include "extutil.h" + +XDeviceControl +*XGetDeviceControl (dpy, dev, control) + register Display *dpy; + XDevice *dev; + int control; + { + int size = 0; + int nbytes, i; + XDeviceControl *Device = NULL; + XDeviceControl *Sav = NULL; + xDeviceState *d = NULL; + xDeviceState *sav = NULL; + xGetDeviceControlReq *req; + xGetDeviceControlReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl) == -1) + return ((XDeviceControl *) NoSuchExtension); + + GetReq(GetDeviceControl,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetDeviceControl; + req->deviceid = dev->device_id; + req->control = control; + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XDeviceControl *) NULL; + } + if (rep.length > 0) + { + nbytes = (long)rep.length << 2; + d = (xDeviceState *) Xmalloc((unsigned) nbytes); + if (!d) + { + _XEatData (dpy, (unsigned long) nbytes); + UnlockDisplay(dpy); + SyncHandle(); + return (XDeviceControl *) NULL; + } + sav = d; + _XRead (dpy, (char *) d, nbytes); + + switch (d->control) + { + case DEVICE_RESOLUTION: + { + xDeviceResolutionState *r; + + r = (xDeviceResolutionState *) d; + size += sizeof (XDeviceResolutionState) + + (3 * sizeof(int) * r->num_valuators); + break; + } + default: + size += d->length; + break; + } + + Device = (XDeviceControl *) Xmalloc((unsigned) size); + if (!Device) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XDeviceControl *) NULL; + } + Sav = Device; + + d = sav; + switch (control) + { + case DEVICE_RESOLUTION: + { + int *iptr, *iptr2; + xDeviceResolutionState *r; + XDeviceResolutionState *R; + r = (xDeviceResolutionState *) d; + R = (XDeviceResolutionState *) Device; + + R->control = DEVICE_RESOLUTION; + R->length = sizeof (XDeviceResolutionState); + R->num_valuators = r->num_valuators; + iptr = (int *) (R+1); + iptr2 = (int *) (r+1); + R->resolutions = iptr; + R->min_resolutions = iptr + R->num_valuators; + R->max_resolutions = iptr + (2 * R->num_valuators); + for (i=0; i < (3 * R->num_valuators); i++) + *iptr++ = *iptr2++; + break; + } + default: + break; + } + XFree (sav); + } + + UnlockDisplay(dpy); + SyncHandle(); + return (Sav); + } + +void XFreeDeviceControl (control) + XDeviceControl *control; + { + XFree (control); + } diff --git a/src/XGetFCtl.c b/src/XGetFCtl.c new file mode 100644 index 0000000..b941bfb --- /dev/null +++ b/src/XGetFCtl.c @@ -0,0 +1,271 @@ +/* $Xorg: XGetFCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetFeedbackControl - get the feedback attributes of an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "Xlib.h" +#include "XInput.h" +#include "extutil.h" + +XFeedbackState +*XGetFeedbackControl (dpy, dev, num_feedbacks) + register Display *dpy; + XDevice *dev; + int *num_feedbacks; + { + int size = 0; + int nbytes, i; + XFeedbackState *Feedback = NULL; + XFeedbackState *Sav = NULL; + xFeedbackState *f = NULL; + xFeedbackState *sav = NULL; + xGetFeedbackControlReq *req; + xGetFeedbackControlReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return ((XFeedbackState *) NoSuchExtension); + + GetReq(GetFeedbackControl,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetFeedbackControl; + req->deviceid = dev->device_id; + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XFeedbackState *) NULL; + } + if (rep.length > 0) + { + *num_feedbacks = rep.num_feedbacks; + nbytes = (long)rep.length << 2; + f = (xFeedbackState *) Xmalloc((unsigned) nbytes); + if (!f) + { + _XEatData (dpy, (unsigned long) nbytes); + UnlockDisplay(dpy); + SyncHandle(); + return (XFeedbackState *) NULL; + } + sav = f; + _XRead (dpy, (char *) f, nbytes); + + for (i=0; i<*num_feedbacks; i++) + { + switch (f->class) + { + case KbdFeedbackClass: + size += sizeof (XKbdFeedbackState); + break; + case PtrFeedbackClass: + size += sizeof (XPtrFeedbackState); + break; + case IntegerFeedbackClass: + size += sizeof (XIntegerFeedbackState); + break; + case StringFeedbackClass: + { + xStringFeedbackState *strf = (xStringFeedbackState *) f; + + size += sizeof (XStringFeedbackState) + + (strf->num_syms_supported * sizeof (KeySym)); + } + break; + case LedFeedbackClass: + size += sizeof (XLedFeedbackState); + break; + case BellFeedbackClass: + size += sizeof (XBellFeedbackState); + break; + default: + size += f->length; + break; + } + f = (xFeedbackState *) ((char *) f + f->length); + } + + Feedback = (XFeedbackState *) Xmalloc((unsigned) size); + if (!Feedback) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XFeedbackState *) NULL; + } + Sav = Feedback; + + f = sav; + for (i=0; i<*num_feedbacks; i++) + { + switch (f->class) + { + case KbdFeedbackClass: + { + xKbdFeedbackState *k; + XKbdFeedbackState *K; + k = (xKbdFeedbackState *) f; + K = (XKbdFeedbackState *) Feedback; + + K->class = k->class; + K->length = sizeof (XKbdFeedbackState); + K->id = k->id; + K->click = k->click; + K->percent = k->percent; + K->pitch = k->pitch; + K->duration = k->duration; + K->led_mask = k->led_mask; + K->global_auto_repeat = k->global_auto_repeat; + memcpy ((char *) &K->auto_repeats[0], + (char *) &k->auto_repeats[0], 32); + break; + } + case PtrFeedbackClass: + { + xPtrFeedbackState *p; + XPtrFeedbackState *P; + p = (xPtrFeedbackState *) f; + P = (XPtrFeedbackState *) Feedback; + + P->class = p->class; + P->length = sizeof (XPtrFeedbackState); + P->id = p->id; + P->accelNum = p->accelNum; + P->accelDenom = p->accelDenom; + P->threshold = p->threshold; + break; + } + case IntegerFeedbackClass: + { + xIntegerFeedbackState *i; + XIntegerFeedbackState *I; + i = (xIntegerFeedbackState *) f; + I = (XIntegerFeedbackState *) Feedback; + + I->class = i->class; + I->length = sizeof (XIntegerFeedbackState); + I->id = i->id; + I->resolution = i->resolution; + I->minVal = i->min_value; + I->maxVal = i->max_value; + break; + } + case StringFeedbackClass: + { + xStringFeedbackState *s; + XStringFeedbackState *S; + s = (xStringFeedbackState *) f; + S = (XStringFeedbackState *) Feedback; + + S->class = s->class; + S->length = sizeof (XStringFeedbackState) + + (s->num_syms_supported * sizeof (KeySym)); + S->id = s->id; + S->max_symbols = s->max_symbols; + S->num_syms_supported = s->num_syms_supported; + S->syms_supported = (KeySym *) (S+1); + memcpy ((char *) S->syms_supported, (char *) (s+1), + (S->num_syms_supported * sizeof (KeySym))); + break; + } + case LedFeedbackClass: + { + xLedFeedbackState *l; + XLedFeedbackState *L; + l = (xLedFeedbackState *) f; + L = (XLedFeedbackState *) Feedback; + + L->class = l->class; + L->length = sizeof (XLedFeedbackState); + L->id = l->id; + L->led_values = l->led_values; + L->led_mask = l->led_mask; + break; + } + case BellFeedbackClass: + { + xBellFeedbackState *b; + XBellFeedbackState *B; + b = (xBellFeedbackState *) f; + B = (XBellFeedbackState *) Feedback; + + B->class = b->class; + B->length = sizeof (XBellFeedbackState); + B->id = b->id; + B->percent = b->percent; + B->pitch = b->pitch; + B->duration = b->duration; + break; + } + default: + break; + } + f = (xFeedbackState *) ((char *) f + f->length); + Feedback = (XFeedbackState *) ((char *) Feedback+Feedback->length); + } + XFree ((char *)sav); + } + + UnlockDisplay(dpy); + SyncHandle(); + return (Sav); + } + +void XFreeFeedbackList (list) + XFeedbackState *list; + { + XFree ((char *)list); + } diff --git a/src/XGetKMap.c b/src/XGetKMap.c new file mode 100644 index 0000000..8813b8f --- /dev/null +++ b/src/XGetKMap.c @@ -0,0 +1,118 @@ +/* $Xorg: XGetKMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetDeviceKeyMapping - get the keymap of an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +KeySym +#if NeedFunctionPrototypes +*XGetDeviceKeyMapping ( + register Display *dpy, + XDevice *dev, +#if NeedWidePrototypes + unsigned int first, +#else + KeyCode first, +#endif + int keycount, + int *syms_per_code) +#else +*XGetDeviceKeyMapping (dpy, dev, first, keycount, syms_per_code) + register Display *dpy; + XDevice *dev; + KeyCode first; + int keycount; + int *syms_per_code; /* RETURN */ +#endif + { + long nbytes; + register KeySym *mapping = NULL; + xGetDeviceKeyMappingReq *req; + xGetDeviceKeyMappingReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return ((KeySym *) NoSuchExtension); + + GetReq(GetDeviceKeyMapping,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetDeviceKeyMapping; + req->deviceid = dev->device_id; + req->firstKeyCode = first; + req->count = keycount; + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (KeySym *) NULL; + } + if (rep.length > 0) { + *syms_per_code = rep.keySymsPerKeyCode; + nbytes = (long)rep.length << 2; + mapping = (KeySym *) Xmalloc((unsigned) nbytes); + if (mapping) + _XRead (dpy, (char *)mapping, nbytes); + else + _XEatData (dpy, (unsigned long) nbytes); + } + + UnlockDisplay(dpy); + SyncHandle(); + return (mapping); + } diff --git a/src/XGetMMap.c b/src/XGetMMap.c new file mode 100644 index 0000000..04615b8 --- /dev/null +++ b/src/XGetMMap.c @@ -0,0 +1,102 @@ +/* $Xorg: XGetMMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetDeviceModifierMapping - get the modifier map of an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +XModifierKeymap +*XGetDeviceModifierMapping (dpy, dev) + register Display *dpy; + XDevice *dev; + { + unsigned long nbytes; + XModifierKeymap *res; + xGetDeviceModifierMappingReq *req; + xGetDeviceModifierMappingReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return ((XModifierKeymap *) NoSuchExtension); + + GetReq(GetDeviceModifierMapping,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetDeviceModifierMapping; + req->deviceid = dev->device_id; + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XModifierKeymap *) NULL; + } + nbytes = (unsigned long)rep.length << 2; + res = (XModifierKeymap *) Xmalloc(sizeof (XModifierKeymap)); + if (res) + { + res->modifiermap = (KeyCode *) Xmalloc (nbytes); + if (res->modifiermap) + _XReadPad(dpy, (char *) res->modifiermap, nbytes); + else + _XEatData (dpy, (unsigned long) nbytes); + res->max_keypermod = rep.numKeyPerModifier; + } + + UnlockDisplay(dpy); + SyncHandle(); + return (res); + } diff --git a/src/XGetProp.c b/src/XGetProp.c new file mode 100644 index 0000000..fdfaf8c --- /dev/null +++ b/src/XGetProp.c @@ -0,0 +1,118 @@ +/* $Xorg: XGetProp.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetDeviceDontPropagateList - Get the dont_propagate_list for a + * window. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +XEventClass +*XGetDeviceDontPropagateList (dpy, window, count) + register Display *dpy; + Window window; + int *count; + { + XEventClass *list = NULL; + int rlen; + xGetDeviceDontPropagateListReq *req; + xGetDeviceDontPropagateListReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return ((XEventClass *) NoSuchExtension); + + GetReq(GetDeviceDontPropagateList,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetDeviceDontPropagateList; + req->window = window; + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XEventClass *) NULL; + } + *count = rep.count; + + if (*count) + { + rlen = rep.length << 2; + list = (XEventClass *) Xmalloc (rlen); + if (list) + { + int i; + CARD32 ec; + + /* read and assign each XEventClass separately because + * the library representation may not be the same size + * as the wire representation (64 bit machines) + */ + for (i = 0; i < rep.length; i++) + { + _XRead (dpy, (char *)(&ec), sizeof(CARD32)); + list[i] = (XEventClass)ec; + } + } + else + _XEatData (dpy, (unsigned long) rlen); + } + + UnlockDisplay(dpy); + SyncHandle(); + return (list); + } + diff --git a/src/XGetVers.c b/src/XGetVers.c new file mode 100644 index 0000000..dba03d8 --- /dev/null +++ b/src/XGetVers.c @@ -0,0 +1,108 @@ +/* $Xorg: XGetVers.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetExtensionVersion - Get the version of the input extension. + * + */ + +#include "XIproto.h" +#include "Xlibint.h" +#include "XI.h" +#include "XInput.h" +#include "extutil.h" + +XExtensionVersion +#if NeedFunctionPrototypes +*XGetExtensionVersion ( + register Display *dpy, + _Xconst char *name) +#else +*XGetExtensionVersion (dpy, name) + register Display *dpy; + char *name; +#endif + { + xGetExtensionVersionReq *req; + xGetExtensionVersionReply rep; + XExtensionVersion *ext; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, Dont_Check) == -1) + return ((XExtensionVersion *) NoSuchExtension); + + GetReq(GetExtensionVersion,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetExtensionVersion; + req->nbytes = name ? strlen(name) : 0; + req->length += (unsigned)(req->nbytes+3)>>2; + _XSend(dpy, name, (long)req->nbytes); + + if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XExtensionVersion *) NULL; + } + ext = (XExtensionVersion *) Xmalloc (sizeof (XExtensionVersion)); + if (ext) + { + ext->present = rep.present; + if (ext->present) + { + ext->major_version = rep.major_version; + ext->minor_version = rep.minor_version; + } + } + UnlockDisplay(dpy); + SyncHandle(); + return (ext); + } + diff --git a/src/XGrDvBut.c b/src/XGrDvBut.c new file mode 100644 index 0000000..fc6b400 --- /dev/null +++ b/src/XGrDvBut.c @@ -0,0 +1,112 @@ +/* $Xorg: XGrDvBut.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGrabDeviceBut - Grab a button on an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XGrabDeviceButton (dpy, dev, button, modifiers, modifier_device, + grab_window, owner_events, event_count, event_list, this_device_mode, + other_devices_mode) + register Display *dpy; + XDevice *dev; + unsigned int button; /* CARD8 */ + unsigned int modifiers; /* CARD16 */ + XDevice *modifier_device; + Window grab_window; + Bool owner_events; + unsigned int event_count; + XEventClass *event_list; + int this_device_mode; + int other_devices_mode; + { + register xGrabDeviceButtonReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(GrabDeviceButton, req); + + req->reqType = info->codes->major_opcode; + req->ReqType = X_GrabDeviceButton; + req->grabbed_device = dev->device_id; + req->button = button; + req->modifiers = modifiers; + if (modifier_device) + req->modifier_device = modifier_device->device_id; + else + req->modifier_device = UseXKeyboard; + req->grabWindow = grab_window; + req->ownerEvents = owner_events; + req->event_count = event_count; + req->this_device_mode = this_device_mode; + req->other_devices_mode = other_devices_mode; + req->length += event_count; + + /* note: Data is a macro that uses its arguments multiple + times, so "nvalues" is changed in a separate assignment + statement */ + + event_count <<= 2; + Data32 (dpy, (long *) event_list, event_count); + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } diff --git a/src/XGrDvKey.c b/src/XGrDvKey.c new file mode 100644 index 0000000..e17d55f --- /dev/null +++ b/src/XGrDvKey.c @@ -0,0 +1,115 @@ +/* $Xorg: XGrDvKey.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGrabDeviceKey - Grab a key on an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XGrabDeviceKey (dpy, dev, key, modifiers, modifier_device, + grab_window, owner_events, event_count, event_list, this_device_mode, + other_devices_mode) + register Display *dpy; + XDevice *dev; + unsigned int key; /* CARD8 */ + unsigned int modifiers; /* CARD16 */ + XDevice *modifier_device; + Window grab_window; + Bool owner_events; + unsigned int event_count; + XEventClass *event_list; + int this_device_mode; + int other_devices_mode; + { + register xGrabDeviceKeyReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(GrabDeviceKey, req); + + req->reqType = info->codes->major_opcode; + req->ReqType = X_GrabDeviceKey; + req->grabbed_device = dev->device_id; + req->key = key; + req->modifiers = modifiers; + if (modifier_device) + req->modifier_device = modifier_device->device_id; + else + req->modifier_device = UseXKeyboard; + req->grabWindow = grab_window; + req->ownerEvents = owner_events; + req->event_count = event_count; + req->this_device_mode = this_device_mode; + req->other_devices_mode = other_devices_mode; + req->length += event_count; + + /* note: Data is a macro that uses its arguments multiple + times, so "nvalues" is changed in a separate assignment + statement */ + + if (event_count) + { + event_count <<= 2; + Data32 (dpy, (long *) event_list, event_count); + } + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } diff --git a/src/XGrabDev.c b/src/XGrabDev.c new file mode 100644 index 0000000..6f5ee02 --- /dev/null +++ b/src/XGrabDev.c @@ -0,0 +1,107 @@ +/* $Xorg: XGrabDev.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGrabDevice - grab an extension input device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XGrabDevice (dpy, dev, grab_window, ownerEvents, event_count, event_list, + this_device_mode, other_devices_mode, time) + register Display *dpy; + XDevice *dev; + Window grab_window; + Bool ownerEvents; + int event_count; + XEventClass *event_list; + int this_device_mode; + int other_devices_mode; + Time time; + { + xGrabDeviceReply rep; + register xGrabDeviceReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(GrabDevice,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_GrabDevice; + + req->deviceid = dev->device_id; + req->grabWindow = grab_window; + req->ownerEvents = ownerEvents; + req->event_count = event_count; + req->this_device_mode = this_device_mode; + req->other_devices_mode = other_devices_mode; + req->time = time; + req->length += event_count; + + /* note: Data is a macro that uses its arguments multiple + times, so "nvalues" is changed in a separate assignment + statement */ + + event_count <<= 2; + Data32 (dpy, (long *) event_list, event_count); + + if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) + rep.status = GrabSuccess; + UnlockDisplay(dpy); + SyncHandle(); + return (rep.status); + } diff --git a/src/XGtFocus.c b/src/XGtFocus.c new file mode 100644 index 0000000..b4a00eb --- /dev/null +++ b/src/XGtFocus.c @@ -0,0 +1,90 @@ +/* $Xorg: XGtFocus.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetDeviceFocus - Get the focus of an input device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XGetDeviceFocus (dpy, dev, focus, revert_to, time) + register Display *dpy; + XDevice *dev; + Window *focus; + int *revert_to; + Time *time; + { + xGetDeviceFocusReq *req; + xGetDeviceFocusReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(GetDeviceFocus,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetDeviceFocus; + req->deviceid = dev->device_id; + + (void) _XReply (dpy, (xReply *) &rep, 0, xTrue); + *focus = rep.focus; + *revert_to = rep.revertTo; + *time = rep.time; + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } + diff --git a/src/XGtSelect.c b/src/XGtSelect.c new file mode 100644 index 0000000..2d76a4f --- /dev/null +++ b/src/XGtSelect.c @@ -0,0 +1,144 @@ +/* $Xorg: XGtSelect.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XGetSelectedExtensionEvents - return a list of currently selected events. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XGetSelectedExtensionEvents (dpy, w, this_client_count, this_client_list, + all_clients_count, all_clients_list) + register Display *dpy; + Window w; + int *this_client_count; + XEventClass **this_client_list; + int *all_clients_count; + XEventClass **all_clients_list; + { + int tlen, alen; + register xGetSelectedExtensionEventsReq *req; + xGetSelectedExtensionEventsReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + GetReq(GetSelectedExtensionEvents,req); + + req->reqType = info->codes->major_opcode; + req->ReqType = X_GetSelectedExtensionEvents; + req->window = w; + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return Success; + } + + *this_client_count = rep.this_client_count; + *all_clients_count = rep.all_clients_count; + + if (rep.length) + { + int i; + CARD32 ec; + tlen = (*this_client_count) * sizeof(CARD32); + alen = (rep.length << 2) - tlen; + + if (tlen) + { + *this_client_list = (XEventClass *) Xmalloc ( + *this_client_count * sizeof(XEventClass)); + if (!*this_client_list) + { + _XEatData (dpy, (unsigned long) tlen+alen); + return (Success); + } + for (i = 0; i < *this_client_count; i++) + { + _XRead (dpy, (char *)(&ec), sizeof(CARD32)); + (*this_client_list)[i] = (XEventClass)ec; + } + } + else + *this_client_list = (XEventClass *) NULL; + if (alen) + { + *all_clients_list = (XEventClass *) Xmalloc ( + *all_clients_count * sizeof(XEventClass)); + if (!*all_clients_list) + { + Xfree((char *)*this_client_list); + *this_client_list = NULL; + _XEatData (dpy, (unsigned long) alen); + return (Success); + } + for (i = 0; i < *all_clients_count; i++) + { + _XRead (dpy, (char *)(&ec), sizeof(CARD32)); + (*all_clients_list)[i] = (XEventClass)ec; + } + } + else + *all_clients_list = (XEventClass *) NULL; + + } + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } diff --git a/src/XListDev.c b/src/XListDev.c new file mode 100644 index 0000000..714e0c4 --- /dev/null +++ b/src/XListDev.c @@ -0,0 +1,257 @@ +/* $Xorg: XListDev.c,v 1.5 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XListInputDevices - Request the server to return a list of + * available input devices. + * + */ + +#define NEED_REPLIES +#define NEED_EVENTS +#include "Xlibint.h" +#include "XIproto.h" +#include "XI.h" +#include "XInput.h" +#include "extutil.h" + +XDeviceInfo +*XListInputDevices(dpy, ndevices) + register Display *dpy; + int *ndevices; + { + int size; + xListInputDevicesReq *req; + xListInputDevicesReply rep; + xDeviceInfo *list, *slist; + XDeviceInfo *sclist; + XDeviceInfo *clist = NULL; + xAnyClassPtr any, sav_any; + XAnyClassPtr Any; + char *nptr, *Nptr; + register int i,j,k; + register long rlen; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return ((XDeviceInfo *) NULL); + + GetReq(ListInputDevices,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_ListInputDevices; + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XDeviceInfo *) NULL; + } + + if ((*ndevices = rep.ndevices)) /* at least 1 input device */ + { + size = *ndevices * sizeof (XDeviceInfo); + rlen = rep.length << 2; /* multiply length by 4 */ + list = (xDeviceInfo *) Xmalloc (rlen); + slist = list; + if (!slist) + { + _XEatData (dpy, (unsigned long) rlen); + UnlockDisplay(dpy); + SyncHandle(); + return (XDeviceInfo *) NULL; + } + _XRead (dpy, (char *)list, rlen); + + any = (xAnyClassPtr) ((char *) list + + (*ndevices * sizeof(xDeviceInfo))); + sav_any = any; + for (i=0; i<*ndevices; i++, list++) + { + for (j=0; j<(int)list->num_classes; j++) + { + switch (any->class) + { + case KeyClass: + size += sizeof (XKeyInfo); + break; + case ButtonClass: + size += sizeof (XButtonInfo); + break; + case ValuatorClass: + { + xValuatorInfoPtr v; + v = (xValuatorInfoPtr) any; + size += sizeof (XValuatorInfo) + + (v->num_axes * sizeof (XAxisInfo)); + break; + } + default: + break; + } + any = (xAnyClassPtr) ((char *) any + any->length); + } + } + + for (i=0, nptr = (char *) any; i<*ndevices; i++) + { + size += *nptr +1; + nptr += (*nptr + 1); + } + + clist = (XDeviceInfoPtr) Xmalloc (size); + if (!clist) + { + XFree ((char *)slist); + UnlockDisplay(dpy); + SyncHandle(); + return (XDeviceInfo *) NULL; + } + sclist = clist; + Any = (XAnyClassPtr) ((char *) clist + + (*ndevices * sizeof (XDeviceInfo))); + list = slist; + any = sav_any; + for (i=0; i<*ndevices; i++, list++, clist++) + { + clist->type = list->type; + clist->id = list->id; + clist->use = list->use; + clist->num_classes = list->num_classes; + clist->inputclassinfo = Any; + for (j=0; j<(int)list->num_classes; j++) + { + switch (any->class) + { + case KeyClass: + { + XKeyInfoPtr K = (XKeyInfoPtr) Any; + xKeyInfoPtr k = (xKeyInfoPtr) any; + K->class = KeyClass; + K->length = sizeof (XKeyInfo); + K->min_keycode = k->min_keycode; + K->max_keycode = k->max_keycode; + K->num_keys = k->num_keys; + break; + } + case ButtonClass: + { + XButtonInfoPtr B = (XButtonInfoPtr) Any; + xButtonInfoPtr b = (xButtonInfoPtr) any; + B->class = ButtonClass; + B->length = sizeof (XButtonInfo); + B->num_buttons = b->num_buttons; + break; + } + case ValuatorClass: + { + XValuatorInfoPtr V = (XValuatorInfoPtr) Any; + xValuatorInfoPtr v = (xValuatorInfoPtr) any; + XAxisInfoPtr A; + xAxisInfoPtr a; + + V->class = ValuatorClass; + V->length = sizeof (XValuatorInfo) + + (v->num_axes * sizeof (XAxisInfo)); + V->num_axes = v->num_axes; + V->motion_buffer = v->motion_buffer_size; + V->mode = v->mode; + A = (XAxisInfoPtr) ((char *) V + sizeof(XValuatorInfo)); + V->axes = A; + a = (xAxisInfoPtr) ((char *) any + + sizeof (xValuatorInfo)); + for (k=0; k<(int)v->num_axes; k++,a++,A++) + { + A->min_value = a->min_value; + A->max_value = a->max_value; + A->resolution = a->resolution; + } + break; + } + default: + break; + } + any = (xAnyClassPtr) ((char *) any + any->length); + Any = (XAnyClassPtr) ((char *) Any + Any->length); + } + } + + clist = sclist; + nptr = (char *) any; + Nptr = (char *) Any; + for (i=0; i<*ndevices; i++,clist++) + { + clist->name = (char *) Nptr; + memcpy (Nptr, nptr+1, *nptr); + Nptr += (*nptr); + *Nptr++ = '\0'; + nptr += (*nptr + 1); + } + } + + XFree ((char *)slist); + UnlockDisplay(dpy); + SyncHandle(); + return (sclist); + } + +/*********************************************************************** + * + * Free the list of input devices. + * + */ + +void XFreeDeviceList (list) + XDeviceInfo *list; + { + if (list != NULL) + { + XFree ((char *) list); + } + } diff --git a/src/XOpenDev.c b/src/XOpenDev.c new file mode 100644 index 0000000..ed1ffe1 --- /dev/null +++ b/src/XOpenDev.c @@ -0,0 +1,111 @@ +/* $Xorg: XOpenDev.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XOpenDevice - Request the server to open and extension input device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +XDevice +*XOpenDevice(dpy, id) + register Display *dpy; + register XID id; + { + register long rlen; /* raw length */ + xOpenDeviceReq *req; + xOpenDeviceReply rep; + XDevice *dev; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return ((XDevice *) NoSuchExtension); + + GetReq(OpenDevice,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_OpenDevice; + req->deviceid = id; + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XDevice *) NULL; + } + + rlen = rep.length << 2; + dev = (XDevice *) Xmalloc (sizeof(XDevice) + rep.num_classes * + sizeof (XInputClassInfo)); + if (dev) + { + int dlen; /* data length */ + + dev->device_id = req->deviceid; + dev->num_classes = rep.num_classes; + dev->classes = (XInputClassInfo *) ((char *) dev + sizeof (XDevice)); + dlen = rep.num_classes * sizeof(xInputClassInfo); + _XRead (dpy, (char *)dev->classes, dlen); + /* could be padding that we still need to eat (yummy!) */ + if(rlen - dlen > 0) + _XEatData (dpy, (unsigned long) rlen - dlen); + } + else + _XEatData (dpy, (unsigned long) rlen); + + UnlockDisplay (dpy); + SyncHandle(); + return (dev); + } + diff --git a/src/XQueryDv.c b/src/XQueryDv.c new file mode 100644 index 0000000..e9b3be7 --- /dev/null +++ b/src/XQueryDv.c @@ -0,0 +1,196 @@ +/* $Xorg: XQueryDv.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XQueryDeviceState - Query the state of an extension input device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +XDeviceState +*XQueryDeviceState (dpy, dev) + register Display *dpy; + XDevice *dev; + { + int i,j; + int rlen; + int size = 0; + xQueryDeviceStateReq *req; + xQueryDeviceStateReply rep; + XDeviceState *state = NULL; + XInputClass *any, *Any; + char *data; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return ((XDeviceState *) NoSuchExtension); + + GetReq(QueryDeviceState,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_QueryDeviceState; + req->deviceid = dev->device_id; + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return (XDeviceState *) NULL; + } + + rlen = rep.length << 2; + if (rlen > 0) + { + data = Xmalloc (rlen); + if (!data) + { + _XEatData (dpy, (unsigned long) rlen); + UnlockDisplay(dpy); + SyncHandle(); + return ((XDeviceState *) NULL); + } + _XRead (dpy, data, rlen); + + for (i=0, any=(XInputClass *) data; i<(int)rep.num_classes; i++) + { + switch (any->class) + { + case KeyClass: + size += sizeof (XKeyState); + break; + case ButtonClass: + size += sizeof (XButtonState); + break; + case ValuatorClass: + { + xValuatorState *v = (xValuatorState *) any; + size += (sizeof (XValuatorState) + + (v->num_valuators * sizeof(int))); + } + break; + } + any = (XInputClass *) ((char *) any + any->length); + } + state = (XDeviceState *) Xmalloc (size + sizeof(XDeviceState)); + if (!state) + { + UnlockDisplay(dpy); + SyncHandle(); + return ((XDeviceState *) NULL); + } + state->device_id = dev->device_id; + state->num_classes = rep.num_classes; + state->data = (XInputClass *) (state + 1); + + Any = state->data; + for (i=0, any=(XInputClass *) data; i<(int)rep.num_classes; i++) + { + switch (any->class) + { + case KeyClass: + { + xKeyState *k = (xKeyState *) any; + XKeyState *K = (XKeyState *) Any; + K->class = k->class; + K->length = sizeof (XKeyState); + K->num_keys = k->num_keys; + memcpy ((char *) &K->keys[0], (char *) &k->keys[0], 32); + Any = (XInputClass *) (K+1); + } + break; + case ButtonClass: + { + xButtonState *b = (xButtonState *) any; + XButtonState *B = (XButtonState *) Any; + B->class = b->class; + B->length = sizeof (XButtonState); + B->num_buttons = b->num_buttons; + memcpy ((char *) &B->buttons[0], (char *) &b->buttons[0], + 32); + Any = (XInputClass *) (B+1); + } + break; + case ValuatorClass: + { + xValuatorState *v = (xValuatorState *) any; + XValuatorState *V = (XValuatorState *) Any; + CARD32 *valuators = (CARD32 *) (v+1); + V->class = v->class; + V->length = sizeof (XValuatorState); + V->num_valuators = v->num_valuators; + V->mode = v->mode; + Any = (XInputClass *) (V+1); + V->valuators = (int *) Any; + for (j=0; j<(int)V->num_valuators; j++) + *(V->valuators + j) = *valuators++; + Any = (XInputClass *)((char *) Any + + V->num_valuators * sizeof (int)); + } + break; + } + any = (XInputClass *) ((char *) any + any->length); + } + Xfree(data); + } + + UnlockDisplay(dpy); + SyncHandle(); + return (state); + } + +void XFreeDeviceState (list) + XDeviceState *list; + { + XFree ((char *)list); + } diff --git a/src/XSelect.c b/src/XSelect.c new file mode 100644 index 0000000..09ea2b4 --- /dev/null +++ b/src/XSelect.c @@ -0,0 +1,92 @@ +/* $Xorg: XSelect.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XSelectExtensionEvent - Select input from an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XSelectExtensionEvent (dpy, w, event_list, count) + register Display *dpy; + Window w; + XEventClass *event_list; + int count; + { + register xSelectExtensionEventReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy,XInput_Initial_Release) == -1) + return (NoSuchExtension); + GetReq(SelectExtensionEvent,req); + + req->reqType = info->codes->major_opcode; + req->ReqType = X_SelectExtensionEvent; + req->window = w; + req->count = count; + req->length += count; + + /* note: Data is a macro that uses its arguments multiple + times, so "nvalues" is changed in a separate assignment + statement */ + + count <<= 2; + Data (dpy, (char *) event_list, count); + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } diff --git a/src/XSetBMap.c b/src/XSetBMap.c new file mode 100644 index 0000000..29fc22e --- /dev/null +++ b/src/XSetBMap.c @@ -0,0 +1,91 @@ +/* $Xorg: XSetBMap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XSetDeviceButtonMapping - Set the button mapping of an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" +#define NEED_REPLIES + +/* returns either DeviceMappingSuccess or DeviceMappingBusy */ + +int +XSetDeviceButtonMapping (dpy, device, map, nmap) + register Display *dpy; + XDevice *device; + unsigned char map[]; + int nmap; + { + register xSetDeviceButtonMappingReq *req; + xSetDeviceButtonMappingReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay(dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + GetReq (SetDeviceButtonMapping, req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_SetDeviceButtonMapping; + req->map_length = nmap; + req->length += (nmap + 3)>>2; + req->deviceid = device->device_id; + + Data (dpy, (char *)map, (long) nmap); /* note that map is char[] */ + if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0) /* suppress error */ + rep.status = MappingSuccess; + UnlockDisplay(dpy); + SyncHandle(); + return ((int) rep.status); + } diff --git a/src/XSetDVal.c b/src/XSetDVal.c new file mode 100644 index 0000000..55e9bff --- /dev/null +++ b/src/XSetDVal.c @@ -0,0 +1,98 @@ +/* $Xorg: XSetDVal.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XSetDeviceValuators - Set the value of valuators on an extension input + * device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XSetDeviceValuators (dpy, dev, valuators, first_valuator, num_valuators) + register Display *dpy; + XDevice *dev; + int *valuators; + int first_valuator; + int num_valuators; + { + xSetDeviceValuatorsReq *req; + xSetDeviceValuatorsReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Add_XSetDeviceValuators) == -1) + return (NoSuchExtension); + + GetReq(SetDeviceValuators,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_SetDeviceValuators; + req->deviceid = dev->device_id; + req->first_valuator = first_valuator; + req->num_valuators = num_valuators; + req->length += num_valuators; + + /* note: Data is a macro that uses its arguments multiple + times, so "nvalues" is changed in a separate assignment + statement */ + + num_valuators <<= 2; + Data (dpy, (char *) valuators, num_valuators); + + (void) _XReply (dpy, (xReply *) &rep, 0, xTrue); + UnlockDisplay(dpy); + SyncHandle(); + return (rep.status); + } + diff --git a/src/XSetMMap.c b/src/XSetMMap.c new file mode 100644 index 0000000..a6a97d7 --- /dev/null +++ b/src/XSetMMap.c @@ -0,0 +1,89 @@ +/* $Xorg: XSetMMap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XSetDeviceModifierMapping - set the modifier map of an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XSetDeviceModifierMapping (dpy, dev, modmap) + register Display *dpy; + XDevice *dev; + XModifierKeymap *modmap; + { + int mapSize = modmap->max_keypermod << 3; /* 8 modifiers */ + xSetDeviceModifierMappingReq *req; + xSetDeviceModifierMappingReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReqExtra(SetDeviceModifierMapping, mapSize, req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_SetDeviceModifierMapping; + req->deviceid = dev->device_id; + req->numKeyPerModifier = modmap->max_keypermod; + memcpy((char *)&req[1], modmap->modifiermap, mapSize); + + (void) _XReply(dpy, (xReply *) &rep, + (sizeof(xSetDeviceModifierMappingReply) - sizeof(xReply)) >> 2, xTrue); + + UnlockDisplay(dpy); + SyncHandle(); + return (rep.success); + } diff --git a/src/XSetMode.c b/src/XSetMode.c new file mode 100644 index 0000000..8ec69cb --- /dev/null +++ b/src/XSetMode.c @@ -0,0 +1,86 @@ +/* $Xorg: XSetMode.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XSetDeviceMode - Set the mode of an extension input device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XSetDeviceMode (dpy, dev, mode) + register Display *dpy; + XDevice *dev; + int mode; + { + xSetDeviceModeReq *req; + xSetDeviceModeReply rep; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(SetDeviceMode,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_SetDeviceMode; + req->deviceid = dev->device_id; + req->mode = mode; + + (void) _XReply (dpy, (xReply *) &rep, 0, xTrue); + UnlockDisplay(dpy); + SyncHandle(); + return (rep.status); + } + diff --git a/src/XSndExEv.c b/src/XSndExEv.c new file mode 100644 index 0000000..78642a5 --- /dev/null +++ b/src/XSndExEv.c @@ -0,0 +1,121 @@ +/* $Xorg: XSndExEv.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XSendExtensionEvent - send an extension event to a client. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +extern Status _XiEventToWire(); + +Status +XSendExtensionEvent (dpy, dev, dest, prop, count, list, event) + register Display *dpy; + XDevice *dev; + Window dest; + Bool prop; + int count; + XEventClass *list; + XEvent *event; + { + int num_events; + int ev_size; + xSendExtensionEventReq *req; + xEvent *ev; + register Status (**fp)(); + Status status; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + /* call through display to find proper conversion routine */ + + fp = &dpy->wire_vec[event->type & 0177]; + if (*fp == NULL) + *fp = _XiEventToWire; + status = (**fp)(dpy, event, &ev, &num_events); + + if (status) + { + GetReq(SendExtensionEvent,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_SendExtensionEvent; + req->deviceid = dev->device_id; + req->destination = dest; + req->propagate = prop; + req->count = count; + req->num_events = num_events; + ev_size = num_events * sizeof (xEvent); + req->length += (count + (ev_size >> 2)); + + /* note: Data is a macro that uses its arguments multiple + times, so "count" is changed in a separate assignment + statement. Any extra events must be sent before the event + list, in order to ensure quad alignment. */ + + Data (dpy, (char *) ev, ev_size); + + count <<= 2; + Data32 (dpy, (long *) list, count); + XFree ((char *)ev); + } + + UnlockDisplay(dpy); + SyncHandle(); + return (status); + } + diff --git a/src/XStFocus.c b/src/XStFocus.c new file mode 100644 index 0000000..e59f3b5 --- /dev/null +++ b/src/XStFocus.c @@ -0,0 +1,85 @@ +/* $Xorg: XStFocus.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XSetDeviceFocus - Set the focus of an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XSetDeviceFocus(dpy, dev, focus, revert_to, time) + register Display *dpy; + XDevice *dev; + Window focus; + int revert_to; + Time time; + { + xSetDeviceFocusReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + + GetReq(SetDeviceFocus,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_SetDeviceFocus; + req->device = dev->device_id; + req->focus = focus; + req->revertTo = revert_to; + req->time = time; + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } diff --git a/src/XUngrDev.c b/src/XUngrDev.c new file mode 100644 index 0000000..a241fba --- /dev/null +++ b/src/XUngrDev.c @@ -0,0 +1,84 @@ +/* $Xorg: XUngrDev.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XUngrabDevice - Ungrab an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XUngrabDevice (dpy, dev, time) + register Display *dpy; + XDevice *dev; + Time time; + { + register xUngrabDeviceReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + + GetReq(UngrabDevice,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_UngrabDevice; + + req->deviceid = dev->device_id; + req->time = time; + + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } diff --git a/src/XUngrDvB.c b/src/XUngrDvB.c new file mode 100644 index 0000000..03b7eb1 --- /dev/null +++ b/src/XUngrDvB.c @@ -0,0 +1,91 @@ +/* $Xorg: XUngrDvB.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XUngrabDeviceButton - Ungrab a button on an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XUngrabDeviceButton(dpy, dev, button, modifiers, modifier_dev, grab_window) + register Display *dpy; + XDevice *dev; + unsigned int button; /* CARD8 */ + unsigned int modifiers; /* CARD16 */ + XDevice *modifier_dev; + Window grab_window; + { + register xUngrabDeviceButtonReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay(dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + GetReq(UngrabDeviceButton, req); + + req->reqType = info->codes->major_opcode; + req->ReqType = X_UngrabDeviceButton; + req->grabbed_device = dev->device_id; + req->button = button; + req->modifiers = modifiers; + if (modifier_dev) + req->modifier_device = modifier_dev->device_id; + else + req->modifier_device = UseXKeyboard; + req->grabWindow = grab_window; + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } diff --git a/src/XUngrDvK.c b/src/XUngrDvK.c new file mode 100644 index 0000000..9c9cfb3 --- /dev/null +++ b/src/XUngrDvK.c @@ -0,0 +1,91 @@ +/* $Xorg: XUngrDvK.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ + +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/*********************************************************************** + * + * XUngrabDeviceKey - Ungrab a key on an extension device. + * + */ + +#include "XI.h" +#include "XIproto.h" +#include "Xlibint.h" +#include "XInput.h" +#include "extutil.h" + +int +XUngrabDeviceKey (dpy, dev, key, modifiers, modifier_dev, grab_window) + register Display *dpy; + XDevice *dev; + unsigned int key; /* CARD8 */ + unsigned int modifiers; /* CARD16 */ + XDevice *modifier_dev; + Window grab_window; + { + register xUngrabDeviceKeyReq *req; + XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy); + + LockDisplay(dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1) + return (NoSuchExtension); + GetReq(UngrabDeviceKey, req); + + req->reqType = info->codes->major_opcode; + req->ReqType = X_UngrabDeviceKey; + req->grabbed_device = dev->device_id; + req->key = key; + req->modifiers = modifiers; + if (modifier_dev) + req->modifier_device = modifier_dev->device_id; + else + req->modifier_device = UseXKeyboard; + req->grabWindow = grab_window; + UnlockDisplay(dpy); + SyncHandle(); + return (Success); + } |