diff gtk/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/gtk/dw.c	Sun Jun 28 05:39:08 2020 +0000
+++ b/gtk/dw.c	Sun Jun 28 20:34:25 2020 +0000
@@ -124,7 +124,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 };
 
 #if GTK_MAJOR_VERSION < 2
 static int _dw_file_active = 0;
@@ -2052,7 +2052,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
       }
@@ -2129,7 +2129,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...
@@ -13336,7 +13336,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;
@@ -13899,6 +13899,7 @@
         case DW_FEATURE_MDI:
 #endif
         case DW_FEATURE_CONTAINER_STRIPE:
+        case DW_FEATURE_UTF8_UNICODE:
         case DW_FEATURE_MLE_WORD_WRAP:
             return DW_FEATURE_ENABLED;
         default:
@@ -13934,6 +13935,7 @@
         case DW_FEATURE_MDI:
 #endif
         case DW_FEATURE_CONTAINER_STRIPE:
+        case DW_FEATURE_UTF8_UNICODE:
         case DW_FEATURE_MLE_WORD_WRAP:
             return DW_ERROR_GENERAL;
         /* These features are supported and configurable */