Back to index

im-sdk  12.3.91
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
IIIMP_ICState_REQUESTED Class Reference

#include <IIIMP_ICState.hh>

Inheritance diagram for IIIMP_ICState_REQUESTED:
Inheritance graph
[legend]
Collaboration diagram for IIIMP_ICState_REQUESTED:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual bool message_proc (void *message)
virtual bool dealing ()
bool toggle_server_convmode (bool flag)
bool set_values (IIIMP_message *pmes)
bool toggle_icfocus (bool flag)
bool reset ()
bool aux_setvalues (IIIMP_message *pmes)
bool aux_getvalues (IIIMP_message *pmes)
bool forward_event (IIIMP_message *pmes)
bool forward_event_with_operations (IIIMP_message *pmes)
bool destroyic ()
virtual int toggle_client_convmode (bool flag)
virtual int forward_keyevent (IMKeyEventStruct *pkeyevent)
virtual int commit_string (IMText *pimtext)
virtual int preedit_start ()
virtual int draw_preedit (IMPreeditDrawCallbackStruct *pimpdraw)
virtual int preedit_done ()
virtual int status_start ()
virtual int draw_status (IMStatusDrawCallbackStruct *pimsdraw)
virtual int status_done ()
virtual int lookup_start (IMLookupStartCallbackStruct *pimls)
virtual int draw_lookup (IMLookupDrawCallbackStruct *pimld)
virtual int lookup_process (IMLookupProcessCallbackStruct *pimlp)
virtual int lookup_done ()
virtual int aux_start (IMAuxStartCallbackStruct *pimauxstart)
virtual int draw_aux (IMAuxDrawCallbackStruct *pimauxdraw)
virtual int aux_done (IMAuxDoneCallbackStruct *pimauxdone)
 IIIMP_ICState_REQUESTED (IIIMP_ICState *pbase)
iml_session_tget_iml_session ()
iml_methods_tget_iml_methods ()
IIIMPTransget_iiimptrans ()
bool conversion_enable_p ()
IMLangListget_langlist (iml_desktop_t *)
bool create_langimlist ()
LangIMListget_langimlist ()
IMInputContextget_iminputcontext ()
IMSvrget_imsvr ()
LEMgrget_lemgr ()
bool send_avail_p ()
IMStateget_imstate ()
CARD16BIT get_im_id ()
IIIMP_hotkey_profileget_hotkey_profile ()
CARD16BIT get_ic_id () const
bool substatep () const
bool deliver (void *message)
virtual int ns_listener (IMNSListenerStruct *pons)

Static Public Member Functions

static IIIMP_ICStatecreate (CARD16BIT ic_id, IIIMP_IMState *piiims, ICHandler *pich)

Protected Member Functions

IIIMP_IMStateget_iiimp_imstate ()
bool send (IIIMP_message *pmes, bool deletep)
IIIMP_ICState_REQUESTEDstart_request ()
IMLExec_ICStateget_imlexec ()
bool mark_terminal ()
void reset_state ()
void change_state (ICState &newstate, bool destroyp=true)
IMProtocolget_improtocol ()
ICHandlerget_ichandler ()
void invalidate_ichandler ()
bool check_protocol_version (int version)
int invalid_operation (const char *opstr)

Protected Attributes

IIIMP_messagepreply
SharedStatepshared
IIIMP_hotkeyihk

Private Member Functions

bool finish ()
bool wait (int opcode)
bool wait_aux (int opcode, int index, const u16string &imname)
virtual bool state_send_available_p ()

Private Attributes

IIIMP_ICStatepprev_state

Friends

class IIIMP_hotkey

Detailed Description

Definition at line 95 of file IIIMP_ICState.hh.


Constructor & Destructor Documentation

Definition at line 311 of file IIIMP_ICState.cpp.

  : IIIMP_ICState(*pbase)
{
    pprev_state = pbase;
}

Member Function Documentation

Reimplemented from ICState.

Definition at line 1132 of file IIIMP_ICState.cpp.

{
    IIIMP_message *pmes;
    u16string auxname(pimauxdone->aux_name);
    IIIMP_string *iiimpauxname;
    int index = pimauxdone->aux_index;

    iiimpauxname = iiimp_string_new(get_iiimptrans()->get_data_s(),
                                auxname.size(),
                                auxname.data());
    if (!iiimpauxname) return -1;

    pmes = iiimp_aux_done_new(get_iiimptrans()->get_data_s(),
                           get_im_id(),
                           get_ic_id(),
                           index,
                           iiimpauxname);
                            
    if (!send(pmes, true)) return -1;

    return wait_aux(IM_AUX_DONE_REPLY, index, auxname) ? 0 : -1;
}

Here is the call graph for this function:

Definition at line 463 of file IIIMP_ICState.cpp.

