Back to index

im-sdk  12.3.91
iiimpIM.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 
00043 #ifndef iiimpIM_H
00044 #define iiimpIM_H
00045 
00046 #include <iiimcf.h>
00047 #include "commonIM.h"
00048 #include "xiiimp.h"
00049 
00050 extern XIM _IIIMP_OpenIM(XLCd lcd, Display *dpy, XrmDatabase rdb,
00051                       char *res_name, char *res_class);
00052 
00053 typedef struct _im_locale_pair {
00054   char *canonical;
00055   char *alias;
00056 } im_locale_pair;
00057 
00058 typedef struct _XIMIIimpIMRec {
00059   IIIMCF_handle handle;
00060   Window      cb_window;
00061   Bool          inited;
00062 
00063   int on_keys_num;
00064   IIIMCF_keyevent *pkev_on;
00065   int off_keys_num;
00066   IIIMCF_keyevent *pkev_off;
00067 
00068   char        *engine_name;
00069   char        *default_font_name;
00070   char        *primary_locale;
00071   char        *client_type;
00072   XIC         current_ic;
00073 
00074   im_locale_pair *lang_alias;
00075 
00076   XIMText     *supported_languages;
00077   int         count_languages;
00078 
00079   XIMMethods  switch_methods;
00080 
00081   int counter;
00082 
00083 } XIMIIimpIMRec;
00084 
00085 extern void ChangePreeditState(XicCommon);
00086 extern void SetConversionMode(XicCommon, int);
00087 extern void PutBackXKeyEvent(XicCommon);
00088 extern void HoldXKeyEvent(XicCommon, XEvent *);
00089 
00090 #define IsConversionMode(ic)  (XIM_IS_IIIMP(ic->core.im) && XIC_IIIMP(ic, filtered))
00091 
00092 /* private XIC data for IIIMP */
00093 typedef struct _XICKeyEventList {
00094   XKeyEvent                 key_event;
00095   struct _XICKeyEventList * next;
00096 } XICKeyEventListRec;
00097 
00098 typedef struct _XICIIimpIMRec {
00099   IIIMCF_context context;
00100   int           preedit_prev_len;
00101   Bool        filtered;
00102   KeySym      keysym_return;       /* For IM_FORWARD_EVENT(Server->Client)
00103                                (Now only for dummy) */
00104 
00105   /* flag for X*LookupString (Why this API involves dirty state???)
00106      Once committed text is looked up by X*LookupString.
00107      This flag must be set until the next commited text comes. */
00108   Bool          committed_text_consumed;
00109 
00110   /*  The following member is used for AUX object and external programs.
00111       For backward compatibility, such entities require an integer id to
00112       distinguish context so that this member holds a unique number.  */
00113   int id;
00114 
00115   XICKeyEventListRec *key_event_list;
00116   int         key_event_num;
00117 
00118   XKeyEvent   keyevent_return;
00119   Bool        has_keyevent_return;
00120 
00121   int         key_event_forwarded;
00122 
00123   struct _aux   *aux;
00124 
00125   XICMethods  switch_methods;
00126 } XICIIimpIMRec;
00127 
00128 typedef enum {
00129   CONV_OFF = 0,
00130   CONV_ON = 1
00131 } XICConversionMode;
00132 
00133 typedef enum {
00134   CREATE_IC = 0,
00135   SET_IC = 1
00136 } XICSetMode;
00137 
00138 typedef enum {
00139   INPUT_LANGUAGE = 1,
00140   CHARACTER_SUBSETS = 2,
00141   INPUT_METHOD = 3
00142 } ICAttributeID;
00143 
00144 #define IIIMP_CLIENT_TYPE "XIM IIIMP ADAPTOR"
00145 
00146 typedef enum {
00147   IM_GUI_OBJECT = 0,
00148   IM_LWE_OBJECT = 1,
00149   IM_SYNTAX_RULE_OBJECT = 2,
00150   IM_MANAGER_RULE_OBJECT = 3,
00151   IM_PRELOADING_LWE_OBJECT = 4
00152 } IMObjectCategory;
00153 
00154 typedef enum {
00155   INPUTMETHOD_LIST = 0x1001,
00156   OBJECT_DESCRIPTER_LIST = 0x1010,
00157   CLIENT_DESCRIPTER = 0x1011,
00158   CCDEF = 0x1030,
00159   GUI_OBJECT = 0x1033,
00160   LWE_OBJECT = 0x1034,
00161   OS_VERSION  = 0x2001,
00162   OS_NAME     = 0x2002,
00163   OS_ARCH     = 0x2003
00164 } IMAttributeID;
00165 
00166 typedef struct {
00167   ICAttributeID attribute_id;
00168   int         value_length;
00169   XPointer    value;
00170 } XICAttribute;
00171 
00172 typedef struct _IIIMObject {
00173   IMObjectCategory   obj_cat;      /* object category */
00174   unsigned int              obj_size;     /* object size */
00175   IMAttributeID             id;           /* CCDEF, GUI_OBJECT, LWE_OBJECT */
00176   unsigned int              id_dyn;              /* dynamic assigned id */
00177   char *             domain;              /* reversed domain */
00178   CARD16 *           name;         /* HRN */
00179   int                name_length;  /* HRN len in UTF16-char unit */
00180   char *             signature;    /* Object signature */
00181   char *             scope;        /* usability id or `generic' */
00182 
00183   char *             path;         /* path for object */
00184   char *             basepath;     /* base path for include tag */
00185   char *             encoding;     /* encoding of CCDEF */
00186 
00187   struct _IIIMObject *      next;
00188 } IIIMObjectRec;
00189 
00190 extern char * IIIMP_GetIMValues(XIM xim, XIMArg *arg);
00191 extern char*  IIIMP_SetIMValues(XIM xim, XIMArg *arg);
00192 
00193 extern Status IIIMP_OpenIM_SWITCH(XIM xim, XLCd lcd, Display *dpy);
00194 extern Status IIIMP_CreateIC_SWITCH(XIC xic, XIMArg *arg);
00195 
00196 extern IIIMCF_language get_IM_language(
00197     XimCommon im
00198 );
00199 
00200 /* iiimcfFun.c */
00201 extern Bool   IMGetICValues(XicCommon ic, XICAttribute *ic_attr,
00202                            int attr_count);
00203 extern Bool   IMSetICValues(XicCommon ic, XICAttribute *ic_attr,
00204                            int attr_count);
00205 extern Bool   IMCheckIMWindow(XicCommon ic, Window window);
00206 extern Bool   IMForwardEvent(XicCommon xic, XEvent *ev);
00207 extern Bool   IMTriggerNotify(XicCommon ic, XICConversionMode conv_mode);
00208 extern Bool   IMSetIMValues(XimCommon im);
00209 extern Bool   IMGetIMValue(XimCommon im, int attr_id);
00210 
00211 extern Bool   IMAuxSetValues(XicCommon ic, IIIMCF_event ev);
00212 extern Bool   IMAuxGetValues(XicCommon ic, IIIMCF_event ev);
00213 
00214 extern IIIMF_status IMCreateIC(
00215     XimCommon im,
00216     IIIMCF_context *pc
00217 );
00218 extern Bool IMSetPrimaryLocale(
00219     XicCommon ic,
00220     char *input_locale
00221 );
00222 extern IIIMF_status IMChangeFocus(
00223     XicCommon ic,
00224     int flag
00225 );
00226 extern Bool IMChangeClientType(
00227     XimCommon im,
00228     char *client_type
00229 );
00230 extern void IM_free_langlist(
00231     XimCommon im
00232 );
00233 
00234 
00235 /* iiimpConv.c */
00236 extern int    IMConvertFromUTF8ToUTF16(char *from_buf, size_t from_left,
00237                                     char **to_buf, size_t *to_left);
00238 extern int    IMConvertFromUTF8(char *from_buf, size_t from_left,
00239                               char **to_buf, size_t *to_left);
00240 extern int    IIimpConvertToUTF16(char *from_buf, size_t from_left,
00241                                 char **to_buf, size_t *to_left);
00242 extern int    IIimpConvertFromUTF16(const char *from_buf, size_t from_left,
00243                                   char **to_buf, size_t * to_left);
00244 extern int    IMConvertToUTF8(char *from_buf, size_t from_left,
00245                             char **to_buf, size_t *to_left);
00246 extern int    IIimpWcstoMbs(XimCommon im, wchar_t *from, int from_len,
00247                            char *to, int to_len, Status *state);
00248 extern int    IIimpMbstoWcs(XimCommon im, char *from, int from_len,
00249                            wchar_t *to, int to_len, Status *state);
00250 
00251 extern int    IMConvertFromUTF8ToUTF16(char *from_buf, size_t from_left,
00252                                     char **to_buf, size_t *to_left);
00253 
00254 extern void   SwitchKeyEventFilter(XicCommon ic, Window old_focus);
00255 extern void   IIIMPKeyEventFilter(XicCommon ic, Window old_focus);
00256 
00257 /* iiimpClientDescriptor.c */
00258 extern void   makeClientDescripter(Display *dpy, char *client_name,
00259                                  XICAttribute *ic_attr,
00260                                  int icid);
00261 
00262 extern void ic_change_conversion_mode (XicCommon ic, char *conv_mode);
00263 extern void ic_initialize_with_input_language (XicCommon ic, char *new_lang);
00264 
00265 #endif
00266 
00267 /* Local Variables: */
00268 /* c-file-style: "iiim-project" */
00269 /* End: */