Implemented SetCursor and rewrote some cursor/icon routines

svn path=/trunk/; revision=6603
This commit is contained in:
Thomas Bluemel 2003-11-10 17:44:50 +00:00
parent 94e9ddef83
commit 1193f17c26
16 changed files with 1367 additions and 724 deletions

View file

@ -314,6 +314,7 @@ NtUserCopyAcceleratorTable 3
NtUserCountClipboardFormats 0
NtUserCreateAcceleratorTable 2
NtUserCreateCaret 4
NtUserCreateCursorIconHandle 2
NtUserCreateDesktop 5
NtUserCreateLocalMemHandle 4
NtUserCreateMenu 0
@ -349,7 +350,7 @@ NtUserEnumDisplaySettings 4
NtUserEvent 1
NtUserExcludeUpdateRgn 2
NtUserFillWindow 4
NtUserFindExistingCursorIcon 3
NtUserFindExistingCursorIcon 2
NtUserFindWindowEx 4
NtUserFlashWindowEx 1
NtUserGetActiveWindow 0
@ -383,8 +384,8 @@ NtUserGetDoubleClickTime 0
NtUserGetForegroundWindow 0
NtUserGetGuiResources 2
NtUserGetGUIThreadInfo 2
NtUserGetIconInfo 6
NtUserGetIconSize 4
NtUserGetIconInfo 2
NtUserGetIconSize 3
NtUserGetImeHotKey 4
NtUserGetInternalWindowPos 3
NtUserGetKeyboardLayoutList 2
@ -481,8 +482,8 @@ NtUserSetClipboardData 3
NtUserSetClipboardViewer 1
NtUserSetConsoleReserveKeys 2
NtUserSetCursor 1
NtUserSetCursorContents 2
NtUserSetCursorIconData 4
NtUserSetCursorIconContents 2
NtUserSetCursorIconData 6
NtUserSetDbgTag 2
NtUserSetFocus 1
NtUserSetImeHotKey 5

View file

@ -292,6 +292,24 @@ enum _GLYPH_MODE
#define GCAPS_NO64BITMEMACCESS 0x00400000
#define GCAPS_FORCEDITHER 0x00800000
#define GCAPS_GRAY16 0x01000000
#define GCAPS_ICM 0x02000000
#define GCAPS_CMYKCOLOR 0x04000000
#define GCAPS_LAYERED 0x08000000
#define GCAPS_ARBRUSHTEXT 0x10000000
#define GCAPS_SCREENPRECISION 0x20000000
#define GCAPS_FONT_RASTERIZER 0x40000000
#define GCAPS_NUP 0x80000000
#define GCAPS2_JPEGSRC 0x00000001
#define GCAPS2_xxxx 0x00000002
#define GCAPS2_PNGSRC 0x00000008
#define GCAPS2_CHANGEGAMMARAMP 0x00000010
#define GCAPS2_ALPHACURSOR 0x00000020
#define GCAPS2_SYNCFLUSH 0x00000040
#define GCAPS2_SYNCTIMER 0x00000080
#define GCAPS2_ICD_MULTIMON 0x00000100
#define GCAPS2_MOUSETRAILS 0x00000200
#define GCAPS2_RESERVED1 0x00000400
/* EngAssocateSurface hook flags */
#define HOOK_BITBLT 0x00000001
@ -527,6 +545,7 @@ typedef struct _DEVINFO
USHORT cxDither;
USHORT cyDither;
HPALETTE hpalDefault;
ULONG flGraphicsCaps2;
} DEVINFO, *PDEVINFO;
typedef struct _GDIINFO

View file

