Back to index

im-sdk  12.3.91
default.c
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /*
00003 Copyright 1990-2001 Sun Microsystems, Inc. All Rights Reserved.
00004 
00005 Permission is hereby granted, free of charge, to any person obtaining a
00006 copy of this software and associated documentation files (the
00007 "Software"), to deal in the Software without restriction, including
00008 without limitation the rights to use, copy, modify, merge, publish,
00009 distribute, sublicense, and/or sell copies of the Software, and to
00010 permit persons to whom the Software is furnished to do so, subject to
00011 the following conditions: The above copyright notice and this
00012 permission notice shall be included in all copies or substantial
00013 portions of the Software.
00014 
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00017 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00018 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00019 IN NO EVENT SHALL THE OPEN GROUP OR SUN MICROSYSTEMS, INC. BE LIABLE
00020 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00021 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
00022 THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF
00023 ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
00024 
00025 
00026 Except as contained in this notice, the names of The Open Group and/or
00027 Sun Microsystems, Inc. shall not be used in advertising or otherwise to
00028 promote the sale, use or other dealings in this Software without prior
00029 written authorization from The Open Group and/or Sun Microsystems,
00030 Inc., as applicable.
00031 
00032 
00033 X Window System is a trademark of The Open Group
00034 
00035 OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
00036 logo, LBX, X Window System, and Xinerama are trademarks of the Open
00037 Group. All other trademarks and registered trademarks mentioned herein
00038 are the property of their respective owners. No right, title or
00039 interest in or to any trademark, service mark, logo or trade name of
00040 Sun Microsystems, Inc. or its licensors is granted.
00041 
00042 */
00043 /* Copyright (c) 2004 Red Hat, Inc. All rights reserved. */
00044 
00045 #include "SunIM.h"
00046 
00047 Bool    if_default_OpenIF      (iml_if_t *If);
00048 Bool    if_default_CloseIF     (iml_if_t *If);
00049 Bool    if_default_GetIFValue  (iml_if_t *If,
00050                             IMArgList args,
00051                             int       num_args);
00052 Bool    if_default_SetIFValue  (iml_if_t *If,
00053                             IMArgList args,
00054                             int       num_args);
00055 Bool    if_default_OpenDesktop (iml_desktop_t *desktop,
00056                             IMArgList      args,
00057                             int            num_args);
00058 Bool    if_default_CloseDesktop(iml_desktop_t *desktop);
00059 Bool    if_default_CreateSC    (iml_session_t *s,
00060                             IMArgList      args,
00061                             int            num_args);
00062 Bool    if_default_DestroySC   (iml_session_t *s);
00063 Bool    if_default_GetSCValue  (iml_session_t *s,
00064                             IMArgList      args,
00065                             int            num_args);
00066 Bool    if_default_SetSCValue  (iml_session_t *s,
00067                             IMArgList      args,
00068                             int            num_args);
00069 IMText *if_default_ResetSC     (iml_session_t *s);
00070 void    if_default_SetSCFocus  (iml_session_t *s);
00071 void    if_default_UnsetSCFocus(iml_session_t *s);
00072 void    if_default_SendEvent   (iml_session_t *s,
00073                             IMInputEvent *ev);
00074 
00075 /* LEIF methods */
00076 if_methods_t default_methods = {
00077     if_default_OpenIF,
00078     if_default_CloseIF,
00079     if_default_GetIFValue,
00080     if_default_SetIFValue,
00081 
00082     if_default_OpenDesktop,
00083     if_default_CloseDesktop,
00084 
00085     if_default_CreateSC,
00086     if_default_DestroySC,
00087     if_default_GetSCValue,
00088     if_default_SetSCValue,
00089     if_default_ResetSC,
00090     if_default_SetSCFocus,
00091     if_default_UnsetSCFocus,
00092     if_default_SendEvent,
00093 };
00094 
00095 UTFCHAR lename_string[] = {'d', 'e', 'f', 'a', 'u', 'l', 't', 0};
00096 UTFCHAR hrn_string[] = {'d', 'i', 's', 'a', 'b', 'l', 'e', 'd', 0};
00097 
00098 static IMLEName lename = {
00099     "default", lename_string
00100 };
00101 static IMLocale locales[] = {
00102     {"en", hrn_string},
00103     {NULL, NULL},
00104 };
00105 static IMObjectDescriptorStruct *objects = NULL;
00106 
00107 
00108 void
00109 if_GetIfInfo(IMArgList args,
00110             int       num_args)
00111 {
00112     int i;
00113 
00114     for (i = 0; i < num_args; i++, args++) {
00115        switch (args->id) {
00116            case IF_VERSION:
00117               args->value = (IMArgVal) "1.2";
00118               break;
00119            case IF_METHOD_TABLE:
00120               args->value = (IMArgVal) &default_methods;
00121               break;
00122            case IF_LE_NAME:
00123               args->value = (IMArgVal) &lename;
00124               break;
00125            case IF_SUPPORTED_LOCALES:
00126               args->value = (IMArgVal) &locales;
00127               break;
00128            case IF_SUPPORTED_OBJECTS:
00129               args->value = (IMArgVal) objects;
00130               break;
00131            case IF_NEED_THREAD_LOCK:
00132               args->value = (IMArgVal) False;
00133               break;
00134            default:
00135               break;
00136        }
00137     }
00138 }
00139 
00140 /*
00141  * LEIF methods
00142  */
00143 Bool
00144 if_default_OpenIF(iml_if_t *If)
00145 {
00146     return True;
00147 }
00148 
00149 Bool
00150 if_default_CloseIF(iml_if_t *If)
00151 {
00152     return True;
00153 }
00154 
00155 Bool
00156 if_default_GetIFValue(iml_if_t *If,
00157                     IMArgList args,
00158                     int       num_args)
00159 {
00160     return True;
00161 }
00162 
00163 Bool
00164 if_default_SetIFValue(iml_if_t *If,
00165                     IMArgList args,
00166                     int       num_args)
00167 {
00168     return True;
00169 }
00170 
00171 Bool
00172 if_default_OpenDesktop(iml_desktop_t *desktop,
00173                      IMArgList      args,
00174                      int            num_args)
00175 {
00176     return True;
00177 }
00178 
00179 Bool
00180 if_default_CloseDesktop(iml_desktop_t *desktop)
00181 {
00182     return True;
00183 }
00184 
00185 Bool
00186 if_default_CreateSC(iml_session_t *s,
00187                   IMArgList      args,
00188                   int            num_args)
00189 {
00190     return True;
00191 }
00192 
00193 Bool
00194 if_default_DestroySC(iml_session_t *s)
00195 {
00196     return True;
00197 }
00198 
00199 Bool
00200 if_default_GetSCValue(iml_session_t *s,
00201                     IMArgList      args,
00202                     int            num_args)
00203 {
00204     return True;
00205 }
00206 
00207 Bool
00208 if_default_SetSCValue(iml_session_t *s,
00209                     IMArgList      args,
00210                     int            num_args)
00211 {
00212     return True;
00213 }
00214 
00215 IMText *
00216 if_default_ResetSC(iml_session_t *s)
00217 {
00218     return (IMText *)NULL;
00219 }
00220 
00221 void
00222 if_default_SetSCFocus(iml_session_t *s)
00223 {
00224 }
00225 
00226 void
00227 if_default_UnsetSCFocus(iml_session_t *s)
00228 {
00229 }
00230 
00231 void
00232 if_default_SendEvent(iml_session_t *s,
00233                    IMInputEvent *ev)
00234 {
00235     if (ev) {
00236        if (ev->type == IM_EventKeyList) {
00237            iml_inst *lp;
00238 
00239            lp = s->If->m->iml_make_keypress_inst(s, (IMKeyEventStruct *)((IMKeyListEvent *)ev)->keylist);
00240            s->If->m->iml_execute(s, &lp);
00241        }
00242     }
00243 }