11ab64890Smrg/******************************************************************
21ab64890Smrg
31ab64890Smrg           Copyright 1992, 1993 by FUJITSU LIMITED
41ab64890Smrg
51ab64890SmrgPermission to use, copy, modify, distribute, and sell this software
61ab64890Smrgand its documentation for any purpose is hereby granted without fee,
71ab64890Smrgprovided that the above copyright notice appear in all copies and
81ab64890Smrgthat both that copyright notice and this permission notice appear
91ab64890Smrgin supporting documentation, and that the name of FUJITSU LIMITED
101ab64890Smrgnot be used in advertising or publicity pertaining to distribution
111ab64890Smrgof the software without specific, written prior permission.
121ab64890SmrgFUJITSU LIMITED makes no representations about the suitability of
1361b2299dSmrgthis software for any purpose.
141ab64890SmrgIt is provided "as is" without express or implied warranty.
151ab64890Smrg
161ab64890SmrgFUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
171ab64890SmrgINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
181ab64890SmrgEVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
191ab64890SmrgCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
201ab64890SmrgUSE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
211ab64890SmrgOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
221ab64890SmrgPERFORMANCE OF THIS SOFTWARE.
231ab64890Smrg
2461b2299dSmrg  Author: Takashi Fujiwara     FUJITSU LIMITED
251ab64890Smrg                               fujiwara@a80.tech.yk.fujitsu.co.jp
261ab64890Smrg
271ab64890Smrg******************************************************************/
281ab64890Smrg
291ab64890Smrg#ifndef _XIMPROTO_H
301ab64890Smrg#define _XIMPROTO_H
311ab64890Smrg
321ab64890Smrg/*
331ab64890Smrg * Default Preconnection selection target
341ab64890Smrg */
351ab64890Smrg#define XIM_SERVERS		"XIM_SERVERS"
361ab64890Smrg#define XIM_LOCALES		"LOCALES"
371ab64890Smrg#define XIM_TRANSPORT		"TRANSPORT"
381ab64890Smrg
391ab64890Smrg/*
401ab64890Smrg * categories in XIM_SERVERS
411ab64890Smrg */
421ab64890Smrg#define XIM_SERVER_CATEGORY	"@server="
431ab64890Smrg#define XIM_LOCAL_CATEGORY	"@locale="
441ab64890Smrg#define XIM_TRANSPORT_CATEGORY	"@transport="
451ab64890Smrg
461ab64890Smrg/*
471ab64890Smrg * Xim implementation revision
481ab64890Smrg */
491ab64890Smrg#define PROTOCOLMAJORVERSION		1
501ab64890Smrg#define PROTOCOLMINORVERSION		0
511ab64890Smrg
521ab64890Smrg/*
531ab64890Smrg * Major Protocol number
541ab64890Smrg */
551ab64890Smrg#define	XIM_CONNECT			  1
561ab64890Smrg#define	XIM_CONNECT_REPLY		  2
571ab64890Smrg#define	XIM_DISCONNECT			  3
581ab64890Smrg#define	XIM_DISCONNECT_REPLY		  4
591ab64890Smrg
601ab64890Smrg#define XIM_AUTH_REQUIRED		 10
611ab64890Smrg#define XIM_AUTH_REPLY			 11
621ab64890Smrg#define XIM_AUTH_NEXT			 12
631ab64890Smrg#define XIM_AUTH_SETUP			 13
641ab64890Smrg#define XIM_AUTH_NG			 14
651ab64890Smrg
661ab64890Smrg#define	XIM_ERROR			 20
671ab64890Smrg
681ab64890Smrg#define	XIM_OPEN			 30
691ab64890Smrg#define	XIM_OPEN_REPLY			 31
701ab64890Smrg#define	XIM_CLOSE			 32
711ab64890Smrg#define	XIM_CLOSE_REPLY			 33
721ab64890Smrg#define	XIM_REGISTER_TRIGGERKEYS	 34
731ab64890Smrg#define	XIM_TRIGGER_NOTIFY		 35
741ab64890Smrg#define	XIM_TRIGGER_NOTIFY_REPLY	 36
751ab64890Smrg#define	XIM_SET_EVENT_MASK		 37
761ab64890Smrg#define	XIM_ENCODING_NEGOTIATION	 38
771ab64890Smrg#define	XIM_ENCODING_NEGOTIATION_REPLY	 39
781ab64890Smrg#define	XIM_QUERY_EXTENSION		 40
791ab64890Smrg#define	XIM_QUERY_EXTENSION_REPLY	 41
801ab64890Smrg#define	XIM_SET_IM_VALUES		 42
811ab64890Smrg#define	XIM_SET_IM_VALUES_REPLY		 43
821ab64890Smrg#define	XIM_GET_IM_VALUES		 44
831ab64890Smrg#define	XIM_GET_IM_VALUES_REPLY		 45
841ab64890Smrg
851ab64890Smrg#define XIM_CREATE_IC			 50
861ab64890Smrg#define	XIM_CREATE_IC_REPLY		 51
871ab64890Smrg#define	XIM_DESTROY_IC			 52
881ab64890Smrg#define	XIM_DESTROY_IC_REPLY		 53
891ab64890Smrg#define XIM_SET_IC_VALUES		 54
901ab64890Smrg#define	XIM_SET_IC_VALUES_REPLY		 55
911ab64890Smrg#define XIM_GET_IC_VALUES		 56
921ab64890Smrg#define XIM_GET_IC_VALUES_REPLY		 57
931ab64890Smrg#define	XIM_SET_IC_FOCUS		 58
941ab64890Smrg#define	XIM_UNSET_IC_FOCUS		 59
951ab64890Smrg#define	XIM_FORWARD_EVENT		 60
961ab64890Smrg#define	XIM_SYNC			 61
971ab64890Smrg#define	XIM_SYNC_REPLY			 62
981ab64890Smrg#define	XIM_COMMIT			 63
991ab64890Smrg#define	XIM_RESET_IC			 64
1001ab64890Smrg#define	XIM_RESET_IC_REPLY		 65
1011ab64890Smrg
1021ab64890Smrg#define	XIM_GEOMETRY			 70
1031ab64890Smrg#define	XIM_STR_CONVERSION		 71
1041ab64890Smrg#define	XIM_STR_CONVERSION_REPLY	 72
1051ab64890Smrg#define	XIM_PREEDIT_START		 73
1061ab64890Smrg#define	XIM_PREEDIT_START_REPLY		 74
1071ab64890Smrg#define	XIM_PREEDIT_DRAW		 75
1081ab64890Smrg#define	XIM_PREEDIT_CARET		 76
1091ab64890Smrg#define XIM_PREEDIT_CARET_REPLY		 77
1101ab64890Smrg#define	XIM_PREEDIT_DONE		 78
1111ab64890Smrg#define	XIM_STATUS_START		 79
1121ab64890Smrg#define	XIM_STATUS_DRAW			 80
1131ab64890Smrg#define	XIM_STATUS_DONE			 81
1141ab64890Smrg#define	XIM_PREEDITSTATE		 82
1151ab64890Smrg
1161ab64890Smrg/*
1171ab64890Smrg * values for the flag of XIM_ERROR
1181ab64890Smrg */
1191ab64890Smrg#define	XIM_IMID_VALID			0x0001
1201ab64890Smrg#define	XIM_ICID_VALID			0x0002
1211ab64890Smrg
1221ab64890Smrg/*
1231ab64890Smrg * XIM Error Code
1241ab64890Smrg */
1251ab64890Smrg#define XIM_BadAlloc			1
1261ab64890Smrg#define XIM_BadStyle			2
1271ab64890Smrg#define XIM_BadClientWindow		3
1281ab64890Smrg#define XIM_BadFocusWindow		4
1291ab64890Smrg#define XIM_BadArea			5
1301ab64890Smrg#define XIM_BadSpotLocation		6
1311ab64890Smrg#define XIM_BadColormap			7
1321ab64890Smrg#define XIM_BadAtom			8
1331ab64890Smrg#define XIM_BadPixel			9
1341ab64890Smrg#define XIM_BadPixmap			10
1351ab64890Smrg#define XIM_BadName			11
1361ab64890Smrg#define XIM_BadCursor			12
1371ab64890Smrg#define XIM_BadProtocol			13
1381ab64890Smrg#define XIM_BadForeground		14
1391ab64890Smrg#define XIM_BadBackground		15
1401ab64890Smrg#define XIM_LocaleNotSupported		16
1411ab64890Smrg#define XIM_BadSomething		999
1421ab64890Smrg
1431ab64890Smrg/*
1441ab64890Smrg * byte order
1451ab64890Smrg */
1461ab64890Smrg#define BIGENDIAN	(CARD8)0x42	/* MSB first */
1471ab64890Smrg#define LITTLEENDIAN	(CARD8)0x6c	/* LSB first */
1481ab64890Smrg
1491ab64890Smrg/*
1501ab64890Smrg * values for the type of XIMATTR & XICATTR
1511ab64890Smrg */
1521ab64890Smrg#define	XimType_SeparatorOfNestedList	0
1531ab64890Smrg#define	XimType_CARD8			1
1541ab64890Smrg#define	XimType_CARD16			2
1551ab64890Smrg#define	XimType_CARD32			3
1561ab64890Smrg#define	XimType_STRING8			4
1571ab64890Smrg#define	XimType_Window			5
1581ab64890Smrg#define	XimType_XIMStyles		10
1591ab64890Smrg#define	XimType_XRectangle		11
1601ab64890Smrg#define	XimType_XPoint			12
1611ab64890Smrg#define XimType_XFontSet		13
1621ab64890Smrg#define XimType_XIMOptions		14
1631ab64890Smrg#define XimType_XIMHotKeyTriggers	15
1641ab64890Smrg#define XimType_XIMHotKeyState		16
1651ab64890Smrg#define XimType_XIMStringConversion	17
1661ab64890Smrg#define	XimType_NEST			0x7fff
1671ab64890Smrg
1681ab64890Smrg/*
1691ab64890Smrg * values for the category of XIM_ENCODING_NEGITIATON_REPLY
1701ab64890Smrg */
1711ab64890Smrg#define	XIM_Encoding_NameCategory	0
1721ab64890Smrg#define	XIM_Encoding_DetailCategory	1
1731ab64890Smrg
1741ab64890Smrg/*
1751ab64890Smrg * value for the index of XIM_ENCODING_NEGITIATON_REPLY
1761ab64890Smrg */
1771ab64890Smrg#define	XIM_Default_Encoding_IDX	-1
1781ab64890Smrg
1791ab64890Smrg/*
1801ab64890Smrg * value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT
1811ab64890Smrg */
1821ab64890Smrg#define XimSYNCHRONUS		  0x0001
1831ab64890Smrg#define XimLookupChars		  0x0002
1841ab64890Smrg#define XimLookupKeySym		  0x0004
1851ab64890Smrg#define XimLookupBoth		  0x0006
1861ab64890Smrg
1871ab64890Smrg/*
1881ab64890Smrg * request packet header size
1891ab64890Smrg */
1901ab64890Smrg#define XIM_HEADER_SIZE						\
191d4a3aaf4Smrg	( sizeof(CARD8)		/* sizeof major-opcode */	\
1921ab64890Smrg	+ sizeof(CARD8)		/* sizeof minor-opcode */	\
193d4a3aaf4Smrg	+ sizeof(INT16)	)	/* sizeof length */
1941ab64890Smrg
1951ab64890Smrg/*
1961ab64890Smrg * Client Message data size
1971ab64890Smrg */
1981ab64890Smrg#define	XIM_CM_DATA_SIZE	20
1991ab64890Smrg
2001ab64890Smrg/*
2011ab64890Smrg * XIM data structure
2021ab64890Smrg */
2031ab64890Smrgtypedef CARD16	BITMASK16;
2041ab64890Smrgtypedef CARD32	BITMASK32;
2051ab64890Smrgtypedef CARD32	EVENTMASK;
2061ab64890Smrg
2071ab64890Smrgtypedef CARD16	XIMID;		/* Input Method ID */
2081ab64890Smrgtypedef CARD16	XICID;		/* Input Context ID */
2091ab64890Smrg
2101ab64890Smrg/*
2111ab64890Smrg * Padding macro
2121ab64890Smrg */
2131ab64890Smrg#define	XIM_PAD(length) ((4 - ((length) % 4)) % 4)
2141ab64890Smrg
2151ab64890Smrg#define XIM_SET_PAD(ptr, length)					\
21607fb9b8fSmrg    do {								\
2171ab64890Smrg	register int	 Counter = XIM_PAD((int)length);		\
2181ab64890Smrg	if (Counter) {							\
2191ab64890Smrg	    register char	*Ptr = (char *)(ptr) + (length);	\
2201ab64890Smrg	    length += Counter;						\
2211ab64890Smrg	    for (; Counter; --Counter, ++Ptr)				\
2221ab64890Smrg		*Ptr = '\0';						\
2231ab64890Smrg	}								\
22407fb9b8fSmrg    } while (0)
2251ab64890Smrg
2261ab64890Smrg#endif /* _XIMPROTO_H */
227