Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-01-07 22:01:07 +00:00
2 changed files with 12 additions and 7 deletions

16
input.c
View File

@@ -63,7 +63,7 @@ struct input_request {
struct input_ctx *ictx; struct input_ctx *ictx;
enum input_request_type type; enum input_request_type type;
time_t t; uint64_t t;
enum input_end_type end; enum input_end_type end;
int idx; int idx;
@@ -72,7 +72,7 @@ struct input_request {
TAILQ_ENTRY(input_request) entry; TAILQ_ENTRY(input_request) entry;
TAILQ_ENTRY(input_request) centry; TAILQ_ENTRY(input_request) centry;
}; };
#define INPUT_REQUEST_TIMEOUT 2 #define INPUT_REQUEST_TIMEOUT 500
/* Input parser cell. */ /* Input parser cell. */
struct input_cell { struct input_cell {
@@ -3243,7 +3243,7 @@ input_request_timer_callback(__unused int fd, __unused short events, void *arg)
{ {
struct input_ctx *ictx = arg; struct input_ctx *ictx = arg;
struct input_request *ir, *ir1; struct input_request *ir, *ir1;
time_t t = time(NULL); uint64_t t = get_timer();
TAILQ_FOREACH_SAFE(ir, &ictx->requests, entry, ir1) { TAILQ_FOREACH_SAFE(ir, &ictx->requests, entry, ir1) {
if (ir->t >= t - INPUT_REQUEST_TIMEOUT) if (ir->t >= t - INPUT_REQUEST_TIMEOUT)
@@ -3260,7 +3260,7 @@ input_request_timer_callback(__unused int fd, __unused short events, void *arg)
static void static void
input_start_request_timer(struct input_ctx *ictx) input_start_request_timer(struct input_ctx *ictx)
{ {
struct timeval tv = { .tv_sec = 0, .tv_usec = 500000 }; struct timeval tv = { .tv_sec = 0, .tv_usec = 100000 };
event_del(&ictx->request_timer); event_del(&ictx->request_timer);
event_add(&ictx->request_timer, &tv); event_add(&ictx->request_timer, &tv);
@@ -3275,7 +3275,7 @@ input_make_request(struct input_ctx *ictx, enum input_request_type type)
ir = xcalloc (1, sizeof *ir); ir = xcalloc (1, sizeof *ir);
ir->type = type; ir->type = type;
ir->ictx = ictx; ir->ictx = ictx;
ir->t = time(NULL); ir->t = get_timer();
if (++ictx->request_count == 1) if (++ictx->request_count == 1)
input_start_request_timer(ictx); input_start_request_timer(ictx);
@@ -3396,7 +3396,11 @@ input_request_reply(struct client *c, enum input_request_type type, void *data)
input_free_request(ir); input_free_request(ir);
continue; continue;
} }
if (type == INPUT_REQUEST_PALETTE && pd->idx == ir->idx) { if (type == INPUT_REQUEST_PALETTE) {
if (pd->idx != ir->idx) {
input_free_request(ir);
continue;
}
found = ir; found = ir;
break; break;
} }

View File

@@ -956,7 +956,8 @@ partial_key:
if (delay == 0) if (delay == 0)
delay = 1; delay = 1;
if ((tty->flags & (TTY_WAITFG|TTY_WAITBG) || if ((tty->flags & (TTY_WAITFG|TTY_WAITBG) ||
(tty->flags & TTY_ALL_REQUEST_FLAGS) != TTY_ALL_REQUEST_FLAGS)) { (tty->flags & TTY_ALL_REQUEST_FLAGS) != TTY_ALL_REQUEST_FLAGS) ||
!TAILQ_EMPTY(&c->input_requests)) {
log_debug("%s: increasing delay for active query", c->name); log_debug("%s: increasing delay for active query", c->name);
if (delay < 500) if (delay < 500)
delay = 500; delay = 500;