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