comparison include/XIMProto.h @ 0:92745d501b9a

initial import from kinput2-v3.1
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 08 Mar 2010 04:44:30 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92745d501b9a
1 /* @(#)XIMProto.h 2.1 91/07/03 11:28:53 FUJITSU LIMITED. */
2 /******************************************************************
3
4 Copyright 1991, by FUJITSU LIMITED.
5 Copyright 1991, by Sun Microsystems, Inc.
6
7 Permission to use, copy, modify, distribute, and sell this software
8 and its documentation for any purpose is hereby granted without fee,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the name of FUJITSU LIMITED or Sun
12 Microsystems, Inc. not be used in advertising or publicity pertaining
13 to distribution of the software without specific, written prior
14 permission. FUJITSU LIMITED and Sun Microsystems, Inc. make no
15 representations about the suitability of this software for any
16 purpose. It is provided "as is" without express or implied warranty.
17
18 FUJITSU LIMITED AND SUN MICROSYSTEMS, INC. DISCLAIMS ALL WARRANTIES
19 WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
20 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND SUN
21 MICROSYSTEMS, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
22 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
23 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25 PERFORMANCE OF THIS SOFTWARE.
26
27 Author: Takashi Fujiwara FUJITSU LIMITED
28 fujiwara@a80.tech.yk.fujitsu.co.jp
29 Hideki Hiura (hhiura@Sun.COM)
30 Sun Microsystems, Inc.
31 ******************************************************************/
32
33 /* Ximp Protocol Version */
34 #define XIMP_PROTOCOL_VERSION "XIMP.3.5"
35
36 /* Input Context ID */
37 typedef unsigned long ICID;
38
39 /* ClientMessage No. */
40
41 /* client <=> frontend */
42 #define XIMP_KEYPRESS 1
43
44 /* client => frontend */
45 /* Base Protocol */
46 #define XIMP_CREATE 2
47 #define XIMP_DESTROY 3
48 #define XIMP_BEGIN 4
49 #define XIMP_END 5
50 #define XIMP_SETFOCUS 6
51 #define XIMP_UNSETFOCUS 7
52 #define XIMP_CHANGE 8
53 #define XIMP_MOVE 9
54 #define XIMP_RESET 10
55 #define XIMP_SETVALUE 11
56 #define XIMP_GETVALUE 12
57
58 /* Callback Protocol */
59 #define XIMP_PREEDITSTART_RETURN 20
60 #define XIMP_PREEDITCARET_RETURN 21
61
62 /* frontend => client */
63 /* Base Protocol */
64 #define XIMP_CREATE_RETURN 2
65 #define XIMP_CONVERSION_BEGIN 30
66 #define XIMP_PROCESS_BEGIN 30
67 #define XIMP_CONVERSION_END 31
68 #define XIMP_PROCESS_END 31
69 #define XIMP_READPROP 32
70 #define XIMP_GETVALUE_RETURN 33
71 #define XIMP_RESET_RETURN 34
72
73 /* Callback Protocol */
74 #define XIMP_GEOMETRY 40
75 #define XIMP_PREEDITSTART 41
76 #define XIMP_PREEDITDONE 42
77 #define XIMP_PREEDITDRAW 43
78 #define XIMP_PREEDITDRAW_CM 44
79 #define XIMP_PREEDITCARET 45
80 #define XIMP_STATUSSTART 46
81 #define XIMP_STATUSDONE 47
82 #define XIMP_STATUSDRAW 48
83 #define XIMP_STATUSDRAW_CM 49
84
85 /* Extension Protocol */
86 #define XIMP_EXTENSION 90
87
88 /* frontend = ERROR => client */
89 #define XIMP_ERROR 99
90
91 /* Error Notify from IM Server */
92 /* Detail Error Number */
93 #define XIMP_NoError 0 /* No Error */
94 #define XIMP_BadAlloc 1 /* Memeory Alloc Fail */
95 #define XIMP_BadStyle 2 /* Unspported Input Style */
96 #define XIMP_BadClientWindow 3 /* Invalid Client Window */
97 #define XIMP_BadFocusWindow 4 /* Invalid Focus Window */
98 #define XIMP_BadArea 5 /* Invalid Area */
99 #define XIMP_BadSpotLocation 6 /* SpotLocation Out Of Range */
100 #define XIMP_BadColormap 7 /* Invalid Colormap ID */
101 #define XIMP_BadAtom 8 /* Invalid Atom ID */
102 #define XIMP_BadPixel 9 /* Invalid Pixel Value */
103 #define XIMP_BadPixmap 10 /* Invalid Pixmap Value */
104 #define XIMP_BadName 11 /* Invalid Font Name */
105 #define XIMP_BadCursor 12 /* Invalid Cursor ID */
106 #define XIMP_BadProtocol 13 /* Invalid Protocol ID */
107 #define XIMP_BadProperty 14 /* Invalid Property Name */
108 #define XIMP_BadPropertyType 15 /* Invalid Property Type */
109
110 /* Property Name */
111 #define _XIMP_PROTOCOL "_XIMP_PROTOCOL"
112 #define _XIMP_BASE "_XIMP_" /* Root Window
113 * _XIP_<locale_name> */
114
115 /* IMS Window Property Name */
116 #define _XIMP_VERSION "_XIMP_VERSION"
117 #define _XIMP_STYLE "_XIMP_STYLE"
118 #define _XIMP_KEYS "_XIMP_KEYS"
119 #define _XIMP_SERVERNAME "_XIMP_SERVERNAME"
120 #define _XIMP_SERVERVERSION "_XIMP_SERVERVERSION"
121 #define _XIMP_EXTENSIONS "_XIMP_EXTENSIONS"
122 #define _XIMP_PREEDITMAXSIZE "_XIMP_PREEDITMAXSIZE"
123 #define _XIMP_VENDORNAME "_XIMP_VENDORNAME"
124
125 /* Client Window Property Name */
126 #define _XIMP_LIBVERSION "_XIMP_VERSION"
127 #define _XIMP_FOCUS "_XIMP_FOCUS"
128 #define _XIMP_PREEDIT "_XIMP_PREEDIT"
129 #define _XIMP_STATUS "_XIMP_STATUS"
130 #define _XIMP_PREEDITFONT "_XIMP_PREEDITFONT"
131 #define _XIMP_STATUSFONT "_XIMP_STATUSFONT"
132
133 #define _XIMP_CTEXT "_XIMP_CTEXT"
134
135 /* CallBack Property Name */
136
137 #define _XIMP_PREEDIT_DRAW_DATA "_XIMP_PREEDIT_DRAW_DATA"
138
139 #define _XIMP_FEEDBACKS "_XIMP_FEEDBACKS"
140 #define _XIMP_PREEDITDRAWLENGTH "_XIMP_PREEDITDRAWLENGTH"
141 #define _XIMP_PREEDITDRAWSTRING "_XIMP_PREEDITDRAWSTRING"
142 #define _XIMP_PREEDITDRAWFEEDBACK "_XIMP_PREEDITDRAWFEEDBACK"
143
144 /* CallBack Property Name / Type X11R5 */
145 #define _XIMP_EXT_XIMP_CHOICE_START_REQ "_XIMP_EXT_XIMP_CHOICE_START_REQ"
146 #define _XIMP_EXT_XIMP_CHOICE_START_REP "_XIMP_EXT_XIMP_CHOICE_START_REP"
147 #define _XIMP_EXT_XIMP_CHOICE_DRAW_REQ "_XIMP_EXT_XIMP_CHOICE_DRAW_REQ"
148 #define _XIMP_EXT_XIMP_CHOICE_PROC_REQ "_XIMP_EXT_XIMP_CHOICE_PROC_REQ"
149 #define _XIMP_EXT_XIMP_CHOICE_PROC_REP "_XIMP_EXT_XIMP_CHOICE_PROC_REP"
150 #define _XIMP_EXT_XIMP_LOOKUPCHOICES "_XIMP_EXT_XIMP_LOOKUPCHOICES"
151
152 /* Lookup choise REQ and REP X11R5 */
153 #define LOOKUP_CHOICES_BEGIN 0
154 #define LOOKUP_CHOICES_START_REQ 1
155 #define LOOKUP_CHOICES_START_REP 2
156 #define LOOKUP_CHOICES_PROCESS_REQ 3
157 #define LOOKUP_CHOICES_PROCESS_REP 4
158 #define LOOKUP_CHOICES_DRAW_REQ 5
159 #define LOOKUP_CHOICES_DONE_REQ 6
160
161 /* mask (XIMP_CREATE, XIMP_SETVALUE, XIMP_GETVALUE) */
162 #define XIMP_FOCUS_WIN_MASK (1L << 0)
163 #define XIMP_PRE_AREA_MASK (1L << 1)
164 #define XIMP_PRE_FG_MASK (1L << 2)
165 #define XIMP_PRE_BG_MASK (1L << 3)
166 #define XIMP_PRE_COLORMAP_MASK (1L << 4)
167 #define XIMP_PRE_BGPIXMAP_MASK (1L << 5)
168 #define XIMP_PRE_LINESP_MASK (1L << 6)
169 #define XIMP_PRE_CURSOR_MASK (1L << 7)
170 #define XIMP_PRE_AREANEED_MASK (1L << 8)
171 #define XIMP_PRE_SPOTL_MASK (1L << 9)
172 #define XIMP_STS_AREA_MASK (1L << 10)
173 #define XIMP_STS_FG_MASK (1L << 11)
174 #define XIMP_STS_BG_MASK (1L << 12)
175 #define XIMP_STS_COLORMAP_MASK (1L << 13)
176 #define XIMP_STS_BGPIXMAP_MASK (1L << 14)
177 #define XIMP_STS_LINESP_MASK (1L << 15)
178 #define XIMP_STS_CURSOR_MASK (1L << 16)
179 #define XIMP_STS_AREANEED_MASK (1L << 17)
180 #define XIMP_STS_WINDOW_MASK (1L << 18)
181 #define XIMP_PRE_FONT_MASK (1L << 19)
182 #define XIMP_STS_FONT_MASK (1L << 20)
183
184 /* FRONTEND or BACKEND MODE */
185 #define XIMP_FRONTEND 0
186 #define XIMP_BACKEND 1
187
188 /** XIMP_PREEDITDRAW_CM status value
189 * post Ximp 3.4 protocol maybe compliant.
190 * XIMP status flag will may contain the supplementary infomations to
191 * reassemble the XIMPreeditDrawCallbackStruct.
192 * +-----------------------------------------+
193 * 0 | XIMP_PREEDITDRAW_CM |
194 * +-----------------------------------------+
195 * 4 | ICID |
196 * +-------------------+---------------------+
197 * 8 |PreeditDrawCBStatus| caret |
198 * +-------------------+---------------------+
199 * 12| chg_first | chg_length |
200 * +-------------------+---------------------+
201 * 16| feedback |
202 * +-----------------------------------------+
203 * PreeditDrawCBStatus:
204 * 0x0001 no_text: if 1, string == NULL (no following client message.)
205 * 0x0002 no_feedback: if 1 feedback == NULL
206 * 0x0004 feedbacks_via_property: if 1 , feedback field is property atom#
207 **/
208
209 #define XIMP_PDCBSTATUS_NOTEXT 0x0001
210 #define XIMP_PDCBSTATUS_NOFEEDBACK 0x0002
211 #define XIMP_PDCBSTATUS_FEEDBACKS_VIA_PROP 0x0004
212
213 /* _XIMP_KEYS struct */
214
215 typedef struct {
216 unsigned long modifier;
217 unsigned long modifier_mask;
218 KeySym keysym;
219 } Ximp_Key;
220
221 typedef struct {
222 unsigned short count_keys;
223 Ximp_Key *keys_list;
224 } Ximp_KeyList;
225
226 typedef struct _Ximp_Area {
227 long x;
228 long y;
229 long width;
230 long height;
231 } Ximp_AreaRec;
232
233 typedef struct _Ximp_Point {
234 long x;
235 long y;
236 } Ximp_PointRec;
237
238 typedef struct _Ximp_Size {
239 long width;
240 long height;
241 } Ximp_SizeRec;
242
243 /* kana-kanji conversion window attributes */
244
245 #define XIMP_PREEDIT_MAX_LONG 14
246 #define XIMP_PREEDIT_MAX_CHAR 56
247
248 typedef struct _Ximp_Preedit {
249 Ximp_AreaRec Area;
250 unsigned long Foreground;
251 unsigned long Background;
252 Colormap Colormap;
253 Pixmap Bg_Pixmap;
254 long LineSpacing;
255 Cursor Cursor;
256 Ximp_SizeRec AreaNeeded;
257 Ximp_PointRec SpotLocation;
258 } Ximp_PreeditPropRec;
259
260 #define XIMP_STATUS_MAX_LONG 13
261 #define XIMP_STATUS_MAX_CHAR 52
262
263 typedef struct _Ximp_Status {
264 Ximp_AreaRec Area;
265 unsigned long Foreground;
266 unsigned long Background;
267 Colormap Colormap;
268 Pixmap Bg_Pixmap;
269 long LineSpacing;
270 Cursor Cursor;
271 Ximp_SizeRec AreaNeeded;
272 Window window;
273 } Ximp_StatusPropRec;
274
275 /* for CallBack */
276 typedef struct _Ximp_PreeditDrawDataPropRec {
277 long caret;
278 long chg_first;
279 long chg_length;
280 } Ximp_PreeditDrawDataPropRec, *Ximp_PreeditDrawDataProp;
281
282 /* for Commit, PreEditDraw, StatusDraw 03/07/12 X11R5 */
283 typedef struct _Ximp_CommitPropRec {
284 unsigned long icid;
285 char size;
286 char ctext[11];
287 } Ximp_CommitPropRec, Ximp_PreEditDrawCallbackPropRec,
288 Ximp_StatusDrawCallbackPropRec;
289
290 /* for PreEditDraw 03/07/16 X11R5 */
291 typedef struct {
292 short chg_first;
293 short chg_length;
294 } Ximp_slong;
295
296 typedef union {
297 Ximp_slong slong;
298 long l;
299 } Ximp_uslong;
300
301