diff gtk3/dw.c @ 2205:a43a3f80ed32

GTK: Changes to include both dw_(int_)init() functions with deprecated. This allows binary-wise for both old style resource apps and GResource ones to function with the same library. Which one is used depends on whether DW_INCLUDE_DEPRECATED is defined at compile time. Some more thought needs to be given to whether DW_INCLUDE_DEPRECATED should be included in the dwindows-config --cflags because apps expecting GResources will fail to compile with DW_INCLUDE_DEPRECATED defined, due to the dw_init() macro.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 29 Nov 2020 08:31:47 +0000
parents b86ae2abb3b3
children 3343ae3ac327
line wrap: on
line diff
--- a/gtk3/dw.c	Sun Nov 29 05:29:11 2020 +0000
+++ b/gtk3/dw.c	Sun Nov 29 08:31:47 2020 +0000
@@ -1924,7 +1924,7 @@
 {
 #if GLIB_CHECK_VERSION(2,32,0)
    char resource_path[201] = {0};
-   snprintf(resource_path, 200, "/org/dbsoft/dwindows/%u", rid);
+   snprintf(resource_path, 200, "/org/dbsoft/dwindows/resources/%u.png", rid);
    return gdk_pixbuf_new_from_resource(resource_path, NULL);
 #else
    return NULL;
@@ -2002,13 +2002,8 @@
 }
 #endif
 
-/*
- * Initializes the Dynamic Windows engine.
- * Parameters:
- *           newthread: True if this is the only thread.
- *                      False if there is already a message loop running.
- */
 #ifdef DW_INCLUDE_DEPRECATED_RESOURCES
+#undef dw_init
 int dw_int_init(DWResources *res, int newthread, int *pargc, char **pargv[])
 {
    int argc = pargc ? *pargc : 0;
@@ -2020,10 +2015,18 @@
       _resources.resource_id = res->resource_id;
       _resources.resource_data = res->resource_data;
    }
-#else
+   return dw_init(newthread, argc, argv);
+}
+#endif
+
+/*
+ * Initializes the Dynamic Windows engine.
+ * Parameters:
+ *           newthread: True if this is the only thread.
+ *                      False if there is already a message loop running.
+ */
 int dw_init(int newthread, int argc, char *argv[])
 {
-#endif
    /* Setup the private data directory */
    if(argc > 0 && argv[0])
    {