Mercurial > dwindows
comparison mac/dw.m @ 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 |
---|---|
11516 * sigfunc: The pointer to the function to be used as the callback. | 11516 * sigfunc: The pointer to the function to be used as the callback. |
11517 * data: User data to be passed to the handler function. | 11517 * data: User data to be passed to the handler function. |
11518 * Returns: | 11518 * Returns: |
11519 * Timer ID for use with dw_timer_disconnect(), 0 on error. | 11519 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
11520 */ | 11520 */ |
11521 int API dw_timer_connect(int interval, void *sigfunc, void *data) | 11521 HTIMER API dw_timer_connect(int interval, void *sigfunc, void *data) |
11522 { | 11522 { |
11523 int z; | 11523 int z; |
11524 | 11524 |
11525 for(z=0;z<DW_TIMER_MAX;z++) | 11525 for(z=0;z<DW_TIMER_MAX;z++) |
11526 { | 11526 { |
11543 /* | 11543 /* |
11544 * Removes timer callback. | 11544 * Removes timer callback. |
11545 * Parameters: | 11545 * Parameters: |
11546 * id: Timer ID returned by dw_timer_connect(). | 11546 * id: Timer ID returned by dw_timer_connect(). |
11547 */ | 11547 */ |
11548 void API dw_timer_disconnect(int timerid) | 11548 void API dw_timer_disconnect(HTIMER timerid) |
11549 { | 11549 { |
11550 SignalHandler *prev = NULL, *tmp = DWRoot; | 11550 SignalHandler *prev = NULL, *tmp = DWRoot; |
11551 NSTimer *thistimer; | 11551 NSTimer *thistimer; |
11552 | 11552 |
11553 /* 0 is an invalid timer ID */ | 11553 /* 0 is an invalid timer ID */ |