1
0

bloodshed everywhere etc

This commit is contained in:
Deven Blake 2021-05-11 14:39:51 -04:00
parent 700f7a9ed2
commit 1bd2627707

View File

@ -39,7 +39,6 @@ static char *embed;
static int bh, mw, mh;
static int inputw = 0, promptw;
static int lrpad; /* sum of left and right padding */
static size_t cursor;
static struct item *items = NULL;
static struct item *matches, *matchend;
static struct item *prev, *curr, *next, *sel;
@ -204,19 +203,6 @@ match(void)
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
readstdin(void)
{
@ -245,32 +231,6 @@ readstdin(void)
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
setup(void)
{
@ -437,7 +397,7 @@ main(int argc, char *argv[])
readstdin();
setup();
run();
while(1); // bodge
return 1; /* unreachable */
}