diff options
| author | eunhhu <[email protected]> | 2026-10-18 20:54:17 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-18 20:54:17 +0100 |
| commit | 4d9598e7d0d6d45bf3db9305d365bd2967481bcd (patch) | |
| tree | 59a1b7c945eef69bf9098523c33dc3b8c29c1312 /surfaces/web.c | |
| parent | 991403f164bef7dcf07b053900367a8f0a60ae6c (diff) | |
| download | vega-4d9598e7d0d6d45bf3db9305d365bd2967481bcd.tar.gz vega-4d9598e7d0d6d45bf3db9305d365bd2967481bcd.zip | |
Send every input as a message (Pure 027's 4d): keys, text, timers, frames and pointing go to the inputs bound to them; a key's press then its release when a message takes it; vega_frame sends dt 1/60 to the frame input, deferring the save as frames were; a table's pointer is the input pointing at it, sent the item's position; a key's handler found by its input's number
Diffstat (limited to 'surfaces/web.c')
| -rw-r--r-- | surfaces/web.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/surfaces/web.c b/surfaces/web.c index dfa9470..4e81614 100644 --- a/surfaces/web.c +++ b/surfaces/web.c @@ -160,9 +160,9 @@ static void screen_json(Buffer *b, PureApp *app, const VegaScreen *screen, size_ puts_(b, "],\"keys\":["); comma = false; for (uint32_t i = 0; i < m->inputs; ++i) { - if (m->input[i].kind != PURE_KIND_KEY) continue; + if (m->input[i].binding != PURE_BIND_PRESS) continue; bool bound = false; - for (uint32_t h = 0; h < m->handlers && !bound; ++h) bound = m->handler[h].event == 1 + 2 * i; + for (uint32_t h = 0; h < m->handlers && !bound; ++h) bound = m->handler[h].event == i; if (!bound) continue; puts_(b, comma ? ",{\"input\":" : "{\"input\":"); json_name(b, m->input_names[i]); @@ -437,13 +437,13 @@ int vega_web(PureApp *app, const VegaScreen *screen, const char *listen_on, unsi fds[count] = (struct pollfd){c->fd, (short)(POLLIN | (c->out_at < c->out.used ? POLLOUT : 0)), 0}; slot[count++] = i; } - int timeout = ticked ? 0 : screen->ticks ? 33 : reload ? 200 : 1000; + int timeout = ticked ? 0 : screen->frame >= 0 ? 33 : reload ? 200 : 1000; if (due >= 0 && due < timeout) timeout = (int)due; int ready = poll(fds, count, timeout); if (ready < 0 && errno != EINTR) break; bool changed = ticked; app->now = vega_now(); /* what the events of this round see */ - if (ready == 0 && screen->ticks) changed = pure_app_frame(app) == PURE_OK; + if (ready == 0 && screen->frame >= 0) changed = vega_frame(app, screen); if (reload && reload()) { /* a new module: every page draws it */ changed = true; vega_timers_start(&timers, app->module, vega_clock()); |
