Back to index

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