Mercurial > dwindows
comparison gtk3/dw.c @ 2127:663467f6eee4
Code cleanup: Add constants to header for dark mode, buffer sizes and Unicode support.
Windows and OS/2 can both be built without Unicode support for legacy platforms and apps.
Some new Windows features require Unicode (notifications, edge) and Unicode is buggy on OS/2.
Can now check if Unicode is supported with the DW_FEATURE_UTF8_UNICODE feature test.
Dark mode constants added DW_DARK_MODE_DISABLED/BASIC/FULL/FORCED.
Win: Include dw.h in the WinToast glue for the constants, and improve safety in Edge glue.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 28 Jun 2020 20:34:25 +0000 |
parents | c3f088266bcd |
children | 42f8ad7a89e8 |
comparison
equal
deleted
inserted
replaced
2126:97839ff3c985 | 2127:663467f6eee4 |
---|---|
172 #if GLIB_CHECK_VERSION(2,28,0) | 172 #if GLIB_CHECK_VERSION(2,28,0) |
173 GApplication *_DWApp = NULL; | 173 GApplication *_DWApp = NULL; |
174 #endif | 174 #endif |
175 char *_DWDefaultFont = NULL; | 175 char *_DWDefaultFont = NULL; |
176 static char _dw_share_path[PATH_MAX+1] = { 0 }; | 176 static char _dw_share_path[PATH_MAX+1] = { 0 }; |
177 static char _dw_app_id[101] = { 0 }; | 177 static char _dw_app_id[_DW_APP_ID_SIZE+1] = { 0 }; |
178 | 178 |
179 typedef struct | 179 typedef struct |
180 { | 180 { |
181 void *func; | 181 void *func; |
182 char name[30]; | 182 char name[30]; |
2018 strcat(_dw_share_path, binname); | 2018 strcat(_dw_share_path, binname); |
2019 #if GLIB_CHECK_VERSION(2,28,0) | 2019 #if GLIB_CHECK_VERSION(2,28,0) |
2020 if(!_dw_app_id[0]) | 2020 if(!_dw_app_id[0]) |
2021 { | 2021 { |
2022 /* If we have a binary name, use that for the Application ID instead. */ | 2022 /* If we have a binary name, use that for the Application ID instead. */ |
2023 snprintf(_dw_app_id, 100, "%s.%s", DW_APP_DOMAIN_DEFAULT, binname); | 2023 snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.%s", DW_APP_DOMAIN_DEFAULT, binname); |
2024 } | 2024 } |
2025 #endif | 2025 #endif |
2026 } | 2026 } |
2027 if(pathcopy) | 2027 if(pathcopy) |
2028 free(pathcopy); | 2028 free(pathcopy); |
2055 | 2055 |
2056 #if GLIB_CHECK_VERSION(2,28,0) | 2056 #if GLIB_CHECK_VERSION(2,28,0) |
2057 if(!_dw_app_id[0]) | 2057 if(!_dw_app_id[0]) |
2058 { | 2058 { |
2059 /* Generate an Application ID based on the PID if all else fails. */ | 2059 /* Generate an Application ID based on the PID if all else fails. */ |
2060 snprintf(_dw_app_id, 100, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid()); | 2060 snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid()); |
2061 } | 2061 } |
2062 | 2062 |
2063 /* Initialize the application subsystem on supported versions... | 2063 /* Initialize the application subsystem on supported versions... |
2064 * we generate an application ID based on the binary name or PID | 2064 * we generate an application ID based on the binary name or PID |
2065 * instead of passing NULL to enable full application support. | 2065 * instead of passing NULL to enable full application support. |
11834 int dw_app_id_set(const char *appid, const char *appname) | 11834 int dw_app_id_set(const char *appid, const char *appname) |
11835 { | 11835 { |
11836 #if GLIB_CHECK_VERSION(2,28,0) | 11836 #if GLIB_CHECK_VERSION(2,28,0) |
11837 if(g_application_id_is_valid(appid)) | 11837 if(g_application_id_is_valid(appid)) |
11838 { | 11838 { |
11839 strncpy(_dw_app_id, appid, 100); | 11839 strncpy(_dw_app_id, appid, _DW_APP_ID_SIZE); |
11840 return DW_ERROR_NONE; | 11840 return DW_ERROR_NONE; |
11841 } | 11841 } |
11842 return DW_ERROR_GENERAL; | 11842 return DW_ERROR_GENERAL; |
11843 #else | 11843 #else |
11844 return DW_ERROR_UNKNOWN; | 11844 return DW_ERROR_UNKNOWN; |
12391 case DW_FEATURE_MDI: | 12391 case DW_FEATURE_MDI: |
12392 #endif | 12392 #endif |
12393 #if !GTK_CHECK_VERSION(3,14,0) | 12393 #if !GTK_CHECK_VERSION(3,14,0) |
12394 case DW_FEATURE_CONTAINER_STRIPE: | 12394 case DW_FEATURE_CONTAINER_STRIPE: |
12395 #endif | 12395 #endif |
12396 case DW_FEATURE_UTF8_UNICODE: | |
12396 case DW_FEATURE_MLE_WORD_WRAP: | 12397 case DW_FEATURE_MLE_WORD_WRAP: |
12397 return DW_FEATURE_ENABLED; | 12398 return DW_FEATURE_ENABLED; |
12398 default: | 12399 default: |
12399 return DW_FEATURE_UNSUPPORTED; | 12400 return DW_FEATURE_UNSUPPORTED; |
12400 } | 12401 } |
12431 case DW_FEATURE_MDI: | 12432 case DW_FEATURE_MDI: |
12432 #endif | 12433 #endif |
12433 #if !GTK_CHECK_VERSION(3,14,0) | 12434 #if !GTK_CHECK_VERSION(3,14,0) |
12434 case DW_FEATURE_CONTAINER_STRIPE: | 12435 case DW_FEATURE_CONTAINER_STRIPE: |
12435 #endif | 12436 #endif |
12437 case DW_FEATURE_UTF8_UNICODE: | |
12436 case DW_FEATURE_MLE_WORD_WRAP: | 12438 case DW_FEATURE_MLE_WORD_WRAP: |
12437 return DW_ERROR_GENERAL; | 12439 return DW_ERROR_GENERAL; |
12438 /* These features are supported and configurable */ | 12440 /* These features are supported and configurable */ |
12439 default: | 12441 default: |
12440 return DW_FEATURE_UNSUPPORTED; | 12442 return DW_FEATURE_UNSUPPORTED; |