Back to index

im-sdk  12.3.91
Defines | Functions | Variables
i18nMethod.c File Reference
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xproto.h>
#include "FrameMgr.h"
#include "Xi18n.h"
#include "XIC_Interface.h"

Go to the source code of this file.

Defines

#define NEED_EVENTS

Functions

Xi18nClient_Xi18nFindClient (Xi18n, CARD16)
static void * xi18n_setup (Display *, XIMArg *)
static Status xi18n_openIM (XIMS)
static Status xi18n_closeIM (XIMS)
static char * xi18n_setIMValues (XIMS, XIMArg *)
static char * xi18n_getIMValues (XIMS, XIMArg *)
static Status xi18n_forwardEvent (XIMS, IMForwardEventStruct *)
static Status xi18n_commit (XIMS, IMCommitEventStruct *)
static Status xi18n_callCallback (XIMS, X11R6IMProtocol)
static Status xi18n_preeditStart (XIMS, X11R6IMProtocol)
static Status xi18n_preeditEnd (XIMS, X11R6IMProtocol)
Bool _Xi18nCheckXAddress (Xi18n, TransportSW *, char *)
Bool _Xi18nCheckTransAddress (Xi18n, TransportSW *, char *)
void _Xi18nChangeIMList (Xi18n i18n_core, XPointer value)
void _Xi18nChangeICList (Xi18n i18n_core, XPointer value)
void _Xi18nInitAttrList (Xi18n i18n_core)
void _Xi18nInitExtension (Xi18n i18n_core)
int _Xi18nNeedSwap (Xi18n i18n_core, CARD16 connect_id)
void _Xi18nSendMessage (XIMS ims, CARD16 connect_id, CARD8 major_opcode, CARD8 minor_opcode, unsigned char *data, long length)
int _Xi18nGeometryCallback (XIMS ims, X11R6IMProtocol call_data)
int _Xi18nPreeditStartCallback (XIMS ims, X11R6IMProtocol call_data)
int _Xi18nPreeditDrawCallback (XIMS ims, X11R6IMProtocol call_data)
int _Xi18nPreeditCaretCallback (XIMS ims, X11R6IMProtocol call_data)
int _Xi18nPreeditDoneCallback (XIMS ims, X11R6IMProtocol call_data)
int _Xi18nStatusStartCallback (XIMS ims, X11R6IMProtocol call_data)
int _Xi18nStatusDrawCallback (XIMS ims, X11R6IMProtocol call_data)
int _Xi18nStatusDoneCallback (XIMS ims, X11R6IMProtocol call_data)
int _Xi18nStringConversionCallback (XIMS ims, X11R6IMProtocol call_data)
void _Xi18nSetEventMask (XIMS ims, CARD16 connect_id, CARD16 im_id, CARD16 ic_id, CARD32 forward_mask, CARD32 sync_mask)
static Bool GetInputStyles (Xi18n i18n_core, XIMStyles **p_style)
static Bool GetOnOffKeys (Xi18n i18n_core, long mask, XIMTriggerKeys **p_key)
static Bool GetEncodings (Xi18n i18n_core, XIMEncodings **p_encoding)
static char * ParseArgs (Xi18n i18n_core, int mode, XIMArg *args)
static int CheckIMName (Xi18n i18n_core)
static int SetXi18nSelectionOwner (Xi18n i18n_core)
static void ReturnSelectionNotify (Xi18n i18n_core, XSelectionRequestEvent *ev)
static Bool WaitXSelectionRequest (Display *dpy, Window win, XEvent *ev, XPointer client_data)
static void EventToWireEvent (XEvent *ev, xEvent *event, CARD16 *serial)

Variables

IMMethodsRec Xi18n_im_methods
TransportSW _TransR []

Define Documentation

#define NEED_EVENTS

Definition at line 32 of file i18nMethod.c.


Function Documentation

void _Xi18nChangeICList ( Xi18n  i18n_core,
XPointer  value 
)

Definition at line 170 of file i18nAttr.c.

{
    XIMAttr *args;
    int       total_count;

    /* init ICAttr list */
    if (i18n_core->address.xic_attr)
       XFree((char *)i18n_core->address.xic_attr);
    args = CreateAttrList(i18n_core, (XIMListOfAttr*)value, &total_count);

    i18n_core->address.ic_attr_num = total_count;
    i18n_core->address.xic_attr = (XICAttr *)args;

    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _Xi18nChangeIMList ( Xi18n  i18n_core,
XPointer  value 
)

Definition at line 153 of file i18nAttr.c.

{
    XIMAttr *args;
    int       total_count;

    /* init IMAttr list */
    if (i18n_core->address.xim_attr)
       XFree((char *)i18n_core->address.xim_attr);
    args = CreateAttrList(i18n_core, (XIMListOfAttr*)value, &total_count);

    i18n_core->address.im_attr_num = total_count;
    i18n_core->address.xim_attr = (XIMAttr *)args;

    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bool _Xi18nCheckTransAddress ( Xi18n  ,
TransportSW ,
char *   
)
Bool _Xi18nCheckXAddress ( Xi18n  ,
TransportSW ,
char *   
)

Definition at line 348 of file i18nX.c.

{
    XSpecRec *spec;

    if(!(spec = (XSpecRec *)malloc(sizeof(XSpecRec))))
      return False ;

    i18n_core->address.connect_addr = (XSpecRec *)spec;
    i18n_core->methods.begin = Xi18nXBegin;
    i18n_core->methods.end  = Xi18nXEnd;
    i18n_core->methods.send = Xi18nXSend;
    i18n_core->methods.wait = Xi18nXWait;
    i18n_core->methods.disconnect = Xi18nXDisconnect;
    return True;
}

Here is the call graph for this function:

Xi18nClient * _Xi18nFindClient ( Xi18n  i18n_core,
CARD16  connect_id 
)

Definition at line 70 of file i18nUtil.c.

{
    Xi18nClient *client = i18n_core->address.clients;

    while (client != NULL) {
       if (client->connect_id == connect_id)
         return client;
       client = client->next;
    }
    return NULL;
}

Here is the caller graph for this function:

int _Xi18nGeometryCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
)

Definition at line 40 of file i18nClbk.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec geometry_fr[];
    int total_size;
    unsigned char *reply = NULL;
    IMGeometryCBStruct *geometry_CB =
      (IMGeometryCBStruct*)&call_data->geometry_callback;
    CARD16 connect_id = call_data->any.connect_id;

    /* create FrameMgr */
    fm = FrameMgrInit(geometry_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));

    total_size = FrameMgrGetTotalSize(fm);
    reply = (unsigned char *)malloc(total_size);
    if (!reply) {
       _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
       return False;
    }
    memset(reply, 0, total_size);
    FrameMgrSetBuffer(fm, reply);

    FrameMgrPutToken(fm, connect_id);
    FrameMgrPutToken(fm, geometry_CB->icid);

    _Xi18nSendMessage(ims, connect_id,
                    XIM_GEOMETRY, 0, reply, total_size);
    /* free FrameMgr */
    FrameMgrFree(fm);
    XFree(reply);

    /* XIM_GEOMETRY is an asyncronous protocol,
       so return immediately. */
    return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _Xi18nInitAttrList ( Xi18n  i18n_core)

