MCPcopy Create free account
hub / github.com/SFML/SFML / contentSizeToWindowSize

Method contentSizeToWindowSize

src/SFML/Window/Win32/WindowImplWin32.cpp:580–593  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

578
579////////////////////////////////////////////////////////////
580Vector2i WindowImplWin32::contentSizeToWindowSize(Vector2u size)
581{
582 // SetWindowPos wants the total size of the window (including title bar, borders, and menu) so we have to compute it
583 const auto style = static_cast<DWORD>(GetWindowLongPtr(m_handle, GWL_STYLE));
584 const BOOL hasMenu = ((style & WS_CHILD) == 0) && GetMenu(m_handle) != nullptr;
585 const auto exStyle = static_cast<DWORD>(GetWindowLongPtr(m_handle, GWL_EXSTYLE));
586
587 RECT rectangle = {0, 0, static_cast<long>(size.x), static_cast<long>(size.y)};
588 AdjustWindowRectEx(&rectangle, style, hasMenu, exStyle);
589 const auto width = rectangle.right - rectangle.left;
590 const auto height = rectangle.bottom - rectangle.top;
591
592 return {width, height};
593}
594
595
596////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected