diff gtk/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 0b6e1b5c8b5e
line wrap: on
line diff
--- a/gtk/dw.c	Sun Nov 29 05:29:11 2020 +0000
+++ b/gtk/dw.c	Sun Nov 29 08:31:47 2020 +0000
@@ -1864,7 +1864,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;
@@ -2069,22 +2069,12 @@
 }
 #endif
 
-static char * _dw_test_xpm[] = {
-   "1 1 1 1",
-   " 	c None",
-   " "};
-   
-/*
- * 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 z, argc = pargc ? *pargc : 0;
-   char *fname, **argv = pargv ? *pargv : NULL;
+   int argc = pargc ? *pargc : 0;
+   char **argv = pargv ? *pargv : NULL;
 
    if(res)
    {
@@ -2092,12 +2082,25 @@
       _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[])
 {
    int z;
    char *fname;
-#endif
+   static char * _dw_test_xpm[] = {
+      "1 1 1 1",
+      " 	c None",
+      " "};
+   
 
    /* Setup the private data directory */
    if(argc > 0 && argv[0])