Fullscreen preview on the same monitor as the OBS window and force a call to resize even if the window is maximized.

This commit is contained in:
Eric 2013-03-18 21:26:29 +01:00
parent bdb572c2c0
commit 5fad211eec

View File

@ -844,8 +844,15 @@ void OBS::SetFullscreenMode(bool fullscreen)
SetMenu(hwndMain, NULL); SetMenu(hwndMain, NULL);
// Fill entire screen // Fill entire screen
// TODO: SM_CXSCREEN is for primary monitor only. Use MonitorFromWindow() for multi-monitor support HMONITOR monitorForWidow = MonitorFromWindow(hwndMain, MONITOR_DEFAULTTONEAREST);
SetWindowPos(hwndMain, HWND_TOPMOST, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_FRAMECHANGED); MONITORINFO monitorInfo;
monitorInfo.cbSize = sizeof(monitorInfo);
GetMonitorInfo(monitorForWidow, &monitorInfo);
int x = monitorInfo.rcMonitor.left;
int y = monitorInfo.rcMonitor.top;
int cx = monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left;
int cy = monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top;
SetWindowPos(hwndMain, HWND_TOPMOST, x, y, cx, cy, SWP_FRAMECHANGED);
// Update menu checkboxes // Update menu checkboxes
CheckMenuItem(hmenuMain, ID_FULLSCREENMODE, MF_CHECKED); CheckMenuItem(hmenuMain, ID_FULLSCREENMODE, MF_CHECKED);
@ -874,6 +881,9 @@ void OBS::SetFullscreenMode(bool fullscreen)
// Disable always-on-top if needed // Disable always-on-top if needed
SetWindowPos(hwndMain, (App->bAlwaysOnTop)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); SetWindowPos(hwndMain, (App->bAlwaysOnTop)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
// Workaround: If the window is maximized, resize isn't called, so do it manually
ResizeWindow(false);
} }
} }