{
    bool result = false;
    IIIMP_aux_getvalues_v *pauxval = &pmes->v.aux_getvalues;
    int i;

    IMAuxGetEvent aux_event;
    IMAuxDrawCallbackStruct *aux_draw, aux_data_struct;
    aux_draw = &aux_data_struct;

    vector<char> auxnamev;
    vector<int> intvalv;
    vector<IMText> imtextvec;

    u16string auxnamestr = CONV_IIIMP_STR(pauxval->input_method_name);
    if (auxnamestr.get_charstr()) {
       auxnamev.reserve(auxnamestr.size() + 1);
       memcpy(&auxnamev[0], auxnamestr.get_charstr(), auxnamestr.size() + 1);
       aux_draw->aux_name = &auxnamev[0];
       aux_draw->aux_index = pauxval->class_index;

       {
           // integer value array.
           int i;
           int num = pauxval->integer_value->count;
           IIIMP_card32 *pc32 = pauxval->integer_value->ptr;
           intvalv.reserve(num);
           aux_draw->count_integer_values = num;
           for (i = 0; i < num; i++, pc32++) {
              intvalv.push_back(*pc32);
           }
           aux_draw->integer_values = &intvalv[0];

           // string value array.
           int count = 0;
           IIIMP_string *pstr;

           for (pstr = pauxval->string_value; pstr; pstr = pstr->next) {
              IMText text;
              memset(&text, 0, sizeof(text));
              text.encoding = UTF16_CODESET;
              text.char_length = pstr->len;
              text.text.utf_chars = pstr->ptr;
              imtextvec.push_back(text);
              count++;
           }
           aux_draw->count_string_values = count;
           aux_draw->string_values = &imtextvec[0];

           aux_event.type = IM_EventAuxGet;
           aux_event.fromaux = aux_draw;
           result = get_ichandler()->send_event_getvalues(get_imlexec(),
                                                    (IMInputEvent*) &aux_event);
       }
    }

    IIIMP_string* pimname = iiimp_string_new(get_iiimptrans()->get_data_s(),
                                        pauxval->input_method_name->len,
                                        pauxval->input_method_name->ptr);
    if (!pimname) {
       // TODO: we should throw memory exception.
       get_ichandler()->send_event_getvalues_finished(get_imlexec());
       return false;
    }

    // send aux_getvalues_reply
    aux_draw = aux_event.toaux;

    IIIMP_string *pstrh = NULL, *pstr = NULL, *pcur;
    IIIMP_card32_list *pilist = NULL;

    if (aux_draw->count_integer_values > 0) {
       // `Int' and `IIIMP_card32' is not always compatible especially
       // in array form.  Thus, it's inevitable to convert `int' array
       // manually.
       IIIMP_card32* pc32h, *pc32;
       pc32h = pc32 = new IIIMP_card32[aux_draw->count_integer_values];
       if (!pc32) {
           get_ichandler()->send_event_getvalues_finished(get_imlexec());
           return -1;
       }
       int *pi = aux_draw->integer_values;
       for (i = 0; i < aux_draw->count_integer_values; i++) {
           *pc32++ = (unsigned) *pi++;
       }
       pilist = iiimp_card32_list_new(get_iiimptrans()->get_data_s(),
                                   aux_draw->count_integer_values,
                                   pc32h);
       if (!pilist) goto error;
       delete[] pc32h;
    }

    IMText *pimt;
    for (i = 0, pimt = aux_draw->string_values;
        i < aux_draw->count_string_values;
        i++, pimt++) {
       pcur = convert_IMText_to_iiimp_string(get_iiimptrans()->get_data_s(),
                                         pimt);
       if (!pcur) goto error;
       if (!pstrh) {
           pstrh = pcur;
       } else {
           pstr->next = pcur;
       }
       pstr = pcur;
    }

    preply = iiimp_aux_getvalues_reply_new(get_iiimptrans()->get_data_s(),
                                      get_im_id(),
                                      get_ic_id(),
                                      pauxval->class_index,
                                      pimname,
                                      pilist,
                                      pstrh);

error:
    get_ichandler()->send_event_getvalues_finished(get_imlexec());
    result = dealing() && result;

#if 0
    // FIXME. The pilist and pstrh must be freed, but freeing them will
    // cause htt_server to freeze.
    if (pilist)
       iiimp_card32_list_delete(get_iiimptrans()->get_data_s(), pilist);
    if (pstrh)
       iiimp_string_delete(get_iiimptrans()->get_data_s(), pstrh);
#endif
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 391 of file IIIMP_ICState.cpp.

{
    bool result = false;
    IIIMP_aux_setvalues_v *pauxval = &pmes->v.aux_setvalues;

    IMAuxDrawCallbackStruct aux_draw;

    u16string auxnamestr = CONV_IIIMP_STR(pauxval->input_method_name);
    if (auxnamestr.get_charstr()) {
       vector<char> auxnamev;
       auxnamev.reserve(auxnamestr.size() + 1);
       memcpy(&auxnamev[0], auxnamestr.get_charstr(), auxnamestr.size() + 1);
       aux_draw.aux_name = &auxnamev[0];
       aux_draw.aux_index = pauxval->class_index;

       {
           // integer value array.
           int i;
           int num = pauxval->integer_value->count;
           IIIMP_card32 *pc32 = pauxval->integer_value->ptr;
           vector<int> intvalv;
           intvalv.reserve(num);
           aux_draw.count_integer_values = num;
           for (i = 0; i < num; i++, pc32++) {
              intvalv.push_back(*pc32);
           }
           aux_draw.integer_values = &intvalv[0];

           // string value array.
           int count = 0;
           IIIMP_string *pstr;
           vector<IMText> imtextvec;

           for (pstr = pauxval->string_value; pstr; pstr = pstr->next) {
              IMText text;
              memset(&text, 0, sizeof(text));
              text.encoding = UTF16_CODESET;
              text.char_length = pstr->len;
              text.text.utf_chars = pstr->ptr;
              imtextvec.push_back(text);
              count++;
           }
           aux_draw.count_string_values = count;
           aux_draw.string_values = &imtextvec[0];

           IMAuxEvent aux_event;
           aux_event.type = IM_EventAuxSet;
           aux_event.aux = &aux_draw;
           result = get_ichandler()->send_event(get_imlexec(),
                                           (IMInputEvent*) &aux_event);
       }
    }

    IIIMP_string* pimname = iiimp_string_new(get_iiimptrans()->get_data_s(),
                                        pauxval->input_method_name->len,
                                        pauxval->input_method_name->ptr);
    if (!pimname) {
       // TODO: we should throw memory exception.
       return false;
    }
    preply = iiimp_aux_setvalues_reply_new(get_iiimptrans()->get_data_s(),
                                      get_im_id(),
                                      get_ic_id(),
                                      pauxval->class_index,
                                      pimname);
    result = dealing() && result;
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from ICState.

Definition at line 1036 of file IIIMP_ICState.cpp.

{
    IIIMP_message *pmes;
    u16string auxname(pimauxstart->aux_name);
    IIIMP_string *iiimpauxname;
    int index = pimauxstart->aux_index;

    iiimpauxname = iiimp_string_new(get_iiimptrans()->get_data_s(),
                                auxname.size(),
                                auxname.data());
    if (!iiimpauxname) return -1;

    pmes = iiimp_aux_start_new(get_iiimptrans()->get_data_s(),
                            get_im_id(),
                            get_ic_id(),
                            index,
                            iiimpauxname);
                            
    if (!send(pmes, true)) return -1;

    return wait_aux(IM_AUX_START_REPLY, index, auxname) ? 0 : -1;
}

Here is the call graph for this function:

void ICState::change_state ( ICState newstate,
bool  destroyp = true 
) [inline, protected, inherited]

Definition at line 154 of file ICState.hh.

    {
       ICState *p = pbase_state;
       if (destroyp && p->pproc_state) delete p->pproc_state;
       if (p == &newstate) {
           p->pproc_state = NULL;
       } else {
           p->pproc_state = &newstate;
       }
       p->pshared->pimlex->set_icstate(&newstate);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

bool ICState::check_protocol_version ( int  version) [inline, protected, inherited]

Definition at line 175 of file ICState.hh.

    { return get_imstate()->check_protocol_version(version); }

Here is the call graph for this function:

int IIIMP_ICState_REQUESTED::commit_string ( IMText pimtext) [virtual]

Reimplemented from ICState.

Definition at line 738 of file IIIMP_ICState.cpp.

{
    IIIMP_contents *pcon;

    pcon = convert_IMText_to_iiimp_contents_string(get_iiimptrans()->get_data_s(),
                                             pimtext);
    if (!pcon) return -1;
    IIIMP_message *pmes = iiimp_commit_string_new(get_iiimptrans()->get_data_s(),
                                            get_im_id(),
                                            get_ic_id(),
                                            pcon);
    if (!pmes) {
       iiimp_contents_delete(get_iiimptrans()->get_data_s(), pcon);
       return -1;
    }
    return send(pmes, true) ? 0 : -1;
}

Here is the call graph for this function:

bool IIIMP_ICState::conversion_enable_p ( ) [inline, inherited]

Definition at line 64 of file IIIMP_ICState.hh.

    { return pshared->conversion_mode; }

Here is the caller graph for this function:

IIIMP_ICState * IIIMP_ICState::create ( CARD16BIT  ic_id,
IIIMP_IMState piiims,
ICHandler pich 
) [static, inherited]

Definition at line 112 of file IIIMP_ICState.cpp.

{
    // The current implementation use the same IMLExec.
    // Note that it will be changed later.
    IMLExec_ICState *pimlex = new IMLExec_ICState();
    // memory error;
    if (!pimlex) return NULL;
    IIIMP_ICState *pics = new IIIMP_ICState(ic_id, piiims, pich, pimlex);
    // memory error;
    if (!pics) {
       delete pimlex;
       return NULL;
    }
    return pics;
}

Here is the call graph for this function:

bool IIIMP_ICState::create_langimlist ( ) [inherited]

Definition at line 183 of file IIIMP_ICState.cpp.

{
    LEMgr *plemgr = get_lemgr ();
    IMDescriptorList::iterator it;
    IMLangList::iterator itt;

    IMDescriptorList *pimdlist = const_cast<IMDescriptorList *>(plemgr->get_all_imdesclist(get_ichandler()->get_current_desktop()));

    langimlist.clear();
    for (it = pimdlist->begin (); it != pimdlist->end (); it++){
        u16string imname;
        u16string hrn;
        imname = it->get_imname();
        hrn = it->get_hrn();
        IMLangList *llist = const_cast<IMLangList *>(it->get_languages());
        for (itt = llist->begin (); itt != llist->end (); itt++) { 
           langimlist.push_back(LangIM(langimlist.size() + 1,
              // this '+ 1' is a crack - index in lang choice starts from 1...
              itt->get_id(),
              u16string(imname),
              u16string(hrn),
              it->get_hotkey_profile()
              )
           );
        }
    }
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 271 of file IIIMP_ICState.cpp.

{
    bool result;
    // execute remaining IML instructions.
    ASSERT(send_avail_p() == true);
    result = get_imlexec()->execute();
    if (send_avail_p()) {
       if (get_imlexec()->empty())
           result = finish() && result;
    }

    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool ICState::deliver ( void *  message) [inherited]

Definition at line 7 of file ICState.cpp.

{
    ICState *p;
    bool result = true;

    if (pproc_state) p = pproc_state;
    else p = this;

    if (!p->message_proc(message)) return false;

    if (send_avail_p() && get_imlexec()) {
       result = get_imlexec()->execute();
    }

    if (terminatingp()) {
       LOG_DEBUG("Try to terminate IC(%d).", get_ic_id());
       if (pproc_state) {
           LOG_DEBUG("Right now, the current state in IC(%d) may be "
                    "waiting for client responce.",
                    get_ic_id());
       } else if (!(get_imlexec()->empty())){
           LOG_DEBUG("Pending IML instruction(s) still remain in IC(%d), "
                    "wait for the next chance.",
                    get_ic_id());
       } else {
           int id = get_ic_id();
           destroy();
           LOG_DEBUG("Successfully IC(%d) is terminated.", id);
       }
    }

    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 665 of file IIIMP_ICState.cpp.

{
    bool result = get_ichandler()->destroy(get_imlexec());
    if (result) invalidate_ichandler();
    preply = iiimp_destroyic_reply_new(get_iiimptrans()->get_data_s(),
                                   get_im_id(),
                                   get_ic_id());
    mark_terminal();
    result = dealing();
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from ICState.

Definition at line 1062 of file IIIMP_ICState.cpp.

{
    int i;
    IIIMP_message *pmes;
    u16string auxname(pimauxdraw->aux_name);
    IIIMP_string *iiimpauxname;
    int index = pimauxdraw->aux_index;
    IIIMP_string *pstrh = NULL, *pstr = NULL, *pcur;
    IIIMP_card32_list *pilist = NULL;

    iiimpauxname = iiimp_string_new(get_iiimptrans()->get_data_s(),
                                auxname.size(),
                                auxname.data());
    if (!iiimpauxname) return -1;

    if (pimauxdraw->count_integer_values > 0) {
       // `int' and `IIIMP_card32' is not always compatible especially
       // in array form.  Thus, it's inevitable to convert `int' array
       // manually.
       IIIMP_card32* pc32h, *pc32;
       pc32h = pc32 = new IIIMP_card32[pimauxdraw->count_integer_values];
       if (!pc32) return -1;
       int *pi = pimauxdraw->integer_values;
       for (i = 0; i < pimauxdraw->count_integer_values; i++) {
           *pc32++ = (unsigned) *pi++;
       }
       pilist = iiimp_card32_list_new(get_iiimptrans()->get_data_s(),
                                   pimauxdraw->count_integer_values,
                                   pc32h);
       delete[] pc32h;
       if (!pilist) goto error;
    }

    IMText *pimt;
    for (i = 0, pimt = pimauxdraw->string_values;
        i < pimauxdraw->count_string_values;
        i++, pimt++) {
       pcur = convert_IMText_to_iiimp_string(get_iiimptrans()->get_data_s(),
                                         pimt);
       if (!pcur) goto error;
       if (!pstrh) {
           pstrh = pcur;
       } else {
           pstr->next = pcur;
       }
       pstr = pcur;
    }

    pmes = iiimp_aux_draw_new(get_iiimptrans()->get_data_s(),
                           get_im_id(),
                           get_ic_id(),
                           index,
                           iiimpauxname,
                           pilist,
                           pstrh);
                           
    if (!send(pmes, true)) return -1;

    return wait_aux(IM_AUX_DRAW_REPLY, index, auxname) ? 0 : -1;

error:
    if (iiimpauxname) iiimp_string_delete(get_iiimptrans()->get_data_s(), iiimpauxname);
    if (pilist) iiimp_card32_list_delete(get_iiimptrans()->get_data_s(), pilist);
    if (pstrh) iiimp_string_delete(get_iiimptrans()->get_data_s(), pstrh);
    return -1;
}

Here is the call graph for this function:

Reimplemented from ICState.

Definition at line 918 of file IIIMP_ICState.cpp.

{
    if (!pshared->lookup_choice) {
       LOG_ERROR("lookup-choice has not been enabled yet. (%d, %d)",
                get_im_id(), get_ic_id());
    }

    IIIMP_message *pmes;
    IIIMP_text *pchoiceh, *pchoice = NULL;
    IIIMP_text *plabelh, *plabel = NULL;
    IIIMP_text *ptitle;
    IMChoiceObject *pco;
    int i;
    pchoiceh = plabelh = NULL;

    ptitle = convert_IMText_to_iiimp_text(get_iiimptrans()->get_data_s(),
                                     pimld->title);
    if (!ptitle) goto error;

    IIIMP_text *pcur;
    for (i = 0, pco = pimld->choices;
        i < pimld->n_choices;
        i++, pco++) {
       // value.
       pcur = convert_IMText_to_iiimp_text(get_iiimptrans()->get_data_s(),
                                       pco->value);
       if (!pcur) goto error;
       if (!pchoiceh) {
           pchoiceh = pcur;
       } else {
           pchoice->next = pcur;
       }
       pchoice = pcur;

       //label
       pcur = convert_IMText_to_iiimp_text(get_iiimptrans()->get_data_s(),
                                       pco->label);
       if (!pcur) goto error;
       if (!plabelh) {
           plabelh = pcur;
       } else {
           plabel->next = pcur;
       }
       plabel = pcur;
    }

    pmes = iiimp_lookup_choice_draw_new(get_iiimptrans()->get_data_s(),
                                   get_im_id(),
                                   get_ic_id(),
                                   pimld->index_of_first_candidate,
                                   pimld->index_of_last_candidate,
                                   pimld->index_of_current_candidate,
                                   pchoiceh,
                                   plabelh,
                                   ptitle);
    if (!pmes) goto error;

    if (!send(pmes, true)) return -1;

    return wait(IM_LOOKUP_CHOICE_DRAW_REPLY) ? 0 : -1;

error:
    if (ptitle) iiimp_text_delete(get_iiimptrans()->get_data_s(), ptitle);
    if (plabelh) iiimp_text_delete(get_iiimptrans()->get_data_s(), plabelh);
    if (pchoiceh) iiimp_text_delete(get_iiimptrans()->get_data_s(), pchoiceh);

    return -1;
}

Here is the call graph for this function:

Reimplemented from ICState.

Definition at line 771 of file IIIMP_ICState.cpp.

{
    IIIMP_contents *pcon;

    if (!pshared->preedit) {
       LOG_ERROR("preedit has not been enabled yet. (%d, %d)",
                get_im_id(), get_ic_id());
    }

    if (pimpdraw->text) {
       pcon = convert_IMText_to_iiimp_contents_text(get_iiimptrans()->get_data_s(),
                                               pimpdraw->text);
    } else {
       // create empty text contents.
       IIIMP_text *ptext = iiimp_text_new(get_iiimptrans()->get_data_s(), NULL, NULL);
       if (!ptext) return -1;
       pcon = iiimp_contents_text_new(get_iiimptrans()->get_data_s(), ptext);
    }
    if (!pcon) return -1;
    IIIMP_message *pmes = iiimp_preedit_draw_new(get_iiimptrans()->get_data_s(),
                                           get_im_id(), get_ic_id(),
                                           pimpdraw->caret,
                                           pimpdraw->chg_first,
                                           pimpdraw->chg_length,
                                           pcon);
    if (!pmes) {
       iiimp_contents_delete(get_iiimptrans()->get_data_s(), pcon);
       return -1;
    }
    if (!send(pmes, true)) return 0;

    return wait(IM_PREEDIT_DRAW_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

Reimplemented from ICState.

Definition at line 832 of file IIIMP_ICState.cpp.

{
    IIIMP_contents *pcon;

    if (!pshared->status) {
       LOG_ERROR("status has not been enabled yet. (%d, %d)",
                get_im_id(), get_ic_id());
    }
    pcon = convert_IMText_to_iiimp_contents_text(get_iiimptrans()->get_data_s(),
                                           pimsdraw->text);
    if (!pcon) return -1;
    IIIMP_message *pmes = iiimp_status_draw_new(get_iiimptrans()->get_data_s(),
                                          get_im_id(), get_ic_id(),
                                          pcon);
    if (!pmes) {
       iiimp_contents_delete(get_iiimptrans()->get_data_s(), pcon);
       return -1;
    }
    if (!send(pmes, true)) return 0;

    return wait(IM_STATUS_DRAW_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

bool IIIMP_ICState_REQUESTED::finish ( ) [private]

Definition at line 245 of file IIIMP_ICState.cpp.

{
    bool flag;

    if (ihk->get_hotkey_mode()) {
       preply = iiimp_hotkey_notify_reply_new(get_iiimptrans()->get_data_s(), get_im_id(), get_ic_id());
       ihk->set_hotkey_mode(false);
    }

    if (ihk->get_forward_event()) {
       preply = iiimp_forward_event_reply_new(get_iiimptrans()->get_data_s(),
                                          get_im_id(),
                                          get_ic_id());
        ihk->set_forward_event(false);
    }

    flag = send(preply, true);
    if (pprev_state)
       change_state(*pprev_state, true);
    else
       reset_state();

    return flag;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 596 of file IIIMP_ICState.cpp.

{
    bool result = false;
    IIIMP_contents *pc = pmes->v.forward_event.contents;

    IMInputEvent ev;
    
    switch (pc->type) {
      case IIIMP_CONTENTS_KEYEVENT:
      {
         vector<IMKeyEventStruct> keyvec;
         IIIMP_keyevent *piiimpkey = pc->value.keyevent_list->keyevent;
         int count = pc->value.keyevent_list->count;
         int i;
         for (i = 0; i < count; i++, piiimpkey++) {
             IMKeyEventStruct kev;
             kev.keyCode = piiimpkey->keycode;
             kev.keyChar = piiimpkey->keychar;
             kev.modifier = piiimpkey->modifier;
             kev.time_stamp = piiimpkey->time_stamp;
             keyvec.push_back(kev);
         }


         IMKeyListEvent *pimkey = &ev.keylist;
         memset(pimkey, 0, sizeof(*pimkey));
         pimkey->type = IM_EventKeyList;
         pimkey->n_key = count;
         pimkey->keylist = &keyvec[0];

         result = get_ichandler()->send_event(get_imlexec(), &ev);
      }
          
      break;
      case IIIMP_CONTENTS_STRING:
      case IIIMP_CONTENTS_TEXT:
       // ignore
       break;
      default:
       abort();
    }

    preply = iiimp_forward_event_reply_new(get_iiimptrans()->get_data_s(),
                                      get_im_id(),
                                      get_ic_id());
    result = dealing() && result;
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 648 of file IIIMP_ICState.cpp.

{
    IIIMP_operation *pop = pmes->v.forward_event_with_operations_reply.operation;

    // currently do nothing.

    preply = iiimp_forward_event_with_operations_reply_new(get_iiimptrans()->get_data_s(),
                                                    get_im_id(),
                                                    get_ic_id(),
                                                    pop);
    // TODO: check memory error, throw exception.
    return dealing();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from ICState.

Definition at line 702 of file IIIMP_ICState.cpp.

{
    IIIMP_keyevent ikev;

    ikev.keycode = pkeyevent->keyCode;
    ikev.keychar = pkeyevent->keyChar;
    ikev.modifier = pkeyevent->modifier;
    ikev.time_stamp = pkeyevent->time_stamp;

    IIIMP_keyevent_list *pikl = iiimp_keyevent_list_new(get_iiimptrans()->get_data_s(),
                                                 1, &ikev);
    if (!pikl) return -1;

    IIIMP_contents *pcon = iiimp_contents_keyevent_list_new(get_iiimptrans()->get_data_s(),
                                                     pikl);
    if (!pcon) {
       iiimp_keyevent_list_delete(get_iiimptrans()->get_data_s(), pikl);
       return -1;
    }

    IIIMP_message *pmes = iiimp_forward_event_new(get_iiimptrans()->get_data_s(),
                                            get_im_id(),
                                            get_ic_id(),
                                            pcon);
    if (!pmes) {
       iiimp_contents_delete(get_iiimptrans()->get_data_s(), pcon);
       return -1;
    }
    if (!send(pmes, true)) return -1;

    return wait(IM_FORWARD_EVENT_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

Definition at line 215 of file ICState.hh.

    { return get_imstate()->get_hotkey_profile(); }

Here is the call graph for this function:

Here is the caller graph for this function:

CARD16BIT ICState::get_ic_id ( ) const [inline, inherited]

Definition at line 217 of file ICState.hh.

    { return pshared->ic_id; }

Here is the caller graph for this function:

ICHandler* ICState::get_ichandler ( ) [inline, protected, inherited]

Definition at line 171 of file ICState.hh.

    { return pshared->pich; }

Here is the caller graph for this function:

IIIMP_IMState* IIIMP_ICState::get_iiimp_imstate ( ) [inline, protected, inherited]

Definition at line 36 of file IIIMP_ICState.hh.

    { return (IIIMP_IMState*) get_imstate(); }

Here is the call graph for this function:

Here is the caller graph for this function:

IIIMPTrans* IIIMP_ICState::get_iiimptrans ( ) [inline, inherited]

Definition at line 58 of file IIIMP_ICState.hh.

Here is the call graph for this function:

Here is the caller graph for this function:

CARD16BIT ICState::get_im_id ( ) [inline, inherited]

Definition at line 213 of file ICState.hh.

    { return get_imstate()->get_im_id(); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 81 of file IIIMP_ICState.hh.

    {
       IMInputContext *pimic;
       pimic = dynamic_cast<IMInputContext *>(get_ichandler());
       return pimic;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

IMLExec_ICState* ICState::get_imlexec ( ) [inline, protected, inherited]

Definition at line 138 of file ICState.hh.

    { return pshared->pimlex; }

Here is the caller graph for this function:

IMProtocol* ICState::get_improtocol ( ) [inline, protected, inherited]

Definition at line 169 of file ICState.hh.

    { return pshared->pims->get_improtocol(); }

Here is the call graph for this function:

IMState* ICState::get_imstate ( ) [inline, inherited]

Definition at line 211 of file ICState.hh.

    { return pshared->pims; }

Here is the caller graph for this function:

IMSvr * IIIMP_ICState::get_imsvr ( ) [inherited]

Definition at line 146 of file IIIMP_ICState.cpp.

{
    IMSvr *imsvr;
    IMInputContext *pimic;

    pimic = get_iminputcontext ();
    imsvr = pimic->get_imconnection()->get_imsvr();

    if (imsvr) return imsvr;
    else return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 213 of file IIIMP_ICState.cpp.

{
    return &langimlist;
}

Here is the caller graph for this function:

IMLangList * IIIMP_ICState::get_langlist ( iml_desktop_t curr_desktop) [inherited]

Definition at line 167 of file IIIMP_ICState.cpp.

{
    LEMgr *plemgr = get_lemgr ();

    IMLangList *planglist =
        const_cast<IMLangList *>(plemgr->get_all_langlist(curr_desktop));
    IMLangList::iterator it;
    for (it = planglist->begin (); it != planglist->end (); it++){
       // LOG_DEBUG("LangID [%s]", it->get_id ());
    }
    return planglist;
}

Here is the call graph for this function:

Here is the caller graph for this function:

LEMgr * IIIMP_ICState::get_lemgr ( ) [inherited]

Definition at line 159 of file IIIMP_ICState.cpp.

{
    IMSvr *pimsvr = get_imsvr ();
    return pimsvr->get_lemgr();

}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::invalid_operation ( const char *  opstr) [protected, inherited]

Definition at line 44 of file ICState.cpp.

{
    LOG_ERROR("Current IC state cannot deal with %s.", opstr);
    abort();
    return 0;
}

Here is the caller graph for this function:

void ICState::invalidate_ichandler ( ) [inline, protected, inherited]

Definition at line 173 of file ICState.hh.

    { pshared->pich = NULL; }

Here is the caller graph for this function:

Reimplemented from ICState.

Definition at line 1023 of file IIIMP_ICState.cpp.

{
    IIIMP_message *pmes;
    pmes = iiimp_lookup_choice_done_new(get_iiimptrans()->get_data_s(),
                                   get_im_id(),
                                   get_ic_id());
    if (!send(pmes, true)) return -1;
    pshared->lookup_choice = false;

    return wait(IM_LOOKUP_CHOICE_DONE_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

Reimplemented from ICState.

Definition at line 990 of file IIIMP_ICState.cpp.

{
    if (!pshared->lookup_choice) {
       LOG_ERROR("lookup-choice has not been enabled yet. (%d, %d)",
                get_im_id(), get_ic_id());
    }

    IIIMP_card16 type, value;
    if (pimlp->type == LookupIndex) {
       type = IM_LOOKUP_CHOICE_PROCESS_INDEX;
       value = pimlp->value.index_of_choice_selected;
    } else {
       ASSERT(pimlp->type == LookupPage);
       type = IM_LOOKUP_CHOICE_PROCESS_PAGE;
       // Note that page_operation_id must have the same value
       // as that of libiiimp.
       value = pimlp->value.page_operation_id;
    }
    IIIMP_message *pmes;
    pmes = iiimp_lookup_choice_process_new(get_iiimptrans()->get_data_s(),
                                      get_im_id(),
                                      get_ic_id(),
                                      type,
                                      value);

    if (!send(pmes, true)) return -1;

    return wait(IM_LOOKUP_CHOICE_PROCESS_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

Reimplemented from ICState.

Definition at line 871 of file IIIMP_ICState.cpp.

{
    int master, direction, labelowner;
    LayoutInfo *playout;

    if (pimls->whoIsMaster == IMIsMaster) {
       playout = pimls->IMPreference;
       master = IM_LOOKUP_CHOICE_START_SERVER_IS_MASTER;
    } else {
       ASSERT(pimls->whoIsMaster == CBIsMaster);
       playout = pimls->CBPreference;
       master = IM_LOOKUP_CHOICE_START_CLIENT_IS_MASTER;
    }

    if (playout->drawUpDirection == DrawUpHorizontally) {
       direction = IM_LOOKUP_CHOICE_START_DRAWING_UP_HORIZONTALLY;
    } else {
       ASSERT(playout->drawUpDirection == DrawUpVertically);
       direction = IM_LOOKUP_CHOICE_START_DRAWING_UP_VERTICALLY;
    }

    if (playout->whoOwnsLabel == IMOwnsLabel) {
       labelowner = IM_LOOKUP_CHOICE_START_SERVER_OWNS_LABEL;
    } else {
       ASSERT(playout->whoOwnsLabel == CBOwnsLabel);
       labelowner = IM_LOOKUP_CHOICE_START_CLIENT_OWNS_LABEL;
    }

    IIIMP_message *pmes;
    pmes = iiimp_lookup_choice_start_new(get_iiimptrans()->get_data_s(),
                                    get_im_id(),
                                    get_ic_id(),
                                    master,
                                    playout->choice_per_window,
                                    playout->nrows,
                                    playout->ncolumns,
                                    direction,
                                    labelowner);
    if (!send(pmes, true)) return -1;
    pshared->lookup_choice = true;

    return wait(IM_LOOKUP_CHOICE_START_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

bool ICState::mark_terminal ( ) [inline, protected, inherited]

Definition at line 140 of file ICState.hh.

    { 
       pshared->terminating = true;
       return true;
    }

Here is the caller graph for this function:

bool IIIMP_ICState_REQUESTED::message_proc ( void *  message) [virtual]

Reimplemented from IIIMP_ICState.

Definition at line 232 of file IIIMP_ICState.cpp.

{
    IIIMP_message *pmes = (IIIMP_message*) x_pmes;

    LOG_ERROR("REQUESTED state cannot accept any messages. (%d, %d, %d)",
             get_im_id(), get_ic_id(), pmes->opcode);

    return false;
}

Here is the call graph for this function:

int ICState::ns_listener ( IMNSListenerStruct pons) [virtual, inherited]

Definition at line 172 of file ICState.cpp.

{
    return invalid_operation("ns_listener");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from ICState.

Definition at line 808 of file IIIMP_ICState.cpp.

{
    IIIMP_message *pmes = iiimp_preedit_done_new(get_iiimptrans()->get_data_s(),
                                           get_im_id(),
                                           get_ic_id());
    if (!send(pmes, true)) return -1;
    pshared->preedit = false;

    return wait(IM_PREEDIT_DONE_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

Reimplemented from ICState.

Definition at line 759 of file IIIMP_ICState.cpp.

{
    IIIMP_message *pmes = iiimp_preedit_start_new(get_iiimptrans()->get_data_s(),
                                            get_im_id(),
                                            get_ic_id());
    if (!send(pmes, true)) return -1;
    pshared->preedit = true;

    return wait(IM_PREEDIT_START_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

Definition at line 380 of file IIIMP_ICState.cpp.

{
    bool result = get_ichandler()->reset(get_imlexec());
    preply = iiimp_resetic_reply_new(get_iiimptrans()->get_data_s(),
                                 get_im_id(),
                                 get_ic_id());
    result = dealing() && result;
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ICState::reset_state ( ) [inline, protected, inherited]

Definition at line 147 of file ICState.hh.

    { 
       ICState *p = pbase_state;
       if (p->pproc_state) delete p->pproc_state;
       p->pproc_state = NULL;
       p->pshared->pimlex->set_icstate(p);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

bool IIIMP_ICState::send ( IIIMP_message pmes,
bool  deletep 
) [inline, protected, inherited]

Definition at line 39 of file IIIMP_ICState.hh.

    { return get_iiimp_imstate()->send(pmes, deletep); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool ICState::send_avail_p ( ) [inline, inherited]

Definition at line 204 of file ICState.hh.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 324 of file IIIMP_ICState.cpp.

{
    bool result = false;

    // Send TRIGGER_OFF_NOTIFY to current language engine
    get_ichandler()->toggle_conversion(get_imlexec(), false);
    pshared->conversion_mode = false;

    const ICAttribute& attr = convert_iiimp_icattr(pmes->v.seticvalues.attr_list);
    result = get_ichandler()->set_icattr(attr);

    preply = iiimp_seticvalues_reply_new(get_iiimptrans()->get_data_s(),
                                    get_im_id(),
                                    get_ic_id());
    result = dealing() && result;
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 13 of file IIIMP_ICState.cpp.

{
    IIIMP_ICState_REQUESTED *picsr = new IIIMP_ICState_REQUESTED(this);
    // TODO: throw memory error.
    change_state(*picsr, false);
    return picsr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool IIIMP_ICState_REQUESTED::state_send_available_p ( ) [inline, private, virtual]

Reimplemented from IIIMP_ICState.

Definition at line 111 of file IIIMP_ICState.hh.

    { return true; }

Reimplemented from ICState.

Definition at line 858 of file IIIMP_ICState.cpp.

{
    IIIMP_message *pmes = iiimp_status_done_new(get_iiimptrans()->get_data_s(),
                                          get_im_id(),
                                          get_ic_id());
    if (!send(pmes, true)) return -1;
    pshared->status = false;

    return wait(IM_STATUS_DONE_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

Reimplemented from ICState.

Definition at line 820 of file IIIMP_ICState.cpp.

{
    IIIMP_message *pmes = iiimp_status_start_new(get_iiimptrans()->get_data_s(),
                                           get_im_id(),
                                           get_ic_id());
    if (!send(pmes, true)) return -1;
    pshared->status = true;

    return wait(IM_STATUS_START_REPLY) ? 0 : -1;
}

Here is the call graph for this function:

bool ICState::substatep ( ) const [inline, inherited]

Definition at line 219 of file ICState.hh.

    { return (pbase_state != this); }

Here is the caller graph for this function:

Reimplemented from ICState.

Definition at line 682 of file IIIMP_ICState.cpp.

{
    LOG_DEBUG("Toggle client conversion mode to %s.",
             flag ? "true" : "false");
    if (conversion_enable_p() != flag) {
       IIIMP_message *pmes = iiimp_trigger_notify_new(get_iiimptrans()->get_data_s(),
                                                 get_im_id(),
                                                 get_ic_id(),
                                                 flag ? 0 : 1);
       if (!send(pmes, true)) return -1;
       pshared->conversion_mode = flag;

       return wait(IM_TRIGGER_NOTIFY_REPLY) ? 0 : -1;
    }
    return 0;
}

Here is the call graph for this function:

Definition at line 360 of file IIIMP_ICState.cpp.

{
    bool result = get_ichandler()->toggle_focus(get_imlexec(), flag);

    if (flag)
       preply = iiimp_seticfocus_reply_new(get_iiimptrans()->get_data_s(),
                                       get_im_id(),
                                       get_ic_id());
    else
       preply = iiimp_unseticfocus_reply_new(get_iiimptrans()->get_data_s(),
                                         get_im_id(),
                                         get_ic_id());

    result = dealing() && result;
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 345 of file IIIMP_ICState.cpp.

{
    bool result = get_ichandler()->toggle_conversion(get_imlexec(), flag);
    pshared->conversion_mode = flag;
    preply = iiimp_trigger_notify_reply_new(get_iiimptrans()->get_data_s(),
                                       get_im_id(),
                                       get_ic_id());

    result = dealing() && result;
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool IIIMP_ICState_REQUESTED::wait ( int  opcode) [private]

Definition at line 286 of file IIIMP_ICState.cpp.

{
    IIIMP_ICState_WAITING *picsw = new IIIMP_ICState_WAITING(this, opcode);
    // TODO: throw memory error.
    change_state(*picsw, false);
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool IIIMP_ICState_REQUESTED::wait_aux ( int  opcode,
int  index,
const u16string imname 
) [private]

Definition at line 297 of file IIIMP_ICState.cpp.

{
    IIIMP_ICState_WAITING *picsw;
    picsw = new IIIMP_ICState_WAITING(this, opcode,
                                  index, imname);
    // TODO: throw memory error.
    change_state(*picsw, false);
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class IIIMP_hotkey [friend, inherited]

Definition at line 92 of file IIIMP_ICState.hh.


Member Data Documentation

IIIMP_hotkey* IIIMP_ICState::ihk [protected, inherited]

Definition at line 35 of file IIIMP_ICState.hh.

Definition at line 98 of file IIIMP_ICState.hh.

Definition at line 115 of file IIIMP_ICState.hh.

SharedState* IIIMP_ICState::pshared [protected, inherited]

Reimplemented from ICState.

Definition at line 34 of file IIIMP_ICState.hh.


The documentation for this class was generated from the following files: