summaryrefslogtreecommitdiff
path: root/protocols/GTalkExt/src/GTalkExt.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-21 15:37:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-21 15:37:17 +0000
commit85bc1059e1d3e415c467821eb5f18af8fc0a9468 (patch)
treef4677690848b34a64818e097043f9a550c7801d1 /protocols/GTalkExt/src/GTalkExt.cpp
parent8e88506457722bc5d834fcdd623cc73aa64c1982 (diff)
fixed crash in GTalkExt popups
git-svn-id: http://svn.miranda-ng.org/main/trunk@4147 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/GTalkExt/src/GTalkExt.cpp')
-rw-r--r--protocols/GTalkExt/src/GTalkExt.cpp74
1 files changed, 47 insertions, 27 deletions
diff --git a/protocols/GTalkExt/src/GTalkExt.cpp b/protocols/GTalkExt/src/GTalkExt.cpp
index 463f1985b8..a449435cb3 100644
--- a/protocols/GTalkExt/src/GTalkExt.cpp
+++ b/protocols/GTalkExt/src/GTalkExt.cpp
@@ -23,16 +23,17 @@
#include "stdafx.h"
#include "options.h"
+#include "notifications.h"
#include "handlers.h"
#include "tipper_items.h"
#include "avatar.h"
#include "menu.h"
+int hLangpack;
+HICON g_hPopupIcon = 0;
-int hLangpack;
-
-
-PLUGININFOEX pluginInfo={
+PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
PLUGIN_DESCRIPTION,
PLUGIN_VERSION_DWORD,
@@ -50,38 +51,57 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
return &pluginInfo;
}
-HANDLE hModulesLoaded = 0;
-HANDLE hAccListChanged = 0;
+/////////////////////////////////////////////////////////////////////////////////////////
-extern "C" int __declspec(dllexport) Unload(void)
+LRESULT CALLBACK WndProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- UnhookOptionsInitialization();
- InitMenus(FALSE);
- InitAvaUnit(FALSE);
- if (hAccListChanged) UnhookEvent(hAccListChanged);
- if (hModulesLoaded) UnhookEvent(hModulesLoaded);
- return 0;
-}
+ switch (msg) {
+ case WM_NCCREATE:
+ return 1;
-HICON g_hPopupIcon = 0;
-extern HINSTANCE hInst;
+ case WM_GETMINMAXINFO:
+ PMINMAXINFO info = (PMINMAXINFO)lParam;
+ info->ptMaxPosition.x = -100;
+ info->ptMaxPosition.y = -100;
+ info->ptMaxSize.x = 10;
+ info->ptMaxSize.y = 10;
+ info->ptMaxTrackSize.x = 10;
+ info->ptMaxTrackSize.y = 10;
+ info->ptMinTrackSize.x = 10;
+ info->ptMinTrackSize.y = 10;
+ return 0;
+ }
+ return DefWindowProc(wnd, msg, wParam, lParam);
+}
extern "C" int __declspec(dllexport) Load(void)
{
- g_hPopupIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_POPUP));
+ mir_getLP(&pluginInfo);
+ mir_getXI(&xi);
+
+ WNDCLASS cls = {0};
+ cls.lpfnWndProc = WndProc;
+ cls.lpszClassName = TEMP_WINDOW_CLASS_NAME;
+ RegisterClass(&cls);
+ g_hPopupIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_POPUP));
- mir_getLP(&pluginInfo);
- if (
- !mir_getXI(&xi) ||
- !(hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded)) ||
- !(hAccListChanged = HookEvent(ME_PROTO_ACCLISTCHANGED, AccListChanged)) ||
- !InitAvaUnit(TRUE) ||
- !InitMenus(TRUE)
- )
- {Unload(); return 1;};
+ InitAvaUnit(TRUE);
+ InitMenus(TRUE);
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, AccListChanged);
AddTipperItem();
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ UnhookOptionsInitialization();
+ InitMenus(FALSE);
+ InitAvaUnit(FALSE);
return 0;
-} \ No newline at end of file
+}