[WIN32K]: Fix display of window title icon for dialogs having the WS_EX_DLGMODALFRAME style.

CORE-10850 #resolve
CORE-10437 #comment The real fix was committed in r70715.

svn path=/trunk/; revision=70715
This commit is contained in:
Hermès Bélusca-Maïto 2016-02-12 17:31:19 +00:00
parent ed391467a5
commit c98d80baf0
2 changed files with 21 additions and 17 deletions

View file

@ -356,7 +356,9 @@ DefWndDoSizeMove(PWND pwnd, WORD wParam)
hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE ); hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
if (iconic) if (iconic)
{ {
// DragCursor = pwnd->pcls->spcur;
DragCursor = pwnd->pcls->spicn; DragCursor = pwnd->pcls->spicn;
ERR("pwnd->pcls->spicn = 0x%p ; pwnd->pcls->spcur = 0x%p\n", pwnd->pcls->spicn, pwnd->pcls->spcur);
if (DragCursor) if (DragCursor)
{ {
UserReferenceObject(DragCursor); UserReferenceObject(DragCursor);
@ -630,7 +632,10 @@ PCURICON_OBJECT FASTCALL NC_IconForWindow( PWND pWnd )
if (!hIcon && pWnd->pcls->spicn) if (!hIcon && pWnd->pcls->spicn)
return 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->hIconSmWindows; // Both are IDI_WINLOGO Small
if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size. if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size.
@ -656,13 +661,13 @@ UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
{ {
UserReferenceObject(WindowIcon); UserReferenceObject(WindowIcon);
Ret = UserDrawIconEx( hDC, Ret = UserDrawIconEx(hDC,
Rect->left + 2, Rect->left + 2,
Rect->top + 2, Rect->top + 2,
WindowIcon, WindowIcon,
UserGetSystemMetrics(SM_CXSMICON), UserGetSystemMetrics(SM_CXSMICON),
UserGetSystemMetrics(SM_CYSMICON), UserGetSystemMetrics(SM_CYSMICON),
0, NULL, DI_NORMAL); 0, NULL, DI_NORMAL);
UserDereferenceObject(WindowIcon); UserDereferenceObject(WindowIcon);
} }
@ -966,9 +971,8 @@ VOID UserDrawCaptionBar(
} }
if (!(Flags & DC_ICON) && if (!(Flags & DC_ICON) &&
(Style & WS_SYSMENU) &&
!(Flags & DC_SMALLCAP) && !(Flags & DC_SMALLCAP) &&
!(ExStyle & WS_EX_DLGMODALFRAME) && (Style & WS_SYSMENU) &&
!(ExStyle & WS_EX_TOOLWINDOW) ) !(ExStyle & WS_EX_TOOLWINDOW) )
{ {
pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged.... 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; wParam = DC_CAPTION;
} }
if (Wnd->state & WNDS_NONCPAINT || !(Wnd->style & WS_VISIBLE)) if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
return 0; return 0;
/* This isn't documented but is reproducible in at least XP SP2 and /* This isn't documented but is reproducible in at least XP SP2 and

View file

@ -573,7 +573,7 @@ co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
if (Next) continue; if (Next) continue;
} }
if ( Child->style & WS_VISIBLE) if (Child->style & WS_VISIBLE)
{ {
USER_REFERENCE_ENTRY Ref; USER_REFERENCE_ENTRY Ref;
UserRefObjectCo(Child, &Ref); UserRefObjectCo(Child, &Ref);
@ -2101,14 +2101,14 @@ BOOL UserDrawCaption(
RECTL_vMakeWellOrdered(lpRc); RECTL_vMakeWellOrdered(lpRc);
/* Determine whether the icon needs to be displayed */
if (!hIcon && pWnd != NULL) if (!hIcon && pWnd != NULL)
{ {
HasIcon = (uFlags & DC_ICON) && (pWnd->style & WS_SYSMENU) HasIcon = (uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP) &&
&& !(uFlags & DC_SMALLCAP) && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME) (pWnd->style & WS_SYSMENU) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
&& !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
} }
else else
HasIcon = (hIcon != 0); HasIcon = (hIcon != NULL);
// Draw the caption background // Draw the caption background
if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON)) if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON))
@ -2192,7 +2192,7 @@ BOOL UserDrawCaption(
LONG cx = UserGetSystemMetrics(SM_CXSMICON); LONG cx = UserGetSystemMetrics(SM_CXSMICON);
LONG cy = UserGetSystemMetrics(SM_CYSMICON); LONG cy = UserGetSystemMetrics(SM_CYSMICON);
LONG x = Rect.left - cx/2 + 1 + (Rect.bottom - Rect.top)/2; // this is really what Window does 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); UserDrawIconEx(hDc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL);
UserDereferenceObject(pIcon); UserDereferenceObject(pIcon);
} }