mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-08-06 01:10:24 +00:00
Merge pull request #358 from a740g/main
Fix incorrect client RECT offset when compiled with LLVM-MingW
This commit is contained in:
commit
5b987d52a8
1 changed files with 15 additions and 22 deletions
|
@ -989,31 +989,24 @@ void fgSetWindow ( SFG_Window *window )
|
||||||
*/
|
*/
|
||||||
void fghComputeWindowRectFromClientArea_UseStyle( const DWORD windowStyle, RECT *clientRect, BOOL posIsOutside )
|
void fghComputeWindowRectFromClientArea_UseStyle( const DWORD windowStyle, RECT *clientRect, BOOL posIsOutside )
|
||||||
{
|
{
|
||||||
int xBorderWidth = 0, yBorderWidth = 0;
|
RECT windowRect = {0, 0, 0, 0};
|
||||||
|
DWORD windowExStyle = 0;
|
||||||
|
|
||||||
/* If window has title bar, correct rect for it */
|
CopyRect(&windowRect, clientRect);
|
||||||
if (windowStyle & WS_SYSMENU) /* Need to query for WS_SYSMENU to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */
|
|
||||||
if (posIsOutside)
|
|
||||||
clientRect->bottom += GetSystemMetrics( SM_CYCAPTION );
|
|
||||||
else
|
|
||||||
clientRect->top -= GetSystemMetrics( SM_CYCAPTION );
|
|
||||||
|
|
||||||
/* get width of window's borders (frame), correct rect for it.
|
/* Get rect including non-client area */
|
||||||
* Note, borders can be of zero width if style does not specify borders
|
AdjustWindowRectEx(&windowRect, windowStyle, FALSE, windowExStyle);
|
||||||
*/
|
|
||||||
fghGetBorderWidth(windowStyle, &xBorderWidth, &yBorderWidth);
|
/* Move window right and down by non-client area extent on left and top, if wanted */
|
||||||
if (posIsOutside)
|
if (posIsOutside) {
|
||||||
{
|
windowRect.right += clientRect->left - windowRect.left;
|
||||||
clientRect->right += xBorderWidth * 2;
|
windowRect.bottom += clientRect->top - windowRect.top;
|
||||||
clientRect->bottom += yBorderWidth * 2;
|
windowRect.left = clientRect->left;
|
||||||
}
|
windowRect.top = clientRect->top;
|
||||||
else
|
|
||||||
{
|
|
||||||
clientRect->left -= xBorderWidth;
|
|
||||||
clientRect->right += xBorderWidth;
|
|
||||||
clientRect->top -= yBorderWidth;
|
|
||||||
clientRect->bottom += yBorderWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* done, copy windowRect to output */
|
||||||
|
CopyRect(clientRect, &windowRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Computes position of corners of window Rect (outer position including
|
/* Computes position of corners of window Rect (outer position including
|
||||||
|
|
Loading…
Reference in a new issue