diff --git a/src/os/gfx/os_gfx.h b/src/os/gfx/os_gfx.h index 57830c9e..0eacd1c2 100644 --- a/src/os/gfx/os_gfx.h +++ b/src/os/gfx/os_gfx.h @@ -63,6 +63,7 @@ struct OS_Event { OS_Event *next; OS_Event *prev; + U64 timestamp_us; OS_Handle window; OS_EventKind kind; OS_EventFlags flags; diff --git a/src/os/gfx/win32/os_gfx_win32.c b/src/os/gfx/win32/os_gfx_win32.c index f81dc89e..8332e1d1 100644 --- a/src/os/gfx/win32/os_gfx_win32.c +++ b/src/os/gfx/win32/os_gfx_win32.c @@ -111,6 +111,7 @@ w32_push_event(OS_EventKind kind, W32_Window *window) { OS_Event *result = push_array(w32_event_arena, OS_Event, 1); DLLPushBack(w32_event_list.first, w32_event_list.last, result); + result->timestamp_us = os_now_microseconds(); result->kind = kind; result->window = os_window_from_w32_window(window); result->flags = os_get_event_flags(); diff --git a/src/raddbg/raddbg.c b/src/raddbg/raddbg.c index f710e0d5..5f4f5320 100644 --- a/src/raddbg/raddbg.c +++ b/src/raddbg/raddbg.c @@ -315,7 +315,14 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data) { arena_clear(leftover_events_arena); leftover_events = os_event_list_copy(leftover_events_arena, &events); - MemoryZeroStruct(&leftover_events); + for(OS_Event *ev = leftover_events.first, *next = 0; ev != 0; ev = next) + { + next = ev->next; + if(ev->timestamp_us+1000000 < os_now_microseconds()) + { + os_eat_event(&leftover_events, ev); + } + } } //- rjf: determine frame time, record into history