comparison win/wintoast.cpp @ 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 251d050d306b
children 2e804b4db81e
comparison
equal deleted inserted replaced
2126:97839ff3c985 2127:663467f6eee4
1 /* Simple WinToast forwarder from Dynamic Windows APIs */ 1 /* Simple WinToast forwarder from Dynamic Windows APIs */
2 2
3 #include "dw.h"
3 #include "wintoastlib.h" 4 #include "wintoastlib.h"
4 5
5 using namespace WinToastLib; 6 using namespace WinToastLib;
6 7
7 extern "C" { 8 extern "C" {
8 LRESULT CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2); 9 LRESULT CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2);
9 void dw_signal_disconnect_by_window(HWND window);
10 } 10 }
11 11
12 class DWHandler : public IWinToastHandler { 12 class DWHandler : public IWinToastHandler {
13 public: 13 public:
14 WinToastTemplate *templ; 14 WinToastTemplate *templ;
116 WinToastTemplate *templ = (WinToastTemplate *)notification; 116 WinToastTemplate *templ = (WinToastTemplate *)notification;
117 DWHandler *handler = new DWHandler(); 117 DWHandler *handler = new DWHandler();
118 handler->templ = templ; 118 handler->templ = templ;
119 119
120 if(templ && WinToast::instance()->showToast(*templ, handler) >= 0) 120 if(templ && WinToast::instance()->showToast(*templ, handler) >= 0)
121 return 0; // DW_ERROR_NONE 121 return DW_ERROR_NONE;
122 } 122 }
123 return -1; // DW_ERROR_UNKNOWN 123 return DW_ERROR_UNKNOWN;
124 } 124 }
125 125
126 BOOL _dw_toast_is_compatible(void) 126 BOOL _dw_toast_is_compatible(void)
127 { 127 {
128 return WinToast::isCompatible(); 128 return WinToast::isCompatible();