mirror of
https://github.com/reactos/reactos.git
synced 2025-05-30 22:49:12 +00:00
[FORMATTING]
- fix indentation - remove the large file header, fix the small one svn path=/trunk/; revision=40390
This commit is contained in:
parent
579dc0993e
commit
f0179f8ce1
1 changed files with 398 additions and 431 deletions
|
@ -1,26 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: ReactOS win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* PURPOSE: Mouse pointer functions
|
||||||
*
|
* FILE: subsystems/win32k/eng/mouse.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
/* $Id$
|
|
||||||
*
|
|
||||||
* PROJECT: ReactOS kernel
|
|
||||||
* PURPOSE: Mouse
|
|
||||||
* FILE: subsys/win32k/eng/mouse.c
|
|
||||||
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||||
* REVISION HISTORY:
|
* REVISION HISTORY:
|
||||||
* 06-06-2001 CSH Created
|
* 06-06-2001 CSH Created
|
||||||
|
@ -34,495 +15,481 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
INT INTERNAL_CALL
|
|
||||||
MouseSafetyOnDrawStart(SURFOBJ *SurfObj, LONG HazardX1,
|
|
||||||
LONG HazardY1, LONG HazardX2, LONG HazardY2)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Notify the mouse driver that drawing is about to begin in
|
* FUNCTION: Notify the mouse driver that drawing is about to begin in
|
||||||
* a rectangle on a particular surface.
|
* a rectangle on a particular surface.
|
||||||
*/
|
*/
|
||||||
|
INT INTERNAL_CALL
|
||||||
|
MouseSafetyOnDrawStart(
|
||||||
|
SURFOBJ *SurfObj,
|
||||||
|
LONG HazardX1,
|
||||||
|
LONG HazardY1,
|
||||||
|
LONG HazardX2,
|
||||||
|
LONG HazardY2)
|
||||||
{
|
{
|
||||||
LONG tmp;
|
LONG tmp;
|
||||||
PDEVOBJ *ppdev;
|
PDEVOBJ *ppdev;
|
||||||
GDIPOINTER *pgp;
|
GDIPOINTER *pgp;
|
||||||
|
|
||||||
ASSERT(SurfObj != NULL);
|
ASSERT(SurfObj != NULL);
|
||||||
|
|
||||||
ppdev = GDIDEV(SurfObj);
|
ppdev = GDIDEV(SurfObj);
|
||||||
|
if (ppdev == NULL)
|
||||||
if(ppdev == NULL)
|
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pgp = &ppdev->Pointer;
|
pgp = &ppdev->Pointer;
|
||||||
|
|
||||||
if (SPS_ACCEPT_NOEXCLUDE == pgp->Status ||
|
if (SPS_ACCEPT_NOEXCLUDE == pgp->Status ||
|
||||||
pgp->Exclude.right == -1)
|
pgp->Exclude.right == -1)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HazardX1 > HazardX2)
|
if (HazardX1 > HazardX2)
|
||||||
{
|
{
|
||||||
tmp = HazardX2; HazardX2 = HazardX1; HazardX1 = tmp;
|
tmp = HazardX2;
|
||||||
|
HazardX2 = HazardX1;
|
||||||
|
HazardX1 = tmp;
|
||||||
}
|
}
|
||||||
if (HazardY1 > HazardY2)
|
if (HazardY1 > HazardY2)
|
||||||
{
|
{
|
||||||
tmp = HazardY2; HazardY2 = HazardY1; HazardY1 = tmp;
|
tmp = HazardY2;
|
||||||
|
HazardY2 = HazardY1;
|
||||||
|
HazardY1 = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppdev->SafetyRemoveLevel != 0)
|
if (ppdev->SafetyRemoveLevel != 0)
|
||||||
{
|
{
|
||||||
ppdev->SafetyRemoveCount++;
|
ppdev->SafetyRemoveCount++;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ppdev->SafetyRemoveCount++;
|
ppdev->SafetyRemoveCount++;
|
||||||
|
|
||||||
if (pgp->Exclude.right >= HazardX1
|
if (pgp->Exclude.right >= HazardX1
|
||||||
&& pgp->Exclude.left <= HazardX2
|
&& pgp->Exclude.left <= HazardX2
|
||||||
&& pgp->Exclude.bottom >= HazardY1
|
&& pgp->Exclude.bottom >= HazardY1
|
||||||
&& pgp->Exclude.top <= HazardY2)
|
&& pgp->Exclude.top <= HazardY2)
|
||||||
{
|
{
|
||||||
ppdev->SafetyRemoveLevel = ppdev->SafetyRemoveCount;
|
ppdev->SafetyRemoveLevel = ppdev->SafetyRemoveCount;
|
||||||
if (pgp->MovePointer)
|
if (pgp->MovePointer)
|
||||||
pgp->MovePointer(SurfObj, -1, -1, NULL);
|
pgp->MovePointer(SurfObj, -1, -1, NULL);
|
||||||
else
|
else
|
||||||
EngMovePointer(SurfObj, -1, -1, NULL);
|
EngMovePointer(SurfObj, -1, -1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT INTERNAL_CALL
|
|
||||||
MouseSafetyOnDrawEnd(SURFOBJ *SurfObj)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Notify the mouse driver that drawing has finished on a surface.
|
* FUNCTION: Notify the mouse driver that drawing has finished on a surface.
|
||||||
*/
|
*/
|
||||||
|
INT INTERNAL_CALL
|
||||||
|
MouseSafetyOnDrawEnd(
|
||||||
|
SURFOBJ *SurfObj)
|
||||||
{
|
{
|
||||||
PDEVOBJ *ppdev;
|
PDEVOBJ *ppdev;
|
||||||
GDIPOINTER *pgp;
|
GDIPOINTER *pgp;
|
||||||
|
|
||||||
ASSERT(SurfObj != NULL);
|
ASSERT(SurfObj != NULL);
|
||||||
|
|
||||||
ppdev = GDIDEV(SurfObj);
|
ppdev = GDIDEV(SurfObj);
|
||||||
|
|
||||||
if(ppdev == NULL)
|
if (ppdev == NULL)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pgp = &ppdev->Pointer;
|
pgp = &ppdev->Pointer;
|
||||||
|
|
||||||
if(SPS_ACCEPT_NOEXCLUDE == pgp->Status ||
|
if (SPS_ACCEPT_NOEXCLUDE == pgp->Status ||
|
||||||
pgp->Exclude.right == -1)
|
pgp->Exclude.right == -1)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (--ppdev->SafetyRemoveCount >= ppdev->SafetyRemoveLevel)
|
if (--ppdev->SafetyRemoveCount >= ppdev->SafetyRemoveLevel)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (pgp->MovePointer)
|
if (pgp->MovePointer)
|
||||||
pgp->MovePointer(SurfObj, gpsi->ptCursor.x, gpsi->ptCursor.y, &pgp->Exclude);
|
pgp->MovePointer(SurfObj, gpsi->ptCursor.x, gpsi->ptCursor.y, &pgp->Exclude);
|
||||||
else
|
else
|
||||||
EngMovePointer(SurfObj, gpsi->ptCursor.x, gpsi->ptCursor.y, &pgp->Exclude);
|
EngMovePointer(SurfObj, gpsi->ptCursor.x, gpsi->ptCursor.y, &pgp->Exclude);
|
||||||
|
|
||||||
ppdev->SafetyRemoveLevel = 0;
|
ppdev->SafetyRemoveLevel = 0;
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SOFTWARE MOUSE POINTER IMPLEMENTATION **************************************/
|
/* SOFTWARE MOUSE POINTER IMPLEMENTATION **************************************/
|
||||||
|
|
||||||
VOID INTERNAL_CALL
|
VOID INTERNAL_CALL
|
||||||
IntHideMousePointer(PDEVOBJ *ppdev, SURFOBJ *psoDest)
|
IntHideMousePointer(
|
||||||
|
PDEVOBJ *ppdev,
|
||||||
|
SURFOBJ *psoDest)
|
||||||
{
|
{
|
||||||
GDIPOINTER *pgp;
|
GDIPOINTER *pgp;
|
||||||
POINTL pt;
|
POINTL pt;
|
||||||
|
|
||||||
ASSERT(ppdev);
|
ASSERT(ppdev);
|
||||||
ASSERT(psoDest);
|
ASSERT(psoDest);
|
||||||
|
|
||||||
pgp = &ppdev->Pointer;
|
pgp = &ppdev->Pointer;
|
||||||
|
|
||||||
if (!pgp->Enabled)
|
if (!pgp->Enabled)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pgp->Enabled = FALSE;
|
||||||
|
|
||||||
|
/* The mouse is hide from ShowCours and it is frist ?? */
|
||||||
|
if (pgp->ShowPointer < 0)
|
||||||
|
{
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide the cours */
|
||||||
|
pt.x = gpsi->ptCursor.x - pgp->HotSpot.x;
|
||||||
|
pt.y = gpsi->ptCursor.y - pgp->HotSpot.y;
|
||||||
|
|
||||||
|
|
||||||
|
if (pgp->SaveSurface != NULL)
|
||||||
|
{
|
||||||
|
RECTL DestRect;
|
||||||
|
POINTL SrcPoint;
|
||||||
|
SURFOBJ *SaveSurface;
|
||||||
|
SURFOBJ *MaskSurface;
|
||||||
|
|
||||||
pgp->Enabled = FALSE;
|
DestRect.left = max(pt.x, 0);
|
||||||
|
DestRect.top = max(pt.y, 0);
|
||||||
|
DestRect.right = min(
|
||||||
|
pt.x + pgp->Size.cx,
|
||||||
|
psoDest->sizlBitmap.cx);
|
||||||
|
DestRect.bottom = min(
|
||||||
|
pt.y + pgp->Size.cy,
|
||||||
|
psoDest->sizlBitmap.cy);
|
||||||
|
|
||||||
/*
|
SrcPoint.x = max(-pt.x, 0);
|
||||||
* The mouse is hide from ShowCours and it is frist ??
|
SrcPoint.y = max(-pt.y, 0);
|
||||||
*/
|
|
||||||
if (pgp->ShowPointer < 0)
|
|
||||||
{
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ((SaveSurface = EngLockSurface(pgp->SaveSurface)))
|
||||||
/*
|
|
||||||
* Hide the cours
|
|
||||||
*/
|
|
||||||
pt.x = gpsi->ptCursor.x - pgp->HotSpot.x;
|
|
||||||
pt.y = gpsi->ptCursor.y - pgp->HotSpot.y;
|
|
||||||
|
|
||||||
|
|
||||||
if (pgp->SaveSurface != NULL)
|
|
||||||
{
|
|
||||||
RECTL DestRect;
|
|
||||||
POINTL SrcPoint;
|
|
||||||
SURFOBJ *SaveSurface;
|
|
||||||
SURFOBJ *MaskSurface;
|
|
||||||
|
|
||||||
DestRect.left = max(pt.x, 0);
|
|
||||||
DestRect.top = max(pt.y, 0);
|
|
||||||
DestRect.right = min(
|
|
||||||
pt.x + pgp->Size.cx,
|
|
||||||
psoDest->sizlBitmap.cx);
|
|
||||||
DestRect.bottom = min(
|
|
||||||
pt.y + pgp->Size.cy,
|
|
||||||
psoDest->sizlBitmap.cy);
|
|
||||||
|
|
||||||
SrcPoint.x = max(-pt.x, 0);
|
|
||||||
SrcPoint.y = max(-pt.y, 0);
|
|
||||||
|
|
||||||
if((SaveSurface = EngLockSurface(pgp->SaveSurface)))
|
|
||||||
{
|
|
||||||
if((MaskSurface = EngLockSurface(pgp->MaskSurface)))
|
|
||||||
{
|
{
|
||||||
IntEngBitBltEx(psoDest, SaveSurface, MaskSurface, NULL, NULL,
|
if ((MaskSurface = EngLockSurface(pgp->MaskSurface)))
|
||||||
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL,
|
{
|
||||||
ROP3_TO_ROP4(SRCCOPY), FALSE);
|
IntEngBitBltEx(psoDest, SaveSurface, MaskSurface, NULL, NULL,
|
||||||
EngUnlockSurface(MaskSurface);
|
&DestRect, &SrcPoint, &SrcPoint, NULL, NULL,
|
||||||
|
ROP3_TO_ROP4(SRCCOPY), FALSE);
|
||||||
|
EngUnlockSurface(MaskSurface);
|
||||||
|
}
|
||||||
|
EngUnlockSurface(SaveSurface);
|
||||||
}
|
}
|
||||||
EngUnlockSurface(SaveSurface);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID INTERNAL_CALL
|
VOID INTERNAL_CALL
|
||||||
IntShowMousePointer(PDEVOBJ *ppdev, SURFOBJ *psoDest)
|
IntShowMousePointer(PDEVOBJ *ppdev, SURFOBJ *psoDest)
|
||||||
{
|
{
|
||||||
GDIPOINTER *pgp;
|
GDIPOINTER *pgp;
|
||||||
SURFOBJ *SaveSurface;
|
SURFOBJ *SaveSurface;
|
||||||
POINTL pt;
|
POINTL pt;
|
||||||
|
|
||||||
ASSERT(ppdev);
|
ASSERT(ppdev);
|
||||||
ASSERT(psoDest);
|
ASSERT(psoDest);
|
||||||
|
|
||||||
pgp = &ppdev->Pointer;
|
pgp = &ppdev->Pointer;
|
||||||
|
|
||||||
if (pgp->Enabled)
|
if (pgp->Enabled)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pgp->Enabled = TRUE;
|
pgp->Enabled = TRUE;
|
||||||
|
|
||||||
/*
|
/* Do not blt the mouse if it in hide */
|
||||||
* Do not blt the mouse if it in hide
|
if (pgp->ShowPointer < 0)
|
||||||
*/
|
{
|
||||||
if (pgp->ShowPointer < 0)
|
return ;
|
||||||
{
|
}
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
pt.x = gpsi->ptCursor.x - pgp->HotSpot.x;
|
pt.x = gpsi->ptCursor.x - pgp->HotSpot.x;
|
||||||
pt.y = gpsi->ptCursor.y - pgp->HotSpot.y;
|
pt.y = gpsi->ptCursor.y - pgp->HotSpot.y;
|
||||||
|
|
||||||
/*
|
/* Copy the pixels under the cursor to temporary surface. */
|
||||||
* Copy the pixels under the cursor to temporary surface.
|
if (pgp->SaveSurface != NULL &&
|
||||||
*/
|
(SaveSurface = EngLockSurface(pgp->SaveSurface)))
|
||||||
|
{
|
||||||
|
RECTL DestRect;
|
||||||
|
POINTL SrcPoint;
|
||||||
|
|
||||||
if (pgp->SaveSurface != NULL &&
|
SrcPoint.x = max(pt.x, 0);
|
||||||
(SaveSurface = EngLockSurface(pgp->SaveSurface)))
|
SrcPoint.y = max(pt.y, 0);
|
||||||
{
|
|
||||||
RECTL DestRect;
|
|
||||||
POINTL SrcPoint;
|
|
||||||
|
|
||||||
SrcPoint.x = max(pt.x, 0);
|
DestRect.left = SrcPoint.x - pt.x;
|
||||||
SrcPoint.y = max(pt.y, 0);
|
DestRect.top = SrcPoint.y - pt.y;
|
||||||
|
DestRect.right = min(
|
||||||
|
pgp->Size.cx,
|
||||||
|
psoDest->sizlBitmap.cx - pt.x);
|
||||||
|
DestRect.bottom = min(
|
||||||
|
pgp->Size.cy,
|
||||||
|
psoDest->sizlBitmap.cy - pt.y);
|
||||||
|
|
||||||
DestRect.left = SrcPoint.x - pt.x;
|
IntEngBitBltEx(SaveSurface, psoDest, NULL, NULL, NULL,
|
||||||
DestRect.top = SrcPoint.y - pt.y;
|
&DestRect, &SrcPoint, NULL, NULL, NULL,
|
||||||
DestRect.right = min(
|
ROP3_TO_ROP4(SRCCOPY), FALSE);
|
||||||
pgp->Size.cx,
|
EngUnlockSurface(SaveSurface);
|
||||||
psoDest->sizlBitmap.cx - pt.x);
|
}
|
||||||
DestRect.bottom = min(
|
|
||||||
pgp->Size.cy,
|
|
||||||
psoDest->sizlBitmap.cy - pt.y);
|
|
||||||
|
|
||||||
IntEngBitBltEx(SaveSurface, psoDest, NULL, NULL, NULL,
|
|
||||||
&DestRect, &SrcPoint, NULL, NULL, NULL,
|
|
||||||
ROP3_TO_ROP4(SRCCOPY), FALSE);
|
|
||||||
EngUnlockSurface(SaveSurface);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Blit the cursor on the screen. */
|
||||||
* Blit the cursor on the screen.
|
{
|
||||||
*/
|
RECTL DestRect;
|
||||||
|
POINTL SrcPoint;
|
||||||
|
SURFOBJ *psoColor;
|
||||||
|
SURFOBJ *psoMask = NULL;
|
||||||
|
|
||||||
{
|
DestRect.left = max(pt.x, 0);
|
||||||
RECTL DestRect;
|
DestRect.top = max(pt.y, 0);
|
||||||
POINTL SrcPoint;
|
DestRect.right = min(
|
||||||
SURFOBJ *psoColor;
|
pt.x + pgp->Size.cx,
|
||||||
SURFOBJ *psoMask = NULL;
|
psoDest->sizlBitmap.cx);
|
||||||
|
DestRect.bottom = min(
|
||||||
|
pt.y + pgp->Size.cy,
|
||||||
|
psoDest->sizlBitmap.cy);
|
||||||
|
|
||||||
DestRect.left = max(pt.x, 0);
|
SrcPoint.x = max(-pt.x, 0);
|
||||||
DestRect.top = max(pt.y, 0);
|
SrcPoint.y = max(-pt.y, 0);
|
||||||
DestRect.right = min(
|
|
||||||
pt.x + pgp->Size.cx,
|
|
||||||
psoDest->sizlBitmap.cx);
|
|
||||||
DestRect.bottom = min(
|
|
||||||
pt.y + pgp->Size.cy,
|
|
||||||
psoDest->sizlBitmap.cy);
|
|
||||||
|
|
||||||
SrcPoint.x = max(-pt.x, 0);
|
if (pgp->MaskSurface)
|
||||||
SrcPoint.y = max(-pt.y, 0);
|
psoMask = EngLockSurface(pgp->MaskSurface);
|
||||||
|
|
||||||
|
if (psoMask != NULL)
|
||||||
if (pgp->MaskSurface)
|
|
||||||
psoMask = EngLockSurface(pgp->MaskSurface);
|
|
||||||
|
|
||||||
if (psoMask != NULL)
|
|
||||||
{
|
|
||||||
if (pgp->ColorSurface != NULL)
|
|
||||||
{
|
{
|
||||||
if((psoColor = EngLockSurface(pgp->ColorSurface)))
|
if (pgp->ColorSurface != NULL)
|
||||||
{
|
{
|
||||||
IntEngBitBltEx(psoDest, psoColor, psoMask, NULL,
|
if ((psoColor = EngLockSurface(pgp->ColorSurface)))
|
||||||
pgp->XlateObject, &DestRect, &SrcPoint, &SrcPoint,
|
{
|
||||||
NULL, NULL, R4_MASK, FALSE);
|
IntEngBitBltEx(psoDest, psoColor, psoMask, NULL,
|
||||||
EngUnlockSurface(psoColor);
|
pgp->XlateObject, &DestRect, &SrcPoint, &SrcPoint,
|
||||||
}
|
NULL, NULL, R4_MASK, FALSE);
|
||||||
|
EngUnlockSurface(psoColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IntEngBitBltEx(psoDest, psoMask, NULL, NULL, pgp->XlateObject,
|
||||||
|
&DestRect, &SrcPoint, NULL, NULL, NULL,
|
||||||
|
ROP3_TO_ROP4(SRCAND), FALSE);
|
||||||
|
SrcPoint.y += pgp->Size.cy;
|
||||||
|
IntEngBitBltEx(psoDest, psoMask, NULL, NULL, pgp->XlateObject,
|
||||||
|
&DestRect, &SrcPoint, NULL, NULL, NULL,
|
||||||
|
ROP3_TO_ROP4(SRCINVERT), FALSE);
|
||||||
|
}
|
||||||
|
EngUnlockSurface(psoMask);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
IntEngBitBltEx(psoDest, psoMask, NULL, NULL, pgp->XlateObject,
|
|
||||||
&DestRect, &SrcPoint, NULL, NULL, NULL,
|
|
||||||
ROP3_TO_ROP4(SRCAND), FALSE);
|
|
||||||
SrcPoint.y += pgp->Size.cy;
|
|
||||||
IntEngBitBltEx(psoDest, psoMask, NULL, NULL, pgp->XlateObject,
|
|
||||||
&DestRect, &SrcPoint, NULL, NULL, NULL,
|
|
||||||
ROP3_TO_ROP4(SRCINVERT), FALSE);
|
|
||||||
}
|
|
||||||
EngUnlockSurface(psoMask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ULONG APIENTRY
|
ULONG APIENTRY
|
||||||
EngSetPointerShape(
|
EngSetPointerShape(
|
||||||
IN SURFOBJ *pso,
|
IN SURFOBJ *pso,
|
||||||
IN SURFOBJ *psoMask,
|
IN SURFOBJ *psoMask,
|
||||||
IN SURFOBJ *psoColor,
|
IN SURFOBJ *psoColor,
|
||||||
IN XLATEOBJ *pxlo,
|
IN XLATEOBJ *pxlo,
|
||||||
IN LONG xHot,
|
IN LONG xHot,
|
||||||
IN LONG yHot,
|
IN LONG yHot,
|
||||||
IN LONG x,
|
IN LONG x,
|
||||||
IN LONG y,
|
IN LONG y,
|
||||||
IN RECTL *prcl,
|
IN RECTL *prcl,
|
||||||
IN FLONG fl)
|
IN FLONG fl)
|
||||||
{
|
{
|
||||||
PDEVOBJ *ppdev;
|
PDEVOBJ *ppdev;
|
||||||
SURFOBJ *psoTemp;
|
SURFOBJ *psoTemp;
|
||||||
GDIPOINTER *pgp;
|
GDIPOINTER *pgp;
|
||||||
|
|
||||||
ASSERT(pso);
|
ASSERT(pso);
|
||||||
|
|
||||||
ppdev = GDIDEV(pso);
|
ppdev = GDIDEV(pso);
|
||||||
pgp = &ppdev->Pointer;
|
pgp = &ppdev->Pointer;
|
||||||
|
|
||||||
IntHideMousePointer(ppdev, pso);
|
IntHideMousePointer(ppdev, pso);
|
||||||
|
|
||||||
if (pgp->ColorSurface != NULL)
|
if (pgp->ColorSurface != NULL)
|
||||||
{
|
{
|
||||||
/* FIXME: Is this really needed? */
|
/* FIXME: Is this really needed? */
|
||||||
if((psoTemp = EngLockSurface(pgp->ColorSurface)))
|
if ((psoTemp = EngLockSurface(pgp->ColorSurface)))
|
||||||
{
|
{
|
||||||
EngFreeMem(psoTemp->pvBits);
|
EngFreeMem(psoTemp->pvBits);
|
||||||
psoTemp->pvBits = 0;
|
psoTemp->pvBits = 0;
|
||||||
EngUnlockSurface(psoTemp);
|
EngUnlockSurface(psoTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
EngDeleteSurface(pgp->ColorSurface);
|
EngDeleteSurface(pgp->ColorSurface);
|
||||||
pgp->MaskSurface = NULL;
|
pgp->MaskSurface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgp->MaskSurface != NULL)
|
if (pgp->MaskSurface != NULL)
|
||||||
{
|
{
|
||||||
/* FIXME: Is this really needed? */
|
/* FIXME: Is this really needed? */
|
||||||
if((psoTemp = EngLockSurface(pgp->MaskSurface)))
|
if ((psoTemp = EngLockSurface(pgp->MaskSurface)))
|
||||||
{
|
{
|
||||||
EngFreeMem(psoTemp->pvBits);
|
EngFreeMem(psoTemp->pvBits);
|
||||||
psoTemp->pvBits = 0;
|
psoTemp->pvBits = 0;
|
||||||
EngUnlockSurface(psoTemp);
|
EngUnlockSurface(psoTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
EngDeleteSurface(pgp->MaskSurface);
|
EngDeleteSurface(pgp->MaskSurface);
|
||||||
pgp->MaskSurface = NULL;
|
pgp->MaskSurface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgp->SaveSurface != NULL)
|
if (pgp->SaveSurface != NULL)
|
||||||
{
|
{
|
||||||
EngDeleteSurface(pgp->SaveSurface);
|
EngDeleteSurface(pgp->SaveSurface);
|
||||||
pgp->SaveSurface = NULL;
|
pgp->SaveSurface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgp->XlateObject != NULL)
|
if (pgp->XlateObject != NULL)
|
||||||
{
|
{
|
||||||
EngDeleteXlate(pgp->XlateObject);
|
EngDeleteXlate(pgp->XlateObject);
|
||||||
pgp->XlateObject = NULL;
|
pgp->XlateObject = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* See if we are being asked to hide the pointer. */
|
||||||
* See if we are being asked to hide the pointer.
|
if (psoMask == NULL)
|
||||||
*/
|
{
|
||||||
|
return SPS_ACCEPT_NOEXCLUDE;
|
||||||
|
}
|
||||||
|
|
||||||
if (psoMask == NULL)
|
pgp->HotSpot.x = xHot;
|
||||||
{
|
pgp->HotSpot.y = yHot;
|
||||||
return SPS_ACCEPT_NOEXCLUDE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pgp->HotSpot.x = xHot;
|
/* Actually this should be set by 'the other side', but it would be
|
||||||
pgp->HotSpot.y = yHot;
|
* done right after this. It helps IntShowMousePointer. */
|
||||||
|
if (x != -1)
|
||||||
|
{
|
||||||
|
gpsi->ptCursor.x = x;
|
||||||
|
gpsi->ptCursor.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
/* Actually this should be set by 'the other side', but it would be
|
pgp->Size.cx = abs(psoMask->lDelta) << 3;
|
||||||
* done right after this. It helps IntShowMousePointer. */
|
pgp->Size.cy = (psoMask->cjBits / abs(psoMask->lDelta)) >> 1;
|
||||||
if (x != -1)
|
|
||||||
{
|
|
||||||
gpsi->ptCursor.x = x;
|
|
||||||
gpsi->ptCursor.y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
pgp->Size.cx = abs(psoMask->lDelta) << 3;
|
if (psoColor != NULL)
|
||||||
pgp->Size.cy = (psoMask->cjBits / abs(psoMask->lDelta)) >> 1;
|
{
|
||||||
|
PBYTE Bits;
|
||||||
|
|
||||||
if (psoColor != NULL)
|
Bits = EngAllocMem(0, psoColor->cjBits, TAG_MOUSE);
|
||||||
{
|
if (Bits == NULL)
|
||||||
PBYTE Bits;
|
{
|
||||||
|
return SPS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
Bits = EngAllocMem(0, psoColor->cjBits, TAG_MOUSE);
|
memcpy(Bits, psoColor->pvBits, psoColor->cjBits);
|
||||||
if (Bits == NULL)
|
|
||||||
{
|
|
||||||
return SPS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(Bits, psoColor->pvBits, psoColor->cjBits);
|
pgp->ColorSurface = (HSURF)EngCreateBitmap(pgp->Size,
|
||||||
|
psoColor->lDelta, psoColor->iBitmapFormat,
|
||||||
|
psoColor->lDelta < 0 ? 0 : BMF_TOPDOWN, Bits);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pgp->ColorSurface = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
pgp->ColorSurface = (HSURF)EngCreateBitmap(pgp->Size,
|
{
|
||||||
psoColor->lDelta, psoColor->iBitmapFormat,
|
SIZEL Size;
|
||||||
psoColor->lDelta < 0 ? 0 : BMF_TOPDOWN, Bits);
|
PBYTE Bits;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pgp->ColorSurface = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
Size.cx = pgp->Size.cx;
|
||||||
SIZEL Size;
|
Size.cy = pgp->Size.cy << 1;
|
||||||
PBYTE Bits;
|
Bits = EngAllocMem(0, psoMask->cjBits, TAG_MOUSE);
|
||||||
|
if (Bits == NULL)
|
||||||
|
{
|
||||||
|
return SPS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
Size.cx = pgp->Size.cx;
|
memcpy(Bits, psoMask->pvBits, psoMask->cjBits);
|
||||||
Size.cy = pgp->Size.cy << 1;
|
|
||||||
Bits = EngAllocMem(0, psoMask->cjBits, TAG_MOUSE);
|
|
||||||
if (Bits == NULL)
|
|
||||||
{
|
|
||||||
return SPS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(Bits, psoMask->pvBits, psoMask->cjBits);
|
pgp->MaskSurface = (HSURF)EngCreateBitmap(Size,
|
||||||
|
psoMask->lDelta, psoMask->iBitmapFormat,
|
||||||
|
psoMask->lDelta < 0 ? 0 : BMF_TOPDOWN, Bits);
|
||||||
|
}
|
||||||
|
|
||||||
pgp->MaskSurface = (HSURF)EngCreateBitmap(Size,
|
/* Create an XLATEOBJ that will be used for drawing masks.
|
||||||
psoMask->lDelta, psoMask->iBitmapFormat,
|
* FIXME: We should get this in pxlo parameter! */
|
||||||
psoMask->lDelta < 0 ? 0 : BMF_TOPDOWN, Bits);
|
if (pxlo == NULL)
|
||||||
}
|
{
|
||||||
|
HPALETTE BWPalette, DestPalette;
|
||||||
|
ULONG BWColors[] = {0, 0xFFFFFF};
|
||||||
|
|
||||||
/*
|
BWPalette = EngCreatePalette(PAL_INDEXED, sizeof(BWColors) / sizeof(ULONG),
|
||||||
* Create an XLATEOBJ that will be used for drawing masks.
|
BWColors, 0, 0, 0);
|
||||||
* FIXME: We should get this in pxlo parameter!
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (pxlo == NULL)
|
DestPalette = ppdev->DevInfo.hpalDefault;
|
||||||
{
|
pgp->XlateObject = IntEngCreateXlate(0, PAL_INDEXED,
|
||||||
HPALETTE BWPalette, DestPalette;
|
DestPalette, BWPalette);
|
||||||
ULONG BWColors[] = {0, 0xFFFFFF};
|
EngDeletePalette(BWPalette);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pgp->XlateObject = pxlo;
|
||||||
|
}
|
||||||
|
|
||||||
BWPalette = EngCreatePalette(PAL_INDEXED, sizeof(BWColors) / sizeof(ULONG),
|
/* Create surface for saving the pixels under the cursor. */
|
||||||
BWColors, 0, 0, 0);
|
{
|
||||||
|
LONG lDelta;
|
||||||
|
|
||||||
DestPalette = ppdev->DevInfo.hpalDefault;
|
switch (pso->iBitmapFormat)
|
||||||
pgp->XlateObject = IntEngCreateXlate(0, PAL_INDEXED,
|
{
|
||||||
DestPalette, BWPalette);
|
case BMF_1BPP:
|
||||||
EngDeletePalette(BWPalette);
|
lDelta = pgp->Size.cx >> 3;
|
||||||
}
|
break;
|
||||||
else
|
case BMF_4BPP:
|
||||||
{
|
lDelta = pgp->Size.cx >> 1;
|
||||||
pgp->XlateObject = pxlo;
|
break;
|
||||||
}
|
case BMF_8BPP:
|
||||||
|
lDelta = pgp->Size.cx;
|
||||||
|
break;
|
||||||
|
case BMF_16BPP:
|
||||||
|
lDelta = pgp->Size.cx << 1;
|
||||||
|
break;
|
||||||
|
case BMF_24BPP:
|
||||||
|
lDelta = pgp->Size.cx * 3;
|
||||||
|
break;
|
||||||
|
case BMF_32BPP:
|
||||||
|
lDelta = pgp->Size.cx << 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
lDelta = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
pgp->SaveSurface = (HSURF)EngCreateBitmap(pgp->Size,
|
||||||
* Create surface for saving the pixels under the cursor.
|
lDelta,
|
||||||
*/
|
pso->iBitmapFormat,
|
||||||
|
BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
if (x != -1)
|
||||||
LONG lDelta;
|
{
|
||||||
|
IntShowMousePointer(ppdev, pso);
|
||||||
|
|
||||||
switch (pso->iBitmapFormat)
|
if (prcl != NULL)
|
||||||
{
|
{
|
||||||
case BMF_1BPP:
|
prcl->left = x - pgp->HotSpot.x;
|
||||||
lDelta = pgp->Size.cx >> 3;
|
prcl->top = y - pgp->HotSpot.x;
|
||||||
break;
|
prcl->right = prcl->left + pgp->Size.cx;
|
||||||
case BMF_4BPP:
|
prcl->bottom = prcl->top + pgp->Size.cy;
|
||||||
lDelta = pgp->Size.cx >> 1;
|
}
|
||||||
break;
|
} else if (prcl != NULL)
|
||||||
case BMF_8BPP:
|
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
|
||||||
lDelta = pgp->Size.cx;
|
|
||||||
break;
|
|
||||||
case BMF_16BPP:
|
|
||||||
lDelta = pgp->Size.cx << 1;
|
|
||||||
break;
|
|
||||||
case BMF_24BPP:
|
|
||||||
lDelta = pgp->Size.cx * 3;
|
|
||||||
break;
|
|
||||||
case BMF_32BPP:
|
|
||||||
lDelta = pgp->Size.cx << 2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
lDelta = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pgp->SaveSurface = (HSURF)EngCreateBitmap(
|
return SPS_ACCEPT_EXCLUDE;
|
||||||
pgp->Size, lDelta, pso->iBitmapFormat, BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(x != -1)
|
|
||||||
{
|
|
||||||
IntShowMousePointer(ppdev, pso);
|
|
||||||
|
|
||||||
if (prcl != NULL)
|
|
||||||
{
|
|
||||||
prcl->left = x - pgp->HotSpot.x;
|
|
||||||
prcl->top = y - pgp->HotSpot.x;
|
|
||||||
prcl->right = prcl->left + pgp->Size.cx;
|
|
||||||
prcl->bottom = prcl->top + pgp->Size.cy;
|
|
||||||
}
|
|
||||||
} else if (prcl != NULL)
|
|
||||||
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
|
|
||||||
|
|
||||||
return SPS_ACCEPT_EXCLUDE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -531,61 +498,61 @@ EngSetPointerShape(
|
||||||
|
|
||||||
VOID APIENTRY
|
VOID APIENTRY
|
||||||
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)
|
||||||
{
|
{
|
||||||
PDEVOBJ *ppdev;
|
PDEVOBJ *ppdev;
|
||||||
GDIPOINTER *pgp;
|
GDIPOINTER *pgp;
|
||||||
|
|
||||||
ASSERT(pso);
|
ASSERT(pso);
|
||||||
|
|
||||||
ppdev = GDIDEV(pso);
|
ppdev = GDIDEV(pso);
|
||||||
|
|
||||||
ASSERT(ppdev);
|
ASSERT(ppdev);
|
||||||
|
|
||||||
pgp = &ppdev->Pointer;
|
pgp = &ppdev->Pointer;
|
||||||
|
|
||||||
IntHideMousePointer(ppdev, pso);
|
IntHideMousePointer(ppdev, pso);
|
||||||
if (x != -1)
|
if (x != -1)
|
||||||
{
|
{
|
||||||
/* Actually this should be set by 'the other side', but it would be
|
/* Actually this should be set by 'the other side', but it would be
|
||||||
* done right after this. It helps IntShowMousePointer. */
|
* done right after this. It helps IntShowMousePointer. */
|
||||||
gpsi->ptCursor.x = x;
|
gpsi->ptCursor.x = x;
|
||||||
gpsi->ptCursor.y = y;
|
gpsi->ptCursor.y = y;
|
||||||
IntShowMousePointer(ppdev, pso);
|
IntShowMousePointer(ppdev, pso);
|
||||||
if (prcl != NULL)
|
if (prcl != NULL)
|
||||||
{
|
{
|
||||||
prcl->left = x - pgp->HotSpot.x;
|
prcl->left = x - pgp->HotSpot.x;
|
||||||
prcl->top = y - pgp->HotSpot.x;
|
prcl->top = y - pgp->HotSpot.x;
|
||||||
prcl->right = prcl->left + pgp->Size.cx;
|
prcl->right = prcl->left + pgp->Size.cx;
|
||||||
prcl->bottom = prcl->top + pgp->Size.cy;
|
prcl->bottom = prcl->top + pgp->Size.cy;
|
||||||
}
|
}
|
||||||
} else if (prcl != NULL)
|
} else if (prcl != NULL)
|
||||||
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
|
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID APIENTRY
|
VOID APIENTRY
|
||||||
IntEngMovePointer(
|
IntEngMovePointer(
|
||||||
IN SURFOBJ *pso,
|
IN SURFOBJ *pso,
|
||||||
IN LONG x,
|
IN LONG x,
|
||||||
IN LONG y,
|
IN LONG y,
|
||||||
IN RECTL *prcl)
|
IN RECTL *prcl)
|
||||||
{
|
{
|
||||||
SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
|
SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
|
||||||
|
|
||||||
SURFACE_LockBitmapBits(psurf);
|
SURFACE_LockBitmapBits(psurf);
|
||||||
if (GDIDEV(pso)->Pointer.MovePointer)
|
if (GDIDEV(pso)->Pointer.MovePointer)
|
||||||
{
|
{
|
||||||
GDIDEV(pso)->Pointer.MovePointer(pso, x, y, prcl);
|
GDIDEV(pso)->Pointer.MovePointer(pso, x, y, prcl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EngMovePointer(pso, x, y, prcl);
|
EngMovePointer(pso, x, y, prcl);
|
||||||
}
|
}
|
||||||
SURFACE_UnlockBitmapBits(psurf);
|
SURFACE_UnlockBitmapBits(psurf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue