changeset 2098:665d87a50eac

Win: Test that the OS is compatible for WinToast before returning supported.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 11 Jun 2020 22:21:53 +0000
parents 6608fc7f6465
children 296a3872ddd9
files win/dw.c win/wintoast.cpp
diffstat 2 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Thu Jun 11 18:02:29 2020 +0000
+++ b/win/dw.c	Thu Jun 11 22:21:53 2020 +0000
@@ -324,6 +324,7 @@
 void _dw_toast_init(LPWSTR AppName, LPWSTR AppID);
 void *_dw_notification_new(LPWSTR title, LPWSTR image, LPWSTR description);
 int _dw_notification_send(void *notification);
+BOOL _dw_toast_is_compatible(void);
 #endif 
 LRESULT CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2);
 void _resize_notebook_page(HWND handle, int pageid);
@@ -13369,12 +13370,17 @@
         case DW_FEATURE_HTML:
         case DW_FEATURE_HTML_RESULT:
 #endif
-#ifdef BUILD_TOAST
-        case DW_FEATURE_NOTIFICATION:
-#endif
         case DW_FEATURE_CONTAINER_STRIPE:
         case DW_FEATURE_MDI:
             return DW_FEATURE_ENABLED;
+#ifdef BUILD_TOAST
+        case DW_FEATURE_NOTIFICATION:
+        {
+            if(_dw_toast_is_compatible())
+                return DW_FEATURE_ENABLED;
+            return DW_FEATURE_UNSUPPORTED;
+        }
+#endif
 #ifdef AEROGLASS
         case DW_FEATURE_WINDOW_TRANSPARENCY:
         {
@@ -13419,12 +13425,17 @@
 #ifdef AEROGLASS
         case DW_FEATURE_WINDOW_TRANSPARENCY:
 #endif
-#ifdef BUILD_TOAST
-        case DW_FEATURE_NOTIFICATION:
-#endif
         case DW_FEATURE_CONTAINER_STRIPE:
         case DW_FEATURE_MDI:
             return DW_ERROR_GENERAL;
+#ifdef BUILD_TOAST
+        case DW_FEATURE_NOTIFICATION:
+        {
+            if(_dw_toast_is_compatible())
+                return DW_ERROR_GENERAL;
+            return DW_FEATURE_UNSUPPORTED;
+        }
+#endif
         /* These features are supported and configurable */
 #ifdef AEROGLASS
         case DW_FEATURE_DARK_MODE:
--- a/win/wintoast.cpp	Thu Jun 11 18:02:29 2020 +0000
+++ b/win/wintoast.cpp	Thu Jun 11 22:21:53 2020 +0000
@@ -88,4 +88,9 @@
       }
       return -1; // DW_ERROR_UNKNOWN
    }
+   
+   BOOL _dw_toast_is_compatible(void)
+   {
+       return WinToast::isCompatible();
+   }
 }