Definition at line 111 of file i18nAttr.c.

{
    XIMAttr *args;
    int       total_count;

    /* init IMAttr list */
    if (i18n_core->address.xim_attr)
      XFree((char *)i18n_core->address.xim_attr);
    args = CreateAttrList(i18n_core, Default_IMattr, &total_count);

    i18n_core->address.im_attr_num = total_count;
    i18n_core->address.xim_attr = (XIMAttr *)args;

    /* init ICAttr list */
    if (i18n_core->address.xic_attr)
      XFree((char *)i18n_core->address.xic_attr);
    args = CreateAttrList(i18n_core, Default_ICattr, &total_count);

    i18n_core->address.ic_attr_num = total_count;
    i18n_core->address.xic_attr = (XICAttr *)args;

    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _Xi18nInitExtension ( Xi18n  i18n_core)

Definition at line 136 of file i18nAttr.c.

{
    register int i;
    IMExtList *extensions = (IMExtList*)Default_Extension;
    XIMExt *ext_list = (XIMExt*)i18n_core->address.extension;
    
    for (i = 0; extensions->name != NULL; i++, ext_list++, extensions++) {
       ext_list->major_opcode = extensions->major_opcode;
       ext_list->minor_opcode = extensions->minor_opcode;
       ext_list->name = extensions->name;
       ext_list->length = strlen(ext_list->name);
    }
    i18n_core->address.ext_num = i;
    return;
}

Here is the caller graph for this function:

int _Xi18nNeedSwap ( Xi18n  i18n_core,
CARD16  connect_id 
)

Definition at line 37 of file i18nUtil.c.

{
    CARD8 im_byteOrder = i18n_core->address.im_byteOrder;
    Xi18nClient *client = _Xi18nFindClient(i18n_core, connect_id);
    
    return (client->byte_order != im_byteOrder);
}
int _Xi18nPreeditCaretCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
)

Definition at line 193 of file i18nClbk.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec preedit_caret_fr[];
    int total_size;
    unsigned char *reply = NULL;
    IMPreeditCBStruct *preedit_CB =
      (IMPreeditCBStruct*)&call_data->preedit_callback;
    XIMPreeditCaretCallbackStruct *caret =
      (XIMPreeditCaretCallbackStruct *)&preedit_CB->todo.caret;
    CARD16 connect_id = call_data->any.connect_id;

    /* create FrameMgr */
    fm = FrameMgrInit(preedit_caret_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));

    total_size = FrameMgrGetTotalSize(fm);
    reply = (unsigned char *)malloc(total_size);
    if (!reply) {
       _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
       return False;
    }
    memset(reply, 0, total_size);
    FrameMgrSetBuffer(fm, reply);

    FrameMgrPutToken(fm, connect_id);
    FrameMgrPutToken(fm, preedit_CB->icid);
    FrameMgrPutToken(fm, caret->position);
    FrameMgrPutToken(fm, caret->direction);
    FrameMgrPutToken(fm, caret->style);

    _Xi18nSendMessage(ims, connect_id,
                    XIM_PREEDIT_CARET, 0, reply, total_size);
    /* free FrameMgr */
    FrameMgrFree(fm);
    XFree(reply);

    return True;
}
int _Xi18nPreeditDoneCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
)

Definition at line 235 of file i18nClbk.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec preedit_done_fr[];
    int total_size;
    unsigned char *reply = NULL;
    IMPreeditCBStruct *preedit_CB =
      (IMPreeditCBStruct*)&call_data->preedit_callback;
    CARD16 connect_id = call_data->any.connect_id;

    /* create FrameMgr */
    fm = FrameMgrInit(preedit_done_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));

    total_size = FrameMgrGetTotalSize(fm);
    reply = (unsigned char *)malloc(total_size);
    if (!reply) {
       _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
       return False;
    }
    memset(reply, 0, total_size);
    FrameMgrSetBuffer(fm, reply);

    FrameMgrPutToken(fm, connect_id);
    FrameMgrPutToken(fm, preedit_CB->icid);

    _Xi18nSendMessage(ims, connect_id,
                    XIM_PREEDIT_DONE, 0, reply, total_size);
    /* free FrameMgr */
    FrameMgrFree(fm);
    XFree(reply);

    /* XIM_PREEDIT_DONE is an asyncronous protocol,
       so return immediately. */
    return True;
}
int _Xi18nPreeditDrawCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
)

Definition at line 115 of file i18nClbk.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec preedit_draw_fr[];
    int total_size;
    unsigned char *reply = NULL;
    IMPreeditCBStruct *preedit_CB =
      (IMPreeditCBStruct*)&call_data->preedit_callback;
    XIMPreeditDrawCallbackStruct *draw =
      (XIMPreeditDrawCallbackStruct *)&preedit_CB->todo.draw;
    CARD16 connect_id = call_data->any.connect_id;
    int feedback_count, i;
    BITMASK32 status = 0x0;
    CARD16 str_length;

    if (draw->text == 0 || draw->text->length == 0) {
      status = 0x00000001;  /* no text */
      feedback_count = 0;
    } else if (draw->text->feedback[0] == 0) {
      status = 0x00000002;  /* no feedback */
      feedback_count = 0;
    } else {
      /* set iteration count for list of feedback */
      for (i = 0;
          i < draw->text->length && draw->text->feedback[i] != 0;
          i++)
       ;
      feedback_count = i;
    }
    /* create FrameMgr */
    fm = FrameMgrInit(preedit_draw_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));

    /* set length of preedit string */
    if (draw->text) {
      str_length = strlen(draw->text->string.multi_byte);
    } else {
      str_length = 0;
    }
    FrameMgrSetSize(fm, str_length);

    FrameMgrSetIterCount(fm, feedback_count);

    total_size = FrameMgrGetTotalSize(fm);
    reply = (unsigned char *)malloc(total_size);
    if (!reply) {
       _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
       return False;
    }
    memset(reply, 0, total_size);
    FrameMgrSetBuffer(fm, reply);

    FrameMgrPutToken(fm, connect_id);
    FrameMgrPutToken(fm, preedit_CB->icid);
    FrameMgrPutToken(fm, draw->caret);
    FrameMgrPutToken(fm, draw->chg_first);
    FrameMgrPutToken(fm, draw->chg_length);
    FrameMgrPutToken(fm, status);
    FrameMgrPutToken(fm, str_length);
    if (draw->text) {
      FrameMgrPutToken(fm, draw->text->string.multi_byte);
      for (i = 0; i < feedback_count; i++) {
       FrameMgrPutToken(fm, draw->text->feedback[i]);
      }
    }
    _Xi18nSendMessage(ims, connect_id,
                    XIM_PREEDIT_DRAW, 0, reply, total_size);
    /* free FrameMgr */
    FrameMgrFree(fm);
    XFree(reply);

    /* XIM_PREEDIT_DRAW is an asyncronous protocol,
       so return immediately. */
    return True;
}
int _Xi18nPreeditStartCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
)

