home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / extensions / xinput / library.ms < prev    next >
Encoding:
Text File  |  1991-07-28  |  150.7 KB  |  4,736 lines

  1. .\" Input Extension
  2. .EH ''''
  3. .OH ''''
  4. .EF ''''
  5. .OF ''''
  6. .ps 11
  7. .nr PS 11
  8. \0
  9. .sp 10
  10. .ce 500
  11. .ps 20
  12. \fBX11 Input Extension Library Specification
  13. .ps 12
  14. .sp 2
  15. MIT X Consortium Standard
  16. .sp 1
  17. X Version 11, Release 5
  18. .sp 16
  19. .ps 15
  20. \fBMark Patrick\0\0\0\0Ardent Computer
  21. .sp 1
  22. \fBGeorge Sachs\0\0\0\0Hewlett-Packard
  23. .ps 12
  24. .ce 0
  25. .bp
  26. \0
  27. .sp 34 
  28. .fi
  29. \fB\s14\&Notice\fR\s9
  30. .vs 11
  31. .LP
  32. Copyright \(co 1989, 1990, 1991 by Hewlett-Packard Company, Ardent Computer, 
  33. and the Massachusetts Institute of Technology.
  34. .LP
  35. Permission to use, copy, modify, and distribute this documentation for
  36. any purpose and without fee is hereby granted, provided that the above
  37. copyright notice and this permission notice appear in all copies.
  38. MIT, Ardent, and Hewlett-Packard make no representations about the suitability 
  39. for any purpose of the information in this document.  It is provided ``as is''
  40. without express or implied warranty.
  41. .ps
  42. .vs
  43. .bp 1
  44. .EH '\fBX Input Extension Library Specification\fP''\fBX11, Release 5\fP'
  45. .OH '\fBX Input Extension Library Specification\fP''\fBX11, Release 5\fP'
  46. .EF ''\fB % \fP''
  47. .OF ''\fB % \fP''
  48. .\"  Force the heading counter for level 1 to one
  49. .\"
  50. .\"
  51. .\"
  52. .\"  Print table of contents to level 4 headings
  53. .\"
  54. .\"
  55. .\"  Page eject for each level 1 heading
  56. .\"
  57. .\"
  58. .\"  Define Ch to contain the chapter string.
  59. .\"
  60. .ds Ch Input Extension Overview
  61. .\"
  62. .\"
  63. .\"  Pull in the layout macro package.
  64. .\"
  65. .\"
  66. .tr ~
  67. .NH 1
  68. Input Extension Overview
  69. .XS
  70. \*(SN Input Extension Overview
  71. .XE
  72. .LP
  73. This document describes an extension to
  74. the X11 server.  The purpose of this extension is to support the use
  75. of additional input devices beyond the pointer and keyboard devices
  76. defined by the core X protocol.  This first section gives an overview
  77. of the input extension.  The following sections correspond to 
  78. chapters 7 and 8, "Window Manager functions" and 
  79. "Events and Event-Handling Functions" of the "Xlib - C Language Interface"
  80. manual and describe how to use the input extension.
  81. .NH 2
  82. Design Approach
  83. .XS
  84. \*(SN Design Approach
  85. .XE
  86. .LP
  87. The design approach of the extension is to define functions
  88. and events analogous to the core functions and events. This allows
  89. extension input devices and events to be individually distinguishable from each other 
  90. and from the core input devices and events .  These functions and events make use
  91. of a device identifier and support the
  92. reporting of n-dimensional motion data as well as other data that
  93. is not currently reportable via the core input events.
  94. .NH 2
  95. Core Input Devices
  96. .XS
  97. \*(SN Core Input Devices
  98. .XE
  99. .LP
  100. The X server core protocol supports two input devices:  a pointer and a
  101. keyboard.  The pointer device has two major functions. 
  102. First, it may be used to generate motion information
  103. that client programs can detect. Second, it may also be used to indicate the
  104. current location and focus of the X keyboard.  To accomplish this, the server 
  105. echoes a cursor at the current position of the X pointer.  Unless the X
  106. keyboard has been explicitly focused, this cursor also shows the current
  107. location and focus of the X keyboard.
  108. .LP
  109. The X keyboard is used to generate input that client programs can detect.
  110. .LP
  111. The X keyboard and X pointer are referred to in this document as 
  112. the \fIcore devices\fP, and the input
  113. events they generate (\fBKeyPress\fP, \fBKeyRelease\fP, \fBButtonPress\fP, 
  114. \fBButtonRelease\fP, and
  115. \fBMotionNotify\fP) are known as the \fIcore input events\fP.  All other
  116. input devices are referred to as \fIextension input devices\fP and the 
  117. input events they generate are referred to as \fIextension input events\fP.
  118. .NT
  119. This input extension does not change the behavior or functionality of the
  120. core input devices, core events, or core protocol requests, with the
  121. exception of the core grab requests.  These requests may affect the
  122. synchronization of events from extension devices.  See the explanation
  123. in the section titled "Event Synchronization and Core Grabs".
  124. .NE
  125. .LP
  126. Selection of the physical devices to be initially used by the server as the 
  127. core devices is left implementation-dependent.  Functions are defined that
  128. allow client programs to change which physical devices are used as the
  129. core devices.
  130. .NH 2
  131. Extension Input Devices
  132. .XS
  133. \*(SN Extension Input Devices
  134. .XE
  135. .LP
  136. The input extension controls access to input devices other than the X keyboard
  137. and X pointer.  It allows client programs to select input from these devices 
  138. independently
  139. from each other and independently from the core devices.  Input events from
  140. these devices are of extension types (\fBDeviceKeyPress\fP, 
  141. \fBDeviceKeyRelease\fP,
  142. \fBDeviceButtonPress\fP, \fBDeviceButtonRelease\fP, \fBDeviceMotionNotify\fP, 
  143. etc.) and contain
  144. a device identifier so that events of the same type coming from different
  145. input devices can be distinguished.
  146. .LP
  147. Extension input events are not limited in size by the size of the server
  148. 32-byte wire events.  Extension input events
  149. may be constructed by the server sending as many
  150. wire sized events as necessary to return the information required for
  151. that event.
  152. The library event reformatting routines
  153. are responsible for combining these into one or more client XEvents.
  154. .LP
  155. Any input device that generates key, button or motion data may be used as
  156. an extension input device.
  157. Extension input devices may have 0 or more keys, 0 or more buttons,
  158. and may report 0 or more axes of motion.  Motion may be reported 
  159. as relative movements from a previous position or as an absolute
  160. position.  All valuators reporting motion information for a given
  161. extension input device must report the same kind of motion information
  162. (absolute or relative).
  163. .LP
  164. This extension is designed to accommodate new types of input devices that
  165. may be added in the future.  The protocol requests that refer to
  166. specific characteristics of input devices organize that information
  167. by \fBinput device classes\fP.  Server implementors may add new
  168. classes of input devices without changing the protocol requests.
  169. .LP
  170. All extension input
  171. devices are treated like the core X keyboard in determining their location
  172. and focus.  The server does not track the location of these devices on an
  173. individual basis, and therefore
  174. does not echo a cursor to indicate their current location.
  175. Instead, their location is determined by the location of the core X pointer.
  176. Like the core X keyboard, some may be explicitly focused. If they are
  177. not explicitly focused,  their focus
  178. is determined by the location of the core X pointer.
  179. .NH 3
  180. Input Device Classes
  181. .XS
  182. \*(SN Input Device Classes
  183. .XE
  184. .LP
  185. Some of the input extension requests divide input devices into classes
  186. based on their functionality.  This is intended to allow new classes of input
  187. devices to be defined at a later time without changing the semantics of 
  188. these functions.  The following input device classes are currently
  189. defined:
  190. .RS
  191. .in +10n
  192. .IP "\fBKEY\fP"
  193. The device reports key events.
  194. .IP "\fBBUTTON\fP"
  195. The device reports button events.
  196. .IP "\fBVALUATOR\fP"
  197. The device reports valuator data in motion events.
  198. .IP "\fBPROXIMITY\fP"
  199. The device reports proximity events.
  200. .IP "\fBFOCUS\fP"
  201. The device can be focused.
  202. .IP "\fBFEEDBACK\fP"
  203. The device supports feedbacks.
  204. .in -10n
  205. .RE
  206. .LP
  207. Additional classes may be added in the future.
  208. Functions that support multiple input classes, such as the 
  209. \fBXListInputDevices\fP function that lists all available input devices,
  210. organize the data they return by input class.  Client programs that
  211. use these functions should not access data unless it matches a 
  212. class defined at the time those clients were compiled.  In this way,
  213. new classes can be added without forcing existing clients that use
  214. these functions to be recompiled.
  215. .NH 2
  216. Using Extension Input Devices
  217. .XS
  218. \*(SN Using Extension Input Devices
  219. .XE
  220. .LP
  221. A client that wishes to access an input device does so through the library
  222. functions defined in the following sections.  A typical sequence of requests
  223. that a client would make is as follows:
  224. .IP \(bu 3n
  225. XListInputDevices - list all of the available input devices.  From the 
  226. information returned by this request, determine whether the desired input
  227. device is attached to the server.  For a description of the 
  228. \fBXListInputDevices\fP request, see the section entitled
  229. "Listing Available Devices".
  230. .IP \(bu 3n
  231. XOpenDevice -  request that the server open the device for access by this
  232. client.  This request returns an \fBXDevice\fP structure that is used
  233. by most other input extension requests to identify the specified device.
  234. For a description of the \fBXOpenDevice\fP request, see the section
  235. entitled "Enabling and Disabling Extension Devices".
  236. .IP \(bu 3n
  237. Determine the event types and event clases needed to select the desired
  238. input extension events, and identify them when they are received.
  239. This is done via macros whose name corresponds to the desired event,
  240. i.e. \fBDeviceKeyPress\fP.  For a description of these macros, see the 
  241. section entitled "Selecting Extension Device Events".
  242. .IP \(bu 3n
  243. XSelectExtensionEvent - select the desired events from the server.
  244. For a description of the \fBXSelextExtensionEvent\fP request, see the 
  245. section entitled "Selecting Extension Device Events".
  246. .IP \(bu 3n
  247. XNextEvent - receive the next available event.  This is the core
  248. \fBXNextEvent\fP function provided by the standard X libarary.
  249. .LP
  250. Other requests are defined to grab and focus extension devices, to
  251. change their key, button, or modifier mappings, to control the
  252. propagation of input extension events, to get motion history from an
  253. extension device, and to send input extension events to another client.
  254. These functions are described in the following sections.
  255. .NH 1
  256. Library Extension Requests
  257. .XS
  258. \*(SN Library Extension Requests
  259. .XE
  260. .LP
  261. Extension input devices are accessed by client programs through the 
  262. use of new protocol requests.
  263. The following requests are provided as extensions to Xlib.  Constants
  264. and structures referenced by these functions may be found in the 
  265. files \fBXI.h\fP and \fBXInput.h\fP, which are attached to this document as 
  266. appendix A.
  267. .LP
  268. The library will return \fBNoSuchExtension\fP if an extension request
  269. is made to a server that does not support the input extension.
  270. .LP
  271. Input extension requests cannot be used to access the X keyboard and
  272. X pointer devices.
  273. .NH 2
  274. Window Manager Functions
  275. .XS
  276. \*(SN Window Manager Functions
  277. .XE
  278. .NH 3
  279. Changing The Core Devices
  280. .XS
  281. \*(SN Changing The Core Devices
  282. .XE
  283. .LP
  284. These functions are provided to change which physical device is used
  285. as the X pointer or X keyboard.
  286. .NT
  287. Using these functions may change the characteristics of the core devices.
  288. The new pointer device may have a different number of buttons than the 
  289. old one did, or the new keyboard device may have a different number of
  290. keys or report a different range of keycodes.  Client programs may be
  291. running that depend on those characteristics.  For example, a client
  292. program could allocate an array based on the number of buttons on the
  293. pointer device, and then use the button numbers received in button events
  294. as indicies into that array.  Changing the core devices could cause
  295. such client programs to behave improperly or abnormally terminate,
  296. if they ignore the ChangeDeviceNotify event generated by these requests.
  297. .NE
  298. .LP
  299. These functions change the X keyboard or X pointer device and generate
  300. an \fBXChangeDeviceNotify\fP event and a \fBMappingNotify\fP event.  
  301. The specified device becomes the
  302. new X keyboard or X pointer device.  The location of the core device
  303. does not change as a result of this request.
  304. .LP
  305. These requests fail and return \fBAlreadyGrabbed\fP if either the specified
  306. device or the core device it would replace are grabbed by some other
  307. client.  They fail and return \fBGrabFrozen\fP if either device is frozen
  308. by the active grab of another client.
  309. .LP
  310. These requests fail with a \fBBadDevice\fP error if the specified device is
  311. invalid, has not previously been opened via \fBXOpenDevice\fP, or is
  312. not supported as a core device by the server implementation.
  313. .sp 2
  314. .LP
  315. Once the device has successfully replaced one of the core devices, it
  316. is treated as a core device until it is in turn replaced by another
  317. \fBChangeDevice\fP request, or until the server terminates.  The termination
  318. of the client that changed  the device will not cause it to change back.
  319. Attempts to use the \fBXCloseDevice\fP request to close the new core device will
  320. fail with a \fBBadDevice\fP error.
  321. .LP
  322. To change which physical device is used as the X keyboard, use
  323. the \fBXChangeKeyboardDevice\fP function.
  324. .LP
  325. The specified device must support input class \fBKeys\fP (as reported in the
  326. \fBListInputDevices\fP request) or the request will fail with a 
  327. \fBBadMatch\fP error.
  328. .LP
  329. .DS
  330. \f(C
  331. int
  332. XChangeKeyboardDevice (display, device)
  333.     Display *display;
  334.     XDevice *device;
  335. \fP
  336. .DE
  337. .RS
  338. .in +.5i
  339. .IP "\fIdisplay\fP" .75i
  340. Specifies the connection to the X server.
  341. .IP "\fIdevice\fP"
  342. Specifies the desired device.
  343. .in -.5i
  344. .RE
  345. .LP
  346. If no error occurs, this function returns \fBSuccess\fP.
  347. A \fBChangeDeviceNotify\fP event with the request field set to \fBNewKeyboard\fP
  348. is sent to all clients selecting that event.  A \fBMappingNotify\fP event
  349. with the request field set to \fBMappingKeyboard\fP is sent to all clients.
  350. The requested device becomes the X keyboard, and the old keyboard becomes 
  351. available as an extension input device.
  352. The focus state of the new keyboard is the same as
  353. the focus state of the old X keyboard.
  354. .LP
  355. Errors returned by this function:  \fBBadDevice\fP, \fBBadMatch\fP,
  356. \fBAlreadyGrabbed\fP, and \fBGrabFrozen\fP.
  357. .sp 2
  358. .LP
  359. To change which physical device is used as the X pointer,
  360. use the \fBXChangePointerDevice\fP function.
  361. The specified device must support input class \fBValuators\fP (as reported in 
  362. the \fBXListInputDevices request\fP) and report at least two axes of motion,
  363. or the request will fail with a \fBBadMatch\fP error.
  364. If the specified device reports more than two axes, the two specified in
  365. the xaxis and yaxis arguments will be used.  Data from other
  366. valuators on the device will be ignored.
  367. .LP
  368. If the specified device reports absolute positional information, and the 
  369. server implementation does not allow such a device to be used as the 
  370. X pointer, the request will fail with a \fBBadDevice\fP error.
  371. .DS
  372. \f(C
  373. int
  374. XChangePointerDevice (display, device, xaxis, yaxis)
  375.     Display *display;
  376.     XDevice *device;
  377.     int     xaxis;
  378.     int     yaxis;
  379. \fP
  380. .DE
  381. .RS
  382. .in +.5i
  383. .IP "\fIdisplay\fP" .75i
  384. Specifies the connection to the X server.
  385. .IP "\fIdevice\fP"
  386. Specifies the desired device.
  387. .IP "\fIxaxis\fP"
  388. Specifies the zero-based index of the axis to be used as the x-axis of the 
  389. pointer device.
  390. .IP "\fIyaxis\fP"
  391. Specifies the zero-based index of the axis to be used as the y-axis of the 
  392. pointer device.
  393. .in -.5i
  394. .RE
  395. .LP
  396. If no error occurs, this function returns \fBSuccess\fP.
  397. A \fBChangeDeviceNotify\fP event with the request field set to \fBNewPointer\fP 
  398. is sent to all clients selecting that event.  A \fBMappingNotify\fP event
  399. with the request field set to \fBMappingPointer\fP is sent to all clients.
  400. The requested device becomes the X pointer, and the old pointer becomes 
  401. available as an extension input device.
  402. .LP
  403. Errors returned by this function:  \fBBadDevice\fP, \fBBadMatch\fP,
  404. \fBAlreadyGrabbed\fP, and \fBGrabFrozen\fP.
  405. .NH 3
  406. Event Synchronization And Core Grabs
  407. .XS
  408. \*(SN Event Synchronization And Core Grabs
  409. .XE
  410. .LP
  411. Implementation of the input extension requires an extension of the
  412. meaning of event synchronization for the core grab requests.  This is
  413. necessary in order to allow window managers to freeze all input devices
  414. with a single request.
  415. .LP
  416. The core grab requests require a \fBpointer_mode\fP and \fBkeyboard_mode\fP
  417. argument.  The meaning of these modes is changed by the input extension.
  418. For the \fBXGrabPointer\fP and \fBXGrabButton\fP requests, \fBpointer_mode\fP
  419. controls synchronization of the pointer device, and \fBkeyboard_mode\fP
  420. controls the synchronization of all other input devices.  
  421. For the \fBXGrabKeyboard\fP
  422. and \fBXGrabKey\fP requests, \fBpointer_mode\fP controls the synchronization
  423. of all input devices except the X keyboard, while \fBkeyboard_mode\fP controls
  424. the synchronization of the keyboard.  When using one of the core grab
  425. requests, the synchronization of extension devices
  426. is controlled by the mode specified for the device not being grabbed.
  427. .NH 3
  428. Extension Active Grabs
  429. .XS
  430. \*(SN Extension Active Grabs
  431. .XE
  432. .LP
  433. Active grabs of
  434. extension devices are supported via the 
  435. \fBXGrabDevice\fP
  436. function in the same way that core devices are grabbed using
  437. the core \fBXGrabKeyboard\fP function, except that a \fIDevice\fP is passed as
  438. a function parameter.  
  439. The \fBXUngrabDevice\fP function allows a
  440. previous active grab for an extension device to be released.
  441. .LP
  442. Passive grabs of buttons and keys on extension devices are supported
  443. via the \fBXGrabDeviceButton\fP and \fBXGrabDeviceKey\fP functions.
  444. These passive grabs are released via the \fBXUngrabDeviceKey\fP and
  445. \fBXUngrabDeviceButton\fP functions.
  446. .sp 2
  447. To grab an extension device, use the \fBXGrabDevice\fP function.
  448. The device must have previously been opened using the
  449. \fBXOpenDevice\fP function.
  450. .DS
  451. \f(C
  452. int
  453. XGrabDevice (display, device, grab_window, owner_events, 
  454.     event_count, event_list, this_device_mode, 
  455.     other_device_mode, time)
  456.         Display     *display;
  457.         XDevice     *device;
  458.         Window      grab_window;
  459.         Bool        owner_events;
  460.         int         event_count;
  461.         XEventClass *event_list;
  462.         int         this_device_mode;
  463.         int         other_device_mode;
  464.         Time        time;
  465. \fP
  466. .DE
  467. .RS
  468. .in +.5i
  469. .IP "\fIdisplay\fP" .80i
  470. Specifies the connection to the X server.
  471. .IP "\fIdevice\fP"
  472. Specifies the desired device.
  473. .IP "\fIgrab_window\fP"
  474. Specifies the ID of a window associated with the device specified above.
  475. .IP "\fIowner_events\fR"
  476. \fRSpecifies a boolean value of either \fBTrue\fP or \fBFalse.
  477. .IP "\fIevent_count\fP"
  478. Specifies the number of elements in the event_list array.
  479. .IP "\fIevent_list\fP"
  480. Specifies a pointer to a list of event classes that indicate which events
  481. the client wishes to receive.  
  482. These event classes must have been obtained
  483. using the device being grabbed.
  484. .IP "\fIthis_device_mode\fP"
  485. Controls further processing of events from this device.  You can pass one
  486. of these constants: \fBGrabModeSync\fP or \fBGrabModeAsync\fP.
  487. .IP "\fIother_device_mode\fP"
  488. Controls further processing of events from all other devices.  You can pass one
  489. of these constants: \fBGrabModeSync\fP or \fBGrabModeAsync\fP.
  490. .IP "\fItime\fP"
  491. Specifies the time.  This may be either a timestamp expressed in
  492. milliseconds, or \fBCurrentTime\fP.
  493. .in -.5i
  494. .RE
  495. .LP
  496. The \fBXGrabDevice\fP function actively grabs an 
  497. extension input device, and generates 
  498. \fBDeviceFocusIn\fP and \fBDeviceFocusOut\fP events.  Further input events from
  499. this device are reported only to the grabbing client.  This function
  500. overrides any previous active grab by this client for this 
  501. device.  
  502. .LP
  503. The event-list parameter is a pointer to a list of event classes.  This list
  504. indicates which events the client wishes to receive while the grab is active.
  505. If owner_events
  506. is \fBFalse\fP, input events from this device are reported with respect to 
  507. grab_window and are only reported if specified in event_list.
  508. If owner_events is \fBTrue\fP, then if a generated event would
  509. normally be reported to this client, it is reported normally. Otherwise
  510. the event is reported with respect to the grab_window, and is only
  511. reported if specified in event_list.
  512. .LP
  513. The this_device_mode argument controls the further processing 
  514. of events from this device, and the other_device_mode argument controls
  515. the further processing of input events from all other devices.
  516. .IP \(bu 3n
  517. If the this_device_mode argument is 
  518. \fBGrabModeAsync\fP,
  519. device event processing continues
  520. normally; if the device is currently frozen by this client, then
  521. processing of device events is resumed.
  522. If the this_device_mode  argument is
  523. \fBGrabModeSync\fP,
  524. the state of the grabbed device
  525. (as seen by client applications) appears to freeze,
  526. and no further device events are generated by the server until the
  527. grabbing client issues a releasing 
  528. \fBXAllowDeviceEvents\fP
  529. call or until the device grab is released.
  530. Actual
  531. device input events are not lost while the device is frozen; they are
  532. simply queued for later processing.
  533. .IP \(bu 3n
  534. If the other_device_mode is 
  535. \fBGrabModeAsync\fP,
  536. event processing from other input devices is unaffected
  537. by activation of the grab.  
  538. If other_device_mode is \fBGrabModeSync\fP,
  539. the state of all devices except the grabbed device
  540. (as seen by client applications) appears to freeze, and no further
  541. events are generated by the server until the grabbing client issues a
  542. releasing 
  543. \fBXAllowEvents\fP or \fBXAllowDeviceEvents\fP
  544. call or until the device grab is released.
  545. Actual events are not lost
  546. while the other devices are frozen; they are simply queued for later
  547. processing.
  548. .LP
  549. \fBXGrabDevice\fP fails and returns:
  550. .IP \(bu 3n
  551. \fBAlreadyGrabbed\fP
  552. If the device is actively grabbed by some other client.
  553. .IP \(bu 3n
  554. \fBGrabNotViewable\fP
  555. If grab_window is not viewable.
  556. .IP \(bu 3n
  557. \fBGrabInvalidTime\fP
  558. If the specified time is earlier
  559. than the last-grab-time for the specified device
  560. or later than the current X server time. Otherwise,
  561. the last-grab-time for the specified device is set
  562. to the specified time and 
  563. \fBCurrentTime\fP
  564. is replaced by the current X server time.
  565. .IP \(bu 3n
  566. \fBGrabFrozen\fP
  567. If the device is frozen by an active grab of another client.
  568. .LP
  569. If a grabbed device is closed by a client while an active grab by that 
  570. client is in
  571. effect, that active grab will be released.  Any passive grabs established by
  572. that client will be released.  If the device is frozen only by an active grab
  573. of the requesting client, it is thawed.
  574. .LP
  575. Errors returned by this function:  \fBBadDevice\fP, \fBBadWindow\fP, 
  576. \fBBadValue\fP, \fBBadClass\fP.
  577. .sp 2
  578. To release a grab of an extension device, use \fBXUngrabDevice\fP.
  579. .DS
  580. \f(C
  581. int
  582. XUngrabDevice (display, device, time)
  583.         Display *display;
  584.         XDevice *device;
  585.         Time    time;
  586. \fP
  587. .DE
  588. .LP
  589. .RS
  590. .in +.5i
  591. .IP "\fIdisplay\fP" .75i
  592. Specifies the connection to the X server.
  593. .IP "\fIdevice\fP"
  594. Specifies the desired device.
  595. .IP "\fItime\fP"
  596. Specifies the time.  This may be either a timestamp expressed in
  597. milliseconds, or \fBCurrentTime\fP.
  598. .in -.5i
  599. .RE
  600. .LP
  601. This function allows a client to release an extension input device and any
  602. queued events if this client has it grabbed from either \fBXGrabDevice\fP
  603. or \fBXGrabDeviceKey\fP.  If any other devices are frozen by the grab,
  604. \fBXUngrabDevice\fP thaws them. 
  605. The function does not release the device and any
  606. queued events if the specified time is earlier than the last-device-grab
  607. time or is later than the current X server time.  It also generates 
  608. \fBDeviceFocusIn\fP and \fBDeviceFocusOut\fP events.  The X server 
  609. automatically performs an \fBXUngrabDevice\fP if the event window for an
  610. active device grab becomes not viewable, or if the client terminates without
  611. releasing the grab.
  612. .LP
  613. Errors returned by this function:  \fBBadDevice\fP.
  614. .sp 2
  615. .NH 3
  616. Passively Grabbing A Key
  617. .XS
  618. \*(SN Passively Grabbing A Key
  619. .XE
  620. .LP
  621. To passively grab a single key on an extension device, use \fBXGrabDeviceKey\fP.
  622. That device must have previously been opened using the
  623. \fBXOpenDevice\fP function, or the request will fail with a \fBBadDevice\fP
  624. error.  
  625. If the specified device does not support input class \fBKeys\fP,
  626. the request will fail with a \fBBadMatch\fP error.
  627. .DS
  628. \f(C
  629. int
  630. XGrabDeviceKey (display, device, keycode, modifiers, modifier_device
  631.     grab_window, owner_events, event_count, event_list, 
  632.     this_device_mode, other_device_mode)
  633.         Display     *display;
  634.         XDevice     *device;
  635.         int         keycode;
  636.         unsigned    int modifiers;
  637.         XDevice     *modifier_device;
  638.         Window      grab_window;
  639.         Bool        owner_events;
  640.         int         event_count;
  641.         XEventClass *event_list;
  642.         int         this_device_mode;
  643.         int         other_device_mode;
  644. \fP
  645. .DE
  646. .LP
  647. .RS
  648. .in +.5i
  649. .IP "\fIdisplay\fP" .80i
  650. Specifies the connection to the X server.
  651. .IP "\fIdevice\fP"
  652. Specifies the desired device.
  653. .IP "\fIkeycode\fP"
  654. Specifies the keycode of the key that is to be grabbed.  You can pass
  655. either the keycode or \fBAnyKey\fR.
  656. .IP "\fImodifiers\fP"
  657. Specifies the set of keymasks.  This mask is the bitwise inclusive OR
  658. of these keymask bits:  \fBShiftMask\fR, \fBLockMask\fR, \fBControlMask\fR, 
  659. \fBMod1Mask\fR, \fBMod2Mask\fR, \fBMod3Mask\fR, \fBMod4Mask\fR, \fBMod5Mask\fR.
  660. .IP "~"
  661. You can also pass \fBAnyModifier\fP, which is equivalent to issuing the grab 
  662. key request for all possible modifier combinations (including the combination
  663. of no modifiers).
  664. .IP "\fImodifier_device\fP"
  665. Specifies the device whose modifiers are to be used.  If \fBNULL\fP is 
  666. specified, the core X keyboard is used as the modifier_device.
  667. .IP "\fIgrab_window\fP"
  668. Specifies the ID of a window associated with the device specified above.
  669. .IP "\fIowner_events\fR"
  670. Specifies a boolean value of either \fBTrue\fR or \fBFalse\fR.
  671. .IP "\fIevent_count\fP"
  672. Specifies the number of elements in the event_list array.
  673. .IP "\fIevent_list\fP"
  674. Specifies a pointer to a list of event classes that indicate which events
  675. the client wishes to receive.
  676. .IP "\fIthis_device_mode\fP"
  677. Controls further processing of events from this device.  You can pass one
  678. of these constants: \fBGrabModeSync\fP or \fBGrabModeAsync\fP.
  679. .IP "\fIother_device_mode\fP"
  680. Controls further processing of events from all other devices.  You can pass one
  681. of these constants: \fBGrabModeSync\fP or \fBGrabModeAsync\fP.
  682. .in -.5i
  683. .RE
  684. .LP
  685. This function is analogous to the core \fBXGrabKey\fP function.  It creates an
  686. explicit passive grab for a key on an extension device.
  687. .LP
  688. The \fBXGrabDeviceKey\fP function establishes a passive grab on a device.
  689. Consequently, in the future, 
  690. .IP \(bu 3n
  691. IF the device is not grabbed and the specified key, 
  692. which itself can be a modifier key, is logically pressed
  693. when the specified modifier keys logically are down on the specified
  694. modifier device
  695. (and no other keys are down),
  696. .IP \(bu 3n
  697. AND no other modifier keys logically are down,
  698. .IP \(bu 3n
  699. AND EITHER the grab window is an ancestor of (or is) the focus window
  700. OR the grab window is a descendent of the focus window and contains the pointer,
  701. .IP \(bu 3n
  702. AND a passive grab on the same device and key combination does not exist on any
  703. ancestor of the grab window,
  704. .IP \(bu 3n
  705. THEN the device is actively grabbed, as for \fBXGrabDevice\fP,
  706. the last-device-grab time is set to the time at which the key was pressed
  707. (as transmitted in the \fBDeviceKeyPress\fP event), and the 
  708. \fBDeviceKeyPress\fP event is reported.
  709. .LP
  710. The interpretation of the remaining arguments is as for \fBXGrabDevice\fP.
  711. The active grab is terminated automatically when the logical state of the
  712. device has the specified key released
  713. (independent of the logical state of the modifier keys).
  714. .LP
  715. Note that the logical state of a device (as seen by means of the X protocol)
  716. may lag the physical state if device event processing is frozen.
  717. .LP
  718. A modifier of \fBAnyModifier\fP is equivalent to issuing the request for all
  719. possible modifier combinations (including the combination of no modifiers).  
  720. It is not required that all modifiers specified have
  721. currently assigned keycodes.
  722. A key of \fBAnyKey\fP is equivalent to issuing
  723. the request for all possible keycodes.  Otherwise, the key must be in
  724. the range specified by min_keycode and max_keycode in the 
  725. information returned by the \fBXListInputDevices\fP
  726. function.
  727. If it is not within that range, \fBXGrabDeviceKey\fP generates a
  728. \fBBadValue\fP error.
  729. .LP
  730. A \fBBadAccess\fP error is generated if some other client has issued a 
  731. \fBXGrabDeviceKey\fP with the same device and key combination on the 
  732. same window.  When using \fBAnyModifier\fP or \fBAnyKey\fP,
  733. the request fails completely and the X server generates a \fBBadAccess\fP
  734. error and no grabs are
  735. established if there is a conflicting grab for any combination.
  736. .LP
  737. \fBXGrabDeviceKey\fP can generate \fBBadDevice\fP, \fBBadAccess\fP,
  738. \fBBadMatch\fP, \fBBadWindow\fP, \fBBadClass\fP, and \fBBadValue\fP errors.
  739. .LP
  740. \fBXGrabDeviceKey\fP returns \fBSuccess\fP upon successful completion of the
  741. request.
  742. .sp 2
  743. To release a passive grab of a single key on an extension device, 
  744. use \fBXUngrabDeviceKey\fP.
  745. .DS
  746. \f(C
  747. int
  748. XUngrabDeviceKey (display, device, keycode, modifiers, 
  749.     modifier_device, ungrab_window)
  750.         Display  *display;
  751.         XDevice  *device;
  752.         int      keycode;
  753.         unsigned int modifiers;
  754.         XDevice  *modifier_device;
  755.         Window   ungrab_window;
  756. \fP
  757. .DE
  758. .LP
  759. .RS
  760. .in +.5i
  761. .IP "\fIdisplay\fP" .75i
  762. Specifies the connection to the X server.
  763. .IP "\fIdevice\fP"
  764. Specifies the desired device.
  765. .IP "\fIkeycode\fP"
  766. Specifies the keycode of the key that is to be ungrabbed.  You can pass
  767. either the keycode or \fBAnyKey\fR.
  768. .IP "\fImodifiers\fP"
  769. Specifies the set of keymasks.  This mask is the bitwise inclusive OR
  770. of these keymask bits:  \fBShiftMask\fR, \fBLockMask\fR, \fBControlMask\fR, 
  771. \fBMod1Mask\fR, \fBMod2Mask\fR, \fBMod3Mask\fR, \fBMod4Mask\fR, \fBMod5Mask\fR.
  772. .IP "~"
  773. You can also pass \fBAnyModifier\fP, which is equivalent to issuing the ungrab key 
  774. request for all possible modifier combinations (including the combination
  775. of no modifiers).
  776. .IP "\fImodifier_device\fP"
  777. Specifies the device whose modifiers are to be used.  If \fBNULL\fP is 
  778. specified, the core X keyboard is used as the modifier_device.
  779. .IP "\fIungrab_window\fP"
  780. Specifies the ID of a window associated with the device specified above.
  781. .in -.5i
  782. .RE
  783. .LP
  784. .SH DESCRIPTION
  785. .LP
  786. This function is analogous to the core \fBXUngrabKey\fP function.  It releases
  787. an explicit passive grab for a key on an extension input device.
  788. .LP
  789. Errors returned by this function:  \fBBadDevice\fP, \fBBadWindow\fP,
  790. \fBBadValue\fP, \fBBadAlloc\fP, and \fBBadMatch\fP.
  791. .sp 2
  792. .NH 3
  793. Passively Grabbing A Button
  794. .XS
  795. \*(SN Passively Grabbing A Button
  796. .XE
  797. .LP
  798. To establish a passive grab for a single button on an extension device,
  799. use \fBXGrabDeviceButton\fP.
  800. The specified device must have previously been opened using the
  801. \fBXOpenDevice\fP function, or the request will fail with a \fBBadDevice\fP
  802. error.  If the specified device does not support input class \fBButtons\fP,
  803. the request will fail with a \fBBadMatch\fP error.
  804. .DS
  805. \f(C
  806. int
  807. XGrabDeviceButton (display, device, button, modifiers, 
  808.     modifier_device, grab_window, owner_events, event_count, 
  809.     event_list, this_device_mode, other_device_mode)
  810.         Display      *display;
  811.         XDevice      *device;
  812.         unsigned int button;
  813.         unsigned int modifiers;
  814.         XDevice      *modifier_device;
  815.         Window       grab_window;
  816.         Bool         owner_events;
  817.         int          event_count;
  818.         XEventClass  *event_list;
  819.         int          this_device_mode;
  820.         int          other_device_mode;
  821. \fP
  822. .DE
  823. .LP
  824. .RS
  825. .in +.5i
  826. .IP "\fIdisplay\fP" .80i
  827. Specifies the connection to the X server.
  828. .IP "\fIdevice\fP"
  829. Specifies the desired device.
  830. .IP "\fIbutton\fP"
  831. Specifies the code of the button that is to be grabbed.  You can pass
  832. either the button or \fBAnyButton\fR.
  833. .IP "\fImodifiers\fP"
  834. Specifies the set of keymasks.  This mask is the bitwise inclusive OR
  835. of these keymask bits:  \fBShiftMask\fR, \fBLockMask\fR, \fBControlMask\fR, 
  836. \fBMod1Mask\fR, \fBMod2Mask\fR, \fBMod3Mask\fR, \fBMod4Mask\fR, \fBMod5Mask\fR.
  837. .IP "~"
  838. You can also pass \fBAnyModifier\fP, which is equivalent to issuing the grab
  839. request for all possible modifier combinations (including the combination
  840. of no modifiers).
  841. .IP "\fImodifier_device\fP"
  842. Specifies the device whose modifiers are to be used.  If \fBNULL\fP is 
  843. specified, the core X keyboard is used as the modifier_device.
  844. .IP "\fIgrab_window\fP"
  845. Specifies the ID of a window associated with the device specified above.
  846. .IP "\fIowner_events"
  847. Specifies a boolean value of either \fBTrue\fR or \fBFalse\fR.
  848. .IP "\fIevent_count\fP"
  849. Specifies the number of elements in the event_list array.
  850. .IP "\fIevent_list\fP"
  851. Specifies a list of event classes that indicates which device events are to be 
  852. reported to the client.
  853. .IP "\fIthis_device_mode\fP"
  854. Controls further processing of events from this device.  You can pass one
  855. of these constants: \fBGrabModeSync\fP or \fBGrabModeAsync\fP.
  856. .IP "\fIother_device_mode\fP"
  857. Controls further processing of events from all other devices.  You can pass one
  858. of these constants: \fBGrabModeSync\fP or \fBGrabModeAsync\fP.
  859. .in -.5i
  860. .RE
  861. .LP
  862. This function is analogous to the core \fBXGrabButton function\fP.  
  863. It creates an
  864. explicit passive grab for a button on an extension input device.  Since the
  865. server does not track extension devices, no cursor is specified with this
  866. request.  For the same reason, there is no confine_to parameter.
  867. The device must have previously been opened using the
  868. \fBXOpenDevice\fP function.
  869. .LP
  870. The \fBXGrabDeviceButton\fP function establishes a passive grab on a device.
  871. Consequently, in the future, 
  872. .IP \(bu 3n
  873. IF the device is not grabbed and the specified button is logically pressed
  874. when the specified modifier keys logically are down 
  875. (and no other buttons or modifier keys are down),
  876. .IP \(bu 3n
  877. AND EITHER the grab window is an ancestor of (or is) the focus window
  878. OR the grab window is a descendent of the focus window and contains the pointer,
  879. .IP \(bu 3n
  880. AND a passive grab on the same device and button/ key combination does not 
  881. exist on any ancestor of the grab window,
  882. .IP \(bu 3n
  883. THEN the device is actively grabbed, as for \fBXGrabDevice\fP,
  884. the last-grab time is set to the time at which the button was pressed
  885. (as transmitted in the \fBDeviceButtonPress\fP event), and the 
  886. \fBDeviceButtonPress\fP event is reported.
  887. .LP
  888. The interpretation of the remaining arguments is as for 
  889. \fBXGrabDevice\fP.
  890. The active grab is terminated automatically when logical state of the
  891. device has all buttons released (independent of the logical state of 
  892. the modifier keys).
  893. .LP
  894. Note that the logical state of a device (as seen by means of the X protocol)
  895. may lag the physical state if device event processing is frozen.
  896. .LP
  897. A modifier of \fBAnyModifier\fP
  898. is equivalent to issuing the request for all
  899. possible modifier combinations (including the combination of no
  900. modifiers).  
  901. It is not required that all modifiers specified have
  902. currently assigned keycodes.
  903. A button of \fBAnyButton\fP is equivalent to issuing
  904. the request for all possible buttons.
  905. Otherwise, it is not required that the 
  906. specified button be assigned to a physical button.
  907. .LP
  908. \fBBadAccess\fP error is generated if some other client has issued a 
  909. \fBXGrabDeviceButton\fP
  910. with the same device and button combination on the same window.  
  911. When using \fBAnyModifier\fP or \fBAnyButton\fP, the request fails completely 
  912. and the X server generates a \fBBadAccess\fP
  913. error and no grabs are
  914. established if there is a conflicting grab for any combination.
  915. .LP
  916. \fBXGrabDeviceButton\fP can generate \fBBadDevice\fP, \fBBadMatch\fP,
  917. \fBBadAccess\fP, \fBBadWindow\fP, \fBBadClass\fP, and \fBBadValue\fP errors.
  918. .sp 2
  919. To release a passive grab of a button on an extension device, use 
  920. \fBXUngrabDeviceButton\fP.
  921. .DS
  922. \f(C
  923. int
  924. XUngrabDeviceButton (display, device, button, modifiers, 
  925.     modifier_device, ungrab_window)
  926.         Display  *display;
  927.         XDevice  *device;
  928.         unsigned int button;
  929.         unsigned int modifiers;
  930.         XDevice  *modifier_device;
  931.         Window   ungrab_window;
  932. \fP
  933. .DE
  934. .RS
  935. .in +.5i
  936. .IP "\fIdisplay\fP" .75i
  937. Specifies the connection to the X server.
  938. .IP "\fIdevice\fP"
  939. Specifies the desired device.
  940. .IP "\fIbutton\fP"
  941. Specifies the code of the button that is to be ungrabbed.  You can pass
  942. either a button or \fBAnyButton\fR.
  943. .IP "\fImodifiers\fP"
  944. Specifies the set of keymasks.  This mask is the bitwise inclusive OR
  945. of these keymask bits:  \fBShiftMask\fR, \fBLockMask\fR, \fBControlMask\fR, 
  946. \fBMod1Mask\fR, \fBMod2Mask\fR, \fBMod3Mask\fR, \fBMod4Mask\fR, \fBMod5Mask\fR.
  947. .IP "~"
  948. You can also pass \fBAnyModifier\fP, which is equivalent to issuing the ungrab key 
  949. request for all possible modifier combinations (including the combination
  950. of no modifiers).
  951. .IP "\fImodifier_device\fP"
  952. Specifies the device whose modifiers are to be used.  If \fBNULL\fP is 
  953. specified, the core X keyboard is used as the modifier_device.
  954. .IP "\fIungrab_window\fP"
  955. Specifies the ID of a window associated with the device specified above.
  956. .in -.5i
  957. .RE
  958. .LP
  959. This function is analogous to the core \fBXUngrabButton\fP function.  It
  960. releases an explicit passive grab for a button on an extension device.
  961. That device must have previously been opened using the
  962. \fBXOpenDevice\fP function, or a \fBBadDevice\fP error will result.
  963. .LP
  964. A modifier of \fBAnyModifier\fP
  965. is equivalent to issuing the request for all
  966. possible modifier combinations (including the combination of no
  967. modifiers).  
  968. .LP
  969. \fBXUngrabDeviceButton\fP can generate \fBBadDevice\fP, \fBBadMatch\fP,
  970. \fBBadWindow\fP, \fBBadValue\fP, and \fBBadAlloc\fP errors.
  971. .NH 3
  972. Thawing A Device
  973. .XS
  974. \*(SN Thawing A Device
  975. .XE
  976. .LP
  977. To allow further events to be processed when a device has been frozen,
  978. use \fBXAllowDeviceEvents\fR.
  979. .DS
  980. \f(C
  981. int
  982. XAllowDeviceEvents (display, device, event_mode, time)
  983.         Display *display;
  984.         XDevice *device;
  985.         int     event_mode;
  986.         Time    time;
  987. \fP
  988. .DE
  989. .RS
  990. .in +.5i
  991. .IP "\fIdisplay\fP" .75i
  992. Specifies the connection to the X server.
  993. .IP "\fIdevice\fP"
  994. Specifies the desired device.
  995. .IP "\fIevent_mode\fP"
  996. Specifies the event mode.  You can pass one of these constants:
  997. \fBAsyncThisDevice\fP, \fBSyncThisDevice\fP, \fBAsyncOtherDevices\fP,
  998. \fBReplayThisDevice\fP, \fBAsyncAll\fP, or \fBSyncAll\fP.
  999. .IP "\fItime\fP"
  1000. Specifies the time.  This may be either a timestamp expressed in
  1001. milliseconds, or \fBCurrentTime\fP.
  1002. .in -.5i
  1003. .RE
  1004. .LP
  1005. The \fBXAllowDeviceEvents\fP function releases some queued events if the client
  1006. has caused a device to freeze.
  1007. The function has no effect if the specified time is earlier than the last-grab 
  1008. time of the most recent active grab for the client and device, 
  1009. or if the specified time is later than the current X server time.
  1010. The following describes the processing that occurs depending on what constant
  1011. you pass to the event_mode argument:
  1012. .IP \(bu 3n \fBAsyncThisDevice\fP
  1013. If the specified device is frozen by the client, event processing for that 
  1014. continues as usual.  If the device is frozen multiple times  by the client on 
  1015. behalf of multiple separate grabs, AsyncThisDevice thaws for all.
  1016. AsyncThisDevice has no effect if the specified device is not frozen by the 
  1017. client, but the device need not be grabbed by the client.
  1018. .IP \(bu 3n \fBSyncThisDevice\fP 
  1019. If the specified device is frozen and actively grabbed by the client,
  1020. event processing for that device continues normally until the next 
  1021. key or button event is reported to the client.
  1022. At this time, 
  1023. the specified device again appears to freeze.
  1024. However, if the reported event causes the grab to be released,
  1025. the specified device does not freeze.
  1026. SyncThisDevice has no effect if the specified device is not frozen by the client
  1027. or is not grabbed by the client.
  1028. .IP \(bu 3n \fBReplayThisDevice\fP
  1029. If the specified device is actively grabbed by the client and is frozen as the result of
  1030. an event having been sent to the client (either from the activation of a 
  1031. GrabDeviceButton or from a previous AllowDeviceEvents with mode SyncThisDevice, 
  1032. but not from a Grab),
  1033. the grab is released and that event is completely reprocessed.
  1034. This time, however, the request ignores any passive grabs at or above 
  1035. (towards the root) the grab-window of the grab just released.
  1036. The request has no effect if the specified device is not grabbed by the client
  1037. or if it is not frozen as the result of an event.
  1038. .IP \(bu 3n \fBAsyncOtherDevices\fP
  1039. If the remaining devices are frozen by the client,
  1040. event processing for them continues as usual.
  1041. If the other devices are frozen multiple times  by the client on behalf of 
  1042. multiple separate grabs,
  1043. AsyncOtherDevices ``thaws'' for all.
  1044. AsyncOtherDevices has no effect if the devices are not frozen by the client,
  1045. but those devices need not be grabbed by the client.
  1046. .IP \(bu 3n \fBSyncAll\fP
  1047. If all devices are frozen by the client,
  1048. event processing (for all devices) continues normally until the next
  1049. button or key event is reported
  1050. to the client for a grabbed device
  1051. at which time the devices again appear to
  1052. freeze.  However, if the reported event causes the grab to be released,
  1053. then the devices do not freeze (but if any device is still
  1054. grabbed, then a subsequent event for it will still cause all devices
  1055. to freeze).  
  1056. SyncAll has no effect unless all devices
  1057. are frozen by the client.  If any device is frozen twice
  1058. by the client on behalf of two separate grabs, 
  1059. SyncAll "thaws" for both (but a subsequent freeze for SyncAll
  1060. will only freeze each device once).
  1061. .IP \(bu 3n \fBAsyncAll\fP
  1062. If all devices are frozen by the
  1063. client, event processing (for all devices) continues normally.
  1064. If any device is frozen multiple times by the client on behalf of multiple
  1065. separate grabs, AsyncAll "thaws" for all.
  1066. If any device is frozen twice by the client on behalf of two separate grabs,
  1067. AsyncAll "thaws" for both.
  1068. AsyncAll has no effect unless all
  1069. devices are frozen by the client.
  1070. .LP
  1071. AsyncThisDevice, SyncThisDevice, and ReplayThisDevice 
  1072. have no effect on the processing of events from the remaining devices.
  1073. AsyncOtherDevices
  1074. has no effect on the processing of events from the specified device.
  1075. When the event_mode is SyncAll or AsyncAll, the 
  1076. device parameter is ignored.
  1077. .LP
  1078. It is possible for several grabs of different devices (by the same 
  1079. or different clients) to be active simultaneously.
  1080. If a device is frozen on behalf of any grab,
  1081. no event processing is performed for the device.
  1082. It is possible for a single device to be frozen because of several grabs.
  1083. In this case,
  1084. the freeze must be released on behalf of each grab before events can 
  1085. again be processed.
  1086. .LP
  1087. Errors returned by this function:  \fBBadDevice\fP, \fBBadValue\fP.
  1088. .NH 3
  1089. Controlling Device Focus
  1090. .XS
  1091. \*(SN Controlling Device Focus
  1092. .XE
  1093. .LP
  1094. The current focus window for an extension input device can be 
  1095. determined using the \fBXGetDeviceFocus\fP function.
  1096. Extension devices are focused using the \fBXSetDeviceFocus\fP
  1097. function in the same way that the keyboard is focused using
  1098. the core \fBXSetInputFocus\fP function, except that a device id is passed as
  1099. a function parameter.  One additional focus state, \fBFollowKeyboard\fP,
  1100. is provided for extension devices.
  1101. .LP
  1102. To get the current focus state, revert state, and focus time of an extension device,
  1103. use \fBXGetDeviceFocus\fP.
  1104. .DS
  1105. \f(C
  1106. int
  1107. XGetDeviceFocus (display, device, focus_return, revert_to_return,
  1108.     focus_time_return)
  1109.         Display *display;
  1110.         XDevice *device;
  1111.         Window  *focus_return;
  1112.         int     *revert_to_return;
  1113.         Time    *focus_time_return;
  1114. \fP
  1115. .DE
  1116. .LP
  1117. .RS
  1118. .in +.5i
  1119. .IP "\fIdisplay\fP" .75i
  1120. Specifies the connection to the X server.
  1121. .IP "\fIdevice\fP"
  1122. Specifies the desired device.
  1123. .IP "\fIfocus_return\fP"
  1124. Specifies the address of a variable into which the server can return the ID of
  1125. the window that contains the device focus, 
  1126. or one of the constants \fBNone\fP,
  1127. \fBPointerRoot\fP, or \fBFollowKeyboard\fP.  
  1128. .IP "\fIrevert_to_return\fP"
  1129. Specifies the address of a variable into which the server can
  1130. return the current revert_to status for the device.
  1131. .IP "\fIfocus_time_return\fP"
  1132. Specifies the address of a variable into which the server can
  1133. return the focus time last set for the device.
  1134. .in -.5i
  1135. .RE
  1136. .LP
  1137. This function returns the focus state, the revert-to state,
  1138. and the last-focus-time for an extension input device.
  1139. .LP
  1140. Errors returned by this function:  \fBBadDevice\fP, \fBBadMatch\fP.
  1141. .sp 2
  1142. To set the focus of an extension device, use \fBXSetDeviceFocus\fP.
  1143. .DS
  1144. \f(C
  1145. int
  1146. XSetDeviceFocus (display, device, focus, revert_to, time)
  1147.         Display *display;
  1148.         XDevice *device;
  1149.         Window  focus;
  1150.         int     revert_to;
  1151.         Time    time;
  1152. \fP
  1153. .DE
  1154. .RS
  1155. .in +.5i
  1156. .IP "\fIdisplay\fP" .75i
  1157. Specifies the connection to the X server.
  1158. .IP "\fIdevice\fP"
  1159. Specifies the desired device.
  1160. .IP "\fIfocus\fP"
  1161. Specifies the id of the window to which the device's focus should be set.
  1162. This may be a window id, or
  1163. \fBPointerRoot\fP, \fBFollowKeyboard\fP, or \fBNone\fP.
  1164. .IP "\fIrevert_to\fP"
  1165. Specifies to which window the focus of the device should revert
  1166. if the focus window becomes not viewable.  One of the following
  1167. constants may be passed:
  1168. \fBRevertToParent\fP, \fBRevertToPointerRoot\fP,
  1169. \fBRevertToNone\fP, or \fBRevertToFollowKeyboard\fP.
  1170. .IP "\fItime\fP"
  1171. Specifies the time.  You can pass either a timestamp, expressed in
  1172. milliseconds, or \fBCurrentTime\fP.
  1173. .in -.5i
  1174. .RE
  1175. .LP
  1176. This function changes the focus for an extension input device and the 
  1177. last-focus-change-time.  The function has no effect if the specified 
  1178. time is earlier than the last-focus-change-time or is later than the
  1179. current X server time.  Otherwise, the last-focus-change-time is set to the
  1180. specified time.
  1181. This function causes the X server to generate \fBDeviceFocusIn\fP and 
  1182. \fBDeviceFocusOut\fP events.
  1183. .LP
  1184. The action taken by the server when this function is requested depends
  1185. on the value of the focus argument:
  1186. .IP \(bu 3n
  1187. If the focus argument is \fBNone\fP, all input events from this device
  1188. will be discarded until a new focus window is set.  In this case, the
  1189. revert_to argument is ignored.
  1190. .IP \(bu 3n
  1191. If a window ID is assigned to the focus argument, it becomes the focus
  1192. window of the device.  If an input event from the device would normally
  1193. be reported to this window or to one of its inferiors, the event is 
  1194. reported normally.  Otherwise, the event is reported relative to the focus 
  1195. window.
  1196. .IP \(bu 3n
  1197. If you assign \fBPointerRoot\fP to the focus argument, the focus window is 
  1198. dynamically taken to be the root window of whatever screen the pointer is
  1199. on at each input event.  In this case, the revert_to argument is ignored.
  1200. .IP \(bu 3n
  1201. If you assign \fBFollowKeyboard\fP to the focus argument, the focus window is 
  1202. dynamically taken to be the same as the focus of the X keyboard at each
  1203. input event.
  1204. .LP
  1205. The specified focus window must be viewable at the time \fBXSetDeviceFocus\fP
  1206. is called.  Otherwise, it generates a \fBBadMatch error\fP.  If the focus window
  1207. later becomes not viewable, the X server evaluates the revert_to argument
  1208. to determine the new focus window.
  1209. .IP \(bu 3n
  1210. If you assign \fBRevertToParent\fP
  1211. to the revert_to argument, the focus reverts to the parent
  1212. (or the closest viewable ancestor), and the new revert_to value is taken to
  1213. be \fBRevertToNone\fP.  
  1214. .IP \(bu 3n
  1215. If you assign \fBRevertToPointerRoot\fP, \fBRevertToFollowKeyboard\fP,
  1216. or \fBRevertToNone\fP
  1217. to the revert_to argument, the focus reverts to that value.
  1218. .LP
  1219. When the focus reverts,
  1220. the X server generates \fBDeviceFocusIn\fP
  1221. and \fBDeviceFocusOut\fP
  1222. events, but the last-focus-change time is not affected.
  1223. .LP
  1224. Errors returned by this function:  \fBBadDevice\fP, \fBBadMatch\fP, 
  1225. \fBBadValue\fP, and \fBBadWindow\fP.
  1226. .NH 3
  1227. Controlling Device Feedback
  1228. .XS
  1229. \*(SN Controlling Device Feedback
  1230. .XE
  1231. .LP
  1232. To determine the current feedback settings of an extension input device, 
  1233. use \fBXGetFeedbackControl\fP.
  1234. .LP
  1235. .DS
  1236. \f(C
  1237. XFeedbackState
  1238. *XGetFeedbackControl (display, device, num_feedbacks_return)
  1239.         Display          *display;
  1240.         XDevice          *device;
  1241.         int              *num_feedbacks_return;
  1242. \fP
  1243. .DE
  1244. .RS
  1245. .in +.5i
  1246. .IP "\fIdisplay\fP" .80i
  1247. Specifies the connection to the X server.
  1248. .IP "\fIdevice\fP"
  1249. Specifies the desired device.
  1250. .IP "\fInum_feedbacks_return\fP"
  1251. Returns the number of feedbacks supported by the device.
  1252. .in -.5i
  1253. .RE
  1254. .LP
  1255. .IP \(bu 3n
  1256. This function returns a list of \fBFeedbackState\fP structures that 
  1257. describe the feedbacks supported by the specified device.  There is an
  1258. \fBXFeedbackState\fP structure for each clase of feedback.  These are of 
  1259. variable length, but the first three fields are common to all.
  1260. The common fields are as follows:
  1261. .LP
  1262. .DS
  1263. \f(C
  1264. typedef struct {
  1265.     XID     class;
  1266.     int     length;
  1267.     XID     id;
  1268. } XFeedbackState;
  1269. \fP
  1270. .DE
  1271. .LP
  1272. where \fBclass\fP identifies the class of feedback.  The \fBclass\fP
  1273. may be compared to constants defined in the file \fBXI.h\fP.  Currently
  1274. defined feedback constants include \fBKbdFeedbackClass\fP, 
  1275. \fBPtrFeedbackClass\fP, \fBStringFeedbackClass\fP, \fBIntegerFeedbackClass\fP, 
  1276. \fBLedFeedbackClass\fP, and \fBBellFeedbackClass\fP.
  1277. .LP
  1278. The \fBlength\fP specifies the length of the \fBFeedbackState\fP structure
  1279. and can be used by clients to traverse the list.
  1280. .LP
  1281. The \fBid\fP uniquely identifies a feedback for a given device and class.
  1282. This allows a device to support more than one feedback of the same class.
  1283. Other feedbacks of other classes or devices may have the same id.
  1284. .IP \(bu 3n
  1285. Those feedbacks equivalent to those
  1286. supported by the core keyboard are reported in class \fBKbdFeedback\fP
  1287. using the \fBXKbdFeedbackState\fP structure.
  1288. The members of that structure are as follows:
  1289. .LP
  1290. .DS
  1291. \f(C
  1292. typedef struct {
  1293.     XID     class;
  1294.     int     length;
  1295.     XID     id;
  1296.     int     click;
  1297.     int     percent;
  1298.     int     pitch;
  1299.     int     duration;
  1300.     int     led_mask;
  1301.     int     global_auto_repeat;
  1302.     char    auto_repeats[32];
  1303. } XKbdFeedbackState;
  1304. \fP
  1305. .DE
  1306. .LP
  1307. The fields of the \fBXKbdFeedbackState\fP structure report the current state of
  1308. the feedback:
  1309. .IP \(bu 3n
  1310. \fBclick\fP specifies the key-click volume, and has a value in the range
  1311. 0 (off) to 100 (loud).
  1312. .IP \(bu 3n
  1313. \fBpercent\fP specifies the bell volume, and has a value in the range
  1314. 0 (off) to 100 (loud).
  1315. .IP \(bu 3n
  1316. \fBpitch\fP specifies the bell pitch in Hz. The range of the value is 
  1317. implementation-dependent.
  1318. .IP \(bu 3n
  1319. \fBduration\fP specifies the duration in milliseconds of the bell.
  1320. .IP \(bu 3n
  1321. \fBled_mask\fP is a bit mask that describes the current state of up to 
  1322. 32 LEDs.  A value of 1 in a bit indicates that the corresponding LED is on.
  1323. .IP \(bu 3n
  1324. \fBglobal_auto_repeat\fP has a value of \fBAutoRepeatModeOn\fP or
  1325. \fBAutoRepeatModeOff\fP.
  1326. .IP \(bu 3n
  1327. The \fBauto_repeats\fP member is a bit vector.  Each bit set to 1 indicates
  1328. that auto-repeat is enabled for the corresponding key.  The vector is
  1329. represented as 32 bytes.  Byte N (from 0) contains the bits for keys
  1330. 8N to 8N + 7, with the least significant bit int the byte representing
  1331. key 8N.
  1332. .LI
  1333. Those feedbacks equivalent to those
  1334. supported by the core pointer are reported in class \fBPtrFeedback\fP
  1335. using he \fBXPtrFeedbackState\fP structure.
  1336. The members of that structure are as follows:
  1337. .LP
  1338. .DS
  1339. \f(C
  1340. typedef struct {
  1341.     XID     class;
  1342.     int     length;
  1343.     XID     id;
  1344.     int     accelNum;
  1345.     int     accelDenom;
  1346.     int     threshold;
  1347. } XPtrFeedbackState;
  1348. \fP
  1349. .DE
  1350. .LP
  1351. The fields of the \fBXPtrFeedbackState\fP structure report the current state of
  1352. the feedback:
  1353. .IP \(bu 3n
  1354. \fBaccelNum\fP returns the numerator for the acceleration multiplier.
  1355. .IP \(bu 3n
  1356. \fBaccelDenom\fP returns the denominator for the acceleration multiplier.
  1357. .IP \(bu 3n
  1358. \fBaccelDenom\fP returns the threshold for the acceleration.
  1359. .LP
  1360. .LI
  1361. \fBInteger\fP feedbacks are those capable of displaying integer numbers.  
  1362. The minimum and maximum values that they can display are reported.
  1363. .LP
  1364. .DS
  1365. \f(C
  1366. typedef struct {
  1367.     XID     class;
  1368.     int     length;
  1369.     XID     id;
  1370.     int     resolution;
  1371.     int     minVal;
  1372.     int     maxVal;
  1373. } XIntegerFeedbackState;
  1374. \fP
  1375. .DE
  1376. .LP
  1377. The fields of the \fBXIntegerFeedbackState\fP structure report the capabilities
  1378. of the feedback:
  1379. .IP \(bu 3n
  1380. \fBresolution\fP specifies the number of digits that the feedback can display.
  1381. .IP \(bu 3n
  1382. \fBminVal\fP specifies the minimum value that the feedback can display.
  1383. .IP \(bu 3n
  1384. \fBmaxVal\fP specifies the maximum value that the feedback can display.
  1385. .LI
  1386. \fBString\fP feedbacks are those that can display character information.  
  1387. Clients set these feedbacks by passing a list of \fBKeySyms\fP to be displayed.
  1388. The \fBXGetFeedbackControl\fP function returns the
  1389. set of key symbols that the feedback can display, as well as the 
  1390. maximum number of symbols that can be displayed.
  1391. .LP
  1392. .DS
  1393. \f(C
  1394. typedef struct {
  1395.     XID     class;
  1396.     int     length;
  1397.     XID     id;
  1398.     int     max_symbols;
  1399.     int     num_syms_supported;
  1400.     KeySym  *syms_supported;
  1401. } XStringFeedbackState;
  1402. \fP
  1403. .DE
  1404. .LP
  1405. The fields of the \fBXStringFeedbackState\fP structure report the capabilities
  1406. of the feedback:
  1407. .IP \(bu 3n
  1408. \fBmax_symbols\fP specifies the maximum number of symbols that can be displayed.
  1409. .IP \(bu 3n
  1410. \fBsyms_supported\fP is a pointer to the list of supported symbols.
  1411. .IP \(bu 3n
  1412. \fBnum_syms_supported\fP specifies the length of the list of supported symbols.
  1413. .LI
  1414. \fBBell\fP feedbacks are those that can generate a sound.  Some implementations
  1415. may support a bell as part of a \fBKbdFeedback\fP feedback.  Class
  1416. \fBBellFeedback\fP is provided for implementations that do not choose to do
  1417. so, and for devices that support multiple feedbacks that can produce sound.
  1418. The meaning of the fields is the same as that of the corresponding fields in
  1419. the \fBXKbdFeedbackState\fP structure.
  1420. .LP
  1421. .DS
  1422. \f(C
  1423. typedef struct {
  1424.     XID     class;
  1425.     int     length;
  1426.     XID     id;
  1427.     int     percent;
  1428.     int     pitch;
  1429.     int     duration;
  1430. } XBellFeedbackState;
  1431. \fP
  1432. .DE
  1433. .LI
  1434. \fBLed\fP feedbacks are those that can generate a light.
  1435. Up to 32 lights per feedback are supported.  
  1436. Each bit in led_mask
  1437. corresponds to one supported light, and the corresponding bit in led_values
  1438. indicates whether that light is currently on (1) or off (0).
  1439. Some implementations may support leds as part of a \fBKbdFeedback\fP feedback.
  1440. Class \fBLedFeedback\fP is provided for implementations that do not choose to do
  1441. so, and for devices that support multiple led feedbacks.
  1442. .LP
  1443. .DS
  1444. \f(C
  1445. typedef struct {
  1446.     XID     class;
  1447.     int     length;
  1448.     XID     id;
  1449.     Mask    led_values;
  1450.     Mask    led_mask;
  1451. } XLedFeedbackState;
  1452. \fP
  1453. .DE
  1454. .LE
  1455. .LP
  1456. Errors returned by this function: \fBBadDevice\fP, \fBBadMatch\fP.
  1457. .LP
  1458. To free the information returned by the \fBXGetFeedbackControl\fP function,
  1459. use \fBXFreeFeedbackList\fP.
  1460. .DS
  1461. \f(C
  1462. void
  1463. XFreeFeedbackList (list)
  1464.         XFeedbackState *list;
  1465. \fP
  1466. .DE
  1467. .LP
  1468. .RS
  1469. .in +10n
  1470. .IP "\fIlist\fP" .75i
  1471. Specifies the pointer to the \fBXFeedbackState\fP structure returned by
  1472. a previous call to \fBXGetFeedbackControl\fP.
  1473. .in -10n
  1474. .RE
  1475. .LP
  1476. This function frees the list of feedback control information.
  1477. .LP
  1478. To change the settings of a feedback
  1479. on an extension device, use \fBXChangeFeedbackControl\fP.
  1480. This function modifies the current control values of the specified feedback
  1481. using information passed in the appropriate \fBXFeedbackControl\fP structure
  1482. for the feedback.
  1483. Which values are modified depends on the valuemask passed.
  1484. .LP
  1485. .DS
  1486. \f(C
  1487. int
  1488. XChangeFeedbackControl (display, device, valuemask, value)
  1489.         Display          *display;
  1490.         XDevice          *device;
  1491.         unsigned long    valuemask;
  1492.         XFeedbackControl *value;
  1493. \fP
  1494. .DE
  1495. .RS
  1496. .in +.5i
  1497. .IP "\fIdisplay\fP" .75i
  1498. Specifies the connection to the X server.
  1499. .IP "\fIdevice\fP"
  1500. Specifies the desired device.
  1501. .IP "\fIvaluemask\fP"
  1502. Specifies one value for each bit in the mask (least to most significant
  1503. bit).  The values are associated with the feedbacks for the specified
  1504. device.
  1505. .IP "\fIvalue\fP"
  1506. Specifies a pointer to the \fBXFeedbackControl\fP structure.
  1507. .in -.5i
  1508. .RE
  1509. .LP
  1510. This function controls the device characteristics described by the
  1511. \fBXFeedbackControl\fP structure. 
  1512. There is an \fBXFeedbackControl\fP structure for each clase of feedback.  
  1513. These are of variable length, but the first 
  1514. two fields are common to all.  The common fields are as follows:
  1515. .LP
  1516. .DS
  1517. \f(C
  1518. typedef struct {
  1519.     XID    class;
  1520.     int    length;
  1521.     XID    id;
  1522. } XFeedbackControl;
  1523. \fP
  1524. .DE
  1525. .LP
  1526. Feedback class \fBKbdFeedback\fP controls feedbacks equivalent to those
  1527. provided by the core keyboard using the \fBKbdFeedbackControl\fP structure.
  1528. The members of that structure are:
  1529. .LP
  1530. .DS
  1531. \f(C
  1532. typedef struct {
  1533.     XID     class;
  1534.     int     length;
  1535.     XID     id;
  1536.     int     click;
  1537.     int     percent;
  1538.     int     pitch;
  1539.     int     duration;
  1540.     int     led_mask;
  1541.     int     led_value;
  1542.     int     key;
  1543.     int     auto_repeat_mode;
  1544. } XKbdFeedbackControl;
  1545. \fP
  1546. .DE
  1547. .LP
  1548. This class controls the device characteristics described by the
  1549. \fBXKbdFeedbackControl\fP structure.  These include the key_click_percent,
  1550. global_auto_repeat and individual key auto-repeat.  Valid modes
  1551. are \fBAutoRepeatModeOn\fP, \fBAutoRepeatModeOff\fP,
  1552. \fBAutoRepeatModeDefault\fP.
  1553. .LP
  1554. Valid masks are as follows:
  1555. .LP
  1556. .DS
  1557. #define DvKeyClickPercent          (1L << 0)
  1558. #define DvPercent                         (1L << 1)
  1559. #define DvPitch                          (1L << 2)
  1560. #define DvDuration                       (1L << 3)
  1561. #define DvLed                              (1L << 4)
  1562. #define DvLedMode                       (1L << 5)
  1563. #define DvKey                             (1L << 6)
  1564. #define DvAutoRepeatMode          (1L << 7)
  1565. .DE
  1566. .LP
  1567. Errors returned by this function: \fBBadDevice\fP, \fBBadMatch\fP, 
  1568. \fBBadValue\fP.
  1569. .LP
  1570. Feedback class \fBPtrFeedback\fP controls feedbacks equivalent to those
  1571. provided by the core pointer using the \fBPtrFeedbackControl\fP structure.
  1572. The members of that structure are:
  1573. .DS
  1574. \f(C
  1575. typedef struct {
  1576.     XID     class;
  1577.     int     length;
  1578.     XID     id;
  1579.     int     accelNum;
  1580.     int     accelDenom;
  1581.     int     threshold;
  1582. } XPtrFeedbackControl;
  1583. \fP
  1584. .DE
  1585. .LP
  1586. Which values are modified depends on the valuemask passed.
  1587. .LP
  1588. Valid masks are as follows:
  1589. .LP
  1590. .DS
  1591. #define DvAccelnum                 (1L << 0)
  1592. #define DvAccelDenom            (1L << 1)
  1593. #define DvThreshold                 (1L << 2)
  1594. .DE
  1595. .LP
  1596. The acceleration, expressed as a fraction, is a multiplier for movement. 
  1597. For example,
  1598. specifying 3/1 means the device moves three times as fast as normal.
  1599. The fraction may be rounded arbitrarily by the X server.  
  1600. Acceleration
  1601. only takes effect if the device moves more than threshold pixels at
  1602. once and only applies to the amount beyond the value in the threshold argument.
  1603. Setting a value to -1 restores the default.
  1604. The values of the accelNumerator and threshold fields must be nonzero for
  1605. the pointer values to be set.
  1606. Otherwise, the parameters will be unchanged.
  1607. Negative values generate a \fBBadValue\fP
  1608. error, as does a zero value
  1609. for the accelDenominator field.
  1610. .LP
  1611. This request fails with a \fBBadMatch\fP error if the specified device is not
  1612. currently reporting relative motion.  If a device that is capable of reporting
  1613. both relative and absolute motion has its mode changed from \fBRelative\fP to
  1614. \fBAbsolute\fP by an \fBXSetDeviceMode\fP request, valuator control values
  1615. will be ignored by the server while the device is in that mode.
  1616. .LP
  1617. Feedback class \fBIntegerFeedback\fP controls integer feedbacks displayed
  1618. on input devices, using the \fBIntegerFeedbackControl\fP structure.
  1619. The members of that structure are:
  1620. .LP
  1621. .DS
  1622. \f(C
  1623. typedef struct {
  1624.     XID     class;
  1625.     int     length;
  1626.     XID     id;
  1627.     int     int_to_display;
  1628. } XIntegerFeedbackControl;
  1629. \fP
  1630. .DE
  1631. .LP
  1632. Valid masks are as follows:
  1633. .LP
  1634. .DS
  1635. #define DvInteger                    (1L << 0)
  1636. .DE
  1637. .LP
  1638. Feedback class \fBStringFeedback\fP controls string feedbacks displayed
  1639. on input devices, using the \fBStringFeedbackControl\fP structure.
  1640. The members of that structure are:
  1641. .LP
  1642. .DS
  1643. \f(C
  1644. typedef struct {
  1645.     XID     class;
  1646.     int     length;
  1647.     XID     id;
  1648.     int     num_keysyms;
  1649.     KeySym  *syms_to_display;
  1650. } XStringFeedbackControl;
  1651. \fP
  1652. .DE
  1653. .LP
  1654. Valid masks are as follows:
  1655. .LP
  1656. .DS
  1657. #define DvString                     (1L << 0)
  1658. .DE
  1659. .LP
  1660. Feedback class \fBBellFeedback\fP controls a bell on an input device,
  1661. using the \fBBellFeedbackControl\fP structure.
  1662. The members of that structure are:
  1663. .DS
  1664. \f(C
  1665. typedef struct {
  1666.     XID     class;
  1667.     int     length;
  1668.     XID     id;
  1669.     int     percent;
  1670.     int     pitch;
  1671.     int     duration;
  1672. } XBellFeedbackControl;
  1673. \fP
  1674. .DE
  1675. .LP
  1676. Valid masks are as follows:
  1677. .LP
  1678. .DS
  1679. #define DvPercent                    (1L << 1)
  1680. #define DvPitch                        (1L << 2)
  1681. #define DvDuration                  (1L << 3)
  1682. .DE
  1683. .LP
  1684. To ring a bell on an extension input device, use the \fBXDeviceBell\fP
  1685. protocol request.
  1686. .LP
  1687. Feedback class \fBLedFeedback\fP controls lights on an input device,
  1688. using the \fBLedFeedbackControl\fP structure.
  1689. The members of that structure are:
  1690. .DS
  1691. \f(C
  1692. typedef struct {
  1693.     XID     class;
  1694.     int     length;
  1695.     XID     id;
  1696.     int     led_mask;
  1697.     int     led_values;
  1698. } XLedFeedbackControl;
  1699. \fP
  1700. .DE
  1701. Valid masks are as follows:
  1702. .LP
  1703. .DS
  1704. #define DvLed                           (1L << 4)
  1705. #define DvLedMode                   (1L << 5)
  1706. .DE
  1707. .LP
  1708. Errors returned by this function: \fBBadDevice\fP, \fBBadMatch\fP,
  1709. \fBBadFeedBack\fP.
  1710. .NH 3
  1711. Ringing a Bell on an Input Device
  1712. .XS
  1713. \*(SN Ringing a Bell on an Input Device
  1714. .XE
  1715. .LP
  1716. To ring a bell on a extension input device, use \fBXDeviceBell\fP.
  1717. .DS
  1718. \f(C
  1719. void
  1720. XDeviceBell (display, device, feedbackclass, feedbackid, percent)
  1721.         Display *display;
  1722.         XDevice *device;
  1723.         XID    feedbackclass, feedbackid;
  1724.         int     percent;
  1725. \fP
  1726. .DE
  1727. .RS
  1728. .in +.5i
  1729. .IP "\fIdisplay\fP" .80i
  1730. Specifies the connection to the X server.
  1731. .IP "\fIdevice\fP"
  1732. Specifies the desired device.
  1733. .IP "\fIfeedbackclass\fP"
  1734. Specifies the feedbackclass.  Valid values are KbdFeedbackClass and
  1735. BellFeedbackClass.
  1736. .IP "\fIfeedbackid\fP"
  1737. Specifies the id of the feedback that has the bell.
  1738. .IP "\fIpercent\fP"
  1739. Specifies the volume in the range -100 (quiet) to 100 percent (loud).
  1740. .in -.5i
  1741. .RE
  1742. .LP
  1743. This function is analogous to the core \fBXBell\fP function.  It rings the
  1744. specified bell on the specified input device feedback, using the specified 
  1745. volume.
  1746. The specified volume is relative to the base volume for the feedback.
  1747. If the value for the percent argument is not in the range -100 to 100
  1748. inclusive, a \fBBadValue\fP error results.
  1749. The volume at which the bell rings when the percent argument is nonnegative is:
  1750. .LP
  1751. .DS
  1752.       base - [(base * percent) / 100] + percent
  1753. .DE
  1754. .LP
  1755. The volume at which the bell rings
  1756. when the percent argument is negative is:
  1757. .LP
  1758. .DS
  1759.       base + [(base * percent) / 100]
  1760. .DE
  1761. .LP
  1762. To change the base volume of the bell, use \fBXChangeFeedbackControl\fP.
  1763. .LP
  1764. Errors returned by this function: \fBBadDevice\fP, \fBBadValue\fP.
  1765. .NH 3
  1766. Controlling Device Encoding
  1767. .XS
  1768. \*(SN Controlling Device Encoding
  1769. .XE
  1770. .LP
  1771. To get the key mapping of an extension device that supports input class 
  1772. \fBKeys\fP, use 
  1773. \fBXGetDeviceKeyMapping\fP.
  1774. .DS
  1775. \f(C
  1776. KeySym
  1777. *XGetDeviceKeyMapping (display, device, first_keycode_wanted, 
  1778.     keycode_count, keysyms_per_keycode_return)
  1779.         Display *display;
  1780.         XDevice *device;
  1781.         KeyCode first_keycode_wanted;
  1782.         int     keycode_count;
  1783.         int     *keysyms_per_keycode_return;
  1784. \fP
  1785. .DE
  1786. .RS
  1787. .in +.5i
  1788. .IP "\fIdisplay\fP" .75i
  1789. Specifies the connection to the X server.
  1790. .IP "\fIdevice\fP"
  1791. Specifies the desired device.
  1792. .IP "\fIfirst_keycode_wanted\fP"
  1793. Specifies the first keycode that is to be returned.
  1794. .IP "\fIkeycode_count\fP"
  1795. Specifies the number of keycodes that are to be returned.
  1796. .IP "\fIkeysyms_per_keycode_return\fP"
  1797. Returns the number of keysyms per keycode.
  1798. .in -.5i
  1799. .RE
  1800. .LP
  1801. This function is analogous to the core \fBXGetKeyboardMapping\fP function.  
  1802. It returns the symbols for the specified number of keycodes for the 
  1803. specified extension device.
  1804. .LP
  1805. \fBXGetDeviceKeyMapping\fP returns the symbols for the 
  1806. specified number of keycodes for the 
  1807. specified extension device, starting with the specified keycode.
  1808. The first_keycode_wanted must be greater than or equal to
  1809. min-keycode as returned 
  1810. by the \fBXListInputDevices\fP request (else a \fBBadValue\fP error),
  1811. and
  1812. .LP
  1813. .DS
  1814. first_keycode_wanted + keycode_count \- 1
  1815. .DE
  1816. .LP
  1817. must be less than or equal to max-keycode as returned 
  1818. by the \fBXListInputDevices\fP request
  1819. (else a \fBBadValue\fP error).
  1820. .LP
  1821. The number of elements in the keysyms list is
  1822. .LP
  1823. .DS
  1824. keycode_count * keysyms_per_keycode_return
  1825. .DE
  1826. and KEYSYM number N (counting from zero) for keycode K has an index
  1827. (counting from zero) of
  1828. .LP
  1829. .DS
  1830. (K \- first_keycode_wanted) * keysyms_per_keycode_return + N
  1831. .DE
  1832. .LP
  1833. in keysyms.
  1834. The keysyms_per_keycode_return value is chosen arbitrarily by the server
  1835. to be large enough to report all requested symbols.
  1836. A special KEYSYM value of
  1837. \fBNoSymbol\fP
  1838. is used to fill in unused elements for individual keycodes.
  1839. .LP
  1840. You should use XFree to free the data returned by this function.
  1841. .LP
  1842. If the specified device has not first been opened by this client via
  1843. \fBXOpenDevice\fP, this request will fail with a \fBBadDevice\fP error.
  1844. If that device does not support input class Keys,
  1845. this request will fail with a \fBBadMatch\fP error.
  1846. .LP
  1847. Errors returned by this function: \fBBadDevice\fP, \fBBadMatch\fP,
  1848. \fBBadValue\fP.
  1849. .sp 2
  1850. .LP
  1851. To change the keyboard mapping of an extension device that supports input
  1852. class \fBKeys\fP, use 
  1853. \fBXChangeDeviceKeyMapping\fP.
  1854. .DS
  1855. \f(C
  1856. int
  1857. XChangeDeviceKeyMapping (display, device, first_keycode, 
  1858.     keysyms_per_keycode, keysyms, num_codes)
  1859.         Display *display;
  1860.         XDevice *device;
  1861.         int     first_keycode;
  1862.         int     keysyms_per_keycode;
  1863.         KeySym  *keysyms;
  1864.         int     num_codes;
  1865. \fP
  1866. .DE
  1867. .RS
  1868. .in +.5i
  1869. .IP "\fIdisplay\fP" .78i
  1870. Specifies the connection to the X server.
  1871. .IP "\fIdevice\fP"
  1872. Specifies the desired device.
  1873. .IP "\fIfirst_keycode\fP"
  1874. Specifies the first keycode that is to be changed.
  1875. .IP "\fIkeysyms_per_keycode\fP"
  1876. Specifies the keysyms that are to be used.
  1877. .IP "\fIkeysyms\fP"
  1878. Specifies a pointer to an array of keysyms.
  1879. .IP "\fInum_codes\fP"
  1880. Specifies the number of keycodes that are to be changed.
  1881. .in -.5i
  1882. .RE
  1883. .LP
  1884. This function is analogous to the core \fBXChangeKeyboardMapping\fP function.  
  1885. It defines the symbols for the specified number of keycodes for the 
  1886. specified extension keyboard device.
  1887. .LP
  1888. If the specified device has not first been opened by this client via
  1889. \fBXOpenDevice\fP,
  1890. this request will fail with a \fBBadDevice\fP error.
  1891. If the specified device does not support input class Keys,
  1892. this request will fail with a \fBBadMatch\fP error.
  1893. .LP
  1894. The number of elements in the keysyms list must be a multiple of
  1895. keysyms_per_keycode.  Otherwise, \fBXChangeDeviceKeyMapping\fP generates
  1896. a \fBBadLength\fP error.  The specified first_keycode must be greater
  1897. than or equal to the min_keycode value returned by the \fBListInputDevices\fP
  1898. request, or this request will fail with a \fBBadValue\fP error.  In addition,
  1899. if the following expression is not less than the max_keycode value returned by
  1900. the ListInputDevices request, the request will fail with a BadValue
  1901. error:
  1902. .LP
  1903. .DS
  1904.       first_keycode + (num_codes / keysyms_per_keycode) - 1
  1905. .DE
  1906. .LP
  1907. Errors returned by this function: \fBBadDevice\fP, \fBBadMatch\fP,
  1908. \fBBadValue\fP, \fBBadAlloc\fP.
  1909. .sp 2
  1910. .LP
  1911. To obtain the keycodes that are used as modifiers on an 
  1912. extension device that supports input class \fBKeys\fP, use
  1913. \fBXGetDeviceModifierMapping\fP.
  1914. .DS
  1915. \f(C
  1916. XModifierKeymap 
  1917. *XGetDeviceModifierMapping (display, device)
  1918.         Display *display;
  1919.         XDevice *device;
  1920. \fP
  1921. .DE
  1922. .RS
  1923. .in +.5i
  1924. .IP "\fIdisplay\fP" .75i
  1925. Specifies the connection to the X server.
  1926. .IP "\fIdevice\fP"
  1927. Specifies the desired device.
  1928. .in -.5i
  1929. .RE
  1930. .LP
  1931. This function is analogous to the core \fBXGetModifierMapping\fP function.  
  1932. The \fBXGetDeviceModifierMapping\fP function returns a newly created
  1933. \fBXModifierKeymap\fP structure that contains the keys being used as
  1934. modifiers for the specified device.  The structure should be freed after
  1935. use with \fBXFreeModifierMapping\fP.  If only zero values appear in the set
  1936. for any modifier, that modifier is disabled.
  1937. .LP
  1938. Errors returned by this function: \fBBadDevice\fP, \fBBadMatch\fP.
  1939. .sp 2
  1940. .LP
  1941. To set which keycodes that are to be used as modifiers for an extension
  1942. device, use \fBXSetDeviceModifierMapping\fP.
  1943. .DS
  1944. \f(C
  1945. int 
  1946. XSetDeviceModifierMapping (display, device, modmap)
  1947.         Display         *display;
  1948.         XDevice         *device;
  1949.         XModifierKeymap *modmap;
  1950. \fP
  1951. .DE
  1952. .RS
  1953. .in +.5i
  1954. .IP "\fIdisplay\fP" .75i
  1955. Specifies the connection to the X server.
  1956. .IP "\fIdevice\fP"
  1957. Specifies the desired device.
  1958. .IP "\fImodmap\fP"
  1959. Specifies a pointer to the \fBXModifierKeymap\fP structure.
  1960. .in -.5i
  1961. .RE
  1962. .LP
  1963. This function is analogous to the core XSetModifierMapping function.  
  1964. The \fBXSetDeviceModifierMapping\fP function specifies the keycodes of 
  1965. the keys, if any, that are to be used as modifiers.  A zero value means
  1966. that no key should be used.  No two arguments can have the same nonzero
  1967. keycode value.  Otherwise, \fBXSetDeviceModifierMapping\fP generates a
  1968. \fBBadValue\fP error.
  1969. There are eight modifiers, and the modifiermap member of the 
  1970. \fBXModifierKeymap\fP structure contains eight sets of max_keypermod 
  1971. keycodes, one for each modifier in the
  1972. order Shift, Lock, Control, Mod1, Mod2, Mod3, Mod4, and Mod5.
  1973. Only nonzero keycodes have meaning in each set, and zero keycodes
  1974. are ignored.
  1975. In addition, all of the nonzero keycodes must be in the range specified by 
  1976. min_keycode and max_keycode reported by the \fBXListInputDevices\fP function.
  1977. Otherwise, \fBXSetModifierMapping\fP generates a \fBBadValue\fP
  1978. error.
  1979. No keycode may appear twice in the entire map. 
  1980. Otherwise, it generates a \fBBadValue\fP
  1981. error.
  1982. .LP
  1983. A X server can impose restrictions on how modifiers can be changed, 
  1984. for example,
  1985. if certain keys do not generate up transitions in hardware or if multiple
  1986. modifier keys are not supported.  
  1987. If some such restriction is violated, 
  1988. the status reply is
  1989. \fBMappingFailed,\fP
  1990. and none of the modifiers are changed.
  1991. If the new keycodes specified for a modifier differ from those
  1992. currently defined and any (current or new) keys for that modifier are
  1993. in the logically down state, 
  1994. the status reply is \fBMappingBusy\fP, 
  1995. and none of the modifiers are changed.
  1996. \fBXSetModifierMapping\fP
  1997. generates a \fBDeviceMappingNotify\fP
  1998. event on a \fBMappingSuccess\fP
  1999. status.
  2000. .LP
  2001. \fBXSetDeviceModifierMapping\fP can generate \fBBadDevice\fR, \fBBadMatch\fP,
  2002. \fBBadAlloc\fP, and \fBBadValue\fP errors.
  2003. .sp 2
  2004. .NH 3
  2005. Controlling Button Mapping
  2006. .XS
  2007. \*(SN Controlling Button Mapping
  2008. .XE
  2009. .LP
  2010. To set the mapping of the buttons on an extension device, use
  2011. \fBXSetDeviceButtonMapping\fP.
  2012. .DS
  2013. \f(C
  2014. int
  2015. XSetDeviceButtonMapping (display, device, map, nmap)
  2016.         Display          *display;
  2017.         XDevice          *device;
  2018.         unsigned char    map[];
  2019.         int              nmap;
  2020. \fP
  2021. .DE
  2022. .RS
  2023. .in +.5i
  2024. .IP "\fIdisplay\fP" .75i
  2025. Specifies the connection to the X server.
  2026. .IP "\fIdevice\fP"
  2027. Specifies the desired device.
  2028. .IP "\fImap\fP"
  2029. Specifies the mapping list.
  2030. .IP "\fInmap\fP"
  2031. Specifies the number of items in the mapping list.
  2032. .in -.5i
  2033. .RE
  2034. .LP
  2035. The
  2036. \fBXSetDeviceButtonMapping\fP function sets the mapping of the buttons on
  2037. an extension device.  If it succeeds, the X server generates a
  2038. \fBDeviceMappingNotify\fP event, and \fBXSetDeviceButtonMapping\fP
  2039. returns \fBMappingSuccess\fP.
  2040. Elements of the list are indexed starting from one.
  2041. The length of the list must be the same as
  2042. \fBXGetDeviceButtonMapping\fP would return, or a \fBBadValue\fP
  2043. error results.
  2044. The index is a button number, and the element of the list
  2045. defines the effective number.
  2046. A zero element disables a button, and elements are not restricted in
  2047. value by the number of physical buttons.
  2048. However, no two elements can have the same nonzero value,
  2049. or a \fBBadValue\fP error results.
  2050. If any of the buttons to be altered are logically in the down state,
  2051. \fBXSetDeviceButtonMapping\fP returns \fBMappingBusy\fP,
  2052. and the mapping is not changed.
  2053. .LP
  2054. \fBXSetDeviceButtonMapping\fP can generate \fBBadDevice\fP, \fBBadMatch\fP,
  2055. and \fBBadValue\fP errors.
  2056. .LP
  2057. .sp
  2058. To get the button mapping, use \fBXGetDeviceButtonMapping\fP.
  2059. .sp 2
  2060. .DS
  2061. \f(C
  2062. int
  2063. XGetDeviceButtonMapping (display, device, map_return, nmap)
  2064.         Display          *display;
  2065.         XDevice          *device;
  2066.         unsigned char    map_return[];
  2067.         int              nmap;
  2068. \fP
  2069. .DE
  2070. .RS
  2071. .in +.5i
  2072. .IP "\fIdisplay\fP" .75i
  2073. Specifies the connection to the X server.
  2074. .IP "\fIdevice\fP"
  2075. Specifies the desired device.
  2076. .IP "\fImap_return\fP"
  2077. Specifies the mapping list.
  2078. .IP "\fInmap\fP"
  2079. Specifies the number of items in the mapping list.
  2080. .in -.5i
  2081. .RE
  2082. .LP
  2083. The \fBXGetDeviceButtonMapping\fP
  2084. function returns the current mapping of the specified extension device.
  2085. Elements of the list are indexed starting from one.
  2086. \fBXGetDeviceButtonMapping\fP returns the number of physical buttons actually 
  2087. on the pointer.
  2088. The nominal mapping for the buttons is the identity mapping: map[i]=i.
  2089. The nmap argument specifies the length of the array where the button
  2090. mapping is returned, and only the first nmap elements are returned 
  2091. in map_return.
  2092. .LP
  2093. Errors returned by this function: \fBBadDevice\fP, \fBBadMatch\fP.
  2094. .sp 2
  2095. .NH 3
  2096. Obtaining The State Of A Device
  2097. .XS
  2098. \*(SN Obtaining The State Of A Device
  2099. .XE
  2100. .LP
  2101. To obtain information that describes the state of the keys, buttons and 
  2102. valuators of an extension device, use \fBXQueryDeviceState\fP.
  2103. .DS
  2104. \f(C
  2105. XDeviceState 
  2106. *XQueryDeviceState (display, device)
  2107.         Display *display;
  2108.         XDevice *device;
  2109. \fP
  2110. .DE
  2111. .RS
  2112. .in +.5i
  2113. .IP "\fIdisplay\fP" .75i
  2114. Specifies the connection to the X server.
  2115. .IP "\fIdevice\fP"
  2116. Specifies the desired device.
  2117. .in -.5i
  2118. .RE
  2119. .LP
  2120. The \fBXQueryDeviceState\fP function returns a pointer to an
  2121. \fBXDeviceState\fP structure.  This structure points to a list of
  2122. structures that describe the state of the keys, buttons, and valuators 
  2123. on the device.
  2124. .DS
  2125. \f(C
  2126. typedef struct {
  2127.         XID        device_id;
  2128.         int        num_classes;
  2129.         XInputClass    *data;
  2130. } XDeviceState;
  2131. \fP
  2132. .DE
  2133. .LP
  2134. .IP \(bu 3n
  2135. The structures are of variable length, but the first 
  2136. two fields are common to all.  The common fields are as follows:
  2137. .DS
  2138. \f(C
  2139. typedef struct
  2140.     {
  2141.     unsigned char    class;
  2142.     unsigned char    length;
  2143.     } XInputClass;
  2144. \fP
  2145. .DE
  2146. .LP
  2147. The \fBclass\fP field contains a class identifier.  This identifier can be
  2148. compared with constants defined in the file \fBXI.h\fP.  Currently defined
  2149. constants are: \fBKeyClass\fP, \fBButtonClass\fP, and \fBValuatorClass\fP.
  2150. .LP
  2151. The \fBlength\fP field contains the length of the structure and can be used
  2152. by clients to traverse the list.
  2153. .LP
  2154. .IP \(bu 3n
  2155. The \fBXValuatorState\fP structure describes the current state of the valuators
  2156. on the device.  The \fBnum_valuators\fP field contains the number of valuators
  2157. on the device.  The \fBmode\fP 
  2158. field is a mask whose bits report the data mode and other state information
  2159. for the device.  The following bits are currently defined:
  2160. .DS
  2161. \f(C
  2162.     DeviceMode    1 << 0      Relative = 0, Absolute = 1
  2163.     ProximityState    1 << 1    InProximity = 0, OutOfProximity = 1
  2164. \fP
  2165. .DE
  2166. The \fBvaluators\fP field contains a pointer to an array of integers that
  2167. describe the current value of the valuators.  If the mode is \fBRelative\fP,
  2168. these values are undefined.
  2169. .LP
  2170. .DS
  2171. \f(C
  2172. typedef struct {
  2173.     unsigned char    class;
  2174.     unsigned char    length;
  2175.     unsigned char    num_valuators;
  2176.     unsigned char    mode;
  2177.     int                *valuators;
  2178. } XValuatorState;
  2179. \fP
  2180. .DE
  2181. .LP
  2182. .IP \(bu 3n
  2183. The \fBXKeyState\fP structure describes the current state of the keys
  2184. on the device.  Byte N (from 0) contains the
  2185. bits for key 8N to 8N+7 with the least significant bit in the
  2186. byte representing key 8N.
  2187. .DS
  2188. \f(C
  2189. typedef struct {
  2190.     unsigned char    class;
  2191.     unsigned char    length;
  2192.     short        num_keys;
  2193.     char            keys[32];
  2194. } XKeyState;
  2195. \fP
  2196. .DE
  2197. .IP \(bu 3n
  2198. The \fBXButtonState\fP structure describes the current state of the buttons
  2199. on the device.  Byte N (from 0) contains the
  2200. bits for button 8N to 8N+7 with the least significant bit in the
  2201. byte representing button 8N.
  2202. .DS
  2203. \f(C
  2204. typedef struct {
  2205.     unsigned char    class;
  2206.     unsigned char    length;
  2207.     short        num_buttons;
  2208.     char            buttons[32];
  2209. } XButtonState;
  2210. \fP
  2211. .DE
  2212. .LP
  2213. You should use \fBXFreeDeviceState\fP to free the data returned by this 
  2214. function.
  2215. .LP
  2216. Errors returned by this function: \fBBadDevice\fP.
  2217. .LP
  2218. .DS
  2219. \f(C
  2220. void
  2221. XFreeDeviceState (state)
  2222.         XDeviceState *state;
  2223. \fP
  2224. .DE
  2225. .LP
  2226. .RS
  2227. .in +.5i
  2228. .IP "\fIstate\fP" .75i
  2229. Specifies the pointer to the \fBXDeviceState\fP data returned by
  2230. a previous call to \fBXQueryDeviceState\fP.
  2231. .in -.5i
  2232. .RE
  2233. .LP
  2234. This function frees the device state data.
  2235. .NH 2
  2236. Events and Event-Handling Functions
  2237. .XS
  2238. \*(SN Events and Event-Handling Functions
  2239. .XE
  2240. .LP
  2241. The input extension creates input events analogous to the core input events.
  2242. These extension input events are generated by manipulating one of the
  2243. extension input devices.  The following sections describe these events
  2244. and explain how a client program can receive them.
  2245. .NH 3
  2246. Event Types
  2247. .XS
  2248. \*(SN Event Types
  2249. .XE
  2250. .LP
  2251. Event types are integer numbers that a client can use to determine what
  2252. kind of event it has received.  The client compares the type field of 
  2253. the event structure with known event types to make this determination.
  2254. .LP
  2255. The core input event types are constants and are defined in the header
  2256. file \fB<X11/X.h>\fP.  Extension event types are not constants.  Instead, they
  2257. are dynamically allocated by the extension's request to the X server
  2258. when the extension is initialized.  Because of this, extension event
  2259. types must be obtained by the client from the server.
  2260. .LP
  2261. The client program determines the event type for an extension event by using
  2262. the information returned by the \fBXOpenDevice\fP request.
  2263. This type can then be used for comparison with the type field
  2264. of events received by the client.
  2265. .LP
  2266. Extension events propagate up the window hierarchy in the same manner
  2267. as core events.  If a window is not interested in an extension event, 
  2268. it usually propagates to the closest ancestor that is interested,
  2269. unless the dont_propagate list prohibits it.
  2270. Grabs of extension devices may alter the set of windows that receive a particular
  2271. extension event.
  2272. .LP
  2273. The following table lists the event category and its associated event
  2274. type or types.
  2275. .sp
  2276. .TS
  2277. box center;
  2278. c | c
  2279. l | l.
  2280. Event Category    Event Type
  2281. =
  2282. Device key events    \fIDeviceKeyPress\fP,
  2283.     \fIDeviceKeyRelease\fP
  2284. _
  2285. Device motion events    \fIDeviceButtonPress\fP,
  2286.     \fIDeviceButtonRelease\fP,
  2287.     \fIDeviceMotionNotify\fP
  2288. _
  2289. Device input focus events    \fIDeviceFocusIn\fP,
  2290.     \fIDeviceFocusOut\fP
  2291. _
  2292. Device state notification events    \fIDeviceStateNotify\fP
  2293. _
  2294. Device proximity events    \fIProximityIn\fP,
  2295.     \fIProximityOut\fP
  2296. _
  2297. Device mapping events    \fIDeviceMappingNotify\fP
  2298. _
  2299. Device change events    \fIChangeDeviceNotify\fP
  2300. .TE
  2301. .sp
  2302. .NH 3
  2303. Event Classes
  2304. .XS
  2305. \*(SN Event Classes
  2306. .XE
  2307. .LP
  2308. Event classes are integer numbers that are used in the same way as the
  2309. core event masks.  They are used by a client program to indicate to the
  2310. server which events that client program wishes to receive.
  2311. .LP
  2312. The core input event masks are constants and are defined in the header
  2313. file \fB<X11/X.h>\fP.  Extension event classes are not constants.  Instead, 
  2314. they are dynamically allocated by the extension's request to the X server
  2315. when the extension is initialized.  Because of this, extension event
  2316. classes must be obtained by the client from the server.
  2317. .LP
  2318. The event class for an extension event and device is obtained from
  2319. information returned by the 
  2320. \fBXOpenDevice\fP function. 
  2321. This class can then be used in an \fBXSelectExtensionEvent\fP
  2322. request to ask that events of that type from that device be sent to
  2323. the client program.
  2324. .LP
  2325. For \fBDeviceButtonPress\fP events, the client may specify whether
  2326. or not an implicit passive grab should be done when the button is
  2327. pressed.  If the client wants to guarantee that it will receive
  2328. a \fBDeviceButtonRelease\fP event for each \fBDeviceButtonPress\fP
  2329. event it receives, it should specify the  \fBDeviceButtonPressGrab\fP
  2330. class in addition to the \fBDeviceButtonPress\fP class.
  2331. This restricts the client in that only one client at a time
  2332. may request \fBDeviceButtonPress\fP events from the same device and
  2333. window if any client specifies this class.
  2334. .LP
  2335. If any client has specified the \fBDeviceButtonPressGrab\fP class, any requests
  2336. by any other client that specify the same device and window and specify
  2337. either \fBDeviceButtonPress\fP or \fBDeviceButtonPressGrab\fP will
  2338. cause an \fBAccess\fP error to be generated.
  2339. .LP
  2340. If only the \fBDeviceButtonPress\fP class is specified, no implicit
  2341. passive grab will be done when a button is pressed on the device.
  2342. Multiple clients may use this class to specify the same device and
  2343. window combination.
  2344. .LP
  2345. The client may also select \fBDeviceMotion\fP events only when a 
  2346. button is down.  It does this by specifying the event classes 
  2347. \fBDeviceButton1Motion\fP through \fBDeviceButton5Motion\fP.  
  2348. An input device will only support
  2349. as many button motion classes as it has buttons.
  2350. .NH 3
  2351. Event Structures
  2352. .XS
  2353. \*(SN Event Structures
  2354. .XE
  2355. .LP
  2356. Each extension event type has a corresponding structure declared in
  2357. \fB<X11/XInput.h>\fP.  All event structures have the following members:
  2358. .RS
  2359. .in +.5i
  2360. .IP "\fItype\fP" .80i
  2361. Set to the event type number that uniquely identifies it.  For example,
  2362. when the X server reports a \fBDeviceKeyPress\fP event to a client 
  2363. application, it sends an \fBXDeviceKeyPressEvent\fP structure.
  2364. .IP "\fIdisplay\fP"
  2365. Set to a pointer to a structure that defines the display the event was read on.
  2366. .IP "\fIsend_event\fP"
  2367. Set to \fBTrue\fP if the event came from an \fBXSendEvent\fP request.
  2368. .IP "\fIserial\fP"
  2369. Set from the serial number reported in the protocol but expanded from the
  2370. 16-bit least-significant bits to a full 32-bit value.
  2371. .in -.5i
  2372. .RE
  2373. .LP
  2374. Extension event structures report the current position of the X pointer.
  2375. In addition, if the device reports motion data and is reporting absolute data,
  2376. the current value of any valuators the device contains is also reported.
  2377. .NH 4
  2378. Device Key Events
  2379. .XS
  2380. \*(SN Device Key Events
  2381. .XE
  2382. .LP
  2383. Key events from extension devices contain all the information that is
  2384. contained in a key event from the X keyboard.  In addition, they contain
  2385. a device id and report the current value of any valuators on the device,
  2386. if that device is reporting absolute data.
  2387. If data for more than six valuators is being reported, more than one
  2388. key event will be sent.
  2389. The axes_count field contains the number of axes that are being
  2390. reported.  The server sends as many of these events as are
  2391. needed to report the device data.  Each event contains the total number
  2392. of axes reported in the axes_count field, and the first axis reported
  2393. in the current event in the first_axis field.
  2394. If the device supports input class \fBValuators\fP, 
  2395. but is not reporting absolute mode data,
  2396. the axes_count field contains 0.
  2397. .LP
  2398. The location reported in 
  2399. the x,y and x_root,y_root fields is the location of the core X pointer.
  2400. .LP
  2401. The XDeviceKeyEvent structure is defined as follows:
  2402. .DS
  2403. \f(C
  2404. .ps 8
  2405. typedef struct 
  2406.     {
  2407.     int            type;         /* of event */
  2408.     unsigned long  serial;       /* # of last request processed */
  2409.     Bool           send_event;   /* true if from SendEvent request */
  2410.     Display        *display;     /* Display the event was read from */
  2411.     Window         window;       /* "event" window reported relative to */
  2412.     XID            deviceid;
  2413.     Window         root;         /* root window event occurred on */
  2414.     Window         subwindow;    /* child window */
  2415.     Time           time;         /* milliseconds */
  2416.     int            x, y;         /* x, y coordinates in event window */
  2417.     int            x_root;       /* coordinates relative to root */
  2418.     int            y_root;       /* coordinates relative to root */
  2419.     unsigned int   state;        /* key or button mask */
  2420.     unsigned int   keycode;      /* detail */
  2421.     Bool           same_screen;  /* same screen flag */
  2422.     unsigned char  axes_count;
  2423.     unsigned char  first_axis;
  2424.     unsigned int   device_state; /* device key or button mask */
  2425.     int            axis_data[6];
  2426.     } XDeviceKeyEvent;
  2427.  
  2428. typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
  2429. typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
  2430. \fP
  2431. .DE
  2432. .ps
  2433. .NH 4
  2434. Device Button Events
  2435. .XS
  2436. \*(SN Device Button Events
  2437. .XE
  2438. .LP
  2439. Button events from extension devices contain all the information that is
  2440. contained in a button event from the X pointer.  In addition, they contain
  2441. a device id and report the current value of any valuators on the device,
  2442. if that device is reporting absolute data.
  2443. If data for more than six valuators is being reported, more than one
  2444. button event may be sent.
  2445. The axes_count field contains the number of axes that are being
  2446. reported.  The server sends as many of these events as are
  2447. needed to report the device data.  Each event contains the total number
  2448. of axes reported in the axes_count field, and the first axis reported
  2449. in the current event in the first_axis field.
  2450. If the device supports input class \fBValuators\fP, 
  2451. but is not reporting absolute mode data,
  2452. the axes_count field contains 0.
  2453. .LP
  2454. The location reported in 
  2455. the x,y and x_root,y_root fields is the location of the core X pointer.
  2456. .DS
  2457. \f(C
  2458. .ps 8
  2459. typedef struct {
  2460.     int           type;         /* of event */
  2461.     unsigned long serial;       /* # of last request processed by server */
  2462.     Bool          send_event;   /* true if from a SendEvent request */
  2463.     Display       *display;     /* Display the event was read from */
  2464.     Window        window;       /* "event" window reported relative to */
  2465.     XID           deviceid;
  2466.     Window        root;         /* root window that the event occurred on */
  2467.     Window        subwindow;    /* child window */
  2468.     Time          time;         /* milliseconds */
  2469.     int           x, y;         /* x, y coordinates in event window */
  2470.     int           x_root;       /* coordinates relative to root */
  2471.     int           y_root;       /* coordinates relative to root */
  2472.     unsigned int  state;        /* key or button mask */
  2473.     unsigned int  button;       /* detail */
  2474.     Bool          same_screen;  /* same screen flag */
  2475.     unsigned char axes_count;
  2476.     unsigned char first_axis;
  2477.     unsigned int  device_state; /* device key or button mask */
  2478.     int           axis_data[6];
  2479.     } XDeviceButtonEvent;
  2480.  
  2481. typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
  2482. typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
  2483. \fP
  2484. .DE
  2485. .ps
  2486. .NH 4
  2487. Device Motion Events
  2488. .XS
  2489. \*(SN Device Motion Events
  2490. .XE
  2491. .LP
  2492. Motion events from extension devices contain all the information that is
  2493. contained in a motion event from the X pointer.  In addition, they contain
  2494. a device id and report the current value of any valuators on the device.
  2495. .LP
  2496. The location reported in 
  2497. the x,y and x_root,y_root fields is the location of the core X pointer, 
  2498. and so is 2-dimensional.
  2499. .LP
  2500. Extension motion devices may report motion data for a variable number of 
  2501. axes.  
  2502. The axes_count field contains the number of axes that are being
  2503. reported.  The server sends as many of these events as are
  2504. needed to report the device data.  Each event contains the total number
  2505. of axes reported in the axes_count field, and the first axis reported
  2506. in the current event in the first_axis field.
  2507. .LP
  2508. .DS
  2509. \f(C
  2510. .ps 8
  2511. typedef struct 
  2512.     {
  2513.     int           type;        /* of event */
  2514.     unsigned long serial;      /* # of last request processed by server */
  2515.     Bool          send_event;  /* true if from a SendEvent request */
  2516.     Display       *display;    /* Display the event was read from */
  2517.     Window        window;      /* "event" window reported relative to */
  2518.     XID           deviceid;
  2519.     Window        root;        /* root window that the event occurred on */
  2520.     Window        subwindow;   /* child window */
  2521.     Time          time;        /* milliseconds */
  2522.     int           x, y;        /* x, y coordinates in event window */
  2523.     int           x_root;      /* coordinates relative to root */
  2524.     int           y_root;      /* coordinates relative to root */
  2525.     unsigned int  state;       /* key or button mask */
  2526.     char          is_hint;     /* detail */
  2527.     Bool          same_screen; /* same screen flag */
  2528.     unsigned int  device_state; /* device key or button mask */
  2529.     unsigned char axes_count;
  2530.     unsigned char first_axis;
  2531.     int           axis_data[6];
  2532.     } XDeviceMotionEvent;
  2533. \fP
  2534. .DE
  2535. .ps
  2536. .NH 4
  2537. Device Focus Events
  2538. .XS
  2539. \*(SN Device Focus Events
  2540. .XE
  2541. .LP
  2542. These events are equivalent to the core focus events.
  2543. They contain the same information, with the addition
  2544. of a device id to identify which device has had a focus change,
  2545. and a timestamp.
  2546. .LP
  2547. \fBDeviceFocusIn\fP and \fBDeviceFocusOut\fP events are generated for
  2548. focus changes of extension devices in the same manner as core focus
  2549. events are generated.
  2550. .LP
  2551. .DS
  2552. \f(C
  2553. .ps 8
  2554. typedef struct 
  2555.     {
  2556.     int           type;       /* of event */
  2557.     unsigned long serial;     /* # of last request processed by server */
  2558.     Bool          send_event; /* true if this came from a SendEvent request */
  2559.     Display       *display;   /* Display the event was read from */
  2560.     Window        window;     /* "event" window it is reported relative to */
  2561.     XID           deviceid;
  2562.     int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
  2563.     int           detail;
  2564.     /*
  2565.      * NotifyAncestor, NotifyVirtual, NotifyInferior, 
  2566.      * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
  2567.      * NotifyPointerRoot, NotifyDetailNone 
  2568.      */
  2569.     Time                time;
  2570.     } XDeviceFocusChangeEvent;
  2571.  
  2572. typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
  2573. typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
  2574. \fP
  2575. .ps
  2576. .DE
  2577. .NH 4
  2578. Device StateNotify Event
  2579. .XS
  2580. \*(SN Device StateNotify Event
  2581. .XE
  2582. .LP
  2583. This event is analogous to the core keymap event, but
  2584. reports the current state of the device for each
  2585. input class that it supports.
  2586. It is generated after every \fBDeviceFocusIn\fP event
  2587. and \fBEnterNotify\fP  event and is delivered to clients 
  2588. who have selected \fBXDeviceStateNotify\fP events.
  2589. .LP
  2590. If the device supports input class Valuators, the mode field in the
  2591. \fBXValuatorStatus\fP structure is a bitmask that reports the device mode,
  2592. proximity state and other state information.  The
  2593. following bits are currently defined:
  2594. .DS
  2595. \f(C
  2596.     0x01        Relative = 0, Absolute = 1
  2597.     0x02        InProximity = 0, OutOfProximity = 1
  2598. \fP
  2599. .DE
  2600. .LP
  2601. If the device supports more valuators than can be reported in a single
  2602. \fBXEvent\fP, multiple \fBXDeviceStateNotify\fP events will be generated.
  2603. .LP
  2604. .DS
  2605. \f(C
  2606. .ps 8
  2607. typedef struct
  2608.     {
  2609.     unsigned char    class;
  2610.     unsigned char    length;
  2611.     } XInputClass;
  2612.  
  2613. typedef struct {
  2614.     int           type;
  2615.     unsigned long serial;       /* # of last request processed by server */
  2616.     Bool          send_event;   /* true if this came from a SendEvent request */
  2617.     Display       *display;     /* Display the event was read from */
  2618.     Window        window;
  2619.     XID           deviceid;
  2620.     Time          time;
  2621.     int           num_classes;
  2622.     char      data[64];
  2623. } XDeviceStateNotifyEvent;    
  2624. \fP
  2625. .ps
  2626. .DE
  2627. .LP
  2628. .DS
  2629. \f(C
  2630. .ps 8
  2631. typedef struct {
  2632.     unsigned char    class;
  2633.     unsigned char    length;
  2634.     unsigned char    num_valuators;
  2635.     unsigned char    mode;
  2636.     int                valuators[6];
  2637. } XValuatorStatus;
  2638. \fP
  2639. .ps
  2640. .DE
  2641. .LP
  2642. .DS
  2643. \f(C
  2644. .ps 8
  2645. typedef struct {
  2646.     unsigned char    class;
  2647.     unsigned char    length;
  2648.     short        num_keys;
  2649.     char            keys[32];
  2650. } XKeyStatus;
  2651. \fP
  2652. .ps
  2653. .DE
  2654. .LP
  2655. .DS
  2656. \f(C
  2657. .ps 8
  2658. typedef struct {
  2659.     unsigned char    class;
  2660.     unsigned char    length;
  2661.     short        num_buttons;
  2662.     char            buttons[32];
  2663. } XButtonStatus;
  2664. \fP
  2665. .ps
  2666. .DE
  2667. .NH 4
  2668. Device Mapping Event
  2669. .XS
  2670. \*(SN Device Mapping Event
  2671. .XE
  2672. .LP
  2673. This event is equivalent to the core MappingNotify event.
  2674. It notifies client programs when the mapping of keys,
  2675. modifiers, or buttons on an extension device has changed.
  2676. .LP
  2677. .DS
  2678. \f(C
  2679. typedef struct {
  2680.     int            type;
  2681.     unsigned long  serial;    
  2682.     Bool           send_event;
  2683.     Display        *display;
  2684.     Window         window;
  2685.     XID            deviceid;
  2686.     Time           time;
  2687.     int            request;
  2688.     int            first_keycode;
  2689.     int            count;
  2690. } XDeviceMappingEvent;
  2691. \fP
  2692. .DE
  2693. .NH 4
  2694. ChangeDeviceNotify Event
  2695. .XS
  2696. \*(SN ChangeDeviceNotify Event
  2697. .XE
  2698. .LP
  2699. This event has no equivalent in the core protocol.  It notifies client
  2700. programs when one of the core devices has been changed.
  2701. .LP
  2702. .DS
  2703. \f(C
  2704. typedef struct {
  2705.     int            type;
  2706.     unsigned long  serial;
  2707.     Bool           send_event;
  2708.     Display        *display;
  2709.     Window         window;
  2710.     XID            deviceid;
  2711.     Time           time;
  2712.     int            request;
  2713. } XChangeDeviceNotifyEvent;
  2714. \fP
  2715. .DE
  2716. .NH 4
  2717. Proximity Events
  2718. .XS
  2719. \*(SN Proximity Events
  2720. .XE
  2721. .LP
  2722. These events have no equivalent in the core protocol.  Some input
  2723. devices such as graphics tablets or touchscreens may send these
  2724. events to indicate that a stylus has moved into or out of contact
  2725. with a positional sensing surface.
  2726. .LP
  2727. The event contains the current value of any valuators on the device,
  2728. if that device is reporting absolute data.
  2729. If data for more than six valuators is being reported, more than one
  2730. proximity event may be sent.
  2731. The axes_count field contains the number of axes that are being
  2732. reported.  The server sends as many of these events as are
  2733. needed to report the device data.  Each event contains the total number
  2734. of axes reported in the axes_count field, and the first axis reported
  2735. in the current event in the first_axis field.
  2736. If the device supports input class \fBValuators\fP, 
  2737. but is not reporting absolute mode data,
  2738. the axes_count field contains 0.
  2739. .LP
  2740. .DS
  2741. \f(C
  2742. .ps 8
  2743. typedef struct 
  2744.     {
  2745.     int             type;      /* ProximityIn or ProximityOut */        
  2746.     unsigned long   serial;    /* # of last request processed by server */
  2747.     Bool            send_event; /* true if this came from a SendEvent request */
  2748.     Display         *display;  /* Display the event was read from */
  2749.     Window          window;      
  2750.     XID                deviceid;
  2751.     Window          root;            
  2752.     Window          subwindow;      
  2753.     Time            time;            
  2754.     int             x, y;            
  2755.     int             x_root, y_root;  
  2756.     unsigned int    state;           
  2757.     Bool            same_screen;     
  2758.     unsigned char   axes_count;
  2759.     unsigned char   first_axis;
  2760.     unsigned int    device_state; /* device key or button mask */
  2761.     int             axis_data[6];
  2762.     } XProximityNotifyEvent;
  2763. typedef XProximityNotifyEvent XProximityInEvent;
  2764. typedef XProximityNotifyEvent XProximityOutEvent;
  2765. \fP
  2766. .ps
  2767. .DE
  2768. .NH 3
  2769. Determining The Extension Version
  2770. .XS
  2771. \*(SN Determining The Extension Version
  2772. .XE
  2773. .LP
  2774. .DS
  2775. \f(C
  2776. XExtensionVersion
  2777. *XGetExtensionVersion (display, name)
  2778.         Display *display;
  2779.         char    *name;
  2780. \fP
  2781. .DE
  2782. .LP
  2783. .RS
  2784. .in +.5i
  2785. .IP "\fIdisplay\fP" .75i
  2786. Specifies the connection to the X server.
  2787. .IP "\fIname\fP"
  2788. Specifies the name of the desired extension.
  2789. .in -.5i
  2790. .RE
  2791. .LP
  2792. This function allows a client to determine if a server supports
  2793. the desired version of the input extension.
  2794. .LP
  2795. The \fBXExtensionVersion\fP structure returns information about the
  2796. version of the extension supported by the server.  The structure is
  2797. defined as follows:
  2798. .LP
  2799. .DS
  2800. \f(C
  2801. typedef struct
  2802.     {
  2803.     Bool  present;   
  2804.     short major_version;
  2805.     short minor_version;
  2806.     } XExtensionVersion;
  2807. \fP
  2808. .DE
  2809. .LP
  2810. The major and minor versions can be compared with constants defined in
  2811. the header file \fBXI.h\fP.  Each version is a superset of the previous
  2812. versions.
  2813. .LP
  2814. You should use \fBXFree\fP to free the data returned by this function.
  2815. .NH 3
  2816. Listing Available Devices
  2817. .XS
  2818. \*(SN Listing Available Devices
  2819. .XE
  2820. .LP
  2821. A client program that wishes to access a specific device
  2822. must first determine whether that device is connected to the X server.  This
  2823. is done through the
  2824. \fBXListInputDevices\fP function, which will return a list of all devices that
  2825. can be opened by the X server.  The client program can use one
  2826. of the names defined in the \fBXI.h\fP header file in an XInternAtom 
  2827. request, to determine the device type of the desired device.  This type 
  2828. can then be compared with the device types returned by the 
  2829. \fBXListInputDevices\fP request.
  2830. .LP
  2831. .DS
  2832. \f(C
  2833. XDeviceInfo 
  2834. *XListInputDevices (display, ndevices)
  2835.         Display *display;
  2836.         int     *ndevices;            /* RETURN */
  2837. \fP
  2838. .DE
  2839. .LP
  2840. .RS
  2841. .in +.5i
  2842. .IP "\fIdisplay\fP" .75i
  2843. Specifies the connection to the X server.
  2844. .IP "\fIndevices\fP"
  2845. Specifies the address of a variable into which the server
  2846. can return the number of input devices available to the X server.
  2847. .in -.5i
  2848. .RE
  2849. .LP
  2850. This function allows a client to determine which devices 
  2851. are available for X input and information about those devices.
  2852. An array of \fBXDeviceInfo\fP structures is returned, with one
  2853. element in the array for each device.  The number of devices
  2854. is returned in the \fBndevices\fP argument.
  2855. .LP
  2856. The X pointer device and X keyboard device are reported, as well as
  2857. all available extension input devices.  The use field of the 
  2858. \fBXDeviceInfo\fP structure specifies the current use of the device.
  2859. If the value of this field is \fBIsXPointer\fP, the device is the 
  2860. X pointer device.  If the value is \fBIsXKeyboard\fP, the device is
  2861. the X keyboard device.  If the value is \fBIsXExtensionDevice\fP, the
  2862. device is available for use as an extension input device.
  2863. .LP
  2864. Each \fBXDeviceInfo\fP entry contains a pointer to a list of
  2865. structures that describe the characteristics of each class
  2866. of input supported by that device.  The num_classes field
  2867. contains the number of entries in that list.
  2868. .LP
  2869. If the device supports input class \fBValuators\fP,
  2870. one of the structures pointed to by 
  2871. the \fBXDeviceInfo\fP structure will be an
  2872. \fBXValuatorInfo\fP structure.  The axes field of that structure
  2873. contains the address of an array of \fBXAxisInfo\fP structures.
  2874. There is one element in this array for each axis of motion
  2875. reported by the device.  The number of elements in this 
  2876. array is contained in the num_axes element of the 
  2877. \fBXValuatorInfo\fP structure.
  2878. The size of the motion buffer for the device is
  2879. reported in the motion_buffer field of the \fBXValuatorInfo\fP
  2880. structure.
  2881. .LP
  2882. The \fBXDeviceInfo\fP structure contains the following information:
  2883. .DS
  2884. \f(C
  2885. typedef struct _XDeviceInfo
  2886.     {
  2887.     XID                 id;        
  2888.     Atom                type;
  2889.     char                *name;
  2890.     int                 num_classes;
  2891.     int                 use;
  2892.     XAnyClassPtr     inputclassinfo;
  2893.     } XDeviceInfo;
  2894. \fP
  2895. .DE
  2896. .LP
  2897. The structures pointed to by the \fBXDeviceInfo\fP structure contain
  2898. the following information:
  2899. .DS
  2900. \f(C
  2901. typedef struct _XKeyInfo
  2902.     {
  2903.     XID                 class;
  2904.     int                 length;
  2905.     unsigned short      min_keycode;
  2906.     unsigned short      max_keycode;
  2907.     unsigned short      num_keys;
  2908.     } XKeyInfo;
  2909.  
  2910. typedef struct _XButtonInfo {
  2911.     XID            class;
  2912.     int         length;
  2913.     short     num_buttons;
  2914.     } XButtonInfo;
  2915.  
  2916. typedef struct    _XValuatorInfo
  2917.     {
  2918.     XID                 class;
  2919.     int                 length;
  2920.     unsigned char       num_axes;
  2921.     unsigned char       mode;
  2922.     unsigned long       motion_buffer;
  2923.     XAxisInfoPtr        axes;
  2924.     } XValuatorInfo;
  2925. \fP
  2926. .DE
  2927. .LP
  2928. The \fBXAxisInfo\fP structure pointed to by the \fBXValuatorInfo\fP structure 
  2929. contains the following information.
  2930. .DS
  2931. \f(C
  2932. typedef struct _XAxisInfo {
  2933.     int     resolution;
  2934.     int     min_value;
  2935.     int     max_value;
  2936.     } XAxisInfo;
  2937. \fP
  2938. .DE
  2939. .LP
  2940. The following atom names are defined in the file \fBXI.h\fP:
  2941. .DS
  2942. \f(C
  2943. \fBMOUSE\fP    
  2944. \fBTABLET\fP
  2945. \fBKEYBOARD\fP    
  2946. \fBTOUCHSCREEN\fP
  2947. \fBTOUCHPAD\fP    
  2948. \fBBUTTONBOX\fP    
  2949. \fBBARCODE\fP
  2950. \fBKNOB_BOX\fP
  2951. \fBTRACKBALL\fP    
  2952. \fBQUADRATURE\fP
  2953. \fBSPACEBALL\fP
  2954. \fBDATAGLOVE\fP
  2955. \fBEYETRACKER\fP
  2956. \fBCURSORKEYS\fP
  2957. \fBFOOTMOUSE\fP
  2958. \fBID_MODULE\fP
  2959. \fBONE_KNOB\fP
  2960. \fBNINE_KNOB\fP
  2961. \fP
  2962. .DE
  2963. .LP
  2964. These names can be used in an \fBXInternAtom\fP request to return an atom that
  2965. can be used for comparison with the type field of the 
  2966. \fBXDeviceInfo\fP structure.
  2967. .LP
  2968. This function returns NULL if there are no input devices to list.
  2969. You should use \fBXFreeDeviceList\fP to free the data returned by 
  2970. \fBXListInputDevices\fP.  
  2971. .LP
  2972. .DS 
  2973. \f(C 
  2974. void
  2975. XFreeDeviceList (list) 
  2976.     XDeviceInfo *list; 
  2977. \fP
  2978. .DE
  2979. .LP
  2980. .RS
  2981. .in +5n
  2982. .IP "\fIlist\fP"
  2983. Specifies the pointer to the \fBXDeviceInfo\fP array returned by
  2984. a previous call to \fBXListInputDevices\fP.
  2985. .in -5n
  2986. .RE
  2987. .LP
  2988. This function frees the list of input device information.
  2989. .NH 3
  2990. Enabling And Disabling Extension Devices
  2991. .XS
  2992. \*(SN Enabling And Disabling Extension Devices
  2993. .XE
  2994. .LP
  2995. Each
  2996. client program that wishes to access an extension device must request that
  2997. the server open that device.  This is done via the \fBXOpenDevice\fP
  2998. request.  That request is defined as follows:
  2999. .LP
  3000. .DS
  3001. \f(C
  3002. XDevice 
  3003. *XOpenDevice(display, device_id)
  3004.         Display *display;
  3005.         XID     device_id;
  3006. \fP
  3007. .DE
  3008. .RS
  3009. .in +.5i
  3010. .IP "\fIdisplay\fP" .75i
  3011. Specifies the connection to the X server.
  3012. .IP "\fIdevice_id\fP"
  3013. Specifies the ID that uniquely identifies the device to be opened.  This ID
  3014. is obtained from the \fBXListInputDevices\fP request.
  3015. .in -.5i
  3016. .RE
  3017. .LP
  3018. This function opens the device for the requesting client and returns an
  3019. \fBXDevice\fP structure on success.  That structure is defined as follows:
  3020. .LP
  3021. .DS
  3022. \f(C
  3023. typedef struct {
  3024.         XID                    device_id;
  3025.         int                    num_classes;
  3026.         XInputClassInfo        *classes;
  3027. } XDevice;
  3028. \fP
  3029. .DE
  3030. .LP
  3031. The \fBXDevice\fP structure contains a pointer to 
  3032. an array of \fBXInputClassInfo\fP structures.  Each element in that array
  3033. contains information about events of a particular input class supported
  3034. by the input device.
  3035. .LP
  3036. The XInputClassInfo structure is defined as follows:
  3037. .LP
  3038. .DS
  3039. \f(C
  3040. typedef struct {
  3041.         unsigned char input_class;
  3042.         unsigned char event_type_base;
  3043. } XInputClassInfo;
  3044. \fP
  3045. .DE
  3046. .LP
  3047. A client program can determine the event
  3048. type and event class for a given event by using macros defined by the 
  3049. input extension.  The name of the macro corresponds to the desired event,
  3050. and the macro is passed the structure that describes the device from which
  3051. input is desired, i.e.
  3052. .DS
  3053. \f(C
  3054.     DeviceKeyPress (XDevice *device, event_type, event_class)
  3055. \fP
  3056. .DE
  3057. .LP
  3058. The macro will fill in the values of the event class to be used in an
  3059. \fBXSelectExtensionEvent\fP request to select the event, and the event
  3060. type to be used in comparing with the event types of events received
  3061. via \fBXNextEvent\fP.
  3062. .LP
  3063. Errors returned by this function:  \fBBadDevice\fP.
  3064. .sp 2
  3065. .LP
  3066. Before terminating, the client program should request that the server close
  3067. the device. This is done via the \fBXCloseDevice\fP request.
  3068. .LP
  3069. A client may open the same extension device more than once.  Requests
  3070. after the first successful one return an additional XDevice structure
  3071. with the same information as the first, but otherwise have no effect.
  3072. A single \fBXCloseDevice\fP request will terminate that client's access to
  3073. the device.
  3074. .LP
  3075. Closing a device releases any active or passive grabs the requesting client
  3076. has established.  If the device is frozen only by an active grab of the
  3077. requesting client, any queued events are released.
  3078. .LP
  3079. If a client program terminates without closing a device, the server will
  3080. automatically close that device on behalf of the client.  This does not
  3081. affect any other clients that may be accessing that device.
  3082. .DS
  3083. \f(C
  3084. int
  3085. XCloseDevice(display, device)
  3086.         Display *display;
  3087.         XDevice *device;
  3088. \fP
  3089. .DE
  3090. .RS
  3091. .in +.5i
  3092. .IP "\fIdisplay\fP" .75i
  3093. Specifies the connection to the X server.
  3094. .IP "\fIdevice\fP"
  3095. Specifies the device to be closed.
  3096. .in -.5i
  3097. .RE    
  3098. .LP
  3099. This function closes the device for the requesting client, and frees
  3100. the \fBXDevice\fP structure.
  3101. .LP
  3102. Errors returned by this function:  \fBBadDevice\fP.
  3103. .NH 3
  3104. Changing The Mode Of A Device
  3105. .XS
  3106. \*(SN Changing The Mode Of A Device
  3107. .XE
  3108. .LP
  3109. Some devices are capable of reporting either relative or absolute motion
  3110. data.  To change the mode of a device from relative to absolute, use the
  3111. \fBXSetDeviceMode\fP function.  The valid values are \fBAbsolute\fP or 
  3112. \fBRelative\fP.
  3113. .DS
  3114. \f(C
  3115. int
  3116. XSetDeviceMode (display, device, mode)
  3117.         Display *display;
  3118.         XDevice *device;
  3119.         int     mode;
  3120. \fP
  3121. .DE
  3122. .RS
  3123. .in +.5i
  3124. .IP "\fIdisplay\fP" .75i
  3125. Specifies the connection to the X server.
  3126. .IP "\fIdevice\fP"
  3127. Specifies the device whose mode should be changed.
  3128. .IP "\fImode\fP"
  3129. Specifies the mode.  You can specify one of these constants:
  3130. \fBAbsolute\fP or \fBRelative\fP.
  3131. .in -.5i
  3132. .RE    
  3133. .LP
  3134. This function allows a client to request the server to change the mode of a 
  3135. device that is capable of reporting either absolute positional data or relative
  3136. motion data.  If the device is invalid, or the client has not previously 
  3137. requested that the server open the device via an \fBXOpenDevice\fP request, 
  3138. this request will fail with a \fBBadDevice\fP error.
  3139. If the device does not support input class \fBValuators\fP, or if it is not
  3140. capable of reporting the specified mode, the request will fail with a 
  3141. \fBBadMatch\fP error.
  3142. .LP
  3143. This request will fail and return \fBDeviceBusy\fP if another client has 
  3144. already opened the device and requested a different mode.
  3145. .LP
  3146. Errors returned by this function:  \fBBadDevice\fP, \fBBadMatch\fP,
  3147. \fBBadMode\fP, \fBDeviceBusy\fP.
  3148. .NH 3
  3149. Initializing Valuators on an Input Device
  3150. .XS
  3151. \*(SN Initializing Valuators on an Input Device
  3152. .XE
  3153. .LP
  3154. Some devices that report absolute positional data can be initialized to a 
  3155. starting value.  Devices that are capable of reporting relative motion or
  3156. absolute positional data may require that their valuators be initialized 
  3157. to a starting value after the mode of the device is changed to \fBAbsolute\fP.
  3158. To initialize the valuators on such a device, use the \fBXSetDeviceValuators\fP
  3159. function.
  3160. .DS
  3161. \f(C
  3162. Status
  3163. XSetDeviceValuators (display, device, valuators, first_valuator, 
  3164.         num_valuators)
  3165.         Display *display;
  3166.         XDevice *device;
  3167.         int     *valuators, first_valuator, num_valuators;
  3168. \fP
  3169. .DE
  3170. .RS
  3171. .in +.5i
  3172. .IP "\fIdisplay\fP" .80i
  3173. Specifies the connection to the X server.
  3174. .IP "\fIdevice\fP"
  3175. Specifies the device whose valuators should be initialized.
  3176. .IP "\fIvaluators\fP"
  3177. Specifies the values to which each valuator should be set.
  3178. .IP "\fIfirst_valuator\fP"
  3179. Specifies the first valuator to be set.
  3180. .IP "\fInum_valuators\fP"
  3181. Specifies the number of valuators to be set.
  3182. .in -.5i
  3183. .RE
  3184. .LP
  3185. This function initializes the specified valuators on the specified extension
  3186. input device.  Valuators are numbered beginning with zero.  Only the valuators
  3187. in the range specified by first_valuator and num_valuators are set.  If the
  3188. number of valuators supported by the device is less than the expression
  3189. .DS
  3190. \f(C
  3191.       first_valuator + num_valuators, 
  3192. \fP
  3193. .DE
  3194. a \fBBadValue\fP error will result.
  3195. .LP
  3196. If the request succeeds, \fPSuccess\fB is returned.  If the specifed device is 
  3197. grabbed by some other client, the request will fail and a status of
  3198. \fBAlreadyGrabbed\fP will be returned.
  3199. .LP
  3200. This request can fail with \fBBadLength\fP, \fBBadDevice\fP, \fBBadMatch\fP,
  3201. and \fBBadValue\fP errors.
  3202. .NH 3 
  3203. Getting Input Device Controls
  3204. .XS
  3205. \*(SN Getting Input Device Controls
  3206. .XE
  3207. .LP
  3208. Some input devices support various configuration controls
  3209. that can be queried or changed by clients.  The set of supported
  3210. controls will vary from one input device to another.  Requests
  3211. to manipulate these controls will fail if either the target
  3212. X server or the target input device does not support the 
  3213. requested device control.
  3214. .LP
  3215. Each device control has a unique identifier.  Information
  3216. passed with each device control varies in length and is mapped
  3217. by data structures unique to that device control.
  3218. .LP
  3219. To query a device control use XGetDeviceControl.  
  3220. .LP     
  3221. .DS
  3222. \f(C
  3223. XDeviceControl
  3224. *XGetDeviceControl (display, device, control)
  3225.     Display *display;
  3226.     XDevice *device;
  3227.     int control;
  3228. \fP
  3229. .DE
  3230. .RS
  3231. .in +.5i
  3232. .IP "\fIdisplay\fP" .80i
  3233. Specifies the connection to the X server.
  3234. .IP "\fIdevice\fP"
  3235. Specifies the device whose configuration control status is to be returned.
  3236. .IP "\fIcontrol\fP"
  3237. Identifies the specific device control to be queried.
  3238. .in -.5i
  3239. .RE
  3240. .LP
  3241. This request returns the current state of the specified device 
  3242. control.  If the target X server does not support that device
  3243. control, a BadValue error will be returned.  If the specified
  3244. device does not support that device control, a BadMatch error
  3245. will be returned.
  3246. .LP
  3247. If the request is successful, a pointer to a generic 
  3248. XDeviceState structure is returned.  The information 
  3249. returned varies according to the specified control and is 
  3250. mapped by a structure appropriate for that control.  The first
  3251. two fields are common to all device controls:
  3252. .LP
  3253. .DS
  3254. \f(C
  3255. typedef struct {
  3256.       XID     control;
  3257.       int     length;
  3258. } XDeviceState;
  3259. \fP
  3260. .DE
  3261. .LP
  3262. The control may be compared to constants defined in the file
  3263. XI.h.  Currently defined device controls include DEVICE_RESOLUTION.
  3264. .LP
  3265. The information returned for the DEVICE_RESOLUTION control is
  3266. defined in the following structure:
  3267. include:
  3268. .LP
  3269. .DS
  3270. \f(C
  3271. typedef struct {
  3272.       XID     control;
  3273.       int     length;
  3274.       int     num_valuators;
  3275.       int     *resolutions;
  3276.       int     *min_resolutions;
  3277.       int     *max_resolutions;
  3278. } XDeviceResolutionState;
  3279. \fP
  3280. .DE
  3281. .LP
  3282. This device control returns a list of valuators and the range of 
  3283. valid resolutions allowed for each.  Valuators are numbered 
  3284. beginning with 0.  Resolutions for all valuators on the device are 
  3285. returned.  For each valuator i on the device, resolutions[i] returns 
  3286. the current setting of the resolution, min_resolutions[i] returns 
  3287. the minimum valid setting, and max_resolutions[i] returns the 
  3288. maximum valid setting.
  3289. .LP
  3290. When this control is specified, XGetDeviceControl will fail with
  3291. a BadMatch error if the specified device has no valuators.
  3292. .LP
  3293. Other errors returned by this request:  BadValue.
  3294. .NH 3 
  3295. Changing Input Device Controls
  3296. .XS
  3297. \*(SN Changing Input Device Controls
  3298. .XE
  3299. .LP
  3300. Some input devices support various configuration controls
  3301. that can be changed by clients.  Typically, this would be
  3302. done to initialize the device to a known state or configuration.
  3303. The set of supported controls will vary from one input device 
  3304. to another.  Requests to manipulate these controls will fail if 
  3305. either the target X server or the target input device does not 
  3306. support the requested device control.  Setting the device control 
  3307. will also fail if the target input device is grabbed by another 
  3308. client, or is open by another client and has been set to a conflicting
  3309. state.
  3310. .LP
  3311. Each device control has a unique identifier.  Information
  3312. passed with each device control varies in length and is mapped
  3313. by data structures unique to that device control.
  3314. .LP
  3315. To change a device control use XChangeDeviceControl.  
  3316. .LP     
  3317. .DS
  3318. \f(C
  3319. Status
  3320. XChangeDeviceControl (display, device, control, value)
  3321.     Display *display;
  3322.     XDevice *device;
  3323.     XID control;
  3324.     XDeviceControl *value;
  3325. \fP
  3326. .DE
  3327. .RS
  3328. .in +.5i
  3329. .IP "\fIdisplay\fP" .80i
  3330. Specifies the connection to the X server.
  3331. .IP "\fIdevice\fP"
  3332. Specifies the device whose configuration control status is to be modified.
  3333. .IP "\fIcontrol\fP"
  3334. Identifies the specific device control to be changed.
  3335. .IP "\fIvalue\fP"
  3336. Specifies a pointer to an XDeviceControl structure that describes which 
  3337. control is to be changed, and how it is to be changed.
  3338. .in -.5i
  3339. .RE
  3340. .LP
  3341. This request changes the current state of the specified device 
  3342. control.  If the target X server does not support that device
  3343. control, a BadValue error will be returned.  If the specified
  3344. device does not support that device control, a BadMatch error
  3345. will be returned.  If another client has the target device 
  3346. grabbed, a status of AlreadyGrabbed will be returned.  If 
  3347. another client has the device open and has set it to a 
  3348. conflicting state, a status of DeviceBusy will be returned.
  3349. .LP
  3350. If the request fails for any reason, the device control will not
  3351. be changed.
  3352. .LP
  3353. If the request is successful, the device control will be changed
  3354. and a status of Success will be returned.  The information passed
  3355. varies according to the specified control and is mapped by a 
  3356. structure appropriate for that control.  The first two fields are 
  3357. common to all device controls:
  3358. .LP
  3359. .DS
  3360. \f(C
  3361. typedef struct {
  3362.       XID     control;
  3363.       int     length;
  3364. } XDeviceControl;
  3365. \fP
  3366. .DE
  3367. .LP
  3368. The control may be set using constants defined in the file XI.h.  
  3369. Currently defined device controls include DEVICE_RESOLUTION.
  3370. .LP
  3371. The information that can be changed by the DEVICE_RESOLUTION 
  3372. control is defined in the following structure:
  3373. .LP
  3374. .DS
  3375. \f(C
  3376. typedef struct {
  3377.       XID     control;
  3378.       int     length;
  3379.       int     first_valuator;
  3380.       int     num_valuators;
  3381.       int     *resolutions;
  3382. } XDeviceResolutionControl;
  3383. \fP
  3384. .DE
  3385. .LP
  3386. This device control changes the resolution of the specified 
  3387. valuators on the specified extension input device.  Valuators 
  3388. are numbered beginning with zero.  Only the valuators in the range 
  3389. specified by first_valuator and num_valuators are set.  A value 
  3390. of -1 in the resolutions list indicates that the resolution for 
  3391. this valuator is not to be changed.  num_valuators specifies the 
  3392. number of valuators in the resolutions list.
  3393. .LP
  3394. When this control is specified, XChangeDeviceControl will fail with 
  3395. a BadMatch error if the specified device has no valuators.  If a 
  3396. resolution is specified that is not within the range of valid values 
  3397. (as returned by XGetDeviceControl) the request will fail with a 
  3398. BadValue error.  If the number of valuators supported by the device 
  3399. is less than the expression 
  3400. .LP   
  3401. .DS
  3402. \f(C
  3403.       first_valuator + num_valuators, 
  3404. \fP
  3405. .DE
  3406. .P  
  3407. a BadValue error will result.
  3408. .LP  
  3409. .NH 3
  3410. Selecting Extension Device Events
  3411. .XS
  3412. \*(SN Selecting Extension Device Events
  3413. .XE
  3414. .LP
  3415. Device input events are selected using the \fBXSelectExtensionEvent\fP
  3416. function.
  3417. The parameters passed are a pointer to 
  3418. a list of classes that define the desired event types and devices, a count
  3419. of the number of elements in the list, and the id of the window from which 
  3420. events are desired.
  3421. .DS
  3422. \f(C
  3423. int
  3424. XSelectExtensionEvent (display, window, event_list, event_count)
  3425.         Display     *display;
  3426.         Window      window;
  3427.         XEventClass *event_list;
  3428.         int         event_count;
  3429. \fP
  3430. .DE
  3431. .RS
  3432. .in +.5i
  3433. .IP "\fIdisplay\fP" .75i
  3434. Specifies the connection to the X server.
  3435. .IP "\fIwindow\fP"
  3436. Specifies the ID of the window from which the client wishes to receive events.
  3437. .IP "\fIevent_list\fP"
  3438. Specifies a pointer to a list of XEventClasses that specify which events are
  3439. desired.
  3440. .IP "\fIevent_count\fP"
  3441. Specifies the number of elements in the event_list.
  3442. .in -.5i
  3443. .RE    
  3444. .LP
  3445. This function requests the server to send events that match the events and
  3446. devices described by the event list and that come from the requested 
  3447. window.  
  3448. The elements of the XEventClass array are the event_class values
  3449. returned obtained by invoking a macro with the pointer to a Device
  3450. structure returned by the \fBXOpenDevice\fP request.
  3451. For example, the DeviceKeyPress macro, invoked in the form:
  3452. .DS
  3453. \f(C
  3454.     DeviceKeyPress (XDevice *device, event_type, event_class)
  3455. \fP
  3456. .DE
  3457. .LP
  3458. returns the XEventClass for DeviceKeyPress events from the specified device.
  3459. .LP
  3460. Macros are defined for the following event classes:  \fBDeviceKeyPress,
  3461. DeviceKeyRelease, DeviceButtonPress, DeviceButtonRelease, DeviceMotionNotify,
  3462. DeviceFocusIn, DeviceFocusOut, ProximityIn, ProximityOut, DeviceStateNotify,
  3463. DeviceMappingNotify, ChangeDeviceNotify, DevicePointerMotionHint,
  3464. DeviceButton1Motion, DeviceButton2Motion, DeviceButton3Motion, 
  3465. DeviceButton4Motion, DeviceButton5Motion, DeviceButtonMotion,
  3466. DeviceOwnerGrabButton,\fP and \fBDeviceButtonPressGrab\fP.
  3467. To get the next available event from within a client program, use the 
  3468. core \fBXNextEvent\fP function.  This returns the next event whether it
  3469. came from a core device or an extension device.
  3470. .LP
  3471. Succeeding XSelectExtensionEvent requests using XEventClasses for the same 
  3472. device as was specified on a previous request will replace the previous
  3473. set of selected events from that device with the new set.
  3474. .LP
  3475. Errors returned by this function:  \fBBadWindow\fP, \fBBadAccess\fP, 
  3476. \fBBadClass\fP, \fBBadLength\fP.
  3477. .NH 3
  3478. Determining Selected Device Events
  3479. .XS
  3480. \*(SN Determining Selected Device Events
  3481. .XE
  3482. .LP
  3483. To determine which extension events are currently selected from a given
  3484. window, use \fBXGetSelectedExtensionEvents\fP.
  3485. .DS
  3486. \f(C
  3487. int
  3488. XGetSelectedExtensionEvents (display, window, this_client_count, 
  3489.         this_client, all_clients_count, all_clients)
  3490.         Display     *display;
  3491.         Window      window;
  3492.         int         *this_client_count;  /* RETURN */
  3493.         XEventClass **this_client;       /* RETURN */
  3494.         int         *all_clients_count;  /* RETURN */
  3495.         XEventClass **all_clients;       /* RETURN */
  3496. \fP
  3497. .DE
  3498. .RS
  3499. .in +.5i
  3500. .IP "\fIdisplay\fP" .75i
  3501. Specifies the connection to the X server.
  3502. .IP "\fIwindow\fP"
  3503. Specifies the ID of the window from which the client wishes to receive events.
  3504. .IP "\fIthis_client_count\fP"
  3505. Specifies the number of elements in the this_client list.
  3506. .IP "\fIthis_client\fP"
  3507. Specifies a pointer to a list of XEventClasses that specify which events are
  3508. selected by this client.
  3509. .IP "\fIall_clients_count\fP"
  3510. Specifies the number of elements in the all_clients list.
  3511. .IP "\fIall_clients\fP"
  3512. Specifies a pointer to a list of XEventClasses that specify which events are
  3513. selected by all clients.
  3514. .in -.5i
  3515. .RE    
  3516. .LP
  3517. This function returns pointers to two event class arrays.  
  3518. One lists the extension events selected by this client from
  3519. the specified window.  The other lists the extension events selected by
  3520. all clients from the specified window.  This information is analogous
  3521. to that returned in the fields your_event_mask and all_event_masks of the
  3522. \fBXWindowAttributes\fP structure when an 
  3523. \fBXGetWindowAttributes\fP request is made.
  3524. .LP
  3525. You should use \fBXFree\fP to free the two arrays returned by this function.
  3526. .LP
  3527. Errors returned by this function: \fBBadWindow\fP.
  3528. .NH 3
  3529. Controlling Event Propagation
  3530. .XS
  3531. \*(SN Controlling Event Propagation
  3532. .XE
  3533. .LP
  3534. Extension events propagate up the window hierarchy in the same manner
  3535. as core events.  If a window is not interested in an extension event, 
  3536. it usually propagates to the closest ancestor that is interested,
  3537. unless the dont_propagate list prohibits it.
  3538. Grabs of extension devices may alter the set of windows that receive a 
  3539. particular extension event.
  3540. .LP
  3541. Client programs may control event propagation through the use
  3542. of the following two functions.  
  3543. .LP
  3544. \fBXChangeDeviceDontPropagateList\fP adds an event to or deletes an event from 
  3545. the do_not_propagate list of extension events for the specified window.
  3546. There is one list per window, and the list remains for the life of the window.
  3547. The list is not altered if a client that changed the list terminates.
  3548. .LP
  3549. Suppression of event propagation is not allowed for all events.  If a
  3550. specified XEventClass is invalid because suppression of that event is not
  3551. allowed, a \fBBadClass\fP error will result.
  3552. .LP
  3553. .DS
  3554. \f(C
  3555. int
  3556. XChangeDeviceDontPropagateList (display, window, event_count, 
  3557.         events, mode)
  3558.     Display     *display;
  3559.     Window      window;
  3560.     int         event_count;
  3561.     XEventClass *events;
  3562.     int         mode;
  3563. \fP
  3564. .DE
  3565. .LP
  3566. .RS
  3567. .in +.5i
  3568. .IP "\fIdisplay\fP" .75i
  3569. Specifies the connection to the X server.
  3570. .IP "\fIwindow\fP"
  3571. Specifies the desired window.
  3572. .IP "\fIevent_count\fP"
  3573. Specifies the number of elements in the events list.
  3574. .IP "\fIevents\fP"
  3575. Specifies a pointer to the list of XEventClasses.
  3576. .IP "\fImode\fP"
  3577. Specifies the mode.  You may use the constants \fBAddToList\fP or
  3578. \fBDeleteFromList\fP.
  3579. .in -.5i
  3580. .RE
  3581. .LP
  3582. This function can return \fBBadWindow\fP, \fBBadClass\fP, and
  3583. \fBBadMode\fP errors.
  3584. .sp 2
  3585. .LP
  3586. \fBXGetDeviceDontPropagateList\fP allows a client to determine the 
  3587. do_not_propagate list of extension events for the specified window.
  3588. .LP
  3589. .DS
  3590. \f(C
  3591. XEventClass
  3592. *XGetDeviceDontPropagateList (display, window, event_count)
  3593.     Display *display;
  3594.     Window  window;
  3595.     int     *event_count;    /*RETURN */
  3596. \fP
  3597. .DE
  3598. .LP
  3599. .RS
  3600. .in +.5i
  3601. .IP "\fIdisplay\fP" .75i
  3602. Specifies the connection to the X server.
  3603. .IP "\fIwindow\fP"
  3604. Specifies the desired window.
  3605. .IP "\fIevent_count\fP"
  3606. Specifies the number of elements in the array returned by this function.
  3607. .in -.5i
  3608. .RE
  3609. .LP
  3610. An array of \fBXEventClasses\fP is returned by this function.
  3611. Each XEventClass represents a device/ event type pair.
  3612. .LP
  3613. This function can return a \fBBadWindow\fP error.
  3614. .LP
  3615. You should use \fBXFree\fP to free the data returned by this function.
  3616. .NH 3
  3617. Sending An Event
  3618. .XS
  3619. \*(SN Sending An Event
  3620. .XE
  3621. .LP
  3622. \fBXSendExtensionEvent\fP allows a client to send an extension event
  3623. to another client.
  3624. .LP
  3625. .DS
  3626. \f(C
  3627. int
  3628. XSendExtensionEvent (display, device, window, propagate, 
  3629.         event_count, event_list, event)
  3630.     Display     *display;
  3631.     XDevice     *device;
  3632.     Window      window;
  3633.     Bool        propagate;
  3634.     int         event_count;
  3635.     XEventClass *event_list;
  3636.     XEvent      *event;
  3637. \fP
  3638. .DE
  3639. .LP
  3640. .RS
  3641. .in +.5i
  3642. .IP "\fIdisplay\fP" .75i
  3643. Specifies the connection to the X server.
  3644. .IP "\fIdevice\fP"
  3645. Specifies the device whose ID is recorded in the event.
  3646. .IP "\fIwindow\fP"
  3647. Specifies the destination window ID.  You can pass a window ID,
  3648. \fBPointerWindow\fP or \fBInputFocus\fP.
  3649. .IP "\fIpropagate\fP"
  3650. Specifies a boolean value that is either True or False.
  3651. .IP "\fIevent_count\fP"
  3652. Specifies the number of elements in the event_list array.
  3653. .IP "\fIevent_list\fP"
  3654. Specifies a pointer to an array of XEventClasses.
  3655. .IP "\fIevent\fP"
  3656. Specifies a pointer to the event that is to be sent.
  3657. .in -.5i
  3658. .RE
  3659. .LP
  3660. The XSendExtensionEvent function identifies the destination window,
  3661. determines which clients should receive the specified event, and ignores
  3662. any active grabs.  This function requires a list of XEventClasses to be
  3663. specified.  These are obtained by opening an input device with the
  3664. XOpenDevice request.
  3665. .LP
  3666. This function uses the \fBwindow\fP argument to identify the destination
  3667. window as follows:
  3668. .IP \(bu 3n
  3669. If you pass \fBPointerWindow\fP, the destination window is the window
  3670. that contains the pointer.
  3671. .IP \(bu 3n
  3672. If you pass \fBInputFocus\fP, and if the focus window contains the pointer,
  3673. the destination window is the window that contains the pointer.  If the 
  3674. focus window does not contain the pointer, the destination window is the 
  3675. focus window.
  3676. .LP
  3677. To determine which clients should receive the specified events, 
  3678. \fBXSendExtensionEvent\fP uses the propagate argument as follows:
  3679. .IP \(bu 3n
  3680. If propagate is \fBFalse\fP, the event is sent to every client selecting
  3681. from the destination window
  3682. any of the events specified in the event_list array.
  3683. .IP \(bu 3n
  3684. If propagate is \fBTrue\fP, and no clients have selected
  3685. from the destination window
  3686. any of the events specified in the event_list array, the destination is 
  3687. replaced with the closest ancestor of destination for which some client
  3688. has selected one of the specified events, and for which no intervening
  3689. window has that event in its do_not_propagate mask.  If no such window
  3690. exists, or if the window is an ancestor of the focus window, and 
  3691. \fBInputFocus\fP was originally specified as the destination, the event
  3692. is not sent to any clients.  Otherwise, the event is reported to every
  3693. client selecting on the final destination any of the events specified
  3694. in event_list.
  3695. .LP
  3696. The event in the \fBXEvent\fP structure must be one of the events defined
  3697. by the input extension, so that the X server can correctly byte swap the
  3698. contents as necessary.  The contents of the event are otherwise unaltered
  3699. and unchecked by the X server except to force send_event to \fBTrue\fP
  3700. in the forwarded event and to set the sequence number in the event correctly.
  3701. .LP
  3702. XSendExtensionEvent returns zero if the conversion-to-wire protocol
  3703. failed, otherwise it returns nonzero.
  3704. .LP
  3705. This function can generate \fBBadDevice\fP, \fBBadValue\fP, \fBBadWindow\fP, 
  3706. or \fBBadClass\fP errors.
  3707. .NH 3
  3708. Getting Motion History
  3709. .XS
  3710. \*(SN Getting Motion History
  3711. .XE
  3712. .LP
  3713. .DS
  3714. \f(C
  3715. XDeviceTimeCoord 
  3716. *XGetDeviceMotionEvents (display, device, start, stop, 
  3717.         nevents_return, mode_return, axis_count_return);
  3718.         Display *display;
  3719.         XDevice *device;
  3720.         Time    start, stop;
  3721.         int     *nevents_return;
  3722.         int     *mode_return;
  3723.         int     *axis_count_return;
  3724. \fP
  3725. .DE
  3726. .LP
  3727. .RS
  3728. .in +.5i
  3729. .IP "\fIdisplay\fP" .75i
  3730. Specifies the connection to the X server.
  3731. .IP "\fIdevice\fP"
  3732. Specifies the desired device.
  3733. .IP "\fIstart\fP"
  3734. Specifies the start time.
  3735. .IP "\fIstop\fP"
  3736. Specifies the stop time.
  3737. .IP "\fInevents_return\fP"
  3738. Specifies the address of a variable into which the server
  3739. will return the number of positions in the motion buffer returned
  3740. for this request.
  3741. .IP "\fImode_return\fP"
  3742. Specifies the address of a variable into which the server
  3743. will return the mode of the nevents information.  The mode will be
  3744. one of the following: \fBAbsolute\fP or \fBRelative\fP.
  3745. .IP "\fIaxis_count_return\fP"
  3746. Specifies the address of a variable into which the server
  3747. will return the number of axes reported in each of the positions returned.
  3748. .in -.5i
  3749. .RE
  3750. .LP
  3751. This function returns all positions in the device's motion history buffer
  3752. that fall between the specified start and stop times inclusive.  If the
  3753. start time is in the future, or is later than the stop time, no positions
  3754. are returned.
  3755. .LP
  3756. The return type for this function is a structure defined as follows:
  3757. .DS
  3758. \f(C
  3759. typedef struct {
  3760.         Time time;
  3761.         unsigned int *data;
  3762. } XDeviceTimeCoord;
  3763. \fP
  3764. .DE
  3765. .LP
  3766. The data field of the \fBXDeviceTimeCoord\fP structure is a pointer to an 
  3767. array of data items.  Each item is of type int, and there is one data item
  3768. per axis of motion reported by the device.  The number of axes reported
  3769. by the device is returned in the axis_count variable.
  3770. .LP
  3771. The value of the data items depends on the mode of the device. 
  3772. The mode is returned in the mode variable.  If the 
  3773. mode is \fBAbsolute\fP, the data items are the raw values generated by
  3774. the device.  These may be scaled by the client program using the
  3775. maximum values that the device can generate for each axis of motion
  3776. that it reports.  The maximum value for each axis is reported in
  3777. the max_val field of the \fBXAxisInfo\fP structure.  This structure is 
  3778. part of the information returned by the \fBXListInputDevices\fP request.
  3779. .LP
  3780. If the mode is \fBRelative\fP, the data items are the relative values
  3781. generated by the device.  The client program must choose an initial
  3782. position for the device and maintain a current position by 
  3783. accumulating these relative values.
  3784. .LP
  3785. Consecutive calls to this function may return data of different modes, if
  3786. some client program has changed the mode of the device via an
  3787. \fBXSetDeviceMode\fP request.
  3788. .LP
  3789. You should use \fBXFreeDeviceMotionEvents\fP to free the data returned by this 
  3790. function.
  3791. .LP
  3792. Errors returned by this function:  \fBBadDevice\fP, \fBBadMatch\fP.
  3793. .LP
  3794. .DS
  3795. \f(C
  3796. void
  3797. XFreeDeviceMotionEvents (events)
  3798.         XDeviceTimeCoord *events;
  3799. \fP
  3800. .DE
  3801. .LP
  3802. .RS
  3803. .in +.5i
  3804. .IP "\fIevents\fP"
  3805. Specifies the pointer to the \fBXDeviceTimeCoord\fP array returned by
  3806. a previous call to \fBXGetDeviceMotionEvents\fP.
  3807. .in -.5i
  3808. .RE
  3809. .LP
  3810. This function frees the array of motion information.
  3811. .\"
  3812. .\"
  3813. .\"  Appendicies
  3814. .\"
  3815. .\"
  3816. .bp
  3817. .ds Ch ~
  3818. .nr H1 1
  3819. .LP
  3820. The following information is contained in the \fB<X11/XInput.h>\fP
  3821. header file:
  3822. .DS 0
  3823. .cs CW 20
  3824. \f(C
  3825. .ps 8
  3826.  
  3827. /* $Header: library.ms,v 1.6 91/07/28 15:58:08 rws Exp $ */
  3828. /************************************************************
  3829. Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California, and the 
  3830. Massachusetts Institute of Technology, Cambridge, Massachusetts.
  3831.  
  3832.             All Rights Reserved
  3833.  
  3834. Permission to use, copy, modify, and distribute this software and its
  3835. documentation for any purpose and without fee is hereby granted,
  3836. provided that the above copyright notice appear in all copies and that
  3837. both that copyright notice and this permission notice appear in
  3838. supporting documentation, and that the names of Hewlett-Packard or MIT not be
  3839. used in advertising or publicity pertaining to distribution of the
  3840. software without specific, written prior permission.
  3841.  
  3842. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  3843. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  3844. HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  3845. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  3846. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  3847. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  3848. SOFTWARE.
  3849.  
  3850. ********************************************************/
  3851.  
  3852. /* Definitions used by the library and client */
  3853.  
  3854. #ifndef _XINPUT_H_
  3855. #define _XINPUT_H_
  3856.  
  3857. #ifndef _XLIB_H_
  3858. #include <X11/Xlib.h>
  3859. #endif
  3860.  
  3861. #ifndef _XI_H_
  3862. #include "XI.h"
  3863. #endif
  3864.  
  3865. #define _deviceKeyPress        0
  3866. #define _deviceKeyRelease    1
  3867.  
  3868. #define _deviceButtonPress    0
  3869. #define _deviceButtonRelease    1
  3870.  
  3871. #define _deviceMotionNotify    0
  3872.  
  3873. #define _deviceFocusIn        0
  3874. #define _deviceFocusOut        1
  3875.  
  3876. #define _proximityIn        0
  3877. #define _proximityOut        1
  3878.  
  3879. #define _deviceStateNotify    0
  3880. #define _deviceMappingNotify    1
  3881. #define _changeDeviceNotify    2
  3882.  
  3883. #define FindTypeAndClass(d, type, class, classid, offset) \
  3884.     { int i; XInputClassInfo *ip; \
  3885.     type = 0; class = 0; \
  3886.     for (i=0, ip= ((XDevice *) d)->classes; \
  3887.      i< ((XDevice *) d)->num_classes; \
  3888.      i++, ip++) \
  3889.     if (ip->input_class == classid) \
  3890.         {type =  ip->event_type_base + offset; \
  3891.          class =  ((XDevice *) d)->device_id << 8 | type;}}
  3892.  
  3893. #define DeviceKeyPress(d, type, class) \
  3894.     FindTypeAndClass(d, type, class, KeyClass, _deviceKeyPress)
  3895.  
  3896. #define DeviceKeyRelease(d, type, class) \
  3897.     FindTypeAndClass(d, type, class, KeyClass, _deviceKeyRelease)
  3898.  
  3899. #define DeviceButtonPress(d, type, class) \
  3900.     FindTypeAndClass(d, type, class, ButtonClass, _deviceButtonPress)
  3901.  
  3902. #define DeviceButtonRelease(d, type, class) \
  3903.     FindTypeAndClass(d, type, class, ButtonClass, _deviceButtonRelease)
  3904.  
  3905. #define DeviceMotionNotify(d, type, class) \
  3906.     FindTypeAndClass(d, type, class, ValuatorClass, _deviceMotionNotify)
  3907.  
  3908. #define DeviceFocusIn(d, type, class) \
  3909.     FindTypeAndClass(d, type, class, FocusClass, _deviceFocusIn)
  3910.  
  3911. #define DeviceFocusOut(d, type, class) \
  3912.     FindTypeAndClass(d, type, class, FocusClass, _deviceFocusOut)
  3913.  
  3914. #define ProximityIn(d, type, class) \
  3915.     FindTypeAndClass(d, type, class, ProximityClass, _proximityIn)
  3916.  
  3917. #define ProximityOut(d, type, class) \
  3918.     FindTypeAndClass(d, type, class, ProximityClass, _proximityOut)
  3919.  
  3920. #define DeviceStateNotify(d, type, class) \
  3921.     FindTypeAndClass(d, type, class, OtherClass, _deviceStateNotify)
  3922.  
  3923. #define DeviceMappingNotify(d, type, class) \
  3924.     FindTypeAndClass(d, type, class, OtherClass, _deviceMappingNotify)
  3925.  
  3926. #define ChangeDeviceNotify(d, type, class) \
  3927.     FindTypeAndClass(d, type, class, OtherClass, _changeDeviceNotify)
  3928.  
  3929. #define DevicePointerMotionHint(d, type, class) \
  3930.     { class =  ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
  3931.  
  3932. #define DeviceButton1Motion(d, type, class) \
  3933.     { class =  ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;}
  3934.  
  3935. #define DeviceButton2Motion(d, type, class) \
  3936.     { class =  ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;}
  3937.  
  3938. #define DeviceButton3Motion(d, type, class) \
  3939.     { class =  ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;}
  3940.  
  3941. #define DeviceButton4Motion(d, type, class) \
  3942.     { class =  ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;}
  3943.  
  3944. #define DeviceButton5Motion(d, type, class) \
  3945.     { class =  ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;}
  3946.  
  3947. #define DeviceButtonMotion(d, type, class) \
  3948.     { class =  ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;}
  3949.  
  3950. #define DeviceOwnerGrabButton(d, type, class) \
  3951.     { class =  ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;}
  3952.  
  3953. #define DeviceButtonPressGrab(d, type, class) \
  3954.     { class =  ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;}
  3955.  
  3956. #define NoExtensionEvent(d, type, class) \
  3957.     { class =  ((XDevice *) d)->device_id << 8 | _noExtensionEvent;}
  3958.  
  3959. #define BadDevice(dpy, error) _xibaddevice(dpy, &error)
  3960.  
  3961. #define BadClass(dpy, error) _xibadclass(dpy, &error)
  3962.  
  3963. #define BadEvent(dpy, error) _xibadevent(dpy, &error)
  3964.  
  3965. #define BadMode(dpy, error) _xibadmode(dpy, &error)
  3966.  
  3967. #define DeviceBusy(dpy, error) _xidevicebusy(dpy, &error)
  3968.  
  3969. /***************************************************************
  3970.  *
  3971.  * DeviceKey events.  These events are sent by input devices that
  3972.  * support input class Keys.
  3973.  * The location of the X pointer is reported in the coordinate
  3974.  * fields of the x,y and x_root,y_root fields.
  3975.  *
  3976.  */
  3977.  
  3978. typedef struct 
  3979.     {
  3980.     int            type;         /* of event */
  3981.     unsigned long  serial;       /* # of last request processed */
  3982.     Bool           send_event;   /* true if from SendEvent request */
  3983.     Display        *display;     /* Display the event was read from */
  3984.     Window         window;       /* "event" window reported relative to */
  3985.     XID            deviceid;
  3986.     Window         root;         /* root window event occured on */
  3987.     Window         subwindow;    /* child window */
  3988.     Time           time;         /* milliseconds */
  3989.     int            x, y;         /* x, y coordinates in event window */
  3990.     int            x_root;       /* coordinates relative to root */
  3991.     int            y_root;       /* coordinates relative to root */
  3992.     unsigned int   state;        /* key or button mask */
  3993.     unsigned int   keycode;      /* detail */
  3994.     Bool           same_screen;  /* same screen flag */
  3995.     unsigned int   device_state; /* device key or button mask */
  3996.     unsigned char  axes_count;
  3997.     unsigned char  first_axis;
  3998.     int            axis_data[6];
  3999.     } XDeviceKeyEvent;
  4000.  
  4001. typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
  4002. typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
  4003.  
  4004. /*******************************************************************
  4005.  *
  4006.  * DeviceButton events.  These events are sent by extension devices
  4007.  * that support input class Buttons.
  4008.  *
  4009.  */
  4010.  
  4011. typedef struct {
  4012.     int           type;         /* of event */
  4013.     unsigned long serial;       /* # of last request processed by server */
  4014.     Bool          send_event;   /* true if from a SendEvent request */
  4015.     Display       *display;     /* Display the event was read from */
  4016.     Window        window;       /* "event" window reported relative to */
  4017.     XID           deviceid;
  4018.     Window        root;         /* root window that the event occured on */
  4019.     Window        subwindow;    /* child window */
  4020.     Time          time;         /* milliseconds */
  4021.     int           x, y;         /* x, y coordinates in event window */
  4022.     int           x_root;       /* coordinates relative to root */
  4023.     int           y_root;       /* coordinates relative to root */
  4024.     unsigned int  state;        /* key or button mask */
  4025.     unsigned int  button;       /* detail */
  4026.     Bool          same_screen;  /* same screen flag */
  4027.     unsigned int  device_state; /* device key or button mask */
  4028.     unsigned char axes_count;
  4029.     unsigned char first_axis;
  4030.     int           axis_data[6];
  4031.     } XDeviceButtonEvent;
  4032.  
  4033. typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
  4034. typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
  4035.  
  4036. /*******************************************************************
  4037.  *
  4038.  * DeviceMotionNotify event.  These events are sent by extension devices
  4039.  * that support input class Valuators.
  4040.  *
  4041.  */
  4042.  
  4043. typedef struct 
  4044.     {
  4045.     int           type;        /* of event */
  4046.     unsigned long serial;      /* # of last request processed by server */
  4047.     Bool          send_event;  /* true if from a SendEvent request */
  4048.     Display       *display;    /* Display the event was read from */
  4049.     Window        window;      /* "event" window reported relative to */
  4050.     XID           deviceid;
  4051.     Window        root;        /* root window that the event occured on */
  4052.     Window        subwindow;   /* child window */
  4053.     Time          time;        /* milliseconds */
  4054.     int           x, y;        /* x, y coordinates in event window */
  4055.     int           x_root;      /* coordinates relative to root */
  4056.     int           y_root;      /* coordinates relative to root */
  4057.     unsigned int  state;       /* key or button mask */
  4058.     char          is_hint;     /* detail */
  4059.     Bool          same_screen; /* same screen flag */
  4060.     unsigned int  device_state; /* device key or button mask */
  4061.     unsigned char axes_count;
  4062.     unsigned char first_axis;
  4063.     int           axis_data[6];
  4064.     } XDeviceMotionEvent;
  4065.  
  4066. /*******************************************************************
  4067.  *
  4068.  * DeviceFocusChange events.  These events are sent when the focus
  4069.  * of an extension device that can be focused is changed.
  4070.  *
  4071.  */
  4072.  
  4073. typedef struct 
  4074.     {
  4075.     int           type;       /* of event */
  4076.     unsigned long serial;     /* # of last request processed by server */
  4077.     Bool          send_event; /* true if from a SendEvent request */
  4078.     Display       *display;   /* Display the event was read from */
  4079.     Window        window;     /* "event" window reported relative to */
  4080.     XID           deviceid;
  4081.     int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
  4082.     int           detail;
  4083.     /*
  4084.      * NotifyAncestor, NotifyVirtual, NotifyInferior, 
  4085.      * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
  4086.      * NotifyPointerRoot, NotifyDetailNone 
  4087.      */
  4088.     Time                time;
  4089.     } XDeviceFocusChangeEvent;
  4090.  
  4091. typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
  4092. typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
  4093.  
  4094. /*******************************************************************
  4095.  *
  4096.  * ProximityNotify events.  These events are sent by those absolute
  4097.  * positioning devices that are capable of generating proximity information.
  4098.  *
  4099.  */
  4100.  
  4101. typedef struct 
  4102.     {
  4103.     int             type;      /* ProximityIn or ProximityOut */        
  4104.     unsigned long   serial;    /* # of last request processed by server */
  4105.     Bool            send_event; /* true if this came from a SendEvent request */
  4106.     Display         *display;  /* Display the event was read from */
  4107.     Window          window;      
  4108.     XID                deviceid;
  4109.     Window          root;            
  4110.     Window          subwindow;      
  4111.     Time            time;            
  4112.     int             x, y;            
  4113.     int             x_root, y_root;  
  4114.     unsigned int    state;           
  4115.     Bool            same_screen;     
  4116.     unsigned int    device_state; /* device key or button mask */
  4117.     unsigned char   axes_count;
  4118.     unsigned char   first_axis;
  4119.     int             axis_data[6];
  4120.     } XProximityNotifyEvent;
  4121. typedef XProximityNotifyEvent XProximityInEvent;
  4122. typedef XProximityNotifyEvent XProximityOutEvent;
  4123.  
  4124. /*******************************************************************
  4125.  *
  4126.  * DeviceStateNotify events are generated on EnterWindow and FocusIn 
  4127.  * for those clients who have selected DeviceState.
  4128.  *
  4129.  */
  4130.  
  4131. typedef struct
  4132.     {
  4133.     unsigned char    class;
  4134.     unsigned char    length;
  4135.     } XInputClass;
  4136.  
  4137. typedef struct {
  4138.     int           type;
  4139.     unsigned long serial;       /* # of last request processed by server */
  4140.     Bool          send_event;   /* true if this came from a SendEvent request */
  4141.     Display       *display;     /* Display the event was read from */
  4142.     Window        window;
  4143.     XID           deviceid;
  4144.     Time          time;
  4145.     int           num_classes;
  4146.     char      data[64];
  4147. } XDeviceStateNotifyEvent;    
  4148.  
  4149. typedef struct {
  4150.     unsigned char    class;
  4151.     unsigned char    length;
  4152.     unsigned char    num_valuators;
  4153.     unsigned char    mode;
  4154.     int                valuators[6];
  4155. } XValuatorStatus;
  4156.  
  4157. typedef struct {
  4158.     unsigned char    class;
  4159.     unsigned char    length;
  4160.     short        num_keys;
  4161.     char            keys[32];
  4162. } XKeyStatus;
  4163.  
  4164. typedef struct {
  4165.     unsigned char    class;
  4166.     unsigned char    length;
  4167.     short        num_buttons;
  4168.     char            buttons[32];
  4169. } XButtonStatus;
  4170.  
  4171. /*******************************************************************
  4172.  *
  4173.  * DeviceMappingNotify event.  This event is sent when the key mapping,
  4174.  * modifier mapping, or button mapping of an extension device is changed.
  4175.  *
  4176.  */
  4177.  
  4178. typedef struct {
  4179.     int           type;
  4180.     unsigned long serial;       /* # of last request processed by server */
  4181.     Bool          send_event;   /* true if this came from a SendEvent request */
  4182.     Display       *display;     /* Display the event was read from */
  4183.     Window        window;       /* unused */
  4184.     XID           deviceid;
  4185.     Time          time;
  4186.     int           request;      /* one of MappingModifier, MappingKeyboard,
  4187.                                     MappingPointer */
  4188.     int           first_keycode;/* first keycode */
  4189.     int           count;        /* defines range of change w. first_keycode*/
  4190. } XDeviceMappingEvent;
  4191.  
  4192. /*******************************************************************
  4193.  *
  4194.  * ChangeDeviceNotify event.  This event is sent when an 
  4195.  * XChangeKeyboard or XChangePointer request is made.
  4196.  *
  4197.  */
  4198.  
  4199. typedef struct {
  4200.     int           type;
  4201.     unsigned long serial;       /* # of last request processed by server */
  4202.     Bool          send_event;   /* true if this came from a SendEvent request */
  4203.     Display       *display;     /* Display the event was read from */
  4204.     Window        window;       /* unused */
  4205.     XID           deviceid;
  4206.     Time          time;
  4207.     int           request;      /* NewPointer or NewKeyboard */
  4208. } XChangeDeviceNotifyEvent;
  4209.  
  4210. /*******************************************************************
  4211.  *
  4212.  * Control structures for input devices that support input class
  4213.  * Feedback.  These are used by the XGetFeedbackControl and 
  4214.  * XChangeFeedbackControl functions.
  4215.  *
  4216.  */
  4217.  
  4218. typedef struct {
  4219.      XID            class;
  4220.      int            length;
  4221.      XID            id;
  4222. } XFeedbackState;
  4223.  
  4224. typedef struct {
  4225.     XID     class;
  4226.     int     length;
  4227.     XID     id;
  4228.     int     click;
  4229.     int     percent;
  4230.     int     pitch;
  4231.     int     duration;
  4232.     int     led_mask;
  4233.     int     global_auto_repeat;
  4234.     char    auto_repeats[32];
  4235. } XKbdFeedbackState;
  4236.  
  4237. typedef struct {
  4238.     XID     class;
  4239.     int     length;
  4240.     XID     id;
  4241.     int     accelNum;
  4242.     int     accelDenom;
  4243.     int     threshold;
  4244. } XPtrFeedbackState;
  4245.  
  4246. typedef struct {
  4247.     XID     class;
  4248.     int     length;
  4249.     XID     id;
  4250.     int     resolution;
  4251.     int     minVal;
  4252.     int     maxVal;
  4253. } XIntegerFeedbackState;
  4254.  
  4255. typedef struct {
  4256.     XID     class;
  4257.     int     length;
  4258.     XID     id;
  4259.     int     max_symbols;
  4260.     int     num_syms_supported;
  4261.     KeySym  *syms_supported;
  4262. } XStringFeedbackState;
  4263.  
  4264. typedef struct {
  4265.     XID     class;
  4266.     int     length;
  4267.     XID     id;
  4268.     int     percent;
  4269.     int     pitch;
  4270.     int     duration;
  4271. } XBellFeedbackState;
  4272.  
  4273. typedef struct {
  4274.     XID     class;
  4275.     int     length;
  4276.     XID     id;
  4277.     int     led_values;
  4278.     int     led_mask;
  4279. } XLedFeedbackState;
  4280.  
  4281. typedef struct {
  4282.      XID            class;
  4283.      int            length;
  4284.      XID        id;
  4285. } XFeedbackControl;
  4286.  
  4287. typedef struct {
  4288.     XID     class;
  4289.     int     length;
  4290.     XID     id;
  4291.     int     accelNum;
  4292.     int     accelDenom;
  4293.     int     threshold;
  4294. } XPtrFeedbackControl;
  4295.  
  4296. typedef struct {
  4297.     XID     class;
  4298.     int     length;
  4299.     XID     id;
  4300.     int     click;
  4301.     int     percent;
  4302.     int     pitch;
  4303.     int     duration;
  4304.     int     led_mask;
  4305.     int     led_value;
  4306.     int     key;
  4307.     int     auto_repeat_mode;
  4308. } XKbdFeedbackControl;
  4309.  
  4310. typedef struct {
  4311.     XID     class;
  4312.     int     length;
  4313.     XID     id;
  4314.     int     num_keysyms;
  4315.     KeySym  *syms_to_display;
  4316. } XStringFeedbackControl;
  4317.  
  4318. typedef struct {
  4319.     XID     class;
  4320.     int     length;
  4321.     XID     id;
  4322.     int     int_to_display;
  4323. } XIntegerFeedbackControl;
  4324.  
  4325. typedef struct {
  4326.     XID     class;
  4327.     int     length;
  4328.     XID     id;
  4329.     int     percent;
  4330.     int     pitch;
  4331.     int     duration;
  4332. } XBellFeedbackControl;
  4333.  
  4334. typedef struct {
  4335.     XID     class;
  4336.     int     length;
  4337.     XID     id;
  4338.     int     led_mask;
  4339.     int     led_values;
  4340. } XLedFeedbackControl;
  4341.  
  4342. /*******************************************************************
  4343.  *
  4344.  * An array of XDeviceList structures is returned by the 
  4345.  * XListInputDevices function.  Each entry contains information
  4346.  * about one input device.  Among that information is an array of 
  4347.  * pointers to structures that describe the characteristics of 
  4348.  * the input device.
  4349.  *
  4350.  */
  4351.  
  4352. typedef struct _XAnyClassinfo *XAnyClassPtr;
  4353.  
  4354. typedef struct _XAnyClassinfo {
  4355.     XID     class;
  4356.     int     length;
  4357.     } XAnyClassInfo;
  4358.  
  4359. typedef struct _XDeviceInfo *XDeviceInfoPtr;
  4360.  
  4361. typedef struct _XDeviceInfo
  4362.     {
  4363.     XID                 id;        
  4364.     Atom                type;
  4365.     char                *name;
  4366.     int                 num_classes;
  4367.     int                 use;
  4368.     XAnyClassPtr     inputclassinfo;
  4369.     } XDeviceInfo;
  4370.  
  4371. typedef struct _XKeyInfo *XKeyInfoPtr;
  4372.  
  4373. typedef struct _XKeyInfo
  4374.     {
  4375.     XID            class;
  4376.     int            length;
  4377.     unsigned short      min_keycode;
  4378.     unsigned short      max_keycode;
  4379.     unsigned short      num_keys;
  4380.     } XKeyInfo;
  4381.  
  4382. typedef struct _XButtonInfo *XButtonInfoPtr;
  4383.  
  4384. typedef struct _XButtonInfo {
  4385.     XID        class;
  4386.     int        length;
  4387.     short     num_buttons;
  4388.     } XButtonInfo;
  4389.  
  4390. typedef struct _XAxisInfo *XAxisInfoPtr;
  4391.  
  4392. typedef struct _XAxisInfo {
  4393.     int     resolution;
  4394.     int     min_value;
  4395.     int     max_value;
  4396.     } XAxisInfo;
  4397.  
  4398. typedef struct _XValuatorInfo *XValuatorInfoPtr;
  4399.  
  4400. typedef struct    _XValuatorInfo
  4401.     {
  4402.     XID            class;
  4403.     int            length;
  4404.     unsigned char       num_axes;
  4405.     unsigned char       mode;
  4406.     unsigned long       motion_buffer;
  4407.     XAxisInfoPtr        axes;
  4408.     } XValuatorInfo;
  4409.  
  4410.  
  4411. /*******************************************************************
  4412.  *
  4413.  * An XDevice structure is returned by the XOpenDevice function.  
  4414.  * It contains an array of pointers to XInputClassInfo structures.
  4415.  * Each contains information about a class of input supported by the
  4416.  * device, including a pointer to an array of data for each type of event
  4417.  * the device reports.
  4418.  *
  4419.  */
  4420.  
  4421.  
  4422. typedef struct {
  4423.         unsigned char   input_class;
  4424.         unsigned char   event_type_base;
  4425. } XInputClassInfo;
  4426.  
  4427. typedef struct {
  4428.         XID                    device_id;
  4429.         int                    num_classes;
  4430.         XInputClassInfo        *classes;
  4431. } XDevice;
  4432.  
  4433.  
  4434. /*******************************************************************
  4435.  *
  4436.  * The following structure is used to return information for the 
  4437.  * XGetSelectedExtensionEvents function.
  4438.  *
  4439.  */
  4440.  
  4441. typedef struct {
  4442.         XEventClass     event_type;
  4443.         XID             device;
  4444. } XEventList;
  4445.  
  4446. /*******************************************************************
  4447.  *
  4448.  * The following structure is used to return motion history data from 
  4449.  * an input device that supports the input class Valuators.
  4450.  * This information is returned by the XGetDeviceMotionEvents function.
  4451.  *
  4452.  */
  4453.  
  4454. typedef struct {
  4455.         Time   time;
  4456.         int    *data;
  4457. } XDeviceTimeCoord;
  4458.  
  4459.  
  4460. /*******************************************************************
  4461.  *
  4462.  * Device state structure.
  4463.  *
  4464.  */
  4465.  
  4466. typedef struct {
  4467.         XID        device_id;
  4468.         int        num_classes;
  4469.         XInputClass    *data;
  4470. } XDeviceState;
  4471.  
  4472. typedef struct {
  4473.     unsigned char    class;
  4474.     unsigned char    length;
  4475.     unsigned char    num_valuators;
  4476.     unsigned char    mode;
  4477.     int                *valuators;
  4478. } XValuatorState;
  4479.  
  4480. typedef struct {
  4481.     unsigned char    class;
  4482.     unsigned char    length;
  4483.     short        num_keys;
  4484.     char            keys[32];
  4485. } XKeyState;
  4486.  
  4487. typedef struct {
  4488.     unsigned char    class;
  4489.     unsigned char    length;
  4490.     short        num_buttons;
  4491.     char            buttons[32];
  4492. } XButtonState;
  4493.  
  4494. /*******************************************************************
  4495.  *
  4496.  * Function definitions.
  4497.  *
  4498.  */
  4499.  
  4500. XDevice                *XOpenDevice();
  4501. XDeviceInfo            *XListInputDevices();
  4502. XDeviceTimeCoord       *XGetDeviceMotionEvents();
  4503. KeySym                 *XGetDeviceKeyMapping();
  4504. XModifierKeymap        *XGetDeviceModifierMapping();
  4505. XFeedbackState         *XGetFeedbackControl();
  4506. XExtensionVersion      *XGetExtensionVersion();
  4507. XDeviceState           *XQueryDeviceState();
  4508. XEventClass            *XGetDeviceDontPropagateList();
  4509. #endif /* _XINPUT_H_ */
  4510. /* $Header: library.ms,v 1.6 91/07/28 15:58:08 rws Exp $ */
  4511.  
  4512. /************************************************************
  4513. Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California, and the 
  4514. Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4515.  
  4516.             All Rights Reserved
  4517.  
  4518. Permission to use, copy, modify, and distribute this software and its
  4519. documentation for any purpose and without fee is hereby granted,
  4520. provided that the above copyright notice appear in all copies and that
  4521. both that copyright notice and this permission notice appear in
  4522. supporting documentation, and that the names of Hewlett-Packard or MIT not be
  4523. used in advertising or publicity pertaining to distribution of the
  4524. software without specific, written prior permission.
  4525.  
  4526. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  4527. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  4528. HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  4529. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  4530. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  4531. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  4532. SOFTWARE.
  4533.  
  4534. ********************************************************/
  4535.  
  4536. /* Definitions used by the server, library and client */
  4537.  
  4538. #ifndef _XI_H_
  4539.  
  4540. #define _XI_H_
  4541.  
  4542. #define sz_xGetExtensionVersionReq        8
  4543. #define sz_xGetExtensionVersionReply        32
  4544. #define sz_xListInputDevicesReq            4
  4545. #define sz_xListInputDevicesReply        32
  4546. #define sz_xOpenDeviceReq            8
  4547. #define sz_xOpenDeviceReply            32
  4548. #define sz_xCloseDeviceReq            8
  4549. #define sz_xSetDeviceModeReq            8
  4550. #define sz_xSetDeviceModeReply            32
  4551. #define sz_xSelectExtensionEventReq        12
  4552. #define sz_xGetSelectedExtensionEventsReq    8
  4553. #define sz_xGetSelectedExtensionEventsReply    32
  4554. #define sz_xChangeDeviceDontPropagateListReq    12
  4555. #define sz_xGetDeviceDontPropagateListReq    8
  4556. #define sz_xGetDeviceDontPropagateListReply    32
  4557. #define sz_xGetDeviceMotionEventsReq        16
  4558. #define sz_xGetDeviceMotionEventsReply        32
  4559. #define sz_xChangeKeyboardDeviceReq        8
  4560. #define sz_xChangeKeyboardDeviceReply        32
  4561. #define sz_xChangePointerDeviceReq        8
  4562. #define sz_xChangePointerDeviceReply        32
  4563. #define sz_xGrabDeviceReq            20
  4564. #define sz_xGrabDeviceReply            32
  4565. #define sz_xUngrabDeviceReq            12
  4566. #define sz_xGrabDeviceKeyReq            20
  4567. #define sz_xGrabDeviceKeyReply            32
  4568. #define sz_xUngrabDeviceKeyReq            16
  4569. #define sz_xGrabDeviceButtonReq            20
  4570. #define sz_xGrabDeviceButtonReply        32
  4571. #define sz_xUngrabDeviceButtonReq        16
  4572. #define sz_xAllowDeviceEventsReq        12
  4573. #define sz_xGetDeviceFocusReq            8
  4574. #define sz_xGetDeviceFocusReply            32
  4575. #define sz_xSetDeviceFocusReq            16
  4576. #define sz_xGetFeedbackControlReq        8
  4577. #define sz_xGetFeedbackControlReply        32
  4578. #define sz_xChangeFeedbackControlReq        12
  4579. #define sz_xGetDeviceKeyMappingReq        8
  4580. #define sz_xGetDeviceKeyMappingReply        32
  4581. #define sz_xChangeDeviceKeyMappingReq        8
  4582. #define sz_xGetDeviceModifierMappingReq        8
  4583. #define sz_xSetDeviceModifierMappingReq        8
  4584. #define sz_xSetDeviceModifierMappingReply    32
  4585. #define sz_xGetDeviceButtonMappingReq        8
  4586. #define sz_xGetDeviceButtonMappingReply        32
  4587. #define sz_xSetDeviceButtonMappingReq        8
  4588. #define sz_xSetDeviceButtonMappingReply        32
  4589. #define sz_xQueryDeviceStateReq            8
  4590. #define sz_xQueryDeviceStateReply        32
  4591. #define sz_xSendExtensionEventReq        16
  4592. #define sz_xDeviceBellReq            8
  4593. #define sz_xSetDeviceValuatorsReq        8
  4594. #define sz_xSetDeviceValuatorsReply        32
  4595.  
  4596. #define INAME             "XInputExtension"
  4597.  
  4598. #define XI_KEYBOARD    "KEYBOARD"
  4599. #define XI_MOUSE    "MOUSE"
  4600. #define XI_TABLET    "TABLET"
  4601. #define XI_TOUCHSCREEN    "TOUCHSCREEN"
  4602. #define XI_TOUCHPAD    "TOUCHPAD"
  4603. #define XI_BARCODE    "BARCODE"
  4604. #define XI_BUTTONBOX    "BUTTONBOX"
  4605. #define XI_KNOB_BOX    "KNOB_BOX"
  4606. #define XI_ONE_KNOB    "ONE_KNOB"
  4607. #define XI_NINE_KNOB    "NINE_KNOB"
  4608. #define XI_TRACKBALL    "TRACKBALL"
  4609. #define XI_QUADRATURE    "QUADRATURE"
  4610. #define XI_ID_MODULE    "ID_MODULE"
  4611. #define XI_SPACEBALL    "SPACEBALL"
  4612. #define XI_DATAGLOVE    "DATAGLOVE"
  4613. #define XI_EYETRACKER    "EYETRACKER"
  4614. #define XI_CURSORKEYS    "CURSORKEYS"
  4615. #define XI_FOOTMOUSE    "FOOTMOUSE"
  4616.  
  4617. #define Dont_Check            0
  4618. #define XInput_Initial_Release        1
  4619. #define XInput_Add_XDeviceBell        2
  4620. #define XInput_Add_XSetDeviceValuators    3
  4621.  
  4622. #define XI_Absent        0
  4623. #define XI_Present        1
  4624.  
  4625. #define XI_Initial_Release_Major        1
  4626. #define XI_Initial_Release_Minor        0
  4627.  
  4628. #define XI_Add_XDeviceBell_Major        1
  4629. #define XI_Add_XDeviceBell_Minor        1
  4630.  
  4631. #define XI_Add_XSetDeviceValuators_Major    1
  4632. #define XI_Add_XSetDeviceValuators_Minor    2
  4633.  
  4634. #define NoSuchExtension        1
  4635.  
  4636. #define COUNT            0
  4637. #define CREATE            1
  4638.  
  4639. #define NewPointer        0
  4640. #define NewKeyboard        1
  4641.  
  4642. #define XPOINTER        0
  4643. #define XKEYBOARD        1
  4644.  
  4645. #define UseXKeyboard        0
  4646.  
  4647. #define IsXPointer        0
  4648. #define IsXKeyboard        1
  4649. #define IsXExtensionDevice    2
  4650.  
  4651. #define AsyncThisDevice        0
  4652. #define SyncThisDevice        1
  4653. #define ReplayThisDevice    2
  4654. #define AsyncOtherDevices    3
  4655. #define AsyncAll        4
  4656. #define SyncAll            5
  4657.  
  4658. #define FollowKeyboard         3
  4659. #define RevertToFollowKeyboard     3
  4660.  
  4661. #define DvAccelNum              (1L << 0)
  4662. #define DvAccelDenom            (1L << 1)
  4663. #define DvThreshold             (1L << 2)
  4664.  
  4665. #define DvKeyClickPercent    (1L<<0)
  4666. #define DvPercent        (1L<<1)
  4667. #define DvPitch            (1L<<2)
  4668. #define DvDuration        (1L<<3)
  4669. #define DvLed            (1L<<4)
  4670. #define DvLedMode        (1L<<5)
  4671. #define DvKey            (1L<<6)
  4672. #define DvAutoRepeatMode    (1L<<7)
  4673.  
  4674. #define DvString                (1L << 0)
  4675.  
  4676. #define DvInteger               (1L << 0)
  4677.  
  4678. #define Relative                0
  4679. #define Absolute                1
  4680.  
  4681. #define AddToList               0
  4682. #define DeleteFromList          1
  4683.  
  4684. #define KeyClass          0
  4685. #define ButtonClass          1
  4686. #define ValuatorClass          2
  4687. #define FeedbackClass          3
  4688. #define ProximityClass      4
  4689. #define FocusClass          5
  4690. #define OtherClass          6
  4691.  
  4692. #define KbdFeedbackClass      0
  4693. #define PtrFeedbackClass      1
  4694. #define StringFeedbackClass      2
  4695. #define IntegerFeedbackClass      3
  4696. #define LedFeedbackClass      4
  4697. #define BellFeedbackClass      5
  4698.  
  4699. #define _devicePointerMotionHint 0
  4700. #define _deviceButton1Motion     1
  4701. #define _deviceButton2Motion     2
  4702. #define _deviceButton3Motion     3
  4703. #define _deviceButton4Motion     4
  4704. #define _deviceButton5Motion     5
  4705. #define _deviceButtonMotion     6
  4706. #define _deviceButtonGrab     7
  4707. #define _deviceOwnerGrabButton     8
  4708. #define _noExtensionEvent     9
  4709.  
  4710. #define XI_BadDevice    0
  4711. #define XI_BadEvent    1
  4712. #define XI_BadMode    2
  4713. #define XI_DeviceBusy    3
  4714. #define XI_BadClass    4
  4715.  
  4716. typedef    unsigned long    XEventClass;
  4717.  
  4718. /*******************************************************************
  4719.  *
  4720.  * Extension version structure.
  4721.  *
  4722.  */
  4723.  
  4724. typedef struct {
  4725.         int       present;
  4726.         short    major_version;
  4727.         short    minor_version;
  4728. } XExtensionVersion;
  4729.  
  4730. #endif /* _XI_H_ */
  4731. \fP
  4732. .DE
  4733. .bp
  4734. .PX
  4735.