mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 02:20:54 +00:00
Moved the generic mouse pointer implementation to win32k (not complete yet).
svn path=/trunk/; revision=7865
This commit is contained in:
parent
db0f9b9ba4
commit
e25e386086
|
@ -26,7 +26,7 @@
|
||||||
#include <ddk/winddi.h>
|
#include <ddk/winddi.h>
|
||||||
#include <ddk/ntddvdeo.h>
|
#include <ddk/ntddvdeo.h>
|
||||||
|
|
||||||
#define EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
|
//#define EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
|
||||||
|
|
||||||
typedef struct _PDEV
|
typedef struct _PDEV
|
||||||
{
|
{
|
||||||
|
@ -48,12 +48,11 @@ typedef struct _PDEV
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
|
#ifdef EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
|
||||||
VIDEO_POINTER_ATTRIBUTES PointerAttributes;
|
VIDEO_POINTER_ATTRIBUTES PointerAttributes;
|
||||||
|
XLATEOBJ *PointerXlateObject;
|
||||||
HSURF PointerColorSurface;
|
HSURF PointerColorSurface;
|
||||||
HSURF PointerMaskSurface;
|
HSURF PointerMaskSurface;
|
||||||
HSURF PointerSaveSurface;
|
HSURF PointerSaveSurface;
|
||||||
XLATEOBJ *XlateObject;
|
POINTL PointerHotSpot;
|
||||||
POINTL HotSpot;
|
|
||||||
CLIPOBJ *ScreenClipObj;
|
|
||||||
#endif
|
#endif
|
||||||
} PDEV, *PPDEV;
|
} PDEV, *PPDEV;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@ DrvSetPointerShape(
|
||||||
IN RECTL *prcl,
|
IN RECTL *prcl,
|
||||||
IN FLONG fl)
|
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 LONG y,
|
||||||
IN RECTL *prcl)
|
IN RECTL *prcl)
|
||||||
{
|
{
|
||||||
|
return EngMovePointer(pso, x, y, prcl);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
IntHideMousePointer(PPDEV ppdev)
|
IntHideMousePointer(PPDEV ppdev, SURFOBJ *DestSurface)
|
||||||
{
|
{
|
||||||
if (ppdev->PointerAttributes.Enable == FALSE)
|
if (ppdev->PointerAttributes.Enable == FALSE)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +84,6 @@ IntHideMousePointer(PPDEV ppdev)
|
||||||
RECTL DestRect;
|
RECTL DestRect;
|
||||||
POINTL SrcPoint;
|
POINTL SrcPoint;
|
||||||
SURFOBJ *SaveSurface;
|
SURFOBJ *SaveSurface;
|
||||||
SURFOBJ *DestSurface;
|
|
||||||
SURFOBJ *MaskSurface;
|
SURFOBJ *MaskSurface;
|
||||||
|
|
||||||
DestRect.left = max(ppdev->PointerAttributes.Column, 0);
|
DestRect.left = max(ppdev->PointerAttributes.Column, 0);
|
||||||
|
@ -99,18 +99,16 @@ IntHideMousePointer(PPDEV ppdev)
|
||||||
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
|
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
|
||||||
|
|
||||||
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
|
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
|
||||||
DestSurface = EngLockSurface(ppdev->hSurfEng);
|
|
||||||
MaskSurface = EngLockSurface(ppdev->PointerMaskSurface);
|
MaskSurface = EngLockSurface(ppdev->PointerMaskSurface);
|
||||||
EngBitBlt(DestSurface, SaveSurface, MaskSurface, NULL, NULL,
|
EngBitBlt(DestSurface, SaveSurface, MaskSurface, NULL, NULL,
|
||||||
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL, SRCCOPY);
|
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL, SRCCOPY);
|
||||||
EngUnlockSurface(MaskSurface);
|
EngUnlockSurface(MaskSurface);
|
||||||
EngUnlockSurface(DestSurface);
|
|
||||||
EngUnlockSurface(SaveSurface);
|
EngUnlockSurface(SaveSurface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
IntShowMousePointer(PPDEV ppdev)
|
IntShowMousePointer(PPDEV ppdev, SURFOBJ *DestSurface)
|
||||||
{
|
{
|
||||||
if (ppdev->PointerAttributes.Enable == TRUE)
|
if (ppdev->PointerAttributes.Enable == TRUE)
|
||||||
{
|
{
|
||||||
|
@ -128,7 +126,6 @@ IntShowMousePointer(PPDEV ppdev)
|
||||||
RECTL DestRect;
|
RECTL DestRect;
|
||||||
POINTL SrcPoint;
|
POINTL SrcPoint;
|
||||||
SURFOBJ *SaveSurface;
|
SURFOBJ *SaveSurface;
|
||||||
SURFOBJ *DestSurface;
|
|
||||||
|
|
||||||
SrcPoint.x = max(ppdev->PointerAttributes.Column, 0);
|
SrcPoint.x = max(ppdev->PointerAttributes.Column, 0);
|
||||||
SrcPoint.y = max(ppdev->PointerAttributes.Row, 0);
|
SrcPoint.y = max(ppdev->PointerAttributes.Row, 0);
|
||||||
|
@ -143,10 +140,8 @@ IntShowMousePointer(PPDEV ppdev)
|
||||||
ppdev->ScreenHeight - ppdev->PointerAttributes.Row - 1);
|
ppdev->ScreenHeight - ppdev->PointerAttributes.Row - 1);
|
||||||
|
|
||||||
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
|
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
|
||||||
DestSurface = EngLockSurface(ppdev->hSurfEng);
|
|
||||||
EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL,
|
EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL,
|
||||||
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCCOPY);
|
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCCOPY);
|
||||||
EngUnlockSurface(DestSurface);
|
|
||||||
EngUnlockSurface(SaveSurface);
|
EngUnlockSurface(SaveSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +152,6 @@ IntShowMousePointer(PPDEV ppdev)
|
||||||
{
|
{
|
||||||
RECTL DestRect;
|
RECTL DestRect;
|
||||||
POINTL SrcPoint;
|
POINTL SrcPoint;
|
||||||
SURFOBJ *DestSurf;
|
|
||||||
SURFOBJ *ColorSurf;
|
SURFOBJ *ColorSurf;
|
||||||
SURFOBJ *MaskSurf;
|
SURFOBJ *MaskSurf;
|
||||||
|
|
||||||
|
@ -173,26 +167,24 @@ IntShowMousePointer(PPDEV ppdev)
|
||||||
SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0);
|
SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0);
|
||||||
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
|
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
|
||||||
|
|
||||||
DestSurf = EngLockSurface(ppdev->hSurfEng);
|
|
||||||
MaskSurf = EngLockSurface(ppdev->PointerMaskSurface);
|
MaskSurf = EngLockSurface(ppdev->PointerMaskSurface);
|
||||||
if (ppdev->PointerColorSurface != NULL)
|
if (ppdev->PointerColorSurface != NULL)
|
||||||
{
|
{
|
||||||
ColorSurf = EngLockSurface(ppdev->PointerColorSurface);
|
ColorSurf = EngLockSurface(ppdev->PointerColorSurface);
|
||||||
EngBitBlt(DestSurf, ColorSurf, MaskSurf, NULL, ppdev->XlateObject,
|
EngBitBlt(DestSurface, ColorSurf, MaskSurf, NULL, ppdev->PointerXlateObject,
|
||||||
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL, 0xAACC);
|
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL, 0xAACC);
|
||||||
EngUnlockSurface(ColorSurf);
|
EngUnlockSurface(ColorSurf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
EngBitBlt(DestSurf, MaskSurf, NULL, NULL, NULL,
|
EngBitBlt(DestSurface, MaskSurf, NULL, NULL, ppdev->PointerXlateObject,
|
||||||
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCAND);
|
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCAND);
|
||||||
SrcPoint.y += ppdev->PointerAttributes.Height;
|
SrcPoint.y += ppdev->PointerAttributes.Height;
|
||||||
EngBitBlt(DestSurf, MaskSurf, NULL, NULL, NULL,
|
EngBitBlt(DestSurface, MaskSurf, NULL, NULL, ppdev->PointerXlateObject,
|
||||||
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCINVERT);
|
&DestRect, &SrcPoint, NULL, NULL, NULL, SRCINVERT);
|
||||||
}
|
}
|
||||||
EngUnlockSurface(MaskSurf);
|
EngUnlockSurface(MaskSurf);
|
||||||
EngUnlockSurface(DestSurf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +213,7 @@ DrvSetPointerShape(
|
||||||
PPDEV ppdev = (PPDEV)pso->dhpdev;
|
PPDEV ppdev = (PPDEV)pso->dhpdev;
|
||||||
SURFOBJ *TempSurfObj;
|
SURFOBJ *TempSurfObj;
|
||||||
|
|
||||||
IntHideMousePointer(ppdev);
|
IntHideMousePointer(ppdev, pso);
|
||||||
|
|
||||||
if (ppdev->PointerColorSurface != NULL)
|
if (ppdev->PointerColorSurface != NULL)
|
||||||
{
|
{
|
||||||
|
@ -262,10 +254,10 @@ DrvSetPointerShape(
|
||||||
return SPS_ACCEPT_EXCLUDE;
|
return SPS_ACCEPT_EXCLUDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ppdev->HotSpot.x = xHot;
|
ppdev->PointerHotSpot.x = xHot;
|
||||||
ppdev->HotSpot.y = yHot;
|
ppdev->PointerHotSpot.y = yHot;
|
||||||
|
|
||||||
ppdev->XlateObject = pxlo;
|
ppdev->PointerXlateObject = pxlo;
|
||||||
ppdev->PointerAttributes.Column = x - xHot;
|
ppdev->PointerAttributes.Column = x - xHot;
|
||||||
ppdev->PointerAttributes.Row = y - yHot;
|
ppdev->PointerAttributes.Row = y - yHot;
|
||||||
ppdev->PointerAttributes.Width = psoMask->lDelta << 3;
|
ppdev->PointerAttributes.Width = psoMask->lDelta << 3;
|
||||||
|
@ -330,7 +322,7 @@ DrvSetPointerShape(
|
||||||
Size, lDelta, pso->iBitmapFormat, BMF_NOZEROINIT, NULL);
|
Size, lDelta, pso->iBitmapFormat, BMF_NOZEROINIT, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntShowMousePointer(ppdev);
|
IntShowMousePointer(ppdev, pso);
|
||||||
|
|
||||||
return SPS_ACCEPT_EXCLUDE;
|
return SPS_ACCEPT_EXCLUDE;
|
||||||
}
|
}
|
||||||
|
@ -358,7 +350,7 @@ DrvMovePointer(
|
||||||
WasVisible = ppdev->PointerAttributes.Enable;
|
WasVisible = ppdev->PointerAttributes.Enable;
|
||||||
if (WasVisible)
|
if (WasVisible)
|
||||||
{
|
{
|
||||||
IntHideMousePointer(ppdev);
|
IntHideMousePointer(ppdev, pso);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
|
@ -366,12 +358,12 @@ DrvMovePointer(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ppdev->PointerAttributes.Column = x - ppdev->HotSpot.x;
|
ppdev->PointerAttributes.Column = x - ppdev->PointerHotSpot.x;
|
||||||
ppdev->PointerAttributes.Row = y - ppdev->HotSpot.y;
|
ppdev->PointerAttributes.Row = y - ppdev->PointerHotSpot.y;
|
||||||
|
|
||||||
if (WasVisible)
|
if (WasVisible)
|
||||||
{
|
{
|
||||||
IntShowMousePointer(ppdev);
|
IntShowMousePointer(ppdev, pso);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,15 +111,6 @@ DrvEnableSurface(
|
||||||
|
|
||||||
ppdev->hSurfEng = hSurface;
|
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;
|
return hSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,9 +136,6 @@ DrvDisableSurface(
|
||||||
ppdev->hSurfEng = NULL;
|
ppdev->hSurfEng = NULL;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
|
#ifdef EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
|
||||||
EngDeleteClip(ppdev->ScreenClipObj);
|
|
||||||
ppdev->ScreenClipObj = NULL;
|
|
||||||
|
|
||||||
/* Clear all mouse pointer surfaces. */
|
/* Clear all mouse pointer surfaces. */
|
||||||
DrvSetPointerShape(NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0);
|
DrvSetPointerShape(NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -117,6 +117,19 @@ typedef struct
|
||||||
DRIVER_FUNCTIONS DriverFunctions;
|
DRIVER_FUNCTIONS DriverFunctions;
|
||||||
PFILE_OBJECT VideoFileObject;
|
PFILE_OBJECT VideoFileObject;
|
||||||
FAST_MUTEX DriverLock;
|
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;
|
} GDIDEVICE;
|
||||||
|
|
||||||
/* Internal functions */
|
/* Internal functions */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: Mouse
|
* PURPOSE: Mouse
|
||||||
|
@ -533,8 +533,132 @@ EnableMouse(HDC hDisplayDC)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
/* SOFTWARE MOUSE POINTER IMPLEMENTATION **************************************/
|
||||||
STDCALL
|
|
||||||
|
#define MOUSE_TAG TAG('M', 'O', 'U', 'S')
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
IntHideMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
|
||||||
|
ULONG STDCALL
|
||||||
EngSetPointerShape(
|
EngSetPointerShape(
|
||||||
IN SURFOBJ *pso,
|
IN SURFOBJ *pso,
|
||||||
IN SURFOBJ *psoMask,
|
IN SURFOBJ *psoMask,
|
||||||
|
@ -545,28 +669,155 @@ EngSetPointerShape(
|
||||||
IN LONG x,
|
IN LONG x,
|
||||||
IN LONG y,
|
IN LONG y,
|
||||||
IN RECTL *prcl,
|
IN RECTL *prcl,
|
||||||
IN FLONG fl
|
IN FLONG fl)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// www.osr.com/ddk/graphics/gdifncs_1y5j.htm
|
GDIDEVICE *ppdev = (GDIDEVICE *)pso->hdev;
|
||||||
UNIMPLEMENTED;
|
SURFOBJ *TempSurfObj;
|
||||||
return 0;
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
VOID
|
|
||||||
STDCALL
|
VOID STDCALL
|
||||||
EngMovePointer(
|
EngMovePointer(
|
||||||
IN SURFOBJ *pso,
|
IN SURFOBJ *pso,
|
||||||
IN LONG x,
|
IN LONG x,
|
||||||
IN LONG y,
|
IN LONG y,
|
||||||
IN RECTL *prcl
|
IN RECTL *prcl)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// www.osr.com/ddk/graphics/gdifncs_8wfb.htm
|
GDIDEVICE *ppdev = (GDIDEVICE *)pso->hdev;
|
||||||
UNIMPLEMENTED;
|
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 */
|
/* EOF */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
|
@ -98,7 +98,8 @@ SetPointerRect(PSYSTEM_CURSORINFO CurInfo, PRECTL PointerRect)
|
||||||
|
|
||||||
#define COLORCURSORS_ALLOWED FALSE
|
#define COLORCURSORS_ALLOWED FALSE
|
||||||
HCURSOR FASTCALL
|
HCURSOR FASTCALL
|
||||||
IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL ForceChange)
|
IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
|
||||||
|
BOOL ForceChange)
|
||||||
{
|
{
|
||||||
PSURFOBJ SurfObj;
|
PSURFOBJ SurfObj;
|
||||||
PSURFGDI SurfGDI;
|
PSURFGDI SurfGDI;
|
||||||
|
@ -115,12 +116,12 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL Fo
|
||||||
|
|
||||||
CurInfo = &WinStaObject->SystemCursor;
|
CurInfo = &WinStaObject->SystemCursor;
|
||||||
OldCursor = CurInfo->CurrentCursorObject;
|
OldCursor = CurInfo->CurrentCursorObject;
|
||||||
if(OldCursor)
|
if (OldCursor)
|
||||||
{
|
{
|
||||||
Ret = (HCURSOR)OldCursor->Self;
|
Ret = (HCURSOR)OldCursor->Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ForceChange && (OldCursor == NewCursor))
|
if (!ForceChange && OldCursor == NewCursor)
|
||||||
{
|
{
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +129,8 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL Fo
|
||||||
{
|
{
|
||||||
/* FIXME use the desktop's HDC instead of using ScreenDeviceContext */
|
/* FIXME use the desktop's HDC instead of using ScreenDeviceContext */
|
||||||
PDC dc = DC_LockDc(IntGetScreenDC());
|
PDC dc = DC_LockDc(IntGetScreenDC());
|
||||||
if(!dc)
|
|
||||||
|
if (!dc)
|
||||||
{
|
{
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
@ -139,16 +141,12 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL Fo
|
||||||
DC_UnlockDc(IntGetScreenDC());
|
DC_UnlockDc(IntGetScreenDC());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!NewCursor && (CurInfo->CurrentCursorObject || ForceChange))
|
if (!NewCursor && (CurInfo->CurrentCursorObject || ForceChange))
|
||||||
{
|
{
|
||||||
ExAcquireFastMutex(SurfGDI->DriverLock);
|
ExAcquireFastMutex(SurfGDI->DriverLock);
|
||||||
SurfGDI->PointerStatus = SurfGDI->SetPointerShape(SurfObj, NULL, NULL, NULL,
|
SurfGDI->PointerStatus = SurfGDI->SetPointerShape(SurfObj, NULL, NULL, NULL,
|
||||||
0,
|
0, 0, CurInfo->x, CurInfo->y,
|
||||||
0,
|
&PointerRect, SPS_CHANGE);
|
||||||
CurInfo->x,
|
|
||||||
CurInfo->y,
|
|
||||||
&PointerRect,
|
|
||||||
SPS_CHANGE);
|
|
||||||
ExReleaseFastMutex(SurfGDI->DriverLock);
|
ExReleaseFastMutex(SurfGDI->DriverLock);
|
||||||
SetPointerRect(CurInfo, &PointerRect);
|
SetPointerRect(CurInfo, &PointerRect);
|
||||||
|
|
||||||
|
@ -166,17 +164,17 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL Fo
|
||||||
|
|
||||||
ASSERT(NewCursor);
|
ASSERT(NewCursor);
|
||||||
MaskBmpObj = BITMAPOBJ_LockBitmap(NewCursor->IconInfo.hbmMask);
|
MaskBmpObj = BITMAPOBJ_LockBitmap(NewCursor->IconInfo.hbmMask);
|
||||||
if(MaskBmpObj)
|
if (MaskBmpObj)
|
||||||
{
|
{
|
||||||
const int maskBpp = MaskBmpObj->bitmap.bmBitsPixel;
|
const int maskBpp = MaskBmpObj->bitmap.bmBitsPixel;
|
||||||
BITMAPOBJ_UnlockBitmap(NewCursor->IconInfo.hbmMask);
|
BITMAPOBJ_UnlockBitmap(NewCursor->IconInfo.hbmMask);
|
||||||
if(maskBpp != 1)
|
if (maskBpp != 1)
|
||||||
{
|
{
|
||||||
DbgPrint("SetCursor: The Mask bitmap must have 1BPP!\n");
|
DbgPrint("SetCursor: The Mask bitmap must have 1BPP!\n");
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((DevInfo->flGraphicsCaps2 & GCAPS2_ALPHACURSOR) &&
|
if ((DevInfo->flGraphicsCaps2 & GCAPS2_ALPHACURSOR) &&
|
||||||
(SurfGDI->BitsPerPixel >= 16) && NewCursor->Shadow
|
(SurfGDI->BitsPerPixel >= 16) && NewCursor->Shadow
|
||||||
&& COLORCURSORS_ALLOWED)
|
&& COLORCURSORS_ALLOWED)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +230,8 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL Fo
|
||||||
{
|
{
|
||||||
SurfGDI->SetPointerShape = EngSetPointerShape;
|
SurfGDI->SetPointerShape = EngSetPointerShape;
|
||||||
SurfGDI->MovePointer = EngMovePointer;
|
SurfGDI->MovePointer = EngMovePointer;
|
||||||
EngSetPointerShape(SurfObj, soMask, soColor, XlateObj,
|
SurfGDI->PointerStatus = EngSetPointerShape(
|
||||||
|
SurfObj, soMask, soColor, XlateObj,
|
||||||
NewCursor->IconInfo.xHotspot,
|
NewCursor->IconInfo.xHotspot,
|
||||||
NewCursor->IconInfo.yHotspot,
|
NewCursor->IconInfo.yHotspot,
|
||||||
CurInfo->x,
|
CurInfo->x,
|
||||||
|
|
Loading…
Reference in a new issue