Skip to content

Commit 871d761

Browse files
committed
Fixed fullscreen/windowed switching on Windows, fixed the core not setting a pointer to itself in Threaded processes
1 parent 8486ff0 commit 871d761

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Core/Contents/Source/PolyWinCore.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ void Win32Core::setVideoMode(int xRes, int yRes, bool fullScreen, bool vSync, in
239239
resetContext = true;
240240
}
241241

242+
bool wasFullscreen = this->fullScreen;
243+
242244
this->xRes = xRes;
243245
this->yRes = yRes;
244246
this->fullScreen = fullScreen;
@@ -248,6 +250,7 @@ void Win32Core::setVideoMode(int xRes, int yRes, bool fullScreen, bool vSync, in
248250

249251
SetWindowLong(hWnd, GWL_STYLE, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP);
250252
ShowWindow(hWnd, SW_SHOW);
253+
MoveWindow(hWnd, 0, 0, xRes, yRes, TRUE);
251254

252255
DEVMODE dmScreenSettings; // Device Mode
253256
memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared
@@ -258,11 +261,19 @@ void Win32Core::setVideoMode(int xRes, int yRes, bool fullScreen, bool vSync, in
258261
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
259262
ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN);
260263

261-
SetWindowPos(hWnd, NULL, 0, 0, xRes, yRes, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
264+
//SetWindowPos(hWnd, NULL, 0, 0, xRes, yRes, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
262265
} else {
263-
// SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPED|WS_SYSMENU);
264-
// ShowWindow(hWnd, SW_SHOW);
265-
ClientResize(hWnd, xRes, yRes);
266+
RECT rect;
267+
rect.left = 0;
268+
rect.top = 0;
269+
rect.right = xRes;
270+
rect.bottom = yRes;
271+
SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE);
272+
AdjustWindowRect(&rect, WS_CAPTION | WS_POPUPWINDOW, FALSE);
273+
MoveWindow(hWnd, 0, 0, rect.right-rect.left, rect.bottom-rect.top, TRUE);
274+
275+
ChangeDisplaySettings(0, 0);
276+
266277
}
267278

268279

@@ -1022,6 +1033,7 @@ DWORD WINAPI Win32LaunchThread(LPVOID data) {
10221033

10231034

10241035
void Win32Core::createThread(Threaded *target) {
1036+
Core::createThread(target);
10251037
DWORD dwGenericThread;
10261038
HANDLE handle = CreateThread(NULL,0,Win32LaunchThread,target,0,&dwGenericThread);
10271039
}

0 commit comments

Comments
 (0)