diff --git a/README.md b/README.md index 4bbbc7e..c074a15 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ query; the Hanja dictionary lists one modern Hangul syllable at a time. | XIM PreeditPosition | strans popup | strans popup | | XIM PreeditNothing | strans popup | strans popup | +Each XIM style is offered with StatusNothing and with StatusNone. + XIM text travels as `COMPOUND_TEXT`, which carries any UTF-8. A client that sends `XNSpotLocation` gets the popup at that spot whatever its preedit style; otherwise the popup sits under the focus window, or under the client diff --git a/ibus.c b/ibus.c index 1304bdb..3f6dd13 100644 --- a/ibus.c +++ b/ibus.c @@ -786,9 +786,6 @@ handlecursor(DBusConnection *c, DBusMessage *m, Ictx *ctx) DBUS_TYPE_INVALID)) return handleerror(c, m, DBUS_ERROR_INVALID_ARGS, "SetCursorLocation expects four integers"); - if(w < 0 || h < 0) - return handleerror(c, m, DBUS_ERROR_INVALID_ARGS, - "cursor dimensions must not be negative"); setcursor(ctx, x, y, h); return reply(c, m, DBUS_TYPE_INVALID, nil); } diff --git a/tests/xim_adapter_test.c b/tests/xim_adapter_test.c index 973f7df..7777b4b 100644 --- a/tests/xim_adapter_test.c +++ b/tests/xim_adapter_test.c @@ -632,6 +632,9 @@ xim_adapter_styles(struct ct *t) XCB_IM_PreeditPosition | XCB_IM_StatusNothing, XCB_IM_PreeditCallbacks | XCB_IM_StatusNothing, XCB_IM_PreeditNothing | XCB_IM_StatusNothing, + XCB_IM_PreeditPosition | XCB_IM_StatusNone, + XCB_IM_PreeditCallbacks | XCB_IM_StatusNone, + XCB_IM_PreeditNothing | XCB_IM_StatusNone, }; xcb_im_input_context_t *ic; Ic *state; @@ -651,7 +654,8 @@ xim_adapter_styles(struct ct *t) state = icbindings[0].data; if(!CT_CHECK(t, state != nil && state == ics)) continue; - CT_EQ_INT(t, i == 1 ? Cclientpreedit : 0, state->cap); + CT_EQ_INT(t, want[i] & XCB_IM_PreeditCallbacks ? Cclientpreedit : 0, + state->cap); CT_EQ_PTR(t, ic, state->xic); icunlink(state); free(state); diff --git a/xim.c b/xim.c index 58d1568..ce9aebf 100644 --- a/xim.c +++ b/xim.c @@ -46,6 +46,9 @@ static u32int styles[] = { XCB_IM_PreeditPosition | XCB_IM_StatusNothing, XCB_IM_PreeditCallbacks | XCB_IM_StatusNothing, XCB_IM_PreeditNothing | XCB_IM_StatusNothing, + XCB_IM_PreeditPosition | XCB_IM_StatusNone, + XCB_IM_PreeditCallbacks | XCB_IM_StatusNone, + XCB_IM_PreeditNothing | XCB_IM_StatusNone, }; static void @@ -434,8 +437,8 @@ kpress(Ic *state, xcb_key_press_event_t *ev) ; else if(composed){ /* The event holds the last key of the sequence, not its result. */ - n = xkb_keysym_to_utf8(sym, buf, sizeof buf); - commit(state, buf, max(n - 1, 0)); + n = xkb_compose_state_get_utf8(compose, buf, sizeof buf); + commit(state, buf, min(n, (int)sizeof buf - 1)); }else xcb_im_forward_event(xim, state->xic, ev); xcb_flush(conn); @@ -473,8 +476,7 @@ iccreate(xcb_im_client_t *client, xcb_im_input_context_t *ic) state = emalloc(sizeof(Ic)); state->xic = ic; state->client = client; - if(xcb_im_input_context_get_input_style(ic) == - (XCB_IM_PreeditCallbacks | XCB_IM_StatusNothing)) + if(xcb_im_input_context_get_input_style(ic) & XCB_IM_PreeditCallbacks) state->cap = Cclientpreedit; state->next = ics; ics = state;