Back to index

im-sdk  12.3.91
key_event.c
Go to the documentation of this file.
00001 /*
00002   Copyright 2002-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 #include <stdio.h>
00043 #include <string.h>
00044 #include <alloca.h>
00045 
00046 #include "le.h"
00047 #include "encode.h"
00048 #include "xaux_locale.h"
00049 #include "logf.h"
00050 #include "iml.h"
00051 #include "le_proc.h"
00052 
00053 void switch_to_prev_lang(iml_session_t *s, unit_desktop_t *udp, int engine_id);
00054 void switch_to_next_lang(iml_session_t *s, unit_desktop_t *udp, int engine_id);
00055 int map_keyevent_to_immkey(unit_desktop_t *udp, IMKeyEventStruct *key_event);
00056 void proc_key_round_switch_ime_event(unit_desktop_t *udp, iml_session_t *s);
00057 void proc_key_switch_conversion_event(unit_desktop_t *udp, iml_session_t *s, int on, char *to_locale);
00058 void proc_hotkey_conversion_event(unit_desktop_t *udp, iml_session_t *s, int on, char *to_locale);
00059 void proc_key_select_switch_ime_event(unit_desktop_t *udp, iml_session_t *s, int ime_id);
00060 void proc_key_output(unit_desktop_t *udp, iml_session_t *s, IMKeyEventStruct *key_event);
00061 extern IMHotkeyProfileStruct *get_hkp_from_hkm(int);
00062 extern int unit_desktop_get_curr_profile_id(unit_desktop_t *udp);
00063 
00064 /* process the keyboard event */
00065 void 
00066 proc_key_event(
00067     unit_desktop_t *udp,
00068     iml_session_t *s,
00069     IMKeyListEvent *keylistevent
00070 )
00071 {
00072     MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00073     IMKeyEventStruct *key_event = (IMKeyEventStruct *) keylistevent->keylist;
00074     char *cur_locale_string;
00075     char *cur_engine_string;
00076     int i,  key_ret, engine_id;
00077     int feid = 0, leid = 0;
00078     int keyCode, Modifier, keyChar;
00079 
00080     keyCode = key_event->keyCode;
00081     keyChar = key_event->keyChar;
00082     Modifier = key_event->modifier;
00083 
00084     cur_locale_string = (char *)alloca(256 * sizeof(char));
00085     cur_engine_string = (char *)alloca(256 * sizeof(char));
00086 
00087     (void) memset((char *)cur_locale_string,'\0',256);
00088     (void) memset((char *)cur_engine_string,'\0',256);
00089 
00090     /* if no input methods in language engine. */
00091     if (udp->gEngine_Num <=0) {
00092        log_f("udp->gEngine_Num is zero \n");
00093        iml_sendback_key(s, key_event);
00094        return;
00095     }
00096 
00097     key_ret = map_keyevent_to_immkey(udp, key_event);
00098     engine_id = session_data->paletteaux_status.engine_id;
00099 
00100     switch (key_ret) {
00101        /* English status <----> Non-English status */
00102       case ENGLISH_NONENGLISH_SWITCH_KEY:
00103        proc_key_switch_conversion_event(udp, s, CONVERSION_OFF, (char *)NULL);
00104        return;
00105 
00106        /* Bound Switching between Input Methods */
00107       case ROUND_SWITCH_KEY:
00108        proc_key_round_switch_ime_event(udp, s);
00109        return;
00110 
00111     }
00112 
00113     if ((keyCode == udp->nextLocaleKeycode) && (Modifier == udp->nextLocaleModifier)) {
00114        switch_to_next_lang(s, udp, engine_id);
00115        return;
00116     }
00117 
00118     if ((keyCode == udp->prevLocaleKeycode) && (Modifier == udp->prevLocaleModifier)) {
00119        switch_to_prev_lang(s, udp, engine_id);
00120        return;
00121     }
00122 
00123     if((keyCode == udp->layoutNameKeyCode) && (Modifier == udp->layoutNameModifier)){ 
00124        /*  Changing keyboard layout Name */
00125        log_f("Changing Layout: engine_id [%d]\n",engine_id);
00126        (void) strncpy((char *)cur_locale_string, udp->modeList[engine_id]->locale_name, strlen( udp->modeList[engine_id]->locale_name));
00127        log_f("Changing Layout: cur_locale_string [%s]\n",cur_locale_string);
00128        (void) strncpy((char *)cur_engine_string, udp->modeList[engine_id]->engine_name, strlen(udp->modeList[engine_id]->engine_name));
00129        log_f("Changing Layout: engine_name [%s]\n",cur_engine_string);
00130 
00131        for(i=0; i< udp->locale_Num; i++){
00132            if(!strcmp(cur_locale_string, udp->localeList[i].locale_name)){
00133               feid = udp->localeList[i].firstEngineId;
00134               leid = udp->localeList[i].lastEngineId;
00135            }
00136        }
00137        log_f("Changing Layout: feid [%d] leid [%d]\n",feid, leid);
00138        for (i = engine_id; i<= udp->gEngine_Num; i++) {
00139            if(!strcmp(cur_locale_string, udp->modeList[i]->locale_name)){
00140               if(!strcmp(cur_engine_string, udp->modeList[i]->engine_name)){
00141                   log_f("Engine EQUAL <%s>\n",udp->modeList[i]->engine_name);
00142                   if(engine_id == leid){
00143                      log_f("engine_id == leid \n");
00144                      le_switch_engine(udp, s, feid, True);
00145                      break;
00146                   }
00147               }else{
00148                   log_f("Engine NOT EQUAL engine_name <%s>\n",udp->modeList[i]->engine_name);
00149                   log_f("NOT EQUAL engine_id <%d>\n",udp->modeList[i]->engine_id);
00150                   le_switch_engine(udp, s, udp->modeList[i]->engine_id, True);
00151                   break;
00152               }
00153            }
00154        }
00155        return;
00156     }
00157     proc_key_output(udp, s, key_event);
00158 }
00159 
00160 void process_hotkey_event(
00161     unit_desktop_t *udp,
00162     iml_session_t *s, 
00163     IMKeyListEvent *keylistevent
00164 )
00165 {
00166     MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00167     IMKeyEventStruct *key_event = (IMKeyEventStruct *) keylistevent->keylist;
00168     int key_ret;
00169     int keyCode, Modifier, keyChar;
00170     int on = session_data->paletteaux_status.on;
00171 
00172     keyCode = key_event->keyCode;
00173     keyChar = key_event->keyChar;
00174     Modifier = key_event->modifier;
00175 
00176     /* Incase of Hotkey Event, keylistEvent->n_operation holds the Hotkey_ID and   */ 
00177     /* keylistEvent->n_key holds the Index of KEYEVENT in LISTofKEYEVENT in HOTKEY */
00178 
00179     log_f("process_hotkey_event: session [%x], udp [0x%x], Hotkey ID [%d], Index [%d] \n", s, udp, keylistevent->n_operation, keylistevent->n_key);
00180 
00181     /* if no input methods in language engine. */
00182     if (udp->gEngine_Num <=0) {
00183        log_f("udp->gEngine_Num is zero \n");
00184        iml_sendback_key(s, key_event);
00185        return;
00186     }
00187 
00188     key_ret = map_keyevent_to_immkey(udp, key_event);
00189 
00190     switch (key_ret) {
00191        /* If the incoming key is Hotkey (deadkey) and                  */
00192        /* 1. If Client conversion mode is turned OFF, then             */
00193        /*    - turn ON the conversion and set hotkey_flag as          */
00194        /*      IME_HOTKEY_START (this flag will be changed by Xctim    */
00195        /*      to IME_HOTKEY_END after completing the deadkey          */
00196        /*      composition and committing it)                          */
00197        /*    - session_data->ime_buffer->conv_flag helps restore       */
00198        /*      the original CONVERSION MODE of the client              */
00199        /*    - In this case, since conv_flag = CONVERSION_OFF,         */
00200        /*      once the deadkey operation is completed, conversion     */
00201        /*      will be turned OFF                                      */
00202        /* 2. If Client conversion mode is turned ON, then              */
00203        /*    - In this case, since conv_flag = CONVERSION_ON,          */
00204        /*      once the deadkey operation is completed, conversion     */
00205        /*      will still be turned ON.                                */
00206        /*    - process the key input                                   */
00207 
00208       case IME_DEADKEY_AS_HOTKEY:
00209       {
00210         if (!on) {
00211           session_data->paletteaux_status.engine_id = 0xff;
00212           proc_key_switch_conversion_event(udp, s, CONVERSION_ON, (char *)"en");
00213           session_data->ime_buffer->hotkey_flag = IME_HOTKEY_START;
00214           session_data->ime_buffer->conv_flag = CONVERSION_OFF;
00215         } else {
00216           session_data->ime_buffer->conv_flag = CONVERSION_ON;
00217         }
00218         proc_key_output(udp, s, key_event);
00219         return;
00220       }
00221 
00222       case IME_COMPOSE_KEY_AS_HOTKEY:
00223       {
00224         if (!on) {
00225           session_data->paletteaux_status.engine_id = 0xff;
00226           proc_key_switch_conversion_event(udp, s, CONVERSION_ON, (char *)"en");
00227           session_data->ime_buffer->hotkey_flag = IME_HOTKEY_START;
00228           session_data->ime_buffer->conv_flag = CONVERSION_OFF;
00229         } else {
00230           session_data->ime_buffer->conv_flag = CONVERSION_ON;
00231         }
00232         key_event->keyCode = IM_VK_T;
00233         key_event->keyChar = IM_VK_T;
00234         key_event->modifier = IM_CTRL_MASK|IM_SHIFT_MASK ;
00235 
00236         proc_key_output(udp, s, key_event);
00237         return;
00238       }
00239 
00240       case IME_EURO_KEY_AS_HOTKEY:
00241       {
00242        session_data->ime_buffer->hotkey_flag = IME_HOTKEY_COMMIT;
00243         if (!on) {
00244           session_data->paletteaux_status.engine_id = 0xff;
00245            proc_hotkey_conversion_event(udp, s, CONVERSION_ON, (char *)"en");
00246           session_data->ime_buffer->conv_flag = CONVERSION_OFF;
00247         } else {
00248           session_data->ime_buffer->conv_flag = CONVERSION_ON;
00249         }
00250         proc_key_output(udp, s, key_event);
00251         return;
00252       }
00253     }
00254     proc_key_output(udp, s, key_event);
00255 }
00256 
00257 /* filter keys that used by Input Methods Manager */
00258 int 
00259 map_keyevent_to_immkey(
00260     unit_desktop_t *udp,
00261     IMKeyEventStruct *key_event
00262 ) 
00263 {
00264     int keycode, modifier, keychar;
00265     int i, j;
00266 
00267     keycode = key_event->keyCode;
00268     keychar = key_event->keyChar;
00269     modifier = key_event->modifier;
00270     int profile_id;
00271     IMHotkeyProfileStruct *hkp = NULL;
00272 
00273     log_f("Dec: keycode: %d, keychar: %d, status: %d\n",keycode, keychar, modifier);
00274     log_f("Hex: keycode: %x, keychar: %x, modifier: %x\n",keycode, keychar, modifier);
00275 
00276     /*  Control status */
00277     if (modifier & IM_CTRL_MASK) {
00278        switch(keycode) {
00279          case IM_VK_ESCAPE: return(ROUND_SWITCH_KEY);
00280          case IM_VK_SPACE:  return(ENGLISH_NONENGLISH_SWITCH_KEY);
00281        }
00282     } else if (modifier & IM_ALT_GRAPH_MASK) {
00283        switch(keycode) {
00284          case IM_VK_E:
00285          case IM_VK_4:      
00286          case IM_VK_5:      
00287            return (IME_EURO_KEY_AS_HOTKEY);
00288        }
00289     }
00290 
00291     /* Check if it is DEAD_KEY */
00292     switch(keycode) {
00293       case IM_VK_DEAD_ACUTE:
00294       case IM_VK_DEAD_GRAVE:
00295       case IM_VK_DEAD_CIRCUMFLEX:
00296       case IM_VK_DEAD_TILDE:
00297       case IM_VK_DEAD_MACRON:
00298       case IM_VK_DEAD_BREVE:
00299       case IM_VK_DEAD_ABOVEDOT:
00300       case IM_VK_DEAD_DIAERESIS:
00301       case IM_VK_DEAD_ABOVERING:
00302       case IM_VK_DEAD_DOUBLEACUTE:
00303       case IM_VK_DEAD_CARON:
00304       case IM_VK_DEAD_CEDILLA:
00305       case IM_VK_DEAD_OGONEK:
00306       case IM_VK_DEAD_IOTA:
00307       case IM_VK_DEAD_VOICED_SOUND:
00308       case IM_VK_DEAD_SEMIVOICED_SOUND:
00309        return(IME_DEADKEY_AS_HOTKEY);
00310     }
00311 
00312     /* Check if it is COMPOSE_KEY */
00313     profile_id = unit_desktop_get_curr_profile_id(udp);
00314 
00315     if (profile_id < 0) 
00316       return (IMM_NOT_USED_KEY);
00317 
00318     hkp = get_hkp_from_hkm(profile_id);
00319 
00320     if (hkp) {
00321       for (i=0; i<hkp->num_hotkeys; i++) {
00322         for (j=0; j<hkp->hks[i].nkeys; j++) {
00323           if ((keycode == hkp->hks[i].keys[j].keyCode) && (modifier == hkp->hks[i].keys[j].modifier)) {
00324             free(hkp);
00325             return(IME_COMPOSE_KEY_AS_HOTKEY);
00326           }
00327         }
00328       }
00329     }
00330     return (IMM_NOT_USED_KEY);
00331 }
00332 
00333 void 
00334 proc_hotkey_conversion_event(
00335     unit_desktop_t *udp,
00336     iml_session_t *s,
00337     int on,
00338     char *to_locale
00339 )
00340 {
00341     MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00342     int i, engine_id;
00343 
00344     session_data->paletteaux_status.on = on;
00345     engine_id = session_data->paletteaux_status.engine_id;
00346     log_f("proc_hotkey_conversion_event: engine_id <%d>\n", engine_id);
00347 
00348     if (engine_id != 0xff) {
00349       le_switch_engine(udp, s, engine_id, False);
00350     }
00351 
00352     for (i = 0; i< udp->gEngine_Num; i++) {
00353        if (!strcmp(to_locale, udp->modeList[i]->locale_name)){
00354          engine_id = i;
00355          break;
00356        }
00357     }
00358 
00359     log_f("proc_hotkey_conversion_event:engine_id [%d]\n", engine_id);
00360     le_switch_engine(udp, s, engine_id, False);
00361 }
00362 
00363 void 
00364 proc_key_switch_conversion_event(
00365     unit_desktop_t *udp,
00366     iml_session_t *s,
00367     int on,
00368     char *to_locale
00369 )
00370 {
00371     MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00372     MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00373     int engine_id, i;
00374     char locale_id, system_locale_id;
00375 
00376     log_f("ENGLISH_NONENGLISH SWITCH IME KEY, on:%d\n", on);
00377 
00378     le_clear_ime_buffer(s, session_data->ime_buffer);
00379 
00380     session_data->paletteaux_status.on = on;
00381     engine_id = session_data->paletteaux_status.engine_id;
00382     log_f("proc_key_switch_conversion_event: engine_id <%d>\n", engine_id);
00383     if (on == CONVERSION_OFF) {
00384        log_f("Inside CONVERSION_OFF \n");
00385        le_status_draw(udp, s);
00386        iml_conversion_off(s);
00387     } else {
00388        log_f("Inside CONVERSION_ON \n");
00389        iml_conversion_on(s);
00390        if (engine_id != 0xff) {
00391            log_f("engine_id != 0xff \n");
00392            le_switch_engine(udp, s, engine_id, True);
00393        }
00394     }
00395 
00396     if (on == CONVERSION_ON && engine_id == 0xff) {
00397        if (to_locale == NULL || to_locale[0] == '\0'){
00398            log_f("key_event: to_locale is NULL \n");
00399            system_locale_id = desktop_data->aux_locale_id;
00400            log_f("keyevent.c: system_locale_id <%d>\n",system_locale_id);
00401            engine_id = 0;
00402            for (i = 0; i< udp->gEngine_Num; i++) {
00403               locale_id = udp->gEngine_Info[i]->core.baseinfo.locale_id;
00404               log_f("keyevent.c: system_locale_id <%d> locale_id <%d>\n",system_locale_id,locale_id);
00405               if (locale_id == system_locale_id || locale_id == ENCODES_NUM) {
00406                   engine_id = i;
00407                   break;
00408               }
00409            }
00410        }else{
00411            log_f("key_event: to_locale is Not NULL \n");
00412            for (i = 0; i< udp->gEngine_Num; i++) {
00413               if(!strcmp(to_locale, udp->modeList[i]->locale_name)){
00414                   engine_id = i;
00415                   break;
00416               }
00417            }
00418        }
00419        log_f("engine_id:%d\n", engine_id);
00420        le_switch_engine(udp, s, engine_id, True);
00421     }
00422 }
00423 
00424 void 
00425 proc_key_round_switch_ime_event(
00426     unit_desktop_t *udp,
00427     iml_session_t *s
00428 )
00429 {
00430     MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00431     MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00432     int engine_id, i;
00433     char locale_id, system_locale_id;
00434 
00435     log_f("ROUND SWITCH IME KEY\n");
00436 
00437     system_locale_id = desktop_data->aux_locale_id;
00438     engine_id = session_data->paletteaux_status.engine_id;
00439     for (i = engine_id; i< udp->gEngine_Num; i++) {
00440        engine_id = (engine_id + udp->localeList[engine_id].nEngineId) % (udp->gEngine_Num);
00441        locale_id = udp->gEngine_Info[engine_id]->core.baseinfo.locale_id;
00442        if (locale_id == system_locale_id || locale_id == ENCODES_NUM) {
00443            break;
00444        }
00445     }
00446     log_f("engine_id:%d\n", engine_id);
00447 
00448     le_clear_ime_buffer(s, session_data->ime_buffer);
00449     le_switch_engine(udp, s, engine_id, True);
00450 }
00451 
00452 void
00453 switch_to_prev_lang(
00454     iml_session_t *s,
00455     unit_desktop_t *udp,
00456     int engine_id
00457 )
00458 {
00459    int i, j, n;
00460    MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00461 
00462    n = udp->locale_Num;
00463    if (!engine_id) {
00464       log_f("Prev engine to switch [%d]\n", udp->localeList[n-1].firstEngineId);
00465       engine_id = udp->localeList[n-1].firstEngineId;
00466    } else {
00467       for (i=0, j=i+1; j<udp->locale_Num; i++, j++){
00468          if ((engine_id >= udp->localeList[j].firstEngineId) &&
00469              (engine_id <= udp->localeList[j].lastEngineId)) {
00470            engine_id = udp->localeList[i].firstEngineId;
00471            break;
00472          }
00473       }
00474    }
00475    le_clear_ime_buffer(s, session_data->ime_buffer);
00476    le_switch_engine(udp, s, engine_id, True);
00477 }
00478 
00479 void
00480 switch_to_next_lang(
00481     iml_session_t *s,
00482     unit_desktop_t *udp,
00483     int engine_id
00484 )
00485 {
00486    int i, j, n;
00487    MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00488 
00489    n = udp->locale_Num;
00490    if (engine_id == udp->localeList[n-1].firstEngineId) {
00491       log_f("Next engine to switch [%d]\n", udp->localeList[n-1].firstEngineId);
00492       engine_id = 0;
00493    } else {
00494       for (i=0, j=i+1; j<udp->locale_Num; i++, j++){
00495          if (udp->localeList[i].firstEngineId == engine_id) {
00496            engine_id = udp->localeList[j].firstEngineId;
00497            break;
00498          }
00499       }
00500    }
00501    le_clear_ime_buffer(s, session_data->ime_buffer);
00502    le_switch_engine(udp, s, engine_id, True);
00503 }
00504 
00505 void 
00506 proc_key_select_switch_ime_event(
00507     unit_desktop_t *udp,
00508     iml_session_t *s,
00509     int ime_id
00510 )
00511 {
00512     MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00513     MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00514     int engine_id, engine_num, i;
00515     char locale_id, system_locale_id;
00516 
00517     log_f("SELECT SWITCH IME KEY\n");
00518     log_f("selected ime_id:%d\n", ime_id);
00519 
00520     system_locale_id = desktop_data->aux_locale_id;
00521     engine_num = 0;
00522     engine_id = 0;
00523     for (i = 0; i< udp->gEngine_Num; i++) {
00524        locale_id = udp->gEngine_Info[i]->core.baseinfo.locale_id;
00525        if (locale_id == system_locale_id || locale_id == ENCODES_NUM) {
00526            if (engine_num >= ime_id) {
00527               engine_id = i;
00528               break;
00529            }
00530            engine_num ++;
00531        }
00532     }
00533 
00534     log_f("engine_id:%d\n", engine_id);
00535     le_clear_ime_buffer(s, session_data->ime_buffer);
00536     le_switch_engine(udp, s, engine_id, True);
00537 }
00538 
00539 void 
00540 proc_key_output(
00541     unit_desktop_t *udp,
00542     iml_session_t *s,
00543     IMKeyEventStruct *key_event
00544 )
00545 {
00546     MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00547     MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00548     IMEKeyRec  ime_keyevent;
00549     IMEArgList ime_args;
00550     int ret, cur_engine_id;
00551 
00552     cur_engine_id = session_data->paletteaux_status.engine_id;
00553     log_f("cur_engine_id:%d\n", cur_engine_id);
00554     if (cur_engine_id == 0xff) {
00555        iml_sendback_key(s, key_event);
00556        return;
00557     }
00558 
00559     ime_keyevent.keyCode = key_event->keyCode;
00560     ime_keyevent.keyChar = key_event->keyChar;
00561     ime_keyevent.modifier = key_event->modifier;
00562 
00563     /* get user defined arguments */
00564     ime_args = desktop_data->ime_args[cur_engine_id];
00565     udp->gEngine_Info[cur_engine_id]->core.envinfo.output_encode_id = desktop_data->aux_locale_id;
00566     ret = udp->gEngine_Info[cur_engine_id]->so_methods->IME_Filter(&udp->gEngine_Info[cur_engine_id]->core,
00567                                                            &ime_keyevent, ime_args, 
00568                                                            session_data->ime_buffer);
00569 
00570     if (ret == IME_NOT_USED_KEY) {
00571        iml_sendback_key(s, key_event);
00572        return;
00573     } else if (ret == RETURN_KEY) {
00574        key_event->keyCode = IM_VK_ENTER;
00575        key_event->keyChar = 0;
00576        key_event->modifier = 0;
00577        le_output_ime_buffer(s, session_data->ime_buffer);
00578        iml_sendback_key(s, key_event);
00579     } 
00580 
00581     if ((session_data->ime_buffer->hotkey_flag == IME_HOTKEY_END) && !session_data->ime_buffer->conv_flag) {
00582       proc_key_switch_conversion_event(udp, s, CONVERSION_OFF, (char *)NULL);
00583       le_output_ime_buffer(s, session_data->ime_buffer);
00584     } else if (session_data->ime_buffer->hotkey_flag == IME_HOTKEY_COMMIT) {
00585       if (!session_data->ime_buffer->conv_flag)
00586         proc_key_switch_conversion_event(udp, s, CONVERSION_OFF, (char *)NULL);
00587         le_commit_euro(s, session_data->ime_buffer);
00588     } else
00589         le_output_ime_buffer(s, session_data->ime_buffer);
00590 }
00591 
00592 /* Local Variables: */
00593 /* c-file-style: "iiim-project" */
00594 /* End: */