bloodshed everywhere etc
This commit is contained in:
parent
700f7a9ed2
commit
1bd2627707
@ -39,7 +39,6 @@ static char *embed;
|
|||||||
static int bh, mw, mh;
|
static int bh, mw, mh;
|
||||||
static int inputw = 0, promptw;
|
static int inputw = 0, promptw;
|
||||||
static int lrpad; /* sum of left and right padding */
|
static int lrpad; /* sum of left and right padding */
|
||||||
static size_t cursor;
|
|
||||||
static struct item *items = NULL;
|
static struct item *items = NULL;
|
||||||
static struct item *matches, *matchend;
|
static struct item *matches, *matchend;
|
||||||
static struct item *prev, *curr, *next, *sel;
|
static struct item *prev, *curr, *next, *sel;
|
||||||
@ -204,19 +203,6 @@ match(void)
|
|||||||
calcoffsets();
|
calcoffsets();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
insert(const char *str, ssize_t n)
|
|
||||||
{
|
|
||||||
if (strlen(text) + n > sizeof text - 1)
|
|
||||||
return;
|
|
||||||
/* move existing text out of the way, insert new text, and update cursor */
|
|
||||||
memmove(&text[cursor + n], &text[cursor], sizeof text - cursor - MAX(n, 0));
|
|
||||||
if (n > 0)
|
|
||||||
memcpy(&text[cursor], str, n);
|
|
||||||
cursor += n;
|
|
||||||
match();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
readstdin(void)
|
readstdin(void)
|
||||||
{
|
{
|
||||||
@ -245,32 +231,6 @@ readstdin(void)
|
|||||||
inputw = items ? TEXTW(items[imax].text) : 0;
|
inputw = items ? TEXTW(items[imax].text) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
run(void)
|
|
||||||
{
|
|
||||||
XEvent ev;
|
|
||||||
|
|
||||||
while (!XNextEvent(dpy, &ev)) {
|
|
||||||
if (XFilterEvent(&ev, win))
|
|
||||||
continue;
|
|
||||||
switch(ev.type) {
|
|
||||||
case DestroyNotify:
|
|
||||||
if (ev.xdestroywindow.window != win)
|
|
||||||
break;
|
|
||||||
cleanup();
|
|
||||||
exit(1);
|
|
||||||
case Expose:
|
|
||||||
if (ev.xexpose.count == 0)
|
|
||||||
drw_map(drw, win, 0, 0, mw, mh);
|
|
||||||
break;
|
|
||||||
case VisibilityNotify:
|
|
||||||
if (ev.xvisibility.state != VisibilityUnobscured)
|
|
||||||
XRaiseWindow(dpy, win);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup(void)
|
setup(void)
|
||||||
{
|
{
|
||||||
@ -437,7 +397,7 @@ main(int argc, char *argv[])
|
|||||||
readstdin();
|
readstdin();
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
run();
|
while(1); // bodge
|
||||||
|
|
||||||
return 1; /* unreachable */
|
return 1; /* unreachable */
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user