mirror of
https://github.com/reactos/reactos.git
synced 2024-09-09 04:10:19 +00:00
- Simplify IntSetCursor
- Make NtUserSetCursor hide Cursor on hCursor = NULL - Don't set the cursor pos if the cursor is hidden in IntMouseInput - remove 2 useless ASSERTs - Dereference old cursor- Make the screensaver lib hide the cursor directly after creating it (the window never recieves a WM_SETCURSOR) partly fixes bug 2965 See issue #2965 for more details. svn path=/trunk/; revision=32676
This commit is contained in:
parent
0d99c97ab4
commit
9457b015d6
|
@ -189,6 +189,7 @@ static int LaunchScreenSaver(HWND hParent)
|
|||
if (hMainWindow)
|
||||
{
|
||||
ShowWindow(hMainWindow, SW_SHOW);
|
||||
SetCursor(NULL);
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
DispatchMessage(&msg);
|
||||
|
|
|
@ -125,8 +125,7 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor,
|
|||
{
|
||||
return Ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(!(Screen = IntGetScreenDC()))
|
||||
{
|
||||
return (HCURSOR)0;
|
||||
|
@ -143,19 +142,20 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor,
|
|||
DC_UnlockDc(dc);
|
||||
|
||||
BitmapObj = BITMAPOBJ_LockBitmap(dcbmp);
|
||||
if ( !BitmapObj )
|
||||
if (!BitmapObj)
|
||||
return (HCURSOR)0;
|
||||
SurfObj = &BitmapObj->SurfObj;
|
||||
ASSERT(SurfObj);
|
||||
}
|
||||
|
||||
if (!NewCursor && (CurInfo->CurrentCursorObject || ForceChange))
|
||||
if (!NewCursor)
|
||||
{
|
||||
if (NULL != CurInfo->CurrentCursorObject)
|
||||
if (CurInfo->CurrentCursorObject || ForceChange)
|
||||
{
|
||||
if (CurInfo->CurrentCursorObject)
|
||||
{
|
||||
UserDereferenceObject(CurInfo->CurrentCursorObject);
|
||||
if (CurInfo->ShowingCursor)
|
||||
{
|
||||
DPRINT1("Removing pointer!\n");
|
||||
/* Remove the cursor if it was displayed */
|
||||
IntEngMovePointer(SurfObj, -1, -1, &GDIDEV(SurfObj)->Pointer.Exclude);
|
||||
}
|
||||
|
@ -165,19 +165,14 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor,
|
|||
|
||||
CurInfo->CurrentCursorObject = NewCursor; /* i.e. CurrentCursorObject = NULL */
|
||||
CurInfo->ShowingCursor = 0;
|
||||
BITMAPOBJ_UnlockBitmap(BitmapObj);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
if (!NewCursor)
|
||||
{
|
||||
BITMAPOBJ_UnlockBitmap(BitmapObj);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/* TODO: Fixme. Logic is screwed above */
|
||||
|
||||
ASSERT(NewCursor);
|
||||
MaskBmpObj = BITMAPOBJ_LockBitmap(NewCursor->IconInfo.hbmMask);
|
||||
if (MaskBmpObj)
|
||||
{
|
||||
|
@ -251,6 +246,12 @@ IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor,
|
|||
CurInfo->CurrentCursorObject = NULL;
|
||||
}
|
||||
|
||||
/* OldCursor is not in use anymore */
|
||||
if (OldCursor)
|
||||
{
|
||||
UserDereferenceObject(OldCursor);
|
||||
}
|
||||
|
||||
if (GDIDEVFUNCS(SurfObj).SetPointerShape)
|
||||
{
|
||||
GDIDEV(SurfObj)->Pointer.Status =
|
||||
|
@ -1107,15 +1108,25 @@ NtUserSetCursor(
|
|||
RETURN(NULL);
|
||||
}
|
||||
|
||||
if(hCursor)
|
||||
{
|
||||
if(!(CurIcon = UserGetCurIconObject(hCursor)))
|
||||
{
|
||||
ObDereferenceObject(WinSta);
|
||||
RETURN(NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CurIcon = NULL;
|
||||
}
|
||||
|
||||
OldCursor = IntSetCursor(WinSta, CurIcon, FALSE);
|
||||
|
||||
if(CurIcon)
|
||||
{
|
||||
UserDereferenceObject(CurIcon);
|
||||
}
|
||||
ObDereferenceObject(WinSta);
|
||||
|
||||
RETURN(OldCursor);
|
||||
|
|
|
@ -1096,7 +1096,10 @@ IntMouseInput(MOUSEINPUT *mi)
|
|||
{
|
||||
SurfObj = &BitmapObj->SurfObj;
|
||||
|
||||
if (CurInfo->ShowingCursor)
|
||||
{
|
||||
IntEngMovePointer(SurfObj, MousePos.x, MousePos.y, &(GDIDEV(SurfObj)->Pointer.Exclude));
|
||||
}
|
||||
/* Only now, update the info in the GDIDEVICE, so EngMovePointer can
|
||||
* use the old values to move the pointer image */
|
||||
GDIDEV(SurfObj)->Pointer.Pos.x = MousePos.x;
|
||||
|
|
Loading…
Reference in a new issue