From 3c50a9aa27d2138b757dd7822841c106f4c99b18 Mon Sep 17 00:00:00 2001 From: sje Date: Fri, 20 Jul 2007 17:26:51 +0000 Subject: convert to new popup api (see m_yapp.h in yapp/docs) git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@297 4f64403b-2f21-0410-a795-97e2b3489a10 --- yapp/message_pump.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'yapp/message_pump.cpp') diff --git a/yapp/message_pump.cpp b/yapp/message_pump.cpp index 535f8fc..db84f64 100644 --- a/yapp/message_pump.cpp +++ b/yapp/message_pump.cpp @@ -16,8 +16,8 @@ HANDLE hMPEvent; // from popups, popup2 implementation, slightly modified // return true if there is a full-screen application (e.g. game) running bool is_full_screen() { - int w = GetSystemMetrics(SM_CXFULLSCREEN); - int h = GetSystemMetrics(SM_CYFULLSCREEN); + int w = GetSystemMetrics(SM_CXSCREEN); + int h = GetSystemMetrics(SM_CYSCREEN); // use ClientRect instead of WindowRect so that it works normally for maximized applications - thx Nikto RECT ClientRect; HWND hWnd = 0; @@ -106,6 +106,7 @@ DWORD CALLBACK MessagePumpThread(LPVOID param) { if((options.disable_full_screen && is_full_screen()) || is_workstation_locked()) enabled = false; + PopupData *pd = (PopupData *)hwndMsg.lParam; if(enabled && num_popups < MAX_POPUPS) { //HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, GetDesktopWindow(), 0, hInst, (LPVOID)hwndMsg.lParam); HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)hwndMsg.lParam); @@ -113,7 +114,9 @@ DWORD CALLBACK MessagePumpThread(LPVOID param) { if(hwndMsg.wParam) // set notifyer handle SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0); } else { - free((void *)hwndMsg.lParam); + if(pd && pd->pwzTitle) free(pd->pwzTitle); + if(pd && pd->pwzText) free(pd->pwzText); + if(pd) free(pd); } } break; @@ -172,7 +175,7 @@ void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam) { // will post a message to the message queue which will set the hwnd value // and then set the event...so create an event, call this function and then wait on the event // when the event is signalled, the hwnd will be valid -void FindWindow(POPUPDATAW *pd, HANDLE hEvent, HWND *hwnd); +void FindWindow(PopupData *pd, HANDLE hEvent, HWND *hwnd); void InitMessagePump() { WNDCLASS popup_win_class = {0}; @@ -192,6 +195,5 @@ void InitMessagePump() { } void DeinitMessagePump() { - PostMPMessage(WM_QUIT, 0, 0); } -- cgit v1.2.3