summaryrefslogtreecommitdiff
path: root/yapp/message_pump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'yapp/message_pump.cpp')
-rw-r--r--yapp/message_pump.cpp41
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);