engine: route popup preedit by client capability

This commit is contained in:
2026-08-14 17:02:46 +09:00
parent c1b1b7016e
commit 2376035524
10 changed files with 81 additions and 28 deletions

View File

@@ -2,9 +2,9 @@
#include "fn.h"
static Im im;
static int popup = 0;
static int visible = 0;
static void *activeowner;
static int activecap;
static Caret caret;
static void dictqmap(Im*);
static void dictqjp(Im*);
@@ -105,7 +105,7 @@ show(void)
pre = search.text;
else
impre(&pre);
if(popup){
if(!(activecap & Cclientpreedit)){
if(search.lang || isjp(&im) || im.l->map == nil ||
!mapget(im.l->map, &pre, &dc.pre))
dc.pre = pre;
@@ -632,11 +632,6 @@ searchkey(u32int ks, u32int mod, Str *com)
startsearch(n, com);
return 1;
}
if(c == 0x10){
popup = !popup;
show();
return 1;
}
endsearch();
if(setlang(c))
return 1;
@@ -725,11 +720,6 @@ keystroke(u32int ks, u32int mod, Str *com)
startsearch(n, com);
return 1;
}
if(c == 0x10){
popup = !popup;
show();
return 1;
}
if(getlang(c) != nil){
if(isjp(&im) && haspre(&im))
commit(com);
@@ -778,6 +768,7 @@ init(void)
memset(&search, 0, sizeof search);
memset(&caret, 0, sizeof caret);
activeowner = nil;
activecap = 0;
visible = 0;
}
@@ -800,6 +791,7 @@ imhandlekey(Keyreq *kr)
if(kr->owner == activeowner){
reset();
activeowner = nil;
activecap = 0;
}
break;
case Keyreset:
@@ -818,6 +810,7 @@ imhandlekey(Keyreq *kr)
if(kr->owner != activeowner){
reset();
activeowner = kr->owner;
activecap = kr->cap;
caret = kr->caret;
}else if(kr->caret.valid)
caret = kr->caret;