Author: hbelusca
Date: Fri Feb 12 17:31:19 2016
New Revision: 70715
URL:
http://svn.reactos.org/svn/reactos?rev=70715&view=rev
Log:
[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.
Modified:
trunk/reactos/win32ss/user/ntuser/nonclient.c
trunk/reactos/win32ss/user/ntuser/painting.c
Modified: trunk/reactos/win32ss/user/ntuser/nonclient.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/noncli…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] Fri Feb 12 17:31:19 2016
@@ -356,7 +356,9 @@
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 @@
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 @@
{
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 @@
}
if (!(Flags & DC_ICON) &&
+ !(Flags & DC_SMALLCAP) &&
(Style & WS_SYSMENU) &&
- !(Flags & DC_SMALLCAP) &&
- !(ExStyle & WS_EX_DLGMODALFRAME) &&
!(ExStyle & WS_EX_TOOLWINDOW) )
{
pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON
not flaged....
@@ -1435,7 +1439,7 @@
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
Modified: trunk/reactos/win32ss/user/ntuser/painting.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/painti…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] Fri Feb 12 17:31:19 2016
@@ -573,7 +573,7 @@
if (Next) continue;
}
- if ( Child->style & WS_VISIBLE)
+ if (Child->style & WS_VISIBLE)
{
USER_REFERENCE_ENTRY Ref;
UserRefObjectCo(Child, &Ref);
@@ -2101,14 +2101,14 @@
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 @@
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);
}