Definition at line 79 of file i18nClbk.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec preedit_start_fr[];
    int total_size;
    unsigned char *reply = NULL;
    IMPreeditCBStruct *preedit_CB =
      (IMPreeditCBStruct*)&call_data->preedit_callback;
    CARD16 connect_id = call_data->any.connect_id;

    /* create FrameMgr */
    fm = FrameMgrInit(preedit_start_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));
    total_size = FrameMgrGetTotalSize(fm);
    reply = (unsigned char *)malloc(total_size);
    if (!reply) {
       _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
       return False;
    }
    memset(reply, 0, total_size);
    FrameMgrSetBuffer(fm, reply);

    FrameMgrPutToken(fm, connect_id);
    FrameMgrPutToken(fm, preedit_CB->icid);

    _Xi18nSendMessage(ims, connect_id,
                    XIM_PREEDIT_START, 0, reply, total_size);
    /* free FrameMgr */
    FrameMgrFree(fm);
    XFree(reply);

    return True;
}
void _Xi18nSendMessage ( XIMS  ims,
CARD16  connect_id,
CARD8  major_opcode,
CARD8  minor_opcode,
unsigned char *  data,
long  length 
)

Definition at line 107 of file i18nUtil.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec packet_header_fr[];
    unsigned char *reply_hdr = NULL;
    int header_size;
    unsigned char *reply = NULL;
    unsigned char *replyp;
    int reply_length;
    long p_len = length/4;

    /* create FrameMgr */
    fm = FrameMgrInit(packet_header_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));

    header_size = FrameMgrGetTotalSize(fm);
    reply_hdr = (unsigned char *)malloc(header_size);
    if (!reply_hdr) {
       _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
       return;
    }
    FrameMgrSetBuffer(fm, reply_hdr);

    /* put data */
    FrameMgrPutToken(fm, major_opcode);
    FrameMgrPutToken(fm, minor_opcode);
    FrameMgrPutToken(fm, p_len);

    reply_length = header_size + length;
    reply = (unsigned char *)malloc(reply_length);
    replyp = reply;
    memmove(reply, reply_hdr, header_size);
    replyp += header_size;
    memmove(replyp, data, length);

    i18n_core->methods.send(ims, connect_id, reply, reply_length);

    XFree(reply_hdr);
    XFree(reply);
    /* free FrameMgr */
    FrameMgrFree(fm);

    return;
}
void _Xi18nSetEventMask ( XIMS  ims,
CARD16  connect_id,
CARD16  im_id,
CARD16  ic_id,
CARD32  forward_mask,
CARD32  sync_mask 
)

Definition at line 219 of file i18nUtil.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec set_event_mask_fr[];
    unsigned char *reply = NULL;
    register int total_size;

    /* create FrameMgr */
    fm = FrameMgrInit(set_event_mask_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));

    total_size = FrameMgrGetTotalSize(fm);
    reply = (unsigned char *)malloc(total_size);
    if (!reply) {
       return;
    }
    memset(reply, 0, total_size);
    FrameMgrSetBuffer(fm, reply);

    FrameMgrPutToken(fm, im_id);   /* input-method-id */
    FrameMgrPutToken(fm, ic_id);   /* input-context-id */
    FrameMgrPutToken(fm, forward_mask);
    FrameMgrPutToken(fm, sync_mask);

    _Xi18nSendMessage(ims, connect_id,
                    XIM_SET_EVENT_MASK, 0, reply, total_size);

    XFree(reply);
    /* free FrameMgr */
    FrameMgrFree(fm);

    return;
}

Here is the call graph for this function:

int _Xi18nStatusDoneCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
)

Definition at line 423 of file i18nClbk.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec status_done_fr[];
    int total_size;
    unsigned char *reply = NULL;
    IMStatusCBStruct *status_CB =
      (IMStatusCBStruct*)&call_data->status_callback;
    CARD16 connect_id = call_data->any.connect_id;

#ifdef  FIX_APPLIXWARE_TURBOLINUX42
       if(getenv("HTT_DISABLE_STATUS_CALLBACK")){
              return True;
       }
#endif

    /* create FrameMgr */
    fm = FrameMgrInit(status_done_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));

    total_size = FrameMgrGetTotalSize(fm);
    reply = (unsigned char *)malloc(total_size);
    if (!reply) {
       _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
       return False;
    }
    memset(reply, 0, total_size);
    FrameMgrSetBuffer(fm, reply);

    FrameMgrPutToken(fm, connect_id);
    FrameMgrPutToken(fm, status_CB->icid);

    _Xi18nSendMessage(ims, connect_id,
                    XIM_STATUS_DONE, 0, reply, total_size);
    /* free FrameMgr */
    FrameMgrFree(fm);
    XFree(reply);

    /* XIM_STATUS_DONE is an asyncronous protocol,
       so return immediately. */
    return True;
}
int _Xi18nStatusDrawCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
)

Definition at line 318 of file i18nClbk.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm = NULL;
    extern XimFrameRec status_draw_text_fr[], status_draw_bitmap_fr[];
    int total_size = 0;
    unsigned char *reply = NULL;
    IMStatusCBStruct *status_CB =
      (IMStatusCBStruct*)&call_data->status_callback;
    XIMStatusDrawCallbackStruct *draw =
      (XIMStatusDrawCallbackStruct *)&status_CB->todo.draw;
    CARD16 connect_id = call_data->any.connect_id;
    int feedback_count, i;
    BITMASK32 status = 0x0;
    CARD16 str_length;

#ifdef  FIX_APPLIXWARE_TURBOLINUX42
       if(getenv("HTT_DISABLE_STATUS_CALLBACK")){
              return True;
       }
#endif

    switch (draw->type) {
      case XIMTextType:
       /* create FrameMgr */
       fm = FrameMgrInit(status_draw_text_fr, NULL,
                       _Xi18nNeedSwap(i18n_core, connect_id));

       if (draw->data.text == 0 || draw->data.text->length == 0) {
         status = 0x00000001;      /* no text */
         feedback_count = 0;
       } else if (draw->data.text->feedback[0] == 0) {
         status = 0x00000002;      /* no feedback */
         feedback_count = 0;
       } else {
         /* set iteration count for list of feedback */
         for (i = 0;
              i < draw->data.text->length && draw->data.text->feedback[i] != 0;
              i++)
           ;
         feedback_count = i;
       }

       /* set length of status string */
       if (draw->data.text) {
         str_length = strlen(draw->data.text->string.multi_byte);
       } else {
         str_length = 0;
       }
       FrameMgrSetSize(fm, str_length);

       FrameMgrSetIterCount(fm, feedback_count);

       total_size = FrameMgrGetTotalSize(fm);
       reply = (unsigned char *)malloc(total_size);
       if (!reply) {
           _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
           return False;
       }
       memset(reply, 0, total_size);
       FrameMgrSetBuffer(fm, reply);

       FrameMgrPutToken(fm, connect_id);
       FrameMgrPutToken(fm, status_CB->icid);
       FrameMgrPutToken(fm, draw->type);
       FrameMgrPutToken(fm, status);
       FrameMgrPutToken(fm, str_length);
       if (draw->data.text) {
         FrameMgrPutToken(fm, draw->data.text->string.multi_byte);
         for (i = 0; i < feedback_count; i++) {
           FrameMgrPutToken(fm, draw->data.text->feedback[i]);
         }
       }
       break;
      case XIMBitmapType:
       /* create FrameMgr */
       fm = FrameMgrInit(status_draw_bitmap_fr, NULL,
                       _Xi18nNeedSwap(i18n_core, connect_id));

       total_size = FrameMgrGetTotalSize(fm);
       reply = (unsigned char *)malloc(total_size);
       if (!reply) {
           _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
           return False;
       }
       memset(reply, 0, total_size);
       FrameMgrSetBuffer(fm, reply);

       FrameMgrPutToken(fm, connect_id);
       FrameMgrPutToken(fm, status_CB->icid);
       FrameMgrPutToken(fm, draw->data.bitmap);
       break;
    }
    _Xi18nSendMessage(ims, connect_id,
                    XIM_STATUS_DRAW, 0, reply, total_size);
    /* free FrameMgr */
    FrameMgrFree(fm);
    XFree(reply);

    /* XIM_STATUS_DRAW is an asyncronous protocol,
       so return immediately. */
    return True;
}
int _Xi18nStatusStartCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
)

