Mercurial > dwindows
comparison win/dw.c @ 2584:2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
On existing platforms, HTIMER will be int for now allowing API backward compatibility.
On new platforms, iOS and Android, these will be pointers to the timer objects.
This allows simplifying the code paths on those platforms. May change it on other
platforms such as Mac in a future major version.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 23 May 2021 21:39:25 +0000 |
parents | 457c91634881 |
children | ac51cbdcfbe5 |
comparison
equal
deleted
inserted
replaced
2583:1d2f5c4eccc5 | 2584:2acc7ba5dea0 |
---|---|
13570 * sigfunc: The pointer to the function to be used as the callback. | 13570 * sigfunc: The pointer to the function to be used as the callback. |
13571 * data: User data to be passed to the handler function. | 13571 * data: User data to be passed to the handler function. |
13572 * Returns: | 13572 * Returns: |
13573 * Timer ID for use with dw_timer_disconnect(), 0 on error. | 13573 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
13574 */ | 13574 */ |
13575 int API dw_timer_connect(int interval, void *sigfunc, void *data) | 13575 HTIMER API dw_timer_connect(int interval, void *sigfunc, void *data) |
13576 { | 13576 { |
13577 if(sigfunc) | 13577 if(sigfunc) |
13578 { | 13578 { |
13579 /* Warning: This seems to return UINT_PTR on some systems... | 13579 /* Warning: This seems to return UINT_PTR on some systems... |
13580 * which may exceed the storage of int that our API uses. | 13580 * which may exceed the storage of int that our API uses. |
13593 /* | 13593 /* |
13594 * Removes timer callback. | 13594 * Removes timer callback. |
13595 * Parameters: | 13595 * Parameters: |
13596 * id: Timer ID returned by dw_timer_connect(). | 13596 * id: Timer ID returned by dw_timer_connect(). |
13597 */ | 13597 */ |
13598 void API dw_timer_disconnect(int id) | 13598 void API dw_timer_disconnect(HTIMER id) |
13599 { | 13599 { |
13600 SignalHandler *prev = NULL, *tmp = Root; | 13600 SignalHandler *prev = NULL, *tmp = Root; |
13601 | 13601 |
13602 /* 0 is an invalid timer ID */ | 13602 /* 0 is an invalid timer ID */ |
13603 if(!id) | 13603 if(!id) |