diff --git a/dat.h b/dat.h index 2b8c14f..581302a 100644 --- a/dat.h +++ b/dat.h @@ -29,6 +29,11 @@ enum Maxkouho = 128, Maxdisp = 9, + /* Content purposes whose keys the engine never sees; IBus and + * text-input-v3 number them alike, both after GTK. */ + Purposepassword = 8, + Purposepin = 9, + Colfg = 0x000000, Colbg = 0xffffff, Colsep = 0xd0d0d0, diff --git a/ibus.c b/ibus.c index 6456f9c..63a1106 100644 --- a/ibus.c +++ b/ibus.c @@ -16,8 +16,6 @@ enum Relmask = 1<<30, /* IBus wire constants; the daemon does not link libibus. */ Ibuscappreedit = 1<<0, - Ibuspurposepassword = 8, - Ibuspurposepin = 9, Ibusattrunderline = 1, Ibusunderlinesingle = 1, Ibuspreeditclear = 0, @@ -313,8 +311,8 @@ sendrequest(Ictx *ctx, int op, u32int ks, u32int mod, Keyres *res) static int hidden(Ictx *ctx) { - return ctx->purpose == Ibuspurposepassword || - ctx->purpose == Ibuspurposepin; + return ctx->purpose == Purposepassword || + ctx->purpose == Purposepin; } static void diff --git a/tests/ibus_test.c b/tests/ibus_test.c index 17b46d1..ca04b7f 100644 --- a/tests/ibus_test.c +++ b/tests/ibus_test.c @@ -213,8 +213,8 @@ ibus_private_input_policy(struct ct *t) { static const struct { u32int purpose; int want; } cases[] = { { 0, 0 }, - { Ibuspurposepassword, 1 }, - { Ibuspurposepin, 1 }, + { Purposepassword, 1 }, + { Purposepin, 1 }, { 37, 0 }, }; Ibusfix f; @@ -239,7 +239,7 @@ ibus_private_input_policy(struct ct *t) contextkey(t, &f, ctx, 'n', Testctrlmask); res = contextkey(t, &f, ctx, 'k', 0); checkstr(t, "preedit", "k", &res.preedit); - ctx->purpose = Ibuspurposepassword; + ctx->purpose = Purposepassword; memset(&res, 0, sizeof res); CT_CHECK(t, !processkey(ctx, 'x', 0, text, sizeof text, &res)); CT_CHECK(t, !res.eaten); diff --git a/wl.c b/wl.c index f087504..9b1c091 100644 --- a/wl.c +++ b/wl.c @@ -9,16 +9,9 @@ #include "imv2.h" #include "vkv1.h" -/* - * text-input-v3 content purposes whose keys the engine never sees. IBus - * numbers these alike but does not share them: one enum here is cheaper - * than reaching into dat.h and ibus.c both. - */ enum { - Purposepassword = 8, - Purposepin = 9, - Maxcode = 0x300, /* KEY_MAX+1: what evdev can send */ + Maxcode = 0x300, /* KEY_MAX+1: what evdev can send */ }; /*