@ -1382,6 +1382,9 @@ extern "C" {
/* GetComputerName */
#define MAX_COMPUTERNAME_LENGTH (15)
/* GetCursorInfo */
#define CURSOR_SHOWING 0x00000001
/* GetCPInfo */
#define CP_ACP (0)

View file

@ -270,6 +270,12 @@ NtUserCreateCaret(
int nWidth,
int nHeight);
HICON
STDCALL
NtUserCreateCursorIconHandle(
PICONINFO IconInfo,
BOOL Indirect);
HDESK
STDCALL
NtUserCreateDesktop(
@ -427,20 +433,20 @@ NtUserDrawCaptionTemp(
DWORD Unknown5,
DWORD Unknown6);
DWORD
BOOL
STDCALL
NtUserDrawIconEx(
HDC hdc,
int xLeft,
int yTop,
HICON hIcon,
int cxWidth,
int cyWidth,
UINT istepIfAniCur,
HBRUSH hbrFlickerFreeDraw,
UINT diFlags,
DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2,
DWORD Unknown3,
DWORD Unknown4,
DWORD Unknown5,
DWORD Unknown6,
DWORD Unknown7,
DWORD Unknown8,
DWORD Unknown9,
DWORD Unknown10);
DWORD Unknown1);
DWORD
STDCALL
@ -534,12 +540,11 @@ NtUserFillWindow(
DWORD Unknown2,
DWORD Unknown3);
DWORD
HICON
STDCALL
NtUserFindExistingCursorIcon(
DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2);
HMODULE hModule,
HRSRC hRsrc);
HWND
STDCALL
@ -698,23 +703,18 @@ NtUserGetGUIThreadInfo(
DWORD Unknown0,
DWORD Unknown1);
DWORD
BOOL
STDCALL
NtUserGetIconInfo(
HICON hIcon,
PBOOL fIcon,
PDWORD xHotspot,
PDWORD yHotspot,
HBITMAP *hbmMask,
HBITMAP *hbmColor);
PICONINFO IconInfo);
BOOL
STDCALL
NtUserGetIconSize(
HICON hIcon,
BOOL *fIcon,
LONG *Width,
LONG *Height);
SIZE *Size);
DWORD
STDCALL
@ -1336,17 +1336,19 @@ NtUserSetCursor(
BOOL
STDCALL
NtUserSetCursorContents(
NtUserSetCursorIconContents(
HCURSOR hCursor,
DWORD Unknown);
PICONINFO IconInfo);
BOOL
STDCALL
NtUserSetCursorIconData(
HICON hIcon,
PBOOL fIcon,
PDWORD xHotspot,
PDWORD yHotspot);
POINT *Hotspot,
HMODULE hModule,
HRSRC hRsrc,
HRSRC hGroupRsrc);
DWORD
STDCALL

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: bitmap.c,v 1.18 2003/10/15 19:39:08 navaraf Exp $
/* $Id: bitmap.c,v 1.19 2003/11/10 17:44:49 weiden Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c
@ -35,6 +35,7 @@
#include <stdlib.h>
/*forward declerations... actualy in user32\windows\icon.c but usful here****/
HICON ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot);
HICON ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot);
CURSORICONDIRENTRY *CURSORICON_FindBestIcon( CURSORICONDIR *dir, int width, int height, int colors);
CURSORICONDIRENTRY *CURSORICON_FindBestCursor( CURSORICONDIR *dir, int width, int height, int colors);
@ -234,7 +235,7 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
return(NULL);
}
hIcon = ICON_CreateIconFromData(hScreenDc, Data, SafeIconImage, 32, 32, dirEntry->Info.cursor.wXHotspot, dirEntry->Info.cursor.wYHotspot);
hIcon = ICON_CreateCursorFromData(hScreenDc, Data, SafeIconImage, 32, 32, dirEntry->Info.cursor.wXHotspot, dirEntry->Info.cursor.wYHotspot);
RtlFreeHeap(RtlGetProcessHeap(), 0, SafeIconImage);
return hIcon;
}

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.13 2003/09/24 21:09:22 weiden Exp $
/* $Id: cursor.c,v 1.14 2003/11/10 17:44:49 weiden Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/cursor.c
@ -33,6 +33,9 @@
#include <string.h>
#include <debug.h>
HBITMAP
CopyBitmap(HBITMAP bmp);
/* INTERNAL ******************************************************************/
/* This callback routine is called directly after switching to gui mode */
@ -41,6 +44,8 @@ User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength)
{
LRESULT Result = TRUE;
/* FIXME load system cursor scheme */
SetCursor(0);
SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
@ -49,18 +54,23 @@ User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength)
/*
* @unimplemented
* @implemented
*/
HCURSOR STDCALL
CopyCursor(HCURSOR pcur)
{
UNIMPLEMENTED;
ICONINFO IconInfo;
if(NtUserGetIconInfo((HICON)pcur, &IconInfo))
{
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
return (HCURSOR)0;
}
/*
* @unimplemented
* @implemented
*/
HCURSOR STDCALL
CreateCursor(HINSTANCE hInst,
@ -71,20 +81,34 @@ CreateCursor(HINSTANCE hInst,
CONST VOID *pvANDPlane,
CONST VOID *pvXORPlane)
{
ICONINFO IconInfo;
UNIMPLEMENTED;
return (HCURSOR)0;
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;
}
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
/*
* @unimplemented
* @implemented
*/
WINBOOL STDCALL
DestroyCursor(HCURSOR hCursor)
{
UNIMPLEMENTED;
return FALSE;
return (WINBOOL)NtUserDestroyCursor((HICON)hCursor, 0);
}
@ -99,24 +123,27 @@ GetClipCursor(LPRECT lpRect)
/*
* @unimplemented
* @implemented
*/
HCURSOR STDCALL
GetCursor(VOID)
{
UNIMPLEMENTED;
return (HCURSOR)0;
CURSORINFO ci;
ci.cbSize = sizeof(CURSORINFO);
if(NtUserGetCursorInfo(&ci))
return ci.hCursor;
else
return (HCURSOR)0;
}
/*
* @unimplemented
* @implemented
*/
WINBOOL STDCALL
GetCursorInfo(PCURSORINFO pci)
{
UNIMPLEMENTED;
return FALSE;
return (WINBOOL)NtUserGetCursorInfo(pci);
}
@ -200,25 +227,17 @@ STDCALL
ClipCursor(
CONST RECT *lpRect)
{
RECT rc;
if(lpRect)
{
RtlCopyMemory(&rc, lpRect, sizeof(RECT));
return NtUserClipCursor(&rc);
}
else
return NtUserClipCursor(NULL);
return NtUserClipCursor((RECT *)lpRect);
}
/*
* @unimplemented
* @implemented
*/
HCURSOR STDCALL
SetCursor(HCURSOR hCursor)
{
UNIMPLEMENTED;
return (HCURSOR)0;
return NtUserSetCursor(hCursor);
}

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.12 2003/10/06 16:25:53 gvg Exp $
/* $Id: icon.c,v 1.13 2003/11/10 17:44:49 weiden Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/icon.c
@ -36,174 +36,6 @@
/* FUNCTIONS *****************************************************************/
STATIC WINBOOL FASTCALL
ICON_CopyBitmaps(HBITMAP *MaskTo, HBITMAP MaskFrom,
HBITMAP *ColorTo, HBITMAP *ColorFrom,
DWORD Width, DWORD Height)
{
HDC DCFrom, DCTo;
HBITMAP InitialFrom, InitialTo;
DCFrom = CreateCompatibleDC(NULL);
if (NULL == DCFrom)
{
return FALSE;
}
DCTo = CreateCompatibleDC(DCFrom);
if (NULL == DCTo)
{
DeleteDC(DCFrom);
return FALSE;
}
*MaskTo = CreateCompatibleBitmap(DCTo, Width, Height);
if (NULL == *MaskTo)
{
DeleteDC(DCTo);
DeleteDC(DCFrom);
return FALSE;
}
InitialFrom = SelectObject(DCFrom, MaskFrom);
if (NULL == InitialFrom)
{
DeleteObject(*MaskTo);
*MaskTo = NULL;
DeleteDC(DCTo);
DeleteDC(DCFrom);
return FALSE;
}
InitialTo = SelectObject(DCTo, *MaskTo);
if (NULL == InitialTo)
{
DeleteObject(*MaskTo);
*MaskTo = NULL;
DeleteDC(DCTo);
SelectObject(DCFrom, InitialFrom);
DeleteDC(DCFrom);
return FALSE;
}
if (! BitBlt(DCTo, 0, 0, Width, Height, DCFrom, 0, 0, SRCCOPY))
{
SelectObject(DCTo, InitialTo);
DeleteObject(*MaskTo);
*MaskTo = NULL;
DeleteDC(DCTo);
SelectObject(DCFrom, InitialFrom);
DeleteDC(DCFrom);
return FALSE;
}
*ColorTo = CreateCompatibleBitmap(DCTo, Width, Height);
if (NULL == *ColorTo)
{
SelectObject(DCTo, InitialTo);
DeleteObject(*MaskTo);
*MaskTo = NULL;
DeleteDC(DCTo);
SelectObject(DCFrom, InitialFrom);
DeleteDC(DCFrom);
return FALSE;
}
if (NULL == SelectObject(DCFrom, ColorFrom))
{
DeleteObject(*ColorTo);
*ColorTo = NULL;
SelectObject(DCTo, InitialTo);
DeleteObject(*MaskTo);
*MaskTo = NULL;
DeleteDC(DCTo);
SelectObject(DCFrom, InitialFrom);
DeleteDC(DCFrom);
return FALSE;
}
if (NULL == SelectObject(DCTo, *ColorTo))
{
DeleteObject(*ColorTo);
*ColorTo = NULL;
SelectObject(DCTo, InitialTo);
DeleteObject(*MaskTo);
*MaskTo = NULL;
DeleteDC(DCTo);
SelectObject(DCFrom, InitialFrom);
DeleteDC(DCFrom);
return FALSE;
}
if (! BitBlt(DCTo, 0, 0, Width, Height, DCFrom, 0, 0, SRCCOPY))
{
SelectObject(DCTo, InitialTo);
DeleteObject(*ColorTo);
*ColorTo = NULL;
DeleteObject(*MaskTo);
*MaskTo = NULL;
DeleteDC(DCTo);
SelectObject(DCFrom, InitialFrom);
DeleteDC(DCFrom);
return FALSE;
}
SelectObject(DCTo, InitialTo);
DeleteDC(DCTo);
SelectObject(DCFrom, InitialFrom);
DeleteDC(DCFrom);
return TRUE;
}
STATIC
HICON
FASTCALL
ICON_CreateIconIndirect(PICONINFO IconInfo, WINBOOL CopyBitmaps,
DWORD Width, DWORD Height)
{
PICONINFO NewIcon;
if (NULL == IconInfo)
{
DPRINT("Invalid parameter passed\n");
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
NewIcon = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ICONINFO));
if (NULL == NewIcon)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
}
/* Set up the basic icon stuff */
NewIcon->fIcon = IconInfo->fIcon;
NewIcon->xHotspot = IconInfo->xHotspot;
NewIcon->yHotspot = IconInfo->yHotspot;
if (CopyBitmaps)
{
/* Store a copy the bitmaps */
if (! ICON_CopyBitmaps(&(NewIcon->hbmMask), IconInfo->hbmMask,
&(NewIcon->hbmColor), IconInfo->hbmColor,
Width, Height))
{
HeapFree(GetProcessHeap(), 0, NewIcon);
return NULL;
}
}
else
{
/* We take ownership of the bitmaps */
NewIcon->hbmMask = IconInfo->hbmMask;
NewIcon->hbmColor = IconInfo->hbmColor;
}
return (HICON) NewIcon;
}
HICON
ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot)
{
@ -213,7 +45,7 @@ ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDe
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);
@ -250,14 +82,73 @@ ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDe
bwBIH->bmiColors[1].rgbReserved = 0;
/* load the AND bitmap */
IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, CBM_INIT,
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);
RtlFreeHeap(RtlGetProcessHeap(), 0, bwBIH);
/* Create the icon based on everything we have so far */
return ICON_CreateIconIndirect(&IconInfo, FALSE, IconImage->icHeader.biWidth,
IconImage->icHeader.biHeight);
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;
IconInfo.fIcon = TRUE;
IconInfo.xHotspot = xHotspot;
IconInfo.yHotspot = yHotspot;
/* create a BITMAPINFO header for the monocrome part of the icon */
bwBIH = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof (BITMAPINFOHEADER)+2*sizeof(RGBQUAD));
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[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);
if(IconInfo.hbmMask)
{
SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
XORImageData, bwBIH, DIB_RGB_COLORS);
}
IconInfo.hbmColor = (HBITMAP)0;
RtlFreeHeap(RtlGetProcessHeap(), 0, bwBIH);
/* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
@ -269,21 +160,13 @@ STDCALL
CopyIcon(
HICON hIcon)
{
PICONINFO IconInfo = (PICONINFO) hIcon;
BITMAP BitmapInfo;
if (NULL == IconInfo)
{
SetLastError(ERROR_INVALID_HANDLE);
return NULL;
}
if (0 == GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &BitmapInfo))
{
return NULL;
}
return ICON_CreateIconIndirect(IconInfo, TRUE, BitmapInfo.bmWidth, BitmapInfo.bmHeight);
ICONINFO IconInfo;
if(NtUserGetIconInfo(hIcon, &IconInfo))
{
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
return (HICON)0;
}
@ -306,19 +189,19 @@ CreateIcon(
IconInfo.fIcon = TRUE;
IconInfo.xHotspot = nWidth / 2;
IconInfo.yHotspot = nHeight / 2;
IconInfo.hbmMask = CreateBitmap(nWidth, nHeight, cPlanes, cBitsPixel, ANDbits);
if (NULL == IconInfo.hbmMask)
{
return NULL;
}
IconInfo.hbmMask = CreateBitmap(nWidth, nHeight, 1, 1, ANDbits);
if(!IconInfo.hbmMask)
{
return (HICON)0;
}
IconInfo.hbmColor = CreateBitmap(nWidth, nHeight, cPlanes, cBitsPixel, XORbits);
if (NULL == IconInfo.hbmColor)
{
DeleteObject(IconInfo.hbmMask);
return NULL;
}
return ICON_CreateIconIndirect(&IconInfo, FALSE, nWidth, nHeight);
if(!IconInfo.hbmColor)
{
DeleteObject(IconInfo.hbmMask);
return (HICON)0;
}
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
@ -333,7 +216,7 @@ CreateIconFromResource(
WINBOOL fIcon,
DWORD dwVer)
{
return CreateIconFromResourceEx( presbits, dwResSize, fIcon, dwVer, 0,0,0);
return CreateIconFromResourceEx(presbits, dwResSize, fIcon, dwVer, 0, 0, 0);
}
@ -379,10 +262,11 @@ CreateIconFromResourceEx(
/* get an safe copy of the icon data */
SafeIconImage = RtlAllocateHeap(RtlGetProcessHeap(), 0, cbIconBits);
memcpy(SafeIconImage, pbIconBits, cbIconBits);
/* take into acount the origonal hight was for both the AND and XOR images */
SafeIconImage->icHeader.biHeight /= 2;
/* take into acount the origonal height was for both the AND and XOR images */
if(fIcon)
SafeIconImage->icHeader.biHeight /= 2;
if (SafeIconImage->icHeader.biSize == sizeof(BITMAPCOREHEADER))
{
BITMAPCOREHEADER* Core = (BITMAPCOREHEADER*)SafeIconImage;
@ -407,7 +291,10 @@ CreateIconFromResourceEx(
return(NULL);
}
hIcon = ICON_CreateIconFromData(hScreenDc, Data, SafeIconImage, cxDesired, cyDesired, wXHotspot, wYHotspot);
if(fIcon)
hIcon = ICON_CreateIconFromData(hScreenDc, Data, SafeIconImage, cxDesired, cyDesired, wXHotspot, wYHotspot);
else
hIcon = ICON_CreateCursorFromData(hScreenDc, Data, SafeIconImage, cxDesired, cyDesired, wXHotspot, wYHotspot);
RtlFreeHeap(RtlGetProcessHeap(), 0, SafeIconImage);
return hIcon;
@ -424,28 +311,31 @@ CreateIconIndirect(PICONINFO IconInfo)
BITMAP ColorBitmap;
BITMAP MaskBitmap;
if (NULL == IconInfo)
{
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
if(!IconInfo)
{
SetLastError(ERROR_INVALID_PARAMETER);
return (HICON)0;
}
if (0 == GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap))
{
return NULL;
}
if (0 == GetObjectW(IconInfo->hbmMask, sizeof(BITMAP), &MaskBitmap))
{
return NULL;
}
if (ColorBitmap.bmWidth != MaskBitmap.bmWidth ||
ColorBitmap.bmHeight != MaskBitmap.bmWidth)
{
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
return ICON_CreateIconIndirect(IconInfo, TRUE, ColorBitmap.bmWidth, ColorBitmap.bmHeight);
if(!GetObjectW(IconInfo->hbmMask, sizeof(BITMAP), &MaskBitmap))
{
return (HICON)0;
}
/* FIXME - does there really *have* to be a color bitmap? monochrome cursors don't have one */
if(IconInfo->hbmColor && !GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap))
{
return (HICON)0;
}
/* FIXME - i doubt this is right (monochrome cursors */
/*if(ColorBitmap.bmWidth != MaskBitmap.bmWidth ||
ColorBitmap.bmHeight != MaskBitmap.bmWidth)
{
SetLastError(ERROR_INVALID_PARAMETER);
return (HICON)0;
}*/
return NtUserCreateCursorIconHandle(IconInfo, TRUE);
}
@ -457,26 +347,7 @@ STDCALL
DestroyIcon(
HICON hIcon)
{
PICONINFO IconInfo = (PICONINFO) hIcon;
if (NULL == IconInfo)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if (NULL != IconInfo->hbmMask)
{
DeleteObject(IconInfo->hbmMask);
}
if (NULL != IconInfo->hbmColor)
{
DeleteObject(IconInfo->hbmColor);
}
HeapFree(GetProcessHeap(), 0, IconInfo);
return TRUE;
return (WINBOOL)NtUserDestroyCursor(hIcon, 0);
}
@ -491,10 +362,9 @@ DrawIcon(
int Y,
HICON hIcon)
{
return DrawIconEx(hDC, X, Y, hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
return DrawIconEx(hDC, X, Y, hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_DEFAULTSIZE);
}
/* Ported from WINE20030408 */
/*
* @implemented
*/
@ -511,145 +381,9 @@ DrawIconEx(
HBRUSH hbrFlickerFreeDraw,
UINT diFlags)
{
PICONINFO IconInfo = (PICONINFO) hIcon;
BITMAP Bitmap;
HDC hDC_off = 0, hMemDC;
BOOL result = FALSE, DoOffscreen;
HBITMAP hB_off = 0, hOld = 0;
if (NULL == IconInfo)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &Bitmap);
DPRINT("(hdc=%p,pos=%d.%d,hicon=%p,extend=%d.%d,istep=%d,br=%p,flags=0x%08x)\n",
hdc,xLeft,yTop,hIcon,cxWidth,cyWidth,istepIfAniCur,hbrFlickerFreeDraw,diFlags );
hMemDC = CreateCompatibleDC(hdc);
if (diFlags & DI_COMPAT)
{
DPRINT("Ignoring flag DI_COMPAT\n");
}
if (!diFlags)
{
diFlags = DI_NORMAL;
}
/* Calculate the size of the destination image. */
if (cxWidth == 0)
{
cxWidth = (diFlags & DI_DEFAULTSIZE ? GetSystemMetrics (SM_CXICON)
: Bitmap.bmWidth);
}
if (cyWidth == 0)
{
cyWidth = (diFlags & DI_DEFAULTSIZE ? GetSystemMetrics (SM_CYICON)
: Bitmap.bmHeight);
}
DoOffscreen = (NULL != hbrFlickerFreeDraw
&& OBJ_BRUSH == GetObjectType(hbrFlickerFreeDraw));
if (DoOffscreen)
{
RECT r;
r.left = 0;
r.top = 0;
r.right = cxWidth;
r.bottom = cxWidth;
DPRINT("in DrawIconEx calling: CreateCompatibleDC\n");
hDC_off = CreateCompatibleDC(hdc);
DPRINT("in DrawIconEx calling: CreateCompatibleBitmap\n");
hB_off = CreateCompatibleBitmap(hdc, cxWidth, cyWidth);
if (hDC_off && hB_off)
{
DPRINT("in DrawIconEx calling: SelectObject\n");
hOld = SelectObject(hDC_off, hB_off);
DPRINT("in DrawIconEx calling: FillRect\n");
FillRect(hDC_off, &r, hbrFlickerFreeDraw);
}
}
if (hMemDC && (! DoOffscreen || (hDC_off && hB_off)))
{
COLORREF oldFg, oldBg;
INT nStretchMode;
nStretchMode = SetStretchBltMode(hdc, STRETCH_DELETESCANS);
oldFg = SetTextColor(hdc, RGB(0, 0, 0));
oldBg = SetBkColor(hdc, RGB(255, 255, 255));
if (IconInfo->hbmColor && IconInfo->hbmMask)
{
HBITMAP hBitTemp = SelectObject(hMemDC, IconInfo->hbmMask);
if (diFlags & DI_MASK)
{
if (DoOffscreen)
{
StretchBlt (hDC_off, 0, 0, cxWidth, cyWidth,
hMemDC, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight,
SRCAND);
}
else
{
StretchBlt (hdc, xLeft, yTop, cxWidth, cyWidth,
hMemDC, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight,
SRCAND);
}
}
SelectObject(hMemDC, IconInfo->hbmColor);
if (diFlags & DI_IMAGE)
{
if (DoOffscreen)
{
StretchBlt (hDC_off, 0, 0, cxWidth, cyWidth,
hMemDC, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight,
SRCINVERT);
}
else
{
StretchBlt (hdc, xLeft, yTop, cxWidth, cyWidth,
hMemDC, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight,
SRCINVERT);
}
}
SelectObject(hMemDC, hBitTemp);
result = TRUE;
}
SetTextColor( hdc, oldFg );
SetBkColor( hdc, oldBg );
SetStretchBltMode (hdc, nStretchMode);
if (DoOffscreen)
{
BitBlt(hdc, xLeft, yTop, cxWidth, cyWidth, hDC_off, 0, 0, SRCCOPY);
SelectObject(hDC_off, hOld);
}
}
if (hMemDC)
{
DeleteDC( hMemDC );
}
if (hDC_off)
{
DeleteDC(hDC_off);
}
if (hB_off)
{
DeleteObject(hB_off);
}
return result;
return (WINBOOL)NtUserDrawIconEx(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth,
istepIfAniCur, hbrFlickerFreeDraw, diFlags,
0, 0);
}
@ -662,38 +396,8 @@ GetIconInfo(
HICON hIcon,
PICONINFO IconInfo)
{
PICONINFO IconData = (PICONINFO) hIcon;
BITMAP BitmapInfo;
if (NULL == IconData)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if (NULL == IconInfo)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* Copy basic info */
IconInfo->fIcon = IconData->fIcon;
IconInfo->xHotspot = IconData->xHotspot;
IconInfo->yHotspot = IconData->yHotspot;
/* Copy the bitmaps */
if (0 == GetObjectW(IconData->hbmColor, sizeof(BITMAP), &BitmapInfo))
{
return FALSE;
}
if (! ICON_CopyBitmaps(&(IconInfo->hbmMask), IconData->hbmMask,
&(IconInfo->hbmColor), IconData->hbmColor,
BitmapInfo.bmWidth, BitmapInfo.bmHeight))
{
return FALSE;
}
return TRUE;
/* FIXME - copy bitmaps */
return (WINBOOL)NtUserGetIconInfo(hIcon, IconInfo);
}
@ -888,3 +592,4 @@ LookupIconIdFromDirectoryEx(
}
return retVal;
}

