| 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 |
|
| 28 |
Permission to use, copy, modify, distribute, and sell this software and |
| 29 |
its documentation for any purpose is hereby granted without fee, provided |
| 30 |
that the above copyright notice appear in all copies and that both that |
| 31 |
copyright notice and this permission notice appear in supporting |
| 32 |
documentation, and that the name of FUJITSU LIMITED and Sony Corporation |
| 33 |
not be used in advertising or publicity pertaining to distribution of the |
| 34 |
software without specific, written prior permission. FUJITSU LIMITED and |
| 35 |
Sony Corporation makes no representations about the suitability of this |
| 36 |
software for any purpose. It is provided "as is" without express or |
| 37 |
implied warranty. |
| 38 |
|
| 39 |
FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD |
| 40 |
TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 41 |
FITNESS, IN NO EVENT SHALL FUJITSU LIMITED OR SONY CORPORATION BE LIABLE |
| 42 |
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER |
| 43 |
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
| 44 |
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE |
| 45 |
USE OR PERFORMANCE OF THIS SOFTWARE. |
| 46 |
|
| 47 |
Author: Hideki Hiura ([email protected]) Sun Microsystems, Inc. |
| 48 |
Takashi Fujiwara FUJITSU LIMITED |
| 49 |
[email protected] |
| 50 |
Makoto Wakamatsu Sony Corporation |
| 51 |
[email protected] |
| 52 |
Hiroyuki Miyamoto Digital Equipment Corporation |
| 53 |
[email protected] |
| 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 |
*/ |
| 66 |
typedef Bool (*XimProtoIntrProc)( |
| 67 |
Xim, INT16, XPointer, XPointer |
| 68 |
); |
| 69 |
typedef 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 |
*/ |
| 80 |
typedef Bool (*XimTransConnectProc)( |
| 81 |
Xim |
| 82 |
); |
| 83 |
typedef Bool (*XimTransShutdownProc)( |
| 84 |
Xim |
| 85 |
); |
| 86 |
typedef Bool (*XimTransWriteProc)( |
| 87 |
Xim, INT16, XPointer |
| 88 |
); |
| 89 |
typedef Bool (*XimTransReadProc)( |
| 90 |
Xim, XPointer, int, int * |
| 91 |
); |
| 92 |
typedef void (*XimTransFlushProc)( |
| 93 |
Xim |
| 94 |
); |
| 95 |
typedef Bool (*XimTransRegDispatcher)( |
| 96 |
Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer |
| 97 |
); |
| 98 |
typedef Bool (*XimTransCallDispatcher)( |
| 99 |
Xim, INT16, XPointer |
| 100 |
); |
| 101 |
|
| 102 |
/* |
| 103 |
* private part of IM |
| 104 |
*/ |
| 105 |
typedef 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 |
#define FABRICATED (1L << 5) |
| 165 |
#define NEED_SYNC_REPLY (1L << 6) |
| 166 |
|
| 167 |
/* |
| 168 |
* macro for the flag of XIMPrivateRec |
| 169 |
*/ |
| 170 |
#define IS_SERVER_CONNECTED(im) \ |
| 171 |
((((Xim)im))->private.proto.flag & SERVER_CONNECTED) |
| 172 |
#define MARK_SERVER_CONNECTED(im) \ |
| 173 |
((((Xim)im))->private.proto.flag |= SERVER_CONNECTED) |
| 174 |
#define UNMARK_SERVER_CONNECTED(im) \ |
| 175 |
((((Xim)im))->private.proto.flag &= ~SERVER_CONNECTED) |
| 176 |
|
| 177 |
#define IS_DYNAMIC_EVENT_FLOW(im) \ |
| 178 |
(((Xim)im)->private.proto.flag & DYNAMIC_EVENT_FLOW) |
| 179 |
#define MARK_DYNAMIC_EVENT_FLOW(im) \ |
| 180 |
(((Xim)im)->private.proto.flag |= DYNAMIC_EVENT_FLOW) |
| 181 |
|
| 182 |
#define IS_USE_AUTHORIZATION_FUNC(im) \ |
| 183 |
(((Xim)im)->private.proto.flag & USE_AUTHORIZATION_FUNC) |
| 184 |
#define MARK_USE_AUTHORIZATION_FUNC(im) \ |
| 185 |
(((Xim)im)->private.proto.flag |= USE_AUTHORIZATION_FUNC) |
| 186 |
|
| 187 |
#ifdef XIM_CONNECTABLE |
| 188 |
#define IS_DELAYBINDABLE(im) \ |
| 189 |
(((Xim)im)->private.proto.flag & DELAYBINDABLE) |
| 190 |
#define MARK_DELAYBINDABLE(im) \ |
| 191 |
(((Xim)im)->private.proto.flag |= DELAYBINDABLE) |
| 192 |
|
| 193 |
#define IS_RECONNECTABLE(im) \ |
| 194 |
(((Xim)im)->private.proto.flag & RECONNECTABLE) |
| 195 |
#define MARK_RECONNECTABLE(im) \ |
| 196 |
(((Xim)im)->private.proto.flag |= RECONNECTABLE) |
| 197 |
|
| 198 |
#define IS_CONNECTABLE(im) \ |
| 199 |
(((Xim)im)->private.proto.flag & (DELAYBINDABLE|RECONNECTABLE)) |
| 200 |
#define UNMAKE_CONNECTABLE(im) \ |
| 201 |
(((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE)) |
| 202 |
#endif /* XIM_CONNECTABLE */ |
| 203 |
|
| 204 |
#define IS_FABRICATED(im) \ |
| 205 |
(((Xim)im)->private.proto.flag & FABRICATED) |
| 206 |
#define MARK_FABRICATED(im) \ |
| 207 |
(((Xim)im)->private.proto.flag |= FABRICATED) |
| 208 |
#define UNMARK_FABRICATED(im) \ |
| 209 |
(((Xim)im)->private.proto.flag &= ~FABRICATED) |
| 210 |
|
| 211 |
#define IS_NEED_SYNC_REPLY(im) \ |
| 212 |
(((Xim)im)->private.proto.flag & NEED_SYNC_REPLY) |
| 213 |
#define MARK_NEED_SYNC_REPLY(im) \ |
| 214 |
(((Xim)im)->private.proto.flag |= NEED_SYNC_REPLY) |
| 215 |
#define UNMARK_NEED_SYNC_REPLY(im) \ |
| 216 |
(((Xim)im)->private.proto.flag &= ~NEED_SYNC_REPLY) |
| 217 |
|
| 218 |
/* |
| 219 |
* bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec |
| 220 |
*/ |
| 221 |
#define KEYPRESS_MASK (1L) |
| 222 |
#define KEYRELEASE_MASK (1L << 1) |
| 223 |
#define DESTROYNOTIFY_MASK (1L << 2) |
| 224 |
|
| 225 |
typedef struct _XimCommitInfoRec { |
| 226 |
struct _XimCommitInfoRec *next; |
| 227 |
char *string; |
| 228 |
int string_len; |
| 229 |
KeySym *keysym; |
| 230 |
int keysym_len; |
| 231 |
} XimCommitInfoRec, *XimCommitInfo; |
| 232 |
|
| 233 |
typedef struct _XimPendingCallback { |
| 234 |
int major_opcode; |
| 235 |
Xim im; |
| 236 |
Xic ic; |
| 237 |
char *proto; |
| 238 |
int proto_len; |
| 239 |
struct _XimPendingCallback *next; |
| 240 |
} XimPendingCallbackRec, *XimPendingCallback; |
| 241 |
|
| 242 |
|
| 243 |
/* |
| 244 |
* private part of IC |
| 245 |
*/ |
| 246 |
typedef struct _XicProtoPrivateRec { |
| 247 |
XICID icid; /* ICID */ |
| 248 |
CARD16 dmy; |
| 249 |
BITMASK32 flag; /* Input Mode */ |
| 250 |
|
| 251 |
BITMASK32 registed_filter_event; /* registed filter mask */ |
| 252 |
EVENTMASK forward_event_mask; /* forward event mask */ |
| 253 |
EVENTMASK synchronous_event_mask;/* sync event mask */ |
| 254 |
EVENTMASK filter_event_mask; /* negrect event mask */ |
| 255 |
EVENTMASK intercept_event_mask; /* deselect event mask */ |
| 256 |
EVENTMASK select_event_mask; /* select event mask */ |
| 257 |
|
| 258 |
char *preedit_font; /* Base font name list */ |
| 259 |
int preedit_font_length; /* length of base font name */ |
| 260 |
char *status_font; /* Base font name list */ |
| 261 |
int status_font_length; /* length of base font name */ |
| 262 |
|
| 263 |
XimCommitInfo commit_info; |
| 264 |
XIMResourceList ic_resources; |
| 265 |
unsigned int ic_num_resources; |
| 266 |
XIMResourceList ic_inner_resources; |
| 267 |
unsigned int ic_num_inner_resources; |
| 268 |
XrmQuark *saved_icvalues; |
| 269 |
int num_saved_icvalues; |
| 270 |
XimPendingCallback pend_cb_que; |
| 271 |
Bool waitCallback; |
| 272 |
} XicProtoPrivateRec ; |
| 273 |
|
| 274 |
/* |
| 275 |
* bit mask for the flag of XICPrivateRec |
| 276 |
*/ |
| 277 |
#define IC_CONNECTED (1L) |
| 278 |
|
| 279 |
/* |
| 280 |
* macro for the flag of XICPrivateRec |
| 281 |
*/ |
| 282 |
#define IS_IC_CONNECTED(ic) \ |
| 283 |
(((Xic)ic)->private.proto.flag & IC_CONNECTED) |
| 284 |
#define MARK_IC_CONNECTED(ic) \ |
| 285 |
(((Xic)ic)->private.proto.flag |= IC_CONNECTED) |
| 286 |
#define UNMARK_IC_CONNECTED(ic) \ |
| 287 |
(((Xic)ic)->private.proto.flag &= ~IC_CONNECTED) |
| 288 |
|
| 289 |
/* |
| 290 |
* macro for the filter_event_mask of XICPrivateRec |
| 291 |
*/ |
| 292 |
#define IS_NEGLECT_EVENT(ic, mask) \ |
| 293 |
(((Xic)ic)->private.proto.filter_event_mask & (mask)) |
| 294 |
|
| 295 |
/* |
| 296 |
* macro for the forward_event_mask of XICPrivateRec |
| 297 |
*/ |
| 298 |
#define IS_FORWARD_EVENT(ic, mask) \ |
| 299 |
(((Xic)ic)->private.proto.forward_event_mask & (mask)) |
| 300 |
|
| 301 |
/* |
| 302 |
* macro for the synchronous_event_mask of XICPrivateRec |
| 303 |
*/ |
| 304 |
#define IS_SYNCHRONOUS_EVENT(ic, mask) \ |
| 305 |
((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False) |
| 306 |
|
| 307 |
#define XIM_MAXIMNAMELEN 64 |
| 308 |
#define XIM_MAXLCNAMELEN 64 |
| 309 |
|
| 310 |
#endif /* _XIMINTP_H */ |