Beispiel #1
0
void Connection::xim_unset_ic_focus(RxPacket *p)
{
    C16 imid;
    XimIM *im;
    imid = p->getC16();
    im = get_im_by_id(imid);
    im->unset_ic_focus(p->getC16());
}
Beispiel #2
0
void Connection::xim_create_ic(RxPacket *p)
{
    XimIM *im;
    C16 imid;
    imid = p->getC16();
    p->rewind();
    im = get_im_by_id(imid);
    im->create_ic(p);
}
Beispiel #3
0
void Connection::xim_get_ic_values(RxPacket *p)
{
    C16 imid;
    imid = p->getC16();
    p->rewind();
    XimIM *im;
    im = get_im_by_id(imid);
    im->get_ic_values(p);
}
Beispiel #4
0
void Connection::xim_destroy_ic(RxPacket *p)
{
    C16 imid;
    C16 icid;
    XimIM *im;
    imid = p->getC16();
    icid = p->getC16();
    im = get_im_by_id(imid);
    im->destroy_ic(icid);
}
Beispiel #5
0
void Connection::OnSend()
{
    std::list<C16>::iterator i;
    for (i = mCreatedIm.begin(); i != mCreatedIm.end(); ++i) {
	XimIM *im;
	im = get_im_by_id(*i);
	if (im)
	    im->onSendPacket();
    }
}
Beispiel #6
0
XimIC *Connection::get_ic(RxPacket *p)
{
    C16 imid, icid;
    XimIM *im;

    imid = p->getC16();
    icid = p->getC16();
    p->rewind();
    im = get_im_by_id(imid);
    return im->get_ic_by_id(icid);
}
Beispiel #7
0
void close_im(C16 id)
{
    XimIM *im;

    im = get_im_by_id(id);
    if (im)
	delete im;

    std::map<C16, XimIM *>::iterator it;
    it = g_ims.find(id);
    if (it != g_ims.end())
	g_ims.erase(it);
}
Beispiel #8
0
keyState::keyState(XimIC *ic)
{
    XimIM *im;
    DefTree *top;

    mModState = 0;
    mIc = ic;

    im = get_im_by_id(mIc->get_imid());
    top = im->get_compose_tree();

    mCompose = new Compose(top, mIc);
}
Beispiel #9
0
void Connection::xim_forward_event(RxPacket *p)
{
    C16 imid, icid;
    XimIM *im;
    
    imid = p->getC16();
    icid = p->getC16();
    p->rewind();
    im = get_im_by_id(imid);
    if (hasSyncFlag()) {
	if (is_xim_sync_reply_timeout()) {
	    // XIM protocol error?
	    push_error_packet(imid, icid, ERR_BadProtocol, "Bad Protocol");
	    clear_pending_queue();
	    unsetSyncFlag();
	}
    }
    im->forward_event(p);
}
Beispiel #10
0
void Connection::xim_get_im_values(RxPacket *p)
{
    int l, i;
    C16 imid;
    TxPacket *t;
    t = createTxPacket(XIM_GET_IM_VALUES_REPLY, 0);
    imid = p->getC16(); // input-method id
    l = p->getC16() / 2; // number

    int *ra = (int *)alloca(sizeof(int) * l);
    int rlen = 0;
    for (i = 0; i < l; i++) {
	ra[i] = p->getC16();
	rlen += 4;
    }

    // XIMATTRIBUTE
    C16 nr_style;
    struct input_style *is = get_im_by_id(imid)->getInputStyles();
    for (nr_style = 0; is[nr_style].style; nr_style++) {
	;
    }

    // since only one IMAttribute...
    t->pushC16(imid);
    t->pushC16((C16)(8 + nr_style * 4));

    t->pushC16(0); // attribute id
    t->pushC16((C16)(4 + nr_style * 4)); // length

    t->pushC16(nr_style); // number
    t->pushC16(0);
    for (i = 0; i < nr_style; i++) {
	t->pushC32(is[i].x_style);
    }

    push_packet(t);
}
Beispiel #11
0
void Connection::xim_encoding_negotiation(RxPacket *p)
{
    TxPacket *t;
    t = createTxPacket(XIM_ENCODING_NEGOTIATION_REPLY, 0);
    C16 l, index;
    int i, m, s;
    C16 imid, idx;
    char buf[32];
    XimIM *im;

    imid = p->getC16(); // m_imid
    l = p->getC16();
    im = get_im_by_id(imid);
  
    index = 0;
    for (m = 0, s = 0, idx = 0; m < l; m += (s + 1), idx++) {
	s = p->getStr8Len();

	for (i= 0; i < 32; i++) {
	    buf[i] = 0;
	}
	p->getStr8(buf);

	// use COMPOUND_TEXT
	if (!strcmp("COMPOUND_TEXT", buf))
	    index = idx;
	else {
	    if (im)
		im->set_encoding(buf);
	}
    }

    t->pushC16(imid);
    t->pushC16(0);
    t->pushC16(index);
    t->pushC16(0);
    push_packet(t);
}
Beispiel #12
0
void InputContext::switch_app_global_im(const char *name)
{
    get_im_by_id(this->get_ic()->get_imid())->changeContext(name);
}