xkblib.pp 48 KB

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