Back to index

im-sdk  12.3.91
method.c
Go to the documentation of this file.
00001 /*
00002  * Copyright 2003 Sun Microsystems Inc.
00003  *
00004  * This is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  *
00019  * Authors: Karl Park <karl.park@sun.com>
00020  */
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025 #include <stdio.h>
00026 #include <stdlib.h>
00027 #include <string.h>
00028 
00029 #include "iml.h"
00030 #include "key_event.h"
00031 #include "le.h"
00032 #include "le_proc.h"
00033 #include "encode.h"
00034 #include "xaux_locale.h"
00035 #include "kolelog.h"
00036 #include "aux-message.h"
00037 #include "SunIM.h"
00038 
00039 void proc_paletteaux_connect_event();
00040 void proc_paletteaux_switch_conversion_event();
00041 void proc_paletteaux_switch_hex_inputmode_event();
00042 void proc_paletteaux_switch_junjabanja_event();
00043 void proc_paletteaux_hangul_hanja_conversion_event();
00044 void proc_paletteaux_change_position_event();
00045 void proc_paletteaux_show_selectaux_event(iml_session_t *s);
00046 void proc_selectaux_update_imeinfo_event(iml_session_t *s);
00047 void proc_paletteaux_show_optionaux_event(iml_session_t *s);
00048 void proc_paletteaux_show_keyboardaux_event(iml_session_t *s, int nKeyboardID);
00049 void proc_paletteaux_hide_keyboardaux_event(iml_session_t *s);
00050 void proc_paletteaux_show_lookupaux_event(iml_session_t *s);
00051 void proc_paletteaux_start_action_event(iml_session_t *s, char *command_str);
00052 void proc_paletteaux_set_options_event(iml_session_t *s, IMAuxDrawCallbackStruct *aux_data);
00053 void proc_paletteaux_switch_input_mode_event(iml_session_t *s, int imode);
00054 /* For different keyboard layout support */
00055 void proc_paletteaux_switch_keyboardlayout_event(iml_session_t *s, int nKeyboardLayoutID);
00056 void proc_keyboardaux_change_position_event(iml_session_t *s, int x, int y);
00057 void proc_keyboardaux_change_key_status_event(iml_session_t *s, int key_status);
00058 void proc_lookupaux_change_position_event(iml_session_t *s, int x, int y);
00059 void proc_lookupaux_change_status_event(iml_session_t *s, int on);
00060 void proc_selectaux_change_status_event(iml_session_t *s, int on);
00061 void proc_optionaux_change_status_event(iml_session_t *s, int on);
00062 void proc_commonaux_commit_string_event(iml_session_t *s, int locale_id, char *commit_str);
00063 void proc_commonaux_commit_key_event(iml_session_t *s, int keycode, int keychar, int keystatus);
00064 void proc_commonaux_lost_focus_event(iml_session_t *s);
00065 
00066 void le_show_selectaux_notify(iml_session_t *s);
00067 void le_show_optionaux_notify(iml_session_t *s);
00068 static void le_show_keyboardaux_notify(iml_session_t *s, int nKeyboardID, int engine_id);
00069 void le_show_lookupaux_notify(iml_session_t *s);
00070 void le_start_action_notify(iml_session_t *s, char *command_str);
00071 void le_imeinfo_notify(iml_session_t *s, char *classname, int aux_locale_id);
00072 void le_update_paletteaux_input_mode_info(iml_session_t *s, int imode);
00073 void le_update_optionaux_argsinfo(iml_session_t *s);
00074 void le_update_keymapinfo_notify(iml_session_t *s, int engine_id);
00075 void le_change_focus_notify(iml_session_t *s);
00076 void proc_aux_event(iml_session_t *s, IMAuxEvent *auxevent);
00077 
00078 extern int           g_number_of_engines;
00079 extern IMEEngineRec  *g_engines[MAX_ENGINE_NUM];
00080 
00081 void
00082 auxevent_handler (iml_session_t *s, IMAuxEvent *ev)
00083 {
00084   /*
00085   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00086   MyDataPerDesktop *desktop_data =
00087     (MyDataPerDesktop *)(s->desktop->specific_data);
00088   IMKeyEventStruct *key_event =
00089     (IMKeyEventStruct *) keylistevent->keylist;
00090   IMEBufferMethods mthds = session_data->session_core.ime_methods_table;
00091   IMEBuffer a_buffer = session_data->session_core.ime_buffer;
00092   */
00093   proc_aux_event (s, ev);
00094   iml_status_draw (s);
00095 
00096 }
00097 
00098 
00099 
00100 /* ============================================================== */
00101 /*            Process information from Auxiliary Window           */
00102 /* ============================================================== */
00103 void
00104 proc_aux_event(iml_session_t *s, IMAuxEvent *auxevent)
00105 {
00106     MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00107     MyDataPerDesktop *desktop_data =
00108        (MyDataPerDesktop *)(s->desktop->specific_data);
00109     IMEBufferMethods mthds = session_data->session_core.ime_methods_table;
00110     IMEBuffer a_buffer = session_data->session_core.ime_buffer;
00111 
00112     IMAuxDrawCallbackStruct *aux_data = auxevent->aux;
00113     int nIntegerCount, *pIntegerList;
00114     int nStringCount, nStringLen;
00115     int reqType;
00116     int locale_id, on, engine_id, junjabanja, punct, x, y;
00117     int charset_id;
00118     int nKeyboardID, keycode, keychar, keystatus;
00119     int nKeyboardLayoutID;
00120     int imode;
00121     char *command_str, *commit_str;
00122 
00123     nIntegerCount = aux_data->count_integer_values;
00124     pIntegerList = aux_data->integer_values;
00125 
00126     if (nIntegerCount <= 0) return;
00127 
00128     reqType = pIntegerList[0];
00129 
00130     KOLE_LOG (LOGDEST_STDOUT, "proc_aux_event: session:%x",aux_data, s);
00131     KOLE_LOG (LOGDEST_STDOUT, "reqType: %d", reqType);
00132     switch (reqType)
00133     {
00134        /* need not check whether the Palette is started */
00135        case PALETTEAUX_CONNECT:
00136 
00137            locale_id = pIntegerList[1];
00138            proc_paletteaux_connect_event(s, locale_id);
00139            break;
00140 
00141        case PALETTEAUX_SWITCH_INPUT_MODE:
00142            imode = pIntegerList[1];
00143            proc_paletteaux_switch_input_mode_event(s, imode);
00144            break;
00145            /*
00146              case PALETTEAUX_SET_LOCALE:
00147              proc_paletteaux_set_locale_event(s);
00148              break;
00149            */
00150            /*
00151              case PALETTEAUX_SWITCH_HEX_INPUTMODE:
00152              proc_paletteaux_switch_hex_inputmode_event(s);
00153              break;
00154            */
00155        case PALETTEAUX_SWITCH_QJBJ:
00156            junjabanja = pIntegerList[1];
00157            proc_paletteaux_switch_junjabanja_event(s, junjabanja);
00158            break;
00159 
00160        case PALETTEAUX_HANJA_CONVERSION:
00161            proc_paletteaux_hangul_hanja_conversion_event(s);
00162            break;
00163 
00164        case PALETTEAUX_CHANGE_POSITION:
00165            x = pIntegerList[1];
00166            y = pIntegerList[2];
00167            proc_paletteaux_change_position_event(s, x, y);
00168            break;
00169 
00170        case PALETTEAUX_SHOW_SELECTAUX:
00171            proc_paletteaux_show_selectaux_event(s);
00172            break;
00173 
00174        case PALETTEAUX_SHOW_OPTIONAUX:
00175            proc_paletteaux_show_optionaux_event(s);
00176            break;
00177 
00178        case PALETTEAUX_SHOW_KEYBOARDAUX:
00179            nKeyboardID = pIntegerList[1];
00180            proc_key_switch_keyboard_layout_event(s, nKeyboardID);
00181            proc_paletteaux_show_keyboardaux_event(s, nKeyboardID);
00182            break;
00183        case PALETTEAUX_SWITCH_KEYBOARDLAYOUT:
00184            /*
00185              charset_id = pIntegerList[1];
00186            (*mthds->ime_buffer_set_active_repertoire)(a_buffer, (OPTION_CHARSET *)&charset_id);
00187 
00188            */
00189            nKeyboardLayoutID = pIntegerList[1];
00190             KOLE_LOG (LOGDEST_STDOUT, "nKeyboardLayoutID is %d.\n", nKeyboardLayoutID);
00191            proc_paletteaux_switch_keyboardlayout_event (s, nKeyboardLayoutID);
00192            break;
00193 
00194            /*****************************************************
00195                Those protocal names are old ones, and no longer exist.
00196                I leave it here just until everything looks fine.
00197                soon to be removed...
00198 
00199               case PALETTEAUX_SWITCH_PUNCT:
00200                      punct = pIntegerList[1];
00201                      proc_paletteaux_switch_punct_event(s, punct);
00202                      break;
00203            ******************************************************/
00204        case PALETTEAUX_SHOW_LOOKUPAUX:
00205            proc_paletteaux_show_lookupaux_event(s);
00206            break;
00207 
00208        case PALETTEAUX_START_ACTION:
00209            nStringCount = aux_data->count_string_values;
00210            if (nStringCount != 1) break;
00211 
00212            command_str = (char *)aux_data->string_values->text.utf_chars;
00213            proc_paletteaux_start_action_event(s, command_str);
00214 
00215            break;
00216       
00217        case PALETTEAUX_SWITCH_CHARSET_NOTIFY:
00218            charset_id = pIntegerList[1];
00219            (*mthds->ime_buffer_set_active_repertoire)(a_buffer, (OPTION_CHARSET *)&charset_id);
00220            break;
00221 
00222        case KEYBOARDAUX_CHANGE_POSITION:
00223            x = pIntegerList[1];
00224            y = pIntegerList[2];
00225            proc_keyboardaux_change_position_event(s, x, y);
00226            break;
00227 
00228        case KEYBOARDAUX_CHANGE_KEY_STATUS:
00229            keystatus = pIntegerList[1];
00230            proc_keyboardaux_change_key_status_event(s, keystatus);
00231            break;
00232 
00233        case LOOKUPAUX_CHANGE_POSITION:
00234            x = pIntegerList[1];
00235            y = pIntegerList[2];
00236            proc_keyboardaux_change_position_event(s, x, y);
00237            break;
00238 
00239        case LOOKUPAUX_CHANGE_STATUS:
00240            on = pIntegerList[1];
00241            proc_lookupaux_change_status_event(s, on);
00242            break;
00243 
00244        case SELECTAUX_CHANGE_STATUS:
00245            on = pIntegerList[1];
00246            proc_selectaux_change_status_event(s, on);
00247            break;
00248            /*
00249              case SELECTAUX_UPDATE_IMEINFO:
00250              proc_selectaux_update_imeinfo_event(s);
00251              break;
00252            */
00253 
00254        case OPTIONAUX_CHANGE_STATUS:
00255            on = pIntegerList[1];
00256            proc_optionaux_change_status_event(s, on);
00257            break;
00258 
00259        case COMMONAUX_COMMIT_STRING:
00260            nStringCount = aux_data->count_string_values;
00261            if (nStringCount != 1) break;
00262 
00263            locale_id = pIntegerList[1];
00264            commit_str = (char *)aux_data->string_values->text.utf_chars;
00265            proc_commonaux_commit_string_event(s, locale_id, commit_str);
00266 
00267            break;
00268 
00269        case COMMONAUX_COMMIT_KEY:
00270            keycode = pIntegerList[1];
00271            keychar = pIntegerList[2];
00272            keystatus = pIntegerList[3];
00273            proc_commonaux_commit_key_event(s, keycode, keychar, keystatus);
00274 
00275            break;
00276 
00277        case COMMONAUX_UPDATE_OPTIONSINFO:
00278            proc_paletteaux_set_options_event(s, aux_data);
00279            break;
00280 
00281        case COMMONAUX_LOST_FOCUS:
00282            proc_commonaux_lost_focus_event(s);
00283            break;
00284 
00285     }
00286 }
00287 
00288 void
00289 proc_paletteaux_connect_event (iml_session_t *s, int locale_id)
00290 {
00291   MyDataPerDesktop *desktop_data =
00292     (MyDataPerDesktop *)(s->desktop->specific_data);
00293   MyDataPerSession *ds = (MyDataPerSession *)s->specific_data;
00294        
00295   KOLE_LOG (LOGDEST_STDOUT, "PALETTEAUX_CONNECT Request Received");
00296   desktop_data->paletteaux_ready = True;
00297   desktop_data->aux_locale_id = locale_id;
00298   /* @@@@
00299      ds->ime_buffer->encode = locale_id;
00300      @@@@*/
00301 }
00302 
00303 void
00304 proc_paletteaux_switch_input_mode_event(iml_session_t *s, int imode)
00305 {
00306   IMKeyEventStruct akey;
00307   IMKeyListEvent keyev;
00308   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00309 
00310   KOLE_LOG (LOGDEST_STDOUT, "PALETTEAUX_SWITCH_INPUT_MODE: imode=%d", imode);
00311 
00312   if (imode == INPUT_MODE_HEX_EUC) {      /* Hex mode from the paletteaux */
00313     akey.keyCode = IM_VK_X;
00314     akey.keyChar = IM_VK_X;
00315     akey.modifier = IM_CTRL_MASK;
00316     keyev.type = IM_EventKeyList;
00317     keyev.keylist = (IMKeyList) &akey;
00318   } else if (imode == INPUT_MODE_HEX_UTF8){      /* Hex mode from the paletteaux */
00319     akey.keyCode = IM_VK_X;
00320     akey.keyChar = IM_VK_X;
00321     akey.modifier = IM_CTRL_MASK | IM_SHIFT_MASK;
00322     keyev.type = IM_EventKeyList;
00323     keyev.keylist = (IMKeyList) &akey;
00324   } else if (imode == INPUT_MODE_SYMBOL){ /* Symbol mode from the paletteaux */
00325     akey.keyCode = IM_VK_J;
00326     akey.keyChar = IM_VK_J;
00327     akey.modifier = IM_CTRL_MASK;
00328     keyev.type = IM_EventKeyList;
00329     keyev.keylist = (IMKeyList) &akey;
00330   } else if (imode == INPUT_MODE_HANGUL){
00331     akey.keyCode = IM_VK_X;
00332     akey.keyChar = IM_VK_X;
00333     akey.modifier = IM_CTRL_MASK;
00334     keyev.type = IM_EventKeyList;
00335     keyev.keylist = (IMKeyList) &akey;
00336 
00337   } else {           /* Normal hangul input mode from the paletteaux */
00338     akey.keyCode = IM_VK_SPACE;
00339     akey.keyChar = IM_VK_SPACE;
00340     akey.modifier = IM_CTRL_MASK;
00341     keyev.type = IM_EventKeyList;
00342     keyev.keylist = (IMKeyList) &akey;
00343   }
00344 #if 0
00345   proc_key_event(s, (IMKeyListEvent *)&keyev);
00346 #endif
00347 }
00348 
00349 void proc_paletteaux_switch_conversion_event(iml_session_t *s, int on)
00350 {
00351   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00352   int engine_id = session_data->paletteaux_status.engine_id;
00353 
00354   KOLE_LOG (LOGDEST_STDOUT, "PALETTEAUX_SWITCH_CONVERSION:  on:%d", on);
00355   if (on)
00356     iml_conversion_on(s);
00357   else
00358     iml_conversion_off(s);
00359 
00360   session_data->paletteaux_status.on = on;
00361 #ifdef EVIL
00362   le_clear_ime_buffer(s, session_data->session_core.ime_buffer);
00363 #endif
00364   if (on == CONVERSION_OFF) {
00365     session_data->paletteaux_status.engine_id = 0xff;
00366 #ifdef EVIL
00367     le_status_draw(s);
00368 #endif
00369   }
00370 }
00371 
00372 
00373 void proc_paletteaux_switch_junjabanja_event(iml_session_t *s, int junjabanja)
00374 {
00375   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00376 
00377   KOLE_LOG (LOGDEST_STDOUT, "PALETTEAUX_SWITCH_QJBJ:  junjabanja:%d", junjabanja);
00378   session_data->paletteaux_status.junjabanja = junjabanja;
00379 #ifdef EVIL
00380   le_clear_ime_buffer(s, session_data->session_core.ime_buffer);
00381 #endif
00382 }
00383 
00384 void proc_paletteaux_hangul_hanja_conversion_event(iml_session_t *s)
00385 {
00386   IMKeyEventStruct akey;
00387   IMKeyListEvent keyev;
00388   KOLE_LOG (LOGDEST_STDOUT, "PALETTEAUX_HANJA_CONVERSION Request Received");
00389   akey.keyCode = IM_VK_W;
00390   akey.keyChar = IM_VK_W;
00391   akey.modifier = IM_CTRL_MASK;
00392   keyev.type = IM_EventKeyList;
00393   keyev.keylist = (IMKeyList) &akey;
00394 #if 0
00395   proc_key_event(s, (IMKeyListEvent *)&keyev);
00396 #endif
00397 }
00398 
00399 /* This function will be called when user choose 'internal code' menu from paletteaux */
00400 /*
00401   void proc_paletteaux_switch_hex_inputmode_event(iml_session_t *s)
00402   {
00403   MyDataPerSession *sd = (MyDataPerSession *) s->specific_data;
00404 
00405   IMKeyEventStruct akey;
00406   IMKeyListEvent keyev;
00407   KOLE_LOG (LOGDEST_STDOUT, "PALETTEAUX_SWITCH_HEX_INPUTMODE Request Received");
00408   if(sd->input_mode == INPUT_MODE_HANGUL)){
00409   proc_paletteaux_switch_conversion_event(s, CONVERSION_ON);
00410   }
00411   sd->input_mode = 1;
00412   akey.keyCode = IM_VK_X;
00413   akey.keyChar = IM_VK_X;
00414   akey.modifier = IM_CTRL_MASK;
00415   keyev.type = IM_EventKeyList;
00416   keyev.keylist = (IMKeyList) &akey;
00417   proc_key_event(s, (IMKeyListEvent *)&keyev);
00418   }
00419 */
00420 void proc_paletteaux_change_position_event(iml_session_t *s, int x, int y)
00421 {
00422   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00423 
00424   KOLE_LOG (LOGDEST_STDOUT, "PALETTEAUX_CHANGE_POSITION:  x: 0x%x, y:0x%x", x, y);
00425   session_data->paletteaux_status.x = x;
00426   session_data->paletteaux_status.y = y;
00427 }
00428 
00429 void proc_paletteaux_show_selectaux_event(iml_session_t *s)
00430 {
00431   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00432   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00433   int aux_locale_id = desktop_data->aux_locale_id;
00434   char *classname = XAUX_SELECT_CLASS_NAME;
00435        
00436   if (desktop_data->selectaux_started == False) {
00437     if (desktop_data->root_session) {
00438       KOLE_LOG (LOGDEST_STDOUT, "First start SelectAux");
00439       iml_aux_start(desktop_data->root_session, classname);
00440       le_imeinfo_notify(s, classname, aux_locale_id);
00441       desktop_data->selectaux_started = True;
00442     }
00443   }
00444 
00445   session_data->selectaux_status.on = True;
00446   le_show_selectaux_notify(s);
00447 }
00448 
00449 void proc_paletteaux_show_optionaux_event(iml_session_t *s)
00450 {
00451   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00452   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00453   char *classname = XAUX_OPTION_CLASS_NAME;
00454        
00455   if (desktop_data->optionaux_started == False) {
00456     if (desktop_data->root_session) {
00457       KOLE_LOG (LOGDEST_STDOUT, "First start OptionAux");
00458       iml_aux_start(desktop_data->root_session, classname);
00459       le_update_optionaux_argsinfo(s);
00460       desktop_data->optionaux_started = True;
00461     }
00462   }
00463 
00464   session_data->optionaux_status.on = True;
00465   le_show_optionaux_notify(s);
00466 }
00467 
00468 void proc_paletteaux_show_lookupaux_event(iml_session_t *s)
00469 {
00470   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00471   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00472   char *classname = XAUX_LOOKUP_CLASS_NAME;
00473 
00474   if (desktop_data->lookupaux_started == False) {
00475     if (desktop_data->root_session) {
00476       KOLE_LOG (LOGDEST_STDOUT, "First start LookupAux");
00477       iml_aux_start(desktop_data->root_session, classname);
00478       desktop_data->lookupaux_started = True;
00479     }
00480   }
00481 
00482   session_data->lookupaux_status.on = True;
00483   le_show_lookupaux_notify(s);
00484 }
00485 
00486 void
00487 proc_paletteaux_show_keyboardaux_event (iml_session_t *s, int nKeyboardID)
00488 {
00489   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00490   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00491   int engine_id = session_data->paletteaux_status.engine_id;
00492   char *classname = XAUX_KEYBOARD_CLASS_NAME;
00493 
00494   KOLE_LOG (LOGDEST_STDOUT,
00495            "Processig PALETTEAUX_SHOW_KEYBOARDAUX\n");
00496 
00497   if (desktop_data->keyboardaux_started == False) {
00498     if (desktop_data->root_session) {
00499       KOLE_LOG (LOGDEST_STDOUT, "First start KeyboardAux");
00500       iml_aux_start(desktop_data->root_session, classname);
00501       desktop_data->keyboardaux_started = True;
00502     }
00503   }
00504 
00505   if (nKeyboardID == -1) { /* hide the keyboard aux */
00506     session_data->keyboardaux_status.keyboard_id = nKeyboardID;
00507     le_update_keymapinfo_notify(s, engine_id);
00508     le_show_keyboardaux_notify(s, nKeyboardID, engine_id);
00509        
00510   } else {
00511     session_data->keyboardaux_status.keyboard_id = nKeyboardID;
00512     /* Now change the currently active keyboard layout */
00513               
00514     /*
00515       session_data->ime_buffer->keyboard_layout = nKeyboardID;
00516     */
00517     le_update_keymapinfo_notify(s, engine_id);
00518     le_show_keyboardaux_notify(s, nKeyboardID, engine_id);
00519   }
00520 }
00521 
00522 void proc_paletteaux_start_action_event(iml_session_t *s, char *command_str)
00523 {
00524   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00525   char *classname = XAUX_ACTION_CLASS_NAME;
00526        
00527   if (desktop_data->actionaux_started == False) {
00528     if (desktop_data->root_session) {
00529       KOLE_LOG (LOGDEST_STDOUT, "First start ActionAux");
00530       iml_aux_start(desktop_data->root_session, classname);
00531       desktop_data->actionaux_started = True;
00532     }
00533   }
00534 
00535   KOLE_LOG (LOGDEST_STDOUT, "PALETTEAUX_START_ACTION Request Received");
00536   KOLE_LOG (LOGDEST_STDOUT,
00537            "command_str:%s, len:%d", command_str, strlen(command_str));
00538 
00539   le_start_action_notify(s, command_str);
00540 }
00541 
00542 void
00543 proc_paletteaux_switch_keyboardlayout_event(iml_session_t *s, int nKeyboardLayoutID)
00544 {
00545     MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00546     MyDataPerDesktop *desktop_data =
00547        (MyDataPerDesktop *)(s->desktop->specific_data);
00548     IMEBuffer a_buffer = session_data->session_core.ime_buffer;
00549     IMEBufferMethods mthds = session_data->session_core.ime_methods_table;
00550 
00551     (*mthds->ime_buffer_set_keyboard_layout)(a_buffer,
00552                                         (KEYBOARD_LAYOUT_T *)&nKeyboardLayoutID);
00553 }
00554 
00555 void proc_paletteaux_set_options_event(iml_session_t *s, IMAuxDrawCallbackStruct *aux_data)
00556 {
00557   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00558   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00559   UserPreference *user_pref = &(desktop_data->user_pref);
00560 
00561   IMText *lt;
00562   char *ime_ename;
00563   char *option_name;
00564   char *ptr;
00565   int i, j, option_value;
00566   int nIntegerCount, *pIntegerList;
00567   int nStringCount, nStringLen;
00568   int engine_id, engine_locale_id, aux_locale_id;
00569 
00570   nIntegerCount = aux_data->count_integer_values;
00571   pIntegerList = aux_data->integer_values;
00572   nStringCount = aux_data->count_string_values;
00573 
00574   KOLE_LOG (LOGDEST_STDOUT, "COMMONAUX_UPDATE_OPTIONSINFO Request Received");
00575   KOLE_LOG (LOGDEST_STDOUT, "Options num:%d", nStringCount);
00576 
00577   aux_locale_id = desktop_data->aux_locale_id;
00578   for (i=0; i<nStringCount; i++) {
00579     lt = aux_data->string_values + i;
00580     option_name = (char *)(lt->text.native_chars);
00581     ptr = strchr(option_name, ':');
00582     *ptr = '\0'; ptr++;
00583     /*
00584       option_value = pIntegerList[i+1];
00585       KOLE_LOG (LOGDEST_STDOUT, "set option: %s\t%d", option_name, option_value);
00586     */
00587     if(!strcmp(option_name, "keyboard_layout")){
00588       user_pref->keyboard_layout = atoi(ptr);
00589     } else if(!strcmp(option_name, "ime_user_id")){
00590       user_pref->ime_user_id =  atoi(ptr);
00591     } else if(!strcmp(option_name,"conversion_format")){
00592       user_pref->conversion_format = atoi(ptr);
00593     } else if(!strcmp(option_name,"auto_commit_on_char_basis")){
00594       user_pref->auto_commit_on_char_basis = atoi(ptr);
00595     } else if(!strcmp(option_name,"auto_commit_on_single_candidate_conversion")){
00596       user_pref->auto_commit_on_single_candidate_conversion = atoi(ptr);
00597     } else if(!strcmp(option_name, "ime_user_home")){
00598       user_pref->ime_user_home = strdup(ptr);
00599     }
00600   }
00601   /************************************************************
00602           This call is needed to let the engine core know about 
00603           some change in the way they calculate correct hangul value
00604   ************************************************************/
00605   le_update_ime_buffer(s, user_pref);
00606 }
00607 
00608 void proc_keyboardaux_change_position_event(iml_session_t *s, int x, int y)
00609 {
00610   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00611 
00612   KOLE_LOG (LOGDEST_STDOUT, "KEYBOARDAUX_CHANGE_POSITION:  x: 0x%x, y:0x%x", x, y);
00613   session_data->keyboardaux_status.x = x;
00614   session_data->keyboardaux_status.y = y;
00615 }
00616 
00617 void proc_keyboardaux_change_key_status_event(iml_session_t *s, int key_status)
00618 {
00619   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00620 
00621   KOLE_LOG (LOGDEST_STDOUT,
00622            "KEYBOARDAUX_CHANGE_KEY_STATUS:  key_status: 0x%x", key_status);
00623   session_data->keyboardaux_status.key_status = key_status;
00624 }
00625 
00626 void proc_lookupaux_change_position_event(iml_session_t *s, int x, int y)
00627 {
00628   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00629 
00630   KOLE_LOG (LOGDEST_STDOUT, "LOOKUPAUX_CHANGE_POSITION:  x: 0x%x, y:0x%x", x, y);
00631 }
00632 
00633 void proc_lookupaux_change_status_event(iml_session_t *s, int on)
00634 {
00635   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00636 
00637   KOLE_LOG (LOGDEST_STDOUT, "LOOKUPAUX_CHANGE_STATUS:  on: %d", on);
00638   session_data->lookupaux_status.on = on;
00639 }
00640 
00641 void
00642 proc_selectaux_change_status_event (iml_session_t *s, int on)
00643 {
00644   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00645 
00646   KOLE_LOG (LOGDEST_STDOUT, "SELECTAUX_CHANGE_STATUS:  on: %d", on);
00647   session_data->selectaux_status.on = on;
00648 }
00649 
00650 void
00651 proc_optionaux_change_status_event (iml_session_t *s, int on)
00652 {
00653   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00654 
00655   KOLE_LOG (LOGDEST_STDOUT, "OPTIONAUX_CHANGE_STATUS:  on: %d", on);
00656   session_data->optionaux_status.on = on;
00657 }
00658 
00659 void
00660 proc_commonaux_commit_string_event (iml_session_t *s, int locale_id, char *commit_str)
00661 {
00662   KOLE_LOG (LOGDEST_STDOUT, "COMMONAUX_COMMIT_STRING Request Received");
00663   KOLE_LOG (LOGDEST_STDOUT,
00664            "locale_id:%d, command_str:%s, len:%d", 
00665            locale_id, commit_str, strlen(commit_str));
00666   /*
00667     encode_commit(s, locale_id, (unsigned char *)commit_str);
00668   */
00669 }
00670 
00671 void
00672 proc_commonaux_commit_key_event (iml_session_t *s, int keycode, int keychar, int keystatus)
00673 {
00674   static IMKeyEventStruct akey;
00675   static IMKeyListEvent keyev;
00676 
00677   KOLE_LOG (LOGDEST_STDOUT, "COMMONAUX_COMMIT_KEY Request Received");
00678   KOLE_LOG (LOGDEST_STDOUT,
00679            "keycode:0x%x, keychar:0x%x, keystatus:0x%x", 
00680            keycode, keychar, keystatus);
00681 
00682   akey.keyCode = keycode;
00683   akey.keyChar = keychar;
00684   akey.modifier = keystatus;
00685   keyev.type = IM_EventKeyList;
00686   keyev.keylist = (IMKeyList) &akey;
00687 #if 0
00688   proc_key_event(s, (IMKeyListEvent *) &keyev);
00689 #endif
00690 
00691   keyevent_handler(s, &keyev); 
00692 }
00693 
00694 void
00695 proc_commonaux_lost_focus_event (iml_session_t *s)
00696 {
00697   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
00698   int on_save = session_data->paletteaux_status.on;
00699        
00700   KOLE_LOG (LOGDEST_STDOUT, "COMMONAUX_LOST_FOCUS Request Received\n");
00701   session_data->paletteaux_status.on = False;
00702   le_change_focus_notify(s);
00703   session_data->paletteaux_status.on = on_save;
00704 }
00705 
00706 /* ============================================================== */
00707 /*              Send information to Auxiliary Window              */
00708 /* ============================================================== */
00709 void
00710 le_start_aux_notify (iml_session_t *s, char *classname)
00711 {
00712   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00713   iml_aux_start(desktop_data->root_session, classname);
00714 }
00715 
00716 void
00717 send_info_to_aux (iml_session_t *s, char *classname,
00718                     int count_integers,  int *integers,
00719                     int count_strings,   int *len_strings,
00720                     char **strings)
00721 {
00722   iml_aux_draw (s, classname, 
00723               count_integers,  integers,
00724               count_strings,   len_strings,
00725               (unsigned char **)strings);
00726 }
00727 
00728 void
00729 le_imeinfo_notify (iml_session_t *s, char *classname, int aux_locale_id)
00730 {
00731   int nIntegerCount,  pIntegerList[5];
00732   int nStringsCount,  pLenStrings[2];
00733   char *pStrings[2], *ename, *kname;
00734   int i, engine_locale_id;
00735 
00736   KOLE_LOG (LOGDEST_STDOUT, "le_imeinfo_notify: ======\n");
00737 
00738   nIntegerCount = 1;
00739   pIntegerList[0] = COMMONAUX_SET_IME_NEW_NOTIFY;
00740   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
00741 
00742   for (i=0; i<g_number_of_engines; i++) {
00743     if (aux_locale_id != -1) {
00744       engine_locale_id = g_engines[i]->core.baseinfo.locale_id;
00745       if (engine_locale_id != aux_locale_id && engine_locale_id != ENCODES_NUM)
00746        continue;
00747     }
00748 
00749     /* send the IME base information to auxiliary window */
00750     nIntegerCount = 5;
00751     pIntegerList[0] = COMMONAUX_SET_IME_INFO_NOTIFY;
00752     pIntegerList[1] = g_engines[i]->core.baseinfo.engine_id;
00753     pIntegerList[2] = g_engines[i]->core.baseinfo.locale_id;
00754     pIntegerList[3] = g_engines[i]->core.baseinfo.encode_id;
00755     pIntegerList[4] = g_engines[i]->core.baseinfo.status;
00756 
00757     nStringsCount = 2;
00758     ename = g_engines[i]->core.baseinfo.ename;
00759     if (ename == NULL) ename = "IME";
00760     pLenStrings[0] = strlen(ename) + 1;
00761     pStrings[0] = (char *)ename;
00762 
00763     kname = g_engines[i]->core.baseinfo.kname;
00764     if (kname == NULL) kname = "IME";
00765     pLenStrings[1] = strlen(kname) + 1;
00766     pStrings[1] = (char *)kname;
00767               
00768     KOLE_LOG (LOGDEST_STDOUT, "le_imeinfo_notify: \n");
00769     KOLE_LOG (LOGDEST_STDOUT, "\tengine_id: %d\n", pIntegerList[1]);
00770     KOLE_LOG (LOGDEST_STDOUT, "\tlocale_id: %d\n", pIntegerList[2]);
00771     KOLE_LOG (LOGDEST_STDOUT, "\tencode_id: %d\n", pIntegerList[3]);
00772     KOLE_LOG (LOGDEST_STDOUT, "\tstatus: %d\n", pIntegerList[4]);
00773     KOLE_LOG (LOGDEST_STDOUT, "\tename: %s\n", ename);
00774     KOLE_LOG (LOGDEST_STDOUT, "\tkname: %s\n", kname);
00775 
00776     send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 
00777                    nStringsCount,  pLenStrings,
00778                    pStrings);
00779   }
00780 
00781   nIntegerCount = 1;
00782   pIntegerList[0] = COMMONAUX_SET_IME_END_NOTIFY;
00783   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
00784 }
00785 
00786 
00787 void
00788 auxhandler_send_session_property (iml_session_t *s, char *classname)
00789 {
00790   int nIntegerCount,  pIntegerList[6];
00791   int nStringsCount,  pLenStrings[2];
00792   char *pStrings[2], *ename, *kname;
00793 
00794   MyDataPerSession *sd = (MyDataPerSession *)(s->specific_data);
00795   IMEBufferMethods mthds = sd->session_core.ime_methods_table;
00796   IMEBuffer ime_buffer = sd->session_core.ime_buffer;
00797 
00798   nIntegerCount = 6;
00799   pIntegerList[0] = KOLE_AUX_SESSION_PROPERTY;
00800   (*mthds->ime_buffer_get_input_mode)(ime_buffer, &pIntegerList[1]);
00801   (*mthds->ime_buffer_get_keyboard_layout)(ime_buffer, &pIntegerList[2]);
00802   (*mthds->ime_buffer_get_active_repertoire)(ime_buffer, &pIntegerList[3]);
00803   (*mthds->ime_buffer_get_deletion_option)(ime_buffer, &pIntegerList[4]);
00804   (*mthds->ime_buffer_get_commitmode_option)(ime_buffer, &pIntegerList[5]);  
00805   
00806   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
00807 }
00808 
00809 void
00810 le_update_paletteaux_input_mode_info (iml_session_t *s, int imode)
00811 {
00812   char *classname = XAUX_PALETTE_CLASS_NAME;
00813   int nIntegerCount,  pIntegerList[2];
00814 
00815   KOLE_LOG (LOGDEST_STDOUT, "le_update_paletteaux_input_mode_info");
00816 
00817   nIntegerCount = 2;
00818   pIntegerList[0] = PALETTEAUX_SWITCH_INPUT_MODE_NOTIFY;
00819   pIntegerList[1] = imode;
00820 
00821   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
00822 }
00823 
00824 void
00825 le_update_optionaux_argsinfo (iml_session_t *s)
00826 {
00827   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00828   char *classname = XAUX_OPTION_CLASS_NAME;
00829 
00830   int nIntegerCount,  pIntegerList[MAX_ARGS_NUM + 2];
00831   int nStringsCount,  pLenStrings[MAX_ARGS_NUM + 2];
00832   char *pStrings[MAX_ARGS_NUM + 2];
00833   int engine_locale_id, aux_locale_id;
00834   int i, j, total_args_num, args_num, arg_value;
00835   char *ename, *kname, *arg_name;
00836   char *tmp_name, ime_kname[256], tmp_arg_name[256];
00837   int encode_id, ilen, olen, ret;
00838 
00839   KOLE_LOG (LOGDEST_STDOUT, "le_update_optionaux_argsinfo");
00840 
00841   aux_locale_id = desktop_data->aux_locale_id;
00842   for (i=0; i<g_number_of_engines; i++) {
00843     engine_locale_id = g_engines[i]->core.baseinfo.locale_id;
00844     if (engine_locale_id != aux_locale_id && engine_locale_id != ENCODES_NUM)
00845       continue;
00846 
00847     ename = (char *)g_engines[i]->core.baseinfo.ename;
00848     if (!ename || !*ename)
00849       continue;
00850 
00851     kname = (char *)g_engines[i]->core.baseinfo.kname;
00852     if (!kname || !*kname)
00853       continue;
00854 
00855     if (desktop_data->ime_args[i] == NULL) {
00856       desktop_data->ime_args[i] = (IMEArgList)calloc(1, sizeof(IMEArgListRec));
00857       if (desktop_data->ime_args[i] == NULL)
00858        continue;
00859 
00860       /* set the options of ime */
00861       /*
00862        g_engines[i]->so_methods->IME_SetValues(&(g_engines[i]->core),  desktop_data->ime_args[i], -1);
00863       */
00864     }
00865 
00866     total_args_num = desktop_data->ime_args[i]->args_num;
00867 
00868     if (total_args_num == 0) 
00869       continue;
00870 
00871     if (total_args_num >= MAX_ARGS_NUM)
00872       total_args_num = MAX_ARGS_NUM - 1;
00873 
00874     strcpy(ime_kname, kname);
00875 
00876     encode_id = g_engines[i]->core.baseinfo.encode_id;
00877     KOLE_LOG (LOGDEST_STDOUT, "ime encode_id is: %d", encode_id);
00878     if (encode_id == ENCODE_UTF8) {
00879       ilen = strlen(kname);
00880       tmp_name = ime_kname;
00881       olen = 256;
00882       memset(ime_kname, 0, olen);
00883       ret = Convert_UTF8_To_Native(aux_locale_id, kname, ilen, &tmp_name, (size_t *)&olen);
00884       if (ret == -1)
00885        strcpy(ime_kname, ename);
00886     }
00887 
00888     KOLE_LOG (LOGDEST_STDOUT, "Set options for IME :%s", ime_kname);
00889     /* set the option information of this IME to OptionAux */
00890     pIntegerList[0] = OPTIONAUX_UPDATE_ARGS_INFO_NOTIFY;
00891     pLenStrings[0] = strlen(ename) + 1;
00892     pStrings[0] = (char *)ename;
00893     pLenStrings[1] = strlen(ime_kname) + 1;
00894     pStrings[1] = (char *)ime_kname;
00895 
00896     args_num = 0;
00897     for (j=0; j<total_args_num; j++) {
00898       arg_name = (char *)desktop_data->ime_args[i]->args[j].name;
00899       if (!arg_name || !*arg_name) 
00900        continue;
00901 
00902       ilen = strlen(arg_name);
00903       tmp_name = tmp_arg_name;
00904       olen = 256;
00905       memset(tmp_arg_name, 0, olen);
00906       ret = Convert_UTF8_To_Native(aux_locale_id, arg_name, ilen, &tmp_name, (size_t *)&olen);
00907       if (ret == -1)
00908        strcpy(tmp_arg_name, arg_name);
00909 
00910       arg_value = desktop_data->ime_args[i]->args[j].value;
00911       pIntegerList[args_num + 2] = arg_value;
00912       pLenStrings[args_num + 2] = strlen(tmp_arg_name) + 1;
00913       pStrings[args_num + 2] = (char *)strdup(tmp_arg_name);
00914                      
00915       KOLE_LOG (LOGDEST_STDOUT, "arg_name:%s\tvalue:%d", tmp_arg_name, arg_value);
00916       args_num++;
00917     }
00918 
00919     if (args_num == 0)
00920       continue;
00921 
00922     nIntegerCount = args_num + 2;
00923     pIntegerList[1] = args_num;
00924     nStringsCount = args_num + 2;
00925 
00926     send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 
00927                    nStringsCount,  pLenStrings,
00928                    pStrings);
00929 
00930     for (j=0; j<args_num; j++) {
00931       if (pStrings[j + 2]) {
00932        KOLE_LOG (LOGDEST_STDOUT, " Free char :%s", pStrings[j + 2]);
00933        free((char *)pStrings[j + 2]);
00934       }
00935     }
00936   }
00937 }
00938 
00939 void
00940 le_update_paletteaux_keymapinfo (iml_session_t *s, int engine_id)
00941 {
00942   char *classname = XAUX_PALETTE_CLASS_NAME;
00943   int nIntegerCount,  pIntegerList[2];
00944 
00945   KOLE_LOG (LOGDEST_STDOUT, "le_update_paletteaux_keymapinfo");
00946 
00947   nIntegerCount = 2;
00948   pIntegerList[0] = COMMONAUX_UPDATE_KEYMAPINFO_NOTIFY;
00949   pIntegerList[1] = engine_id;
00950 
00951   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
00952 }
00953 
00954 void
00955 le_update_keyboardaux_keymapinfo (iml_session_t *s, int engine_id, int bNeedKeyMap)
00956 {
00957   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
00958   char *classname = XAUX_KEYBOARD_CLASS_NAME;
00959 
00960   int nIntegerCount,  pIntegerList[2];
00961   int nStringsCount,  pLenStrings[1];
00962   char *pStrings[1];
00963 
00964   static char keymap_buf[MAX_KEYMAP_KEY_NUM][5];
00965   int encode_id, aux_locale_id;
00966   int i, ilen, olen, ret;
00967   char key_str[64], *str, *tmp_str;
00968 
00969   KOLE_LOG (LOGDEST_STDOUT, "le_update_keyboardaux_keymapinfo");
00970 
00971   nIntegerCount = 2;
00972   pIntegerList[0] = COMMONAUX_UPDATE_KEYMAPINFO_NOTIFY;
00973   pIntegerList[1] = engine_id;
00974 
00975   if (bNeedKeyMap) {
00976     memset(keymap_buf[0], 0, sizeof(keymap_buf));
00977 
00978     encode_id = g_engines[engine_id]->core.baseinfo.encode_id;
00979     aux_locale_id = desktop_data->aux_locale_id;
00980     for(i=0; i<MAX_KEYMAP_KEY_NUM; i++) {
00981       str = (char *)g_engines[engine_id]->core.keymapinfo.keymap[i];
00982       if (str && *str) {
00983        if (encode_id == ENCODE_UTF8) {
00984          ilen = strlen(str);
00985          tmp_str = key_str;
00986          olen = 64;
00987          memset(key_str, 0, 64);
00988          ret = Convert_UTF8_To_Native(aux_locale_id, str, ilen, &tmp_str, (size_t *)&olen);
00989          if (ret == 0)
00990            strncpy(keymap_buf[i], key_str, 4);
00991        } else {
00992          strncpy(keymap_buf[i], str, 4);
00993        }
00994        KOLE_LOG (LOGDEST_STDOUT, "keymap_buf[%d]: %s, str:%s", i, keymap_buf[i], str);
00995       }
00996     }
00997 
00998     nStringsCount = 1;
00999     pLenStrings[0] = sizeof(keymap_buf);
01000     pStrings[0] = (char *)(keymap_buf[0]);
01001 
01002     send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 
01003                    nStringsCount,  pLenStrings,
01004                    pStrings);
01005   } else {
01006     send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 
01007                    0, NULL, NULL);
01008   }
01009 
01010 }
01011 
01012 void
01013 le_update_keymapinfo_notify (iml_session_t *s, int engine_id)
01014 {
01015   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
01016   int bSet, bSentKeymapToAux;
01017 
01018   if (engine_id < 0 || engine_id >= g_number_of_engines) return;
01019 
01020   bSet = g_engines[engine_id]->core.keymapinfo.bSet;
01021 
01022   if (bSet && desktop_data->paletteaux_started == True)
01023     le_update_paletteaux_keymapinfo(s, engine_id);
01024 
01025   if (desktop_data->keyboardaux_started == True) {
01026     bSentKeymapToAux = desktop_data->bSentKeymapToAux[engine_id];
01027     if (bSet && !bSentKeymapToAux) {
01028       /* if have keymap and not sent to KeyboardAux */
01029       /* send keymap to KeyboardAux */
01030       le_update_keyboardaux_keymapinfo(s, engine_id, 1);
01031       desktop_data->bSentKeymapToAux[engine_id] = True;
01032     } else {
01033       /* if no keymap or have sent to KeyboardAux */
01034       /* update the information of KeyboardAux */
01035       le_update_keyboardaux_keymapinfo(s, engine_id, 0);
01036     }
01037 
01038   }
01039 }
01040 
01041 void
01042 le_update_keyboardaux_keypress_notify (iml_session_t *s, int keycode, int keychar, int keystatus)
01043 {
01044   char *classname = XAUX_KEYBOARD_CLASS_NAME;
01045   int nIntegerCount,  pIntegerList[4];
01046 
01047   KOLE_LOG (LOGDEST_STDOUT, "le_update_keyboardaux_keypress_notify");
01048 
01049   nIntegerCount = 4;
01050   pIntegerList[0] = KEYBOARDAUX_PRESS_KEY_NOTIFY;
01051   pIntegerList[1] = keycode;
01052   pIntegerList[2] = keychar;
01053   pIntegerList[3] = keystatus;
01054 
01055   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01056 }
01057 
01058 void
01059 le_send_keyevent_to_keyboardaux (iml_session_t *s, IMKeyListEvent *ev)
01060 {
01061   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
01062   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
01063   IMKeyEventStruct *key_event = (IMKeyEventStruct *) ev->keylist;
01064   int keycode, keystatus, keychar;
01065 
01066   if (desktop_data->keyboardaux_started == False)
01067     return;
01068 
01069   if (session_data->keyboardaux_status.keyboard_id == -1)
01070     return;
01071 
01072   keycode = key_event->keyCode;
01073   keychar = key_event->keyChar;
01074   keystatus = key_event->modifier;
01075 
01076   KOLE_LOG (LOGDEST_STDOUT,
01077            "le_update_keyboardaux_keypress_notify: keycode:0x%x, keychar:0x%x, keystatus:0x%x",
01078            keycode, keychar, keystatus);
01079   le_update_keyboardaux_keypress_notify(s, keycode, keychar, keystatus);
01080 }
01081 
01082 static void
01083 le_switch_conversion_notify (iml_session_t *s, int on)
01084 {
01085   char *classname = XAUX_PALETTE_CLASS_NAME;
01086   int nIntegerCount,  pIntegerList[2];
01087 
01088   KOLE_LOG (LOGDEST_STDOUT, "le_switch_conversion_notify");
01089 
01090   nIntegerCount = 2;
01091   pIntegerList[0] = PALETTEAUX_SWITCH_CONVERSION_NOTIFY;
01092   pIntegerList[1] = on;
01093 
01094   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01095 }
01096 
01097 void
01098 le_switch_junjabanja_notify (iml_session_t *s, int junjabanja)
01099 {
01100   char *classname = XAUX_PALETTE_CLASS_NAME;
01101   int nIntegerCount,  pIntegerList[2];
01102 
01103   KOLE_LOG (LOGDEST_STDOUT, "le_switch_junjabanja_notify");
01104 
01105   nIntegerCount = 2;
01106   pIntegerList[0] = PALETTEAUX_SWITCH_QJBJ_NOTIFY;
01107   pIntegerList[1] = junjabanja;
01108 
01109   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01110 }
01111 
01112 void
01113 le_change_paletteaux_focus_notify (iml_session_t *s)
01114 {
01115   MyDataPerDesktop *desktop_data =
01116     (MyDataPerDesktop *)(s->desktop->specific_data);
01117   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
01118   
01119   IMEBufferMethods mthds = session_data->session_core.ime_methods_table;
01120   INPUT_MODE_T input_mode;
01121   
01122   IMEBuffer ime_buffer = session_data->session_core.ime_buffer;
01123   char *classname = XAUX_PALETTE_CLASS_NAME;
01124   int nIntegerCount,  pIntegerList[12];
01125   int tmp;
01126 
01127   KOLE_LOG (LOGDEST_STDOUT, "le_change_paletteaux_focus_notify");
01128   
01129   (void) (*mthds->ime_buffer_get_input_mode) (ime_buffer, &input_mode);
01130   nIntegerCount = 12;
01131   pIntegerList[0] = COMMONAUX_CHANGE_FOCUS_NOTIFY;
01132   pIntegerList[1] = session_data->paletteaux_status.x;
01133   pIntegerList[2] = session_data->paletteaux_status.y;
01134   pIntegerList[3] = session_data->paletteaux_status.on;
01135   pIntegerList[4] = session_data->paletteaux_status.junjabanja;
01136   pIntegerList[5] = session_data->paletteaux_status.punct;
01137   pIntegerList[6] = session_data->paletteaux_status.engine_id;
01138   pIntegerList[7] = input_mode;
01139 
01140   (*mthds->ime_buffer_get_keyboard_layout)(ime_buffer, &tmp);
01141   pIntegerList[8] = tmp;
01142   
01143   (*mthds->ime_buffer_get_active_repertoire)(ime_buffer, &tmp);
01144   pIntegerList[9] = tmp;
01145   (*mthds->ime_buffer_get_deletion_option)(ime_buffer, &tmp);
01146   pIntegerList[10] = tmp;
01147   (*mthds->ime_buffer_get_commitmode_option)(ime_buffer, &tmp);  
01148   pIntegerList[11] = tmp;
01149   
01150   KOLE_LOG (LOGDEST_STDOUT, " x:%d, y:%d, on:%d, junjabanja:%d, punct:%d, engine_id:%d",
01151        pIntegerList[1],
01152        pIntegerList[2],
01153        pIntegerList[3],
01154        pIntegerList[4],
01155        pIntegerList[5],
01156        pIntegerList[6],
01157        pIntegerList[7]);
01158   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01159 }
01160 
01161 void
01162 le_change_keyboardaux_focus_notify (iml_session_t *s)
01163 {
01164   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
01165   char *classname = XAUX_KEYBOARD_CLASS_NAME;
01166   int nIntegerCount,  pIntegerList[7];
01167 
01168   KOLE_LOG (LOGDEST_STDOUT, "le_change_keyboardaux_focus_notify");
01169 
01170   nIntegerCount = 7;
01171   pIntegerList[0] = COMMONAUX_CHANGE_FOCUS_NOTIFY;
01172   pIntegerList[1] = session_data->keyboardaux_status.x;
01173   pIntegerList[2] = session_data->keyboardaux_status.y;
01174   pIntegerList[3] = session_data->keyboardaux_status.keyboard_id;
01175   pIntegerList[4] = session_data->keyboardaux_status.key_status;
01176   pIntegerList[5] = session_data->paletteaux_status.on;
01177   pIntegerList[6] = session_data->paletteaux_status.engine_id;
01178   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01179 }
01180 
01181 void
01182 le_change_lookupaux_focus_notify (iml_session_t *s)
01183 {
01184   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
01185   char *classname = XAUX_LOOKUP_CLASS_NAME;
01186   int nIntegerCount,  pIntegerList[3];
01187 
01188   KOLE_LOG (LOGDEST_STDOUT, "le_change_lookupaux_focus_notify");
01189 
01190   nIntegerCount = 3;
01191   pIntegerList[0] = COMMONAUX_CHANGE_FOCUS_NOTIFY;
01192   pIntegerList[1] = session_data->lookupaux_status.on;
01193   pIntegerList[2] = session_data->paletteaux_status.on;
01194   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01195 }
01196 
01197 void
01198 le_change_selectaux_focus_notify (iml_session_t *s)
01199 {
01200   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
01201   char *classname = XAUX_SELECT_CLASS_NAME;
01202   int nIntegerCount,  pIntegerList[3];
01203 
01204   KOLE_LOG (LOGDEST_STDOUT, "le_change_selectaux_focus_notify");
01205 
01206   nIntegerCount = 3;
01207   pIntegerList[0] = COMMONAUX_CHANGE_FOCUS_NOTIFY;
01208   pIntegerList[1] = session_data->selectaux_status.on;
01209   pIntegerList[2] = session_data->paletteaux_status.on;
01210   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01211 }
01212 
01213 void
01214 le_change_optionaux_focus_notify (iml_session_t *s)
01215 {
01216   MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
01217   char *classname = XAUX_OPTION_CLASS_NAME;
01218   int nIntegerCount,  pIntegerList[3];
01219 
01220   KOLE_LOG (LOGDEST_STDOUT, "le_change_selectaux_focus_notify");
01221 
01222   nIntegerCount = 3;
01223   pIntegerList[0] = COMMONAUX_CHANGE_FOCUS_NOTIFY;
01224   pIntegerList[1] = session_data->optionaux_status.on;
01225   pIntegerList[2] = session_data->paletteaux_status.on;
01226   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01227 }
01228 
01229 void
01230 le_change_focus_notify (iml_session_t *s)
01231 {
01232   MyDataPerDesktop *desktop_data =
01233     (MyDataPerDesktop *)(s->desktop->specific_data);
01234 #if 0
01235   MyDataPerSession *ds = (MyDataPerSession *)(s->specific_data);
01236   IMEBufferMethods mthds = ds->session_core.ime_methods_table;
01237   INPUT_MODE_T input_mode;
01238   IMEBuffer ime_buffer = ds->session_core.ime_buffer;
01239 
01240   (void) (*mthds->ime_buffer->get_input_mode) (ime_buffer, &input_mode);
01241 #endif
01242   /*
01243     if (desktop_data->paletteaux_started == True)
01244   */
01245   le_change_paletteaux_focus_notify (s);
01246 
01247   if (desktop_data->keyboardaux_started == True)
01248     le_change_keyboardaux_focus_notify (s);
01249 
01250   if (desktop_data->lookupaux_started == True)
01251     le_change_lookupaux_focus_notify (s);
01252 
01253   if (desktop_data->selectaux_started == True)
01254     le_change_selectaux_focus_notify (s);
01255 
01256   if (desktop_data->optionaux_started == True)
01257     le_change_optionaux_focus_notify (s);
01258 }
01259 
01260 void
01261 le_show_selectaux_notify (iml_session_t *s)
01262 {
01263   char *classname = XAUX_SELECT_CLASS_NAME;
01264   int nIntegerCount,  pIntegerList[1];
01265 
01266   KOLE_LOG (LOGDEST_STDOUT, "le_show_selectaux_notify");
01267 
01268   nIntegerCount = 1;
01269   pIntegerList[0] = SELECTAUX_SHOW_NOTIFY;
01270 
01271   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01272 }
01273 
01274 void
01275 le_show_optionaux_notify (iml_session_t *s)
01276 {
01277   MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
01278   UserPreference *user_pref = &(desktop_data->user_pref);
01279   int n_option;
01280   char buffer[200];
01281 
01282   char *classname = XAUX_OPTION_CLASS_NAME;
01283   int nIntegerCount,  pIntegerList[7];
01284   int nStringCount, pLenStrings[6];
01285   char *pStrings[6];
01286 
01287   KOLE_LOG (LOGDEST_STDOUT, "le_show_optionaux_notify");
01288 
01289   nIntegerCount = 1;
01290   pIntegerList[0] = OPTIONAUX_SHOW_NOTIFY;
01291 
01292   n_option = OPTION_PAIR_NUM;
01293   nStringCount = n_option;
01294 
01295   sprintf(buffer, "%s:%d", STR_IME_USER_ID, user_pref->ime_user_id);
01296   pLenStrings[IDX_IME_USER_ID] = strlen(buffer);
01297   pStrings[IDX_IME_USER_ID] = strdup(buffer);
01298 
01299   sprintf(buffer, "%s:%s", STR_IME_USER_HOME, user_pref->ime_user_home);
01300   pLenStrings[IDX_IME_USER_HOME] = strlen(buffer);
01301   pStrings[IDX_IME_USER_HOME] = strdup(buffer);
01302 
01303   sprintf(buffer, "%s:%d", STR_KEYBOARD_LAYOUT, user_pref->keyboard_layout);
01304   pLenStrings[IDX_KEYBOARD_LAYOUT] = strlen(buffer);
01305   pStrings[IDX_KEYBOARD_LAYOUT] = strdup(buffer);
01306 
01307   sprintf(buffer, "%s:%d", STR_CONVERSION_FORMAT, user_pref->conversion_format);
01308   pLenStrings[IDX_CONVERSION_FORMAT] = strlen(buffer);
01309   pStrings[IDX_CONVERSION_FORMAT] = strdup(buffer);
01310 
01311   sprintf(buffer, "%s:%d", 
01312          STR_AUTO_COMMIT_ON_CHAR_BASIS, user_pref->auto_commit_on_char_basis);
01313   pLenStrings[IDX_AUTO_COMMIT_ON_CHAR_BASIS] = strlen(buffer);
01314   pStrings[IDX_AUTO_COMMIT_ON_CHAR_BASIS] = strdup(buffer);
01315 
01316   sprintf(buffer, "%s:%d", 
01317          STR_AUTO_COMMIT_ON_SINGLE_CANDIDATE_CONVERSION, 
01318          user_pref->auto_commit_on_single_candidate_conversion);
01319   pLenStrings[IDX_AUTO_COMMIT_ON_SINGLE_CANDIDATE_CONVERSION] = strlen(buffer);
01320   pStrings[IDX_AUTO_COMMIT_ON_SINGLE_CANDIDATE_CONVERSION] = strdup(buffer);
01321 
01322   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, nStringCount, pLenStrings, pStrings);
01323 }
01324 
01325 static void
01326 le_show_keyboardaux_notify (iml_session_t *s, int nKeyboardID, int engine_id)
01327 {
01328   char *classname = XAUX_KEYBOARD_CLASS_NAME;
01329   int nIntegerCount,  pIntegerList[3];
01330 
01331   KOLE_LOG (LOGDEST_STDOUT,
01332            "SVR->AUX: KEYBOARDAUX_SHOW_NOTIFY\n");
01333 
01334   nIntegerCount = 3;
01335   pIntegerList[0] = KEYBOARDAUX_SHOW_NOTIFY;
01336   pIntegerList[1] = nKeyboardID;
01337   pIntegerList[2] = engine_id;
01338 
01339   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01340 }
01341 
01342 void
01343 le_show_lookupaux_notify (iml_session_t *s)
01344 {
01345   char *classname = XAUX_LOOKUP_CLASS_NAME;
01346   int nIntegerCount,  pIntegerList[1];
01347 
01348   KOLE_LOG (LOGDEST_STDOUT, "le_show_lookupaux_notify");
01349 
01350   nIntegerCount = 1;
01351   pIntegerList[0] = LOOKUPAUX_SHOW_NOTIFY;
01352 
01353   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 0, NULL, NULL);
01354 }
01355 
01356 void
01357 le_start_action_notify (iml_session_t *s, char *command_str)
01358 {
01359   char *classname = XAUX_ACTION_CLASS_NAME;
01360   int nIntegerCount,  pIntegerList[1];
01361   int nStringsCount,  pLenStrings[1];
01362   char *pStrings[1];
01363 
01364   nIntegerCount = 1;
01365   pIntegerList[0] = ACTIONAUX_START_ACTION_NOTIFY;
01366 
01367   nStringsCount = 1;
01368   pLenStrings[0] = strlen(command_str) + 1;
01369   pStrings[0] = (char *)command_str;
01370 
01371   KOLE_LOG (LOGDEST_STDOUT,
01372            "le_start_action_notify: %s, len:%d", command_str, pLenStrings[0]);
01373   send_info_to_aux(s, classname, nIntegerCount, pIntegerList, 
01374                  nStringsCount,  pLenStrings,
01375                  pStrings);
01376 }
01377 
01378 #if 0
01379 static void
01380 get_session_property (iml_session *s)
01381 {
01382   MyDataPerDesktop *dd =
01383     (MyDataPerDesktop *)(s->desktop->specific_data);
01384   MyDataPerSession *sd = (MyDataPerSession *)(s->specific_data);
01385   IMEBufferMethods mthds = ds->session_core.ime_methods_table;
01386   IMEBuffer ime_buffer = ds->session_core.ime_buffer;
01387   int n_property;
01388   KOLE_config **p_configs;
01389     
01390   (*mthds->ime_buffer_get_configuration)(ime_buffer, &n_property, &p_configs);
01391   
01392 }
01393 #endif