aboutsummaryrefslogtreecommitdiff
path: root/libX11/src/xlibi18n/XimProto.h
blob: 9551301a22b14b9cf5c7dbb0cfd776baf9d96a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/******************************************************************

           Copyright 1992, 1993 by FUJITSU LIMITED

Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose.
It is provided "as is" without express or implied warranty.

FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

  Author: Takashi Fujiwara     FUJITSU LIMITED
                               fujiwara@a80.tech.yk.fujitsu.co.jp

******************************************************************/

#ifndef _XIMPROTO_H
#define _XIMPROTO_H

/*
 * Default Preconnection selection target
 */
#define XIM_SERVERS		"XIM_SERVERS"
#define XIM_LOCALES		"LOCALES"
#define XIM_TRANSPORT		"TRANSPORT"

/*
 * categories in XIM_SERVERS
 */
#define XIM_SERVER_CATEGORY	"@server="
#define XIM_LOCAL_CATEGORY	"@locale="
#define XIM_TRANSPORT_CATEGORY	"@transport="

/*
 * Xim implementation revision
 */
#define PROTOCOLMAJORVERSION		1
#define PROTOCOLMINORVERSION		0

/*
 * Major Protocol number
 */
#define	XIM_CONNECT			  1
#define	XIM_CONNECT_REPLY		  2
#define	XIM_DISCONNECT			  3
#define	XIM_DISCONNECT_REPLY		  4

#define XIM_AUTH_REQUIRED		 10
#define XIM_AUTH_REPLY			 11
#define XIM_AUTH_NEXT			 12
#define XIM_AUTH_SETUP			 13
#define XIM_AUTH_NG			 14

#define	XIM_ERROR			 20

#define	XIM_OPEN			 30
#define	XIM_OPEN_REPLY			 31
#define	XIM_CLOSE			 32
#define	XIM_CLOSE_REPLY			 33
#define	XIM_REGISTER_TRIGGERKEYS	 34
#define	XIM_TRIGGER_NOTIFY		 35
#define	XIM_TRIGGER_NOTIFY_REPLY	 36
#define	XIM_SET_EVENT_MASK		 37
#define	XIM_ENCODING_NEGOTIATION	 38
#define	XIM_ENCODING_NEGOTIATION_REPLY	 39
#define	XIM_QUERY_EXTENSION		 40
#define	XIM_QUERY_EXTENSION_REPLY	 41
#define	XIM_SET_IM_VALUES		 42
#define	XIM_SET_IM_VALUES_REPLY		 43
#define	XIM_GET_IM_VALUES		 44
#define	XIM_GET_IM_VALUES_REPLY		 45

#define XIM_CREATE_IC			 50
#define	XIM_CREATE_IC_REPLY		 51
#define	XIM_DESTROY_IC			 52
#define	XIM_DESTROY_IC_REPLY		 53
#define XIM_SET_IC_VALUES		 54
#define	XIM_SET_IC_VALUES_REPLY		 55
#define XIM_GET_IC_VALUES		 56
#define XIM_GET_IC_VALUES_REPLY		 57
#define	XIM_SET_IC_FOCUS		 58
#define	XIM_UNSET_IC_FOCUS		 59
#define	XIM_FORWARD_EVENT		 60
#define	XIM_SYNC			 61
#define	XIM_SYNC_REPLY			 62
#define	XIM_COMMIT			 63
#define	XIM_RESET_IC			 64
#define	XIM_RESET_IC_REPLY		 65

#define	XIM_GEOMETRY			 70
#define	XIM_STR_CONVERSION		 71
#define	XIM_STR_CONVERSION_REPLY	 72
#define	XIM_PREEDIT_START		 73
#define	XIM_PREEDIT_START_REPLY		 74
#define	XIM_PREEDIT_DRAW		 75
#define	XIM_PREEDIT_CARET		 76
#define XIM_PREEDIT_CARET_REPLY		 77
#define	XIM_PREEDIT_DONE		 78
#define	XIM_STATUS_START		 79
#define	XIM_STATUS_DRAW			 80
#define	XIM_STATUS_DONE			 81
#define	XIM_PREEDITSTATE		 82

/*
 * values for the flag of XIM_ERROR
 */
#define	XIM_IMID_VALID			0x0001
#define	XIM_ICID_VALID			0x0002

/*
 * XIM Error Code
 */
#define XIM_BadAlloc			1
#define XIM_BadStyle			2
#define XIM_BadClientWindow		3
#define XIM_BadFocusWindow		4
#define XIM_BadArea			5
#define XIM_BadSpotLocation		6
#define XIM_BadColormap			7
#define XIM_BadAtom			8
#define XIM_BadPixel			9
#define XIM_BadPixmap			10
#define XIM_BadName			11
#define XIM_BadCursor			12
#define XIM_BadProtocol			13
#define XIM_BadForeground		14
#define XIM_BadBackground		15
#define XIM_LocaleNotSupported		16
#define XIM_BadSomething		999

/*
 * byte order
 */
#ifdef BIGENDIAN
#undef BIGENDIAN
#endif
#ifdef LITTLEENDIAN
#undef LITTLEENDIAN
#endif

#define BIGENDIAN	(CARD8)0x42	/* MSB first */
#define LITTLEENDIAN	(CARD8)0x6c	/* LSB first */

/*
 * values for the type of XIMATTR & XICATTR
 */
#define	XimType_SeparatorOfNestedList	0
#define	XimType_CARD8			1
#define	XimType_CARD16			2
#define	XimType_CARD32			3
#define	XimType_STRING8			4
#define	XimType_Window			5
#define	XimType_XIMStyles		10
#define	XimType_XRectangle		11
#define	XimType_XPoint			12
#define XimType_XFontSet		13
#define XimType_XIMOptions		14
#define XimType_XIMHotKeyTriggers	15
#define XimType_XIMHotKeyState		16
#define XimType_XIMStringConversion	17
#define	XimType_NEST			0x7fff

/*
 * values for the category of XIM_ENCODING_NEGITIATON_REPLY
 */
#define	XIM_Encoding_NameCategory	0
#define	XIM_Encoding_DetailCategory	1

/*
 * value for the index of XIM_ENCODING_NEGITIATON_REPLY
 */
#define	XIM_Default_Encoding_IDX	-1

/*
 * value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT
 */
#define XimSYNCHRONUS		  0x0001
#define XimLookupChars		  0x0002
#define XimLookupKeySym		  0x0004
#define XimLookupBoth		  0x0006

/*
 * request packet header size
 */
#define XIM_HEADER_SIZE						\
	  sizeof(CARD8)		/* sizeof mejor-opcode */	\
	+ sizeof(CARD8)		/* sizeof minor-opcode */	\
	+ sizeof(INT16)		/* sizeof length */

/*
 * Client Message data size
 */
#define	XIM_CM_DATA_SIZE	20

/*
 * XIM data structure
 */
typedef CARD16	BITMASK16;
typedef CARD32	BITMASK32;
typedef CARD32	EVENTMASK;

typedef CARD16	XIMID;		/* Input Method ID */
typedef CARD16	XICID;		/* Input Context ID */

/*
 * Padding macro
 */
#define	XIM_PAD(length) ((4 - ((length) % 4)) % 4)

#define XIM_SET_PAD(ptr, length)					\
    {									\
	register int	 Counter = XIM_PAD((int)length);		\
	if (Counter) {							\
	    register char	*Ptr = (char *)(ptr) + (length);	\
	    length += Counter;						\
	    for (; Counter; --Counter, ++Ptr)				\
		*Ptr = '\0';						\
	}								\
    }

#endif /* _XIMPROTO_H */