View file

@ -8,9 +8,6 @@
#define NTOS_MODE_KERNEL
#include <ntos.h>
/* one systemcursor for custom cursors */
#define SYSCURSORCOUNT (14 + 1)
typedef struct _CURSORCLIP_INFO
{
BOOL IsClipped;
@ -20,26 +17,26 @@ typedef struct _CURSORCLIP_INFO
UINT Bottom;
} CURSORCLIP_INFO, *PCURSORCLIP_INFO;
typedef struct _SYSCURSOR
typedef struct _CURICONS
{
HANDLE hCursor;
LONG cx, cy;
LONG hx, hy;
PVOID AndImage;
PVOID XorImage;
} SYSCURSOR, *PSYSCURSOR;
FAST_MUTEX LockHandles;
PVOID Handles;
PVOID Objects;
UINT Count;
} CURICONS, *PCURICONS;
typedef struct _SYSTEM_CURSORINFO
{
BOOL Enabled;
BOOL SwapButtons;
UINT CurrentCursor;
UINT ButtonsDown;
LONG x, y;
BOOL SafetySwitch, SafetySwitch2;
FAST_MUTEX CursorMutex;
CURSORCLIP_INFO CursorClipInfo;
SYSCURSOR SystemCursors[SYSCURSORCOUNT];
CURICONS CurIcons;
PVOID CurrentCursorObject;
BYTE ShowingCursor;
UINT DblClickSpeed;
UINT DblClickWidth;
UINT DblClickHeight;
@ -76,6 +73,8 @@ typedef struct _DESKTOP_OBJECT
struct _WINSTATION_OBJECT *WindowStation;
/* Pointer to the active queue. */
PVOID ActiveMessageQueue;
/* Rectangle of the work area */
struct RECT* WorkArea;
/* Handle of the desktop window. */
HANDLE DesktopWindow;
HANDLE PrevActiveWindow;

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: mouse.c,v 1.43 2003/09/28 00:26:13 weiden Exp $
/* $Id: mouse.c,v 1.44 2003/11/10 17:44:49 weiden Exp $
*
* PROJECT: ReactOS kernel
* PURPOSE: Mouse
@ -36,6 +36,8 @@
#include "include/msgqueue.h"
#include "include/object.h"
#include "include/winsta.h"
#include "include/cursoricon.h"
#include "include/callback.h"
#include <include/mouse.h>
#define NDEBUG
@ -44,77 +46,6 @@
#define GETSYSCURSOR(x) ((x) - OCR_NORMAL)
/* GLOBALS *******************************************************************/
static ULONG PointerStatus;
static UCHAR DefaultCursor[256] = {
0x3F, 0xFF, 0xFF, 0xFF,
0x1F, 0xFF, 0xFF, 0xFF,
0x0F, 0xFF, 0xFF, 0xFF,
0x07, 0xFF, 0xFF, 0xFF,
0x03, 0xFF, 0xFF, 0xFF,
0x01, 0xFF, 0xFF, 0xFF,
0x00, 0xFF, 0xFF, 0xFF,
0x00, 0x7F, 0xFF, 0xFF,
0x00, 0x3F, 0xFF, 0xFF,
0x00, 0x1F, 0xFF, 0xFF,
0x00, 0x0F, 0xFF, 0xFF,
0x00, 0xFF, 0xFF, 0xFF,
0x00, 0xFF, 0xFF, 0xFF,
0x18, 0x7F, 0xFF, 0xFF,
0x38, 0x7F, 0xFF, 0xFF,
0x7C, 0x3F, 0xFF, 0xFF,
0xFC, 0x3F, 0xFF, 0xFF,
0xFE, 0x1F, 0xFF, 0xFF,
0xFE, 0x1F, 0xFF, 0xFF,
0xFF, 0x3F, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00,
0x60, 0x00, 0x00, 0x00,
0x70, 0x00, 0x00, 0x00,
0x78, 0x00, 0x00, 0x00,
0x7C, 0x00, 0x00, 0x00,
0x7E, 0x00, 0x00, 0x00,
0x7F, 0x00, 0x00, 0x00,
0x7F, 0x80, 0x00, 0x00,
0x7F, 0xC0, 0x00, 0x00,
0x7E, 0x00, 0x00, 0x00,
0x76, 0x00, 0x00, 0x00,
0x76, 0x00, 0x00, 0x00,
0x43, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x01, 0x80, 0x00, 0x00,
0x01, 0x80, 0x00, 0x00,
0x00, 0xC0, 0x00, 0x00,
0x00, 0xC0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
/* FUNCTIONS *****************************************************************/
BOOL FASTCALL
@ -192,8 +123,8 @@ MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1,
RECTL MouseRect;
LONG tmp;
PSYSTEM_CURSORINFO CurInfo;
PSYSCURSOR SysCursor;
BOOL MouseEnabled = FALSE;
PCURICON_OBJECT Cursor;
/* Mouse is not allowed to move if GDI is busy drawing */
@ -202,8 +133,7 @@ MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1,
{
CurInfo = &InputWindowStation->SystemCursor;
SysCursor = &CurInfo->SystemCursors[CurInfo->CurrentCursor];
MouseEnabled = CurInfo->Enabled && SysCursor->hCursor;
MouseEnabled = CurInfo->Enabled && CurInfo->ShowingCursor;
}
else
return FALSE;
@ -225,12 +155,18 @@ MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1,
return(FALSE);
}
if (SPS_ACCEPT_NOEXCLUDE == PointerStatus)
if (SPS_ACCEPT_NOEXCLUDE == SurfGDI->PointerStatus)
{
/* Hardware cursor, no need to remove it */
ObDereferenceObject(InputWindowStation);
return(FALSE);
}
if(!(Cursor = CurInfo->CurrentCursorObject))
{
ObDereferenceObject(InputWindowStation);
return(FALSE);
}
if (HazardX1 > HazardX2)
{
@ -241,8 +177,8 @@ MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1,
tmp = HazardY2; HazardY2 = HazardY1; HazardY1 = tmp;
}
if (((CurInfo->x + SysCursor->cx) >= HazardX1) && (CurInfo->x <= HazardX2) &&
((CurInfo->y + SysCursor->cy) >= HazardY1) && (CurInfo->y <= HazardY2))
if (((CurInfo->x + Cursor->Size.cx) >= HazardX1) && (CurInfo->x <= HazardX2) &&
((CurInfo->y + Cursor->Size.cy) >= HazardY1) && (CurInfo->y <= HazardY2))
{
/* Mouse is not allowed to move if GDI is busy drawing */
ExAcquireFastMutexUnsafe(&CurInfo->CursorMutex);
@ -263,7 +199,6 @@ MouseSafetyOnDrawEnd(PSURFOBJ SurfObj, PSURFGDI SurfGDI)
{
RECTL MouseRect;
PSYSTEM_CURSORINFO CurInfo;
PSYSCURSOR SysCursor;
BOOL MouseEnabled = FALSE;
if(IntGetWindowStationObject(InputWindowStation))
@ -282,8 +217,7 @@ MouseSafetyOnDrawEnd(PSURFOBJ SurfObj, PSURFGDI SurfGDI)
return FALSE;
}
SysCursor = &CurInfo->SystemCursors[CurInfo->CurrentCursor];
MouseEnabled = CurInfo->Enabled && SysCursor->hCursor;
MouseEnabled = CurInfo->Enabled && CurInfo->ShowingCursor;
if (SurfObj->iType != STYPE_DEVICE || MouseEnabled == FALSE)
{
@ -294,7 +228,7 @@ MouseSafetyOnDrawEnd(PSURFOBJ SurfObj, PSURFGDI SurfGDI)
return(FALSE);
}
if (SPS_ACCEPT_NOEXCLUDE == PointerStatus)
if (SPS_ACCEPT_NOEXCLUDE == SurfGDI->PointerStatus)
{
/* Hardware cursor, it wasn't removed so need to restore it */
ExAcquireFastMutexUnsafe(&CurInfo->CursorMutex);
@ -395,7 +329,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
{
ULONG i;
PSYSTEM_CURSORINFO CurInfo;
PSYSCURSOR SysCursor;
BOOL MouseEnabled = FALSE;
BOOL MouseMoveAdded = FALSE;
BOOL Moved = FALSE;
@ -420,7 +353,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
if(IntGetWindowStationObject(InputWindowStation))
{
CurInfo = &InputWindowStation->SystemCursor;
SysCursor = &CurInfo->SystemCursors[CurInfo->CurrentCursor];
MouseEnabled = CurInfo->Enabled;
if(!MouseEnabled)
{
@ -657,12 +589,6 @@ EnableMouse(HDC hDisplayDC)
PDC dc;
PSURFOBJ SurfObj;
PSURFGDI SurfGDI;
HBITMAP hMouseSurf;
PSURFOBJ MouseSurf;
SIZEL MouseSize;
RECTL MouseRect;
PSYSTEM_CURSORINFO CurInfo;
PSYSCURSOR SysCursor;
if( hDisplayDC && InputWindowStation)
{
@ -671,49 +597,27 @@ EnableMouse(HDC hDisplayDC)
InputWindowStation->SystemCursor.Enabled = FALSE;
return;
}
CurInfo = &InputWindowStation->SystemCursor;
SysCursor = &CurInfo->SystemCursors[CurInfo->CurrentCursor];
IntSetCursor(InputWindowStation, NULL, TRUE);
dc = DC_LockDc(hDisplayDC);
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
DC_UnlockDc( hDisplayDC );
/* Tell the display driver to set the pointer shape. */
CurInfo->x = SurfObj->sizlBitmap.cx / 2;
CurInfo->y = SurfObj->sizlBitmap.cy / 2;
/* Create the default mouse cursor. */
MouseSize.cx = SysCursor->cx;
MouseSize.cy = SysCursor->cy * 2;
hMouseSurf = EngCreateBitmap(MouseSize, 4, BMF_1BPP, BMF_TOPDOWN, DefaultCursor);
MouseSurf = (PSURFOBJ)AccessUserObject((ULONG) hMouseSurf);
DPRINT("Setting Cursor up at 0x%x, 0x%x\n", CurInfo->x, CurInfo->y);
IntCheckClipCursor(&CurInfo->x,
&CurInfo->y,
CurInfo);
PointerStatus = SurfGDI->SetPointerShape(SurfObj, MouseSurf, NULL, NULL,
SysCursor->hx,
SysCursor->hy,
CurInfo->x,
CurInfo->y,
&MouseRect,
SPS_CHANGE);
InputWindowStation->SystemCursor.Enabled = (SPS_ACCEPT_EXCLUDE == PointerStatus ||
SPS_ACCEPT_NOEXCLUDE == PointerStatus);
EngDeleteSurface(hMouseSurf);
ObDereferenceObject(InputWindowStation);
InputWindowStation->SystemCursor.Enabled = (SPS_ACCEPT_EXCLUDE == SurfGDI->PointerStatus ||
SPS_ACCEPT_NOEXCLUDE == SurfGDI->PointerStatus);
/* Move the cursor to the screen center */
DPRINT("Setting Cursor up at 0x%x, 0x%x\n", SurfObj->sizlBitmap.cx / 2, SurfObj->sizlBitmap.cy / 2);
MouseMoveCursor(SurfObj->sizlBitmap.cx / 2, SurfObj->sizlBitmap.cy / 2);
ObDereferenceObject(InputWindowStation);
}
else
{
if(IntGetWindowStationObject(InputWindowStation))
{
IntSetCursor(InputWindowStation, NULL, TRUE);
InputWindowStation->SystemCursor.Enabled = FALSE;
InputWindowStation->SystemCursor.CursorClipInfo.IsClipped = FALSE;
ObDereferenceObject(InputWindowStation);

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: objects.h,v 1.19 2003/10/29 08:38:55 gvg Exp $
/* $Id: objects.h,v 1.20 2003/11/10 17:44:49 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -186,6 +186,9 @@ typedef struct _SURFGDI {
PFN_DIB_HLine DIB_HLine;
PFN_DIB_VLine DIB_VLine;
PFN_DIB_BitBlt DIB_BitBlt;
/* misc */
ULONG PointerStatus;
} SURFGDI;
typedef struct _XFORMGDI {

View file

@ -0,0 +1,27 @@
#ifndef _WIN32K_CURSORICON_H
#define _WIN32K_CURSORICON_H
#define MAXCURICONHANDLES 4096
typedef struct _CURICON_OBJECT
{
HICON Handle;
PW32PROCESS Process;
HMODULE hModule;
HRSRC hRsrc;
HRSRC hGroupRsrc;
SIZE Size;
BYTE Shadow;
ICONINFO IconInfo;
} CURICON_OBJECT, *PCURICON_OBJECT;
HCURSOR FASTCALL IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL ForceChange);
BOOL FASTCALL IntSetupCurIconHandles(PWINSTATION_OBJECT WinStaObject);
PCURICON_OBJECT FASTCALL IntGetCurIconObject(PWINSTATION_OBJECT WinStaObject, HICON hIcon);
VOID FASTCALL IntReleaseCurIconObject(PWINSTATION_OBJECT WinStaObject);
PCURICON_OBJECT FASTCALL IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject);
#endif /* _WIN32K_CURSORICON_H */
/* EOF */

View file

@ -17,6 +17,8 @@
WINSTATION_OBJECT *InputWindowStation;
//FAST_MUTEX InputWindowStationLock;
extern HDC ScreenDeviceContext;
NTSTATUS FASTCALL
InitWindowStationImpl(VOID);

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.21 2003/10/17 20:31:56 weiden Exp $
/* $Id: misc.c,v 1.22 2003/11/10 17:44:49 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -20,6 +20,7 @@
#include <include/mouse.h>
#include <include/winsta.h>
#include <include/caret.h>
#include <include/object.h>
#define NDEBUG
#include <debug.h>
@ -286,50 +287,71 @@ NtUserSystemParametersInfo(
0, 0, DEFAULT_QUALITY, FF_MODERN, L"Bitstream Vera Sans Bold" };*/
NTSTATUS Status;
PWINSTATION_OBJECT WinStaObject;
RECT Rect;
switch(uiAction)
{
case SPI_SETDOUBLECLKWIDTH:
case SPI_SETDOUBLECLKHEIGHT:
case SPI_SETDOUBLECLICKTIME:
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode,
0,
&WinStaObject);
if (!NT_SUCCESS(Status))
return (DWORD)FALSE;
switch(uiAction)
{
case SPI_SETDOUBLECLKWIDTH:
/* FIXME limit the maximum value? */
WinStaObject->SystemCursor.DblClickWidth = uiParam;
break;
case SPI_SETDOUBLECLKHEIGHT:
/* FIXME limit the maximum value? */
WinStaObject->SystemCursor.DblClickHeight = uiParam;
break;
case SPI_SETDOUBLECLICKTIME:
/* FIXME limit the maximum time to 1000 ms? */
WinStaObject->SystemCursor.DblClickSpeed = uiParam;
break;
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode,
0,
&WinStaObject);
if (!NT_SUCCESS(Status))
return (DWORD)FALSE;
switch(uiAction)
{
case SPI_SETDOUBLECLKWIDTH:
/* FIXME limit the maximum value? */
WinStaObject->SystemCursor.DblClickWidth = uiParam;
break;
case SPI_SETDOUBLECLKHEIGHT:
/* FIXME limit the maximum value? */
WinStaObject->SystemCursor.DblClickHeight = uiParam;
break;
case SPI_SETDOUBLECLICKTIME:
/* FIXME limit the maximum time to 1000 ms? */
WinStaObject->SystemCursor.DblClickSpeed = uiParam;
break;
}
/* FIXME save the value to the registry */
ObDereferenceObject(WinStaObject);
return TRUE;
}
case SPI_SETWORKAREA:
{
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
if(!Desktop)
{
/* FIXME - Set last error */
return FALSE;
}
Status = MmCopyFromCaller(Desktop->WorkArea, (PRECT)pvParam, sizeof(RECT));
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return FALSE;
}
return TRUE;
}
/* FIXME save the value to the registry */
ObDereferenceObject(WinStaObject);
return TRUE;
case SPI_GETWORKAREA:
{
/* FIXME */
Rect.left = 0;
Rect.top = 0;
Rect.right = 640;
Rect.bottom = 480;
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
Status = MmCopyToCaller((PRECT)pvParam, &Rect, sizeof(RECT));
if(!Desktop)
{
/* FIXME - Set last error */
return FALSE;
}
Status = MmCopyToCaller((PRECT)pvParam, Desktop->WorkArea, sizeof(RECT));
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.33 2003/11/09 18:38:09 navaraf Exp $
/* $Id: stubs.c,v 1.34 2003/11/10 17:44:49 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -333,26 +333,6 @@ NtUserDrawCaptionTemp(
return 0;
}
DWORD
STDCALL
NtUserDrawIconEx(
DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2,
DWORD Unknown3,
DWORD Unknown4,
DWORD Unknown5,
DWORD Unknown6,
DWORD Unknown7,
DWORD Unknown8,
DWORD Unknown9,
DWORD Unknown10)
{
UNIMPLEMENTED
return 0;
}
DWORD
STDCALL
NtUserEmptyClipboard(VOID)

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: winsta.c,v 1.39 2003/10/19 19:51:48 navaraf Exp $
/* $Id: winsta.c,v 1.40 2003/11/10 17:44:49 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -48,6 +48,7 @@
#include <include/mouse.h>
#include <include/callback.h>
#include <include/color.h>
#include <include/cursoricon.h>
#define NDEBUG
#include <debug.h>
@ -66,7 +67,7 @@ STATIC HDESK InputDesktopHandle = NULL;
STATIC PDESKTOP_OBJECT InputDesktop = NULL;
//STATIC PWINSTATION_OBJECT InputWindowStation = NULL;
static HDC ScreenDeviceContext = NULL;
HDC ScreenDeviceContext = NULL;
/* FUNCTIONS *****************************************************************/
@ -375,11 +376,12 @@ NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
ExInitializeFastMutex(&WinStaObject->SystemCursor.CursorMutex);
WinStaObject->SystemCursor.Enabled = FALSE;
WinStaObject->SystemCursor.ButtonsDown = 0;
WinStaObject->SystemCursor.CurrentCursor = 0;
WinStaObject->SystemCursor.x = (LONG)0;
WinStaObject->SystemCursor.y = (LONG)0;
WinStaObject->SystemCursor.CursorClipInfo.IsClipped = FALSE;
WinStaObject->SystemCursor.LastBtnDown = 0;
WinStaObject->SystemCursor.CurrentCursorObject = NULL;
WinStaObject->SystemCursor.ShowingCursor = 0;
/* FIXME Obtain the following information from the registry */
WinStaObject->SystemCursor.SwapButtons = FALSE;
@ -389,13 +391,10 @@ NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
WinStaObject->SystemCursor.DblClickWidth = 4;
WinStaObject->SystemCursor.DblClickHeight = 4;
/* FIXME tell user32 to load the cursors from it's rosource file or
to load the user's cursor scheme */
WinStaObject->SystemCursor.SystemCursors[0].hCursor = (HANDLE)1;
WinStaObject->SystemCursor.SystemCursors[0].cx = 32;
WinStaObject->SystemCursor.SystemCursors[0].cy = 32;
/* FIXME setup system cursors */
if(!IntSetupCurIconHandles(WinStaObject))
{
DbgPrint("Setting up the Cursor/Icon Handle table failed!\n");
}
DPRINT("Window station successfully created (%wZ)\n", &WindowStationName);
@ -662,6 +661,7 @@ NtUserCreateDesktop(PUNICODE_STRING lpszDesktopName,
WCHAR NameBuffer[MAX_PATH];
NTSTATUS Status;
HDESK Desktop;
PRECT WorkArea;
Status = ValidateWindowStationHandle(hWindowStation,
KernelMode,
@ -711,7 +711,7 @@ NtUserCreateDesktop(PUNICODE_STRING lpszDesktopName,
&ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(DESKTOP_OBJECT),
sizeof(DESKTOP_OBJECT) + sizeof(RECT),
0,
0,
(PVOID*)&DesktopObject);
@ -721,6 +721,13 @@ NtUserCreateDesktop(PUNICODE_STRING lpszDesktopName,
SetLastNtError(STATUS_UNSUCCESSFUL);
return((HDESK)0);
}
WorkArea = (PRECT)((PDESKTOP_OBJECT)(DesktopObject + 1));
DesktopObject->WorkArea = (struct RECT *)WorkArea;
WorkArea->left = 0;
WorkArea->top = 0;
WorkArea->right = 640;
WorkArea->bottom = 480;
/* Initialize some local (to win32k) desktop state. */
DesktopObject->ActiveMessageQueue = NULL;
@ -1014,9 +1021,9 @@ IntInitializeDesktopGraphics(VOID)
{
ScreenDeviceContext = NtGdiCreateDC(L"DISPLAY", NULL, NULL, NULL);
GDIOBJ_MarkObjectGlobal(ScreenDeviceContext);
EnableMouse(ScreenDeviceContext);
/* not the best place to load the cursors but it's good for now */
IntLoadDefaultCursors();
EnableMouse(ScreenDeviceContext);
NtUserAcquireOrReleaseInputOwnership(FALSE);
}

File diff suppressed because it is too large Load diff