| 1 |
/****************************************************************** |
| 2 |
|
| 3 |
Copyright 1992, 1993 by FUJITSU LIMITED |
| 4 |
|
| 5 |
Permission to use, copy, modify, distribute, and sell this software |
| 6 |
and its documentation for any purpose is hereby granted without fee, |
| 7 |
provided that the above copyright notice appear in all copies and |
| 8 |
that both that copyright notice and this permission notice appear |
| 9 |
in supporting documentation, and that the name of FUJITSU LIMITED |
| 10 |
not be used in advertising or publicity pertaining to distribution |
| 11 |
of the software without specific, written prior permission. |
| 12 |
FUJITSU LIMITED makes no representations about the suitability of |
| 13 |
this software for any purpose. |
| 14 |
It is provided "as is" without express or implied warranty. |
| 15 |
|
| 16 |
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 17 |
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 18 |
EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
| 19 |
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF |
| 20 |
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| 21 |
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 22 |
PERFORMANCE OF THIS SOFTWARE. |
| 23 |
|
| 24 |
Author: Takashi Fujiwara FUJITSU LIMITED |
| 25 |
[email protected] |
| 26 |
|
| 27 |
******************************************************************/ |
| 28 |
|
| 29 |
#ifndef _XIMPROTO_H |
| 30 |
#define _XIMPROTO_H |
| 31 |
|
| 32 |
/* |
| 33 |
* Default Preconnection selection target |
| 34 |
*/ |
| 35 |
#define XIM_SERVERS "XIM_SERVERS" |
| 36 |
#define XIM_LOCALES "LOCALES" |
| 37 |
#define XIM_TRANSPORT "TRANSPORT" |
| 38 |
|
| 39 |
/* |
| 40 |
* categories in XIM_SERVERS |
| 41 |
*/ |
| 42 |
#define XIM_SERVER_CATEGORY "@server=" |
| 43 |
#define XIM_LOCAL_CATEGORY "@locale=" |
| 44 |
#define XIM_TRANSPORT_CATEGORY "@transport=" |
| 45 |
|
| 46 |
/* |
| 47 |
* Xim implementation revision |
| 48 |
*/ |
| 49 |
#define PROTOCOLMAJORVERSION 1 |
| 50 |
#define PROTOCOLMINORVERSION 0 |
| 51 |
|
| 52 |
/* |
| 53 |
* Major Protocol number |
| 54 |
*/ |
| 55 |
#define XIM_CONNECT 1 |
| 56 |
#define XIM_CONNECT_REPLY 2 |
| 57 |
#define XIM_DISCONNECT 3 |
| 58 |
#define XIM_DISCONNECT_REPLY 4 |
| 59 |
|
| 60 |
#define XIM_AUTH_REQUIRED 10 |
| 61 |
#define XIM_AUTH_REPLY 11 |
| 62 |
#define XIM_AUTH_NEXT 12 |
| 63 |
#define XIM_AUTH_SETUP 13 |
| 64 |
#define XIM_AUTH_NG 14 |
| 65 |
|
| 66 |
#define XIM_ERROR 20 |
| 67 |
|
| 68 |
#define XIM_OPEN 30 |
| 69 |
#define XIM_OPEN_REPLY 31 |
| 70 |
#define XIM_CLOSE 32 |
| 71 |
#define XIM_CLOSE_REPLY 33 |
| 72 |
#define XIM_REGISTER_TRIGGERKEYS 34 |
| 73 |
#define XIM_TRIGGER_NOTIFY 35 |
| 74 |
#define XIM_TRIGGER_NOTIFY_REPLY 36 |
| 75 |
#define XIM_SET_EVENT_MASK 37 |
| 76 |
#define XIM_ENCODING_NEGOTIATION 38 |
| 77 |
#define XIM_ENCODING_NEGOTIATION_REPLY 39 |
| 78 |
#define XIM_QUERY_EXTENSION 40 |
| 79 |
#define XIM_QUERY_EXTENSION_REPLY 41 |
| 80 |
#define XIM_SET_IM_VALUES 42 |
| 81 |
#define XIM_SET_IM_VALUES_REPLY 43 |
| 82 |
#define XIM_GET_IM_VALUES 44 |
| 83 |
#define XIM_GET_IM_VALUES_REPLY 45 |
| 84 |
|
| 85 |
#define XIM_CREATE_IC 50 |
| 86 |
#define XIM_CREATE_IC_REPLY 51 |
| 87 |
#define XIM_DESTROY_IC 52 |
| 88 |
#define XIM_DESTROY_IC_REPLY 53 |
| 89 |
#define XIM_SET_IC_VALUES 54 |
| 90 |
#define XIM_SET_IC_VALUES_REPLY 55 |
| 91 |
#define XIM_GET_IC_VALUES 56 |
| 92 |
#define XIM_GET_IC_VALUES_REPLY 57 |
| 93 |
#define XIM_SET_IC_FOCUS 58 |
| 94 |
#define XIM_UNSET_IC_FOCUS 59 |
| 95 |
#define XIM_FORWARD_EVENT 60 |
| 96 |
#define XIM_SYNC 61 |
| 97 |
#define XIM_SYNC_REPLY 62 |
| 98 |
#define XIM_COMMIT 63 |
| 99 |
#define XIM_RESET_IC 64 |
| 100 |
#define XIM_RESET_IC_REPLY 65 |
| 101 |
|
| 102 |
#define XIM_GEOMETRY 70 |
| 103 |
#define XIM_STR_CONVERSION 71 |
| 104 |
#define XIM_STR_CONVERSION_REPLY 72 |
| 105 |
#define XIM_PREEDIT_START 73 |
| 106 |
#define XIM_PREEDIT_START_REPLY 74 |
| 107 |
#define XIM_PREEDIT_DRAW 75 |
| 108 |
#define XIM_PREEDIT_CARET 76 |
| 109 |
#define XIM_PREEDIT_CARET_REPLY 77 |
| 110 |
#define XIM_PREEDIT_DONE 78 |
| 111 |
#define XIM_STATUS_START 79 |
| 112 |
#define XIM_STATUS_DRAW 80 |
| 113 |
#define XIM_STATUS_DONE 81 |
| 114 |
#define XIM_PREEDITSTATE 82 |
| 115 |
|
| 116 |
/* |
| 117 |
* values for the flag of XIM_ERROR |
| 118 |
*/ |
| 119 |
#define XIM_IMID_VALID 0x0001 |
| 120 |
#define XIM_ICID_VALID 0x0002 |
| 121 |
|
| 122 |
/* |
| 123 |
* XIM Error Code |
| 124 |
*/ |
| 125 |
#define XIM_BadAlloc 1 |
| 126 |
#define XIM_BadStyle 2 |
| 127 |
#define XIM_BadClientWindow 3 |
| 128 |
#define XIM_BadFocusWindow 4 |
| 129 |
#define XIM_BadArea 5 |
| 130 |
#define XIM_BadSpotLocation 6 |
| 131 |
#define XIM_BadColormap 7 |
| 132 |
#define XIM_BadAtom 8 |
| 133 |
#define XIM_BadPixel 9 |
| 134 |
#define XIM_BadPixmap 10 |
| 135 |
#define XIM_BadName 11 |
| 136 |
#define XIM_BadCursor 12 |
| 137 |
#define XIM_BadProtocol 13 |
| 138 |
#define XIM_BadForeground 14 |
| 139 |
#define XIM_BadBackground 15 |
| 140 |
#define XIM_LocaleNotSupported 16 |
| 141 |
#define XIM_BadSomething 999 |
| 142 |
|
| 143 |
/* |
| 144 |
* byte order |
| 145 |
*/ |
| 146 |
#define BIGENDIAN (CARD8)0x42 /* MSB first */ |
| 147 |
#define LITTLEENDIAN (CARD8)0x6c /* LSB first */ |
| 148 |
|
| 149 |
/* |
| 150 |
* values for the type of XIMATTR & XICATTR |
| 151 |
*/ |
| 152 |
#define XimType_SeparatorOfNestedList 0 |
| 153 |
#define XimType_CARD8 1 |
| 154 |
#define XimType_CARD16 2 |
| 155 |
#define XimType_CARD32 3 |
| 156 |
#define XimType_STRING8 4 |
| 157 |
#define XimType_Window 5 |
| 158 |
#define XimType_XIMStyles 10 |
| 159 |
#define XimType_XRectangle 11 |
| 160 |
#define XimType_XPoint 12 |
| 161 |
#define XimType_XFontSet 13 |
| 162 |
#define XimType_XIMOptions 14 |
| 163 |
#define XimType_XIMHotKeyTriggers 15 |
| 164 |
#define XimType_XIMHotKeyState 16 |
| 165 |
#define XimType_XIMStringConversion 17 |
| 166 |
#define XimType_NEST 0x7fff |
| 167 |
|
| 168 |
/* |
| 169 |
* values for the category of XIM_ENCODING_NEGITIATON_REPLY |
| 170 |
*/ |
| 171 |
#define XIM_Encoding_NameCategory 0 |
| 172 |
#define XIM_Encoding_DetailCategory 1 |
| 173 |
|
| 174 |
/* |
| 175 |
* value for the index of XIM_ENCODING_NEGITIATON_REPLY |
| 176 |
*/ |
| 177 |
#define XIM_Default_Encoding_IDX -1 |
| 178 |
|
| 179 |
/* |
| 180 |
* value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT |
| 181 |
*/ |
| 182 |
#define XimSYNCHRONUS 0x0001 |
| 183 |
#define XimLookupChars 0x0002 |
| 184 |
#define XimLookupKeySym 0x0004 |
| 185 |
#define XimLookupBoth 0x0006 |
| 186 |
|
| 187 |
/* |
| 188 |
* request packet header size |
| 189 |
*/ |
| 190 |
#define XIM_HEADER_SIZE \ |
| 191 |
( sizeof(CARD8) /* sizeof major-opcode */ \ |
| 192 |
+ sizeof(CARD8) /* sizeof minor-opcode */ \ |
| 193 |
+ sizeof(INT16) ) /* sizeof length */ |
| 194 |
|
| 195 |
/* |
| 196 |
* Client Message data size |
| 197 |
*/ |
| 198 |
#define XIM_CM_DATA_SIZE 20 |
| 199 |
|
| 200 |
/* |
| 201 |
* XIM data structure |
| 202 |
*/ |
| 203 |
typedef CARD16 BITMASK16; |
| 204 |
typedef CARD32 BITMASK32; |
| 205 |
typedef CARD32 EVENTMASK; |
| 206 |
|
| 207 |
typedef CARD16 XIMID; /* Input Method ID */ |
| 208 |
typedef CARD16 XICID; /* Input Context ID */ |
| 209 |
|
| 210 |
/* |
| 211 |
* Padding macro |
| 212 |
*/ |
| 213 |
#define XIM_PAD(length) ((4 - ((length) % 4)) % 4) |
| 214 |
|
| 215 |
#define XIM_SET_PAD(ptr, length) \ |
| 216 |
{ \ |
| 217 |
register int Counter = XIM_PAD((int)length); \ |
| 218 |
if (Counter) { \ |
| 219 |
register char *Ptr = (char *)(ptr) + (length); \ |
| 220 |
length += Counter; \ |
| 221 |
for (; Counter; --Counter, ++Ptr) \ |
| 222 |
*Ptr = '\0'; \ |
| 223 |
} \ |
| 224 |
} |
| 225 |
|
| 226 |
#endif /* _XIMPROTO_H */ |