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