Ensure the window size is correct (#1855)

This commit is contained in:
RH 2024-04-27 05:09:52 +10:00 committed by GitHub
parent d69f0c0d91
commit f20be6ab95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -498,6 +498,13 @@ bool GLViewImpl::initWithRect(std::string_view viewName, const ax::Rect& rect, f
return false; return false;
} }
int actualWidth, actualHeight;
glfwGetWindowSize(_mainWindow, &actualWidth, &actualHeight);
if (static_cast<int>(windowSize.width) != actualWidth || static_cast<int>(windowSize.height) != actualHeight)
{
windowSize.set(static_cast<float>(actualWidth), static_cast<float>(actualHeight));
}
#if defined(AX_USE_METAL) #if defined(AX_USE_METAL)
int fbWidth, fbHeight; int fbWidth, fbHeight;
glfwGetFramebufferSize(_mainWindow, &fbWidth, &fbHeight); glfwGetFramebufferSize(_mainWindow, &fbWidth, &fbHeight);