Back to index

im-sdk  12.3.91
Functions
iiimpIC.c File Reference
#include "iiimpIM.h"
#include "switchIM.h"
#include "guiIM.h"
#include "XimpIm.h"
#include "iiimpIC.h"
#include "status.h"
#include <X11/keysym.h>
#include <X11/Xutil.h>
#include "iiimpUtil.h"
#include "iiimpSwitcher.h"
#include "iiimpAuxP.h"
#include "xfactory.h"

Go to the source code of this file.

Functions

char * SetICValueData (XicCommon ic, XIMArg *values, XICSetMode mode, XimpChangeaMask change_mask)
char * GetICValueData (XicCommon ic, XIMArg *values, XimpChangeaMask change_mask)
static void IIIMP_DestroyIC (XIC xic)
static void IIIMP_SetFocus (XIC xic)
static void IIIMP_UnSetFocus (XIC xic)
static char * IIIMP_MbReset (XIC xic)
static wchar_t * IIIMP_WcReset (XIC xic)
char * IIIMP_SetICValues (XIC xic, XIMArg *arg)
char * IIIMP_GetICValues (XIC xic, XIMArg *arg)
static int IIIMP_MbLookupString (XIC xic, XKeyEvent *ev, char *buffer, int len, KeySym *keysym, Status *status)
static int IIIMP_WcLookupString (XIC xic, XKeyEvent *ev, wchar_t *buffer, int len, KeySym *keysym, Status *status)
IIIMCF_languageiiim_get_languages (XimCommon im, int *n_lang)
IIIMF_status IIimpConvertToString (IIIMCF_text text, Bool useUnicode, char **pstr)
static XICMethods get_iiimp_ic_methods ()
static void SWITCH_DestroyIC (XIC)
static XICMethods get_switch_ic_methods ()
Bool IIIMP_Local_KeyFilter (Display *d, Window w, XEvent *ev, XPointer client_data)
void ChangePreeditState (XicCommon ic)
void SetConversionMode (XicCommon ic, int mode)
static SwitchMode SwitchFilter (XicCommon ic, XEvent *ev)
char * im_canonicalize_langname (XimCommon im)
XIC CreateIC (XimCommon im, XIMArg *arg)
Status IIIMP_CreateIC_SWITCH (XIC xic, XIMArg *arg)
Bool GetIMSettings (XicCommon ic)
int IIIMP_MbLookupString_SWITCH (XIC xic, XKeyEvent *ev, char *buffer, int len, KeySym *keysym, Status *status)
int IIIMP_WcLookupString_SWITCH (XIC xic, XKeyEvent *ev, wchar_t *buffer, int len, KeySym *keysym, Status *status)
void HoldXKeyEvent (XicCommon ic, XEvent *ev)
void PutBackXKeyEvent (XicCommon ic)
void IIIMPKeyEventFilter (XicCommon ic, Window old_focus)
Bool IMGetICValues (XicCommon ic, XICAttribute *ic_attr, int attr_count)
Bool IMCheckIMWindow (XicCommon ic, Window window)

Function Documentation

Definition at line 156 of file iiimpIC.c.

{
    if (ic->core.preedit_attr.preedit_state == XIMPreeditEnable &&
       !IsConversionMode(ic)) {
       SetConversionMode(ic, True);
       IMTriggerNotify(ic, CONV_ON);
    }
    if (ic->core.preedit_attr.preedit_state == XIMPreeditDisable &&
       IsConversionMode(ic)) {
       IMTriggerNotify(ic, CONV_OFF);
       SetConversionMode(ic, False);
    }
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

XIC CreateIC ( XimCommon  im,
XIMArg arg 
)

Definition at line 274 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)NULL;

    ic = (XicCommon)Xmalloc(sizeof(XicCommonRec));
    if (ic == (XicCommon)NULL) goto Error;
    memset(ic, 0, sizeof(XicCommonRec));

    ic->core.im = (XIM)im;
    ic->methods = get_iiimp_ic_methods();

    if (!CommonCreateIC((XIC)ic, arg)) goto Error;
    
    if (!IIIMP_CreateIC_SWITCH((XIC)ic, arg)) goto Error;

    ic->current_language = im_canonicalize_langname(im);

    _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window,
                        KeyPress, KeyRelease,
                        IIIMP_Local_KeyFilter, (XPointer)ic);
    return (XIC)ic;
Error:
    if (ic) Xfree(ic);
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static XICMethods get_iiimp_ic_methods ( ) [static]

Definition at line 115 of file iiimpIC.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static XICMethods get_switch_ic_methods ( ) [static]

Definition at line 136 of file iiimpIC.c.

{
  static XICMethodsRec icm;
  if (!icm.destroy) {
    icm.destroy = SWITCH_DestroyIC;
    icm.set_focus = IIIMP_SetFocus;
    icm.unset_focus = IIIMP_UnSetFocus;
  }
  return &icm;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* GetICValueData ( XicCommon  ic,
XIMArg values,
XimpChangeaMask  change_mask 
)

Definition at line 548 of file iiimpICG.c.

                                                                          {
  XIMArg *p;
  char *p_char;
  char *return_name = NULL;
  int len;

  for (p = values; p->name != NULL; p++) {
    if (strcmp(p->name, XNInputStyle) == 0) {
      if (ic->ximp_icpart->value_mask & XIMP_INPUT_STYLE) {
       *((XIMStyle *)(p->value)) = ic->core.input_style;
      } else {
       return_name = p->name;
       break;
      }
    } else if (strcmp(p->name, XNClientWindow)==0) {
      if (ic->ximp_icpart->value_mask & XIMP_CLIENT_WIN) {
       *((Window *)(p->value)) = ic->core.client_window;
      } else {
       return_name = p->name;
       break;
      }
    } else if (strcmp(p->name, XNFocusWindow)==0) {
      if (XIMP_CHK_FOCUSWINMASK(ic)) {
       *((Window *)(p->value)) = ic->core.focus_window;
      } else {
       return_name = p->name;
       break;
      }
    } else if (strcmp(p->name, XNResourceName)==0) {
      if (ic->core.im->core.res_name != (char *)NULL) {
       len = strlen(ic->core.im->core.res_name);
       if ((p_char = (char*)Xmalloc(len+1)) == NULL) {
         return_name = p->name;
         break;
       }
       strcpy(p_char, ic->core.im->core.res_name);
       *((char **)(p->value)) = p_char;
      } else {
       return_name = p->name;
       break;
      }
    } else if (strcmp(p->name, XNResourceClass)==0) {
      if (ic->core.im->core.res_class != (char *)NULL) {
       len = strlen(ic->core.im->core.res_class);
       if ((p_char = (char*)Xmalloc(len+1)) == NULL) {
         return_name = p->name;
         break;
       }
       strcpy(p_char, ic->core.im->core.res_class);
       *((char **)(p->value)) = p_char;
      } else {
       return_name = p->name;
       break;
      }
    } else if (strcmp(p->name, XNGeometryCallback)==0) {
      if (ic->ximp_icpart->value_mask & XIMP_GEOMETRY_CB) {
       *((XICCallback *)(p->value)) = ic->core.geometry_callback;
      } else {
       return_name = p->name;
       break;
      }
    } else if (strcmp(p->name, XNFilterEvents)==0) {
      *((unsigned long *)(p->value)) = ic->core.filter_events;
    } else if (strcmp(p->name, XNUnicodeCharacterSubset)==0) {
      XIMUnicodeCharacterSubset **value;
      XIMUnicodeCharacterSubset *subset;
      XimCommon xim = (XimCommon)ic->core.im;

      if (xim->unicode_char_subsets == NULL)
       return p->name;

      subset = &(xim->unicode_char_subsets->supported_subsets[ic->subset_id]);
      value = (XIMUnicodeCharacterSubset**)p->value;
      *value = subset;
    } else if (strcmp(p->name, XNPreeditAttributes)==0) {
      if (PreGetAttributes(ic, (XIMArg*)p->value,
                        change_mask,
                        &return_name) == False)
       break;
    } else if (strcmp(p->name, XNStatusAttributes)==0) {
      if (StatusGetAttributes(ic, (XIMArg*)p->value,
                           change_mask,
                           &return_name) == False)
       break;
    } else {
      return_name = p->name;
      break;
    }
  }
  return(return_name);
}

Here is the caller graph for this function:

Definition at line 201 of file guiIM.c.

{
  Atom type;
  unsigned char *data = NULL;
  int format;
  unsigned long length = 0, bytes_after;
  Display *display = ic->core.im->core.display;

  if (XGetWindowProperty (display,
                       RootWindow(display, XIC_GUI(ic, screen_number)),
                       im_settings_atom, 0L, 1000000L,
                       False, AnyPropertyType, &type, &format, &length,
                       &bytes_after, (unsigned char **)&data ) == Success &&
      data != NULL)
    {
      memmove (&current_setting, data, sizeof (IMSettings));
      Xfree (data);
      current_setting_enabled = True;
      return True;
    }
  else
    current_setting_enabled = False;
  return False;
}

Here is the caller graph for this function:

void HoldXKeyEvent ( XicCommon  ic,
XEvent *  ev 
)

Definition at line 748 of file iiimpIC.c.

{
    XICKeyEventListRec *    kel;

    kel = (XICKeyEventListRec *)Xmalloc(sizeof (XICKeyEventListRec));
    if (NULL == kel) {
       return;
    }

    memcpy(&(kel->key_event), ev, sizeof (XKeyEvent));
    kel->next = XIC_IIIMP(ic, key_event_list);
    XIC_IIIMP(ic, key_event_list) = kel;

    return;
}

Here is the caller graph for this function:

IIIMCF_language* iiim_get_languages ( XimCommon  im,
int *  n_lang 
)

Definition at line 1170 of file iiimcfFun.c.

{
  IIIMF_status st;
  IIIMCF_handle h = XIM_IIIMP(im, handle);
  IIIMCF_language *lang = NULL;

  if (!h)
    return NULL;

  st = iiimcf_get_supported_languages (h, n_lang, &lang);
  if (st != IIIMF_STATUS_SUCCESS)
    return NULL;

  return lang;
}

Here is the call graph for this function:

Status IIIMP_CreateIC_SWITCH ( XIC  xic,
XIMArg arg 
)

Definition at line 304 of file iiimpIC.c.

{
    int id;
    XicCommon ic = (XicCommon)xic;
    XimCommon im = (XimCommon)ic->core.im;
    XimpChangeMaskRec dummy;

    ic->core.filter_events = KeyPressMask|ExposureMask|
       ButtonPressMask |PointerMotionMask;
    if (!(ic->iiimp_icpart = Xmalloc(sizeof(XICIIimpIMRec)))) {
       goto Error;
    }
    memset(ic->iiimp_icpart, 0, sizeof(XICIIimpIMRec));
    XIC_IIIMP(ic, switch_methods) = get_switch_ic_methods();
    if (IMCreateIC(im, &XIC_IIIMP(ic, context))
       != IIIMF_STATUS_SUCCESS) {
       goto Error;
    }
    id = XIM_IIIMP(im, counter);
    XIC_IIIMP(ic, id) = id;
    XIM_IIIMP(im, counter) = id + 1;
    SetConversionMode(ic, False);

    memset(&dummy, 0, sizeof(dummy));
    if (SetICValueData(ic, arg, CREATE_IC, &dummy)) {
       goto Error;
    }

    /* switch */
    if (XIM_IS_SWITCH(im)) {
       RegisterSwitchFilter(ic, SwitchFilter,
                          IIIMP_Local_KeyFilter,
                          get_iiimp_ic_methods());
    }

    return True;
Error:
    if (ic->iiimp_icpart)
       Xfree(ic->iiimp_icpart);
    return False;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void IIIMP_DestroyIC ( XIC  xic) [static]

Definition at line 350 of file iiimpIC.c.

Here is the call graph for this function:

Here is the caller graph for this function:

char * IIIMP_GetICValues ( XIC  xic,
XIMArg arg 
)

Definition at line 543 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)xic;
    XimpChangeMaskRec dummy;
    char *ret = NULL;

    memset(&dummy, 0, sizeof (dummy));

    (void)IMGetICValues(ic, NULL, 0);

    ret = GetICValueData(ic, arg, &dummy);

    return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bool IIIMP_Local_KeyFilter ( Display *  d,
Window  w,
XEvent *  ev,
XPointer  client_data 
)

Definition at line 225 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)client_data;

    if (!IsIMEnabled())
      return False;

    if (ic->ximp_icpart == NULL) {
       /* most likely associated ic has been already destroyed */
       _XUnregisterFilter(d, w, IIIMP_Local_KeyFilter, (XPointer)ic);
       return False;
    }
    if (ev->xkey.keycode == XIM_COMPOSE_KEYCODE) {
       return False;
    }
    if (0 < XIC_IIIMP(ic, key_event_num)) {
       XIC_IIIMP(ic, key_event_num) -= 1;
       return False;
    }

    /*
     * Comment the codes below - FIXME
     * Key release event should be forwarded with IMForwardEvent to server
     */
    if ((KeyRelease == ev->xkey.type) &&
       (IIIMF_STATUS_SUCCESS !=
        iiimcf_is_capability_supported(XIM_IIIMP(ic->core.im, handle),
                                   IIIMP_CAPABILITY_KEY_RELEASE))) {
       XIMCallback *cb = &ic->forward_event_callback;
       if (NULL != cb->callback) {
           (*cb->callback)((XIC)ic, cb->client_data, (XPointer)ev);
           return True;
       } else {
           return IsConversionMode(ic);
       }
    }

    return IMForwardEvent(ic, ev);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int IIIMP_MbLookupString ( XIC  xic,
XKeyEvent *  ev,
char *  buffer,
int  len,
KeySym keysym,
Status *  status 
) [static]

Definition at line 579 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)xic;
    int ret;
    XComposeStatus compose_status;

    if (ev->keycode == XIM_COMPOSE_KEYCODE) { /* Composed Event */
       IIIMF_status st;
       IIIMCF_text text;
       char *str;
       KeySym keysym_return;

       keysym_return = XIC_IIIMP(ic, keysym_return);

       if (XIC_IIIMP(ic, committed_text_consumed)) return 0;

       st = iiimcf_get_committed_text(XIC_IIIMP(ic, context), &text);
       if (st != IIIMF_STATUS_SUCCESS) return 0;
       st = IIimpConvertToString(text, False, &str);
       if (st != IIIMF_STATUS_SUCCESS) return 0;
       ret = strlen(str);

       if (ret > len) {
           if (status) *status = XBufferOverflow;
           return 0;
       }
       memcpy(buffer, str, ret * sizeof(char));
       free(str);
       if (keysym) {
           if (keysym_return)
              *keysym = keysym_return;
           else
              *keysym = NoSymbol;
       }
       if (status) {
           if (keysym_return)
              *status = XLookupBoth;
           else
              *status = XLookupChars;
       }
       XIC_IIIMP(ic, committed_text_consumed) = True;

       return ret;
    } else { /* Throughed Event */
       (void)memset((void *)&compose_status, 0, sizeof(XComposeStatus));
       ret = _Ximp_LookupMBText((Ximp_XIC)ic, ev,
                             (unsigned char *)buffer,
                             len, keysym, &compose_status);
       if (ret > 0) {
           if (keysym && *keysym != NoSymbol) {
              if (status) *status = XLookupBoth;
           } else {
              if (status) *status = XLookupChars;
           }
       } else {
           if (keysym && *keysym != NoSymbol) {
              if (status) *status = XLookupKeySym;
           } else {
              if (status) *status = XLookupNone;
           }
       }
    }

    return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMP_MbLookupString_SWITCH ( XIC  xic,
XKeyEvent *  ev,
char *  buffer,
int  len,
KeySym keysym,
Status *  status 
)

Definition at line 562 of file iiimpIC.c.

{
    if (XIM_COMPOSE_KEYCODE == ev->keycode) {
       return IIIMP_MbLookupString(xic, ev, buffer, len, keysym, status);
    } else {
       return 0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char * IIIMP_MbReset ( XIC  xic) [static]

Definition at line 448 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)xic;
    IIIMF_status st;
    IIIMCF_text text;
    char *str = NULL;
    int caret, len;

    st = iiimcf_get_preedit_text(XIC_IIIMP(ic, context), &text, &caret);
    if (st == IIIMF_STATUS_SUCCESS) {
        st = iiimcf_get_text_length(text, &len);
        if (st == IIIMF_STATUS_SUCCESS && len > 0) {
          XICCallback *cb = &ic->core.preedit_attr.draw_callback;
          XimCommon im = (XimCommon)ic->core.im;
          Bool useUnicode = (XIM_USE_UNICODE(im) && cb->callback &&
                             (ic->core.input_style & XIMPreeditCallbacks));
          st = IIimpConvertToString(text, useUnicode, &str);
          if (st != IIIMF_STATUS_SUCCESS && str) {
            free(str);
            str = NULL;
          }
        }
    }
    iiimcf_reset_context(XIC_IIIMP(ic, context));
    ic->core.preedit_attr.preedit_state = XIMPreeditDisable;
    ChangePreeditState(ic);
    /* to unmap preedit window */
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_DONE, NULL);

    return str;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void IIIMP_SetFocus ( XIC  xic) [static]

Definition at line 369 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)xic;
    XimCommon im = (XimCommon)ic->core.im;

    if (XIM_IIIMP(im, current_ic) == xic) {
       IIIMP_UnSetFocus(xic);
    }
    XIM_IIIMP(im, current_ic) = xic;

    XIC_GUI(ic, change_lookup)((XIC)ic, LOOKUP_SETFOCUS, NULL);

    IMChangeFocus(ic, 1);

    ic_switcher_set_focus (ic);

    if (im_switcher_active (im))
      {
       IIIMCF_language *lang_list;
       int n_lang;
       char *hotkey;

       lang_list = iiim_get_languages (im, &n_lang);
       ic_switcher_set_language_list (ic, lang_list, n_lang);
       ic_switcher_set_input_language (ic, NULL);

// #ifdef CONFIG_HOTKEY
#if 1
       if ((hotkey = ic_switcher_get_hotkey_with_atom (ic)) == NULL)
         {
           if (hotkey = ic_switcher_get_hotkey (ic))
             ic_switcher_set_hotkey (ic, hotkey);
         }
       else
         {
           char *conversion_keys;

           conversion_keys = ic_switcher_get_hotkey_with_type (hotkey,
                                                        TRIGGER_KEY_LABEL);
           ic_switcher_change_hotkey_with_type (ic,
                                           TRIGGER_KEY_LABEL,
                                           conversion_keys);
           free (conversion_keys);
         }

       if (hotkey) free (hotkey);
#endif
      }

    GetIMSettings (ic);

    if (!XIM_IS_SWITCH(ic->core.im)) {
       _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window,
                            KeyPress, KeyRelease,
                            IIIMP_Local_KeyFilter, (XPointer)ic);
    }
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char * IIIMP_SetICValues ( XIC  xic,
XIMArg arg 
)

Definition at line 526 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)xic;
    XimpChangeMaskRec dummy;
    char *ret = NULL;

    memset(&dummy, 0, sizeof (dummy));

    ret = SetICValueData(ic, arg, SET_IC, &dummy);

    return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void IIIMP_UnSetFocus ( XIC  xic) [static]

Definition at line 431 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)xic;
    XimCommon im = (XimCommon)ic->core.im;

    XIM_IIIMP(im, current_ic) = (XIC)NULL;

    IMChangeFocus(ic, 0);

    _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window,
                     IIIMP_Local_KeyFilter, (XPointer)ic);
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int IIIMP_WcLookupString ( XIC  xic,
XKeyEvent *  ev,
wchar_t *  buffer,
int  len,
KeySym keysym,
Status *  status 
) [static]

Definition at line 670 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)xic;
    XimCommon im = (XimCommon)ic->core.im;
    int ret;
    XComposeStatus compose_status;

    if (ev->keycode == XIM_COMPOSE_KEYCODE) { /* Composed Event */
       IIIMF_status st;
       Status sts;
       IIIMCF_text text;
       char *str;
       int byte_len;
       KeySym keysym_return;

       keysym_return = XIC_IIIMP(ic, keysym_return);

       if (XIC_IIIMP(ic, committed_text_consumed)) return 0;

       st = iiimcf_get_committed_text(XIC_IIIMP(ic, context), &text);
       if (st != IIIMF_STATUS_SUCCESS) return 0;
       st = IIimpConvertToString(text, False, &str);
       if (st != IIIMF_STATUS_SUCCESS) return 0;
       byte_len = strlen(str);

       if ((ret = IIimpMbstoWcs(im, str, byte_len,
                             buffer, len, &sts)) < 0) {
           ret = 0;
           if(status) *status = XLookupNone;
       } else if (sts == XBufferOverflow) {
           *status = XBufferOverflow;
           return ret; /* Immidiately return */
       }
       if (keysym) {
           if (keysym_return)
              *keysym = keysym_return;
           else
              *keysym = NoSymbol;
       }
       if (status) {
           if (keysym_return)
              *status = XLookupBoth;
           else
              *status = XLookupChars;
       }

       XIC_IIIMP(ic, committed_text_consumed) = True;

       return ret;
    } else { /* Throughed Event */
       (void)memset((void *)&compose_status, 0, sizeof(XComposeStatus));
       ret = _Ximp_LookupWCText((Ximp_XIC)ic, ev, buffer,
                             len, keysym, &compose_status);
       if (ret > 0) {
           if (keysym && *keysym != NoSymbol) {
              if (status) *status = XLookupBoth;
           } else {
              if (status) *status = XLookupChars;
           }
       } else {
           if (keysym && *keysym != NoSymbol) {
              if (status) *status = XLookupKeySym;
           } else {
              if (status) *status = XLookupNone;
           }
       }
    }
    return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMP_WcLookupString_SWITCH ( XIC  xic,
XKeyEvent *  ev,
wchar_t *  buffer,
int  len,
KeySym keysym,
Status *  status 
)

Definition at line 653 of file iiimpIC.c.

{
    if (XIM_COMPOSE_KEYCODE == ev->keycode) {
       return IIIMP_WcLookupString(xic, ev, buffer, len, keysym, status);
    } else {
       return 0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static wchar_t * IIIMP_WcReset ( XIC  xic) [static]

Definition at line 483 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)xic;
    IIIMF_status st;
    IIIMCF_text text;
    wchar_t *wc_p = NULL;
    int caret, len;
    Bool useUnicode;

    st = iiimcf_get_preedit_text(XIC_IIIMP(ic, context), &text, &caret);
    if (st == IIIMF_STATUS_SUCCESS) {
      st = iiimcf_get_text_length(text, &len);
      if (st == IIIMF_STATUS_SUCCESS && len > 0) {
        XICCallback *cb = &ic->core.preedit_attr.draw_callback;
        XimCommon im = (XimCommon)ic->core.im;
        char *str = NULL;
        Bool useUnicode = (XIM_USE_UNICODE(im) && cb->callback &&
                           (ic->core.input_style & XIMPreeditCallbacks));
        st = IIimpConvertToString(text, useUnicode, &str);
        if (st == IIIMF_STATUS_SUCCESS) {
          wc_p = (wchar_t *)Xmalloc(sizeof(wchar_t) * len);
          if (!IIimpMbstoWcs((XimCommon)ic->core.im,
                             str, len, wc_p, len, NULL)) {
            if (wc_p) {
              free(wc_p); wc_p = NULL;
            }
          }
        }
        if (str) free(str);
      }
    }
    iiimcf_reset_context(XIC_IIIMP(ic, context));
    ic->core.preedit_attr.preedit_state = XIMPreeditDisable;
    ChangePreeditState(ic);
    /* to unmap preedit window */
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_DONE, NULL);

    return (wchar_t*)wc_p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

