From 583bcd490a055f013b244a6cd7e6ecb6765260e2 Mon Sep 17 00:00:00 2001 From: katalx Date: Wed, 28 Jan 2026 20:46:43 -0500 Subject: read stdin into opt array --- ui.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ui.c') diff --git a/ui.c b/ui.c index aa3bad6..26bf56a 100644 --- a/ui.c +++ b/ui.c @@ -51,7 +51,7 @@ ui_init(int argc, char **argv) XSetBackground(dsp, gc, bg); XSetForeground(dsp, gc, fg); - XSelectInput(dsp, win, ButtonPressMask | KeyPressMask | ExposureMask); + XSelectInput(dsp, win, KeyPressMask | ExposureMask); XMapRaised(dsp, win); freg = XLoadFont(dsp, "-*-new century schoolbook-medium-r-*-*-24-*-*-*-*-*-*-*"); @@ -103,7 +103,7 @@ ui_wait_event(UiEvent *e) } void -ui_draw(Str input, int inpi, int seli, Str *optv, int optc) +ui_draw(Str input, int inpi, int seli, UiOpts o) { XWindowAttributes attr; XClearWindow(dsp, win); @@ -120,23 +120,23 @@ ui_draw(Str input, int inpi, int seli, Str *optv, int optc) /* draw options */ XSetFont(dsp, gc, freg); - for (int i = 0; i < optc; i++) { + for (int i = 0; i < o.n; i++) { if (i == seli) { int w = XTextWidth(XQueryFont(dsp, XGContextFromGC(gc)), - optv[i].s, optv[i].n); + o.v[i].s, o.v[i].n); XFillRectangle(dsp, win, gc, 16, 28 + i * 24 + 8, w, 24); XSetForeground(dsp, gc, bg); XDrawString(dsp, win, gc, 16, 48 + i * 24 + 8, - optv[i].s, optv[i].n); + o.v[i].s, o.v[i].n); XSetForeground(dsp, gc, fg); } else { XDrawString(dsp, win, gc, 16, 48 + i * 24 + 8, - optv[i].s, optv[i].n); + o.v[i].s, o.v[i].n); } } } -- cgit v1.2.3