fix(popup): raise the popup whenever it is shown

The popup window is created once at startup and only mapped afterwards,
and MapWindow does not restack, so every application window (or WM
frame) opened after the daemon sat above it: candidates and preedit were
invisible in those windows until the daemon restarted. Configure the
window above its siblings on every show. The XIM live test now checks
the popup stacks above a client window created after the daemon.
This commit is contained in:
2026-08-16 20:23:29 +09:00
parent 333300b297
commit f6adb117c9
2 changed files with 41 additions and 3 deletions

View File

@@ -608,6 +608,41 @@ testcallbacks(Display *dpy, XIM im, Window win)
return 1;
}
/*
* The popup is the one viewable override-redirect window on the private
* display; created before the client window, it must still stack above it.
*/
static int
popupabove(Display *dpy, Window client)
{
XWindowAttributes wa;
Window root, parent, *kids;
unsigned i, n;
int64_t deadline;
int above;
deadline = nowms() + Eventtimeout;
for(;;){
above = 0;
root = DefaultRootWindow(dpy);
if(!XQueryTree(dpy, root, &root, &parent, &kids, &n))
return fail("query the window tree");
for(i = 0; i < n; i++){
if(kids[i] == client)
above = 1;
else if(XGetWindowAttributes(dpy, kids[i], &wa) &&
wa.override_redirect && wa.map_state == IsViewable)
break;
}
XFree(kids);
if(i < n)
return above || fail("popup is stacked below the client");
if(leftms(deadline) == 0)
return fail("popup did not appear");
pump(dpy, 20);
}
}
static int
testnothing(Display *dpy, XIM im, Window win)
{
@@ -628,6 +663,7 @@ testnothing(Display *dpy, XIM im, Window win)
}
pump(dpy, 100);
if(!sendkey(dpy, ic, win, XK_r, 0, commit, sizeof commit) ||
!popupabove(dpy, win) ||
!sendkey(dpy, ic, win, XK_k, 0, commit, sizeof commit) ||
!sendkey(dpy, ic, win, XK_Return, 0, commit, sizeof commit)){
XDestroyIC(ic);