Back to index

im-sdk  12.3.91
Public Member Functions | Private Member Functions | Private Attributes | Friends
LEContext Class Reference

#include <LE.hh>

Collaboration diagram for LEContext:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool errorp ()
IMInputContextget_inputcontext ()
iml_if_tget_iml_if ()
iml_desktop_tget_iml_desktop ()
LEBaseget_lebase ()
bool send_event (IMLExec *pimlex, IMInputEvent *pimevent)
bool send_event_getvalues (IMLExec *pimlex, IMInputEvent *pimevent)
bool send_event_getvalues_finished (IMLExec *pimlex)
bool toggle_conversion (IMLExec *pimlex, bool flag)
bool reset (IMLExec *pimlex)
bool toggle_focus (IMLExec *pimlex, bool flag)
void destroy ()
bool destroy (IMLExec *pimlex)
iml_session_tget_iml_session ()

Private Member Functions

bool need_thread_lock_p ()
IMSyncObjectget_leif_sync_object ()
void bind_imlexec (IMLExec *pimlex)
bool set_values (IMArgList args, int num_args)
bool realize ()
bool initialize ()
 LEContext (IMInputContext *pic, LEBase *pbase, iml_if_t *iif)
 ~LEContext ()

Private Attributes

LEBasepbase
IMInputContextpic
iml_if_timl_if
iml_session_ts
iml_desktop_timl_desktop
bool error
bool realized

Friends

class LEBase

Detailed Description

Definition at line 123 of file LE.hh.


Constructor & Destructor Documentation

LEContext::LEContext ( IMInputContext pic,
LEBase pbase,
iml_if_t iif 
) [private]

Definition at line 621 of file LE.cpp.

  :
    pic(x_pic), pbase(x_pbase), iml_if(iif)
{
    s = NULL;
    iml_desktop = NULL;
    realized = false;
    if (initialize())
       error = false;
    else
       error = true;
}

Here is the call graph for this function:

LEContext::~LEContext ( ) [private]

Definition at line 637 of file LE.cpp.

{
    IMConnection *pimc = get_inputcontext()->get_imconnection();
    IMDesktop *pdesk = pimc->get_desktop();

    {
       IMLock lock(get_leif_sync_object());
       if (s) {
           LOG_DEBUG("Destroy session context(%lx)", (long) s);
           if_DestroySC_WithoutDesktopDestruction(s);
       }
    }

    if (iml_desktop)
       pdesk->release_iml_desktop(*this, iml_desktop);

    pbase->remove_lecontext(this);
}

Here is the call graph for this function:


Member Function Documentation

void LEContext::bind_imlexec ( IMLExec pimlex) [private]

Definition at line 411 of file LE.cpp.

{
    // later, we should use TLS or something.
    s->SessionContext = pimlex;
    LOG_DEBUG("Bound imlexec:(%lx -> %lx)", (long) s, (long) pimlex);
}

Here is the caller graph for this function:

Definition at line 574 of file LE.cpp.

{
    bind_imlexec(NULL);
    delete this;
}

Here is the call graph for this function:

bool LEContext::destroy ( IMLExec pimlex)

Definition at line 581 of file LE.cpp.

{
    bind_imlexec(pimlex);
    delete this;
    return true;
}

Here is the call graph for this function:

bool LEContext::errorp ( ) [inline]

Definition at line 148 of file LE.hh.

    { return error; }

Here is the caller graph for this function:

Definition at line 157 of file LE.hh.

    { return iml_desktop; }

Here is the caller graph for this function:

Definition at line 154 of file LE.hh.

    { return iml_if; }

Definition at line 191 of file LE.hh.

    { return s; }

Here is the caller graph for this function:

Definition at line 151 of file LE.hh.

    { return pic; }

Here is the caller graph for this function:

Definition at line 160 of file LE.hh.

    { return pbase; }

Here is the caller graph for this function:

