popup: place and bound the input panel
This commit is contained in:
10
win.c
10
win.c
@@ -161,6 +161,8 @@ drawkouho(Drawcmd *dc, int n, int w, int h)
|
||||
int npre, sely, y, i;
|
||||
Str num, *s;
|
||||
|
||||
if(w <= 0 || w > Imgw || h <= 0 || h > Imgh)
|
||||
return;
|
||||
fill(img, w * h, Colbg);
|
||||
npre = dc->pre.n != 0;
|
||||
if(npre)
|
||||
@@ -174,13 +176,15 @@ drawkouho(Drawcmd *dc, int n, int w, int h)
|
||||
sclear(&num);
|
||||
sputr(&num, '1' + i + Asciitofull);
|
||||
textdraw(img, w, h, 0, y, &num);
|
||||
textdraw(img, w, h, 2*Fontsz, y, s);
|
||||
textdrawfit(img, w, h, 2*Fontsz, y, w - 2*Fontsz, s);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
putimage(int w, int h)
|
||||
{
|
||||
if(w <= 0 || w > Imgw || h <= 0 || h > Imgh)
|
||||
return;
|
||||
xcb_put_image(conn, XCB_IMAGE_FORMAT_Z_PIXMAP, pix, gc,
|
||||
w, h, 0, 0, 0, depth, w * h * 4, (u8int*)img);
|
||||
/* The retained background pixmap lets the server repaint exposures. */
|
||||
@@ -213,7 +217,9 @@ winshow(Drawcmd *dc)
|
||||
maxw = max(maxw, textwidth(&dc->kouho[i]));
|
||||
vals[3] = h = (n + npre) * Fontsz;
|
||||
width = (vlong)maxw + 3*Fontsz;
|
||||
vals[2] = w = min(max(width, 1), Imgw);
|
||||
vals[2] = w = min(min(max(width, 1), Imgw), scr->width_in_pixels);
|
||||
if(w <= 0 || w > Imgw || h <= 0 || h > Imgh)
|
||||
return 0;
|
||||
px = py = 0;
|
||||
if(!dc->caret.valid){
|
||||
cookie = xcb_query_pointer(conn, scr->root);
|
||||
|
||||
Reference in New Issue
Block a user