ibus: keep only the content purpose; nothing read the hints
This commit is contained in:
13
ibus.c
13
ibus.c
@@ -35,7 +35,6 @@ struct Ictx
|
||||
int focused;
|
||||
u32int cap;
|
||||
u32int purpose;
|
||||
u32int hints;
|
||||
int clientcommitpreedit;
|
||||
Caret caret;
|
||||
};
|
||||
@@ -671,11 +670,12 @@ getproperty(DBusMessage *m, const char **iface, const char **name,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ContentType is (purpose, hints); only the purpose matters to us. */
|
||||
static int
|
||||
getcontent(DBusMessageIter *value, u32int *purpose, u32int *hints)
|
||||
getcontent(DBusMessageIter *value, u32int *purpose)
|
||||
{
|
||||
DBusMessageIter st;
|
||||
dbus_uint32_t p, h;
|
||||
dbus_uint32_t p;
|
||||
|
||||
if(dbus_message_iter_get_arg_type(value) != DBUS_TYPE_STRUCT)
|
||||
return 0;
|
||||
@@ -686,11 +686,9 @@ getcontent(DBusMessageIter *value, u32int *purpose, u32int *hints)
|
||||
if(!dbus_message_iter_next(&st) ||
|
||||
dbus_message_iter_get_arg_type(&st) != DBUS_TYPE_UINT32)
|
||||
return 0;
|
||||
dbus_message_iter_get_basic(&st, &h);
|
||||
if(dbus_message_iter_next(&st))
|
||||
return 0;
|
||||
*purpose = p;
|
||||
*hints = h;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -701,7 +699,7 @@ handlepropertyset(DBusConnection *c, DBusMessage *m, Ictx *ctx)
|
||||
const char *iface, *name;
|
||||
DBusMessageIter value, st;
|
||||
dbus_bool_t b;
|
||||
u32int purpose, hints;
|
||||
u32int purpose;
|
||||
Keyres res;
|
||||
int washidden;
|
||||
|
||||
@@ -712,12 +710,11 @@ handlepropertyset(DBusConnection *c, DBusMessage *m, Ictx *ctx)
|
||||
return handleerror(c, m, DBUS_ERROR_UNKNOWN_INTERFACE,
|
||||
"unknown property interface");
|
||||
if(strcmp(name, "ContentType") == 0){
|
||||
if(!getcontent(&value, &purpose, &hints))
|
||||
if(!getcontent(&value, &purpose))
|
||||
return handleerror(c, m, DBUS_ERROR_INVALID_ARGS,
|
||||
"ContentType expects (uu)");
|
||||
washidden = hidden(ctx);
|
||||
ctx->purpose = purpose;
|
||||
ctx->hints = hints;
|
||||
if(ctx->focused && !washidden && hidden(ctx)){
|
||||
sendrequest(ctx, Keyreset, 0, 0, &res);
|
||||
if(clientpreedit(ctx))
|
||||
|
||||
@@ -285,12 +285,11 @@ cleanup:
|
||||
void
|
||||
ibus_private_input_policy(struct ct *t)
|
||||
{
|
||||
static const struct { u32int purpose, hints; int want; } cases[] = {
|
||||
{ 0, 0, 0 },
|
||||
{ Ibuspurposepassword, 0, 1 },
|
||||
{ Ibuspurposepin, 0, 1 },
|
||||
{ 0, 1<<11, 0 },
|
||||
{ 37, 1<<20, 0 },
|
||||
static const struct { u32int purpose; int want; } cases[] = {
|
||||
{ 0, 0 },
|
||||
{ Ibuspurposepassword, 1 },
|
||||
{ Ibuspurposepin, 1 },
|
||||
{ 37, 0 },
|
||||
};
|
||||
Ibusfix f;
|
||||
Ictx *ctx;
|
||||
@@ -304,14 +303,12 @@ ibus_private_input_policy(struct ct *t)
|
||||
goto cleanup;
|
||||
for(i = 0; i < nelem(cases); i++){
|
||||
ctx->purpose = cases[i].purpose;
|
||||
ctx->hints = cases[i].hints;
|
||||
CT_EQ_INT(t, cases[i].want, hidden(ctx));
|
||||
}
|
||||
|
||||
ctx->focused = 1;
|
||||
ctx->cap = Cclientpreedit;
|
||||
ctx->purpose = 0;
|
||||
ctx->hints = 0;
|
||||
contextkey(t, &f, ctx, 'n', Testctrlmask);
|
||||
res = contextkey(t, &f, ctx, 'k', 0);
|
||||
checkstr(t, "preedit", "k", &res.preedit);
|
||||
@@ -323,7 +320,6 @@ ibus_private_input_policy(struct ct *t)
|
||||
checkenginepreedit(t, "k");
|
||||
|
||||
ctx->purpose = 0;
|
||||
ctx->hints = 1<<11;
|
||||
res = contextkey(t, &f, ctx, 'a', 0);
|
||||
checkstr(t, "preedit", "か", &res.preedit);
|
||||
cleanup:
|
||||
|
||||
Reference in New Issue
Block a user