From 83b04cda47cf67f91816f19b3d28f015df3c8a67 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 18 Apr 2018 21:09:24 -0400 Subject: [PATCH] And added documentation nits and TODOs to the uiTimer() code. --- ui.h | 5 +++++ windows/main.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/ui.h b/ui.h index 3eed0e39..10159331 100644 --- a/ui.h +++ b/ui.h @@ -62,6 +62,11 @@ _UI_EXTERN void uiQuit(void); _UI_EXTERN void uiQueueMain(void (*f)(void *data), void *data); +// TODO standardize the looping behavior return type, either with some enum or something, and the test expressions throughout the code +// TODO figure out what to do about looping and the exact point that the timer is rescheduled so we can document it; see https://github.com/andlabs/libui/pull/277 +// TODO (also in the above link) document that this cannot be called from any thread, unlike uiQueueMain() +// TODO document that the minimum exact timing, either accuracy (timer burst, etc.) or granularity (15ms on Windows, etc.), is OS-defined +// TODO also figure out how long until the initial tick is registered on all platforms to document _UI_EXTERN void uiTimer(int milliseconds, int (*f)(void *data), void *data); _UI_EXTERN void uiOnShouldQuit(int (*f)(void *data), void *data); diff --git a/windows/main.cpp b/windows/main.cpp index 100c1873..d171e339 100644 --- a/windows/main.cpp +++ b/windows/main.cpp @@ -136,6 +136,7 @@ void uiTimer(int milliseconds, int (*f)(void *data), void *data) timer = uiprivNew(uiprivTimer); timer->f = f; timer->data = data; + // note that timer IDs are pointer sized precisely so we can use them as timer IDs; see https://blogs.msdn.microsoft.com/oldnewthing/20150924-00/?p=91521 if (SetTimer(utilWindow, (UINT_PTR) timer, milliseconds, NULL) == 0) logLastError(L"error calling SetTimer() in uiTimer()"); }