1
0
Fork 0

source/Platform/Win32/Win32Display.cpp: in create() fix a bug where window size was initially not setup correctly causing two resize events.

This commit is contained in:
Henrik Hautakoski 2023-08-03 15:43:18 +02:00
parent ea4267ef2d
commit fcc292a40f

View file

@ -42,20 +42,26 @@ Win32Display::~Win32Display()
bool Win32Display::create(DisplayDescription description)
{
DWORD flags;
Vector2i pos;
Vector2i pos, actual_size;
if (firstTime) {
registerClass();
firstTime = false;
}
// Store the size for use later.
m_size = Vector2u(description.mode.width, description.mode.height);
// Set window to center and set decoration flags.
pos = centerWindow(description.mode.width, description.mode.height);
flags = getWin32Flags(description.decoration);
// Calculate the actuall window size (with borders and stuff)
actual_size = calculateSize(flags, description.mode.width, description.mode.height);
// Create window.
m_handle = CreateWindowExA(0, WND_CLASSNAME, "", flags,
pos.x, pos.y, description.mode.width, description.mode.height,
pos.x, pos.y, actual_size.x, actual_size.y,
NULL, NULL, GetModuleHandle(NULL), (LPVOID) this);
if (!m_handle) {
@ -63,11 +69,6 @@ bool Win32Display::create(DisplayDescription description)
return false;
}
setSize(description.mode.width, description.mode.height);
// Store the size for use later.
m_size = getSize();
return true;
}