- Reimplementation of CreateCursor (now the correct way).

- Various small fixes in the cursors/icon implementation.
- Print the message about InSendMessage being unimplemented only once (per process).

svn path=/trunk/; revision=12394
This commit is contained in:
Filip Navara
2004-12-30 02:32:26 +00:00
parent a0d295de59
commit ead9e85bda
3 changed files with 140 additions and 110 deletions
+52 -18
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: cursor.c,v 1.22 2004/08/15 21:36:29 chorns Exp $
/* $Id: cursor.c,v 1.23 2004/12/30 02:32:26 navaraf Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/cursor.c
@@ -78,7 +78,6 @@ CopyCursor(HCURSOR pcur)
return (HCURSOR)0;
}
/*
* @implemented
*/
@@ -91,24 +90,59 @@ CreateCursor(HINSTANCE hInst,
CONST VOID *pvANDPlane,
CONST VOID *pvXORPlane)
{
ICONINFO IconInfo;
ICONINFO IconInfo;
BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
HDC hScreenDc;
IconInfo.fIcon = FALSE;
IconInfo.xHotspot = xHotSpot;
IconInfo.yHotspot = yHotSpot;
IconInfo.hbmMask = CreateBitmap(nWidth, nHeight, 1, 1, pvANDPlane);
if(!IconInfo.hbmMask)
{
return (HICON)0;
}
IconInfo.hbmColor = CreateBitmap(nWidth, nHeight, 1, 1, pvXORPlane);
if(!IconInfo.hbmColor)
{
DeleteObject(IconInfo.hbmMask);
return (HICON)0;
}
hScreenDc = CreateCompatibleDC(NULL);
if (hScreenDc == NULL)
return NULL;
bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = nWidth;
bwBIH->bmiHeader.biHeight = -nHeight * 2;
bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bwBIH->bmiHeader.biPlanes = 1;
bwBIH->bmiHeader.biSizeImage = 0;
bwBIH->bmiHeader.biCompression = BI_RGB;
bwBIH->bmiHeader.biClrImportant = 0;
bwBIH->bmiHeader.biClrUsed = 0;
bwBIH->bmiHeader.biXPelsPerMeter = 0;
bwBIH->bmiHeader.biYPelsPerMeter = 0;
bwBIH->bmiColors[0].rgbBlue = 0;
bwBIH->bmiColors[0].rgbGreen = 0;
bwBIH->bmiColors[0].rgbRed = 0;
bwBIH->bmiColors[0].rgbReserved = 0;
bwBIH->bmiColors[1].rgbBlue = 0xff;
bwBIH->bmiColors[1].rgbGreen = 0xff;
bwBIH->bmiColors[1].rgbRed = 0xff;
bwBIH->bmiColors[1].rgbReserved = 0;
IconInfo.hbmMask = CreateDIBitmap(hScreenDc, &bwBIH->bmiHeader, 0,
NULL, bwBIH, DIB_RGB_COLORS);
if (IconInfo.hbmMask)
{
SetDIBits(hScreenDc, IconInfo.hbmMask, 0, nHeight,
pvXORPlane, bwBIH, DIB_RGB_COLORS);
SetDIBits(hScreenDc, IconInfo.hbmMask, nHeight, nHeight,
pvANDPlane, bwBIH, DIB_RGB_COLORS);
}
else
{
return NULL;
}
DeleteDC(hScreenDc);
IconInfo.fIcon = FALSE;
IconInfo.xHotspot = xHotSpot;
IconInfo.yHotspot = yHotSpot;
IconInfo.hbmColor = 0;
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
+80 -89
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: icon.c,v 1.23 2004/10/05 22:08:56 gvg Exp $
/* $Id: icon.c,v 1.24 2004/12/30 02:32:26 navaraf Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/icon.c
@@ -38,116 +38,107 @@
HICON
ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot)
{
BITMAPINFO* bwBIH;
ICONINFO IconInfo;
BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
ICONINFO IconInfo;
IconInfo.fIcon = TRUE;
IconInfo.xHotspot = xHotspot;
IconInfo.yHotspot = yHotspot;
/* Load the XOR bitmap */
IconInfo.hbmColor = CreateDIBitmap(hDC, &IconImage->icHeader, CBM_INIT,
ImageData, (BITMAPINFO*)IconImage, DIB_RGB_COLORS);
IconInfo.fIcon = TRUE;
IconInfo.xHotspot = xHotspot;
IconInfo.yHotspot = yHotspot;
/* make ImageData point to the start of the AND image data */
ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth *
/* Load the XOR bitmap */
IconInfo.hbmColor = CreateDIBitmap(hDC, &IconImage->icHeader, CBM_INIT,
ImageData, (BITMAPINFO*)IconImage,
DIB_RGB_COLORS);
/* Make ImageData point to the start of the AND image data. */
ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth *
IconImage->icHeader.biBitCount + 31) & ~31) >> 3) *
(IconImage->icHeader.biHeight );
/* create a BITMAPINFO header for the monocrome part of the icon */
bwBIH = RtlAllocateHeap(GetProcessHeap(), 0, sizeof (BITMAPINFOHEADER)+2*sizeof(RGBQUAD));
/* Create a BITMAPINFO header for the monocrome part of the icon. */
bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bwBIH->bmiHeader.biPlanes = 1;
bwBIH->bmiHeader.biSizeImage = 0;
bwBIH->bmiHeader.biCompression = BI_RGB;
bwBIH->bmiHeader.biClrImportant = 0;
bwBIH->bmiHeader.biClrUsed = 0;
bwBIH->bmiHeader.biXPelsPerMeter = 0;
bwBIH->bmiHeader.biYPelsPerMeter = 0;
bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bwBIH->bmiHeader.biPlanes = 1;
bwBIH->bmiHeader.biSizeImage = (((IconImage->icHeader.biWidth * 1 + 31) & ~31) >> 3) *
(IconImage->icHeader.biHeight );
bwBIH->bmiHeader.biCompression = BI_RGB;
bwBIH->bmiHeader.biClrImportant = 0;
bwBIH->bmiHeader.biClrUsed = 0;
bwBIH->bmiHeader.biXPelsPerMeter = 0;
bwBIH->bmiHeader.biYPelsPerMeter = 0;
bwBIH->bmiColors[0].rgbBlue = 0;
bwBIH->bmiColors[0].rgbGreen = 0;
bwBIH->bmiColors[0].rgbRed = 0;
bwBIH->bmiColors[0].rgbReserved = 0;
bwBIH->bmiColors[0].rgbBlue = 0;
bwBIH->bmiColors[0].rgbGreen = 0;
bwBIH->bmiColors[0].rgbRed = 0;
bwBIH->bmiColors[0].rgbReserved = 0;
bwBIH->bmiColors[1].rgbBlue = 0xff;
bwBIH->bmiColors[1].rgbGreen = 0xff;
bwBIH->bmiColors[1].rgbRed = 0xff;
bwBIH->bmiColors[1].rgbReserved = 0;
bwBIH->bmiColors[1].rgbBlue = 0xff;
bwBIH->bmiColors[1].rgbGreen = 0xff;
bwBIH->bmiColors[1].rgbRed = 0xff;
bwBIH->bmiColors[1].rgbReserved = 0;
/* load the AND bitmap */
IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
ImageData, bwBIH, DIB_RGB_COLORS);
/* Load the AND bitmap. */
IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
ImageData, bwBIH, DIB_RGB_COLORS);
SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
ImageData, bwBIH, DIB_RGB_COLORS);
SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
ImageData, bwBIH, DIB_RGB_COLORS);
RtlFreeHeap(GetProcessHeap(), 0, bwBIH);
/* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
/* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
HICON
ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot)
{
/* FIXME - color cursors */
BITMAPINFO* bwBIH;
ICONINFO IconInfo;
PVOID XORImageData = ImageData;
/* FIXME - color cursors */
BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
ICONINFO IconInfo;
PVOID XORImageData = ImageData;
IconInfo.fIcon = TRUE;
IconInfo.xHotspot = xHotspot;
IconInfo.yHotspot = yHotspot;
IconInfo.fIcon = FALSE;
IconInfo.xHotspot = xHotspot;
IconInfo.yHotspot = yHotspot;
/* create a BITMAPINFO header for the monocrome part of the icon */
bwBIH = RtlAllocateHeap(GetProcessHeap(), 0, sizeof (BITMAPINFOHEADER)+2*sizeof(RGBQUAD));
/* Create a BITMAPINFO header for the monocrome part of the icon */
bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bwBIH->bmiHeader.biPlanes = 1;
bwBIH->bmiHeader.biSizeImage = 0;
bwBIH->bmiHeader.biCompression = BI_RGB;
bwBIH->bmiHeader.biClrImportant = 0;
bwBIH->bmiHeader.biClrUsed = 0;
bwBIH->bmiHeader.biXPelsPerMeter = 0;
bwBIH->bmiHeader.biYPelsPerMeter = 0;
bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bwBIH->bmiHeader.biPlanes = 1;
bwBIH->bmiHeader.biSizeImage = (((IconImage->icHeader.biWidth * 1 + 31) & ~31) >> 3) *
(IconImage->icHeader.biHeight );
bwBIH->bmiHeader.biCompression = BI_RGB;
bwBIH->bmiHeader.biClrImportant = 0;
bwBIH->bmiHeader.biClrUsed = 0;
bwBIH->bmiHeader.biXPelsPerMeter = 0;
bwBIH->bmiHeader.biYPelsPerMeter = 0;
bwBIH->bmiColors[0].rgbBlue = 0;
bwBIH->bmiColors[0].rgbGreen = 0;
bwBIH->bmiColors[0].rgbRed = 0;
bwBIH->bmiColors[0].rgbReserved = 0;
bwBIH->bmiColors[0].rgbBlue = 0;
bwBIH->bmiColors[0].rgbGreen = 0;
bwBIH->bmiColors[0].rgbRed = 0;
bwBIH->bmiColors[0].rgbReserved = 0;
bwBIH->bmiColors[1].rgbBlue = 0xff;
bwBIH->bmiColors[1].rgbGreen = 0xff;
bwBIH->bmiColors[1].rgbRed = 0xff;
bwBIH->bmiColors[1].rgbReserved = 0;
bwBIH->bmiColors[1].rgbBlue = 0xff;
bwBIH->bmiColors[1].rgbGreen = 0xff;
bwBIH->bmiColors[1].rgbRed = 0xff;
bwBIH->bmiColors[1].rgbReserved = 0;
/* load the AND bitmap */
IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
XORImageData, bwBIH, DIB_RGB_COLORS);
/* Load the AND bitmap */
IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
XORImageData, bwBIH, DIB_RGB_COLORS);
if (IconInfo.hbmMask)
{
SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
XORImageData, bwBIH, DIB_RGB_COLORS);
}
if(IconInfo.hbmMask)
{
SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
XORImageData, bwBIH, DIB_RGB_COLORS);
}
IconInfo.hbmColor = (HBITMAP)0;
IconInfo.hbmColor = (HBITMAP)0;
RtlFreeHeap(GetProcessHeap(), 0, bwBIH);
/* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
/* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
+8 -3
View File
@@ -1,4 +1,4 @@
/* $Id: message.c,v 1.48 2004/12/27 16:48:29 navaraf Exp $
/* $Id: message.c,v 1.49 2004/12/30 02:32:26 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@@ -882,8 +882,13 @@ BOOL
STDCALL
InSendMessage(VOID)
{
static DWORD ShowNotImplemented = TRUE;
if (ShowNotImplemented)
{
DbgPrint("InSendMessage is unimplemented\n");
ShowNotImplemented = FALSE;
}
/* return(NtUserGetThreadState(THREADSTATE_INSENDMESSAGE) != ISMEX_NOSEND); */
UNIMPLEMENTED;
return FALSE;
}
@@ -1919,7 +1924,7 @@ BOOL WINAPI IsInsideMessagePumpHook()
if(!gfMessagePumpHook)
return FALSE;
/* This code checks for WOW16. */
/* This code checks if we're inside SendMessage. */
#if 0
/* Since our TEB doesnt match that of real windows, testing this value is useless until we know what it does
PUCHAR NtTeb = (PUCHAR)NtCurrentTeb();