From a4b442beef67e204c99d75e561ec9577d58ddf40 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 18 Mar 2013 13:48:48 +0000 Subject: removed endless loop in YAPP git-svn-id: http://svn.miranda-ng.org/main/trunk@4094 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/YAPP/src/message_pump.cpp | 9 ++++----- plugins/YAPP/src/popwin.cpp | 35 +++++++++++++++++------------------ plugins/YAPP/src/yapp.cpp | 4 ++-- 3 files changed, 23 insertions(+), 25 deletions(-) (limited to 'plugins/YAPP') diff --git a/plugins/YAPP/src/message_pump.cpp b/plugins/YAPP/src/message_pump.cpp index 3c2d297d92..a54c2cbba9 100644 --- a/plugins/YAPP/src/message_pump.cpp +++ b/plugins/YAPP/src/message_pump.cpp @@ -67,7 +67,6 @@ bool is_workstation_locked() return rc; } - unsigned __stdcall MessagePumpThread(void* param) { InitWindowStack(); @@ -143,13 +142,12 @@ unsigned __stdcall MessagePumpThread(void* param) DeinitWindowStack(); num_popups = 0; - //if (param) SetEvent((HANDLE)param); - DeinitServices(); return 0; } -void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam) { +void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam) +{ PostThreadMessage(message_pump_thread_id, msg, wParam, lParam); } @@ -159,7 +157,8 @@ void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam) { // when the event is signalled, the hwnd will be valid void FindWindow(PopupData *pd, HANDLE hEvent, HWND *hwnd); -void InitMessagePump() { +void InitMessagePump() +{ WNDCLASS popup_win_class = {0}; popup_win_class.lpfnWndProc = PopupWindowProc; popup_win_class.hInstance = hInst; diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index 0313ba6f30..cbc7eb8139 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -131,15 +131,16 @@ void AddWindowToStack(HWND hwnd) { RepositionWindows(); } -void RemoveWindowFromStack(HWND hwnd) { +void RemoveWindowFromStack(HWND hwnd) +{ HWNDStackNode *current = hwnd_stack_top, *prev = 0; while(current) { if (current->hwnd == hwnd) { - if (prev) { + if (prev) prev->next = current->next; - } else { + else hwnd_stack_top = current->next; - } + mir_free(current); stack_size--; break; @@ -149,19 +150,24 @@ void RemoveWindowFromStack(HWND hwnd) { current = current->next; } - if (hwnd_stack_top) RepositionWindows(); + if (hwnd_stack_top) + RepositionWindows(); } -void ClearStack() { - while(hwnd_stack_top) { - DestroyWindow(hwnd_stack_top->hwnd); +void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam) +{ + HWNDStackNode *current = hwnd_stack_top; + while(current) { + SendMessage(current->hwnd, msg, wParam, lParam); + current = current->next; } } -void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam) { +void DeinitWindowStack() +{ HWNDStackNode *current = hwnd_stack_top; while(current) { - SendMessage(current->hwnd, msg, wParam, lParam); + DestroyWindow(current->hwnd); current = current->next; } } @@ -729,17 +735,10 @@ void InitWindowStack() MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); MyAnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); MyMonitorFromRect=(HMONITOR (WINAPI*)(LPCRECT,DWORD))GetProcAddress(hUserDll, "MonitorFromRect"); - - MyGetMonitorInfo=(BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoW"); - + MyGetMonitorInfo=(BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoW"); } } -void DeinitWindowStack() -{ - ClearStack(); -} - /////////////////////////////////////////////////////////////////////////////// void PopupData::SetIcon(HICON hNewIcon) diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index cec66a0ee9..88aef60da0 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -162,8 +162,8 @@ int PreShutdown(WPARAM wParam, LPARAM lParam) return 0; } -extern "C" int __declspec(dllexport) Load(void) { - +extern "C" int __declspec(dllexport) Load(void) +{ mir_getLP(&pluginInfo); InitMessagePump(); -- cgit v1.2.3