Fix fullscreen check only returning true if window is focused on Windows

by @WarmUpTill
This commit is contained in:
Myned 2020-06-06 18:39:57 -04:00
parent fabb7406bd
commit 5590e97f4f
No known key found for this signature in database
GPG Key ID: 24318A323F309244

View File

@ -105,22 +105,36 @@ pair<int, int> getCursorPos()
return pos;
}
// Argument added in lieu of fullscreen bug fix
bool isFullscreen(std::string &title)
{
RECT appBounds;
RECT rc;
HWND hwnd = GetWindow(GetDesktopWindow(), GW_CHILD);
while (hwnd)
{
string wtitle;
if (WindowValid(hwnd) && GetWindowTitle(hwnd, wtitle) && wtitle == title)
break;
hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
}
GetWindowRect(GetDesktopWindow(), &rc);
HWND hwnd = GetForegroundWindow();
if (hwnd != GetDesktopWindow() && hwnd != GetShellWindow())
{
GetWindowRect(hwnd, &appBounds);
if (rc.bottom == appBounds.bottom && rc.top == appBounds.top && rc.left == appBounds.left
&& rc.right == appBounds.right)
{
if
(
rc.bottom == appBounds.bottom
&& rc.top == appBounds.top
&& rc.left == appBounds.left
&& rc.right == appBounds.right
) {
return true;
}
}
return false;
}