Back to index

im-sdk  12.3.91
SunIMMthd.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 #ifndef  SUNIMMTHD_H
00043 #define  SUNIMMTHD_H
00044 
00045 #include <stdio.h>
00046 #include <sys/types.h>
00047 #include <dirent.h>
00048 #include <fcntl.h>
00049 #include <unistd.h>
00050 #include <sys/stat.h>
00051 #include "IMProtocolStruct.h"
00052 
00053 #if defined(sun)
00054 #include <thread.h>
00055 #elif defined(WIN32)
00056 #include <windows.h>
00057 #else
00058 #include <pthread.h>
00059 #endif
00060 
00061 #ifdef ENABLE_EIMIL
00062 #include <EIMIL.h>
00063 #endif
00064 
00065 typedef struct _iml_nsc *iml_nsc_t;
00066 typedef struct _iml_desktop_t *iml_desktop_list;
00067 typedef struct _iml_session *iml_session;
00068 typedef struct _iml_if_t *iml_if;
00069 typedef struct _iml_aux *iml_aux;
00070 typedef iml_session iml_session_list;
00071 
00072 typedef struct _iml_nsc {
00073     /* for supporting procedural interface */
00074     int (*open) (iml_nsc_t, char *, mode_t);
00075     size_t (*read) (int, void *, size_t);
00076     size_t (*write) (int, void *, size_t);
00077     int (*getfsize) (iml_nsc_t, int);
00078     int (*close) (iml_nsc_t, int);
00079     iml_desktop_list desktop;
00080 
00081     /* Used along with the listener functionality */
00082     char* filename;
00083     char* identifier;
00084     void* calldata ;
00085     int ns_id;
00086     int file_size;
00087 
00088     /* Method for updating the supported language list per LE */
00089     int (*updateSupportedLocales) (IMLEName *, IMLocale *, int);
00090     int (*mkdir) (int, char *, mode_t);
00091     int (*rmdir) (int, char *);
00092     int (*symlink) (int, char *, char *);
00093     int (*creat) (int, char *, mode_t);
00094     off_t (*lseek) (int, off_t, int);
00095     int (*unlink) (int, char *);
00096     int (*rename) (int, char *, char *);
00097     int (*fcntl) (int, int, int);
00098     int (*truncate) (int, char *, off_t);
00099 } iml_nsc;
00100 
00101 typedef int listener_id_t;
00102 
00103 typedef struct _iml_listener {
00104     iml_session s;
00105     char* listener_name ;
00106     listener_id_t listener_id ; /* identify the listener */
00107     void* (*listener)(listener_id_t listener_id, 
00108                       int size, /* Size of the file read */
00109                     void* public_data, /* buf contain the data retrieved */
00110                     void* private_data /* data passed via addlistener */
00111     );
00112     void* private_data ; /* store the "value" passed by addlistner */
00113     struct _iml_listener *next;    /* link */
00114 } iml_listener_t ;
00115 
00116 typedef iml_listener_t *iml_listener_list;
00117 
00118 typedef struct _iml_desktop_t {
00119     /* public */
00120     iml_if If;                            /* parent IF */
00121 
00122     char *user_name;               /* user info */
00123     char *host_name;               /* user info */
00124     char *display_id;                     /* user info */
00125 
00126     void *specific_data;           /* specific data for desktop */
00127 
00128     iml_session_list session_list;
00129     int session_count;
00130 
00131     /* private */
00132     struct _iml_desktop_t *next;   /* link */
00133 
00134 /*
00135  * Added to bottom for binary compatibility 
00136  */
00137     /* public */
00138     listener_id_t (*addListenerToDesktop)(iml_session, void *, void *); 
00139     iml_listener_t *(*lookupListenerFromDesktop)(iml_session, int) ;
00140     void (*deleteListenerFromDesktop)(iml_session, int);
00141     void *(*desktopGetValue)(char *, void *);
00142 
00143     /* private */
00144     int listener_id;
00145     int listener_count;
00146     iml_listener_list l_list ;
00147 
00148 }   iml_desktop_t;
00149 
00150 typedef struct _iml_methods {
00151     iml_inst *(*iml_make_preedit_start_inst) (iml_session);
00152     iml_inst *(*iml_make_preedit_draw_inst) (iml_session, IMText *);
00153     iml_inst *(*iml_make_preedit_draw_with_chgpos_inst) (iml_session, IMText *, int, int, int);
00154     iml_inst *(*iml_make_preedit_erase_inst) (iml_session);
00155     iml_inst *(*iml_make_preedit_caret_inst) (iml_session, int);
00156     iml_inst *(*iml_make_preedit_done_inst) (iml_session);
00157 
00158     iml_inst *(*iml_make_status_start_inst) (iml_session);
00159     iml_inst *(*iml_make_status_draw_inst) (iml_session, IMText *);
00160     iml_inst *(*iml_make_status_done_inst) (iml_session);
00161 
00162     iml_inst *(*iml_make_lookup_start_inst) (iml_session, IMLookupStartCallbackStruct *);
00163     iml_inst *(*iml_make_lookup_draw_inst) (iml_session, IMLookupDrawCallbackStruct *);
00164     iml_inst *(*iml_make_lookup_done_inst) (iml_session);
00165 
00166     iml_inst *(*iml_make_start_conversion_inst) (iml_session);
00167     iml_inst *(*iml_make_end_conversion_inst) (iml_session);
00168 
00169     iml_inst *(*iml_make_commit_inst) (iml_session, IMText *);
00170     iml_inst *(*iml_make_keypress_inst) (iml_session, IMKeyEventStruct *);
00171 
00172     iml_inst *(*iml_make_aux_start_inst) (iml_session, IMAuxStartCallbackStruct *);
00173     iml_inst *(*iml_make_aux_draw_inst) (iml_session, IMAuxDrawCallbackStruct *);
00174     iml_inst *(*iml_make_aux_done_inst) (iml_session, IMAuxDoneCallbackStruct *);
00175     void *(*iml_new) (iml_session, int);
00176     void *(*iml_new2) (iml_session, int);
00177     void *(*iml_delete) (iml_session);
00178     void *(*iml_delete2) (iml_session);
00179 
00180     iml_inst *(*iml_link_inst_tail) (iml_inst **, iml_inst *);
00181     iml_inst *(*iml_execute) (iml_session, iml_inst **);
00182 
00183     int (*iml_add_listener)(iml_session, char *, void *, void *);
00184     int (*iml_delete_listener)(iml_session, int listener_id);
00185 
00186     Bool (*iml_flush) (iml_session);
00187 
00188     void *(*iml_getvalue) (iml_session, char *, void *);
00189     void (*iml_setvalue) (iml_session, char *, void *);
00190 }   iml_methods_t;
00191 
00192 typedef struct _if_methods {
00193     Bool(*if_OpenIF) (iml_if);
00194     Bool(*if_CloseIF) (iml_if);
00195     Bool(*if_GetIFValues) (iml_if, IMArgList, int);
00196     Bool(*if_SetIFValues) (iml_if, IMArgList, int);
00197 
00198     Bool(*if_OpenDesktop) (iml_desktop_t *, IMArgList, int);
00199     Bool(*if_CloseDesktop) (iml_desktop_t *);
00200 
00201     Bool(*if_CreateSC) (iml_session, IMArgList, int);
00202     Bool(*if_DestroySC) (iml_session);
00203     Bool(*if_GetSCValues) (iml_session, IMArgList, int);
00204     Bool(*if_SetSCValues) (iml_session, IMArgList, int);
00205 
00206     IMText *(*if_ResetSC) (iml_session);
00207 
00208     void (*if_SetSCFocus) (iml_session);
00209     void (*if_UnsetSCFocus) (iml_session);
00210 
00211     void (*if_SendEvent) (iml_session, IMInputEvent *);
00212 }   if_methods_t;
00213 
00214 typedef struct _hotkey_manager {
00215     /* public */
00216     int (*assign_hotkey_profile_id)();
00217     int (*assign_hotkey_id)();
00218     /* private */
00219     unsigned int profile_id ;
00220     unsigned int hotkey_id ;
00221     int num_hkps;
00222 } iml_hotkey_manager_t ;
00223 
00224 /*
00225  * Per interface data structure
00226  */
00227 typedef struct _iml_if_t {
00228     /* public */
00229     char *if_name;                        /* id */
00230     char *if_version;                            /* version */
00231     char *locale;                         /* locale */
00232 
00233     iml_methods_t *m;                            /* link for iml methods */
00234 
00235     iml_desktop_list desktop_list;        /* list for child desktop */
00236     int desktop_count;
00237 
00238     char *ifpath_name;                           /* location of if module */
00239 
00240     /* private */
00241     if_methods_t *ifm;
00242 
00243     void *dl_module;
00244 
00245     IMLEName *lename;
00246     IMLocale *locale_list;
00247     IMEInfo *imeinfo_list;
00248     IMObjectDescriptorStruct *object_list;
00249     Bool xsunim;
00250     Bool need_thread_lock;
00251 #ifdef USE_SUNIM_ADAPTER
00252     Bool need_adapter;
00253 #endif /* USE_SUNIM_ADAPTER */
00254 
00255 #ifdef ENABLE_EIMIL
00256     EIMIL_handle eh;
00257 #endif
00258 /*
00259  * Added to bottom for binary compatibility
00260  */
00261     iml_hotkey_manager_t *hotkey_manager ;
00262     void (*add_hotkey_profile)(iml_if, IMHotkeyProfileStruct *);
00263     IMHotkeyProfileStruct *hkp_list;
00264 }   iml_if_t;
00265 
00266 typedef enum {
00267        IF_VERSION = 1,
00268        IF_METHOD_TABLE,
00269        IF_LE_NAME,
00270        IF_SUPPORTED_LOCALES,
00271        IF_SUPPORTED_OBJECTS,
00272        IF_SUPPORTED_HOTKEY_PROFILE,
00273 #ifdef USE_SUNIM_ADAPTER
00274        IF_NEED_THREAD_LOCK,
00275        IF_HAVE_LOCALE_DEPENDENCY,
00276 #else  /* USE_SUNIM_ADAPTER */
00277        IF_NEED_THREAD_LOCK,
00278 #endif /* USE_SUNIM_ADAPTER */
00279 
00280        /* EIMIL extension */
00281        IF_EIMIL_HANDLE = 0x100,
00282 
00283        /* LE extension */
00284        IF_SUPPORTED_KEYRELEASE,
00285        IF_SUPPORTED_IMEINFO
00286 
00287 }   IF_Attribute;
00288 
00289 typedef enum {
00290        SC_REALIZE = 1,
00291        SC_TRIGGER_ON_NOTIFY,
00292        SC_TRIGGER_OFF_NOTIFY,
00293        SC_SUPPORTED_CHARACTER_SUBSETS,
00294 
00295        SC_PREFERED_OBJECTS = 64,
00296        SC_SUPPORTED_CLASSES = 65,
00297        SC_LOOKUP_NROWS = 100,             /* for compatibility purpose */
00298        SC_LOOKUP_NCOLS,                   /* for compatibility purpose */
00299        SC_LOOKUP_LABELTYPE,        /* for compatibility purpose */
00300 
00301        SC_CLIENT_LOCALE = 200,
00302        SC_CLIENT_CHARACTER_SUBSETS,
00303        SC_CLIENT_INPUT_METHOD_NAME,
00304        SC_CLIENT_INPUT_METHOD_ENGINE
00305 }   SC_Attribute;
00306 
00307 typedef enum {
00308        UI_USER_NAME = 1,
00309        UI_HOST_NAME,
00310        UI_DISPLAY_ID,
00311        UI_PROTOCOL_TYPE,
00312        UI_CLIENT_TYPE,
00313        UI_OS_NAME,
00314        UI_OS_ARCH,
00315        UI_OS_VERSION,
00316        UI_XSERVER_VENDOR,
00317        UI_AUTH_PASSWD
00318 }   UI_Attribute;
00319 
00320 #define       MAX_UI_ATTRIBUTE     UI_AUTH_PASSWD
00321 
00322 #define UI_PROTOCOL_TYPE_IIIMP     "IIIMP"
00323 #define UI_PROTOCOL_TYPE_XIMP      "XIMP"
00324 #define UI_PROTOCOL_TYPE_XIMCP     "XIMCP"
00325 
00326 #define UI_CLIENT_TYPE_JAVA "JAVA"
00327 #define UI_CLIENT_TYPE_X    "X"
00328 #define UI_CLIENT_TYPE_UNKNOWN     "Unknown"
00329 
00330 
00331 
00332 #endif                      /* SUNIMMTHD_H */
00333 /* Local Variables: */
00334 /* c-file-style: "iiim-project" */
00335 /* End: */