mirror of
https://github.com/edubart/otclient.git
synced 2025-04-29 17:19:20 +02:00
Fix window position when entering fullscreen mode on Windows platform (#1099)
This commit is contained in:
parent
70400bc83e
commit
83959e5e23
@ -852,10 +852,19 @@ void WIN32Window::setFullscreen(bool fullscreen)
|
||||
wpPrev.length = sizeof(wpPrev);
|
||||
|
||||
if(fullscreen) {
|
||||
Size size = getDisplaySize();
|
||||
MONITORINFO mi;
|
||||
HMONITOR m = MonitorFromWindow(m_window, MONITOR_DEFAULTTONEAREST);
|
||||
mi.cbSize = sizeof(mi);
|
||||
GetMonitorInfoW(m, &mi);
|
||||
uint x = mi.rcMonitor.left;
|
||||
uint y = mi.rcMonitor.top;
|
||||
uint width = mi.rcMonitor.right - mi.rcMonitor.left;
|
||||
uint height = mi.rcMonitor.bottom - mi.rcMonitor.top;
|
||||
|
||||
GetWindowPlacement(m_window, &wpPrev);
|
||||
|
||||
SetWindowLong(m_window, GWL_STYLE, (dwStyle & ~WS_OVERLAPPEDWINDOW) | WS_POPUP | WS_EX_TOPMOST);
|
||||
SetWindowPos(m_window, HWND_TOPMOST, 0, 0, size.width(), size.height(), SWP_FRAMECHANGED);
|
||||
SetWindowPos(m_window, HWND_TOPMOST, x, y, width, height, SWP_FRAMECHANGED);
|
||||
} else {
|
||||
SetWindowLong(m_window, GWL_STYLE, (dwStyle & ~(WS_POPUP | WS_EX_TOPMOST)) | WS_OVERLAPPEDWINDOW);
|
||||
SetWindowPlacement(m_window, &wpPrev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user