Correctly draw the titlebar as active or inactive during the processing of WM_NCACTIVATE message.

svn path=/trunk/; revision=14248
This commit is contained in:
Filip Navara 2005-03-21 01:59:21 +00:00
parent 2315100314
commit fd19aa00e6
3 changed files with 20 additions and 18 deletions

View file

@ -31,7 +31,7 @@
#define WM_QUERYDROPOBJECT 0x022B
#endif
LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn);
LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active);
LRESULT DefWndNCCalcSize(HWND hWnd, BOOL CalcSizeStruct, RECT *Rect);
LRESULT DefWndNCActivate(HWND hWnd, WPARAM wParam);
LRESULT DefWndNCHitTest(HWND hWnd, POINT Point);
@ -949,7 +949,7 @@ User32DefWindowProc(HWND hWnd,
{
case WM_NCPAINT:
{
return DefWndNCPaint(hWnd, (HRGN)wParam);
return DefWndNCPaint(hWnd, (HRGN)wParam, -1);
}
case WM_NCCALCSIZE:
@ -1472,7 +1472,7 @@ DefWindowProcA(HWND hWnd,
if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{
DefWndNCPaint(hWnd, (HRGN)1);
DefWndNCPaint(hWnd, (HRGN)1, -1);
}
return TRUE;
}
@ -1532,7 +1532,7 @@ DefWindowProcW(HWND hWnd,
if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{
DefWndNCPaint(hWnd, (HRGN)1);
DefWndNCPaint(hWnd, (HRGN)1, -1);
}
return (1);
}

View file

@ -288,10 +288,9 @@ UserDrawCaptionButtonWnd(HWND hWnd, HDC hDC, BOOL bDown, ULONG Type)
* - Correct drawing of size-box
*/
LRESULT
DefWndNCPaint(HWND hWnd, HRGN hRgn)
DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
{
HDC hDC;
BOOL Active;
DWORD Style, ExStyle;
HWND Parent;
RECT ClientRect, WindowRect, CurrentRect, TempRect;
@ -309,15 +308,18 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn)
Parent = GetParent(hWnd);
ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
if (ExStyle & WS_EX_MDICHILD)
if (Active == -1)
{
Active = IsChild(GetForegroundWindow(), hWnd);
if (Active)
Active = (hWnd == (HWND)SendMessageW(Parent, WM_MDIGETACTIVE, 0, 0));
}
else
{
Active = (GetForegroundWindow() == hWnd);
if (ExStyle & WS_EX_MDICHILD)
{
Active = IsChild(GetForegroundWindow(), hWnd);
if (Active)
Active = (hWnd == (HWND)SendMessageW(Parent, WM_MDIGETACTIVE, 0, 0));
}
else
{
Active = (GetForegroundWindow() == hWnd);
}
}
GetWindowRect(hWnd, &WindowRect);
GetClientRect(hWnd, &ClientRect);
@ -660,7 +662,7 @@ DefWndNCCalcSize(HWND hWnd, BOOL CalcSizeStruct, RECT *Rect)
LRESULT
DefWndNCActivate(HWND hWnd, WPARAM wParam)
{
DefWndNCPaint(hWnd, (HRGN)1);
DefWndNCPaint(hWnd, (HRGN)1, wParam);
return TRUE;
}

View file

@ -22,7 +22,7 @@
BOOL ControlsInitialized = FALSE;
LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn);
LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active);
/* FUNCTIONS *****************************************************************/
@ -1236,7 +1236,7 @@ SetWindowTextA(HWND hWnd,
if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{
DefWndNCPaint(hWnd, (HRGN)1);
DefWndNCPaint(hWnd, (HRGN)1, -1);
}
return TRUE;
}
@ -1270,7 +1270,7 @@ SetWindowTextW(HWND hWnd,
if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{
DefWndNCPaint(hWnd, (HRGN)1);
DefWndNCPaint(hWnd, (HRGN)1, -1);
}
return TRUE;
}