PageRenderTime 41ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/src/xlibi18n/XimintP.h

#
C Header | 310 lines | 182 code | 33 blank | 95 comment | 0 complexity | a2a21089291cea52e9303342500ffa8c MD5 | raw file
Possible License(s): MIT
  1. /*
  2. * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. * DEALINGS IN THE SOFTWARE.
  22. */
  23. /******************************************************************
  24. Copyright 1992, 1993, 1994 by FUJITSU LIMITED
  25. Copyright 1993, 1994 by Sony Corporation
  26. Permission to use, copy, modify, distribute, and sell this software and
  27. its documentation for any purpose is hereby granted without fee, provided
  28. that the above copyright notice appear in all copies and that both that
  29. copyright notice and this permission notice appear in supporting
  30. documentation, and that the name of FUJITSU LIMITED and Sony Corporation
  31. not be used in advertising or publicity pertaining to distribution of the
  32. software without specific, written prior permission. FUJITSU LIMITED and
  33. Sony Corporation makes no representations about the suitability of this
  34. software for any purpose. It is provided "as is" without express or
  35. implied warranty.
  36. FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
  37. TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  38. FITNESS, IN NO EVENT SHALL FUJITSU LIMITED OR SONY CORPORATION BE LIABLE
  39. FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  40. RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  41. NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
  42. USE OR PERFORMANCE OF THIS SOFTWARE.
  43. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
  44. Takashi Fujiwara FUJITSU LIMITED
  45. fujiwara@a80.tech.yk.fujitsu.co.jp
  46. Makoto Wakamatsu Sony Corporation
  47. makoto@sm.sony.co.jp
  48. Hiroyuki Miyamoto Digital Equipment Corporation
  49. miyamoto@jrd.dec.com
  50. ******************************************************************/
  51. #ifndef _XIMINTP_H
  52. #define _XIMINTP_H
  53. #include "XimProto.h"
  54. #include "XlcPublic.h"
  55. /*
  56. * for protocol layer callback function
  57. */
  58. typedef Bool (*XimProtoIntrProc)(
  59. Xim, INT16, XPointer, XPointer
  60. );
  61. typedef struct _XimProtoIntrRec {
  62. XimProtoIntrProc func;
  63. CARD16 major_code;
  64. CARD16 minor_code;
  65. XPointer call_data;
  66. struct _XimProtoIntrRec *next;
  67. } XimProtoIntrRec;
  68. /*
  69. * for transport layer methods
  70. */
  71. typedef Bool (*XimTransConnectProc)(
  72. Xim
  73. );
  74. typedef Bool (*XimTransShutdownProc)(
  75. Xim
  76. );
  77. typedef Bool (*XimTransWriteProc)(
  78. Xim, INT16, XPointer
  79. );
  80. typedef Bool (*XimTransReadProc)(
  81. Xim, XPointer, int, int *
  82. );
  83. typedef void (*XimTransFlushProc)(
  84. Xim
  85. );
  86. typedef Bool (*XimTransRegDispatcher)(
  87. Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer
  88. );
  89. typedef Bool (*XimTransCallDispatcher)(
  90. Xim, INT16, XPointer
  91. );
  92. /*
  93. * private part of IM
  94. */
  95. typedef struct _XimProtoPrivateRec {
  96. /* The first fields are identical with XimCommonPrivateRec. */
  97. XlcConv ctom_conv;
  98. XlcConv ctow_conv;
  99. XlcConv ctoutf8_conv;
  100. XlcConv cstomb_conv;
  101. XlcConv cstowc_conv;
  102. XlcConv cstoutf8_conv;
  103. XlcConv ucstoc_conv;
  104. XlcConv ucstoutf8_conv;
  105. Window im_window;
  106. XIMID imid;
  107. CARD16 unused;
  108. XIMStyles *default_styles;
  109. CARD32 *im_onkeylist;
  110. CARD32 *im_offkeylist;
  111. BITMASK32 flag;
  112. BITMASK32 registed_filter_event;
  113. EVENTMASK forward_event_mask;
  114. EVENTMASK synchronous_event_mask;
  115. XimProtoIntrRec *intrproto;
  116. XIMResourceList im_inner_resources;
  117. unsigned int im_num_inner_resources;
  118. XIMResourceList ic_inner_resources;
  119. unsigned int ic_num_inner_resources;
  120. char *hold_data;
  121. int hold_data_len;
  122. char *locale_name;
  123. CARD16 protocol_major_version;
  124. CARD16 protocol_minor_version;
  125. XrmQuark *saved_imvalues;
  126. int num_saved_imvalues;
  127. /*
  128. * transport specific
  129. */
  130. XimTransConnectProc connect;
  131. XimTransShutdownProc shutdown;
  132. XimTransWriteProc write;
  133. XimTransReadProc read;
  134. XimTransFlushProc flush;
  135. XimTransRegDispatcher register_dispatcher;
  136. XimTransCallDispatcher call_dispatcher;
  137. XPointer spec;
  138. } XimProtoPrivateRec;
  139. /*
  140. * bit mask for the flag of XIMPrivateRec
  141. */
  142. #define SERVER_CONNECTED (1L)
  143. #define DYNAMIC_EVENT_FLOW (1L << 1)
  144. #define USE_AUTHORIZATION_FUNC (1L << 2)
  145. #ifdef XIM_CONNECTABLE
  146. #define DELAYBINDABLE (1L << 3)
  147. #define RECONNECTABLE (1L << 4)
  148. #endif /* XIM_CONNECTABLE */
  149. #define FABRICATED (1L << 5)
  150. #define NEED_SYNC_REPLY (1L << 6)
  151. /*
  152. * macro for the flag of XIMPrivateRec
  153. */
  154. #define IS_SERVER_CONNECTED(im) \
  155. ((((Xim)im))->private.proto.flag & SERVER_CONNECTED)
  156. #define MARK_SERVER_CONNECTED(im) \
  157. ((((Xim)im))->private.proto.flag |= SERVER_CONNECTED)
  158. #define UNMARK_SERVER_CONNECTED(im) \
  159. ((((Xim)im))->private.proto.flag &= ~SERVER_CONNECTED)
  160. #define IS_DYNAMIC_EVENT_FLOW(im) \
  161. (((Xim)im)->private.proto.flag & DYNAMIC_EVENT_FLOW)
  162. #define MARK_DYNAMIC_EVENT_FLOW(im) \
  163. (((Xim)im)->private.proto.flag |= DYNAMIC_EVENT_FLOW)
  164. #define IS_USE_AUTHORIZATION_FUNC(im) \
  165. (((Xim)im)->private.proto.flag & USE_AUTHORIZATION_FUNC)
  166. #define MARK_USE_AUTHORIZATION_FUNC(im) \
  167. (((Xim)im)->private.proto.flag |= USE_AUTHORIZATION_FUNC)
  168. #ifdef XIM_CONNECTABLE
  169. #define IS_DELAYBINDABLE(im) \
  170. (((Xim)im)->private.proto.flag & DELAYBINDABLE)
  171. #define MARK_DELAYBINDABLE(im) \
  172. (((Xim)im)->private.proto.flag |= DELAYBINDABLE)
  173. #define IS_RECONNECTABLE(im) \
  174. (((Xim)im)->private.proto.flag & RECONNECTABLE)
  175. #define MARK_RECONNECTABLE(im) \
  176. (((Xim)im)->private.proto.flag |= RECONNECTABLE)
  177. #define IS_CONNECTABLE(im) \
  178. (((Xim)im)->private.proto.flag & (DELAYBINDABLE|RECONNECTABLE))
  179. #define UNMAKE_CONNECTABLE(im) \
  180. (((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE))
  181. #endif /* XIM_CONNECTABLE */
  182. #define IS_FABRICATED(im) \
  183. (((Xim)im)->private.proto.flag & FABRICATED)
  184. #define MARK_FABRICATED(im) \
  185. (((Xim)im)->private.proto.flag |= FABRICATED)
  186. #define UNMARK_FABRICATED(im) \
  187. (((Xim)im)->private.proto.flag &= ~FABRICATED)
  188. #define IS_NEED_SYNC_REPLY(im) \
  189. (((Xim)im)->private.proto.flag & NEED_SYNC_REPLY)
  190. #define MARK_NEED_SYNC_REPLY(im) \
  191. (((Xim)im)->private.proto.flag |= NEED_SYNC_REPLY)
  192. #define UNMARK_NEED_SYNC_REPLY(im) \
  193. (((Xim)im)->private.proto.flag &= ~NEED_SYNC_REPLY)
  194. /*
  195. * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec
  196. */
  197. #define KEYPRESS_MASK (1L)
  198. #define KEYRELEASE_MASK (1L << 1)
  199. #define DESTROYNOTIFY_MASK (1L << 2)
  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. typedef struct _XimPendingCallback {
  208. int major_opcode;
  209. Xim im;
  210. Xic ic;
  211. char *proto;
  212. int proto_len;
  213. struct _XimPendingCallback *next;
  214. } XimPendingCallbackRec, *XimPendingCallback;
  215. /*
  216. * private part of IC
  217. */
  218. typedef struct _XicProtoPrivateRec {
  219. XICID icid; /* ICID */
  220. CARD16 dmy;
  221. BITMASK32 flag; /* Input Mode */
  222. BITMASK32 registed_filter_event; /* registed filter mask */
  223. EVENTMASK forward_event_mask; /* forward event mask */
  224. EVENTMASK synchronous_event_mask;/* sync event mask */
  225. EVENTMASK filter_event_mask; /* negrect event mask */
  226. EVENTMASK intercept_event_mask; /* deselect event mask */
  227. EVENTMASK select_event_mask; /* select event mask */
  228. char *preedit_font; /* Base font name list */
  229. int preedit_font_length; /* length of base font name */
  230. char *status_font; /* Base font name list */
  231. int status_font_length; /* length of base font name */
  232. XimCommitInfo commit_info;
  233. XIMResourceList ic_resources;
  234. unsigned int ic_num_resources;
  235. XIMResourceList ic_inner_resources;
  236. unsigned int ic_num_inner_resources;
  237. XrmQuark *saved_icvalues;
  238. int num_saved_icvalues;
  239. XimPendingCallback pend_cb_que;
  240. Bool waitCallback;
  241. } XicProtoPrivateRec ;
  242. /*
  243. * bit mask for the flag of XICPrivateRec
  244. */
  245. #define IC_CONNECTED (1L)
  246. /*
  247. * macro for the flag of XICPrivateRec
  248. */
  249. #define IS_IC_CONNECTED(ic) \
  250. (((Xic)ic)->private.proto.flag & IC_CONNECTED)
  251. #define MARK_IC_CONNECTED(ic) \
  252. (((Xic)ic)->private.proto.flag |= IC_CONNECTED)
  253. #define UNMARK_IC_CONNECTED(ic) \
  254. (((Xic)ic)->private.proto.flag &= ~IC_CONNECTED)
  255. /*
  256. * macro for the filter_event_mask of XICPrivateRec
  257. */
  258. #define IS_NEGLECT_EVENT(ic, mask) \
  259. (((Xic)ic)->private.proto.filter_event_mask & (mask))
  260. /*
  261. * macro for the forward_event_mask of XICPrivateRec
  262. */
  263. #define IS_FORWARD_EVENT(ic, mask) \
  264. (((Xic)ic)->private.proto.forward_event_mask & (mask))
  265. /*
  266. * macro for the synchronous_event_mask of XICPrivateRec
  267. */
  268. #define IS_SYNCHRONOUS_EVENT(ic, mask) \
  269. ((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False)
  270. #define XIM_MAXIMNAMELEN 64
  271. #define XIM_MAXLCNAMELEN 64
  272. #endif /* _XIMINTP_H */