summaryrefslogtreecommitdiff
path: root/src/Kind.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Kind.zig')
-rw-r--r--src/Kind.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Kind.zig b/src/Kind.zig
index 66e37852..9785a1a3 100644
--- a/src/Kind.zig
+++ b/src/Kind.zig
@@ -626,7 +626,10 @@ pub fn step(p: *Pardes) void {
// counted by them.
const flags = (if (focused) c.PA_FOCUSED else 0) | (if (slot.painted and caps(p, slot).v22) c.PA_FRAMED else 0);
slot.painted = false;
- if (slot.ops) |o| cl.ret = @bitCast(o.tick.?(slot.st, now, flags));
+ // The clock's now for a tick after an event (a key, a focus): the
+ // stepped frame lags it while the next wake is still to come.
+ const at = if (slot.next_tick == 1) @max(now, p.clock.now_ns) else now;
+ if (slot.ops) |o| cl.ret = @bitCast(o.tick.?(slot.st, at, flags));
slot.next_tick = @bitCast(cl.end(prev).ret);
p.needs_frame = true;
repaint(p, slot, id);