Skip to content

Instantly share code, notes, and snippets.

@michicc
Created March 8, 2021 12:46
Show Gist options
  • Save michicc/9552b45ceb74faaf162ce16d41a04c25 to your computer and use it in GitHub Desktop.
Save michicc/9552b45ceb74faaf162ce16d41a04c25 to your computer and use it in GitHub Desktop.
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 54c01e145..d69f8c1ba 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -129,9 +129,10 @@ uint8 VideoDriver_Win32Base::GetFullscreenBpp()
/**
* Instantiate a new window.
* @param full_screen Whether to make a full screen window or not.
+ * @param resize Whether to change window size.
* @return True if the window could be created.
*/
-bool VideoDriver_Win32Base::MakeWindow(bool full_screen)
+bool VideoDriver_Win32Base::MakeWindow(bool full_screen, bool resize)
{
/* full_screen is whether the new window should be fullscreen,
* _wnd.fullscreen is whether the current window is. */
@@ -206,7 +207,7 @@ bool VideoDriver_Win32Base::MakeWindow(bool full_screen)
h = r.bottom - r.top;
if (this->main_wnd != nullptr) {
- if (!_window_maximize) SetWindowPos(this->main_wnd, 0, 0, 0, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE);
+ if (!_window_maximize && resize) SetWindowPos(this->main_wnd, 0, 0, 0, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE);
} else {
int x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
int y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
@@ -1046,7 +1047,7 @@ bool VideoDriver_Win32GDI::AllocateBackingStore(int w, int h, bool force)
bool VideoDriver_Win32GDI::AfterBlitterChange()
{
assert(BlitterFactory::GetCurrentBlitter()->GetScreenDepth() != 0);
- return this->AllocateBackingStore(_screen.width, _screen.height, true) && this->MakeWindow(_fullscreen);
+ return this->AllocateBackingStore(_screen.width, _screen.height, true) && this->MakeWindow(_fullscreen, false);
}
void VideoDriver_Win32GDI::MakePalette()
diff --git a/src/video/win32_v.h b/src/video/win32_v.h
index 8b7b53b05..5589170c4 100644
--- a/src/video/win32_v.h
+++ b/src/video/win32_v.h
@@ -54,7 +54,7 @@ protected:
bool PollEvent() override;
void Initialize();
- bool MakeWindow(bool full_screen);
+ bool MakeWindow(bool full_screen, bool resize = true);
void ClientSizeChanged(int w, int h, bool force = false);
/** Get screen depth to use for fullscreen mode. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment