Back to index

im-sdk  12.3.91
Functions
guiIMClbk.c File Reference
#include "xiiimp.h"
#include "iiimpIM.h"
#include "guiIM.h"
#include "status.h"
#include "XimpIm.h"
#include <langinfo.h>

Go to the source code of this file.

Functions

int CallPreeditStartCallback (XicCommon ic, XPointer p)
Bool CallPreeditDrawCallback (XicCommon ic, XIMPreeditDrawCallbackStruct *p, IMFeedbackList *feedback_list)
Bool CallPreeditCaretCallback (XicCommon ic, XPointer p)
Bool CallPreeditDoneCallback (XicCommon ic, XPointer p)
Bool CallStatusStartCallback (XicCommon ic, XPointer p)
static char * locale_to_utf8 (char *loc)
Bool CallStatusDrawCallback (XicCommon ic, XIMStatusDrawCallbackStruct *call_data, IMFeedbackList *feedback_list)
Bool CallStatusDoneCallback (XicCommon ic, XPointer p)

Function Documentation

Definition at line 84 of file guiIMClbk.c.

                                                   {
  XIMCallback *cb;
  XIMPreeditCaretCallbackStruct *call_data = (XIMPreeditCaretCallbackStruct*)p;
  cb = &ic->core.preedit_attr.caret_callback;
  if (cb->callback &&
      ic->core.input_style & XIMPreeditCallbacks) {
    (*cb->callback)((XIC)ic, cb->client_data, (XPointer)call_data);
  } else {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CARET, (XPointer)p);
  }
  return True;
}

Definition at line 98 of file guiIMClbk.c.

                                                  {
  XIMCallback *cb;
  cb = &ic->core.preedit_attr.done_callback;
  if (cb->callback &&
      ic->core.input_style & XIMPreeditCallbacks) {
    (*cb->callback)((XIC)ic, cb->client_data, NULL);
    ic->ximp_icpart->cbstatus &= ~XIMPCBPREEDITACTIVE ;
  } else {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_DONE, NULL);
  }
  return True;
}

Here is the caller graph for this function:

Bool CallPreeditDrawCallback ( XicCommon  ic,
XIMPreeditDrawCallbackStruct *  p,
IMFeedbackList feedback_list 
)

Definition at line 66 of file guiIMClbk.c.

                                                    {
  XIMCallback *cb;
  cb = &ic->core.preedit_attr.draw_callback;
  if (cb->callback &&
      ic->core.input_style & XIMPreeditCallbacks) {
    (*cb->callback)((XIC)ic, cb->client_data, (XPointer)p);
  } else {
    XIMDrawTextStruct preedit_draw;
    preedit_draw.call_data = (XPointer)p;
    preedit_draw.feedback_list = feedback_list;
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_DRAW,
                            (XPointer)&preedit_draw);
  }
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 50 of file guiIMClbk.c.

                                                   {
  XIMCallback *cb;
  int max_len = -1;

  cb = &ic->core.preedit_attr.start_callback;
  if (cb->callback &&
      ic->core.input_style & XIMPreeditCallbacks) {
    max_len = (*(int(*)())cb->callback)(ic, cb->client_data, NULL);
    ic->ximp_icpart->cbstatus |= XIMPCBPREEDITACTIVE ;
  } else {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_START, NULL);
  }
  return max_len;
}

Here is the caller graph for this function:

Definition at line 196 of file guiIMClbk.c.

                                                 {
  XIMCallback *cb;
  cb = &ic->core.status_attr.done_callback;
  if (cb->callback && ic->core.input_style & XIMStatusCallbacks &&
      IsIMStatusAttached()) {
    (*cb->callback)((XIC)ic, cb->client_data, NULL);
    ic->ximp_icpart->cbstatus &= ~XIMPCBSTATUSACTIVE ;
  } else {
    XIC_GUI(ic, change_status)((XIC)ic, STATUS_DONE, NULL);
  }
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bool CallStatusDrawCallback ( XicCommon  ic,
XIMStatusDrawCallbackStruct *  call_data,
IMFeedbackList feedback_list 
)

Definition at line 150 of file guiIMClbk.c.

                                                    {
  XIMCallback *cb;
  cb = &ic->core.status_attr.draw_callback;

  if (!IsIMStatusAttached()) {
    if (call_data->type == XIMTextType &&
       !call_data->data.text->encoding_is_wchar) {
      char *utf8 = locale_to_utf8 (call_data->data.text->string.multi_byte);
      ic_switcher_set_status_text (ic, utf8);
      free (utf8);
    } else {
      ic_switcher_set_status_text (ic, " ");
    }
  }
  if (cb->callback && ic->core.input_style & XIMStatusCallbacks) {
    if (!IsIMStatusAttached())
         call_data->data.text = NULL;
    (*cb->callback)((XIC)ic, cb->client_data, (XPointer)call_data);
  } else {
    XIMDrawTextStruct status_draw;

    if (XIM_IS_SWITCH(ic->core.im)) {
      /*
       fix for 4276042:
       status strings is not [English/European] when iiim IM is off
      */
      if (!IsConversionMode(ic)) {
       Ximp_Local_Status_Reset(ic);
       return True;
      }
    }
    status_draw.call_data = (XPointer)call_data->data.text;
    status_draw.feedback_list = feedback_list;
    XIC_GUI(ic, change_status)((XIC)ic, STATUS_DRAW,
                            (XPointer)&status_draw);
  }

  /* move preedit window */
  if (ic->core.input_style & XIMPreeditNothing) {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_WIN, NULL);
  }
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 112 of file guiIMClbk.c.

                                                  {
  XIMCallback *cb;
  cb = &ic->core.status_attr.start_callback;
  if (cb->callback && ic->core.input_style & XIMStatusCallbacks &&
      IsIMStatusAttached()) {
    (*cb->callback)((XIC)ic, cb->client_data, NULL);
    ic->ximp_icpart->cbstatus |= XIMPCBSTATUSACTIVE ;
  } else {
    XIC_GUI(ic, change_status)((XIC)ic, STATUS_START, (XPointer)p);
  }
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* locale_to_utf8 ( char *  loc) [static]

Definition at line 126 of file guiIMClbk.c.

{
  char *encoding = nl_langinfo(CODESET);

  if (loc == NULL)
    return strdup (" ");

  if (!strcmp(encoding, "UTF-8"))
    return strdup(loc);
  else {
    size_t utf8_len = 64;   /* enough */
    char buffer[64], *pbuffer;
    memset(&buffer, 0, 64);
    pbuffer = buffer;
    if (IMConvertToUTF8(loc, strlen(loc),
                     (char**)&pbuffer, &utf8_len) != -1)
      buffer[64 - utf8_len] = 0;
    else
      strcpy (buffer, " ");
    return strdup(buffer);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function: