Back to index

im-sdk  12.3.91
X11R6IMProtoData.h
Go to the documentation of this file.
00001 /*
00002 Copyright 1990-2001 Sun Microsystems, Inc. All Rights Reserved.
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a
00005 copy of this software and associated documentation files (the
00006 "Software"), to deal in the Software without restriction, including
00007 without limitation the rights to use, copy, modify, merge, publish,
00008 distribute, sublicense, and/or sell copies of the Software, and to
00009 permit persons to whom the Software is furnished to do so, subject to
00010 the following conditions: The above copyright notice and this
00011 permission notice shall be included in all copies or substantial
00012 portions of the Software.
00013 
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018 IN NO EVENT SHALL THE OPEN GROUP OR SUN MICROSYSTEMS, INC. BE LIABLE
00019 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00020 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
00021 THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF
00022 ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
00023 
00024 
00025 Except as contained in this notice, the names of The Open Group and/or
00026 Sun Microsystems, Inc. shall not be used in advertising or otherwise to
00027 promote the sale, use or other dealings in this Software without prior
00028 written authorization from The Open Group and/or Sun Microsystems,
00029 Inc., as applicable.
00030 
00031 
00032 X Window System is a trademark of The Open Group
00033 
00034 OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
00035 logo, LBX, X Window System, and Xinerama are trademarks of the Open
00036 Group. All other trademarks and registered trademarks mentioned herein
00037 are the property of their respective owners. No right, title or
00038 interest in or to any trademark, service mark, logo or trade name of
00039 Sun Microsystems, Inc. or its licensors is granted.
00040 
00041 */
00042 #ifdef HAVE_CONFIG_H
00043 #include <config.h>
00044 #endif
00045 
00046 #ifndef _X11R6IMProtoData_h
00047 #define _X11R6IMProtoData_h
00048 
00049 #include <X11/Xmd.h>
00050 #include "Xlcint.h"
00051 #include "XIMTriggerKey.h"
00052 
00053 /* IM Attributes Name */
00054 #define IMModifiers         "modifiers"
00055 #define IMServerWindow             "serverWindow"
00056 #define IMServerName        "serverName"
00057 #define IMServerTransport   "serverTransport"
00058 #define IMLocale            "locale"
00059 #define IMInputStyles              "inputStyles"
00060 #define IMProtocolHandler   "protocolHandler"
00061 #define IMOnKeysList        "onKeysList"
00062 #define IMOffKeysList              "offKeysList"
00063 #define IMEncodingList             "encodingList"
00064 #define IMFilterEventMask   "filterEventMask"
00065 #define IMProtocolDepend    "protocolDepend"
00066 #define IMSupportedIMValues "supportedIMValues"
00067 #define IMSupportedICValues "supportedICValues"
00068 
00069 /* Masks for IM Attributes Name */
00070 #define I18N_IMSERVER_WIN   0x0001 /* IMServerWindow */
00071 #define I18N_IM_NAME        0x0002 /* IMServerName */
00072 #define I18N_IM_LOCALE             0x0004 /* IMLocale */
00073 #define I18N_IM_ADDRESS            0x0008 /* IMServerTransport */
00074 #define I18N_INPUT_STYLES   0x0010 /* IMInputStyles */
00075 #define I18N_ON_KEYS        0x0020 /* IMOnKeysList */
00076 #define I18N_OFF_KEYS              0x0040 /* IMOffKeysList */
00077 #define I18N_IM_HANDLER            0x0080 /* IMProtocolHander */
00078 #define I18N_ENCODINGS             0x0100 /* IMEncodingList */
00079 #define I18N_FILTERMASK            0x0200 /* IMFilterEventMask */
00080 #define I18N_PROTO_DEPEND   0x0400 /* IMProtoDepend */
00081 
00082 typedef char *XIMEncoding;
00083 
00084 typedef struct {
00085     unsigned short count_encodings;
00086     XIMEncoding *supported_encodings;
00087 } XIMEncodings;
00088 
00089 typedef struct _XIMS *XIMS;
00090 
00091 typedef struct _IMForwardEventStruct *IMForwardEvent;
00092 typedef struct _IMCommitEventStruct *IMCommitEvent;
00093 typedef union _X11R6IMProtocolStruct *X11R6IMProtocol;
00094 
00095 typedef struct {
00096     void*     (*setup)(Display*, XIMArg*);
00097     Status    (*openIM)(XIMS);
00098     Status    (*closeIM)(XIMS);
00099     char*     (*setIMValues)(XIMS, XIMArg*);
00100     char*     (*getIMValues)(XIMS, XIMArg*);
00101     Status    (*forwardEvent)(XIMS, IMForwardEvent);
00102     Status    (*commitString)(XIMS, IMCommitEvent);
00103     int              (*callCallback)(XIMS, X11R6IMProtocol);
00104     int              (*preeditStart)(XIMS, X11R6IMProtocol);
00105     int              (*preeditEnd)(XIMS, X11R6IMProtocol);
00106 } IMMethodsRec, *IMMethods;
00107 
00108 typedef struct {
00109     Display   *display;
00110     int              screen;
00111 } IMCoreRec, *IMCore;
00112 
00113 typedef struct _XIMS {
00114     IMMethods methods;
00115     IMCoreRec core;
00116     void      *protocol;
00117     int              id;
00118 } XIMProtocolRec;
00119 
00120 typedef struct {
00121     char *name;
00122     CARD16 type;
00123     CARD16 id;
00124 } XIMListOfAttr;
00125 
00126 typedef struct {
00127     char *name;
00128     CARD8 major_opcode;
00129     CARD8 minor_opcode;
00130 } IMExtList;
00131 
00132 typedef struct {
00133     int              attribute_id;
00134     CARD16    name_length; 
00135     char      *name;
00136     int              value_length;
00137     void      *value;
00138     int              type;
00139 } XIMAttribute;
00140 
00141 typedef struct {
00142     int              attribute_id;
00143     CARD16    name_length;
00144     char      *name;
00145     int              value_length;
00146     void      *value;
00147     int              type;
00148 } XICAttribute;
00149 
00150 typedef struct {
00151     int              length;
00152     char      *name;
00153 } XIMStr;
00154 
00155 /*
00156  * Callback Struct for XIM Protocol
00157  */
00158 typedef struct {
00159     int              major_code;
00160     int              minor_code;
00161     CARD16    connect_id;
00162 } IMAnyStruct;
00163 
00164 typedef struct {
00165     int              major_code;
00166     int              minor_code;
00167     CARD16    connect_id;
00168     CARD8     byte_order;
00169     CARD16    major_version;
00170     CARD16    minor_version;
00171 } IMConnectStruct;
00172 
00173 typedef struct {
00174     int              major_code;
00175     int              minor_code;
00176     CARD16    connect_id;
00177 } IMDisConnectStruct;
00178 
00179 typedef struct {
00180     int              major_code;
00181     int              minor_code;
00182     CARD16    connect_id;
00183     XIMStr    lang;
00184 } IMOpenStruct;
00185 
00186 typedef struct {
00187     int              major_code;
00188     int              minor_code;
00189     CARD16    connect_id;
00190 } IMCloseStruct;
00191 
00192 typedef struct {
00193     int              major_code;
00194     int              minor_code;
00195     CARD16    connect_id;
00196     CARD16    number;
00197     XIMStr    *extension;
00198 } IMQueryExtensionStruct;
00199 
00200 typedef struct {
00201     int              major_code;
00202     int              minor_code;
00203     CARD16    connect_id;
00204     CARD16    number;
00205     char      **im_attr_list;
00206 } IMGetIMValuesStruct;
00207 
00208 typedef struct {
00209     int              major_code;
00210     int              minor_code;
00211     CARD16    connect_id;
00212     CARD16    icid;
00213     CARD16    preedit_attr_num;
00214     CARD16    status_attr_num;
00215     CARD16    ic_attr_num;
00216     XICAttribute *preedit_attr;
00217     XICAttribute *status_attr;
00218     XICAttribute *ic_attr;
00219 } IMChangeICStruct;
00220 
00221 typedef struct {
00222     int              major_code;
00223     int              minor_code;
00224     CARD16    connect_id;
00225     CARD16    icid;
00226 } IMDestroyICStruct;
00227 
00228 typedef struct {
00229     int              major_code;
00230     int              minor_code;
00231     CARD16    connect_id;
00232     CARD16    icid;
00233     CARD16    length;
00234     char      *commit_string;
00235 } IMResetICStruct;
00236 
00237 typedef struct {
00238     int              major_code;
00239     int              minor_code;
00240     CARD16    connect_id;
00241     CARD16    icid;
00242 } IMChangeFocusStruct;
00243 
00244 typedef struct _IMForwardEventStruct {
00245     int              major_code;
00246     int              minor_code;
00247     CARD16    connect_id;
00248     CARD16    icid;
00249     CARD16    sync_bit;
00250     CARD16    serial_number;
00251     XEvent    event;
00252 } IMForwardEventStruct;
00253 
00254 typedef struct _IMCommitEventStruct {
00255     int              major_code;
00256     int              minor_code;
00257     CARD16    connect_id;
00258     CARD16    icid;
00259     CARD16    flag;
00260     KeySym    keysym;
00261     char      *commit_string;
00262 } IMCommitEventStruct;
00263 
00264 typedef struct {
00265     int              major_code;
00266     int              minor_code;
00267     CARD16    connect_id;
00268     CARD16    icid;
00269     CARD32    flag;
00270     CARD32    key_index;
00271     CARD32    event_mask;
00272 } IMTriggerNotifyStruct;
00273 
00274 typedef struct {
00275     int              major_code;
00276     int              minor_code;
00277     CARD16    connect_id;
00278     CARD16    encoding_number;
00279     XIMStr    *encoding;    /* name information */
00280     CARD16    encoding_info_number;
00281     XIMStr    *encodinginfo;       /* detailed information */
00282     CARD16    category;     /* #0 for name, #1 for detail */
00283     INT16     enc_index;    /* index of the encoding determined */
00284 } IMEncodingNegotiationStruct;
00285 
00286 typedef struct {
00287     int              major_code;
00288     int              minor_code;
00289     CARD16    connect_id;
00290     CARD16    icid;
00291     CARD32    flag;
00292     CARD32    forward_event_mask;
00293     CARD32    sync_event_mask;
00294 } IMSetEventMaskStruct;
00295 
00296 typedef struct {
00297     int              major_code;
00298     int              minor_code;
00299     CARD16    connect_id;
00300     CARD16    icid;
00301     CARD32    flag;
00302     CARD32    intercept_event_mask;
00303     CARD32    select_event_mask;
00304     CARD32    forward_event_mask;
00305     CARD32    sync_event_mask;
00306 } IMExtSetEventMaskStruct;
00307 
00308 typedef struct {
00309     int              major_code;
00310     int              minor_code;
00311     CARD16    connect_id;
00312     CARD16    icid;
00313     CARD16    x;
00314     CARD16    y;
00315 } IMMoveStruct;
00316 
00317 typedef struct {
00318     int              major_code;
00319     int              minor_code;
00320     CARD16    connect_id;
00321     CARD16    icid;
00322     CARD16    flag;
00323     CARD16    error_code;
00324     CARD16    str_length;
00325     CARD16    error_type;
00326     char      *error_detail;
00327 } IMErrorStruct;
00328 
00329 typedef struct {
00330     int              major_code;
00331     int              minor_code;
00332     CARD16    connect_id;
00333     CARD16    icid;
00334     CARD32    operation;    /* True: set, False: get */
00335     CARD32    conv_state;
00336 } IMPreeditStateStruct;
00337 
00338 /* Callbacks */
00339 typedef struct {
00340     int              major_code;
00341     int              minor_code;
00342     CARD16    connect_id;
00343     CARD16    icid;
00344 } IMGeometryCBStruct;
00345 
00346 typedef struct {
00347     int              major_code;
00348     int              minor_code;
00349     CARD16    connect_id;
00350     CARD16    icid;
00351     union {
00352        int return_value;                  /* PreeditStart */
00353        XIMPreeditDrawCallbackStruct draw; /* PreeditDraw */
00354        XIMPreeditCaretCallbackStruct caret;      /* PreeditCaret */
00355     } todo;
00356 } IMPreeditCBStruct;
00357 
00358 typedef struct {
00359     int              major_code;
00360     int              minor_code;
00361     CARD16    connect_id;
00362     CARD16    icid;
00363     union {
00364        XIMStatusDrawCallbackStruct draw;  /* StatusDraw */
00365     } todo;
00366 } IMStatusCBStruct;
00367 
00368 typedef struct {
00369     int              major_code;
00370     int              minor_code;
00371     CARD16    connect_id;
00372     CARD16    icid;
00373     XIMStringConversionCallbackStruct strconv;
00374 } IMStrConvCBStruct;
00375 
00376 typedef union _X11R6IMProtocolStruct {
00377     int       major_code;
00378     IMAnyStruct any;
00379     IMConnectStruct imconnect;
00380     IMDisConnectStruct imdisconnect;
00381     IMOpenStruct imopen;
00382     IMCloseStruct imclose;
00383     IMQueryExtensionStruct queryext;
00384     IMGetIMValuesStruct getim;
00385     IMEncodingNegotiationStruct encodingnego;
00386     IMExtSetEventMaskStruct extsetevent;
00387     IMMoveStruct extmove;
00388     IMSetEventMaskStruct setevent;
00389     IMChangeICStruct changeic;
00390     IMDestroyICStruct destroyic;
00391     IMResetICStruct resetic;
00392     IMChangeFocusStruct changefocus;
00393     IMCommitEventStruct commitstring;
00394     IMForwardEventStruct forwardevent;
00395     IMTriggerNotifyStruct triggernotify;
00396     IMPreeditStateStruct preedit_state;
00397     IMErrorStruct imerror;
00398     IMGeometryCBStruct geometry_callback;
00399     IMPreeditCBStruct preedit_callback;
00400     IMStatusCBStruct status_callback;
00401     IMStrConvCBStruct strconv_callback;
00402     long pad[32];
00403 } X11R6IMProtocolStruct;
00404 
00405 typedef struct {
00406     int (*proc)(
00407               XIMS, X11R6IMProtocol *, XPointer
00408               );
00409     XPointer client_data;
00410 } X11R6IMProtoHandler;
00411 
00412 /*
00413  * value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT
00414  */
00415 #define XimSYNCHRONUS                0x0001
00416 #define XimLookupChars               0x0002
00417 #define XimLookupKeySym              0x0004
00418 #define XimLookupBoth                0x0006
00419 
00420 #endif /* _X11R6IMProtoData_h */