Back to index

im-sdk  12.3.91
commonIM.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 #ifdef HAVE_CONFIG_H
00044 #include <config.h>
00045 #endif
00046 
00047 #ifndef _commonIM_h
00048 #define _commonIM_h
00049 
00050 #ifndef __XLIBINT_HH
00051 #define __XLIBINT_HH
00052 #include <X11/Xlibint.h>
00053 #endif /* __XLIBINT_HH */
00054 #include "Xlcint.h"
00055 #include "XlcPublic.h"
00056 
00057 #include "XIM.h"
00058 
00059 #define XIM_COMPOSE_KEYCODE 0
00060 
00061 /* forward declaration */
00062 typedef struct _XimCommon *XimCommon;
00063 typedef struct _XicCommon *XicCommon;
00064 
00065 typedef struct _XIMXimpRec *XIMXimp;
00066 typedef struct _XIMPopupRec *XIMPopup;
00067 typedef struct _XIMGUIRec *XIMGUI;
00068 typedef struct _XIMDLRec *XIMDL;
00069 typedef struct _XIMComposeIMRec *XIMComposeIM;
00070 typedef struct _XIMIIimpIMRec *XIMIIimpIM;
00071 
00072 typedef struct _XICXimpRec *XICXimp;
00073 typedef struct _XICPopupRec *XICPopup;
00074 typedef struct _XICGUIRec *XICGUI;
00075 typedef struct _XICComposeIMRec *XICComposeIM;
00076 typedef struct _XICIIimpIMRec *XICIIIMP;
00077 
00078 typedef struct _SwitcherInfo SwitcherInfo;
00079 typedef struct _SwitcherContext SwitcherContext;
00080 
00081 typedef struct _XimCommon {
00082   XIMMethods  methods;
00083   XIMCoreRec  core;
00084   XIMXimp     ximp_impart;  /* has to be just after XIMCoreRec */
00085 
00086   XlcConv     mtow_conv;
00087   XlcConv     wtom_conv;
00088 
00089   XIMPopup    popup_impart;
00090   XIMGUI      gui_impart;
00091   XIMDL              dl_impart;
00092 
00093   Bool        isUnicode;    /* always use UTF16 encoding */
00094   XIMUnicodeCharacterSubsets       *unicode_char_subsets;
00095 
00096   /* XIM private part */
00097   XIMComposeIM       local_impart; /* must be null when IIIMP only */
00098   XIMIIimpIM  iiimp_impart; /* must be null when localIM only */
00099 
00100   SwitcherInfo *switcher_info;
00101 } XimCommonRec;
00102 
00103 #define XIM_USE_UNICODE(im) ((XimCommon)im)->isUnicode
00104 
00105 #define XIM_POPUP(im, field) ((XimCommon)im)->popup_impart->field
00106 #define XIM_IIIMP(im, field) ((XimCommon)im)->iiimp_impart->field
00107 #define XIM_COMPOSE(im, field) ((XimCommon)im)->local_impart->field
00108 #define XIM_GUI(im, field) ((XimCommon)im)->gui_impart->field
00109 
00110 #define XIM_IS_IIIMP(im) ((XimCommon)im)->iiimp_impart
00111 #define XIM_IS_COMPOSE(im) ((XimCommon)im)->local_impart
00112 #define XIM_IS_SWITCH(im) (XIM_IS_IIIMP(im) && XIM_IS_COMPOSE(im))
00113 
00114 typedef enum {
00115   Switch_ON = 1,
00116   Switch_OFF = 2,
00117   Switch_NOP = 3
00118 } SwitchMode;
00119 
00120 typedef SwitchMode (*SwitchKeyEventProc)(XicCommon, XEvent*);
00121 
00122 typedef struct _SwitchFilter {
00123   struct _SwitchFilter *next;
00124   SwitchKeyEventProc is_switch_key;
00125   XFilterEventProc key_filter;
00126   XICMethods ic_methods;
00127 } SwitchFilterEventRec, *SwitchFilterEventList;
00128 
00129 typedef struct _XicCommon {
00130   XICMethods  methods;
00131   XICCoreRec  core;
00132   XICXimp     ximp_icpart;
00133 
00134   XICPopup    popup_icpart;
00135   XICGUI      gui_icpart;
00136 
00137   /* XIC private part */
00138   XICComposeIM       local_icpart; /* must be null when IIIMP only */
00139   XICIIIMP    iiimp_icpart; /* must be null when localIM only */
00140 
00141   XIMCallback switchim_notify_callback;
00142   XIMCallback commit_string_callback;
00143   XIMCallback forward_event_callback;
00144 
00145   XIMUnicodeCharacterSubsetID      subset_id;
00146 
00147   XIMCallback lookup_start_callback;
00148   XIMCallback lookup_draw_callback;
00149   XIMCallback lookup_done_callback;
00150 
00151   Bool (*active_filter)(Display *, Window, XEvent *, XPointer);
00152   XICMethods active_methods;
00153   struct _SwitchFilter *switch_filters;
00154 
00155   SwitcherContext *switcher_context; /* per context */
00156   char *current_language;
00157 } XicCommonRec;
00158 
00159 #define XIC_POPUP(ic, field) ((XicCommon)ic)->popup_icpart->field
00160 #define XIC_IIIMP(ic, field) ((XicCommon)ic)->iiimp_icpart->field
00161 #define XIC_COMPOSE(ic, field) ((XicCommon)ic)->local_icpart->field
00162 #define XIC_GUI(ic, field) ((XicCommon)ic)->gui_icpart->field
00163 
00164 extern Status  CommonOpenIM(XIM xim, XLCd lcd, Display *dpy, XrmDatabase rdb,
00165                          char *res_name, char *res_class);
00166 extern Status CommonCreateIC(XIC xic, XIMArg *arg);
00167 extern Status CommonDestroyIC(XIC xic);
00168 extern Status CommonCloseIM(XIM xim);
00169 
00170 #endif