popup: show the candidate page
This commit is contained in:
21
win.c
21
win.c
@@ -158,8 +158,9 @@ fill(u32int *buf, int n, u32int color)
|
||||
static void
|
||||
drawkouho(Drawcmd *dc, int n, int w, int h)
|
||||
{
|
||||
int npre, sely, y, i;
|
||||
Str num, *s;
|
||||
char buf[32];
|
||||
int nmark, npre, sely, y, i;
|
||||
Str mark, num, *s;
|
||||
|
||||
if(w <= 0 || w > Imgw || h <= 0 || h > Imgh)
|
||||
return;
|
||||
@@ -178,6 +179,11 @@ drawkouho(Drawcmd *dc, int n, int w, int h)
|
||||
textdraw(img, w, h, 0, y, &num);
|
||||
textdrawfit(img, w, h, 2*Fontsz, y, w - 2*Fontsz, s);
|
||||
}
|
||||
nmark = pagemarker(buf, sizeof buf, dc->first, n, dc->total);
|
||||
if(nmark != 0){
|
||||
sinit(&mark, buf, nmark);
|
||||
textdraw(img, w, h, 0, y, &mark);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -201,8 +207,10 @@ winhide(void)
|
||||
static int
|
||||
winshow(Drawcmd *dc)
|
||||
{
|
||||
char buf[32];
|
||||
vlong width;
|
||||
int npre, px, py, w, h, i, n, maxw;
|
||||
int nmark, npre, px, py, w, h, i, n, maxw;
|
||||
Str mark;
|
||||
u32int vals[4];
|
||||
xcb_query_pointer_reply_t *ptr;
|
||||
xcb_query_pointer_cookie_t cookie;
|
||||
@@ -215,7 +223,12 @@ winshow(Drawcmd *dc)
|
||||
maxw = textwidth(&dc->pre);
|
||||
for(i = 0; i < n; i++)
|
||||
maxw = max(maxw, textwidth(&dc->kouho[i]));
|
||||
vals[3] = h = (n + npre) * Fontsz;
|
||||
nmark = pagemarker(buf, sizeof buf, dc->first, n, dc->total);
|
||||
if(nmark != 0){
|
||||
sinit(&mark, buf, nmark);
|
||||
maxw = max(maxw, textwidth(&mark));
|
||||
}
|
||||
vals[3] = h = (n + npre + (nmark != 0)) * Fontsz;
|
||||
width = (vlong)maxw + 3*Fontsz;
|
||||
vals[2] = w = min(min(max(width, 1), Imgw), scr->width_in_pixels);
|
||||
if(w <= 0 || w > Imgw || h <= 0 || h > Imgh)
|
||||
|
||||
Reference in New Issue
Block a user