2 * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved.
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:
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
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.
23 /******************************************************************
25 Copyright 1992, 1993, 1994 by FUJITSU LIMITED
26 Copyright 1993, 1994 by Sony Corporation
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
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.
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
52 Hiroyuki Miyamoto Digital Equipment Corporation
55 ******************************************************************/
61 #include "XlcPublic.h"
64 * for protocol layer callback function
66 typedef Bool (*XimProtoIntrProc)(
67 Xim, INT16, XPointer, XPointer
69 typedef struct _XimProtoIntrRec {
70 XimProtoIntrProc func;
74 struct _XimProtoIntrRec *next;
78 * for transport layer methods
80 typedef Bool (*XimTransConnectProc)(
83 typedef Bool (*XimTransShutdownProc)(
86 typedef Bool (*XimTransWriteProc)(
89 typedef Bool (*XimTransReadProc)(
90 Xim, XPointer, int, int *
92 typedef void (*XimTransFlushProc)(
95 typedef Bool (*XimTransRegDispatcher)(
96 Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer
98 typedef Bool (*XimTransCallDispatcher)(
105 typedef struct _XimProtoPrivateRec {
106 /* The first fields are identical with XimCommonPrivateRec. */
109 XlcConv ctoutf8_conv;
112 XlcConv cstoutf8_conv;
114 XlcConv ucstoutf8_conv;
119 XIMStyles *default_styles;
120 CARD32 *im_onkeylist;
121 CARD32 *im_offkeylist;
124 BITMASK32 registed_filter_event;
125 EVENTMASK forward_event_mask;
126 EVENTMASK synchronous_event_mask;
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;
136 CARD16 protocol_major_version;
137 CARD16 protocol_minor_version;
138 XrmQuark *saved_imvalues;
139 int num_saved_imvalues;
144 XimTransConnectProc connect;
145 XimTransShutdownProc shutdown;
146 XimTransWriteProc write;
147 XimTransReadProc read;
148 XimTransFlushProc flush;
149 XimTransRegDispatcher register_dispatcher;
150 XimTransCallDispatcher call_dispatcher;
152 } XimProtoPrivateRec;
155 * bit mask for the flag of XIMPrivateRec
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 */
166 * macro for the flag of XIMPrivateRec
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)
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)
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)
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)
191 #define IS_RECONNECTABLE(im) \
192 (((Xim)im)->private.proto.flag & RECONNECTABLE)
193 #define MARK_RECONNECTABLE(im) \
194 (((Xim)im)->private.proto.flag |= RECONNECTABLE)
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 */
203 * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec
205 #define KEYPRESS_MASK (1L)
206 #define KEYRELEASE_MASK (1L << 1)
207 #define DESTROYNOTIFY_MASK (1L << 2)
209 typedef struct _XimCommitInfoRec {
210 struct _XimCommitInfoRec *next;
215 } XimCommitInfoRec, *XimCommitInfo;
217 typedef struct _XimPendingCallback {
223 struct _XimPendingCallback *next;
224 } XimPendingCallbackRec, *XimPendingCallback;
230 typedef struct _XicProtoPrivateRec {
231 XICID icid; /* ICID */
233 BITMASK32 flag; /* Input Mode */
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 */
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 */
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;
256 } XicProtoPrivateRec ;
259 * bit mask for the flag of XICPrivateRec
261 #define IC_CONNECTED (1L)
262 #define FABLICATED (1L << 1)
263 #define NEED_SYNC_REPLY (1L << 2)
264 #define FOCUSED (1L << 3)
267 * macro for the flag of XICPrivateRec
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)
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)
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)
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)
298 * macro for the filter_event_mask of XICPrivateRec
300 #define IS_NEGLECT_EVENT(ic, mask) \
301 (((Xic)ic)->private.proto.filter_event_mask & (mask))
304 * macro for the forward_event_mask of XICPrivateRec
306 #define IS_FORWARD_EVENT(ic, mask) \
307 (((Xic)ic)->private.proto.forward_event_mask & (mask))
310 * macro for the synchronous_event_mask of XICPrivateRec
312 #define IS_SYNCHRONOUS_EVENT(ic, mask) \
313 ((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False)
315 #define XIM_MAXIMNAMELEN 64
316 #define XIM_MAXLCNAMELEN 64
318 #endif /* _XIMINTP_H */