Mercurial > dwindows
comparison gtk4/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 | 156ad91481eb |
comparison
equal
deleted
inserted
replaced
2583:1d2f5c4eccc5 | 2584:2acc7ba5dea0 |
---|---|
10662 * sigfunc: The pointer to the function to be used as the callback. | 10662 * sigfunc: The pointer to the function to be used as the callback. |
10663 * data: User data to be passed to the handler function. | 10663 * data: User data to be passed to the handler function. |
10664 * Returns: | 10664 * Returns: |
10665 * Timer ID for use with dw_timer_disconnect(), 0 on error. | 10665 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
10666 */ | 10666 */ |
10667 int API dw_timer_connect(int interval, void *sigfunc, void *data) | 10667 HTIMER API dw_timer_connect(int interval, void *sigfunc, void *data) |
10668 { | 10668 { |
10669 int *tag; | 10669 int *tag; |
10670 char tmpbuf[31] = {0}; | 10670 char tmpbuf[31] = {0}; |
10671 | 10671 |
10672 tag = calloc(1, sizeof(int)); | 10672 tag = calloc(1, sizeof(int)); |
10682 /* | 10682 /* |
10683 * Removes timer callback. | 10683 * Removes timer callback. |
10684 * Parameters: | 10684 * Parameters: |
10685 * id: Timer ID returned by dw_timer_connect(). | 10685 * id: Timer ID returned by dw_timer_connect(). |
10686 */ | 10686 */ |
10687 void API dw_timer_disconnect(int id) | 10687 void API dw_timer_disconnect(HTIMER id) |
10688 { | 10688 { |
10689 char tmpbuf[31] = {0}; | 10689 char tmpbuf[31] = {0}; |
10690 | 10690 |
10691 snprintf(tmpbuf, 30, "_dw_timer%d", id); | 10691 snprintf(tmpbuf, 30, "_dw_timer%d", id); |
10692 g_object_set_data(G_OBJECT(_DWObject), tmpbuf, NULL); | 10692 g_object_set_data(G_OBJECT(_DWObject), tmpbuf, NULL); |