diff dw.h @ 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 a36448beb7f7
children d59d579dc6ec
line wrap: on
line diff
--- a/dw.h	Sun May 23 09:43:04 2021 +0000
+++ b/dw.h	Sun May 23 21:39:25 2021 +0000
@@ -358,6 +358,10 @@
 #define FALSE 0
 
 typedef void *HWND;
+#ifdef __IOS__
+typedef void *HTIMER
+#define HTIMER_TYPEDEFED 1
+#endif
 typedef void *HSHM;
 typedef unsigned long ULONG;
 typedef long LONG;
@@ -741,6 +745,8 @@
 #define FALSE 0
 
 typedef jobject HWND;
+typedef jobject HTIMER;
+#define HTIMER_TYPEDEFED 1
 
 typedef unsigned long ULONG;
 typedef long LONG;
@@ -1597,6 +1603,11 @@
 #define DW_DIR_SEPARATOR '\\'
 #endif
 
+#ifndef HTIMER_TYPEDEFED
+typedef int HTIMER;
+#define HTIMER_TYPEDEFED 1
+#endif
+
 /* Some dark mode constants for supported platforms */
 #define DW_DARK_MODE_DISABLED 0
 #define DW_DARK_MODE_BASIC    1
@@ -2128,8 +2139,8 @@
 int API dw_module_load(const char *name, HMOD *handle);
 int API dw_module_symbol(HMOD handle, const char *name, void**func);
 int API dw_module_close(HMOD handle);
-int API dw_timer_connect(int interval, void *sigfunc, void *data);
-void API dw_timer_disconnect(int id);
+HTIMER API dw_timer_connect(int interval, void *sigfunc, void *data);
+void API dw_timer_disconnect(HTIMER id);
 void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data);
 void API dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data);
 void API dw_signal_disconnect_by_window(HWND window);