diff dw.h @ 2202:c677d728e143

GTK3: Switch to using GResource for compiled in image resources. Second commit with similar changes coming for GTK2 soon. dwindows-config --gresource will return "enabled" if GResource is supported. GLib 2.32 is required for GResource support, if GLib is older than 2.32 Dynamic Windows will fall back to the old style compiled in resource array.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 28 Nov 2020 23:47:30 +0000
parents 6533fc42c951
children 12fb7f32f3a9
line wrap: on
line diff
--- a/dw.h	Tue Oct 27 00:52:13 2020 +0000
+++ b/dw.h	Sat Nov 28 23:47:30 2020 +0000
@@ -1346,11 +1346,27 @@
    char **resource_data;
 } DWResources;
 
+/* As of Dynamic Windows 3.1 GResource is default if supported.
+ * Defining DW_INCLUDE_DEPRECATED_RESOURCES at compile time will
+ * include support for our old home brewed resource system.
+ * GLib 2.32 is required for GResource, so we automatically 
+ * enable our old system if using an old Glib.
+ * Test for GResource using: dwindows-config --gresource
+ */
+#ifndef DW_INCLUDE_DEPRECATED_RESOURCES
+#if !GLIB_CHECK_VERSION(2,32,0)
+#define DW_INCLUDE_DEPRECATED_RESOURCES 1
+#endif
+#endif
+
+/* Only reference our old style resources if required. */
+#ifdef DW_INCLUDE_DEPRECATED_RESOURCES
 #if !defined(DW_RESOURCES) || defined(BUILD_DLL)
 static DWResources DW_UNUSED(_resources) = { 0, 0, 0 };
 #else
 extern DWResources _resources;
 #endif
+#endif
 
 #endif
 
@@ -1626,7 +1642,7 @@
 void API dw_box_pack_at_index(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad);
 HWND API dw_box_unpack_at_index(HWND box, int index);
 int API dw_box_unpack(HWND handle);
-#if !defined(__OS2__) && !defined(__WIN32__) && !defined(__EMX__) && !defined(__MAC__)
+#ifdef DW_INCLUDE_DEPRECATED_RESOURCES
 int API dw_int_init(DWResources *res, int newthread, int *argc, char **argv[]);
 #define dw_init(a, b, c) dw_int_init(&_resources, a, &b, &c)
 #else