00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _Xi18n_h
00022 #define _Xi18n_h
00023 #include <X11/Xlib.h>
00024 #include <X11/Xfuncs.h>
00025 #include <X11/Xos.h>
00026 #include "XimProto.h"
00027
00028
00029
00030
00031 #define XIM_EXTENSION 128
00032 #define XIM_EXT_SET_EVENT_MASK (0x30)
00033 #define XIM_EXT_FORWARD_KEYEVENT (0x32)
00034 #define XIM_EXT_MOVE (0x33)
00035 #define COMMON_EXTENSIONS_NUM 3
00036
00037 #include <stdlib.h>
00038 #include "IMdkit.h"
00039
00040
00041 #define ExtForwardKeyEvent "extForwardKeyEvent"
00042 #define ExtMove "extMove"
00043 #define ExtSetEventMask "extSetEventMask"
00044
00045
00046
00047
00048 #define IMPAD(length) ((4 - ((length)%4))%4)
00049
00050
00051
00052
00053 #define LOCALES "LOCALES"
00054 #define TRANSPORT "TRANSPORT"
00055
00056 #define I18N_OPEN 0
00057 #define I18N_SET 1
00058 #define I18N_GET 2
00059
00060 typedef struct {
00061 char *transportname;
00062 int namelen;
00063 Bool(*checkAddr)();
00064 } TransportSW;
00065
00066 typedef struct _XIMPending {
00067 unsigned char *p;
00068 struct _XIMPending *next;
00069 } XIMPending;
00070
00071 typedef struct _XimProtoHdr {
00072 CARD8 major_opcode;
00073 CARD8 minor_opcode;
00074 CARD16 length;
00075 } XimProtoHdr;
00076
00077 typedef struct {
00078 CARD16 attribute_id;
00079 CARD16 type;
00080 CARD16 length;
00081 char *name;
00082 } XIMAttr;
00083
00084 typedef struct {
00085 CARD16 attribute_id;
00086 CARD16 type;
00087 CARD16 length;
00088 char *name;
00089 } XICAttr;
00090
00091 typedef struct {
00092 int attribute_id;
00093 CARD16 name_length;
00094 char *name;
00095 int value_length;
00096 void *value;
00097 int type;
00098 } XIMAttribute;
00099
00100 typedef struct {
00101 int attribute_id;
00102 CARD16 name_length;
00103 char *name;
00104 int value_length;
00105 void *value;
00106 int type;
00107 } XICAttribute;
00108
00109 typedef struct {
00110 int length;
00111 char *name;
00112 } XIMStr;
00113
00114 typedef struct {
00115 CARD16 major_opcode;
00116 CARD16 minor_opcode;
00117 CARD16 length;
00118 char *name;
00119 } XIMExt;
00120
00121 typedef struct _Xi18nClient {
00122 int connect_id;
00123 CARD8 byte_order;
00124
00125
00126
00127
00128
00129 int sync;
00130 XIMPending *pending;
00131
00132 long property_offset;
00133 void *trans_rec;
00134 struct _Xi18nClient *next;
00135 } Xi18nClient;
00136
00137 typedef struct _Xi18nCore *Xi18n;
00138
00139
00140
00141
00142 typedef struct {
00143 int major_code;
00144 int minor_code;
00145 CARD16 connect_id;
00146 } IMAnyStruct;
00147
00148 typedef struct {
00149 int major_code;
00150 int minor_code;
00151 CARD16 connect_id;
00152 CARD8 byte_order;
00153 CARD16 major_version;
00154 CARD16 minor_version;
00155 } IMConnectStruct;
00156
00157 typedef struct {
00158 int major_code;
00159 int minor_code;
00160 CARD16 connect_id;
00161 } IMDisConnectStruct;
00162
00163 typedef struct {
00164 int major_code;
00165 int minor_code;
00166 CARD16 connect_id;
00167 XIMStr lang;
00168 } IMOpenStruct;
00169
00170 typedef struct {
00171 int major_code;
00172 int minor_code;
00173 CARD16 connect_id;
00174 } IMCloseStruct;
00175
00176 typedef struct {
00177 int major_code;
00178 int minor_code;
00179 CARD16 connect_id;
00180 CARD16 number;
00181 XIMStr *extension;
00182 } IMQueryExtensionStruct;
00183
00184 typedef struct {
00185 int major_code;
00186 int minor_code;
00187 CARD16 connect_id;
00188 CARD16 number;
00189 char **im_attr_list;
00190 } IMGetIMValuesStruct;
00191
00192 typedef struct {
00193 int major_code;
00194 int minor_code;
00195 CARD16 connect_id;
00196 CARD16 icid;
00197 CARD16 preedit_attr_num;
00198 CARD16 status_attr_num;
00199 CARD16 ic_attr_num;
00200 XICAttribute *preedit_attr;
00201 XICAttribute *status_attr;
00202 XICAttribute *ic_attr;
00203 } IMChangeICStruct;
00204
00205 typedef struct {
00206 int major_code;
00207 int minor_code;
00208 CARD16 connect_id;
00209 CARD16 icid;
00210 } IMDestroyICStruct;
00211
00212 typedef struct {
00213 int major_code;
00214 int minor_code;
00215 CARD16 connect_id;
00216 CARD16 icid;
00217 CARD16 length;
00218 char *commit_string;
00219 } IMResetICStruct;
00220
00221 typedef struct {
00222 int major_code;
00223 int minor_code;
00224 CARD16 connect_id;
00225 CARD16 icid;
00226 } IMChangeFocusStruct;
00227
00228 typedef struct {
00229 int major_code;
00230 int minor_code;
00231 CARD16 connect_id;
00232 CARD16 icid;
00233 BITMASK16 sync_bit;
00234 CARD16 serial_number;
00235 XEvent event;
00236 } IMForwardEventStruct;
00237
00238 typedef struct {
00239 int major_code;
00240 int minor_code;
00241 CARD16 connect_id;
00242 CARD16 icid;
00243 CARD16 flag;
00244 KeySym keysym;
00245 char *commit_string;
00246 } IMCommitStruct;
00247
00248 typedef struct {
00249 int major_code;
00250 int minor_code;
00251 CARD16 connect_id;
00252 CARD16 icid;
00253 CARD32 flag;
00254 CARD32 key_index;
00255 CARD32 event_mask;
00256 } IMTriggerNotifyStruct;
00257
00258 typedef struct {
00259 int major_code;
00260 int minor_code;
00261 CARD16 connect_id;
00262 CARD16 encoding_number;
00263 XIMStr *encoding;
00264 CARD16 encoding_info_number;
00265 XIMStr *encodinginfo;
00266 CARD16 category;
00267 INT16 enc_index;
00268 } IMEncodingNegotiationStruct;
00269
00270 typedef struct {
00271 int major_code;
00272 int minor_code;
00273 CARD16 connect_id;
00274 CARD16 icid;
00275 CARD32 flag;
00276 CARD32 forward_event_mask;
00277 CARD32 sync_event_mask;
00278 } IMSetEventMaskStruct;
00279
00280 typedef struct {
00281 int major_code;
00282 int minor_code;
00283 CARD16 connect_id;
00284 CARD16 icid;
00285 CARD32 filter_event_mask;
00286 CARD32 intercept_event_mask;
00287 CARD32 select_event_mask;
00288 CARD32 forward_event_mask;
00289 CARD32 sync_event_mask;
00290 } IMExtSetEventMaskStruct;
00291
00292 typedef struct {
00293 int major_code;
00294 int minor_code;
00295 CARD16 connect_id;
00296 CARD16 icid;
00297 CARD16 x;
00298 CARD16 y;
00299 } IMMoveStruct;
00300
00301 typedef struct {
00302 int major_code;
00303 int minor_code;
00304 CARD16 connect_id;
00305 CARD16 icid;
00306 BITMASK16 flag;
00307 CARD16 error_code;
00308 CARD16 str_length;
00309 CARD16 error_type;
00310 char *error_detail;
00311 } IMErrorStruct;
00312
00313 typedef struct {
00314 int major_code;
00315 int minor_code;
00316 CARD16 connect_id;
00317 CARD16 icid;
00318 } IMPreeditStateStruct;
00319
00320
00321 typedef struct {
00322 int major_code;
00323 int minor_code;
00324 CARD16 connect_id;
00325 CARD16 icid;
00326 } IMGeometryCBStruct;
00327
00328 typedef struct {
00329 int major_code;
00330 int minor_code;
00331 CARD16 connect_id;
00332 CARD16 icid;
00333 union {
00334 int return_value;
00335 XIMPreeditDrawCallbackStruct draw;
00336 XIMPreeditCaretCallbackStruct caret;
00337 } todo;
00338 } IMPreeditCBStruct;
00339
00340 typedef struct {
00341 int major_code;
00342 int minor_code;
00343 CARD16 connect_id;
00344 CARD16 icid;
00345 union {
00346 XIMStatusDrawCallbackStruct draw;
00347 } todo;
00348 } IMStatusCBStruct;
00349
00350 typedef struct {
00351 int major_code;
00352 int minor_code;
00353 CARD16 connect_id;
00354 CARD16 icid;
00355 XIMStringConversionCallbackStruct strconv;
00356 } IMStrConvCBStruct;
00357
00358 typedef struct {
00359 int major_code;
00360 int minor_code;
00361 CARD16 connect_id;
00362 CARD16 icid;
00363 } IMSyncXlibStruct;
00364
00365 typedef union _IMProtocol {
00366 int major_code;
00367 IMAnyStruct any;
00368 IMConnectStruct imconnect;
00369 IMDisConnectStruct imdisconnect;
00370 IMOpenStruct imopen;
00371 IMCloseStruct imclose;
00372 IMQueryExtensionStruct queryext;
00373 IMGetIMValuesStruct getim;
00374 IMEncodingNegotiationStruct encodingnego;
00375 IMExtSetEventMaskStruct extsetevent;
00376 IMMoveStruct extmove;
00377 IMSetEventMaskStruct setevent;
00378 IMChangeICStruct changeic;
00379 IMDestroyICStruct destroyic;
00380 IMResetICStruct resetic;
00381 IMChangeFocusStruct changefocus;
00382 IMCommitStruct commitstring;
00383 IMForwardEventStruct forwardevent;
00384 IMTriggerNotifyStruct triggernotify;
00385 IMPreeditStateStruct preedit_state;
00386 IMErrorStruct imerror;
00387 IMGeometryCBStruct geometry_callback;
00388 IMPreeditCBStruct preedit_callback;
00389 IMStatusCBStruct status_callback;
00390 IMStrConvCBStruct strconv_callback;
00391 IMSyncXlibStruct sync_xlib;
00392 long pad[32];
00393 } IMProtocol;
00394
00395 typedef int (*IMProtoHandler)(XIMS, IMProtocol*);
00396
00397 #define DEFAULT_FILTER_MASK (KeyPressMask)
00398
00399
00400 typedef struct _Xi18nAddressRec {
00401 Display *dpy;
00402 CARD8 im_byteOrder;
00403
00404 long imvalue_mask;
00405 Window im_window;
00406 char *im_name;
00407 char *im_locale;
00408 char *im_addr;
00409 XIMStyles input_styles;
00410 XIMTriggerKeys on_keys;
00411 XIMTriggerKeys off_keys;
00412 XIMEncodings encoding_list;
00413 IMProtoHandler improto;
00414 long filterevent_mask;
00415
00416 Atom selection;
00417 Atom Localename;
00418 Atom Transportname;
00419
00420 int im_attr_num;
00421 XIMAttr *xim_attr;
00422 int ic_attr_num;
00423 XICAttr *xic_attr;
00424 CARD16 preeditAttr_id;
00425 CARD16 statusAttr_id;
00426 CARD16 separatorAttr_id;
00427
00428 int ext_num;
00429 XIMExt extension[COMMON_EXTENSIONS_NUM];
00430
00431 void *connect_addr;
00432
00433
00434
00435
00436
00437 Xi18nClient *clients;
00438 Xi18nClient *free_clients;
00439 } Xi18nAddressRec;
00440
00441 typedef struct _Xi18nMethodsRec {
00442 Bool(*begin)(XIMS);
00443 Bool(*end)(XIMS);
00444 Bool(*send)(XIMS, CARD16, unsigned char*, long);
00445 Bool(*wait)(XIMS, CARD16, CARD8, CARD8);
00446 Bool(*disconnect)(XIMS, CARD16);
00447 } Xi18nMethodsRec;
00448
00449 typedef struct _Xi18nCore {
00450 Xi18nAddressRec address;
00451 Xi18nMethodsRec methods;
00452 } Xi18nCore;
00453
00454 #endif