diff --git a/reactos/lib/user32/windows/defwnd.c b/reactos/lib/user32/windows/defwnd.c index c04e43d8669..e0f9d0d9edc 100644 --- a/reactos/lib/user32/windows/defwnd.c +++ b/reactos/lib/user32/windows/defwnd.c @@ -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); } diff --git a/reactos/lib/user32/windows/nonclient.c b/reactos/lib/user32/windows/nonclient.c index 02a328011e1..444d84bf96b 100644 --- a/reactos/lib/user32/windows/nonclient.c +++ b/reactos/lib/user32/windows/nonclient.c @@ -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; } diff --git a/reactos/lib/user32/windows/window.c b/reactos/lib/user32/windows/window.c index 20efad69ea9..bab497bf025 100644 --- a/reactos/lib/user32/windows/window.c +++ b/reactos/lib/user32/windows/window.c @@ -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; }