Definition at line 274 of file i18nClbk.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec status_start_fr[];
    int total_size;
    unsigned char *reply = NULL;
    IMStatusCBStruct *status_CB =
      (IMStatusCBStruct*)&call_data->status_callback;
    CARD16 connect_id = call_data->any.connect_id;

#ifdef  FIX_APPLIXWARE_TURBOLINUX42
       if(getenv("HTT_DISABLE_STATUS_CALLBACK")){
              return True;
       }
#endif

    /* create FrameMgr */
    fm = FrameMgrInit(status_start_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));
    total_size = FrameMgrGetTotalSize(fm);
    reply = (unsigned char *)malloc(total_size);
    if (!reply) {
       _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
       return False;
    }
    memset(reply, 0, total_size);
    FrameMgrSetBuffer(fm, reply);

    FrameMgrPutToken(fm, connect_id);
    FrameMgrPutToken(fm, status_CB->icid);

    _Xi18nSendMessage(ims, connect_id,
                    XIM_STATUS_START, 0, reply, total_size);
    /* free FrameMgr */
    FrameMgrFree(fm);
    XFree(reply);

    /* XIM_STATUS_START is an asyncronous protocol,
       so return immediately. */
    return True;
}
int _Xi18nStringConversionCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
)

Definition at line 468 of file i18nClbk.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec str_conversion_fr[];
    int total_size;
    unsigned char *reply = NULL;
    IMStrConvCBStruct *call_back =
      (IMStrConvCBStruct*)&call_data->strconv_callback;
    XIMStringConversionCallbackStruct *strconv =
      (XIMStringConversionCallbackStruct *)&call_back->strconv;
    CARD16 connect_id = call_data->any.connect_id;

    /* create FrameMgr */
    fm = FrameMgrInit(str_conversion_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, connect_id));
    total_size = FrameMgrGetTotalSize(fm);
    reply = (unsigned char *)malloc(total_size);
    if (!reply) {
       _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
       return False;
    }
    memset(reply, 0, total_size);
    FrameMgrSetBuffer(fm, reply);

    FrameMgrPutToken(fm, connect_id);
    FrameMgrPutToken(fm, call_back->icid);
    FrameMgrPutToken(fm, strconv->position);
    FrameMgrPutToken(fm, strconv->factor);
    FrameMgrPutToken(fm, strconv->direction);
    FrameMgrPutToken(fm, strconv->operation);
    _Xi18nSendMessage(ims, connect_id,
                    XIM_STR_CONVERSION, 0, reply, total_size);
    /* free FrameMgr */
    FrameMgrFree(fm);
    XFree(reply);

    /* XIM_STR_CONVERSION is a syncronous protocol,
       so should wait here for XIM_STR_CONVERSION_REPLY. */
    if (i18n_core->methods.wait(ims, connect_id,
                            XIM_STR_CONVERSION_REPLY, 0) == False)
      return False;
    return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int CheckIMName ( Xi18n  i18n_core) [static]

Definition at line 405 of file i18nMethod.c.

{
    char *address = i18n_core->address.im_addr;
    int i;

    for (i = 0; _TransR[i].transportname; i++) {
       while (*address == ' ' || *address == '\t') address++;
       if (!strncmp(address, _TransR[i].transportname,
                   _TransR[i].namelen)
           && address[_TransR[i].namelen] == '/') {
           if (_TransR[i].checkAddr(i18n_core, &_TransR[i],
                          address+_TransR[i].namelen + 1) == True) {
              return True;
           } else {
              return False;
           }
       }
    }
    return False;
}

Here is the caller graph for this function:

static void EventToWireEvent ( XEvent *  ev,
xEvent *  event,
CARD16 serial 
) [static]

Definition at line 651 of file i18nMethod.c.

{
    *serial = (CARD16)(ev->xany.serial >> 16);
    event->u.u.sequenceNumber = (CARD16)(ev->xany.serial & (unsigned long)0xffff);

    switch (ev->type) {
      case KeyPress:
      case KeyRelease:
       {
           XKeyEvent *kev = (XKeyEvent*)ev;

           event->u.u.type = ev->type;
           event->u.keyButtonPointer.root = kev->root;
           event->u.keyButtonPointer.state = kev->state;
           event->u.keyButtonPointer.time = kev->time;
           event->u.keyButtonPointer.event = kev->window;
           event->u.keyButtonPointer.child = kev->subwindow;
           event->u.keyButtonPointer.eventX = kev->x;
           event->u.keyButtonPointer.eventY = kev->y;
           event->u.keyButtonPointer.rootX = kev->x_root;
           event->u.keyButtonPointer.rootY = kev->y_root;
           event->u.keyButtonPointer.sameScreen = kev->same_screen;
           event->u.u.detail = kev->keycode;
       }
    }
}

Here is the caller graph for this function:

static Bool GetEncodings ( Xi18n  i18n_core,
XIMEncodings **  p_encoding 
) [static]

Definition at line 145 of file i18nMethod.c.

{
    Xi18nAddressRec  *address = (Xi18nAddressRec *)&i18n_core->address;
    XIMEncodings     *p;
    int                     i;

    p = &address->encoding_list;

    if ((*p_encoding = (XIMEncodings *)malloc(sizeof(XIMEncodings)
              + p->count_encodings * sizeof(XIMEncoding))) == NULL)
      return False;
    (*p_encoding)->count_encodings = p->count_encodings;
    (*p_encoding)->supported_encodings = (XIMEncoding *)((XPointer)*p_encoding + sizeof(XIMEncodings));
    for (i = 0; i < (int)p->count_encodings; i++) {
       (*p_encoding)->supported_encodings[i]
         = (char *)malloc(strlen(p->supported_encodings[i]) + 1);
       strcpy((*p_encoding)->supported_encodings[i],
              p->supported_encodings[i]);
    }
    return True;
}

