diff options
-rw-r--r-- | plugins/Toaster/src/add_to_start_menu.h | 1 | ||||
-rw-r--r-- | plugins/Toaster/src/services.cpp | 1 | ||||
-rw-r--r-- | plugins/Toaster/src/stdafx.h | 2 | ||||
-rw-r--r-- | plugins/Toaster/src/toast_notification.cpp | 5 | ||||
-rw-r--r-- | plugins/Toaster/src/toast_notification.h | 15 |
5 files changed, 15 insertions, 9 deletions
diff --git a/plugins/Toaster/src/add_to_start_menu.h b/plugins/Toaster/src/add_to_start_menu.h index 17d22ba6ad..45d866c0fd 100644 --- a/plugins/Toaster/src/add_to_start_menu.h +++ b/plugins/Toaster/src/add_to_start_menu.h @@ -1,6 +1,7 @@ #ifndef _ADD_TOSTART_MENU_H_
#define _ADD_TOSTART_MENU_H_
+DEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 5);
HRESULT TryCreateShortcut();
#endif //_ADD_TOSTART_MENU_H_
\ No newline at end of file diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 100a2387cf..9342af8672 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -243,6 +243,7 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam) static INT_PTR HideToast(WPARAM, LPARAM lParam)
{
ToastNotification* pNotification = reinterpret_cast<ToastNotification*>(lParam);
+ mir_cslock lck(csNotifications);
if (lstNotifications.getIndex(pNotification) != -1)
lstNotifications.remove(pNotification);
return 0;
diff --git a/plugins/Toaster/src/stdafx.h b/plugins/Toaster/src/stdafx.h index 57c860a0f3..3faa59fec7 100644 --- a/plugins/Toaster/src/stdafx.h +++ b/plugins/Toaster/src/stdafx.h @@ -27,9 +27,7 @@ #include "version.h"
#include "resource.h"
-typedef void(__cdecl *pEventHandler)(void*);
const wchar_t AppUserModelID[] = _T("MirandaNG");
-DEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 5);
#define MODULE "Toaster"
#define CHECKHR(x) if (FAILED(x)) return x;
diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp index 0b48c5c235..1d1c73aed4 100644 --- a/plugins/Toaster/src/toast_notification.cpp +++ b/plugins/Toaster/src/toast_notification.cpp @@ -11,7 +11,10 @@ ToastNotification::ToastNotification( void *pData )
: _text(text), _caption(caption), _imagePath(imagePath), _hContact(hContact), _pfnPopupProc(pWndProc), _pvPopupData(pData)
{
- lstNotifications.insert(this);
+ {
+ mir_cslock lck(csNotifications);
+ lstNotifications.insert(this);
+ }
Windows::Foundation::GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), ¬ificationManager);
notificationManager->CreateToastNotifierWithId(StringReferenceWrapper(::AppUserModelID).Get(), ¬ifier);
Create(¬ification);
diff --git a/plugins/Toaster/src/toast_notification.h b/plugins/Toaster/src/toast_notification.h index b99e3036a3..757cf269d5 100644 --- a/plugins/Toaster/src/toast_notification.h +++ b/plugins/Toaster/src/toast_notification.h @@ -7,6 +7,11 @@ typedef __FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification typedef __FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_Windows__CUI__CNotifications__CToastDismissedEventArgs ToastDismissHandler;
typedef __FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_Windows__CUI__CNotifications__CToastFailedEventArgs ToastFailHandler;
+class ToastNotification;
+
+extern OBJLIST<ToastNotification> lstNotifications;
+extern mir_cs csNotifications;
+
class ToastNotification
{
private:
@@ -34,15 +39,13 @@ private: public:
ToastNotification(_In_ wchar_t* text, _In_ wchar_t* caption = nullptr, _In_ wchar_t* imagePath = nullptr, MCONTACT hContact = 0, WNDPROC pWndProc = nullptr, void *pData = nullptr);
- ToastNotification::~ToastNotification();
+ ~ToastNotification();
inline void Destroy()
- {
- extern OBJLIST<ToastNotification> lstNotifications;
- lstNotifications.remove(this);
+ { mir_cslock lck(csNotifications); lstNotifications.remove(this);
}
- HRESULT OnActivate(_In_ ABI::Windows::UI::Notifications::IToastNotification*, IInspectable* aInspectable);
+ HRESULT OnActivate(_In_ ABI::Windows::UI::Notifications::IToastNotification*, IInspectable*);
HRESULT OnDismiss(_In_ ABI::Windows::UI::Notifications::IToastNotification*, _In_ ABI::Windows::UI::Notifications::IToastDismissedEventArgs*);
HRESULT OnFail(_In_ ABI::Windows::UI::Notifications::IToastNotification*, _In_ ABI::Windows::UI::Notifications::IToastFailedEventArgs*);
@@ -53,7 +56,7 @@ public: { return _hContact;
}
- inline LRESULT ToastNotification::CallPopupProc(UINT uMsg)
+ inline LRESULT CallPopupProc(UINT uMsg)
{ return (_pfnPopupProc ? _pfnPopupProc((HWND)this, uMsg, 0, 0) : 0);
}
|