Moved the generic mouse pointer implementation to win32k (not complete yet).

svn path=/trunk/; revision=7865
This commit is contained in:
Filip Navara 2004-01-24 19:47:05 +00:00
parent db0f9b9ba4
commit e25e386086
6 changed files with 389 additions and 147 deletions

View file

@ -26,7 +26,7 @@
#include <ddk/winddi.h>
#include <ddk/ntddvdeo.h>
#define EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
//#define EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
typedef struct _PDEV
{
@ -48,12 +48,11 @@ typedef struct _PDEV
#ifdef EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
VIDEO_POINTER_ATTRIBUTES PointerAttributes;
XLATEOBJ *PointerXlateObject;
HSURF PointerColorSurface;
HSURF PointerMaskSurface;
HSURF PointerSaveSurface;
XLATEOBJ *XlateObject;
POINTL HotSpot;
CLIPOBJ *ScreenClipObj;
POINTL PointerHotSpot;
#endif
} PDEV, *PPDEV;

View file

@ -44,7 +44,8 @@ DrvSetPointerShape(
IN RECTL *prcl,
IN FLONG fl)
{
return SPS_DECLINE;
/* return SPS_DECLINE;*/
return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl);
}
/*
@ -64,13 +65,13 @@ DrvMovePointer(
IN LONG y,
IN RECTL *prcl)
{
return EngMovePointer(pso, x, y, prcl);
}
#else
VOID FASTCALL
IntHideMousePointer(PPDEV ppdev)
IntHideMousePointer(PPDEV ppdev, SURFOBJ *DestSurface)
{
if (ppdev->PointerAttributes.Enable == FALSE)
{
@ -83,7 +84,6 @@ IntHideMousePointer(PPDEV ppdev)
RECTL DestRect;
POINTL SrcPoint;
SURFOBJ *SaveSurface;
SURFOBJ *DestSurface;
SURFOBJ *MaskSurface;
DestRect.left = max(ppdev->PointerAttributes.Column, 0);
@ -99,18 +99,16 @@ IntHideMousePointer(PPDEV ppdev)
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
DestSurface = EngLockSurface(ppdev->hSurfEng);
MaskSurface = EngLockSurface(ppdev->PointerMaskSurface);
EngBitBlt(DestSurface, SaveSurface, MaskSurface, NULL, NULL,
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL, SRCCOPY);
EngUnlockSurface(MaskSurface);
EngUnlockSurface(DestSurface);
EngUnlockSurface(SaveSurface);
}
}
VOID FASTCALL
IntShowMousePointer(PPDEV ppdev)
IntShowMousePointer(PPDEV ppdev, SURFOBJ *DestSurface)
{
if (ppdev->PointerAttributes.Enable == TRUE)
{
@ -128,7 +126,6 @@ IntShowMousePointer(PPDEV ppdev)
RECTL DestRect;
POINTL SrcPoint;
SURFOBJ *SaveSurface;
SURFOBJ *DestSurface;
SrcPoint.x = max(ppdev->PointerAttributes.Column, 0);
SrcPoint.y = max(ppdev->PointerAttributes.Row, 0);
@ -143,10 +140,8 @@ IntShowMousePointer(PPDEV ppdev)
ppdev->ScreenHeight - ppdev->PointerAttributes.Row - 1);
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
DestSurface = EngLockSurface(ppdev->hSurfEng);
EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL,
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCCOPY);
EngUnlockSurface(DestSurface);
EngUnlockSurface(SaveSurface);
}
@ -157,7 +152,6 @@ IntShowMousePointer(PPDEV ppdev)
{
RECTL DestRect;
POINTL SrcPoint;
SURFOBJ *DestSurf;
SURFOBJ *ColorSurf;
SURFOBJ *MaskSurf;
@ -173,26 +167,24 @@ IntShowMousePointer(PPDEV ppdev)
SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0);
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
DestSurf = EngLockSurface(ppdev->hSurfEng);
MaskSurf = EngLockSurface(ppdev->PointerMaskSurface);
if (ppdev->PointerColorSurface != NULL)
{
ColorSurf = EngLockSurface(ppdev->PointerColorSurface);
EngBitBlt(DestSurf, ColorSurf, MaskSurf, NULL, ppdev->XlateObject,
EngBitBlt(DestSurface, ColorSurf, MaskSurf, NULL, ppdev->PointerXlateObject,
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL, 0xAACC);
EngUnlockSurface(ColorSurf);
}
else
{
/* FIXME */
EngBitBlt(DestSurf, MaskSurf, NULL, NULL, NULL,
EngBitBlt(DestSurface, MaskSurf, NULL, NULL, ppdev->PointerXlateObject,
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCAND);
SrcPoint.y += ppdev->PointerAttributes.Height;
EngBitBlt(DestSurf, MaskSurf, NULL, NULL, NULL,
EngBitBlt(DestSurface, MaskSurf, NULL, NULL, ppdev->PointerXlateObject,
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCINVERT);
}
EngUnlockSurface(MaskSurf);
EngUnlockSurface(DestSurf);
}
}
@ -221,7 +213,7 @@ DrvSetPointerShape(
PPDEV ppdev = (PPDEV)pso->dhpdev;
SURFOBJ *TempSurfObj;
IntHideMousePointer(ppdev);
IntHideMousePointer(ppdev, pso);
if (ppdev->PointerColorSurface != NULL)
{
@ -262,10 +254,10 @@ DrvSetPointerShape(
return SPS_ACCEPT_EXCLUDE;
}
ppdev->HotSpot.x = xHot;
ppdev->HotSpot.y = yHot;
ppdev->PointerHotSpot.x = xHot;
ppdev->PointerHotSpot.y = yHot;
ppdev->XlateObject = pxlo;
ppdev->PointerXlateObject = pxlo;
ppdev->PointerAttributes.Column = x - xHot;
ppdev->PointerAttributes.Row = y - yHot;
ppdev->PointerAttributes.Width = psoMask->lDelta << 3;
@ -330,7 +322,7 @@ DrvSetPointerShape(
Size, lDelta, pso->iBitmapFormat, BMF_NOZEROINIT, NULL);
}
IntShowMousePointer(ppdev);
IntShowMousePointer(ppdev, pso);
return SPS_ACCEPT_EXCLUDE;
}
@ -358,7 +350,7 @@ DrvMovePointer(
WasVisible = ppdev->PointerAttributes.Enable;
if (WasVisible)
{
IntHideMousePointer(ppdev);
IntHideMousePointer(ppdev, pso);
}
if (x == -1)
@ -366,12 +358,12 @@ DrvMovePointer(
return;
}
ppdev->PointerAttributes.Column = x - ppdev->HotSpot.x;
ppdev->PointerAttributes.Row = y - ppdev->HotSpot.y;
ppdev->PointerAttributes.Column = x - ppdev->PointerHotSpot.x;
ppdev->PointerAttributes.Row = y - ppdev->PointerHotSpot.y;
if (WasVisible)
{
IntShowMousePointer(ppdev);
IntShowMousePointer(ppdev, pso);
}
}

