From 32414442e287b95cf2557d4e9933841a269ce007 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Wed, 15 Apr 2009 17:09:17 +0000 Subject: [PATCH] - Detect switched color and mask bitmaps in CreateCursorIndirect and switch them back - Don't set the icon hotspot too early in CreateIcon - Fixes five cursoricon winetests svn path=/trunk/; revision=40531 --- reactos/dll/win32/user32/windows/icon.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/user32/windows/icon.c b/reactos/dll/win32/user32/windows/icon.c index b19a50ddbd4..e6a32fd6cfd 100644 --- a/reactos/dll/win32/user32/windows/icon.c +++ b/reactos/dll/win32/user32/windows/icon.c @@ -195,8 +195,6 @@ CreateIcon( ICONINFO IconInfo; IconInfo.fIcon = TRUE; - IconInfo.xHotspot = nWidth / 2; - IconInfo.yHotspot = nHeight / 2; if (cBitsPixel == 1) { @@ -347,6 +345,7 @@ CreateIconIndirect(PICONINFO IconInfo) { BITMAP ColorBitmap; BITMAP MaskBitmap; + HBITMAP hbmTemp; if(!IconInfo) { @@ -363,13 +362,20 @@ CreateIconIndirect(PICONINFO IconInfo) if (GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap)) { /* Compare size of color and mask bitmap*/ - if(ColorBitmap.bmWidth != MaskBitmap.bmWidth || + if (ColorBitmap.bmWidth != MaskBitmap.bmWidth || ColorBitmap.bmHeight != MaskBitmap.bmHeight) { ERR("Color and mask size are different!"); SetLastError(ERROR_INVALID_PARAMETER); return (HICON)0; } + /* Check if color and mask are switched and switch them back */ + if (MaskBitmap.bmBitsPixel != 1 && ColorBitmap.bmBitsPixel == 1) + { + hbmTemp = IconInfo->hbmMask; + IconInfo->hbmMask = IconInfo->hbmColor; + IconInfo->hbmColor = hbmTemp; + } } return (HICON)NtUserCreateCursorIconHandle(IconInfo, TRUE); }