Back to index

im-sdk  12.3.91
palette_methods.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <X11/Xmd.h>
00003 #include <X11/Xlib.h>
00004 #include <gdk/gdkx.h>
00005 #include <gtk/gtk.h>
00006 
00007 #ifdef HAVE_CONFIG_H
00008 #include "config.h"
00009 #endif
00010 
00011 #include "xaux_common.h"
00012 #include "xaux_ext_common.h"
00013 #include "palette_aux.h"
00014 #include "vkb_aux.h"
00015 #include "le_aux_protocol.h"
00016 #include "ime.h"
00017 
00018 /* Define Aux class */
00019 xaux_class_t *xc_ = 0;
00020 int im_ = 0;
00021 int ic_ = 0;
00022 
00023 #define ATOM_NUM_PALETTEAUX     32
00024 
00025 /* Define Aux class */
00026 xaux_class_t xaux_class = {
00027     PALETTE_AUX_CLASS_NAME, 1,
00028     NULL,
00029     (Window) 0, (Window) 0, (Window) 0,
00030     (Atom) 0, (Atom) 0, (Atom) 0, (Atom) 0,
00031     {(Atom) 0}, ATOM_NUM_PALETTEAUX, 0,
00032     {(Atom) 0}, ATOM_NUM_PALETTEAUX, 0,
00033     NULL,
00034 };
00035 
00036 extern palette_window_t *palette_window;
00037 
00038 int gLocaleID = 0;
00039 Display *gDisplay = NULL;
00040 Window gWindow = 0;
00041 
00042 void palette_aux_Proc_LE_Notify(aux_ext_data_t * aux_ext_data);
00043 void palette_aux_Proc_LE_IMEInfo_Notify(aux_ext_data_t * aux_ext_data);
00044 void palette_aux_Proc_LE_Show_Notify(aux_ext_data_t * aux_ext_data);
00045 void palette_aux_Proc_LE_Hide_Notify(aux_ext_data_t * aux_ext_data);
00046 void palette_aux_Proc_LE_Change_Focus_Notify(aux_ext_data_t * aux_ext_data);
00047 void palette_aux_Proc_LE_Switch_IME_Notify(aux_ext_data_t * aux_ext_data);
00048 void palette_aux_Proc_LE_Switch_QjBj_Notify(aux_ext_data_t * aux_ext_data);
00049 void palette_aux_Proc_LE_Switch_Punct_Notify(aux_ext_data_t * aux_ext_data);
00050 void palette_aux_Proc_LE_Beep_Notify(aux_ext_data_t * aux_ext_data);
00051 
00052 void palette_aux_Connect_To_LE_Request(int locale_id);
00053 void palette_aux_Switch_LE_Engine_Request(char *name);
00054 void palette_aux_Switch_LE_QjBj_Request(int qjbj);
00055 void palette_aux_Switch_LE_Punct_Request(int punct);
00056 
00057 /*
00058                  Data Flow Processing
00059 
00060 Data:
00061     property_data_t:
00062         divide into two categories:  
00063             1. User Preference (need notify LE):   vkb_shortcut_key, IME setting.
00064             2. Local setting (need not notify LE): palette status info(pos_x,pos_y, vertical style), composite style.
00065 
00066 Flow:
00067 
00068                 User Preference Info
00069     Aux   ----------------------------------------->  LE
00070                                                       |
00071                                                       V
00072                                                    Merge IME info
00073                                                       |
00074                 Merged IME Info                       V
00075           <------------------------------------------
00076          |
00077          V
00078     Modification     
00079          |
00080          V     Modified part 
00081           ------------------------------------------> LE
00082 
00083 */
00084 
00085 /*
00086        Event Handler 
00087 */
00088 GdkFilterReturn xaux_ext_event_handler(GdkXEvent * gdk_xevent,
00089                                    GdkEvent * event,
00090                                    gpointer user_data)
00091 {
00092     XEvent *xevent = (XEvent *) gdk_xevent;
00093 
00094     switch (xevent->type) {
00095     case ClientMessage:
00096        xaux_ext_process_client_message((Display *) gDisplay,
00097                                    (XClientMessageEvent *) xevent);
00098        break;
00099     case SelectionClear:
00100        break;
00101     }
00102     return GDK_FILTER_CONTINUE;
00103 }
00104 
00105 /*
00106        xaux_ext_init_classes(): Initialize the Atom of Auxiliary Window.
00107        It is in ../xaux_common/xaux_ext_common.c
00108 */
00109 int xaux_ext_register_classes(GdkWindow * window)
00110 {
00111     gDisplay = (Display *) GDK_WINDOW_XDISPLAY(window);
00112     gWindow = (Window) GDK_WINDOW_XWINDOW(window);
00113 
00114     /* Register aux class */
00115     if (xaux_ext_init_classes(gDisplay, (xaux_class_t *) & xaux_class, gWindow) == False)
00116        return False;
00117 
00118     return True;
00119 }
00120 
00121 /* 
00122 Note:
00123      xaux_ext_Start(), xaux_ext_Draw(), xaux_ext_Done() 
00124      These three functions are all called by xaux_ext_process_client_message()
00125 
00126      xaux_ext_SetValue() will send auxiliary window information to language engine;
00127 */
00128 
00129 /* Method - Start */
00130 Bool xaux_ext_Start(xaux_class_t * xc, aux_ext_data_t * aux_ext_data,
00131                   Atom atom)
00132 {
00133     DEBUG_printf("ext_Start: im:%d, ic:%d\n", aux_ext_data->im,
00134                aux_ext_data->ic);
00135     im_ = aux_ext_data->im;
00136     ic_ = aux_ext_data->ic;
00137     xc_ = xc;
00138 
00139     /* inform Language Engine that PaletteAux has started. */
00140     /* Get Options Setting and send settings to Language engine. */
00141     palette_aux_Connect_To_LE_Request(gLocaleID);
00142 
00143     return True;
00144 }
00145 
00146 /* Method - Draw */
00147 Bool xaux_ext_Draw(xaux_class_t * xc, aux_ext_data_t * aux_ext_data,
00148                  Atom atom)
00149 {
00150     DEBUG_printf("ext_Draw == im:0x%x, ic:0x%x\n", aux_ext_data->im,
00151                aux_ext_data->ic);
00152     im_ = aux_ext_data->im;
00153     ic_ = aux_ext_data->ic;
00154     xc_ = xc;
00155 
00156     palette_aux_Proc_LE_Notify(aux_ext_data);
00157     return True;
00158 }
00159 
00160 /* Method - Done */
00161 Bool xaux_ext_Done(xaux_class_t * xc, aux_ext_data_t * aux_ext_data,
00162                  Atom atom)
00163 {
00164     DEBUG_printf("ext_Done im:0x%x, ic_id:0x%x\n", aux_ext_data->im,
00165                aux_ext_data->ic);
00166     return True;
00167 }
00168 
00169 /* ================================================================= */
00170 /*       Process Notify information From Language Engine             */
00171 /* ================================================================= */
00172 void palette_aux_Proc_LE_Notify(aux_ext_data_t * aux_ext_data)
00173 {
00174     int nIntegerCount, notifyType;
00175 
00176     nIntegerCount = aux_ext_data->integer_count;
00177     if (nIntegerCount <= 0)
00178        return;
00179 
00180     notifyType = aux_ext_data->integer_list[0];
00181 
00182     switch (notifyType) {
00183     case COMMONAUX_IME_INFO_NOTIFY:
00184        DEBUG_printf("COMMONAUX_IME_INFO_NOTIFY Notify Received\n");
00185        palette_aux_Proc_LE_IMEInfo_Notify(aux_ext_data);
00186        break;
00187     case COMMONAUX_SHOW_NOTIFY:
00188        DEBUG_printf("COMMONAUX_SHOW_NOTIFY Notify Received\n");
00189        palette_aux_Proc_LE_Show_Notify(aux_ext_data);
00190        break;
00191     case COMMONAUX_HIDE_NOTIFY:
00192        DEBUG_printf("COMMONAUX_HIDE_NOTIFY Notify Received\n");
00193        palette_aux_Proc_LE_Hide_Notify(aux_ext_data);
00194        break;
00195     case COMMONAUX_CHANGE_FOCUS_NOTIFY:
00196        DEBUG_printf("COMMONAUX_CHANGE_FOCUS_NOTIFY Notify Received\n");
00197        palette_aux_Proc_LE_Change_Focus_Notify(aux_ext_data);
00198        break;
00199     case PALETTEAUX_SWITCH_IME_NOTIFY:
00200        DEBUG_printf("PALETTEAUX_SWITCH_IME_NOTIFY Notify Received\n");
00201        palette_aux_Proc_LE_Switch_IME_Notify(aux_ext_data);
00202        break;
00203     case PALETTEAUX_SWITCH_QJBJ_NOTIFY:
00204        DEBUG_printf("PALETTEAUX_SWITCH_QJBJ_NOTIFY Notify Received\n");
00205        palette_aux_Proc_LE_Switch_QjBj_Notify(aux_ext_data);
00206        break;
00207     case PALETTEAUX_SWITCH_PUNCT_NOTIFY:
00208        DEBUG_printf("PALETTEAUX_SWITCH_PUNCT_NOTIFY Notify Received\n");
00209        palette_aux_Proc_LE_Switch_Punct_Notify(aux_ext_data);
00210        break;
00211     case PALETTEAUX_BEEP_NOTIFY:
00212        DEBUG_printf("PALETTEAUX_BEEP_NOTIFY Notify Received\n");
00213        palette_aux_Proc_LE_Beep_Notify(aux_ext_data);
00214        break;
00215 #if 0
00216     case PALETTEAUX_SWITCH_CONVERSION_NOTIFY:
00217        DEBUG_printf
00218            ("PALETTEAUX_SWITCH_CONVERSION_NOTIFY Notify Received\n");
00219        palette_aux_Proc_LE_Switch_Conversion_Notify(aux_ext_data);
00220        break;
00221     case COMMONAUX_UPDATE_KEYMAPINFO_NOTIFY:
00222        DEBUG_printf
00223            ("PALETTEAUX_UPDATE_KEYMAPINFO_NOTIFY Notify Received\n");
00224        palette_aux_Proc_LE_Update_KeymapInfo_Notify(aux_ext_data);
00225        break;
00226 #endif
00227     }
00228 }
00229 
00230 void palette_aux_Set_Selection_Owner()
00231 {
00232     Atom aux_atom =
00233        XInternAtom(gDisplay, "CH_PALETTEAUX_MODULE_ATOM", False);
00234 
00235     XSetSelectionOwner(gDisplay, aux_atom, gWindow, CurrentTime);
00236 }
00237 
00238 void palette_aux_Proc_LE_IMEInfo_Notify(aux_ext_data_t * aux_ext_data)
00239 {
00240     int nIntegerCount;
00241     int nStringsCount;
00242     char *property_info_str;
00243     int  property_info_len;
00244     property_data_t *property_data;
00245 
00246     char ime_uuid[256], *uuid_str;
00247     ime_module_t *current_ime;
00248 
00249     nIntegerCount = aux_ext_data->integer_count;
00250     if (nIntegerCount <= 0)
00251        return;
00252 
00253     nStringsCount = aux_ext_data->string_count;
00254     if (nStringsCount <= 0)
00255        return;
00256 
00257     property_info_str = (char *)aux_ext_data->string_list[0].ptr;
00258     property_info_len = strlen ((char *) property_info_str);
00259 
00260     if (property_info_len == 0 || *property_info_str == 0)
00261        return;
00262 
00263     uuid_str = "NoIme";
00264     current_ime = palette_window->current_ime;
00265     if (current_ime != NULL)
00266        uuid_str = current_ime->uuid;
00267     snprintf(ime_uuid, sizeof(ime_uuid), "%s", uuid_str);
00268 
00269     property_data = palette_window->property_data;
00270     property_data_parse_from_xmlstr(property_data, property_info_str, property_info_len);
00271 
00272     palette_window->current_ime = (ime_module_t *)property_data_get_ime_module_by_uuid(
00273                                                  property_data, ime_uuid);
00274 
00275     palette_window_update_ime_list_menu(palette_window, property_data);
00276 
00277 /*
00278     property_data_save_to_profile(palette_window->property_data, PROPERTY_DATA_FOR_IME_CONFIG);
00279 */
00280 
00281     return;
00282 }
00283 
00284 void palette_aux_Proc_LE_Show_Notify(aux_ext_data_t * aux_ext_data)
00285 {
00286     /* Change auxiliary window Full_Width/half_Width information */
00287     DEBUG_printf("palette_aux_Proc_LE_Show_Notify().");
00288     gtk_widget_show_all(palette_window->window);
00289 }
00290 
00291 void palette_aux_Proc_LE_Hide_Notify(aux_ext_data_t * aux_ext_data)
00292 {
00293     /* Change auxiliary window Full_Width/half_Width information */
00294     if (palette_window->menu_popuped == 0) {
00295         palette_window_hide(palette_window);
00296     }
00297 }
00298 
00299 void palette_aux_Proc_LE_Change_Focus_Notify(aux_ext_data_t * aux_ext_data)
00300 {
00301     int show_status;
00302     gboolean qjbj_status, punct_status;
00303     char *uuid;
00304     ime_module_t *ime_module;
00305 
00306     if (aux_ext_data->integer_count != 4)
00307        return;
00308 
00309     show_status = aux_ext_data->integer_list[1];
00310     qjbj_status = aux_ext_data->integer_list[2];
00311     punct_status = aux_ext_data->integer_list[3];
00312 
00313     DEBUG_printf("palette_aux_Proc_LE_Change_Focus_Notify: \n");
00314     DEBUG_printf("   show_status: %d\n", show_status);
00315     DEBUG_printf("   qjbj_status: 0x%x, punct_status: 0x%x\n",
00316                qjbj_status, punct_status);
00317 
00318     if (!show_status) {
00319        palette_window_hide(palette_window);
00320        return;
00321     }
00322 
00323     if (aux_ext_data->string_count != 1)
00324        return;
00325 
00326     uuid = (char *)aux_ext_data->string_list[0].ptr;
00327 
00328     ime_module = (ime_module_t *)property_data_get_ime_module_by_uuid(palette_window->property_data, uuid);
00329     if (ime_module == NULL)
00330        return;
00331 
00332     gtk_widget_show_all(palette_window->window);
00333     palette_window_change_current_ime(ime_module, False);
00334 
00335     palette_window_set_qjbj_status(palette_window, qjbj_status);
00336     palette_window_set_punct_status(palette_window, punct_status);
00337     palette_window_set_position(palette_window, palette_window->pos_x, palette_window->pos_y);
00338 }
00339 
00340 void palette_aux_Proc_LE_Switch_IME_Notify(aux_ext_data_t * aux_ext_data)
00341 {
00342     int show_status;
00343     char *uuid;
00344     ime_module_t *ime_module;
00345 
00346     if (aux_ext_data->integer_count != 2)
00347        return;
00348 
00349     show_status = aux_ext_data->integer_list[1];
00350 
00351     DEBUG_printf("palette_aux_Proc_LE_Switch_IME_Notify: \n");
00352 
00353     if (!show_status) {
00354         palette_window_hide(palette_window);
00355        return;
00356     }
00357 
00358     if (aux_ext_data->string_count != 1)
00359        return;
00360 
00361     uuid = (char *)aux_ext_data->string_list[0].ptr;
00362     ime_module = (ime_module_t *)property_data_get_ime_module_by_uuid(palette_window->property_data, uuid);
00363     if (ime_module == NULL)
00364        return;
00365 
00366     gtk_widget_show_all(palette_window->window);
00367     palette_window_change_current_ime(ime_module, False);
00368 }
00369 
00370 void palette_aux_Proc_LE_Switch_QjBj_Notify(aux_ext_data_t * aux_ext_data)
00371 {
00372     int qjbj;
00373 
00374     if (aux_ext_data->integer_count != 2)
00375        return;
00376 
00377     /* Change auxiliary window Full_Width/half_Width information */
00378     qjbj = aux_ext_data->integer_list[1];
00379     palette_window_set_qjbj_status(palette_window, qjbj);
00380 }
00381 
00382 void palette_aux_Proc_LE_Switch_Punct_Notify(aux_ext_data_t * aux_ext_data)
00383 {
00384     int punct;
00385 
00386     if (aux_ext_data->integer_count != 2)
00387        return;
00388 
00389     /* Change auxiliary window English/Chinese Punctuation information */
00390     punct = aux_ext_data->integer_list[1];
00391     palette_window_set_punct_status(palette_window, punct);
00392 }
00393 
00394 void palette_aux_Proc_LE_Beep_Notify(aux_ext_data_t * aux_ext_data)
00395 {
00396     int beep_type;
00397     property_data_t *property_data;
00398 
00399     property_data = palette_window->property_data;
00400 
00401     beep_type = ImeBeepWarning;
00402     if (aux_ext_data->integer_count == 2)
00403        beep_type = aux_ext_data->integer_list[1];
00404 
00405     if (gDisplay == NULL)
00406        return;
00407 
00408     if (property_data != NULL && property_data->beep_enabled == 0)
00409        return;
00410 
00411     if (beep_type == ImeBeepWarning) {
00412         XBell(gDisplay, 0);
00413     } else {
00414        /* if is ImeBeepError, bell with some long time. */
00415 
00416         static XKeyboardState kbdstate;
00417         static XKeyboardControl kbdcontrol;
00418         gint save_duration;
00419 
00420         XGetKeyboardControl(gDisplay, &kbdstate);
00421         save_duration = kbdstate.bell_duration;
00422 
00423         kbdcontrol.bell_duration = save_duration * 2;
00424         XChangeKeyboardControl(gDisplay, KBBellDuration, &kbdcontrol);
00425 
00426         XBell(gDisplay, 0);
00427 
00428         kbdcontrol.bell_duration = save_duration;
00429         XChangeKeyboardControl(gDisplay, KBBellDuration, &kbdcontrol);
00430     }
00431 }
00432 
00433 /* ================================================================= */
00434 /*             Send information to Language Engine                   */
00435 /* ================================================================= */
00436 void palette_aux_Connect_To_LE_Request(int locale_id)
00437 {
00438     int nIntegerCount, pIntegerList[3];
00439     int nStringCount, pStringLen[1];
00440     char *pStringList[1];
00441     char *property_info_str = NULL;
00442     int  property_info_len = 0;
00443 
00444     nIntegerCount = 3;
00445     pIntegerList[0] = PALETTEAUX_CONNECT;
00446     pIntegerList[1] = locale_id;
00447 
00448     property_info_len = 0;
00449 
00450     property_data_read_from_profile(palette_window->property_data, PROPERTY_DATA_FOR_IME_CONFIG);
00451     property_info_str = (char *)property_data_composite_le_settings_to_xmlstr(palette_window->property_data,
00452                                         PROPERTY_DATA_FOR_SERVER_NOTIFICATION);
00453     if (property_info_str != NULL) {
00454         property_info_len = strlen(property_info_str);
00455     }
00456 
00457     pIntegerList[2] = property_info_len;
00458 
00459     if (property_info_len == 0) {
00460         NotifyIntegerListDataToLanguageEngine(gDisplay, nIntegerCount,
00461                                          pIntegerList);
00462        return;
00463     }
00464 
00465 #if DEBUG
00466     printf("palette_aux_Connect_To_LE_Request: property_info_str: \n%s\nlen: %d\n", property_info_str, property_info_len);
00467 #endif
00468     nStringCount = 1;
00469     pStringLen[0] = property_info_len + 1;
00470     pStringList[0] = property_info_str;
00471     
00472     NotifyStringListDataToLanguageEngine(gDisplay, nIntegerCount,
00473                                     pIntegerList, nStringCount,
00474                                     pStringLen, pStringList);
00475 
00476     free((char *)property_info_str);
00477 }
00478 
00479 void palette_aux_Update_LE_Properties_Request()
00480 {
00481     int nIntegerCount, pIntegerList[2];
00482     int nStringCount, pStringLen[1];
00483     char *pStringList[1];
00484     char *property_info_str = NULL;
00485     int  property_info_len = 0;
00486 
00487     nIntegerCount = 2;
00488     pIntegerList[0] = PALETTEAUX_UPDATE_PROPERTY;
00489 
00490     property_info_len = 0;
00491     property_info_str = (char *)property_data_composite_le_settings_to_xmlstr(palette_window->property_data,
00492                                         PROPERTY_DATA_FOR_SERVER_NOTIFICATION);
00493     if (property_info_str != NULL) {
00494             property_info_len = strlen(property_info_str);
00495     }
00496 
00497     if (property_info_len == 0)
00498        return;
00499 
00500     pIntegerList[1] = property_info_len;
00501 
00502 #if DEBUG
00503     printf("palette_aux_Connect_To_LE_Request: property_info_str: \n%s\nlen: %d\n", property_info_str, property_info_len);
00504 #endif
00505     nStringCount = 1;
00506     pStringLen[0] = property_info_len + 1;
00507     pStringList[0] = property_info_str;
00508     
00509     NotifyStringListDataToLanguageEngine(gDisplay, nIntegerCount,
00510                                     pIntegerList, nStringCount,
00511                                     pStringLen, pStringList);
00512 
00513     free((char *)property_info_str);
00514 }
00515 
00516 void palette_aux_Switch_LE_Engine_Request(char *name)
00517 {
00518     int nIntegerCount, pIntegerList[1];
00519     int nStringCount, pStringLen[1];
00520     char *pStringList[1];
00521 
00522     nIntegerCount = 1;
00523     pIntegerList[0] = PALETTEAUX_SWITCH_IME;
00524 
00525     nStringCount = 1;
00526     pStringLen[0] = strlen(name);
00527     pStringList[0] = name;
00528     
00529     NotifyStringListDataToLanguageEngine(gDisplay, nIntegerCount,
00530                                     pIntegerList, nStringCount,
00531                                     pStringLen, pStringList);
00532 }
00533 
00534 void palette_aux_Switch_LE_QjBj_Request(int qjbj)
00535 {
00536     int nIntegerCount, pIntegerList[2];
00537 
00538     nIntegerCount = 2;
00539     pIntegerList[0] = PALETTEAUX_SWITCH_QJBJ;
00540     pIntegerList[1] = qjbj;
00541     NotifyIntegerListDataToLanguageEngine(gDisplay, nIntegerCount,
00542                                      pIntegerList);
00543 }
00544 
00545 void palette_aux_Switch_LE_Punct_Request(int punct)
00546 {
00547     int nIntegerCount, pIntegerList[2];
00548 
00549     nIntegerCount = 2;
00550     pIntegerList[0] = PALETTEAUX_SWITCH_PUNCT;
00551     pIntegerList[1] = punct;
00552     NotifyIntegerListDataToLanguageEngine(gDisplay, nIntegerCount,
00553                                      pIntegerList);
00554 }
00555 
00556 #if 0
00557 void palette_aux_Change_LE_Position_Request(int x, int y)
00558 {
00559     int nIntegerCount, pIntegerList[3];
00560 
00561     nIntegerCount = 3;
00562     pIntegerList[0] = PALETTEAUX_CHANGE_POSITION;
00563     pIntegerList[1] = x;
00564     pIntegerList[2] = y;
00565     NotifyIntegerListDataToLanguageEngine(gDisplay, nIntegerCount,
00566                                      pIntegerList);
00567 }
00568 #endif
00569 
00570 void palette_aux_Commit_String_Request(char *commit_str)
00571 {
00572     int nIntegerCount, pIntegerList[3];
00573     int nStringCount, pStringLen[1];
00574     char *pStringList[1];
00575 
00576     if (!commit_str || !*commit_str) return;
00577 
00578     DEBUG_printf("palette_aux_Commit_String_Request: encode_id:%d, commit_str:%s, len: %d\n",
00579                  ENCODE_UTF8,  commit_str, strlen(commit_str));
00580 
00581     nIntegerCount = 3;
00582     pIntegerList[0] = COMMONAUX_COMMIT_STRING;
00583     pIntegerList[1] = ENCODE_UTF8;
00584     pIntegerList[2] = strlen(commit_str);
00585 
00586     nStringCount = 1;
00587     pStringLen[0] = strlen(commit_str) + 1;
00588     pStringList[0] = commit_str;
00589 
00590     NotifyStringListDataToLanguageEngine(gDisplay, nIntegerCount, pIntegerList,
00591                                     nStringCount, pStringLen,
00592                                     pStringList);
00593 }
00594 
00595 void palette_aux_Commit_Key_Request(int nKeyCode, int nKeyChar, int nKeyStatus)
00596 {
00597     int nIntegerCount, pIntegerList[4];
00598 
00599     nIntegerCount = 4;
00600     pIntegerList[0] = COMMONAUX_COMMIT_KEY;
00601     pIntegerList[1] = nKeyCode;
00602     pIntegerList[2] = nKeyChar;
00603     pIntegerList[3] = nKeyStatus;
00604     NotifyIntegerListDataToLanguageEngine(gDisplay, nIntegerCount, pIntegerList);
00605 }
00606 
00607 NotifyIntegerListDataToLanguageEngine(Display * display,
00608                                   int nIntegerCount, int *pIntegerList)
00609 {
00610     aux_ext_data_t aux_ext_data;
00611 
00612     aux_ext_data.im = im_;
00613     aux_ext_data.ic = ic_;
00614     aux_ext_data.integer_count = nIntegerCount;
00615     aux_ext_data.integer_list = pIntegerList;
00616     aux_ext_data.string_count = 0;
00617     aux_ext_data.string_list = NULL;
00618     aux_ext_data.string_ptr = NULL;
00619     aux_ext_data.point.x = 0;
00620     aux_ext_data.point.y = 0;
00621 
00622     xaux_ext_SetValue(display, xc_, &aux_ext_data);
00623     XFlush(display);
00624 }
00625 
00626 NotifyStringListDataToLanguageEngine(Display * display,
00627                                  int nIntegerCount, int *pIntegerList,
00628                                  int nStringCount, int *pStringLen,
00629                                  char **pStringList)
00630 {
00631     int i;
00632 
00633     aux_ext_data_t aux_ext_data;
00634     aux_ext_string_t *p;
00635 
00636     aux_ext_data.im = im_;
00637     aux_ext_data.ic = ic_;
00638     aux_ext_data.integer_count = nIntegerCount;
00639     aux_ext_data.integer_list = pIntegerList;
00640     aux_ext_data.point.x = 0;
00641     aux_ext_data.point.y = 0;
00642 
00643     aux_ext_data.string_count = nStringCount;
00644     aux_ext_data.string_ptr = NULL;
00645 
00646     if (nStringCount > 0) {
00647        aux_ext_data.string_list =
00648            (aux_ext_string_t *) calloc(nStringCount,
00649                                    sizeof(aux_ext_string_t));
00650        for (i = 0; i < nStringCount; i++) {
00651            aux_ext_string_t *p = &aux_ext_data.string_list[i];
00652            p->length = pStringLen[i];
00653            p->ptr = (unsigned char *) (pStringList[i]);
00654        }
00655     }
00656 
00657     xaux_ext_SetValue(display, xc_, &aux_ext_data);
00658     XFlush(display);
00659 
00660     free(aux_ext_data.string_list);
00661 }