View file

@ -111,15 +111,6 @@ DrvEnableSurface(
ppdev->hSurfEng = hSurface;
#ifdef EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
ppdev->ScreenClipObj = EngCreateClip();
ppdev->ScreenClipObj->iDComplexity = DC_RECT;
ppdev->ScreenClipObj->rclBounds.left = 0;
ppdev->ScreenClipObj->rclBounds.top = 0;
ppdev->ScreenClipObj->rclBounds.right = ppdev->ScreenWidth;
ppdev->ScreenClipObj->rclBounds.bottom = ppdev->ScreenHeight;
#endif
return hSurface;
}
@ -145,9 +136,6 @@ DrvDisableSurface(
ppdev->hSurfEng = NULL;
#ifdef EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
EngDeleteClip(ppdev->ScreenClipObj);
ppdev->ScreenClipObj = NULL;
/* Clear all mouse pointer surfaces. */
DrvSetPointerShape(NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0);
#endif

View file

@ -117,6 +117,19 @@ typedef struct
DRIVER_FUNCTIONS DriverFunctions;
PFILE_OBJECT VideoFileObject;
FAST_MUTEX DriverLock;
struct {
BOOL Enable;
LONG Column;
LONG Row;
LONG Width;
LONG Height;
} PointerAttributes;
XLATEOBJ *PointerXlateObject;
HSURF PointerColorSurface;
HSURF PointerMaskSurface;
HSURF PointerSaveSurface;
POINTL PointerHotSpot;
} GDIDEVICE;
/* Internal functions */

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.56 2004/01/17 15:20:25 navaraf Exp $
/* $Id: mouse.c,v 1.57 2004/01/24 19:47:05 navaraf Exp $
*
* PROJECT: ReactOS kernel
* PURPOSE: Mouse
@ -533,40 +533,291 @@ EnableMouse(HDC hDisplayDC)
}
}
ULONG
STDCALL
EngSetPointerShape(
IN SURFOBJ *pso,
IN SURFOBJ *psoMask,
IN SURFOBJ *psoColor,
IN XLATEOBJ *pxlo,
IN LONG xHot,
IN LONG yHot,
IN LONG x,
IN LONG y,
IN RECTL *prcl,
IN FLONG fl
)
/* SOFTWARE MOUSE POINTER IMPLEMENTATION **************************************/
#define MOUSE_TAG TAG('M', 'O', 'U', 'S')
VOID FASTCALL
IntHideMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface)
{
// www.osr.com/ddk/graphics/gdifncs_1y5j.htm
UNIMPLEMENTED;
return 0;
if (ppdev->PointerAttributes.Enable == FALSE)
{
return;
}
ppdev->PointerAttributes.Enable = FALSE;
if (ppdev->PointerSaveSurface != NULL)
{
RECTL DestRect;
POINTL SrcPoint;
SURFOBJ *SaveSurface;
SURFOBJ *MaskSurface;
DestRect.left = max(ppdev->PointerAttributes.Column, 0);
DestRect.top = max(ppdev->PointerAttributes.Row, 0);
DestRect.right = min(
ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width,
DestSurface->sizlBitmap.cx - 1);
DestRect.bottom = min(
ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height,
DestSurface->sizlBitmap.cy - 1);
SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0);
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
MaskSurface = EngLockSurface(ppdev->PointerMaskSurface);
EngBitBlt(DestSurface, SaveSurface, MaskSurface, NULL, NULL,
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL, SRCCOPY);
EngUnlockSurface(MaskSurface);
EngUnlockSurface(SaveSurface);
}
}
VOID FASTCALL
IntShowMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface)
{
if (ppdev->PointerAttributes.Enable == TRUE)
{
return;
}
ppdev->PointerAttributes.Enable = TRUE;
/*
* Copy the pixels under the cursor to temporary surface.
*/
if (ppdev->PointerSaveSurface != NULL)
{
RECTL DestRect;
POINTL SrcPoint;
SURFOBJ *SaveSurface;
SrcPoint.x = max(ppdev->PointerAttributes.Column, 0);
SrcPoint.y = max(ppdev->PointerAttributes.Row, 0);
DestRect.left = SrcPoint.x - ppdev->PointerAttributes.Column;
DestRect.top = SrcPoint.y - ppdev->PointerAttributes.Row;
DestRect.right = min(
ppdev->PointerAttributes.Width,
DestSurface->sizlBitmap.cx - ppdev->PointerAttributes.Column - 1);
DestRect.bottom = min(
ppdev->PointerAttributes.Height,
DestSurface->sizlBitmap.cy - ppdev->PointerAttributes.Row - 1);
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL,
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCCOPY);
EngUnlockSurface(SaveSurface);
}
/*
* Blit the cursor on the screen.
*/
{
RECTL DestRect;
POINTL SrcPoint;
SURFOBJ *ColorSurf;
SURFOBJ *MaskSurf;
DestRect.left = max(ppdev->PointerAttributes.Column, 0);
DestRect.top = max(ppdev->PointerAttributes.Row, 0);
DestRect.right = min(
ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width,
DestSurface->sizlBitmap.cx - 1);
DestRect.bottom = min(
ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height,
DestSurface->sizlBitmap.cy - 1);
SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0);
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
MaskSurf = EngLockSurface(ppdev->PointerMaskSurface);
if (ppdev->PointerColorSurface != NULL)
{
ColorSurf = EngLockSurface(ppdev->PointerColorSurface);
EngBitBlt(DestSurface, ColorSurf, MaskSurf, NULL, ppdev->PointerXlateObject,
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL, 0xAACC);
EngUnlockSurface(ColorSurf);
}
else
{
EngBitBlt(DestSurface, MaskSurf, NULL, NULL, ppdev->PointerXlateObject,
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCAND);
SrcPoint.y += ppdev->PointerAttributes.Height;
EngBitBlt(DestSurface, MaskSurf, NULL, NULL, ppdev->PointerXlateObject,
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCINVERT);
}
EngUnlockSurface(MaskSurf);
}
}
/*
* @unimplemented
* @implemented
*/
VOID
STDCALL
EngMovePointer(
IN SURFOBJ *pso,
IN LONG x,
IN LONG y,
IN RECTL *prcl
)
ULONG STDCALL
EngSetPointerShape(
IN SURFOBJ *pso,
IN SURFOBJ *psoMask,
IN SURFOBJ *psoColor,
IN XLATEOBJ *pxlo,
IN LONG xHot,
IN LONG yHot,
IN LONG x,
IN LONG y,
IN RECTL *prcl,
IN FLONG fl)
{
// www.osr.com/ddk/graphics/gdifncs_8wfb.htm
UNIMPLEMENTED;
GDIDEVICE *ppdev = (GDIDEVICE *)pso->hdev;
SURFOBJ *TempSurfObj;
IntHideMousePointer(ppdev, pso);
if (ppdev->PointerColorSurface != NULL)
{
/* FIXME: Is this really needed? */
TempSurfObj = EngLockSurface(ppdev->PointerColorSurface);
EngFreeMem(TempSurfObj->pvBits);
TempSurfObj->pvBits = 0;
EngUnlockSurface(TempSurfObj);
EngDeleteSurface(ppdev->PointerColorSurface);
ppdev->PointerMaskSurface = NULL;
}
if (ppdev->PointerMaskSurface != NULL)
{
/* FIXME: Is this really needed? */
TempSurfObj = EngLockSurface(ppdev->PointerMaskSurface);
EngFreeMem(TempSurfObj->pvBits);
TempSurfObj->pvBits = 0;
EngUnlockSurface(TempSurfObj);
EngDeleteSurface(ppdev->PointerMaskSurface);
ppdev->PointerMaskSurface = NULL;
}
if (ppdev->PointerSaveSurface != NULL)
{
EngDeleteSurface(ppdev->PointerSaveSurface);
ppdev->PointerSaveSurface = NULL;
}
/*
* See if we are being asked to hide the pointer.
*/
if (psoMask == NULL)
{
return SPS_ACCEPT_EXCLUDE;
}
ppdev->PointerHotSpot.x = xHot;
ppdev->PointerHotSpot.y = yHot;
ppdev->PointerAttributes.Column = x - xHot;
ppdev->PointerAttributes.Row = y - yHot;
ppdev->PointerAttributes.Width = psoMask->lDelta << 3;
ppdev->PointerAttributes.Height = (psoMask->cjBits / psoMask->lDelta) >> 1;
ppdev->PointerXlateObject = pxlo;
if (psoColor != NULL)
{
SIZEL Size;
PBYTE Bits;
Size.cx = ppdev->PointerAttributes.Width;
Size.cy = ppdev->PointerAttributes.Height;
Bits = EngAllocMem(0, psoColor->cjBits, MOUSE_TAG);
memcpy(Bits, psoColor->pvBits, psoColor->cjBits);
ppdev->PointerColorSurface = (HSURF)EngCreateBitmap(Size,
psoColor->lDelta, psoColor->iBitmapFormat, 0, Bits);
}
else
{
ppdev->PointerColorSurface = NULL;
}
{
SIZEL Size;
PBYTE Bits;
Size.cx = ppdev->PointerAttributes.Width;
Size.cy = ppdev->PointerAttributes.Height << 1;
Bits = EngAllocMem(0, psoMask->cjBits, MOUSE_TAG);
memcpy(Bits, psoMask->pvBits, psoMask->cjBits);
ppdev->PointerMaskSurface = (HSURF)EngCreateBitmap(Size,
psoMask->lDelta, psoMask->iBitmapFormat, 0, Bits);
}
/*
* Create surface for saving the pixels under the cursor.
*/
{
SIZEL Size;
LONG lDelta;
Size.cx = ppdev->PointerAttributes.Width;
Size.cy = ppdev->PointerAttributes.Height;
switch (pso->iBitmapFormat)
{
case BMF_1BPP: lDelta = Size.cx >> 3; break;
case BMF_4BPP: lDelta = Size.cx >> 1; break;
case BMF_8BPP: lDelta = Size.cx; break;
case BMF_16BPP: lDelta = Size.cx << 1; break;
case BMF_24BPP: lDelta = Size.cx * 3; break;
case BMF_32BPP: lDelta = Size.cx << 2; break;
}
ppdev->PointerSaveSurface = (HSURF)EngCreateBitmap(
Size, lDelta, pso->iBitmapFormat, BMF_NOZEROINIT, NULL);
}
IntShowMousePointer(ppdev, pso);
return SPS_ACCEPT_EXCLUDE;
}
/*
* @implemented
*/
VOID STDCALL
EngMovePointer(
IN SURFOBJ *pso,
IN LONG x,
IN LONG y,
IN RECTL *prcl)
{
GDIDEVICE *ppdev = (GDIDEVICE *)pso->hdev;
BOOL WasVisible;
WasVisible = ppdev->PointerAttributes.Enable;
if (WasVisible)
{
IntHideMousePointer(ppdev, pso);
}
if (x == -1)
{
return;
}
ppdev->PointerAttributes.Column = x - ppdev->PointerHotSpot.x;
ppdev->PointerAttributes.Row = y - ppdev->PointerHotSpot.y;
if (WasVisible)
{
IntShowMousePointer(ppdev, pso);
}
}
/* EOF */

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: cursoricon.c,v 1.44 2004/01/17 15:20:25 navaraf Exp $ */
/* $Id: cursoricon.c,v 1.45 2004/01/24 19:47:05 navaraf Exp $ */
#undef WIN32_LEAN_AND_MEAN
@ -98,87 +98,85 @@ SetPointerRect(PSYSTEM_CURSORINFO CurInfo, PRECTL PointerRect)
#define COLORCURSORS_ALLOWED FALSE
HCURSOR FASTCALL
IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL ForceChange)
IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
BOOL ForceChange)
{
PSURFOBJ SurfObj;
PSURFGDI SurfGDI;
SIZEL MouseSize;
PDEVINFO DevInfo;
PBITMAPOBJ MaskBmpObj;
PSYSTEM_CURSORINFO CurInfo;
PCURICON_OBJECT OldCursor;
HCURSOR Ret = (HCURSOR)0;
HBITMAP hMask = (HBITMAP)0, hColor = (HBITMAP)0;
PSURFOBJ soMask = NULL, soColor = NULL;
PXLATEOBJ XlateObj = NULL;
RECTL PointerRect;
PSURFOBJ SurfObj;
PSURFGDI SurfGDI;
SIZEL MouseSize;
PDEVINFO DevInfo;
PBITMAPOBJ MaskBmpObj;
PSYSTEM_CURSORINFO CurInfo;
PCURICON_OBJECT OldCursor;
HCURSOR Ret = (HCURSOR)0;
HBITMAP hMask = (HBITMAP)0, hColor = (HBITMAP)0;
PSURFOBJ soMask = NULL, soColor = NULL;
PXLATEOBJ XlateObj = NULL;
RECTL PointerRect;
CurInfo = &WinStaObject->SystemCursor;
OldCursor = CurInfo->CurrentCursorObject;
if(OldCursor)
{
Ret = (HCURSOR)OldCursor->Self;
}
CurInfo = &WinStaObject->SystemCursor;
OldCursor = CurInfo->CurrentCursorObject;
if (OldCursor)
{
Ret = (HCURSOR)OldCursor->Self;
}
if(!ForceChange && (OldCursor == NewCursor))
{
return Ret;
}
{
/* FIXME use the desktop's HDC instead of using ScreenDeviceContext */
PDC dc = DC_LockDc(IntGetScreenDC());
if(!dc)
{
return Ret;
}
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
DevInfo = dc->DevInfo;
DC_UnlockDc(IntGetScreenDC());
}
if(!NewCursor && (CurInfo->CurrentCursorObject || ForceChange))
{
ExAcquireFastMutex(SurfGDI->DriverLock);
SurfGDI->PointerStatus = SurfGDI->SetPointerShape(SurfObj, NULL, NULL, NULL,
0,
0,
CurInfo->x,
CurInfo->y,
&PointerRect,
SPS_CHANGE);
ExReleaseFastMutex(SurfGDI->DriverLock);
SetPointerRect(CurInfo, &PointerRect);
CurInfo->CurrentCursorObject = NewCursor; /* i.e. CurrentCursorObject = NULL */
CurInfo->ShowingCursor = 0;
return Ret;
}
if (!NewCursor)
{
return Ret;
}
/* TODO: Fixme. Logic is screwed above */
ASSERT(NewCursor);
MaskBmpObj = BITMAPOBJ_LockBitmap(NewCursor->IconInfo.hbmMask);
if(MaskBmpObj)
{
const int maskBpp = MaskBmpObj->bitmap.bmBitsPixel;
BITMAPOBJ_UnlockBitmap(NewCursor->IconInfo.hbmMask);
if(maskBpp != 1)
{
DbgPrint("SetCursor: The Mask bitmap must have 1BPP!\n");
if (!ForceChange && OldCursor == NewCursor)
{
return Ret;
}
{
/* FIXME use the desktop's HDC instead of using ScreenDeviceContext */
PDC dc = DC_LockDc(IntGetScreenDC());
if (!dc)
{
return Ret;
}
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
DevInfo = dc->DevInfo;
DC_UnlockDc(IntGetScreenDC());
}
if (!NewCursor && (CurInfo->CurrentCursorObject || ForceChange))
{
ExAcquireFastMutex(SurfGDI->DriverLock);
SurfGDI->PointerStatus = SurfGDI->SetPointerShape(SurfObj, NULL, NULL, NULL,
0, 0, CurInfo->x, CurInfo->y,
&PointerRect, SPS_CHANGE);
ExReleaseFastMutex(SurfGDI->DriverLock);
SetPointerRect(CurInfo, &PointerRect);
CurInfo->CurrentCursorObject = NewCursor; /* i.e. CurrentCursorObject = NULL */
CurInfo->ShowingCursor = 0;
return Ret;
}
if (!NewCursor)
{
return Ret;
}
/* TODO: Fixme. Logic is screwed above */
ASSERT(NewCursor);
MaskBmpObj = BITMAPOBJ_LockBitmap(NewCursor->IconInfo.hbmMask);
if (MaskBmpObj)
{
const int maskBpp = MaskBmpObj->bitmap.bmBitsPixel;
BITMAPOBJ_UnlockBitmap(NewCursor->IconInfo.hbmMask);
if (maskBpp != 1)
{
DbgPrint("SetCursor: The Mask bitmap must have 1BPP!\n");
return Ret;
}
if((DevInfo->flGraphicsCaps2 & GCAPS2_ALPHACURSOR) &&
(SurfGDI->BitsPerPixel >= 16) && NewCursor->Shadow
&& COLORCURSORS_ALLOWED)
if ((DevInfo->flGraphicsCaps2 & GCAPS2_ALPHACURSOR) &&
(SurfGDI->BitsPerPixel >= 16) && NewCursor->Shadow
&& COLORCURSORS_ALLOWED)
{
/* FIXME - Create a color pointer, only 32bit bitmap, set alpha bits!
Do not pass a mask bitmap to DrvSetPointerShape()!
@ -232,7 +230,8 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL Fo
{
SurfGDI->SetPointerShape = EngSetPointerShape;
SurfGDI->MovePointer = EngMovePointer;
EngSetPointerShape(SurfObj, soMask, soColor, XlateObj,
SurfGDI->PointerStatus = EngSetPointerShape(
SurfObj, soMask, soColor, XlateObj,
NewCursor->IconInfo.xHotspot,
NewCursor->IconInfo.yHotspot,
CurInfo->x,