From e95cabc57a0f82a6fb6316dbd2e3b3fdaccff6f3 Mon Sep 17 00:00:00 2001 From: sje Date: Mon, 13 Nov 2006 12:32:06 +0000 Subject: mingw build for fl git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@43 4f64403b-2f21-0410-a795-97e2b3489a10 --- yapp/message_pump.cpp | 41 ++++++++++++++++++++++++----------------- yapp/version.h | 2 +- 2 files changed, 25 insertions(+), 18 deletions(-) (limited to 'yapp') diff --git a/yapp/message_pump.cpp b/yapp/message_pump.cpp index f5cedd8..3d67948 100644 --- a/yapp/message_pump.cpp +++ b/yapp/message_pump.cpp @@ -13,23 +13,29 @@ HANDLE hMPEvent; #define MAX_POPUPS 100 -// from popups, popup2 implementation +// from popups, popup2 implementation, slightly modified +// return true if there is a full-screen application (e.g. game) running bool is_full_screen() { - HWND hWnd = GetForegroundWindow(); - - if(!hWnd || !IsWindowVisible(hWnd) || IsIconic(hWnd) || !IsZoomed(hWnd)) return false; - - RECT rc; - if(!GetWindowRect(hWnd,&rc)) return false; - - if (rc.right - rc.left < GetSystemMetrics(SM_CXSCREEN) || rc.bottom - rc.top < GetSystemMetrics(SM_CYSCREEN)) return false; - - // at this point, it will return true for full-screen and, unfortunately, maximized windows - so we need to check for maximized - - LONG style = GetWindowLong(hWnd, GWL_STYLE); - if(style & WS_MAXIMIZEBOX) return false; - - return true; + int w = GetSystemMetrics(SM_CXSCREEN); + int h = GetSystemMetrics(SM_CYSCREEN); + + HWND hWnd = 0; + while (hWnd = FindWindowEx(NULL, hWnd, NULL, NULL)) { + if(!IsWindowVisible(hWnd) || IsIconic(hWnd)) + continue; + + if (!(GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST)) + continue; + + // not sure if this could be done more simply using 'IsZoomed'? + RECT WindowRect; + GetWindowRect(hWnd, &WindowRect); + if ((w != (WindowRect.right - WindowRect.left)) || (h != (WindowRect.bottom - WindowRect.top))) + continue; + + return true; + } + return false; } bool is_workstation_locked() @@ -67,8 +73,9 @@ DWORD CALLBACK MessagePumpThread(LPVOID param) { int status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0); if(status >= ID_STATUS_OFFLINE && status <= ID_STATUS_OUTTOLUNCH && options.disable_status[status - ID_STATUS_OFFLINE]) enabled = false; - if(options.disable_full_screen && is_full_screen() || is_workstation_locked()) + if((options.disable_full_screen && is_full_screen()) || is_workstation_locked()) enabled = false; + 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); diff --git a/yapp/version.h b/yapp/version.h index 4239f7d..fb22a17 100644 --- a/yapp/version.h +++ b/yapp/version.h @@ -4,7 +4,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 4 -#define __BUILD_NUM 4 +#define __BUILD_NUM 6 #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM #define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -- cgit v1.2.3