Here is the caller graph for this function:

static Bool GetInputStyles ( Xi18n  i18n_core,
XIMStyles **  p_style 
) [static]

Definition at line 101 of file i18nMethod.c.

{
    Xi18nAddressRec  *address = (Xi18nAddressRec *)&i18n_core->address;
    XIMStyles        *p;
    int                     i;

    p = &address->input_styles;
    if ((*p_style = (XIMStyles *)malloc(sizeof(XIMStyles)
              + p->count_styles * sizeof(XIMStyle))) == NULL)
      return False;
    (*p_style)->count_styles = p->count_styles;
    (*p_style)->supported_styles = (XIMStyle *)((XPointer)*p_style + sizeof(XIMStyles));
    for (i = 0; i < (int)p->count_styles; i++) {
       (*p_style)->supported_styles[i] = p->supported_styles[i];
    }
    return True;
}

Here is the caller graph for this function:

static Bool GetOnOffKeys ( Xi18n  i18n_core,
long  mask,
XIMTriggerKeys **  p_key 
) [static]

Definition at line 120 of file i18nMethod.c.

{
    Xi18nAddressRec  *address = (Xi18nAddressRec *)&i18n_core->address;
    XIMTriggerKeys   *p;
    int                     i;

    if (mask & I18N_ON_KEYS)
      p = &address->on_keys;
    else
      p = &address->off_keys;

    if ((*p_key = (XIMTriggerKeys *)malloc(sizeof(XIMTriggerKeys)
              + p->count_keys * sizeof(XIMTriggerKey))) == NULL)
      return False;
    (*p_key)->count_keys = p->count_keys;
    (*p_key)->keylist = (XIMTriggerKey *)((XPointer)*p_key + sizeof(XIMTriggerKeys));
    for (i = 0; i < (int)p->count_keys; i++) {
       (*p_key)->keylist[i].keysym = p->keylist[i].keysym;
       (*p_key)->keylist[i].modifier = p->keylist[i].modifier;
       (*p_key)->keylist[i].modifier_mask = p->keylist[i].modifier_mask;
    }
    return True;
}

Here is the caller graph for this function:

static char* ParseArgs ( Xi18n  i18n_core,
int  mode,
XIMArg args 
) [static]

Definition at line 168 of file i18nMethod.c.

