Let the mouse cursor go where it hasn't gone before: right and lower edge

of the screen

svn path=/trunk/; revision=6032
This commit is contained in:
Gé van Geldorp 2003-09-10 07:24:31 +00:00
parent 413af2c984
commit 8636ea85a9
2 changed files with 29 additions and 28 deletions

View file

@ -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: pointer.c,v 1.14 2003/03/11 00:21:40 gvg Exp $ /* $Id: pointer.c,v 1.15 2003/09/10 07:24:31 gvg Exp $
* *
* PROJECT: ReactOS VGA16 display driver * PROJECT: ReactOS VGA16 display driver
* FILE: drivers/dd/vga/display/objects/pointer.c * FILE: drivers/dd/vga/display/objects/pointer.c
@ -39,13 +39,12 @@ VOID VGADDI_ShowCursor(PPDEV ppdev);
VOID VOID
VGADDI_BltPointerToVGA(ULONG StartX, ULONG StartY, ULONG SizeX, VGADDI_BltPointerToVGA(ULONG StartX, ULONG StartY, ULONG SizeX,
ULONG SizeY, PUCHAR MaskBits, ULONG MaskOp) ULONG SizeY, PUCHAR MaskBits, ULONG MaskPitch, ULONG MaskOp)
{ {
ULONG EndX, EndY; ULONG EndX, EndY;
UCHAR Mask; UCHAR Mask;
PUCHAR Video; PUCHAR Video;
PUCHAR Src; PUCHAR Src;
ULONG MaskPitch;
UCHAR SrcValue; UCHAR SrcValue;
ULONG i, j; ULONG i, j;
ULONG Left; ULONG Left;
@ -53,7 +52,6 @@ VGADDI_BltPointerToVGA(ULONG StartX, ULONG StartY, ULONG SizeX,
EndX = StartX + SizeX; EndX = StartX + SizeX;
EndY = StartY + SizeY; EndY = StartY + SizeY;
MaskPitch = SizeX >> 3;
/* Set write mode zero. */ /* Set write mode zero. */
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 5); WRITE_PORT_UCHAR((PUCHAR)GRA_I, 5);
@ -289,16 +287,17 @@ VOID
VGADDI_HideCursor(PPDEV ppdev) VGADDI_HideCursor(PPDEV ppdev)
{ {
ULONG i, j, cx, cy, bitpos; ULONG i, j, cx, cy, bitpos;
ULONG SizeX; ULONG SizeX, SizeY;
/* Display what was behind cursor */ /* Display what was behind cursor */
SizeX = ((oldx + ppdev->pPointerAttributes->Width) + 7) & ~0x7; SizeX = min(((oldx + ppdev->pPointerAttributes->Width) + 7) & ~0x7, ppdev->sizeSurf.cx);
SizeX -= (oldx & ~0x7); SizeX -= (oldx & ~0x7);
SizeY = min(ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - oldy);
VGADDI_BltFromSavedScreenBits(oldx & ~0x7, VGADDI_BltFromSavedScreenBits(oldx & ~0x7,
oldy, oldy,
ImageBehindCursor, ImageBehindCursor,
SizeX, SizeX,
ppdev->pPointerAttributes->Height); SizeY);
ppdev->pPointerAttributes->Enable = 0; ppdev->pPointerAttributes->Enable = 0;
} }
@ -307,8 +306,8 @@ VOID
VGADDI_ShowCursor(PPDEV ppdev) VGADDI_ShowCursor(PPDEV ppdev)
{ {
ULONG i, j, cx, cy; ULONG i, j, cx, cy;
PUCHAR XorMask; PUCHAR AndMask, XorMask;
ULONG SizeX; ULONG SizeX, SizeY;
if (ppdev->pPointerAttributes->Enable != 0) if (ppdev->pPointerAttributes->Enable != 0)
{ {
@ -320,30 +319,37 @@ VGADDI_ShowCursor(PPDEV ppdev)
cy = ppdev->xyCursor.y; cy = ppdev->xyCursor.y;
/* Used to repaint background */ /* Used to repaint background */
SizeX = ((cx + ppdev->pPointerAttributes->Width) + 7) & ~0x7; SizeX = min(((cx + ppdev->pPointerAttributes->Width) + 7) & ~0x7, ppdev->sizeSurf.cx);
SizeX -= (cx & ~0x7); SizeX -= (cx & ~0x7);
SizeY = min(ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - cy);
VGADDI_BltToSavedScreenBits(ImageBehindCursor, VGADDI_BltToSavedScreenBits(ImageBehindCursor,
cx & ~0x7, cx & ~0x7,
cy, cy,
SizeX, SizeX,
ppdev->pPointerAttributes->Height); SizeY);
/* Display the cursor. */ /* Display the cursor. */
XorMask = ppdev->pPointerAttributes->Pixels + SizeX = min(ppdev->pPointerAttributes->Width, ppdev->sizeSurf.cx - ppdev->xyCursor.x);
SizeY = min(ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - ppdev->xyCursor.y);
AndMask = ppdev->pPointerAttributes->Pixels +
(ppdev->pPointerAttributes->Height - SizeY) * ppdev->pPointerAttributes->WidthInBytes;
VGADDI_BltPointerToVGA(ppdev->xyCursor.x,
ppdev->xyCursor.y,
SizeX,
SizeY,
AndMask,
ppdev->pPointerAttributes->WidthInBytes,
VGA_AND);
XorMask = AndMask +
ppdev->pPointerAttributes->WidthInBytes * ppdev->pPointerAttributes->WidthInBytes *
ppdev->pPointerAttributes->Height; ppdev->pPointerAttributes->Height;
VGADDI_BltPointerToVGA(ppdev->xyCursor.x, VGADDI_BltPointerToVGA(ppdev->xyCursor.x,
ppdev->xyCursor.y, ppdev->xyCursor.y,
ppdev->pPointerAttributes->Width, SizeX,
ppdev->pPointerAttributes->Height, SizeY,
ppdev->pPointerAttributes->Pixels,
VGA_AND);
VGADDI_BltPointerToVGA(ppdev->xyCursor.x,
ppdev->xyCursor.y,
ppdev->pPointerAttributes->Width,
ppdev->pPointerAttributes->Height,
XorMask, XorMask,
ppdev->pPointerAttributes->WidthInBytes,
VGA_XOR); VGA_XOR);
/* Save the new cursor location. */ /* Save the new cursor location. */

View file

@ -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.40 2003/08/29 19:17:31 weiden Exp $ /* $Id: mouse.c,v 1.41 2003/09/10 07:24:31 gvg Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* PURPOSE: Mouse * PURPOSE: Mouse
@ -437,8 +437,8 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
CurInfo->x = max(CurInfo->x, 0); CurInfo->x = max(CurInfo->x, 0);
CurInfo->y = max(CurInfo->y, 0); CurInfo->y = max(CurInfo->y, 0);
CurInfo->x = min(CurInfo->x, SurfObj->sizlBitmap.cx - 20); CurInfo->x = min(CurInfo->x, SurfObj->sizlBitmap.cx - 1);
CurInfo->y = min(CurInfo->y, SurfObj->sizlBitmap.cy - 20); CurInfo->y = min(CurInfo->y, SurfObj->sizlBitmap.cy - 1);
IntCheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo); IntCheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo);
@ -588,13 +588,8 @@ EnableMouse(HDC hDisplayDC)
DC_UnlockDc( hDisplayDC ); DC_UnlockDc( hDisplayDC );
/* Tell the display driver to set the pointer shape. */ /* Tell the display driver to set the pointer shape. */
#if 1
CurInfo->x = SurfObj->sizlBitmap.cx / 2; CurInfo->x = SurfObj->sizlBitmap.cx / 2;
CurInfo->y = SurfObj->sizlBitmap.cy / 2; CurInfo->y = SurfObj->sizlBitmap.cy / 2;
#else
CurInfo->x = 320;
CurInfo->y = 240;
#endif
/* Create the default mouse cursor. */ /* Create the default mouse cursor. */
MouseSize.cx = SysCursor->cx; MouseSize.cx = SysCursor->cx;