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

  1. /* $XConsortium: XimintP.h,v 1.6 94/03/26 16:57:21 rws Exp $ */
  2. /******************************************************************
  3.  
  4.            Copyright 1991, 1992 by Sun Microsystems, Inc.
  5.            Copyright 1992, 1993, 1994 by FUJITSU LIMITED
  6.            Copyright 1993, 1994       by Sony Corporation
  7.  
  8. Permission to use, copy, modify, distribute, and sell this software and
  9. its documentation for any purpose is hereby granted without fee, provided
  10. that the above copyright notice appear in all copies and that both that
  11. copyright notice and this permission notice appear in supporting
  12. documentation, and that the name of Sun Microsystems, Inc., FUJITSU
  13. LIMITED and Sony Corporation not be used in advertising or publicity
  14. pertaining to distribution of the software without specific, written
  15. prior permission.  Sun Microsystems, Inc., FUJITSU LIMITED and Sony
  16. Corporation makes no representations about the suitability of this
  17. software for any purpose.  It is provided "as is" without express or
  18. implied warranty. 
  19.  
  20. Sun Microsystems Inc. ,FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL
  21. WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
  22. OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc.,
  23. FUJITSU LIMITED, SONY CORPORATIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  24. CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  25. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  26. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  27. PERFORMANCE OF THIS SOFTWARE.
  28.  
  29.   Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
  30.           Takashi Fujiwara     FUJITSU LIMITED 
  31.                                  fujiwara@a80.tech.yk.fujitsu.co.jp
  32.       Makoto Wakamatsu     Sony Corporation
  33.                                  makoto@sm.sony.co.jp
  34.       Hiroyuki Miyamoto    Digital Equipment Corporation
  35.                                  miyamoto@jrd.dec.com
  36.  
  37. ******************************************************************/
  38.  
  39. #ifndef _XIMINTP_H
  40. #define _XIMINTP_H
  41.  
  42. #include "XimProto.h"
  43. #include "XlcPublic.h"
  44.  
  45. /*
  46.  * for protocol layer callback function
  47.  */
  48. typedef Bool (*XimProtoIntrProc)(
  49. #if NeedFunctionPrototypes
  50.     Xim, INT16, XPointer, XPointer
  51. #endif
  52. );
  53. typedef struct _XimProtoIntrRec {
  54.     XimProtoIntrProc         func;
  55.     CARD16             major_code;
  56.     CARD16             minor_code;
  57.     XPointer             call_data;
  58.     struct _XimProtoIntrRec    *next;
  59. } XimProtoIntrRec;
  60.  
  61. /*
  62.  * for transport layer methods
  63.  */
  64. typedef Bool (*XimTransConnectProc)(
  65. #if NeedFunctionPrototypes
  66.      Xim
  67. #endif
  68. );
  69. typedef Bool (*XimTransShutdownProc)(
  70. #if NeedFunctionPrototypes
  71.      Xim
  72. #endif
  73. );
  74. typedef Bool (*XimTransWriteProc)(
  75. #if NeedFunctionPrototypes
  76.      Xim, INT16, XPointer
  77. #endif
  78. );
  79. typedef Bool (*XimTransReadProc)(
  80. #if NeedFunctionPrototypes
  81.      Xim, XPointer, int, int *
  82. #endif
  83. );
  84. typedef void (*XimTransFlushProc)(
  85. #if NeedFunctionPrototypes
  86.      Xim
  87. #endif
  88. );
  89. typedef Bool (*XimTransRegDispatcher)(
  90. #if NeedNestedPrototypes
  91.      Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer
  92. #endif
  93. );
  94. typedef Bool (*XimTransCallDispatcher)(
  95. #if NeedFunctionPrototypes
  96.      Xim, INT16, XPointer
  97. #endif
  98. );
  99.  
  100. /*
  101.  * private part of IM
  102.  */
  103. typedef struct _XimProtoPrivateRec {
  104.     Window             im_window;
  105.     XIMID             imid;
  106.     CARD16             unused;
  107.     XIMStyles            *default_styles;
  108.     CARD32            *im_onkeylist;
  109.     CARD32            *im_offkeylist;
  110.     BITMASK32             flag;
  111.  
  112.     BITMASK32             registed_filter_event;
  113.     EVENTMASK             forward_event_mask;
  114.     EVENTMASK             synchronous_event_mask;
  115.  
  116.     XimProtoIntrRec        *intrproto;
  117.     XIMResourceList         im_inner_resources;
  118.     unsigned int         im_num_inner_resources;
  119.     XIMResourceList         ic_inner_resources;
  120.     unsigned int         ic_num_inner_resources;
  121.     char            *hold_data;
  122.     int                 hold_data_len;
  123.     char            *locale_name;
  124.     CARD16             protocol_major_version;
  125.     CARD16             protocol_minor_version;
  126.     XrmQuark            *saved_imvalues;
  127.     int                 num_saved_imvalues;
  128.  
  129.     XlcConv             ctom_conv;
  130.     XlcConv             ctow_conv;
  131.  
  132.     /*
  133.      * transport specific
  134.      */
  135.     XimTransConnectProc         connect;
  136.     XimTransShutdownProc     shutdown;
  137.     XimTransWriteProc         write;
  138.     XimTransReadProc         read;
  139.     XimTransFlushProc         flush;
  140.     XimTransRegDispatcher     register_dispatcher;
  141.     XimTransCallDispatcher     call_dispatcher;
  142.     XPointer             spec;
  143. } XimProtoPrivateRec;
  144.  
  145. /*
  146.  * bit mask for the flag of XIMPrivateRec
  147.  */
  148. #define SERVER_CONNECTED    (1L)
  149. #define    DYNAMIC_EVENT_FLOW    (1L << 1)
  150. #define    USE_AUTHORIZATION_FUNC    (1L << 2)
  151. #ifdef XIM_CONNECTABLE
  152. #define DELAYBINDABLE        (1L << 3)
  153. #define RECONNECTABLE        (1L << 4)
  154. #endif /* XIM_CONNECTABLE */
  155.  
  156. /*
  157.  * macro for the flag of XIMPrivateRec
  158.  */
  159. #define IS_SERVER_CONNECTED(im) \
  160.         ((((Xim)im))->private.proto.flag & SERVER_CONNECTED)
  161. #define MARK_SERVER_CONNECTED(im) \
  162.         ((((Xim)im))->private.proto.flag |= SERVER_CONNECTED)
  163. #define UNMARK_SERVER_CONNECTED(im) \
  164.         ((((Xim)im))->private.proto.flag &= ~SERVER_CONNECTED)
  165.  
  166. #define    IS_DYNAMIC_EVENT_FLOW(im) \
  167.         (((Xim)im)->private.proto.flag & DYNAMIC_EVENT_FLOW)
  168. #define    MARK_DYNAMIC_EVENT_FLOW(im) \
  169.         (((Xim)im)->private.proto.flag |= DYNAMIC_EVENT_FLOW)
  170.  
  171. #define    IS_USE_AUTHORIZATION_FUNC(im) \
  172.         (((Xim)im)->private.proto.flag & USE_AUTHORIZATION_FUNC)
  173. #define    MARK_USE_AUTHORIZATION_FUNC(im) \
  174.         (((Xim)im)->private.proto.flag |= USE_AUTHORIZATION_FUNC)
  175.  
  176. #ifdef XIM_CONNECTABLE
  177. #define IS_DELAYBINDABLE(im) \
  178.         (((Xim)im)->private.proto.flag & DELAYBINDABLE)
  179. #define MARK_DELAYBINDABLE(im) \
  180.         (((Xim)im)->private.proto.flag |= DELAYBINDABLE)
  181.  
  182. #define IS_RECONNECTABLE(im) \
  183.         (((Xim)im)->private.proto.flag & RECONNECTABLE)
  184. #define MARK_RECONNECTABLE(im) \
  185.         (((Xim)im)->private.proto.flag |= RECONNECTABLE)
  186.  
  187. #define IS_CONNECTABLE(im) \
  188.     (((Xim)im)->private.proto.flag & (DELAYBINDABLE|RECONNECTABLE))
  189. #define UNMAKE_CONNECTABLE(im) \
  190.     (((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE))
  191. #endif /* XIM_CONNECTABLE */
  192.  
  193. /*
  194.  * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec
  195.  */
  196. #define KEYPRESS_MASK        (1L)
  197. #define KEYRELEASE_MASK        (1L << 1)
  198. #define DESTROYNOTIFY_MASK    (1L << 2)
  199.  
  200. typedef struct _XimCommitInfoRec {
  201.     struct _XimCommitInfoRec    *next;
  202.     char            *string;
  203.     int                 string_len;
  204.     KeySym            *keysym;
  205.     int                 keysym_len;
  206. } XimCommitInfoRec, *XimCommitInfo;
  207.  
  208. typedef struct _XimPendingCallback {
  209.     int                 major_opcode;
  210.     Xim                 im;
  211.     Xic                 ic;
  212.     char            *proto;
  213.     int                 proto_len;
  214.     struct _XimPendingCallback    *next;
  215. } XimPendingCallbackRec, *XimPendingCallback;
  216.  
  217.  
  218. /*
  219.  * private part of IC
  220.  */
  221. typedef struct _XicProtoPrivateRec {
  222.     XICID             icid;            /* ICID        */
  223.     CARD16         dmy;
  224.     BITMASK32         flag;            /* Input Mode    */
  225.  
  226.     BITMASK32         registed_filter_event; /* registed filter mask */
  227.     EVENTMASK         forward_event_mask;    /* forward event mask */
  228.     EVENTMASK         synchronous_event_mask;/* sync event mask */
  229.     EVENTMASK         filter_event_mask;    /* negrect event mask */
  230.     EVENTMASK         intercept_event_mask;    /* deselect event mask */
  231.     EVENTMASK         select_event_mask;    /* select event mask */
  232.  
  233.     char        *preedit_font;        /* Base font name list */
  234.     int             preedit_font_length;    /* length of base font name */
  235.     char        *status_font;        /* Base font name list */
  236.     int             status_font_length;    /* length of base font name */
  237.  
  238.     XimCommitInfo     commit_info;
  239.     XIMResourceList     ic_resources;
  240.     unsigned int     ic_num_resources;
  241.     XIMResourceList     ic_inner_resources;
  242.     unsigned int     ic_num_inner_resources;
  243.     XrmQuark        *saved_icvalues;
  244.     int             num_saved_icvalues;
  245.     XimPendingCallback     pend_cb_que;
  246.     Bool         waitCallback;
  247. } XicProtoPrivateRec ;
  248.  
  249. /*
  250.  * bit mask for the flag of XICPrivateRec
  251.  */
  252. #define IC_CONNECTED        (1L)
  253. #define FABLICATED        (1L << 1)
  254. #define    NEED_SYNC_REPLY        (1L << 2)
  255.  
  256. /*
  257.  * macro for the flag of XICPrivateRec
  258.  */
  259. #define    IS_IC_CONNECTED(ic) \
  260.         (((Xic)ic)->private.proto.flag & IC_CONNECTED)
  261. #define    MARK_IC_CONNECTED(ic) \
  262.         (((Xic)ic)->private.proto.flag |= IC_CONNECTED)
  263. #define    UNMARK_IC_CONNECTED(ic) \
  264.         (((Xic)ic)->private.proto.flag &= ~IC_CONNECTED)
  265.  
  266. #define IS_FABLICATED(ic) \
  267.         (((Xic)ic)->private.proto.flag & FABLICATED)
  268. #define MARK_FABLICATED(ic) \
  269.         (((Xic)ic)->private.proto.flag |= FABLICATED)
  270. #define UNMARK_FABLICATED(ic) \
  271.         (((Xic)ic)->private.proto.flag &= ~FABLICATED)
  272.  
  273. #define    IS_NEED_SYNC_REPLY(ic) \
  274.         (((Xic)ic)->private.proto.flag & NEED_SYNC_REPLY)
  275. #define    MARK_NEED_SYNC_REPLY(ic) \
  276.         (((Xic)ic)->private.proto.flag |= NEED_SYNC_REPLY)
  277. #define    UNMARK_NEED_SYNC_REPLY(ic) \
  278.         (((Xic)ic)->private.proto.flag &= ~NEED_SYNC_REPLY)
  279.  
  280. /*
  281.  * macro for the filter_event_mask of XICPrivateRec
  282.  */
  283. #define    IS_NEGLECT_EVENT(ic, mask) \
  284.         (((Xic)ic)->private.proto.filter_event_mask & (mask))
  285.  
  286. /*
  287.  * macro for the forward_event_mask of XICPrivateRec
  288.  */
  289. #define    IS_FORWARD_EVENT(ic, mask) \
  290.         (((Xic)ic)->private.proto.forward_event_mask & (mask))
  291.  
  292. /*
  293.  * macro for the synchronous_event_mask of XICPrivateRec
  294.  */
  295. #define    IS_SYNCHRONOUS_EVENT(ic, mask) \
  296.    ((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False)
  297.  
  298. #define XIM_MAXIMNAMELEN 64
  299. #define XIM_MAXLCNAMELEN 64
  300.  
  301. #endif /* _XIMINTP_H */
  302.