{
    Xi18nAddressRec *address = (Xi18nAddressRec *)&i18n_core->address;
    XIMArg *p;
    
    if (mode == I18N_OPEN || mode == I18N_SET) {
       for (p = args; p->name != NULL; p++) {
           if (!strcmp(p->name, IMLocale)) {
              if (address->imvalue_mask & I18N_IM_LOCALE) {
                  return IMLocale;
              }
              address->im_locale = (char *)malloc(strlen(p->value) + 1);
              if (!address->im_locale)
                return IMLocale;
              strcpy(address->im_locale, p->value);
              address->imvalue_mask |= I18N_IM_LOCALE;
           }
           else if (!strcmp(p->name, IMSupportedIMValues)) {
              _Xi18nChangeIMList(i18n_core, p->value);
           }
           else if (!strcmp(p->name, IMSupportedICValues)) {
              _Xi18nChangeICList(i18n_core, p->value);
           }
           else if (!strcmp(p->name, IMServerTransport)) {
              if (address->imvalue_mask & I18N_IM_ADDRESS) {
                  return IMServerTransport;
              }
              address->im_addr = (char *)malloc(strlen(p->value) + 1);
              if (!address->im_addr)
                return IMServerTransport;
              strcpy(address->im_addr, p->value);
              address->imvalue_mask |= I18N_IM_ADDRESS;
           }
           else if (!strcmp(p->name, IMServerName)) {
              if (address->imvalue_mask & I18N_IM_NAME) {
                  return IMServerName;
              }
              address->im_name = (char *)malloc(strlen(p->value) + 1);
              if (!address->im_name)
                return IMServerName;
              strcpy(address->im_name, p->value);
              address->imvalue_mask |= I18N_IM_NAME;
           }
           else if (!strcmp(p->name, IMServerWindow)) {
              if (address->imvalue_mask & I18N_IMSERVER_WIN) {
                  return IMServerWindow;
              }
              address->im_window = (Window)p->value;
              address->imvalue_mask |= I18N_IMSERVER_WIN;
           }
           else if (!strcmp(p->name, IMInputStyles)) {
              if (address->imvalue_mask & I18N_INPUT_STYLES) {
                  return IMInputStyles;
              }
              address->input_styles.count_styles =
                ((XIMStyles*)p->value)->count_styles;
              address->input_styles.supported_styles =
                (XIMStyle*)malloc(sizeof(XIMStyle)
                                * address->input_styles.count_styles);
              if (address->input_styles.supported_styles == (XIMStyle*)NULL)
                return IMInputStyles;
              memmove(address->input_styles.supported_styles,
                     ((XIMStyles*)p->value)->supported_styles,
                     sizeof(XIMStyle) *
                        address->input_styles.count_styles);
              address->imvalue_mask |= I18N_INPUT_STYLES;
           }
           else if (!strcmp(p->name, IMProtocolHandler)) {
#if IM_PROTO_HANDLER
              address->improto = (X11R6IMProtoHandler*)p->value;
              address->imvalue_mask |= I18N_IM_HANDLER;
#endif
           }
           else if (!strcmp(p->name, IMOnKeysList)) {
              if (address->imvalue_mask & I18N_ON_KEYS) {
                  return IMOnKeysList;
              }
              address->on_keys.count_keys =
                ((XIMTriggerKeys*)p->value)->count_keys;
              if (address->on_keys.count_keys > 0) {
                address->on_keys.keylist =
                  (XIMTriggerKey*)malloc(sizeof(XIMTriggerKey)
                                      * address->on_keys.count_keys);
                if (address->on_keys.keylist == (XIMTriggerKey*)NULL)
                  return IMOnKeysList;
                memmove(address->on_keys.keylist,
                       ((XIMTriggerKeys*)p->value)->keylist,
                       sizeof(XIMTriggerKey) * address->on_keys.count_keys);
                address->imvalue_mask |= I18N_ON_KEYS;
              }
           }
           else if (!strcmp(p->name, IMOffKeysList)) {
              if (address->imvalue_mask & I18N_OFF_KEYS) {
                  return IMOffKeysList;
              }
              if (address->off_keys.count_keys > 0) {
                address->off_keys.count_keys =
                  ((XIMTriggerKeys*)p->value)->count_keys;
                address->off_keys.keylist =
                  (XIMTriggerKey*)malloc(sizeof(XIMTriggerKey)
                                      * address->off_keys.count_keys);
                if (address->off_keys.keylist == (XIMTriggerKey*)NULL)
                  return IMOffKeysList;
                memmove(address->off_keys.keylist,
                       ((XIMTriggerKeys*)p->value)->keylist,
                       sizeof(XIMTriggerKey) * address->off_keys.count_keys);
                address->imvalue_mask |= I18N_OFF_KEYS;
              }
           }
           else if (!strcmp(p->name, IMEncodingList)) {
              if (address->imvalue_mask & I18N_ENCODINGS) {
                  return IMEncodingList;
              }
              address->encoding_list.count_encodings =
                ((XIMEncodings*)p->value)->count_encodings;
              address->encoding_list.supported_encodings =
                (XIMEncoding*)malloc(sizeof(XIMEncoding) *
                                   address->encoding_list.count_encodings);
              if (address->encoding_list.supported_encodings
                  == (XIMEncoding*)NULL)
                return IMEncodingList;
              memmove(address->encoding_list.supported_encodings,
                     ((XIMEncodings*)p->value)->supported_encodings,
                     sizeof(XIMEncoding) *
                       address->encoding_list.count_encodings);
              address->imvalue_mask |= I18N_ENCODINGS;
           }
           else if (!strcmp(p->name, IMFilterEventMask)) {
              if (address->imvalue_mask & I18N_FILTERMASK) {
                  return IMFilterEventMask;
              }
              address->filterevent_mask = (long)p->value;
              address->imvalue_mask |= I18N_FILTERMASK;
           }
       }
       if (mode == I18N_OPEN) {
           /* check mandatory IM values */
           if (!(address->imvalue_mask & I18N_IM_LOCALE)) {
              /* locales must be set in IMOpenIM */
              return IMLocale;
           }
           if (!(address->imvalue_mask & I18N_IM_ADDRESS)) {
              /* address must be set in IMOpenIM */
              return IMServerTransport;
           }
       }
    } else if (mode == I18N_GET) {
       for (p = args; p->name != NULL; p++) {
           if (!strcmp(p->name, IMLocale)) {
              p->value = (char *)malloc(strlen(address->im_locale) + 1);
              if (!p->value)
                return IMLocale;
              strcpy(p->value, address->im_locale);
           }
           else if (!strcmp(p->name, IMServerTransport)) {
              p->value = (char *)malloc(strlen(address->im_addr) + 1);
              if (!p->value)
                return IMServerTransport;
              strcpy(p->value, address->im_addr);
           }
           else if (!strcmp(p->name, IMServerName)) {
              if (address->imvalue_mask & I18N_IM_NAME) {
                  p->value = (char *)malloc(strlen(address->im_name) + 1);
                  if (!p->value)
                    return IMServerName;
                  strcpy(p->value, address->im_name);
              } else {
                  return IMServerName;
              }
           }
           else if (!strcmp(p->name, IMServerWindow)) {
              if (address->imvalue_mask & I18N_IMSERVER_WIN) {
                  *((Window *)(p->value)) = address->im_window;
              } else {
                  return IMServerWindow;
              }
           }
           else if (!strcmp(p->name, IMInputStyles)) {
              if (GetInputStyles(i18n_core,
                               (XIMStyles **)p->value) == False) {
                  return IMInputStyles;
              }
           }
           else if (!strcmp(p->name, IMProtocolHandler)) {
#if IM_PROTO_HANDLER
              if (address->imvalue_mask & I18N_IM_HANDLER) {
                  X11R6IMProtoHandler **handler =
                    (X11R6IMProtoHandler **)p->value;
                  *handler = address->improto;
              } else {
                  return IMProtocolHandler;
              }
#endif
           }
           else if (!strcmp(p->name, IMOnKeysList)) {
              if (address->imvalue_mask & I18N_ON_KEYS) {
                  if (GetOnOffKeys(i18n_core, I18N_ON_KEYS,
                                 (XIMTriggerKeys **)p->value) == False) {
                     return IMOnKeysList;
                  }
              } else {
                  return IMOnKeysList;
              }
           }
           else if (!strcmp(p->name, IMOffKeysList)) {
              if (address->imvalue_mask & I18N_OFF_KEYS) {
                  if (GetOnOffKeys(i18n_core, I18N_OFF_KEYS,
                                 (XIMTriggerKeys **)p->value) == False) {
                     return IMOffKeysList;
                  }
              } else {
                  return IMOffKeysList;
              }
           }
           else if (!strcmp(p->name, IMEncodingList)) {
              if (address->imvalue_mask & I18N_ENCODINGS) {
                  if (GetEncodings(i18n_core,
                                 (XIMEncodings **)p->value) == False) {
                     return IMEncodingList;
                  }
              } else {
                  return IMEncodingList;
              }
           }
           else if (!strcmp(p->name, IMFilterEventMask)) {
              if (address->imvalue_mask & I18N_FILTERMASK) {
                  *((long *)(p->value)) = address->filterevent_mask;
              } else {
                  return IMFilterEventMask;
              }
           }
       }
    }
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void ReturnSelectionNotify ( Xi18n  i18n_core,
XSelectionRequestEvent *  ev 
) [static]

Definition at line 544 of file i18nMethod.c.

{
    XEvent event;
    Display *dpy = i18n_core->address.dpy;
    char buf[256];

    event.type = SelectionNotify;
    event.xselection.requestor = ev->requestor;
    event.xselection.selection = ev->selection;
    event.xselection.target = ev->target;
    event.xselection.time = ev->time;
    event.xselection.property = ev->property;
    if (ev->target == i18n_core->address.Localename) {
       (void)sprintf(buf, "@locale=%s", i18n_core->address.im_locale);
    } else if (ev->target == i18n_core->address.Transportname) {
       (void)sprintf(buf, "@transport=%s", i18n_core->address.im_addr);
    }
    XChangeProperty(dpy, event.xselection.requestor,
                  ev->target, ev->target, 8,
                  PropModeReplace, (unsigned char *)buf, strlen(buf));
    XSendEvent(dpy, event.xselection.requestor, False, NoEventMask, &event);
    XFlush(i18n_core->address.dpy);
}

Here is the caller graph for this function:

static int SetXi18nSelectionOwner ( Xi18n  i18n_core) [static]

Definition at line 431 of file i18nMethod.c.

{
    static Atom XIM_Servers = None;
    Display *dpy = i18n_core->address.dpy;
    Window ims_win = i18n_core->address.im_window;
    Window root = RootWindow(dpy, DefaultScreen(dpy));
    Atom realtype;
    int realformat;
    unsigned long bytesafter;
    long *data;
    unsigned long length;
    Atom atom;
    Atom atom_bwc;
    int i;
    int found;
    int forse = False;
    char buf[256];

    /* FIXME */
    (void)sprintf(buf, "@server=%s", i18n_core->address.im_name);
    if ((atom = XInternAtom(dpy, buf, False)) == 0) {
       return False;
    }
    if ((atom_bwc = XInternAtom(dpy, "@server=htt", False)) == 0) {
        return False;
    }
    i18n_core->address.selection = atom;
    i18n_core->address.selection_bwc = atom_bwc;

    if (XIM_Servers == None)
      XIM_Servers = XInternAtom(dpy, XIM_SERVERS, False);
    XGetWindowProperty(dpy, root,
                     XIM_Servers, 0L, 1000000L, False, XA_ATOM,
                     &realtype, &realformat, &length,
                     &bytesafter, (unsigned char **)(&data));
    if (realtype == None) {
       /* specified property doesn't exist yet */
    } else if (realtype != XA_ATOM) {
       /* wrong type */
       return False;
    } else if (realformat != 32) {
       /* wrong format */
       if (data != NULL) XFree((char *)data);
       return False;
    }
    found = False;
    for (i = 0; i < length; i++) {
       if (data[i] == atom) {
           Window owner;
           found = True;
           if ((owner = XGetSelectionOwner(dpy, atom)) != ims_win ||
                (owner = XGetSelectionOwner(dpy, atom_bwc)) != ims_win) {
              if (owner == None || forse == True) {
                XSetSelectionOwner(dpy, atom, ims_win, CurrentTime);
                XSetSelectionOwner(dpy, atom_bwc, ims_win, CurrentTime);
                }
              else
                return False;
           }
           break;
       }
    }
    if (data != NULL) XFree((char *)data);

    if (found == False) {
       XSetSelectionOwner(dpy, atom, ims_win, CurrentTime);
       XSetSelectionOwner(dpy, atom_bwc, ims_win, CurrentTime);
       (void)XChangeProperty(dpy, root, XIM_Servers, XA_ATOM,
                           32, PropModePrepend, (unsigned char *)&atom, 1);
       (void)XChangeProperty(dpy, root, XIM_Servers, XA_ATOM,
                           32, PropModePrepend, (unsigned char *)&atom_bwc, 1);
    }
    /* Intern "LOCALES" and "TRANSOPORT" Target Atoms */
    i18n_core->address.Localename = XInternAtom(dpy, LOCALES, False);
    i18n_core->address.Transportname = XInternAtom(dpy, TRANSPORT, False);
    return (XGetSelectionOwner(dpy, atom) == ims_win);
}

Here is the caller graph for this function:

static Bool WaitXSelectionRequest ( Display *  dpy,
Window  win,
XEvent *  ev,
XPointer  client_data 
) [static]

Definition at line 569 of file i18nMethod.c.

{
    XIMS ims = (XIMS)client_data;
    Xi18n i18n_core = ims->protocol;

    if (((XSelectionRequestEvent *)ev)->selection ==
       i18n_core->address.selection ||
        ((XSelectionRequestEvent *)ev)->selection ==
        i18n_core->address.selection_bwc) {
       ReturnSelectionNotify(i18n_core,
                           (XSelectionRequestEvent *)ev);
       return True;
    }
    return False;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int xi18n_callCallback ( XIMS  ims,
X11R6IMProtocol  call_data 
) [static]

Definition at line 824 of file i18nMethod.c.

                                                        {
    switch (call_data->major_code) {
      case XIM_GEOMETRY:
       return _Xi18nGeometryCallback(ims, call_data);
      case XIM_PREEDIT_START:
       return _Xi18nPreeditStartCallback(ims, call_data);
      case XIM_PREEDIT_DRAW:
       return _Xi18nPreeditDrawCallback(ims, call_data);
      case XIM_PREEDIT_CARET:
       return _Xi18nPreeditCaretCallback(ims, call_data);
      case XIM_PREEDIT_DONE:
       return _Xi18nPreeditDoneCallback(ims, call_data);
      case XIM_STATUS_START:
       return _Xi18nStatusStartCallback(ims, call_data);
      case XIM_STATUS_DRAW:
       return _Xi18nStatusDrawCallback(ims, call_data);
      case XIM_STATUS_DONE:
       return _Xi18nStatusDoneCallback(ims, call_data);
      case XIM_STR_CONVERSION:
       return _Xi18nStringConversionCallback(ims, call_data);
      default:
       return False;
    }
}

Here is the call graph for this function:

static Status xi18n_closeIM ( XIMS  ims) [static]

Definition at line 609 of file i18nMethod.c.

{
    Xi18n i18n_core = ims->protocol;
    Display *dpy = i18n_core->address.dpy;

    if (!i18n_core->methods.end(ims)) {
       return False;
    }
    _XUnregisterFilter(dpy, i18n_core->address.im_window,
                     WaitXSelectionRequest, (XPointer)ims);
    XFree(i18n_core->address.im_name);
    XFree(i18n_core->address.im_locale);
    XFree(i18n_core->address.im_addr);
    XFree(i18n_core);
    return True;
}

Here is the call graph for this function:

static Status xi18n_commit ( XIMS  ims,
IMCommitEventStruct call_data 
) [static]

Definition at line 736 of file i18nMethod.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec commit_chars_fr[], commit_both_fr[];
    register int total_size;
    unsigned char *reply = NULL;
    CARD16 str_length;
#ifndef FULL_SYNC_MODE
    Xi18nClient *client = (Xi18nClient *)_Xi18nFindClient(i18n_core,
                                     call_data->connect_id);

    call_data->flag |= XimSYNCHRONUS; /* always sync */
    client->sync = True;
#endif

    if (!(call_data->flag & XimLookupKeySym) &&
       (call_data->flag & XimLookupChars)) {
       /* create FrameMgr */
       fm = FrameMgrInit(commit_chars_fr, NULL,
                       _Xi18nNeedSwap(i18n_core, call_data->connect_id));

       /* set length of STRING8 */
       str_length = strlen(call_data->commit_string);
       FrameMgrSetSize(fm, str_length);
       total_size = FrameMgrGetTotalSize(fm);
       reply = (unsigned char *)malloc(total_size);
       if (!reply) {
           _Xi18nSendMessage(ims, call_data->connect_id,
                           XIM_ERROR, 0, 0, 0);
           return False;
       }
       memset(reply, 0, total_size);
       FrameMgrSetBuffer(fm, reply);

       str_length = FrameMgrGetSize(fm);
       FrameMgrPutToken(fm, call_data->connect_id);
       FrameMgrPutToken(fm, call_data->icid);
       FrameMgrPutToken(fm, call_data->flag);
       FrameMgrPutToken(fm, str_length);
       FrameMgrPutToken(fm, call_data->commit_string);
    } else {
       /* create FrameMgr */
       fm = FrameMgrInit(commit_both_fr, NULL,
                       _Xi18nNeedSwap(i18n_core, call_data->connect_id));
       /* set length of STRING8 */
       str_length = strlen(call_data->commit_string);
       if (str_length > 0)
         FrameMgrSetSize(fm, str_length);

       total_size = FrameMgrGetTotalSize(fm);
       reply = (unsigned char *)malloc(total_size);
       if (!reply) {
           _Xi18nSendMessage(ims, call_data->connect_id,
                           XIM_ERROR, 0, 0, 0);
           return False;
       }
       memset(reply, 0, total_size);
       FrameMgrSetBuffer(fm, reply);

       FrameMgrPutToken(fm, call_data->connect_id);
       FrameMgrPutToken(fm, call_data->icid);
       FrameMgrPutToken(fm, call_data->flag);
       FrameMgrPutToken(fm, call_data->keysym);
       if (str_length > 0) {
         str_length = FrameMgrGetSize(fm);
         FrameMgrPutToken(fm, str_length);
         FrameMgrPutToken(fm, call_data->commit_string);
      }
    }
    if (IsFocused(call_data->icid)) {
      _Xi18nSendMessage(ims, call_data->connect_id,
                     XIM_COMMIT, 0, reply, total_size);
      XFree(reply);
    } else {
      Xi18nClient *client =
       (Xi18nClient *)_Xi18nFindClient(i18n_core,
                                   call_data->connect_id);
      client->pending_commit = reply;
      client->pending_commit_size = total_size;
    }
    /* free FrameMgr */
    FrameMgrFree(fm);

    return True;
}

Here is the call graph for this function:

static Status xi18n_forwardEvent ( XIMS  ims,
IMForwardEventStruct call_data 
) [static]

Definition at line 679 of file i18nMethod.c.

{
    Xi18n i18n_core = ims->protocol;
    FrameMgr fm;
    extern XimFrameRec forward_event_fr[];
    register int total_size;
    unsigned char *reply = NULL;
    unsigned char *replyp;
    CARD16 serial;
    int event_size;
    Xi18nClient *client = (Xi18nClient *)_Xi18nFindClient(i18n_core,
                                     call_data->connect_id);

    /* create FrameMgr */
    fm = FrameMgrInit(forward_event_fr, NULL,
                    _Xi18nNeedSwap(i18n_core, call_data->connect_id));

    total_size = FrameMgrGetTotalSize(fm);
    event_size = sizeof(xEvent);
    reply = (unsigned char *)malloc(total_size + event_size);
    if (!reply) {
       _Xi18nSendMessage(ims, call_data->connect_id,
                       XIM_ERROR, 0, 0, 0);
       return False;
    }
    memset(reply, 0, total_size + event_size);
    FrameMgrSetBuffer(fm, reply);
    replyp = reply;

#ifdef FULL_SYNC_MODE
    call_data->sync_bit = 0;       /* off; SYNC_REPLY will sync */
#else
    call_data->sync_bit = 1;       /* always sync */
    client->sync = True;
#endif

    FrameMgrPutToken(fm, call_data->connect_id);
    FrameMgrPutToken(fm, call_data->icid);
    FrameMgrPutToken(fm, call_data->sync_bit);

    replyp += total_size;
    EventToWireEvent(&(call_data->event), (xEvent *)replyp, &serial);

    FrameMgrPutToken(fm, serial);

    _Xi18nSendMessage(ims, call_data->connect_id,
                    XIM_FORWARD_EVENT, 0,
                    reply, total_size + event_size);

    XFree(reply);
    /* free FrameMgr */
    FrameMgrFree(fm);

    return True;
}

Here is the call graph for this function:

static char * xi18n_getIMValues ( XIMS  ims,
XIMArg args 
) [static]

Definition at line 639 of file i18nMethod.c.

{
    Xi18n i18n_core = ims->protocol;
    char *ret;

    if ((ret = ParseArgs(i18n_core, I18N_GET, args)) != NULL) {
       return ret;
    }
    return NULL;
}

Here is the call graph for this function:

static Status xi18n_openIM ( XIMS  ims) [static]

Definition at line 587 of file i18nMethod.c.

{
    Xi18n i18n_core = ims->protocol;
    Display *dpy = i18n_core->address.dpy;

    if (!CheckIMName(i18n_core)
       || !SetXi18nSelectionOwner(i18n_core)
       || !i18n_core->methods.begin(ims)) {
       XFree(i18n_core->address.im_name);
       XFree(i18n_core->address.im_locale);
       XFree(i18n_core->address.im_addr);
       XFree(i18n_core);
       return False;
    }

    _XRegisterFilterByType(dpy, i18n_core->address.im_window,
                        SelectionRequest, SelectionRequest,
                        WaitXSelectionRequest, (XPointer)ims);
    return True;
}

Here is the call graph for this function:

static int xi18n_preeditEnd ( XIMS  ims,
X11R6IMProtocol  call_data 
) [static]

Definition at line 878 of file i18nMethod.c.

                                                      {
    Xi18n i18n_core = ims->protocol;
    int on_key_num = i18n_core->address.on_keys.count_keys;
    int off_key_num = i18n_core->address.off_keys.count_keys;
    IMPreeditStateStruct *preedit_state =
      (IMPreeditStateStruct *)&call_data->preedit_state;

    if (on_key_num == 0 && off_key_num == 0)
      return False;

    _Xi18nSetEventMask(ims, preedit_state->connect_id,
                     preedit_state->connect_id, preedit_state->icid,
                     0, 0);
    return True;
}

Here is the call graph for this function:

static int xi18n_preeditStart ( XIMS  ims,
X11R6IMProtocol  call_data 
) [static]

Definition at line 851 of file i18nMethod.c.

                                                        {
    Xi18n i18n_core = ims->protocol;
    IMPreeditStateStruct *preedit_state =
      (IMPreeditStateStruct *)&call_data->preedit_state;
    long mask;
    int on_key_num = i18n_core->address.on_keys.count_keys;
    int off_key_num = i18n_core->address.off_keys.count_keys;

    if (on_key_num == 0 && off_key_num == 0)
      return False;

    if (i18n_core->address.imvalue_mask & I18N_FILTERMASK)
      mask = i18n_core->address.filterevent_mask;
    else
      mask = DEFAULT_FILTER_MASK;

      _Xi18nSetEventMask(ims, preedit_state->connect_id,
                      preedit_state->connect_id, preedit_state->icid,
#ifdef FULL_SYNC_MODE
                      mask, mask);
#else
                      mask, ~mask);
#endif
    return True;
}

