xkblib.pp 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  1. { $Xorg: XKBlib.h,v 1.6 2000/08/17 19:45:03 cpqbld Exp $
  2. ************************************************************
  3. Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
  4. Permission to use, copy, modify, and distribute this
  5. software and its documentation for any purpose and without
  6. fee is hereby granted, provided that the above copyright
  7. notice appear in all copies and that both that copyright
  8. notice and this permission notice appear in supporting
  9. documentation, and that the name of Silicon Graphics not be
  10. used in advertising or publicity pertaining to distribution
  11. of the software without specific prior written permission.
  12. Silicon Graphics makes no representation about the suitability
  13. of this software for any purpose. It is provided "as is"
  14. without any express or implied warranty.
  15. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  16. SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  17. AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
  18. GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  19. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  20. DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  21. OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
  22. THE USE OR PERFORMANCE OF THIS SOFTWARE.
  23. ********************************************************/
  24. $XFree86: xc/lib/X11/XKBlib.h,v 3.3 2001/08/01 00:44:38 tsi Exp $
  25. Pascal Convertion was made by Ido Kannner - [email protected]
  26. Thanks:
  27. I want to thanks to oliebol for putting up with all of the problems that was found
  28. while translating this code. ;)
  29. I want to thanks #fpc channel in freenode irc, for helping me, and to put up with my
  30. wierd questions ;)
  31. Thanks for mmc in #xlib on freenode irc And so for the channel itself for the helping me to
  32. understanding some of the problems I had converting this headers and pointing me to resources
  33. that helped translating this headers.
  34. Ido
  35. History:
  36. 2004/10/15 - Fixed a bug of accessing second based records by removing "paced record" and
  37. chnaged it to "reocrd" only.
  38. 2004/10/10 - Added to TXkbGetAtomNameFunc and TXkbInternAtomFunc the cdecl call.
  39. 2004/10/06 - 09 - Convertion from the c header of XKBlib.h
  40. }
  41. {$PACKRECORDS C}
  42. {$MODE OBJFPC} {$MACRO ON} {$DEFINE MACRO}
  43. unit xkblib;
  44. interface
  45. uses X, Xlib, XKB;
  46. type
  47. PXkbAnyEvent = ^TXkbAnyEvent;
  48. TXkbAnyEvent = record
  49. _type : Smallint; // XkbAnyEvent
  50. serial : Longword; // # of last req processed by server
  51. send_event : Boolean; // is this from a SendEvent request?
  52. display : PDisplay; // Display the event was read from
  53. time : TTime; // milliseconds;
  54. xkb_type : Smallint; // XKB event minor code
  55. device : Word; // device ID
  56. end;
  57. type
  58. PXkbNewKeyboardNotifyEvent = ^TXkbNewKeyboardNotifyEvent;
  59. TXkbNewKeyboardNotifyEvent = record
  60. _type : Smallint; // XkbAnyEvent
  61. serial : Longword; // of last req processed by server
  62. send_event : Boolean; // is this from a SendEvent request?
  63. display : PDisplay; // Display the event was read from
  64. time : TTime; // milliseconds
  65. xkb_type : Smallint; // XkbNewKeyboardNotify
  66. device : Smallint; // device ID
  67. old_device : Smallint; // device ID of previous keyboard
  68. min_key_code : Smallint; // minimum key code
  69. max_key_code : Smallint; // maximum key code
  70. old_min_key_code : Smallint; // min key code of previous kbd
  71. old_max_key_code : Smallint; // max key code of previous kbd
  72. changed : Word; // changed aspects of the keyboard
  73. req_major : Shortint; // major and minor opcode of req
  74. req_minor : Shortint; // that caused change, if applicable
  75. end;
  76. type
  77. PXkbMapNotifyEvent = ^TXkbMapNotifyEvent;
  78. TXkbMapNotifyEvent = record
  79. _type : Smallint; // XkbAnyEvent
  80. serial : Longword; // of last req processed by server
  81. send_event : Boolean; // is this from a SendEvent request
  82. display : PDisplay; // Display the event was read from
  83. time : TTime; // milliseconds
  84. xkb_type : Smallint; // XkbMapNotify
  85. device : Smallint; // device ID
  86. changed : Word; // fields which have been changed
  87. flags : Word; // reserved
  88. first_type : Smallint; // first changed key type
  89. num_types : Smallint; // number of changed key types
  90. min_key_code : TKeyCode;
  91. max_key_code : TKeyCode;
  92. first_key_sym : TKeyCode;
  93. first_key_act : TKeyCode;
  94. first_key_behavior : TKeyCode;
  95. first_key_explicit : TKeyCode;
  96. first_modmap_key : TKeyCode;
  97. first_vmodmap_key : TKeyCode;
  98. num_key_syms : Smallint;
  99. num_key_acts : Smallint;
  100. num_key_behaviors : Smallint;
  101. num_key_explicit : Smallint;
  102. num_modmap_keys : Smallint;
  103. num_vmodmap_keys : Smallint;
  104. vmods : Word; // mask of changed virtual mods
  105. end;
  106. type
  107. PXkbStateNotifyEvent = ^TXkbStateNotifyEvent;
  108. TXkbStateNotifyEvent = record
  109. _type : Smallint; // XkbAnyEvent
  110. serial : Longword; // # of last req processed by server
  111. send_event : Boolean; // is this from a SendEvent request?
  112. display : PDisplay; // Display the event was read from
  113. time : TTime; // milliseconds
  114. xkb_type : Smallint; // XkbStateNotify
  115. device : Smallint; // device ID
  116. changed : Word; // mask of changed state components
  117. group : Smallint; // keyboard group
  118. base_group : Smallint; // base keyboard group
  119. latched_group : Smallint; // latched keyboard group
  120. locked_group : Smallint; // locked keyboard group
  121. mods : Word; // modifier state
  122. base_mods : Word; // base modifier state
  123. latched_mods : Word; // latched modifiers
  124. locked_mods : Word; // locked modifiers
  125. compat_state : Smallint; // compatibility state
  126. grab_mods : Byte; // mods used for grabs
  127. compat_grab_mods : Byte; // grab mods for non-XKB clients
  128. lookup_mods : Byte; // mods sent to clients
  129. compat_lookup_mods : Byte; // mods sent to non-XKB clients
  130. ptr_buttons : Smallint; // pointer button state
  131. keycode : TKeyCode; // keycode that caused the change
  132. event_type : Shortint; // KeyPress or KeyRelease
  133. req_major : Shortint; // Major opcode of request
  134. req_minor : Shortint; // Minor opcode of request
  135. end;
  136. type
  137. PXkbControlsNotifyEvent = ^TXkbControlsNotifyEvent;
  138. TXkbControlsNotifyEvent = record
  139. _type : Smallint; // XkbAnyEvent
  140. serial : Longword; // of last req processed by server
  141. send_event : Boolean; // is this from a SendEvent request?
  142. display : PDisplay; // Display the event was read from
  143. time : TTime; // milliseconds
  144. xkb_type : Smallint; // XkbControlsNotify
  145. device : Smallint; // device ID
  146. changed_ctrls : Word; // controls with changed sub-values
  147. enabled_ctrls : Word; // controls currently enabled
  148. enabled_ctrl_changes : Word; // controls just {en,dis}abled
  149. num_groups : Smallint; // total groups on keyboard
  150. keycode : TKeyCode; // key that caused change or 0
  151. event_type : Byte; // type of event that caused change
  152. req_major : Byte; // if keycode==0, major and minor
  153. req_minor : Byte; // opcode of req that caused change
  154. end;
  155. type
  156. PXkbIndicatorNotifyEvent = ^TXkbIndicatorNotifyEvent;
  157. TXkbIndicatorNotifyEvent = record
  158. _type : Smallint; // XkbAnyEvent
  159. serial : Longword; // of last req processed by server
  160. send_event : Boolean; // is this from a SendEvent request?
  161. display : PDisplay; // Display the event was read from
  162. time : TTime; // milliseconds
  163. xkb_type : Smallint; // XkbIndicatorNotify
  164. device : Smallint; // device
  165. changed : Word; // indicators with new state or map
  166. state : Word; // current state of all indicators
  167. end;
  168. type
  169. PXkbNamesNotifyEvent = ^TXkbNamesNotifyEvent;
  170. TXkbNamesNotifyEvent = record
  171. _type : Smallint; // XkbAnyEvent
  172. serial : Longword; // of last req processed by server
  173. send_event : Boolean; // is this from a SendEvent request?
  174. display : PDisplay; // Display the event was read from
  175. time : TTime; // milliseconds
  176. xkb_type : Smallint; // XkbNamesNotify
  177. device : Smallint; // device ID
  178. changed : Longword; // names that have changed
  179. first_type : Smallint; // first key type with new name
  180. num_types : Smallint; // number of key types with new names
  181. first_lvl : Smallint; // first key type new new level names
  182. num_lvls : Smallint; // # of key types w/new level names
  183. num_aliases : Smallint; // total number of key aliases
  184. num_radio_groups : Smallint; // total number of radio groups
  185. changed_vmods : Word; // virtual modifiers with new names
  186. changed_groups : Word; // groups with new names
  187. changed_indicators : Word; // indicators with new names
  188. first_key : Smallint; // first key with new name
  189. num_keys : Smallint; // number of keys with new names
  190. end;
  191. type
  192. PXkbCompatMapNotifyEvent = ^TXkbCompatMapNotifyEvent;
  193. TXkbCompatMapNotifyEvent = record
  194. _type : Smallint; // XkbAnyEvent
  195. serial : Longword; // of last req processed by server
  196. send_event : Boolean; // is this from a SendEvent request?
  197. display : PDisplay; // Display the event was read from
  198. time : TTime; // milliseconds
  199. xkb_type : Smallint; // XkbCompatMapNotify
  200. device : Smallint; // device ID
  201. changed_groups : Word; // groups with new compat maps
  202. first_si : Smallint; // first new symbol interp
  203. num_si : Smallint; // number of new symbol interps
  204. num_total_si : Smallint; // total # of symbol interps
  205. end;
  206. type
  207. PXkbBellNotifyEvent = ^TXkbBellNotifyEvent;
  208. TXkbBellNotifyEvent = record
  209. _type : Smallint; // XkbAnyEvent
  210. serial : Longword; // of last req processed by server
  211. send_event : Boolean; // is this from a SendEvent request?
  212. display : PDisplay; // Display the event was read from
  213. time : TTime; // milliseconds
  214. xkb_type : Smallint; // XkbBellNotify
  215. device : Smallint; // device ID
  216. percent : Smallint; // requested volume as a % of maximum
  217. pitch : Smallint; // requested pitch in Hz
  218. duration : Smallint; // requested duration in useconds
  219. bell_class : Smallint; // (input extension) feedback class
  220. bell_id : Smallint; // (input extension) ID of feedback
  221. name : TAtom; // "name" of requested bell
  222. window : TWindow; // window associated with event
  223. event_only : Boolean; // "event only" requested
  224. end;
  225. type
  226. PXkbActionMessageEvent = ^TXkbActionMessageEvent;
  227. TXkbActionMessageEvent = record
  228. _type : Smallint; // XkbAnyEvent
  229. serial : Longword; // of last req processed by server
  230. send_event : Boolean; // is this from a SendEvent request?
  231. display : PDisplay; // Display the event was read from
  232. time : TTime; // milliseconds
  233. xkb_type : Smallint; // XkbActionMessage
  234. device : Smallint; // device ID
  235. keycode : TKeyCode; // key that generated the event
  236. press : Boolean; // true if act caused by key press
  237. key_event_follows : Boolean; // true if key event also generated
  238. group : Smallint; // effective group
  239. mods : Word; // effective mods
  240. message : array [0..XkbActionMessageLength] of Char;
  241. // message -- leave space for NUL
  242. end;
  243. type
  244. PXkbAccessXNotifyEvent = ^TXkbAccessXNotifyEvent;
  245. TXkbAccessXNotifyEvent = record
  246. _type : Smallint; // XkbAnyEvent
  247. serial : Longword; // of last req processed by server
  248. send_event : Boolean; // is this from a SendEvent request?
  249. display : PDisplay; // Display the event was read from
  250. time : TTime; // milliseconds
  251. xkb_type : Smallint; // XkbAccessXNotify
  252. device : Smallint; // device ID
  253. detail : Smallint; // XkbAXN_*
  254. keycode : Smallint; // key of event
  255. sk_delay : Smallint; // current slow keys delay
  256. debounce_delay : Smallint; // current debounce delay
  257. end;
  258. type
  259. PXkbExtensionDeviceNotifyEvent = ^TXkbExtensionDeviceNotifyEvent;
  260. TXkbExtensionDeviceNotifyEvent = record
  261. _type : Smallint; // XkbAnyEvent
  262. serial : Longword; // of last req processed by server
  263. send_event : Boolean; // is this from a SendEvent request?
  264. display : PDisplay; // Display the event was read from
  265. time : TTime; // milliseconds
  266. xkb_type : Smallint; // XkbExtensionDeviceNotify
  267. device : Smallint; // device ID
  268. reason : Word; // reason for the event
  269. supported : Word; // mask of supported features
  270. unsupported : Word; // mask of unsupported features
  271. // that some app tried to use
  272. first_btn : Smallint; // first button that changed
  273. num_btns : Smallint; // range of buttons changed
  274. leds_defined : Word; // indicators with names or maps
  275. led_state : Word; // current state of the indicators
  276. led_class : Smallint; // feedback class for led changes
  277. led_id : Smallint; // feedback id for led changes
  278. end;
  279. type
  280. PXkbEvent = ^TXkbEvent;
  281. TXkbEvent = record
  282. _type : Smallint;
  283. any : TXkbAnyEvent;
  284. new_kbd : TXkbNewKeyboardNotifyEvent;
  285. map : TXkbMapNotifyEvent;
  286. state : TXkbStateNotifyEvent;
  287. ctrls : TXkbControlsNotifyEvent;
  288. indicators : TXkbIndicatorNotifyEvent;
  289. names : TXkbNamesNotifyEvent;
  290. compat : TXkbCompatMapNotifyEvent;
  291. bell : TXkbBellNotifyEvent;
  292. message : TXkbActionMessageEvent;
  293. accessx : TXkbAccessXNotifyEvent;
  294. device : TXkbExtensionDeviceNotifyEvent;
  295. core : TXEvent;
  296. end;
  297. type
  298. //typedef struct _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr;
  299. PXkbKbdDpyStatePtr = ^TXkbKbdDpyStateRec;
  300. TXkbKbdDpyStateRec = record
  301. end;
  302. { XkbOpenDisplay error codes }
  303. const
  304. XkbOD_Success = 0;
  305. XkbOD_BadLibraryVersion = 1;
  306. XkbOD_ConnectionRefused = 2;
  307. XkbOD_NonXkbServer = 3;
  308. XkbOD_BadServerVersion = 4;
  309. { Values for XlibFlags }
  310. const
  311. XkbLC_ForceLatin1Lookup = 1 shl 0;
  312. XkbLC_ConsumeLookupMods = 1 shl 1;
  313. XkbLC_AlwaysConsumeShiftAndLock = 1 shl 2;
  314. XkbLC_IgnoreNewKeyboards = 1 shl 3;
  315. XkbLC_ControlFallback = 1 shl 4;
  316. XkbLC_ConsumeKeysOnComposeFail = 1 shl 29;
  317. XkbLC_ComposeLED = 1 shl 30;
  318. XkbLC_BeepOnComposeFail = 1 shl 31;
  319. XkbLC_AllComposeControls = $C0000000;
  320. XkbLC_AllControls = $C000001F;
  321. function XkbIgnoreExtension (ignore : Boolean) : Boolean;
  322. cdecl; external libX11 name 'XkbIgnoreExtension';
  323. function XkbOpenDisplay (name : PChar; ev_rtrn, err_rtrn,
  324. major_rtrn, minor_rtrn, reason : PSmallint) : PDisplay;
  325. cdecl; external libX11 name 'XkbOpenDisplay';
  326. function XkbQueryExtension (dpy : PDisplay; opcodeReturn, eventBaseReturn,
  327. errorBaseReturn, majorRtrn, minorRtrn: PSmallint) : Boolean;
  328. cdecl; external libX11 name 'XkbQueryExtension';
  329. function XkbUseExtension (dpy : PDisplay; major_rtrn, minor_rtrn : PSmallint) : Boolean;
  330. cdecl; external libX11 name 'XkbUseExtension';
  331. function XkbLibraryVersion (libMajorRtrn, libMinorRtrn : PSmallint) : Boolean;
  332. cdecl; external libX11 name 'XkbLibraryVersion';
  333. function XkbSetXlibControls (dpy : PDisplay; affect, values : Word) : Word;
  334. cdecl; external libX11 name 'XkbSetXlibControls';
  335. function XkbGetXlibControls (dpy : PDisplay) : Word;
  336. cdecl; external libX11 name 'XkbGetXlibControls';
  337. type
  338. TXkbInternAtomFunc = function (dpy : PDisplay; name : PChar; only_if_exists : Boolean) : TAtom; cdecl;
  339. type
  340. TXkbGetAtomNameFunc = function (dpy : PDisplay; atom : TAtom) : PChar; cdecl;
  341. procedure XkbSetAtomFuncs (getAtom : TXkbInternAtomFunc; getName : TXkbGetAtomNameFunc);
  342. cdecl; external libX11 name 'XkbSetAtomFuncs';
  343. function XkbKeycodeToKeysym (dpy : PDisplay;
  344. {$IFDEF NeedWidePrototypes}
  345. kc : Word;
  346. {$ELSE}
  347. kc : TKeyCode;
  348. {$ENDIF}
  349. group, level : Smallint) : TKeySym;
  350. cdecl; external libX11 name 'XkbKeycodeToKeysym';
  351. function XkbKeysymToModifiers (dpy : PDisplay; ks : TKeySym) : Word;
  352. cdecl; external libX11 name 'XkbKeysymToModifiers';
  353. function XkbLookupKeySym (dpy : PDisplay; keycode : TKeyCode; modifiers,
  354. modifiers_return : Word; keysym_return : PKeySym) : Boolean;
  355. cdecl; external libX11 name 'XkbLookupKeySym';
  356. function XkbLookupKeyBinding (dpy : PDisplay; sym_rtrn : TKeySym; mods : Word;
  357. buffer : PChar; nbytes : Smallint; extra_rtrn : PSmallint) : Smallint;
  358. cdecl; external libX11 name 'XkbLookupKeyBinding';
  359. function XkbTranslateKeyCode (xkb : PXkbDescPtr; keycode : TKeyCode; modifiers,
  360. modifiers_return : Word; keysym_return : PKeySym) : Boolean;
  361. cdecl; external libX11 name 'XkbTranslateKeyCode';
  362. function XkbTranslateKeySym (dpy : PDisplay; sym_return : TKeySym; modifiers : Word;
  363. buffer : PChar; nbytes : Smallint; extra_rtrn : PSmallint) : Smallint;
  364. cdecl; external libX11 name 'XkbTranslateKeySym';
  365. function XkbSetAutoRepeatRate (dpy : PDisplay; deviceSpec, delay, interval : Word) : Boolean;
  366. cdecl; external libX11 name 'XkbSetAutoRepeatRate';
  367. function XkbGetAutoRepeatRate (dpy : PDisplay; deviceSpec : Word; delayRtrn, intervalRtrn : PWord) : Boolean;
  368. cdecl; external libX11 name 'XkbGetAutoRepeatRate';
  369. function XkbChangeEnabledControls (dpy : PDisplay; deviceSpec, affect, values : Word) : Boolean;
  370. cdecl; external libX11 name 'XkbChangeEnabledControls';
  371. function XkbDeviceBell (dpy : PDisplay; win : TWindow; deviceSpec,
  372. bellClass, bellID, percent : Smallint; name : TAtom) : Boolean;
  373. cdecl; external libX11 name 'XkbDeviceBell';
  374. function XkbForceDeviceBell (dpy : PDisplay; deviceSpec, bellClass, bellID, percent : Smallint) : Boolean;
  375. cdecl; external libX11 name 'XkbForceDeviceBell';
  376. function XkbDeviceBellEvent (dpy : PDisplay; win : TWindow; deviceSpec,
  377. bellClass, bellID, percent : Smallint; name : TAtom) : Boolean;
  378. cdecl; external libX11 name 'XkbDeviceBellEvent';
  379. function XkbBell (dpy : PDisplay; win : TWindow; percent : Smallint; name : TAtom) : Boolean;
  380. cdecl; external libX11 name 'XkbBell';
  381. function XkbForceBell (dpy : PDisplay; percent : Smallint) : Boolean;
  382. cdecl; external libX11 name 'XkbForceBell';
  383. function XkbBellEvent (dpy : PDisplay; win : TWindow; percent : Smallint; name : TAtom) : Boolean;
  384. cdecl; external libX11 name 'XkbBellEvent';
  385. function XkbSelectEvents (dpy : PDisplay; deviceID, affect, values : Word) : Boolean;
  386. cdecl; external libX11 name 'XkbSelectEvents';
  387. function XkbSelectEventDetails (dpy : PDisplay; deviceID, eventType : Word;
  388. affect, details : Longword) : Boolean;
  389. cdecl; external libX11 name 'XkbSelectEventDetails';
  390. procedure XkbNoteMapChanges (old : PXkbMapChangesPtr; new : PXkbMapNotifyEvent; wanted : Word);
  391. cdecl; external libX11 name 'XkbNoteMapChanges';
  392. procedure XkbNoteNameChanges (old : PXkbNameChangesPtr; new : PXkbNamesNotifyEvent; wanted : Word);
  393. cdecl; external libX11 name 'XkbNoteNameChanges';
  394. function XkbGetIndicatorState (dpy : PDisplay; deviceSpec : Word; pStateRtrn : PWord) : TStatus;
  395. cdecl; external libX11 name 'XkbGetIndicatorState';
  396. function XkbGetDeviceIndicatorState (dpy : PDisplay; deviceSpec, ledClass,
  397. ledID : Word; pStateRtrn : PWord) : TStatus;
  398. cdecl; external libX11 name 'XkbGetDeviceIndicatorState';
  399. function XkbGetIndicatorMap (dpy : PDisplay; which : Longword; desc : PXkbDescPtr) : TStatus;
  400. cdecl; external libX11 name 'XkbGetIndicatorMap';
  401. function XkbSetIndicatorMap (dpy : PDisplay; which : Longword; desc : PXkbDescPtr) : Boolean;
  402. cdecl; external libX11 name 'XkbSetIndicatorMap';
  403. procedure XkbNoteIndicatorMapChanges (o, n : PXkbIndicatorChangesPtr; w : Word);
  404. procedure XkbNoteIndicatorStateChanges (o, n : PXkbIndicatorChangesPtr; w : Word);
  405. function XkbGetIndicatorMapChanges (d : PDisplay; x : PXkbDescPtr;
  406. c : PXkbIndicatorChangesPtr) : TStatus;
  407. function XkbChangeIndicatorMaps (d : PDisplay; x : PXkbDescPtr;
  408. c : PXkbIndicatorChangesPtr) : Boolean;
  409. function XkbGetNamedIndicator (dpy : PDisplay; name : TAtom; pNdxRtrn : PSmallint;
  410. pStateRtrn : PBoolean; pMapRtrn : PXkbIndicatorMapPtr;
  411. pRealRtrn : PBoolean) : Boolean;
  412. cdecl; external libX11 name 'XkbGetNamedIndicator';
  413. function XkbGetNamedDeviceIndicator (dpy : PDisplay; deviceSpec, ledClass, ledID : Word;
  414. name : TAtom; pNdxRtrn : PSmallint; pStateRtrn : PBoolean;
  415. pMapRtrn : PXkbIndicatorMapPtr; pRealRtrn : PBoolean) : Boolean;
  416. cdecl; external libX11 name 'XkbGetNamedDeviceIndicator';
  417. function XkbSetNamedIndicator (dpy : PDisplay; name : TAtom; changeState,
  418. state, createNewMap : Boolean; pMap : PXkbIndicatorMapPtr) : Boolean;
  419. cdecl; external libX11 name 'XkbSetNamedIndicator';
  420. function XkbSetNamedDeviceIndicator (dpy : PDisplay; deviceSpec, ledClass, ledID : Word;
  421. name : TAtom; changeState, state, createNewMap : Boolean;
  422. pMap : PXkbIndicatorMapPtr) : Boolean;
  423. cdecl; external libX11 name 'XkbSetNamedDeviceIndicator';
  424. function XkbLockModifiers (dpy : PDisplay; deviceSpec, affect, values : Word) : Boolean;
  425. cdecl; external libX11 name 'XkbLockModifiers';
  426. function XkbLatchModifiers (dpy : PDisplay; deviceSpec, affect, values : Word) : Boolean;
  427. cdecl; external libX11 name 'XkbLatchModifiers';
  428. function XkbLockGroup (dpy : PDisplay; deviceSpec, group : Word) : Boolean;
  429. cdecl; external libX11 name 'XkbLockGroup';
  430. function XkbLatchGroup (dpy : PDisplay; deviceSpec, group : Word) : Boolean;
  431. cdecl; external libX11 name 'XkbLatchGroup';
  432. function XkbSetServerInternalMods (dpy : PDisplay; deviceSpec, affectReal,
  433. realValues, affectVirtual, virtualValues : Word) : Boolean;
  434. cdecl; external libX11 name 'XkbSetServerInternalMods';
  435. function XkbSetIgnoreLockMods (dpy : PDisplay; deviceSpec, affectReal,
  436. realValues, affectVirtual, virtualValues : Word) : Boolean;
  437. cdecl; external libX11 name 'XkbSetIgnoreLockMods';
  438. function XkbVirtualModsToReal (dpy : PDisplay; virtual_mask : Word; mask_rtrn : PWord) : Boolean;
  439. cdecl; external libX11 name 'XkbVirtualModsToReal';
  440. function XkbComputeEffectiveMap (xkb : PXkbDescPtr; _type : PXkbKeyTypePtr; map_rtrn : PByte) : Boolean;
  441. cdecl; external libX11 name 'XkbComputeEffectiveMap';
  442. function XkbInitCanonicalKeyTypes (xkb : PXkbDescPtr; which : Word; keypadVMod : Smallint) : TStatus;
  443. cdecl; external libX11 name 'XkbInitCanonicalKeyTypes';
  444. function XkbAllocKeyboard : PXkbDescPtr;
  445. cdecl; external libX11 name 'XkbAllocKeyboard';
  446. procedure XkbFreeKeyboard (xkb : PXkbDescPtr; which : Word; freeDesc : Boolean);
  447. cdecl; external libX11 name 'XkbFreeKeyboard';
  448. function XkbAllocClientMap (xkb : PXkbDescPtr; which, nTypes : Word) : TStatus;
  449. cdecl; external libX11 name 'XkbAllocClientMap';
  450. function XkbAllocServerMap (xkb : PXkbDescPtr; which, nActions : Word) : TStatus;
  451. cdecl; external libX11 name 'XkbAllocServerMap';
  452. procedure XkbFreeClientMap (xkb : PXkbDescPtr; what : Word; freeMap : Boolean);
  453. cdecl; external libX11 name 'XkbFreeClientMap';
  454. procedure XkbFreeServerMap (xkb : PXkbDescPtr; what : Word; freeMap : Boolean);
  455. cdecl; external libX11 name 'XkbFreeServerMap';
  456. function XkbAddKeyType (xkb : PXkbDescPtr; name : TAtom; map_count : Smallint;
  457. want_preserve : Boolean; num_lvls : Smallint) : PXkbKeyTypePtr;
  458. cdecl; external libX11 name 'XkbAddKeyType';
  459. function XkbAllocIndicatorMaps (xkb : PXkbDescPtr) : TStatus;
  460. cdecl; external libX11 name 'XkbAllocIndicatorMaps';
  461. procedure XkbFreeIndicatorMaps (xkb : PXkbDescPtr);
  462. cdecl; external libX11 name 'XkbFreeIndicatorMaps';
  463. function XkbGetMap (dpy : PDisplay; which, deviceSpec : Word) : PXkbDescPtr;
  464. cdecl; external libX11 name 'XkbGetMap';
  465. function XkbGetUpdatedMap (dpy : PDisplay; which : Word; desc : PXkbDescPtr) : TStatus;
  466. cdecl; external libX11 name 'XkbGetUpdatedMap';
  467. function XkbGetMapChanges (dpy : PDisplay; xkb : PXkbDescPtr; changes : PXkbMapChangesPtr) : TStatus;
  468. cdecl; external libX11 name 'XkbGetMapChanges';
  469. function XkbRefreshKeyboardMapping (event : PXkbMapNotifyEvent) : TStatus;
  470. cdecl; external libX11 name 'XkbRefreshKeyboardMapping';
  471. function XkbGetKeyTypes (dpy : PDisplay; first, num : Word; xkb : PXkbDescPtr) : TStatus;
  472. cdecl; external libX11 name 'XkbGetKeyTypes';
  473. function XkbGetKeySyms (dpy : PDisplay; first, num : Word; xkb : PXkbDescPtr) : TStatus;
  474. cdecl; external libX11 name 'XkbGetKeySyms';
  475. function XkbGetKeyActions (dpy : PDisplay; first, num : Word; xkb : PXkbDescPtr) : TStatus;
  476. cdecl; external libX11 name 'XkbGetKeyActions';
  477. function XkbGetKeyBehaviors (dpy : PDisplay; firstKey, nKeys : Word; desc : PXkbDescPtr) : TStatus;
  478. cdecl; external libX11 name 'XkbGetKeyBehaviors';
  479. function XkbGetVirtualMods (dpy : PDisplay; which : Word; desc : PXkbDescPtr) : TStatus;
  480. cdecl; external libX11 name 'XkbGetVirtualMods';
  481. function XkbGetKeyExplicitComponents (dpy : PDisplay; firstKey, nKeys : Word; desc : PXkbDescPtr) : TStatus;
  482. cdecl; external libX11 name 'XkbGetKeyExplicitComponents';
  483. function XkbGetKeyModifierMap (dpy : PDisplay; firstKey, nKeys : Word; desc : PXkbDescPtr) : TStatus;
  484. cdecl; external libX11 name 'XkbGetKeyModifierMap';
  485. function XkbAllocControls (xkb : PXkbDescPtr; which : Word) : TStatus;
  486. cdecl; external libX11 name 'XkbAllocControls';
  487. procedure XkbFreeControls (xkb : PXkbDescPtr; which : Word; freeMap : Boolean);
  488. cdecl; external libX11 name 'XkbFreeControls';
  489. function XkbGetControls (dpy : PDisplay; which : Longword; desc : PXkbDescPtr) : TStatus;
  490. cdecl; external libX11 name 'XkbGetControls';
  491. function XkbSetControls (dpy : PDisplay; which : Longword; desc : PXkbDescPtr) : Boolean;
  492. cdecl; external libX11 name 'XkbSetControls';
  493. procedure XkbNoteControlsChanges (old : PXkbControlsChangesPtr; new : PXkbControlsNotifyEvent;
  494. wanted : Word);
  495. cdecl; external libX11 name 'XkbNoteControlsChanges';
  496. function XkbGetControlsChanges (d : PDisplay; x : PXkbDescPtr; c : PXkbControlsChangesPtr) : TStatus;
  497. function XkbChangeControls (d : PDisplay; x : PXkbDescPtr; c : PXkbControlsChangesPtr) : Boolean;
  498. function XkbAllocCompatMap (xkb : PXkbDescPtr; which, nInterpret : Word) : TStatus;
  499. cdecl; external libX11 name 'XkbAllocCompatMap';
  500. procedure XkbFreeCompatMap (xkib : PXkbDescPtr; which : Word; freeMap : Boolean);
  501. cdecl; external libX11 name 'XkbFreeCompatMap';
  502. function XkbGetCompatMap (dpy : PDisplay; which : Word; xkb : PXkbDescPtr) : TStatus;
  503. cdecl; external libX11 name 'XkbGetCompatMap';
  504. function XkbSetCompatMap (dpy : PDisplay; which : Word;
  505. xkb : PXkbDescPtr; updateActions : Boolean) : Boolean;
  506. cdecl; external libX11 name 'XkbSetCompatMap';
  507. function XkbAddSymInterpret (xkb : PXkbDescPtr; si : PXkbSymInterpretPtr;
  508. updateMap : Boolean; changes : PXkbChangesPtr) : PXkbSymInterpretPtr;
  509. cdecl; external libX11 name 'XkbAddSymInterpret';
  510. function XkbAllocNames (xkb : PXkbDescPtr; which : Word; nTotalRG, nTotalAliases : Smallint) : TStatus;
  511. cdecl; external libX11 name 'XkbAllocNames';
  512. function XkbGetNames (dpy : PDisplay; which : Word; desc : PXkbDescPtr) : TStatus;
  513. cdecl; external libX11 name 'XkbGetNames';
  514. function XkbSetNames (dpy : PDisplay; which, firstType, nTypes : Word; desc : PXkbDescPtr) : Boolean;
  515. cdecl; external libX11 name 'XkbSetNames';
  516. function XkbChangeNames (dpy : PDisplay; xkb : PXkbDescPtr; changes : PXkbNameChangesPtr) : Boolean;
  517. cdecl; external libX11 name 'XkbChangeNames';
  518. procedure XkbFreeNames (xkb : PXkbDescPtr; which : Word; freeMap : Boolean);
  519. cdecl; external libX11 name 'XkbFreeNames';
  520. function XkbGetState(dpy : PDisplay; deviceSpec : Word; rtrnState : PXkbStatePtr) : TStatus;
  521. cdecl; external libX11 name 'XkbGetState';
  522. function XkbSetMap (dpy : PDisplay; which : Word; desc : PXkbDescPtr) : Boolean;
  523. cdecl; external libX11 name 'XkbSetMap';
  524. function XkbChangeMap (dpy : PDisplay; desc : PXkbDescPtr; changes : PXkbMapChangesPtr) : Boolean;
  525. cdecl; external libX11 name 'XkbChangeMap';
  526. function XkbSetDetectableAutoRepeat (dpy : PDisplay; detectable : Boolean; supported : PBoolean) : Boolean;
  527. cdecl; external libX11 name 'XkbSetDetectableAutoRepeat';
  528. function XkbGetDetectableAutoRepeat (dpy : PDisplay; supported : PBoolean) : Boolean;
  529. cdecl; external libX11 name 'XkbGetDetectableAutoRepeat';
  530. function XkbSetAutoResetControls (dpy : PDisplay; changes : Word;
  531. auto_ctrls, auto_values : PWord) : Boolean;
  532. cdecl; external libX11 name 'XkbSetAutoResetControls';
  533. function XkbGetAutoResetControls (dpy : PDisplay; auto_ctrls, auto_ctrl_values : PWord) : Boolean;
  534. cdecl; external libX11 name 'XkbGetAutoResetControls';
  535. function XkbSetPerClientControls (dpy : PDisplay; change : Word; values : PWord) : Boolean;
  536. cdecl; external libX11 name 'XkbSetPerClientControls';
  537. function XkbGetPerClientControls (dpy : PDisplay; ctrls : PWord) : Boolean;
  538. cdecl; external libX11 name 'XkbGetPerClientControls';
  539. function XkbCopyKeyType (from, into : PXkbKeyTypePtr) : TStatus;
  540. cdecl; external libX11 name 'XkbCopyKeyType';
  541. function XkbCopyKeyTypes (from, into : PXkbKeyTypePtr; num_types : Smallint) : TStatus;
  542. cdecl; external libX11 name 'XkbCopyKeyTypes';
  543. function XkbResizeKeyType (xkb : PXkbDescPtr; type_ndx, map_count : Smallint;
  544. want_preserve : Boolean; new_num_lvls : Smallint) : TStatus;
  545. cdecl; external libX11 name 'XkbResizeKeyType';
  546. function XkbResizeKeySyms (desc : PXkbDescPtr; forKey, symsNeeded : Smallint) : PKeySym;
  547. cdecl; external libX11 name 'XkbResizeKeySyms';
  548. function XkbResizeKeyActions (desc : PXkbDescPtr; forKey, actsNeeded : Smallint) : PXkbAction;
  549. cdecl; external libX11 name 'XkbResizeKeyActions';
  550. function XkbChangeTypesOfKey (xkb : PXkbDescPtr; key, num_groups : Smallint;
  551. groups : Word; newTypes : PSmallint; pChanges : PXkbMapChangesPtr) : TStatus;
  552. cdecl; external libX11 name 'XkbChangeTypesOfKey';
  553. (***====================================================================***)
  554. function XkbListComponents (dpy : PDisplay; deviceSpec : Word;
  555. ptrns : PXkbComponentNamesPtr; max_inout : PSmallint) : PXkbComponentListPtr;
  556. cdecl; external libX11 name 'XkbListComponents';
  557. procedure XkbFreeComponentList (list : PXkbComponentListPtr);
  558. cdecl; external libX11 name 'XkbFreeComponentList';
  559. function XkbGetKeyboard (dpy : PDisplay; which, deviceSpec : Word) : PXkbDescPtr;
  560. cdecl; external libX11 name 'XkbGetKeyboard';
  561. function XkbGetKeyboardByName (dpy : PDisplay; deviceSpec : Word; names : PXkbComponentNamesPtr;
  562. want, need : Word; load : Boolean) : PXkbDescPtr;
  563. cdecl; external libX11 name 'XkbGetKeyboardByName';
  564. (***====================================================================***)
  565. function XkbKeyTypesForCoreSymbols ( // returns # of groups
  566. xkb : PXkbDescPtr; // keyboard device
  567. map_width : Smallint; // keyboard device
  568. core_syms : PKeySym; // always mapWidth symbols
  569. protected : Word; // explicit key types
  570. types_inout : PSmallint; // always four type indices
  571. xkb_syms_rtrn : PKeySym // must have enough space
  572. ) : Smallint;
  573. cdecl; external libX11 name 'XkbKeyTypesForCoreSymbols';
  574. function XkbApplyCompatMapToKey ( // False only on error
  575. xkb : PXkbDescPtr; // keymap to be edited
  576. key : TKeyCode; // key to be updated
  577. changes : PXkbChangesPtr // resulting changes to map
  578. ) : Boolean;
  579. cdecl; external libX11 name 'XkbApplyCompatMapToKey';
  580. function XkbUpdateMapFromCore ( //False only on error
  581. xkb : PXkbDescPtr; // XKB keyboard to be edited
  582. first_key : TKeyCode; // first changed key
  583. num_keys, // number of changed keys
  584. map_width : Smallint; // width of core keymap
  585. core_keysyms : PKeySym; // symbols from core keymap
  586. changes : PXkbChangesPtr // resulting changes
  587. ) : Boolean;
  588. cdecl; external libX11 name 'XkbUpdateMapFromCore';
  589. (***====================================================================***)
  590. function XkbAddDeviceLedInfo (devi : PXkbDeviceInfoPtr; ledClass, ledId : Word) : PXkbDeviceLedInfoPtr;
  591. cdecl; external libX11 name 'XkbAddDeviceLedInfo';
  592. function XkbResizeDeviceButtonActions (devi : PXkbDeviceInfoPtr; newTotal : Word) : TStatus;
  593. cdecl; external libX11 name 'XkbResizeDeviceButtonActions';
  594. function XkbAllocDeviceInfo (deviceSpec, nButtons, szLeds : Word) : PXkbDeviceInfoPtr;
  595. cdecl; external libX11 name 'XkbAllocDeviceInfo';
  596. procedure XkbFreeDeviceInfo (devi : PXkbDeviceInfoPtr; which : Word; freeDevI : Boolean);
  597. cdecl; external libX11 name 'XkbFreeDeviceInfo';
  598. procedure XkbNoteDeviceChanges (old : PXkbDeviceChangesPtr; new : PXkbExtensionDeviceNotifyEvent;
  599. wanted : Word);
  600. cdecl; external libX11 name 'XkbNoteDeviceChanges';
  601. function XkbGetDeviceInfo (dpy : PDisplay; which, deviceSpec, ledClass, ledID : Word) : PXkbDeviceInfoPtr;
  602. cdecl; external libX11 name 'XkbGetDeviceInfo';
  603. function XkbGetDeviceInfoChanges (dpy : PDisplay; devi : PXkbDeviceInfoPtr;
  604. changes : PXkbDeviceChangesPtr) : TStatus;
  605. cdecl; external libX11 name 'XkbGetDeviceInfoChanges';
  606. function XkbGetDeviceButtonActions (dpy : PDisplay; devi : PXkbDeviceInfoPtr; all : Boolean;
  607. first, nBtns : Word) : TStatus;
  608. cdecl; external libX11 name 'XkbGetDeviceButtonActions';
  609. function XkbGetDeviceLedInfo (dpy : PDisplay; devi : PXkbDeviceInfoPtr;
  610. ledClass, ledId, which : Word) : TStatus;
  611. cdecl; external libX11 name 'XkbGetDeviceLedInfo';
  612. function XkbSetDeviceInfo (dpy : PDisplay; which : Word; devi : PXkbDeviceInfoPtr) : Boolean;
  613. cdecl; external libX11 name 'XkbSetDeviceInfo';
  614. function XkbChangeDeviceInfo (dpy : PDisplay; desc : PXkbDeviceInfoPtr;
  615. changes : PXkbDeviceChangesPtr) : Boolean;
  616. cdecl; external libX11 name 'XkbChangeDeviceInfo';
  617. function XkbSetDeviceLedInfo (dpy : PDisplay; devi : PXkbDeviceInfoPtr;
  618. ledClass, ledID, which : Word) : Boolean;
  619. cdecl; external libX11 name 'XkbSetDeviceLedInfo';
  620. function XkbSetDeviceButtonActions (dpy : PDisplay; devi : PXkbDeviceInfoPtr;
  621. first, nBtns : Word) : Boolean;
  622. cdecl; external libX11 name 'XkbSetDeviceButtonActions';
  623. (***====================================================================***)
  624. function XkbToControl (c : Byte) : Byte;
  625. cdecl; external libX11 name 'XkbToControl';
  626. (***====================================================================***)
  627. function XkbSetDebuggingFlags (dpy : PDisplay; mask, flags : Word; msg : PChar;
  628. ctrls_mask, ctrls, rtrn_flags, rtrn_ctrls : Word) : Boolean;
  629. cdecl; external libX11 name 'XkbSetDebuggingFlags';
  630. function XkbApplyVirtualModChanges (xkb : PXkbDescPtr; changed : Word; changes : PXkbChangesPtr) : Boolean;
  631. cdecl; external libX11 name 'XkbApplyVirtualModChanges';
  632. implementation
  633. procedure XkbNoteIndicatorMapChanges (o, n : PXkbIndicatorChangesPtr; w : Word);
  634. begin
  635. {#define XkbNoteIndicatorMapChanges(o,n,w) ((o)->map_changes|=((n)->map_changes&(w)))}
  636. o^.map_changes := o^.map_changes or (n^.map_changes and w);
  637. end;
  638. procedure XkbNoteIndicatorStateChanges (o, n : PXkbIndicatorChangesPtr; w : Word);
  639. begin
  640. {#define XkbNoteIndicatorStateChanges(o,n,w) ((o)->state_changes|=((n)->state_changes&(w)))}
  641. o^.state_changes := o^.state_changes or (n^.state_changes and w);
  642. end;
  643. function XkbGetIndicatorMapChanges (d : PDisplay; x : PXkbDescPtr; c : PXkbIndicatorChangesPtr) : TStatus;
  644. begin
  645. {#define XkbGetIndicatorMapChanges(d,x,c) (XkbGetIndicatorMap((d),(c)->map_changes,x)}
  646. Result := XkbGetIndicatorMap (d, c^.map_changes, x);
  647. end;
  648. function XkbChangeIndicatorMaps (d : PDisplay; x : PXkbDescPtr; c : PXkbIndicatorChangesPtr) : Boolean;
  649. begin
  650. {#define XkbChangeIndicatorMaps(d,x,c) (XkbSetIndicatorMap((d),(c)->map_changes,x))}
  651. Result := XkbSetIndicatorMap (d, c^.map_changes, x);
  652. end;
  653. function XkbGetControlsChanges (d : PDisplay; x : PXkbDescPtr; c : PXkbControlsChangesPtr) : TStatus;
  654. begin
  655. {#define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x)}
  656. Result := XkbGetControls (d, c^.changed_ctrls, x);
  657. end;
  658. function XkbChangeControls (d : PDisplay; x : PXkbDescPtr; c : PXkbControlsChangesPtr) : Boolean;
  659. begin
  660. {#define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x)}
  661. Result := XkbSetControls (d, c^.changed_ctrls, x);
  662. end;
  663. end.