Definition at line 136 of file LE.hh.

    { return pbase->get_leif_sync_object(); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEContext::initialize ( ) [private]

Definition at line 591 of file LE.cpp.

{
    IMConnection *pimc = get_inputcontext()->get_imconnection();
    IMDesktop *pdesk = pimc->get_desktop();

    vector<IMArg> args;
    pdesk->get_iml_desktop_args(args);
    iml_desktop = pdesk->request_iml_desktop(*this);
    if (!iml_desktop) return false;

    {
       IMLock lock(get_leif_sync_object());
       s = iml_construct_session(iml_desktop, &args[0], args.size());
       LOG_DEBUG("Create session context(%lx)", (long) s);
    }
    if (!s) return false;

    add_session_to_desktop(s);

    // inhibit IML inst. issuing.
    bind_imlexec(NULL);
    // Set additional values from the desktop.
    args.clear();
    pdesk->get_lecontext_args(args);
    get_inputcontext()->get_lecontext_args(args);
    if (!set_values(&args[0], args.size())) return false;

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEContext::need_thread_lock_p ( ) [inline, private]

Definition at line 134 of file LE.hh.

    { return pbase->need_thread_lock_p(); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEContext::realize ( ) [private]

Definition at line 444 of file LE.cpp.

{
    if ((!realized) && (!pbase->xsunim_p())) {
       IMArg arg;
       IMSetArg(arg, SC_REALIZE, 0);
       IMLock lock(get_leif_sync_object());
       if (!if_SetSCValues(s, &arg, 1)) return false;
       realized = true;
    }
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEContext::reset ( IMLExec pimlex)

Definition at line 540 of file LE.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEContext::send_event ( IMLExec pimlex,
IMInputEvent pimevent 
)

Definition at line 457 of file LE.cpp.

{
//    IMKeyEventStruct *pkey;

    bind_imlexec(pimlex);
    IMLock lock(get_leif_sync_object(), need_thread_lock_p());
    /* Assume that only one event will be sent at a time */
//    pkey = ((IMKeyListEvent *)pimevent)->keylist;
    /* if KeyRelease is interested, send the release event. Otherwise, send only the press event */
//    if ((pkey && pkey->keyType == IM_KEY_PRESS) || pbase->iml_if->need_keyrelease)
    if ((IM_EventKeyList != pimevent->type) ||
       ((0 == (IM_KEY_RELEASE_MASK & pimevent->keylist.keylist->modifier)) ||
        pbase->iml_if->need_keyrelease))
       if_SendEvent(s, pimevent);

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEContext::send_event_getvalues ( IMLExec pimlex,
IMInputEvent pimevent 
)

Definition at line 479 of file LE.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 492 of file LE.cpp.

{
    bind_imlexec(pimlex);
    IMLock lock(get_leif_sync_object(), need_thread_lock_p());
    if (s)
       {
           s->If->m->iml_delete(s);
       }

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEContext::set_values ( IMArgList  args,
int  num_args 
) [private]

Definition at line 421 of file LE.cpp.

{
    /* called from iiimd core, but ignore */
    if (!pbase->xsunim_p()
       && (num_args == 1)
       && (args[0].id == SC_REALIZE)) {
       return true;
    }

    /* at engine switching on en_US.UTF-8, SC_TRIGGER_ON_NOTIFY require
       realization. */
    if ((num_args == 1) && (args[0].id == SC_TRIGGER_ON_NOTIFY)) {
       if (!realize()) return false;
    }

    IMLock lock(get_leif_sync_object());
    return if_SetSCValues(s, args, num_args);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEContext::toggle_conversion ( IMLExec pimlex,
bool  flag 
)

Definition at line 507 of file LE.cpp.

{
    IMArg arg;
    ICAttribute &attr = (ICAttribute &) pic->get_icattr();
    const u16string preq_imename = attr.get_inputengine();
    const UTFCHAR *imename = preq_imename.c_str();

    bind_imlexec(pimlex);

    /* 
     * tell LE to switch to the target input method engine.
     */
    if (imename && *imename)
      {
        IMSetArg (arg, SC_CLIENT_INPUT_METHOD_ENGINE, imename);
        set_values (&arg, 1);

       /* reset the input engine */
       attr.set_inputengine (u16string (""));
      }

    if (flag)
       IMSetArg(arg, SC_TRIGGER_ON_NOTIFY, 0);
    else
       IMSetArg(arg, SC_TRIGGER_OFF_NOTIFY, 0);

    return set_values(&arg, 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEContext::toggle_focus ( IMLExec pimlex,
bool  flag 
)

Definition at line 552 of file LE.cpp.

{
    bind_imlexec(pimlex);

    /* Before set forcus, require realization. */
    if (flag && !pbase->xsunim_p()) {
       if (!realize()) return false;
    }

    IMLock lock(get_leif_sync_object(), need_thread_lock_p());
    if (flag)
       if_SetSCFocus(s);
    else
       if_UnsetSCFocus(s);

    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 LEBase [friend]

Definition at line 203 of file LE.hh.


Member Data Documentation

bool LEContext::error [private]

Definition at line 132 of file LE.hh.

Definition at line 131 of file LE.hh.

Definition at line 129 of file LE.hh.

Definition at line 127 of file LE.hh.

Definition at line 128 of file LE.hh.

bool LEContext::realized [private]

Definition at line 145 of file LE.hh.

Definition at line 130 of file LE.hh.


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