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