1
/******************************************************************
3
Copyright 1994, 1995 by Sun Microsystems, Inc.
4
Copyright 1993, 1994 by Hewlett-Packard Company
6
Permission to use, copy, modify, distribute, and sell this software
7
and its documentation for any purpose is hereby granted without fee,
8
provided that the above copyright notice appear in all copies and
9
that both that copyright notice and this permission notice appear
10
in supporting documentation, and that the name of Sun Microsystems, Inc.
11
and Hewlett-Packard not be used in advertising or publicity pertaining to
12
distribution of the software without specific, written prior permission.
13
Sun Microsystems, Inc. and Hewlett-Packard make no representations about
14
the suitability of this software for any purpose. It is provided "as is"
15
without express or implied warranty.
17
SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
18
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
20
SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
21
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
22
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
23
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
24
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26
Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
28
This version tidied and debugged by Steve Underwood May 1999
30
******************************************************************/
35
#include <X11/Xfuncs.h>
40
* Minor Protocol Number for Extension Protocol
42
#define XIM_EXTENSION 128
43
#define XIM_EXT_SET_EVENT_MASK (0x30)
44
#define XIM_EXT_FORWARD_KEYEVENT (0x32)
45
#define XIM_EXT_MOVE (0x33)
46
#define COMMON_EXTENSIONS_NUM 3
51
/* XI18N Valid Attribute Name Definition */
52
#define ExtForwardKeyEvent "extForwardKeyEvent"
53
#define ExtMove "extMove"
54
#define ExtSetEventMask "extSetEventMask"
59
#define IMPAD(length) ((4 - ((length)%4))%4)
62
* Target Atom for Transport Connection
64
#define LOCALES "LOCALES"
65
#define TRANSPORT "TRANSPORT"
78
typedef struct _XIMPending
81
struct _XIMPending *next;
84
typedef struct _XimProtoHdr
141
typedef struct _Xi18nClient
148
'l': for little-endian
152
/* property offset to read next data */
153
long property_offset;
154
void *trans_rec; /* contains transport specific data */
155
struct _Xi18nClient *next;
158
typedef struct _Xi18nCore *Xi18n;
161
* Callback Struct for XIM Protocol
176
CARD16 major_version;
177
CARD16 minor_version;
185
} IMDisConnectStruct;
209
} IMQueryExtensionStruct;
218
} IMGetIMValuesStruct;
226
CARD16 preedit_attr_num;
227
CARD16 status_attr_num;
229
XICAttribute *preedit_attr;
230
XICAttribute *status_attr;
231
XICAttribute *ic_attr;
258
} IMChangeFocusStruct;
267
CARD16 serial_number;
269
} IMForwardEventStruct;
291
} IMTriggerNotifyStruct;
298
CARD16 encoding_number;
299
XIMStr *encoding; /* name information */
300
CARD16 encoding_info_number;
301
XIMStr *encodinginfo; /* detailed information */
302
CARD16 category; /* #0 for name, #1 for detail */
303
INT16 enc_index; /* index of the encoding determined */
304
} IMEncodingNegotiationStruct;
313
CARD32 forward_event_mask;
314
CARD32 sync_event_mask;
315
} IMSetEventMaskStruct;
323
CARD32 filter_event_mask;
324
CARD32 intercept_event_mask;
325
CARD32 select_event_mask;
326
CARD32 forward_event_mask;
327
CARD32 sync_event_mask;
328
} IMExtSetEventMaskStruct;
359
} IMPreeditStateStruct;
368
} IMGeometryCBStruct;
378
int return_value; /* PreeditStart */
379
XIMPreeditDrawCallbackStruct draw; /* PreeditDraw */
380
XIMPreeditCaretCallbackStruct caret; /* PreeditCaret */
392
XIMStatusDrawCallbackStruct draw; /* StatusDraw */
402
XIMStringConversionCallbackStruct strconv;
413
typedef union _IMProtocol
417
IMConnectStruct imconnect;
418
IMDisConnectStruct imdisconnect;
420
IMCloseStruct imclose;
421
IMQueryExtensionStruct queryext;
422
IMGetIMValuesStruct getim;
423
IMEncodingNegotiationStruct encodingnego;
424
IMExtSetEventMaskStruct extsetevent;
425
IMMoveStruct extmove;
426
IMSetEventMaskStruct setevent;
427
IMChangeICStruct changeic;
428
IMDestroyICStruct destroyic;
429
IMResetICStruct resetic;
430
IMChangeFocusStruct changefocus;
431
IMCommitStruct commitstring;
432
IMForwardEventStruct forwardevent;
433
IMTriggerNotifyStruct triggernotify;
434
IMPreeditStateStruct preedit_state;
435
IMErrorStruct imerror;
436
IMGeometryCBStruct geometry_callback;
437
IMPreeditCBStruct preedit_callback;
438
IMStatusCBStruct status_callback;
439
IMStrConvCBStruct strconv_callback;
440
IMSyncXlibStruct sync_xlib;
444
typedef int (*IMProtoHandler) (XIMS, IMProtocol*);
446
#define DEFAULT_FILTER_MASK (KeyPressMask)
448
/* Xi18nAddressRec structure */
449
typedef struct _Xi18nAddressRec
452
CARD8 im_byteOrder; /* byte order 'B' or 'l' */
455
Window im_window; /* IMServerWindow */
456
char *im_name; /* IMServerName */
457
char *im_locale; /* IMLocale */
458
char *im_addr; /* IMServerTransport */
459
XIMStyles input_styles; /* IMInputStyles */
460
XIMTriggerKeys on_keys; /* IMOnKeysList */
461
XIMTriggerKeys off_keys; /* IMOffKeysList */
462
XIMEncodings encoding_list; /* IMEncodingList */
463
IMProtoHandler improto; /* IMProtocolHander */
464
long filterevent_mask; /* IMFilterEventMask */
465
/* XIM_SERVERS target Atoms */
474
CARD16 preeditAttr_id;
475
CARD16 statusAttr_id;
476
CARD16 separatorAttr_id;
477
/* XIMExtension List */
479
XIMExt extension[COMMON_EXTENSIONS_NUM];
480
/* transport specific connection address */
482
/* actual data is defined:
483
XSpecRec in Xi18nX.h for X-based connection.
484
TransSpecRec in Xi18nTr.h for Socket-based connection.
487
Xi18nClient *clients;
488
Xi18nClient *free_clients;
491
typedef struct _Xi18nMethodsRec
493
Bool (*begin) (XIMS);
495
Bool (*send) (XIMS, CARD16, unsigned char*, long);
496
Bool (*wait) (XIMS, CARD16, CARD8, CARD8);
497
Bool (*disconnect) (XIMS, CARD16);
500
typedef struct _Xi18nCore
502
Xi18nAddressRec address;
503
Xi18nMethodsRec methods;