home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / evbl0627.zip / everblue_20010627.zip / x11 / XKBlibint.h < prev    next >
C/C++ Source or Header  |  1999-11-02  |  10KB  |  408 lines

  1. /* $TOG: XKBlibint.h /main/15 1997/06/10 06:53:27 kaleb $ */
  2. /************************************************************
  3. Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
  4.  
  5. Permission to use, copy, modify, and distribute this
  6. software and its documentation for any purpose and without
  7. fee is hereby granted, provided that the above copyright
  8. notice appear in all copies and that both that copyright
  9. notice and this permission notice appear in supporting
  10. documentation, and that the name of Silicon Graphics not be 
  11. used in advertising or publicity pertaining to distribution 
  12. of the software without specific prior written permission.
  13. Silicon Graphics makes no representation about the suitability 
  14. of this software for any purpose. It is provided "as is"
  15. without any express or implied warranty.
  16.  
  17. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
  18. SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
  19. AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
  20. GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
  21. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
  22. DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
  23. OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
  24. THE USE OR PERFORMANCE OF THIS SOFTWARE.
  25.  
  26. ********************************************************/
  27. /* $XFree86: xc/lib/X11/XKBlibint.h,v 3.1.2.2 1997/06/22 10:32:26 dawes Exp $ */
  28.  
  29. #ifndef _XKBLIBINT_H_
  30. #define    _XKBLIBINT_H_
  31.  
  32. #include <X11/Xutil.h>
  33. #include <X11/XKBlib.h>
  34.  
  35. #define    XkbMapPending        (1<<0)
  36. #define    XkbXlibNewKeyboard    (1<<1)
  37.  
  38. typedef int    (*XkbKSToMBFunc)(
  39. #if NeedFunctionPrototypes
  40.     XPointer    /* priv */,
  41.     KeySym        /* sym */,
  42.     char *        /* buf */,
  43.     int        /* len */,
  44.     int *        /* extra_rtrn */
  45. #endif
  46. );
  47.  
  48. typedef KeySym    (*XkbMBToKSFunc)(
  49. #if NeedFunctionPrototypes
  50.     XPointer    /* priv */,
  51.     char *        /* buf */,
  52.     int        /* len */,
  53.     Status *    /* status */
  54. #endif
  55. );
  56.  
  57. typedef KeySym    (*XkbToUpperFunc)(
  58. #if NeedFunctionPrototypes
  59.     KeySym        /* sym */
  60. #endif
  61. );
  62.  
  63. typedef struct _XkbConverters {
  64.     XkbKSToMBFunc     KSToMB;
  65.     XPointer     KSToMBPriv;
  66.     XkbMBToKSFunc     MBToKS;
  67.     XPointer     MBToKSPriv;
  68.     XkbToUpperFunc     KSToUpper;
  69. } XkbConverters;
  70.  
  71. extern    XkbInternAtomFunc    _XkbInternAtomFunc;
  72. extern    XkbGetAtomNameFunc    _XkbGetAtomNameFunc;
  73.  
  74. typedef struct _XkbInfoRec {
  75.     unsigned     flags;
  76.     unsigned     xlib_ctrls;
  77.     XExtCodes     *codes;
  78.     int         srv_major;
  79.     int         srv_minor;
  80.     unsigned     selected_events;
  81.     unsigned short     selected_nkn_details;
  82.     unsigned short     selected_map_details;
  83.     XkbDescRec    *desc;
  84.     XkbMapChangesRec changes;
  85.     Atom         composeLED;
  86.     XkbConverters     cvt;
  87.     XkbConverters     latin1cvt;
  88. } XkbInfoRec, *XkbInfoPtr;
  89.  
  90.  
  91. #define    _XkbUnavailable(d) \
  92.     (((d)->flags&XlibDisplayNoXkb) ||\
  93.      ((!(d)->xkb_info || (!(d)->xkb_info->desc)) && !_XkbLoadDpy(d)))
  94.  
  95. #define    _XkbCheckPendingRefresh(d,xi) {\
  96.     if ((xi)->flags&XkbXlibNewKeyboard)\
  97.     _XkbReloadDpy((d));\
  98.     else if ((xi)->flags&XkbMapPending) {\
  99.     if (XkbGetMapChanges((d),(xi)->desc, &(xi)->changes)==Success) {\
  100.         LockDisplay((d));\
  101.         (xi)->changes.changed= 0;\
  102.         UnlockDisplay((d));\
  103.     }\
  104.     }\
  105. }
  106.  
  107. #define    _XkbNeedModmap(i)    ((!(i)->desc->map)||(!(i)->desc->map->modmap))
  108.  
  109.     /*
  110.      * mask of the events that the "invisible" XKB support in Xlib needs
  111.      */
  112. #define XKB_XLIB_MAP_MASK (XkbAllClientInfoMask)
  113.  
  114.     /*
  115.      * Handy helper macros 
  116.      */
  117. #define    XKB_INSURE_SIZE(f,t,nNum,oNum)    {\
  118.     if ((f)==NULL)    \
  119.          (f)=(t *)Xmalloc(sizeof(t)*(nNum));\
  120.     else if ((nNum)<(oNum))\
  121.          (f)=(t *)Xrealloc((f),sizeof(t)*(nNum));\
  122.     }
  123.  
  124. typedef struct _XkbReadBuffer {
  125.     int     error;
  126.     int     size;
  127.     char    *start;
  128.     char    *data;
  129. } XkbReadBufferRec,*XkbReadBufferPtr;
  130.  
  131. #define    _XkbAlloc(s)        Xmalloc((s))
  132. #define    _XkbCalloc(n,s)        Xcalloc((n),(s))
  133. #define    _XkbRealloc(o,s)    Xrealloc((o),(s))
  134. #define    _XkbTypedAlloc(t)    ((t *)Xmalloc(sizeof(t)))
  135. #define    _XkbTypedCalloc(n,t)    ((t *)Xcalloc((n),sizeof(t)))
  136. #define    _XkbTypedRealloc(o,n,t) \
  137.     ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
  138. #define    _XkbClearElems(a,f,l,t)    bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
  139. #define    _XkbFree(p)        Xfree(p)
  140.  
  141. _XFUNCPROTOBEGIN
  142.  
  143. extern    void _XkbReloadDpy(
  144. #if NeedFunctionPrototypes
  145.     Display *        /* dpy */
  146. #endif
  147. );
  148.  
  149. extern KeySym _XKeycodeToKeysym(
  150. #if NeedFunctionPrototypes
  151.     Display*        /* display */,
  152.     KeyCode        /* keycode */,
  153.     int            /* index */
  154. #endif
  155. );
  156.  
  157. extern KeyCode _XKeysymToKeycode(
  158. #if NeedFunctionPrototypes
  159.     Display*        /* display */,
  160.     KeySym        /* keysym */
  161. #endif
  162. );
  163.  
  164. extern KeySym _XLookupKeysym(
  165. #if NeedFunctionPrototypes
  166.     XKeyEvent*        /* key_event */,
  167.     int            /* index */
  168. #endif
  169. );
  170.  
  171. extern int _XRefreshKeyboardMapping(
  172. #if NeedFunctionPrototypes
  173.     XMappingEvent*    /* event_map */    
  174. #endif
  175. );
  176.  
  177. extern unsigned    _XKeysymToModifiers(
  178. #if NeedFunctionPrototypes
  179.     Display *        /* dpy */,
  180.     KeySym         /* ks */
  181. #endif
  182. );
  183.  
  184. extern int _XTranslateKey(    
  185. #if NeedFunctionPrototypes
  186.     register Display *    /* dpy */,
  187.     KeyCode         /* keycode */,
  188.     register unsigned int /* modifiers */,
  189.     unsigned int *    /* modifiers_return */,
  190.     KeySym *        /* keysym_return */
  191. #endif
  192. );
  193.  
  194. extern int    _XTranslateKeySym(
  195. #if NeedFunctionPrototypes
  196.     Display *        /* dpy */,
  197.     register KeySym     /* symbol */,
  198.     unsigned int     /* modifiers */,
  199.     char *        /* buffer */,
  200.     int         /* nbytes */
  201. #endif
  202. );
  203.  
  204. extern    int _XLookupString(
  205. #if NeedFunctionPrototypes
  206.     register XKeyEvent *    /* event */,
  207.     char *            /* buffer */,
  208.     int             /* nbytes */,
  209.     KeySym *            /* keysym */,
  210.     XComposeStatus *        /* status */
  211. #endif
  212. );
  213.  
  214. extern void _XkbNoteCoreMapChanges(
  215. #if NeedFunctionPrototypes
  216.     XkbMapChangesRec *         /* old */,
  217.     XMappingEvent *         /* new */,
  218.     unsigned int         /* wanted */
  219. #endif
  220. );
  221.  
  222. extern    int _XkbInitReadBuffer(
  223. #if NeedFunctionPrototypes
  224.     Display *        /* dpy */,
  225.     XkbReadBufferPtr    /* buf */,
  226.     int            /* size */
  227. #endif
  228. );
  229.  
  230. extern int _XkbSkipReadBufferData(
  231. #if NeedFunctionPrototypes
  232.     XkbReadBufferPtr    /* from */,
  233.     int            /* size */
  234. #endif
  235. );
  236.  
  237. extern int _XkbCopyFromReadBuffer(
  238. #if NeedFunctionPrototypes
  239.     XkbReadBufferPtr    /* from */,
  240.     char *        /* to */,
  241.     int            /* size */
  242. #endif
  243. );
  244.  
  245.  
  246. #if defined(WORD64) || defined(LONG64)
  247. extern    int _XkbReadCopyData32(
  248. #if NeedFunctionPrototypes
  249.     int *        /* from */,
  250.     long *        /* to */,
  251.     int            /* num_words */
  252. #endif
  253. );
  254.  
  255. extern    int _XkbWriteCopyData32(
  256. #if NeedFunctionPrototypes
  257.     unsigned long *    /* from */,
  258.     CARD32 *        /* to */,
  259.     int            /* num_words */
  260. #endif
  261. );
  262.  
  263. extern int _XkbReadBufferCopy32(
  264. #if NeedFunctionPrototypes
  265.     XkbReadBufferPtr    /* from */,
  266.     long *        /* to */,
  267.     int            /* size */
  268. #endif
  269. );
  270. #else
  271. #define    _XkbReadCopyData32(f,t,s)    memcpy((char *)(t),(char *)(f),(s)*4)
  272. #define    _XkbWriteCopyData32(f,t,s)   memcpy((char *)(t),(char *)(f),(s)*4)
  273. #define    _XkbReadBufferCopy32(f,t,s) _XkbCopyFromReadBuffer(f,(char *)t,(s)*4)
  274. #endif
  275.  
  276. #ifndef NO_DEC_BINARY_COMPATIBILITY
  277. #define XKB_FORCE_INT_KEYSYM 1
  278. #endif
  279.  
  280. #ifdef XKB_FORCE_INT_KEYSYM
  281. extern int _XkbReadCopyKeySyms(
  282. #if NeedFunctionPrototypes
  283.     int *        /* from */,
  284.     KeySym *        /* to */,
  285.     int            /* num_words */
  286. #endif
  287. );
  288.  
  289. extern    int _XkbWriteCopyKeySyms(
  290. #if NeedFunctionPrototypes
  291.     KeySym *        /* from */,
  292.     CARD32 *        /* to */,
  293.     int            /* num_words */
  294. #endif
  295. );
  296.  
  297. extern int _XkbReadBufferCopyKeySyms(
  298. #if NeedFunctionPrototypes
  299.     XkbReadBufferPtr    /* from */,
  300. #ifndef NO_DEC_BUG_FIX
  301.     KeySym *        /* to */,
  302. #else
  303.     long *        /* to */,
  304. #endif
  305.     int            /* size */
  306. #endif
  307. );
  308. #else
  309. #define    _XkbReadCopyKeySyms(f,t,n)        _XkbReadCopyData32(f,t,n)
  310. #define    _XkbWriteCopyKeySyms(f,t,n)        _XkbWriteCopyData32(f,t,n)
  311. #define    _XkbReadBufferCopyKeySyms(f,t,s)    _XkbReadBufferCopy32(f,t,s)
  312. #endif
  313.  
  314. extern char *_XkbPeekAtReadBuffer(
  315. #if NeedFunctionPrototypes
  316.     XkbReadBufferPtr    /* from */,
  317.     int            /*  size */
  318. #endif
  319. );
  320.  
  321. extern char *_XkbGetReadBufferPtr(
  322. #if NeedFunctionPrototypes
  323.     XkbReadBufferPtr    /* from */,
  324.     int            /* size */
  325. #endif
  326. );
  327. #define    _XkbGetTypedRdBufPtr(b,n,t) ((t *)_XkbGetReadBufferPtr(b,(n)*SIZEOF(t)))
  328.  
  329. extern int _XkbFreeReadBuffer(
  330. #if NeedFunctionPrototypes
  331.     XkbReadBufferPtr    /* buf */
  332. #endif
  333. );
  334.  
  335. extern Bool
  336. _XkbGetReadBufferCountedString(
  337. #if NeedFunctionPrototypes
  338.     XkbReadBufferPtr    /* buf */,
  339.     char **        /* rtrn */
  340. #endif
  341. );
  342.  
  343. extern char    *_XkbGetCharset(
  344. #if NeedFunctionPrototypes
  345.     void
  346. #endif
  347. );
  348.  
  349. extern int     _XkbGetConverters(
  350. #if NeedFunctionPrototypes
  351.     char *        /* encoding_name */,
  352.     XkbConverters *    /* cvt_rtrn */
  353. #endif
  354. );
  355.  
  356. #ifdef    NEED_MAP_READERS
  357.  
  358. extern    Status    _XkbReadGetMapReply(
  359. #if NeedFunctionPrototypes
  360.     Display *        /* dpy */,
  361.     xkbGetMapReply *     /* rep */,
  362.     XkbDescRec *    /* xkb */,
  363.     int *        /* nread_rtrn */
  364. #endif
  365. );
  366.  
  367. extern    Status    _XkbReadGetCompatMapReply(
  368. #if NeedFunctionPrototypes
  369.     Display *            /* dpy */,
  370.     xkbGetCompatMapReply *    /* rep */,
  371.     XkbDescPtr            /* xkb */,
  372.     int    *            /* nread_rtrn */
  373. #endif
  374. );
  375.  
  376. extern    Status    _XkbReadGetIndicatorMapReply(
  377. #if NeedFunctionPrototypes
  378.     Display *            /* dpy */,
  379.     xkbGetIndicatorMapReply *    /* rep */,
  380.     XkbDescPtr            /* xkb */,
  381.     int    *            /* nread_rtrn */
  382. #endif
  383. );
  384.  
  385. extern    Status    _XkbReadGetNamesReply(
  386. #if NeedFunctionPrototypes
  387.     Display *            /* dpy */,
  388.     xkbGetNamesReply *        /* rep */,
  389.     XkbDescPtr             /* xkb */,
  390.     int *            /* nread_rtrn */
  391. #endif
  392. );
  393.  
  394. extern    Status    _XkbReadGetGeometryReply(
  395. #if NeedFunctionPrototypes
  396.     Display *            /* dpy */,
  397.     xkbGetGeometryReply *    /* rep */,
  398.     XkbDescPtr             /* xkb */,
  399.     int *            /* nread_rtrn */
  400. #endif
  401. );
  402.  
  403. #endif
  404.  
  405. _XFUNCPROTOEND
  406.  
  407. #endif /* _XKBLIBINT_H_ */
  408.