diff --git a/reactos/win32ss/user/ntuser/nonclient.c b/reactos/win32ss/user/ntuser/nonclient.c index 14ffab20949..abb796cb43e 100644 --- a/reactos/win32ss/user/ntuser/nonclient.c +++ b/reactos/win32ss/user/ntuser/nonclient.c @@ -356,7 +356,9 @@ DefWndDoSizeMove(PWND pwnd, WORD wParam) hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE ); if (iconic) { + // DragCursor = pwnd->pcls->spcur; DragCursor = pwnd->pcls->spicn; + ERR("pwnd->pcls->spicn = 0x%p ; pwnd->pcls->spcur = 0x%p\n", pwnd->pcls->spicn, pwnd->pcls->spcur); if (DragCursor) { UserReferenceObject(DragCursor); @@ -630,7 +632,10 @@ PCURICON_OBJECT FASTCALL NC_IconForWindow( PWND pWnd ) if (!hIcon && pWnd->pcls->spicn) return pWnd->pcls->spicn; - if (!hIcon && (pWnd->style & DS_MODALFRAME)) + // WARNING: Wine code has this test completely wrong. The following is how + // Windows behaves for windows having the WS_EX_DLGMODALFRAME style set: + // it does not use the default icon! And it does not check for DS_MODALFRAME. + if (!hIcon && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME)) { if (!hIcon) hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size. @@ -656,13 +661,13 @@ UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down) { UserReferenceObject(WindowIcon); - Ret = UserDrawIconEx( hDC, - Rect->left + 2, - Rect->top + 2, - WindowIcon, - UserGetSystemMetrics(SM_CXSMICON), - UserGetSystemMetrics(SM_CYSMICON), - 0, NULL, DI_NORMAL); + Ret = UserDrawIconEx(hDC, + Rect->left + 2, + Rect->top + 2, + WindowIcon, + UserGetSystemMetrics(SM_CXSMICON), + UserGetSystemMetrics(SM_CYSMICON), + 0, NULL, DI_NORMAL); UserDereferenceObject(WindowIcon); } @@ -966,9 +971,8 @@ VOID UserDrawCaptionBar( } if (!(Flags & DC_ICON) && - (Style & WS_SYSMENU) && !(Flags & DC_SMALLCAP) && - !(ExStyle & WS_EX_DLGMODALFRAME) && + (Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) ) { pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged.... @@ -1435,7 +1439,7 @@ LRESULT NC_HandleNCActivate( PWND Wnd, WPARAM wParam, LPARAM lParam ) wParam = DC_CAPTION; } - if (Wnd->state & WNDS_NONCPAINT || !(Wnd->style & WS_VISIBLE)) + if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE)) return 0; /* This isn't documented but is reproducible in at least XP SP2 and diff --git a/reactos/win32ss/user/ntuser/painting.c b/reactos/win32ss/user/ntuser/painting.c index 631cc02e6fc..4e124f36e56 100644 --- a/reactos/win32ss/user/ntuser/painting.c +++ b/reactos/win32ss/user/ntuser/painting.c @@ -573,7 +573,7 @@ co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse) if (Next) continue; } - if ( Child->style & WS_VISIBLE) + if (Child->style & WS_VISIBLE) { USER_REFERENCE_ENTRY Ref; UserRefObjectCo(Child, &Ref); @@ -2101,14 +2101,14 @@ BOOL UserDrawCaption( RECTL_vMakeWellOrdered(lpRc); + /* Determine whether the icon needs to be displayed */ if (!hIcon && pWnd != NULL) { - HasIcon = (uFlags & DC_ICON) && (pWnd->style & WS_SYSMENU) - && !(uFlags & DC_SMALLCAP) && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME) - && !(pWnd->ExStyle & WS_EX_TOOLWINDOW); + HasIcon = (uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP) && + (pWnd->style & WS_SYSMENU) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW); } else - HasIcon = (hIcon != 0); + HasIcon = (hIcon != NULL); // Draw the caption background if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON)) @@ -2192,7 +2192,7 @@ BOOL UserDrawCaption( LONG cx = UserGetSystemMetrics(SM_CXSMICON); LONG cy = UserGetSystemMetrics(SM_CYSMICON); LONG x = Rect.left - cx/2 + 1 + (Rect.bottom - Rect.top)/2; // this is really what Window does - LONG y = (Rect.top + Rect.bottom)/2 - cy/2; // center + LONG y = (Rect.top + Rect.bottom - cy)/2; // center UserDrawIconEx(hDc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL); UserDereferenceObject(pIcon); }