IIIMF_status IIimpConvertToString ( IIIMCF_text  text,
Bool  useUnicode,
char **  pstr 
)

Definition at line 594 of file iiimpConv.c.

{
    IIIMF_status st;
    int len;
    const IIIMP_card16 *ucstr;

    st = iiimcf_get_text_length(text, &len); 
    if (st != IIIMF_STATUS_SUCCESS) return st;
    if (len == 0) {
       *pstr = NULL;
       return IIIMF_STATUS_SUCCESS;
    }
    st = iiimcf_get_text_utf16string(text, &ucstr);
    if (st != IIIMF_STATUS_SUCCESS) return st;

    return UTF16ToString(len, ucstr, useUnicode, pstr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPKeyEventFilter ( XicCommon  ic,
Window  old_focus 
)

Definition at line 804 of file iiimpIC.c.

{
    _XUnregisterFilter(ic->core.im->core.display, old_focus,
                     IIIMP_Local_KeyFilter, (XPointer)ic);
    _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window,
                        KeyPress, KeyRelease,
                        IIIMP_Local_KeyFilter, (XPointer)ic);
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 335 of file iiimpIM.c.

{
    char *canonical, *p;
    const char *localename = setlocale(LC_CTYPE, NULL);

    canonical = getIMLangName(im, localename);
    if (canonical) return strdup(canonical);

    canonical = strdup(localename);
    if (!canonical) return NULL;
    p = strchr(canonical, '.');
    if (p) *p = '\0';

    return canonical;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bool IMCheckIMWindow ( XicCommon  ic,
Window  window 
)

Definition at line 871 of file iiimpIC.c.

{
    return (XIM_IS_IIIMP(ic->core.im)
           && XIM_IIIMP(ic->core.im, handle)
           && XFactoryCheckIMWindow(ic->core.im->core.display, window));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bool IMGetICValues ( XicCommon  ic,
XICAttribute ic_attr,
int  attr_count 
)

Definition at line 860 of file iiimpIC.c.

{
    /* nothing to do from X client */
    return True;
}

Here is the caller graph for this function:

Definition at line 768 of file iiimpIC.c.

{
    XICKeyEventListRec *    key_event_list;
    XICKeyEventListRec *    kel;
    int                     key_event_num;

    key_event_list = XIC_IIIMP(ic, key_event_list);
    if (NULL == key_event_list) {
       return;
    }

    key_event_num = XIC_IIIMP(ic, key_event_num);
    if (key_event_num < 0) {
       key_event_num = 0;
    }

    while (NULL != key_event_list) {
       if (XIM_COMPOSE_KEYCODE != key_event_list->key_event.keycode) {
           key_event_num += 1;
       }
       XPutBackEvent(ic->core.im->core.display,
                    (XEvent *)(&key_event_list->key_event));
       kel = key_event_list->next;
       Xfree(key_event_list);
       key_event_list = kel;
    }

    XIC_IIIMP(ic, key_event_list) = NULL;
    XIC_IIIMP(ic, key_event_num) = key_event_num;

    return;
}

Here is the caller graph for this function:

void SetConversionMode ( XicCommon  ic,
int  mode 
)

Definition at line 174 of file iiimpIC.c.

{
    XIC_IIIMP(ic, filtered) = mode;

    ic->core.preedit_attr.preedit_state = ((mode == True) ?
                                      XIMPreeditEnable :
                                      XIMPreeditDisable);
    if ((int)ic->core.preedit_attr.state_notify_callback.callback) {
       XIMPreeditStateNotifyCallbackStruct call_data;
       call_data.state = ic->core.preedit_attr.preedit_state;
       ic->core.preedit_attr.state_notify_callback.callback(
           (XIC)ic,
           ic->core.preedit_attr.state_notify_callback.client_data,
           (XPointer)&call_data
       );
    }
    if (XIM_IS_SWITCH(ic->core.im)) {
       if (mode == False) {        /* CONV_OFF */
           ResetSwitchFilter(ic);
           Ximp_Local_Status_Set(ic);
           Ximp_Local_Status_Draw(ic);
       } else {
           ic->active_filter = IIIMP_Local_KeyFilter;
           ic->active_methods = get_iiimp_ic_methods();
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* SetICValueData ( XicCommon  ic,
XIMArg values,
XICSetMode  mode,
XimpChangeaMask  change_mask 
)

Definition at line 362 of file iiimpICS.c.

                                           {
  XIMArg *p;
  char *return_name = NULL;

  for (p = values; p->name != NULL; p++) {
    TRACE_MESSAGE('v', ("iiimp_SetICValueData: %s\n", p->name));
    if (strcmp(p->name, XNInputStyle) == 0) {
      if (mode == CREATE_IC) {
       /* already set */
       continue;
      } else if (mode == SET_IC) {
       return_name = p->name;
       break; /* Can't change this value */
      }
    } else if (strcmp(p->name, XNClientWindow)==0) {
      /* 4378199: Linux Htt: can not operate after WMDoc client is
                                          closed on VineLinux2.0

        Need to check client_window is valid or not before creating
        status, preedit and lookup
      */
      if(!IMCheckIMWindow(ic, (Window)p->value)) {
        return p->name;
      }
      if (!(ic->ximp_icpart->value_mask & XIMP_CLIENT_WIN)) {
       ic->core.client_window = (Window)p->value;
       ic->ximp_icpart->value_mask |= XIMP_CLIENT_WIN;
       if (!(XIMP_CHK_FOCUSWINMASK(ic))) {
         ic->core.focus_window = ic->core.client_window;
         XIMP_SET_FOCUSWINMASK2(ic, change_mask);
       }
       XIC_GUI(ic, change_status)((XIC)ic, STATUS_CREATE, NULL);
       XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CREATE, NULL);
       XIC_GUI(ic, change_lookup)((XIC)ic, LOOKUP_CREATE, NULL);

       SetScreenNumber(ic);
       FilterConfigureNotify(ic->core.im->core.display,
                           ic->core.focus_window,
                           NULL, (XPointer)ic);
      } else {
#ifdef NO_CLIENTWIN_CHANGE
       return_name = p->name;
       break; /* Can't change this value */
#else
       /* allow to change client window */
       /* destroy status/preedit/lookup */
       XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_DESTROY, NULL);
       XIC_GUI(ic, change_status)((XIC)ic, STATUS_DESTROY, NULL);
       XIC_GUI(ic, change_lookup)((XIC)ic, LOOKUP_DESTROY, NULL);

       ic->core.client_window = (Window)p->value;
       if (!(XIMP_CHK_FOCUSWINMASK(ic))) {
         ic->core.focus_window = ic->core.client_window;
         XIMP_SET_FOCUSWINMASK2(ic, change_mask);
       }

       /* re-create status/preedit/lookup */
       XIC_GUI(ic, change_status)((XIC)ic, STATUS_CREATE, NULL);
       XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CREATE, NULL);
       XIC_GUI(ic, change_lookup)((XIC)ic, LOOKUP_CREATE, NULL);

       SetScreenNumber(ic);
       FilterConfigureNotify(ic->core.im->core.display,
                           ic->core.focus_window,
                           NULL, (XPointer)ic);
#endif
      }
           
    } else if (strcmp(p->name, XNFocusWindow)==0) {
      Window old_focus_window = 0;
      if ((Window)p->value != 0 &&
         (Window)p->value == ic->core.focus_window) {
       continue;
      }
#if 0
      ic->ximp_icpart->back_focus_win = ic->core.focus_window;
#endif
#ifdef linux
      /* 4378199: Linux Htt: can not operate after WMDoc client is
                                          closed on VineLinux2.0

        Need to check focus_window is valid or not before creating
        status, preedit and lookup
      */
      if(!IMCheckIMWindow(ic, (Window)p->value)) {
        return NULL;
      }
#endif

      old_focus_window = ic->core.focus_window;
      ic->core.focus_window = (Window)p->value;
      XIMP_SET_FOCUSWINMASK2(ic, change_mask);
      XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CREATE, NULL);

      SetScreenNumber(ic);
      FilterConfigureNotify(ic->core.im->core.display,
                         ic->core.focus_window,
                         NULL, (XPointer)ic);
      if (XIM_IS_SWITCH(ic->core.im)) {
       SwitchKeyEventFilter(ic, old_focus_window);
      } else if (XIM_IS_IIIMP(ic->core.im)) {
       IIIMPKeyEventFilter(ic, old_focus_window);
      }
    } else if (strcmp(p->name, XNResourceName)==0) {
      ic->core.im->core.res_name = (char *)p->value;
      ic->ximp_icpart->value_mask |= XIMP_RES_NAME;
           
    } else if (strcmp(p->name, XNResourceClass)==0) {
      ic->core.im->core.res_class = (char *)p->value;
      ic->ximp_icpart->value_mask |= XIMP_RES_CLASS;
           
    } else if (strcmp(p->name, XNGeometryCallback)==0) {
      ic->core.geometry_callback.client_data =
       ((XIMCallback *)p->value)->client_data;
      ic->core.geometry_callback.callback =
       ((XIMCallback *)p->value)->callback;
      ic->ximp_icpart->value_mask |= XIMP_GEOMETRY_CB;
           
    } else if (strcmp(p->name, XNUnicodeCharacterSubset)==0) {
      /* select a input charset from the list */
      XIMUnicodeCharacterSubset *new_subset =
       (XIMUnicodeCharacterSubset*)p->value;
      if (!SelectCharacterSubset(ic, new_subset)) {
       break;               /* cannot set this value */
      }
    } else if (strcmp(p->name, XNPreeditAttributes)==0) {
      if (PreeditSetAttributes(ic,
                            &(ic->ximp_icpart->preedit_attr),
                            (XIMArg*)p->value, mode, change_mask,
                            return_name) == False )
       break;
           
    } else if (strcmp(p->name, XNStatusAttributes)==0) {
      if (StatusSetAttributes(ic,
                           &(ic->ximp_icpart->status_attr),
                           (XIMArg*)p->value, mode, change_mask,
                           return_name) == False )
       break;

      SwitchUpdateStatus(ic);

    } else if (strcmp(p->name, XNPreeditState)==0) {
      ic->core.preedit_attr.preedit_state = (XIMPreeditState)p->value;
      ChangePreeditState(ic);
    } else if (strcmp(p->name, XNPreeditStateNotifyCallback)==0) {
      ic->core.preedit_attr.state_notify_callback.client_data =
       ((XIMCallback *)p->value)->client_data;
      ic->core.preedit_attr.state_notify_callback.callback =
       ((XIMCallback *)p->value)->callback;

 /* private XIC extention */
    } else if (strcmp(p->name, XNLookupStartCallback)==0) {
      ic->lookup_start_callback.client_data =
       ((XIMCallback *)p->value)->client_data;
      ic->lookup_start_callback.callback =
       ((XIMCallback *)p->value)->callback;
    } else if (strcmp(p->name, XNLookupDrawCallback)==0) {
      ic->lookup_draw_callback.client_data =
       ((XIMCallback *)p->value)->client_data;
      ic->lookup_draw_callback.callback =
       ((XIMCallback *)p->value)->callback;
    } else if (strcmp(p->name, XNLookupDoneCallback)==0) {
      ic->lookup_done_callback.client_data =
       ((XIMCallback *)p->value)->client_data;
      ic->lookup_done_callback.callback =
       ((XIMCallback *)p->value)->callback;

    } else if (strcmp(p->name, XNSwitchIMNotifyCallback)==0) {
      ic->switchim_notify_callback.client_data =
       ((XIMCallback *)p->value)->client_data;
      ic->switchim_notify_callback.callback =
       ((XIMCallback *)p->value)->callback;
    } else if (strcmp(p->name, XNCommitStringCallback)==0) {
      ic->commit_string_callback.client_data =
       ((XIMCallback *)p->value)->client_data;
      ic->commit_string_callback.callback =
       ((XIMCallback *)p->value)->callback;
    } else if (strcmp(p->name, XNForwardEventCallback)==0) {
      ic->forward_event_callback.client_data =
       ((XIMCallback *)p->value)->client_data;
      ic->forward_event_callback.callback =
       ((XIMCallback *)p->value)->callback;
    } else {
      return_name = p->name;
      break;
    }
  }
  return return_name;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SWITCH_DestroyIC ( XIC  xic) [static]

Definition at line 819 of file iiimpIC.c.

{
    XicCommon ic = (XicCommon)xic;
    XimCommon im = (XimCommon)ic->core.im;

    if (XIM_IS_SWITCH(im)) {
       UnRegisterSwitchFilter(ic, SwitchFilter,
                            IIIMP_Local_KeyFilter,
                            get_iiimp_ic_methods());
    }

    if (XIM_IIIMP(im, current_ic) == xic) {
       IIIMP_UnSetFocus(xic);
    }

    iiimcf_destroy_context(XIC_IIIMP(ic, context));

    ic_switcher_finalize (ic);
    if (XIC_IIIMP(ic, aux)) Xfree(XIC_IIIMP(ic, aux));

    _XUnregisterFilter(ic->core.im->core.display,
                     ic->core.focus_window,
                     IIIMP_Local_KeyFilter, (XPointer)ic);

    if (ic->gui_icpart) {
       XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_DESTROY, NULL);
       XIC_GUI(ic, change_status)((XIC)ic, STATUS_DESTROY, NULL);
       XIC_GUI(ic, change_lookup)((XIC)ic, LOOKUP_DESTROY, NULL);
    }

    if (ic->iiimp_icpart) {
       Xfree (ic->iiimp_icpart);
       ic->iiimp_icpart = 0;
    }

    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static SwitchMode SwitchFilter ( XicCommon  ic,
XEvent *  ev 
) [static]

Definition at line 206 of file iiimpIC.c.

{
  XimCommon im = (XimCommon)ic->core.im;
  if (IsConversionMode(ic)) {
    if (isConversionOffKey(im, ev)) {
      return Switch_OFF;
    }
  } else {
    if (isConversionOnKey(im, ev)) {
      return Switch_ON;
    }
  }
  return Switch_NOP;
}

Here is the call graph for this function:

Here is the caller graph for this function: