From 63ed39f2286560d410b97b6b6ad75e9ed68cd30e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 5 Nov 2023 15:27:21 +0300 Subject: Popup+ specific functionality localized inside Popup+ --- include/m_popup.h | 58 ------------------------------------ include/m_popup_int.h | 1 - libs/win32/mir_app.lib | Bin 272378 -> 272124 bytes libs/win64/mir_app.lib | Bin 271560 -> 271324 bytes plugins/Popup/src/actions.h | 58 ++++++++++++++++++++++++++++++++++++ plugins/Popup/src/notifications.cpp | 10 +++---- plugins/Popup/src/services.cpp | 7 ----- src/mir_app/src/mir_app.def | 1 - src/mir_app/src/mir_app64.def | 1 - src/mir_app/src/popups.cpp | 5 ---- 10 files changed, 63 insertions(+), 78 deletions(-) diff --git a/include/m_popup.h b/include/m_popup.h index 039b05e9fe..48c264ed56 100644 --- a/include/m_popup.h +++ b/include/m_popup.h @@ -243,64 +243,6 @@ __forceinline int PUModifyActionIcon(HWND hWndPopup, WPARAM wParam, LPARAM lPara EXTERN_C MIR_APP_DLL(int) PURegisterActions(POPUPACTION *actions, int count); -// Popup/RegisterNotification -// Registers your action in popup action list -// wParam = (WPARAM)(LPPOPUPNOTIFICATION)info -// lParam = 0 -// Returns: handle of registered notification or sero on failure - -#define PNAF_CALLBACK 0x01 - -#define POPUP_ACTION_NOTHING LPGEN("Do nothing") -#define POPUP_ACTION_DISMISS LPGEN("Dismiss popup") - -struct POPUPNOTIFYACTION -{ - char lpzTitle[64]; - uint32_t dwFlags; - union - { - struct - { - char lpzLModule[MAXMODULELABELLENGTH]; - char lpzLSetting[MAXMODULELABELLENGTH]; - DBVARIANT dbvLData; - char lpzRModule[MAXMODULELABELLENGTH]; - char lpzRSetting[MAXMODULELABELLENGTH]; - DBVARIANT dbvRData; - }; - struct - { - uint32_t dwCookie; - void(*pfnCallback)(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, uint32_t cookie); - }; - }; -}; - -#define PNF_CONTACT 0x01 - -struct POPUPNOTIFICATION -{ - int cbSize; - uint32_t dwFlags; // set of PNF_* flags - char lpzGroup[MAXMODULELABELLENGTH]; - char lpzName[MAXMODULELABELLENGTH]; - HANDLE lchIcoLib; // gotten from icolib - COLORREF colorBack; // this will be registered in fontservice - COLORREF colorText; // this will be registered in fontservice - int iSeconds; // default timeout - int actionCount; // for unified action comboboxes - POPUPNOTIFYACTION *lpActions; - char *lpzLAction; - char *lpzRAction; - char *pszReserved1; // reserved for future use - #ifdef _WINDOWS - DLGPROC pfnReserved2; // reserved for future use - #endif -}; - -EXTERN_C MIR_APP_DLL(HANDLE) PURegisterNotification(POPUPNOTIFICATION *notification); - /* Popup/UnhookEventAsync Using of "UnhookEvent" inside PluginWindowProc in conjunction with HookEventMessage may cause deadlocks. Use this service instead. It will queue event unhook into main diff --git a/include/m_popup_int.h b/include/m_popup_int.h index b241f7bebe..6860759174 100644 --- a/include/m_popup_int.h +++ b/include/m_popup_int.h @@ -31,7 +31,6 @@ #define MS_POPUP_GETCONTACT "Popup/GetContact" #define MS_POPUP_REGISTERACTIONS "Popup/RegisterActions" -#define MS_POPUP_REGISTERNOTIFICATION "Popup/RegisterNotification" #define MS_POPUP_SHOWMESSAGE "Popup/ShowMessage" #define MS_POPUP_SHOWMESSAGEW "Popup/ShowMessageW" diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 902b5ccca6..7a269f60b6 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index a3f9c345f3..a94ba8baf0 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/Popup/src/actions.h b/plugins/Popup/src/actions.h index bfdaf8591d..c7833e456a 100644 --- a/plugins/Popup/src/actions.h +++ b/plugins/Popup/src/actions.h @@ -24,6 +24,64 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __actions_h__ #define __actions_h__ +// Popup/RegisterNotification +// Registers your action in popup action list +// wParam = (WPARAM)(LPPOPUPNOTIFICATION)info +// lParam = 0 +// Returns: handle of registered notification or sero on failure + +#define PNAF_CALLBACK 0x01 + +#define POPUP_ACTION_NOTHING LPGEN("Do nothing") +#define POPUP_ACTION_DISMISS LPGEN("Dismiss popup") + +struct POPUPNOTIFYACTION +{ + char lpzTitle[64]; + uint32_t dwFlags; + union + { + struct + { + char lpzLModule[MAXMODULELABELLENGTH]; + char lpzLSetting[MAXMODULELABELLENGTH]; + DBVARIANT dbvLData; + char lpzRModule[MAXMODULELABELLENGTH]; + char lpzRSetting[MAXMODULELABELLENGTH]; + DBVARIANT dbvRData; + }; + struct + { + uint32_t dwCookie; + void(*pfnCallback)(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, uint32_t cookie); + }; + }; +}; + +#define PNF_CONTACT 0x01 + +struct POPUPNOTIFICATION +{ + int cbSize; + uint32_t dwFlags; // set of PNF_* flags + char lpzGroup[MAXMODULELABELLENGTH]; + char lpzName[MAXMODULELABELLENGTH]; + HANDLE lchIcoLib; // gotten from icolib + COLORREF colorBack; // this will be registered in fontservice + COLORREF colorText; // this will be registered in fontservice + int iSeconds; // default timeout + int actionCount; // for unified action comboboxes + POPUPNOTIFYACTION *lpActions; + char *lpzLAction; + char *lpzRAction; + char *pszReserved1; // reserved for future use + #ifdef _WINDOWS + DLGPROC pfnReserved2; // reserved for future use + #endif +}; + +///////////////////////////////////////////////////////////////////////////////////////// + void LoadActions(); void UnloadActions(); diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 84a0119de2..fcd88ad902 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -43,7 +43,7 @@ void LoadNotifications() notification.lpActions = nullptr; mir_strncpy(notification.lpzGroup, LPGEN("Misc"), sizeof(notification.lpzName)); - mir_strncpy(notification.lpzName, LPGEN("Warning"), sizeof(notification.lpzName)); + mir_strncpy(notification.lpzName, "Warning", sizeof(notification.lpzName)); notification.lchIcoLib = g_plugin.getIconHandle(IDI_MB_WARN); notification.colorBack = RGB(210, 210, 150); notification.colorText = RGB(0, 0, 0); @@ -51,7 +51,7 @@ void LoadNotifications() g_hntfWarning = RegisterNotification(¬ification); mir_strncpy(notification.lpzGroup, LPGEN("Misc"), sizeof(notification.lpzName)); - mir_strncpy(notification.lpzName, LPGEN("Notification"), sizeof(notification.lpzName)); + mir_strncpy(notification.lpzName, "Notification", sizeof(notification.lpzName)); notification.lchIcoLib = g_plugin.getIconHandle(IDI_MB_INFO); notification.colorBack = RGB(230, 230, 230); notification.colorText = RGB(0, 0, 0); @@ -59,7 +59,7 @@ void LoadNotifications() g_hntfNotification = RegisterNotification(¬ification); mir_strncpy(notification.lpzGroup, LPGEN("Misc"), sizeof(notification.lpzName)); - mir_strncpy(notification.lpzName, LPGEN("Error"), sizeof(notification.lpzName)); + mir_strncpy(notification.lpzName, "Error", sizeof(notification.lpzName)); notification.lchIcoLib = g_plugin.getIconHandle(IDI_MB_STOP); notification.colorBack = RGB(191, 0, 0); notification.colorText = RGB(255, 245, 225); @@ -190,7 +190,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) fontid.deffontsettings.size = -11; mir_strncpy(fontid.deffontsettings.szFace, "MS Shell Dlg", _countof(fontid.deffontsettings.szFace)); fontid.deffontsettings.style = 0; - mir_snprintf(fontid.name, LPGEN("%s (colors only)"), notification->lpzName); + mir_snprintf(fontid.name, "%s (colors only)", notification->lpzName); mir_snprintf(fontid.setting, "{%s/%s}text", notification->lpzGroup, notification->lpzName); fontid.deffontsettings.style = 0; g_plugin.addFont(&fontid); @@ -198,7 +198,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) ColourID colourid = {}; mir_snprintf(colourid.group, PU_FNT_AND_COLOR"/%s", notification->lpzGroup); mir_strcpy(colourid.dbSettingsGroup, "PopupNotifications"); - mir_snprintf(colourid.name, LPGEN("%s (colors only)"), notification->lpzName); + mir_snprintf(colourid.name, "%s (colors only)", notification->lpzName); mir_snprintf(colourid.setting, "{%s/%s}backColor", notification->lpzGroup, notification->lpzName); colourid.defcolour = ptd->notification.colorBack; g_plugin.addColor(&colourid); diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 09cee21427..48a73fc864 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -304,12 +304,6 @@ static INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR Popup_RegisterNotification(WPARAM wParam, LPARAM) -{ - return (INT_PTR)RegisterNotification((POPUPNOTIFICATION*)wParam); -} - - ///////////////////////////////////////////////////////////////////////////////////////// // Popup/UnhookEventAsync @@ -508,7 +502,6 @@ void CreateServices() CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW); CreateServiceFunction(MS_POPUP_REGISTERACTIONS, Popup_RegisterActions); - CreateServiceFunction(MS_POPUP_REGISTERNOTIFICATION, Popup_RegisterNotification); CreateServiceFunction(MS_POPUP_UNHOOKEVENTASYNC, Popup_UnhookEventAsync); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index e0919c872a..53c82fe05e 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -636,7 +636,6 @@ PUDeletePopup @750 PUGetContact @751 PUGetPluginData @752 PURegisterActions @753 -PURegisterNotification @754 PUShowMessage @755 PUShowMessageW @756 Popup_RegisterClass @757 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index c60f03222e..518db90afc 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -636,7 +636,6 @@ PUDeletePopup @750 PUGetContact @751 PUGetPluginData @752 PURegisterActions @753 -PURegisterNotification @754 PUShowMessage @755 PUShowMessageW @756 Popup_RegisterClass @757 diff --git a/src/mir_app/src/popups.cpp b/src/mir_app/src/popups.cpp index aa7af870f3..15ee314dbb 100644 --- a/src/mir_app/src/popups.cpp +++ b/src/mir_app/src/popups.cpp @@ -114,11 +114,6 @@ MIR_APP_DLL(int) PURegisterActions(POPUPACTION *actions, int count) return (int)CallService(MS_POPUP_REGISTERACTIONS, (WPARAM)actions, (LPARAM)count); } -MIR_APP_DLL(HANDLE) PURegisterNotification(POPUPNOTIFICATION *notification) -{ - return (HANDLE)CallService(MS_POPUP_REGISTERNOTIFICATION, (WPARAM)notification, 0); -} - ///////////////////////////////////////////////////////////////////////////////////////// // Popup classes -- cgit v1.2.3