user32: Pass the window styles to NC_GetInsideRect instead of accessing the window structure.
This commit is contained in:
parent
7295b6746d
commit
c5bf4976f1
@ -479,7 +479,7 @@ LRESULT NC_HandleNCCalcSize( HWND hwnd, RECT *winRect )
|
|||||||
* but without the borders (if any).
|
* but without the borders (if any).
|
||||||
* The rectangle is in window coordinates (for drawing with GetWindowDC()).
|
* The rectangle is in window coordinates (for drawing with GetWindowDC()).
|
||||||
*/
|
*/
|
||||||
static void NC_GetInsideRect( HWND hwnd, RECT *rect )
|
static void NC_GetInsideRect( HWND hwnd, RECT *rect, DWORD style, DWORD ex_style )
|
||||||
{
|
{
|
||||||
WND *wndPtr = WIN_GetPtr( hwnd );
|
WND *wndPtr = WIN_GetPtr( hwnd );
|
||||||
|
|
||||||
@ -489,30 +489,29 @@ static void NC_GetInsideRect( HWND hwnd, RECT *rect )
|
|||||||
rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
|
rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
|
||||||
rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
|
rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
|
||||||
|
|
||||||
if (wndPtr->dwStyle & WS_ICONIC) goto END;
|
if (style & WS_ICONIC) goto END;
|
||||||
|
|
||||||
/* Remove frame from rectangle */
|
/* Remove frame from rectangle */
|
||||||
if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
|
if (HAS_THICKFRAME( style, ex_style ))
|
||||||
{
|
{
|
||||||
InflateRect( rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) );
|
InflateRect( rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) );
|
||||||
}
|
}
|
||||||
else if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
|
else if (HAS_DLGFRAME( style, ex_style ))
|
||||||
{
|
{
|
||||||
InflateRect( rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME));
|
InflateRect( rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME));
|
||||||
}
|
}
|
||||||
else if (HAS_THINFRAME( wndPtr->dwStyle ))
|
else if (HAS_THINFRAME( style ))
|
||||||
{
|
{
|
||||||
InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) );
|
InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We have additional border information if the window
|
/* We have additional border information if the window
|
||||||
* is a child (but not an MDI child) */
|
* is a child (but not an MDI child) */
|
||||||
if ( (wndPtr->dwStyle & WS_CHILD) &&
|
if ((style & WS_CHILD) && !(ex_style & WS_EX_MDICHILD))
|
||||||
( (wndPtr->dwExStyle & WS_EX_MDICHILD) == 0 ) )
|
|
||||||
{
|
{
|
||||||
if (wndPtr->dwExStyle & WS_EX_CLIENTEDGE)
|
if (ex_style & WS_EX_CLIENTEDGE)
|
||||||
InflateRect (rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE));
|
InflateRect (rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE));
|
||||||
if (wndPtr->dwExStyle & WS_EX_STATICEDGE)
|
if (ex_style & WS_EX_STATICEDGE)
|
||||||
InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
|
InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -706,7 +705,10 @@ BOOL NC_DrawSysButton (HWND hwnd, HDC hdc, BOOL down)
|
|||||||
if (hIcon)
|
if (hIcon)
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
NC_GetInsideRect( hwnd, &rect );
|
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
|
||||||
|
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
||||||
|
|
||||||
|
NC_GetInsideRect( hwnd, &rect, style, ex_style );
|
||||||
DrawIconEx (hdc, rect.left + 2, rect.top + 1, hIcon,
|
DrawIconEx (hdc, rect.left + 2, rect.top + 1, hIcon,
|
||||||
GetSystemMetrics(SM_CXSMICON),
|
GetSystemMetrics(SM_CXSMICON),
|
||||||
GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL);
|
GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL);
|
||||||
@ -728,11 +730,13 @@ BOOL NC_DrawSysButton (HWND hwnd, HDC hdc, BOOL down)
|
|||||||
static void NC_DrawCloseButton (HWND hwnd, HDC hdc, BOOL down, BOOL bGrayed)
|
static void NC_DrawCloseButton (HWND hwnd, HDC hdc, BOOL down, BOOL bGrayed)
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
|
||||||
|
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
||||||
|
|
||||||
NC_GetInsideRect( hwnd, &rect );
|
NC_GetInsideRect( hwnd, &rect, style, ex_style );
|
||||||
|
|
||||||
/* A tool window has a smaller Close button */
|
/* A tool window has a smaller Close button */
|
||||||
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW)
|
if (ex_style & WS_EX_TOOLWINDOW)
|
||||||
{
|
{
|
||||||
INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE */
|
INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE */
|
||||||
INT iBmpWidth = 11; /* it uses 11x11 for the close button in tool window */
|
INT iBmpWidth = 11; /* it uses 11x11 for the close button in tool window */
|
||||||
@ -766,15 +770,16 @@ static void NC_DrawMaxButton(HWND hwnd,HDC hdc,BOOL down, BOOL bGrayed)
|
|||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
UINT flags;
|
UINT flags;
|
||||||
|
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
|
||||||
|
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
||||||
|
|
||||||
/* never draw maximize box when window has WS_EX_TOOLWINDOW style */
|
/* never draw maximize box when window has WS_EX_TOOLWINDOW style */
|
||||||
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW)
|
if (ex_style & WS_EX_TOOLWINDOW) return;
|
||||||
return;
|
|
||||||
|
|
||||||
flags = IsZoomed(hwnd) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX;
|
flags = (style & WS_MAXIMIZE) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX;
|
||||||
|
|
||||||
NC_GetInsideRect( hwnd, &rect );
|
NC_GetInsideRect( hwnd, &rect, style, ex_style );
|
||||||
if (GetWindowLongW( hwnd, GWL_STYLE) & WS_SYSMENU)
|
if (style & WS_SYSMENU)
|
||||||
rect.right -= GetSystemMetrics(SM_CXSIZE);
|
rect.right -= GetSystemMetrics(SM_CXSIZE);
|
||||||
rect.left = rect.right - GetSystemMetrics(SM_CXSIZE);
|
rect.left = rect.right - GetSystemMetrics(SM_CXSIZE);
|
||||||
rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 2;
|
rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 2;
|
||||||
@ -796,12 +801,12 @@ static void NC_DrawMinButton(HWND hwnd,HDC hdc,BOOL down, BOOL bGrayed)
|
|||||||
RECT rect;
|
RECT rect;
|
||||||
UINT flags = DFCS_CAPTIONMIN;
|
UINT flags = DFCS_CAPTIONMIN;
|
||||||
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
|
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
|
||||||
|
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
||||||
|
|
||||||
/* never draw minimize box when window has WS_EX_TOOLWINDOW style */
|
/* never draw minimize box when window has WS_EX_TOOLWINDOW style */
|
||||||
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW)
|
if (ex_style & WS_EX_TOOLWINDOW) return;
|
||||||
return;
|
|
||||||
|
|
||||||
NC_GetInsideRect( hwnd, &rect );
|
NC_GetInsideRect( hwnd, &rect, style, ex_style );
|
||||||
if (style & WS_SYSMENU)
|
if (style & WS_SYSMENU)
|
||||||
rect.right -= GetSystemMetrics(SM_CXSIZE);
|
rect.right -= GetSystemMetrics(SM_CXSIZE);
|
||||||
if (style & (WS_MAXIMIZEBOX|WS_MINIMIZEBOX))
|
if (style & (WS_MAXIMIZEBOX|WS_MINIMIZEBOX))
|
||||||
@ -1215,13 +1220,14 @@ void NC_GetSysPopupPos( HWND hwnd, RECT* rect )
|
|||||||
if (IsIconic(hwnd)) GetWindowRect( hwnd, rect );
|
if (IsIconic(hwnd)) GetWindowRect( hwnd, rect );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
|
||||||
|
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
||||||
WND *wndPtr = WIN_GetPtr( hwnd );
|
WND *wndPtr = WIN_GetPtr( hwnd );
|
||||||
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return;
|
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return;
|
||||||
|
|
||||||
NC_GetInsideRect( hwnd, rect );
|
NC_GetInsideRect( hwnd, rect, style, ex_style );
|
||||||
OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
|
OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
|
||||||
if (wndPtr->dwStyle & WS_CHILD)
|
if (style & WS_CHILD) ClientToScreen( GetParent(hwnd), (POINT *)rect );
|
||||||
ClientToScreen( GetParent(hwnd), (POINT *)rect );
|
|
||||||
rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
|
rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
|
||||||
rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
|
rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
|
||||||
WIN_ReleasePtr( wndPtr );
|
WIN_ReleasePtr( wndPtr );
|
||||||
@ -1643,7 +1649,7 @@ BOOL WINAPI GetTitleBarInfo(HWND hwnd, PTITLEBARINFO tbi) {
|
|||||||
}
|
}
|
||||||
dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
|
dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
|
||||||
dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
|
dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
|
||||||
NC_GetInsideRect(hwnd, &tbi->rcTitleBar);
|
NC_GetInsideRect(hwnd, &tbi->rcTitleBar, dwStyle, dwExStyle);
|
||||||
|
|
||||||
GetWindowRect(hwnd, &wndRect);
|
GetWindowRect(hwnd, &wndRect);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user