And added documentation nits and TODOs to the uiTimer() code.
This commit is contained in:
parent
cac4cd9e81
commit
83b04cda47
5
ui.h
5
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);
|
||||
|
|
|
@ -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()");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue