diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-13 12:32:06 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-13 12:32:06 +0000 |
commit | e95cabc57a0f82a6fb6316dbd2e3b3fdaccff6f3 (patch) | |
tree | a8f78be7b843e47ba92be3d41267f07902386fd4 /yapp/message_pump.cpp | |
parent | df59cbfe798046867e2146e28c98ee2fe6601abe (diff) |
mingw build for fl
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@43 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'yapp/message_pump.cpp')
-rw-r--r-- | yapp/message_pump.cpp | 41 |
1 files changed, 24 insertions, 17 deletions
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);
|