summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Toaster/src/images.h19
-rw-r--r--plugins/Toaster/src/toast_event_handler.cpp16
-rw-r--r--plugins/Toaster/src/toast_event_handler.h5
3 files changed, 19 insertions, 21 deletions
diff --git a/plugins/Toaster/src/images.h b/plugins/Toaster/src/images.h
index 31981f82a5..320a368769 100644
--- a/plugins/Toaster/src/images.h
+++ b/plugins/Toaster/src/images.h
@@ -6,34 +6,31 @@ class ToasterImage
ptrT tszId;
public:
- ToasterImage(HICON hIcon)
+ __inline explicit ToasterImage(HICON hIcon) : tszId(CMString(FORMAT, _T("%p"), hIcon).Detach())
{
- ICONINFO icon;
+ ICONINFO icon = { 0 };
if (GetIconInfo(hIcon, &icon))
{
_hBitmap = icon.hbmColor;
DeleteObject(icon.hbmMask);
}
- tszId = CMString(FORMAT, _T("%p"), hIcon).Detach();
}
- inline ToasterImage(HBITMAP bmp) : _hBitmap(bmp)
- {
- tszId = CMString(FORMAT, _T("%p"), bmp).Detach();
+ __inline explicit ToasterImage(HBITMAP bmp) : _hBitmap(bmp), tszId(CMString(FORMAT, _T("%p"), bmp).Detach())
+ {
}
- ToasterImage(const char *szProto)
+ __inline explicit ToasterImage(const char *szProto) : tszId(mir_a2t(szProto))
{
- ICONINFO icon;
+ ICONINFO icon = { 0 };
if (GetIconInfo(Skin_LoadProtoIcon(szProto, ID_STATUS_ONLINE, 1), &icon))
{
_hBitmap = icon.hbmColor;
DeleteObject(icon.hbmMask);
}
- tszId = mir_a2t(szProto);
}
- inline ~ToasterImage()
+ __inline ~ToasterImage()
{
DeleteObject(_hBitmap);
}
@@ -62,7 +59,7 @@ public:
return mir_wstrdup(wszSavePath);
}
- inline operator wchar_t*()
+ __inline operator wchar_t*()
{ return Save();
}
}; \ No newline at end of file
diff --git a/plugins/Toaster/src/toast_event_handler.cpp b/plugins/Toaster/src/toast_event_handler.cpp
index e312f7a8e1..a31a0d342b 100644
--- a/plugins/Toaster/src/toast_event_handler.cpp
+++ b/plugins/Toaster/src/toast_event_handler.cpp
@@ -21,8 +21,7 @@ IFACEMETHODIMP_(ULONG) ToastEventHandler::AddRef()
IFACEMETHODIMP_(ULONG) ToastEventHandler::Release()
{
ULONG l = InterlockedDecrement(&_ref);
- if (l == 0)
- delete this;
+ if (l == 0) delete this;
return l;
}
@@ -79,14 +78,17 @@ IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification*, _In_ IToastFa
void ToastEventHandler::DestroyNotification()
{
- mir_cslock lck(csNotifications);
- lstNotifications.remove(_thd->tstNotification);
+ if (_thd->tstNotification != nullptr)
+ {
+ mir_cslock lck(csNotifications);
+ lstNotifications.remove(_thd->tstNotification);
+ }
+ _thd->tstNotification = nullptr;
}
-void ToastEventHandler::CallPopupProc(UINT uMsg)
+LRESULT ToastEventHandler::CallPopupProc(UINT uMsg)
{
- if (_thd->pPopupProc)
- _thd->pPopupProc((HWND)this, uMsg, 0, 0);
+ return (_thd->pPopupProc ? _thd->pPopupProc((HWND)this, uMsg, 0, 0) : 0);
}
void* ToastEventHandler::GetPluginData()
diff --git a/plugins/Toaster/src/toast_event_handler.h b/plugins/Toaster/src/toast_event_handler.h
index bdad152a4e..a0efcbac2e 100644
--- a/plugins/Toaster/src/toast_event_handler.h
+++ b/plugins/Toaster/src/toast_event_handler.h
@@ -10,7 +10,7 @@ struct ToastHandlerData;
class ToastEventHandler : public Microsoft::WRL::Implements<DesktopToastActivatedEventHandler, DesktopToastDismissedEventHandler, DesktopToastFailedEventHandler>
{
public:
- ToastEventHandler::ToastEventHandler(_In_ ToastHandlerData*);
+ explicit ToastEventHandler(_In_ ToastHandlerData*);
~ToastEventHandler();
IFACEMETHODIMP_(ULONG) AddRef();
@@ -30,8 +30,7 @@ private:
std::unique_ptr<ToastHandlerData> _thd;
void DestroyNotification();
-
- void CallPopupProc(UINT uMsg);
+ LRESULT CallPopupProc(UINT uMsg);
};
#endif //_TOAST_EVENT_HANDLER_H_ \ No newline at end of file