GENERATE_INTERCEPT_HEADER(GetWindowRect, BOOL, WINAPI, _In_ HWND hWnd, _Out_ LPRECT lpRect) { SDLOG(2, "DetouredGetWindowRect\n"); HRESULT ret = TrueGetWindowRect(hWnd, lpRect); if(RSManager::currentlyDownsampling() && Settings::get().getModifyGetWindowRect()) { SDLOG(2, "- override from %s\n", RectToString(lpRect).c_str()); lpRect->right = Settings::get().getRenderWidth(); lpRect->bottom = Settings::get().getRenderHeight(); } SDLOG(2, "-> %s\n", RectToString(lpRect).c_str()); return ret; }
void WindowManager::maintainBorderlessFullscreen() { if(borderlessFullscreen) { HWND hwnd = ::GetActiveWindow(); RECT rect; TrueGetWindowRect(hwnd, &rect); HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); MONITORINFO info; info.cbSize = sizeof(MONITORINFO); GetMonitorInfo(monitor, &info); if(rect.left != info.rcMonitor.left || rect.top != info.rcMonitor.top || rect.right != info.rcMonitor.right || rect.bottom != info.rcMonitor.bottom) { SDLOG(0, "Restoring borderless window, previous rect: %s, monitor: %s\n", RectToString(&rect).c_str(), RectToString(&info.rcMonitor).c_str()); borderlessFullscreen = false; toggleBorderlessFullscreen(); } } }