Here is the call graph for this function:

static char * xi18n_setIMValues ( XIMS  ims,
XIMArg args 
) [static]

Definition at line 627 of file i18nMethod.c.

{
    Xi18n i18n_core = ims->protocol;
    char *ret;

    if ((ret = ParseArgs(i18n_core, I18N_SET, args)) != NULL) {
       return ret;
    }
    return NULL;
}

Here is the call graph for this function:

static void * xi18n_setup ( Display *  dpy,
XIMArg args 
) [static]

Definition at line 511 of file i18nMethod.c.

{
    Xi18n i18n_core;
    CARD16 endian = 1;

    if ((i18n_core = (Xi18n)malloc(sizeof(Xi18nCore)))
       == (Xi18n)NULL) {
       return NULL;
    }
    memset(i18n_core, 0, sizeof(Xi18nCore));

    i18n_core->address.dpy = dpy;

    if (ParseArgs(i18n_core, I18N_OPEN, args) != NULL) {
       XFree(i18n_core);
       return NULL;
    }
    if (*(char *)&endian) {
       i18n_core->address.im_byteOrder = 'l';
    } else {
       i18n_core->address.im_byteOrder = 'B';
    }

    /* install IMAttr and ICAttr list in i18n_core */
    _Xi18nInitAttrList(i18n_core);

    /* install IMExtension list in i18n_core */
    _Xi18nInitExtension(i18n_core);

    return i18n_core;
}

Here is the call graph for this function:


Variable Documentation

Initial value:
 {
    {"X",          1, _Xi18nCheckXAddress},







    {(char *)NULL, 0, (Bool (*)())NULL}
}

Definition at line 88 of file i18nMethod.c.