Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
2204:b86ae2abb3b3 | 2205:a43a3f80ed32 |
---|---|
1862 | 1862 |
1863 static GdkPixbuf *_dw_pixbuf_from_resource(unsigned int rid) | 1863 static GdkPixbuf *_dw_pixbuf_from_resource(unsigned int rid) |
1864 { | 1864 { |
1865 #if GLIB_CHECK_VERSION(2,32,0) | 1865 #if GLIB_CHECK_VERSION(2,32,0) |
1866 char resource_path[201] = {0}; | 1866 char resource_path[201] = {0}; |
1867 snprintf(resource_path, 200, "/org/dbsoft/dwindows/%u", rid); | 1867 snprintf(resource_path, 200, "/org/dbsoft/dwindows/resources/%u.png", rid); |
1868 return gdk_pixbuf_new_from_resource(resource_path, NULL); | 1868 return gdk_pixbuf_new_from_resource(resource_path, NULL); |
1869 #else | 1869 #else |
1870 return NULL; | 1870 return NULL; |
1871 #endif | 1871 #endif |
1872 } | 1872 } |
2067 * quell the warning and can be used at a later point if needed. | 2067 * quell the warning and can be used at a later point if needed. |
2068 */ | 2068 */ |
2069 } | 2069 } |
2070 #endif | 2070 #endif |
2071 | 2071 |
2072 static char * _dw_test_xpm[] = { | |
2073 "1 1 1 1", | |
2074 " c None", | |
2075 " "}; | |
2076 | |
2077 /* | |
2078 * Initializes the Dynamic Windows engine. | |
2079 * Parameters: | |
2080 * newthread: True if this is the only thread. | |
2081 * False if there is already a message loop running. | |
2082 */ | |
2083 #ifdef DW_INCLUDE_DEPRECATED_RESOURCES | 2072 #ifdef DW_INCLUDE_DEPRECATED_RESOURCES |
2073 #undef dw_init | |
2084 int dw_int_init(DWResources *res, int newthread, int *pargc, char **pargv[]) | 2074 int dw_int_init(DWResources *res, int newthread, int *pargc, char **pargv[]) |
2085 { | 2075 { |
2086 int z, argc = pargc ? *pargc : 0; | 2076 int argc = pargc ? *pargc : 0; |
2087 char *fname, **argv = pargv ? *pargv : NULL; | 2077 char **argv = pargv ? *pargv : NULL; |
2088 | 2078 |
2089 if(res) | 2079 if(res) |
2090 { | 2080 { |
2091 _resources.resource_max = res->resource_max; | 2081 _resources.resource_max = res->resource_max; |
2092 _resources.resource_id = res->resource_id; | 2082 _resources.resource_id = res->resource_id; |
2093 _resources.resource_data = res->resource_data; | 2083 _resources.resource_data = res->resource_data; |
2094 } | 2084 } |
2095 #else | 2085 return dw_init(newthread, argc, argv); |
2086 } | |
2087 #endif | |
2088 | |
2089 /* | |
2090 * Initializes the Dynamic Windows engine. | |
2091 * Parameters: | |
2092 * newthread: True if this is the only thread. | |
2093 * False if there is already a message loop running. | |
2094 */ | |
2096 int dw_init(int newthread, int argc, char *argv[]) | 2095 int dw_init(int newthread, int argc, char *argv[]) |
2097 { | 2096 { |
2098 int z; | 2097 int z; |
2099 char *fname; | 2098 char *fname; |
2100 #endif | 2099 static char * _dw_test_xpm[] = { |
2100 "1 1 1 1", | |
2101 " c None", | |
2102 " "}; | |
2103 | |
2101 | 2104 |
2102 /* Setup the private data directory */ | 2105 /* Setup the private data directory */ |
2103 if(argc > 0 && argv[0]) | 2106 if(argc > 0 && argv[0]) |
2104 { | 2107 { |
2105 char *pathcopy = strdup(argv[0]); | 2108 char *pathcopy = strdup(argv[0]); |