diff 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
line wrap: on
line diff
--- a/gtk3/dw.c	Sun Jun 28 05:39:08 2020 +0000
+++ b/gtk3/dw.c	Sun Jun 28 20:34:25 2020 +0000
@@ -174,7 +174,7 @@
 #endif
 char *_DWDefaultFont = NULL;
 static char _dw_share_path[PATH_MAX+1] = { 0 };
-static char _dw_app_id[101] = { 0 };
+static char _dw_app_id[_DW_APP_ID_SIZE+1] = { 0 };
 
 typedef struct
 {
@@ -2020,7 +2020,7 @@
          if(!_dw_app_id[0])
          {
             /* If we have a binary name, use that for the Application ID instead. */
-            snprintf(_dw_app_id, 100, "%s.%s", DW_APP_DOMAIN_DEFAULT, binname);
+            snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.%s", DW_APP_DOMAIN_DEFAULT, binname);
          }
 #endif
       }
@@ -2057,7 +2057,7 @@
    if(!_dw_app_id[0])
    {
       /* Generate an Application ID based on the PID if all else fails. */
-      snprintf(_dw_app_id, 100, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid());
+      snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid());
    }
 
    /* Initialize the application subsystem on supported versions...
@@ -11836,7 +11836,7 @@
 #if GLIB_CHECK_VERSION(2,28,0)
    if(g_application_id_is_valid(appid))
    {
-      strncpy(_dw_app_id, appid, 100);
+      strncpy(_dw_app_id, appid, _DW_APP_ID_SIZE);
       return DW_ERROR_NONE;
    }
    return DW_ERROR_GENERAL;
@@ -12393,6 +12393,7 @@
 #if !GTK_CHECK_VERSION(3,14,0)
         case DW_FEATURE_CONTAINER_STRIPE:
 #endif
+        case DW_FEATURE_UTF8_UNICODE:
         case DW_FEATURE_MLE_WORD_WRAP:
             return DW_FEATURE_ENABLED;
         default:
@@ -12433,6 +12434,7 @@
 #if !GTK_CHECK_VERSION(3,14,0)
         case DW_FEATURE_CONTAINER_STRIPE:
 #endif
+        case DW_FEATURE_UTF8_UNICODE:
         case DW_FEATURE_MLE_WORD_WRAP:
             return DW_ERROR_GENERAL;
         /* These features are supported and configurable */