Author: tkreuzer
Date: Thu Mar 13 19:05:58 2008
New Revision: 32676
URL:
http://svn.reactos.org/svn/reactos?rev=3D32676&view=3Drev
Log:
- Simplify IntSetCursor
- Make NtUserSetCursor hide Cursor on hCursor =3D 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.
Modified:
trunk/reactos/lib/sdk/scrnsave/scrnsave.c
trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
trunk/reactos/subsystems/win32/win32k/ntuser/input.c
Modified: trunk/reactos/lib/sdk/scrnsave/scrnsave.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/scrnsave/scrn=
save.c?rev=3D32676&r1=3D32675&r2=3D32676&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/lib/sdk/scrnsave/scrnsave.c (original)
+++ trunk/reactos/lib/sdk/scrnsave/scrnsave.c Thu Mar 13 19:05:58 2008
@@ -189,6 +189,7 @@
if (hMainWindow)
{
ShowWindow(hMainWindow, SW_SHOW);
+ SetCursor(NULL);
=
while (GetMessage(&msg, NULL, 0, 0))
DispatchMessage(&msg);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3=
2k/ntuser/cursoricon.c?rev=3D32676&r1=3D32675&r2=3D32676&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Thu Mar 13 19=
:05:58 2008
@@ -125,59 +125,54 @@
{
return Ret;
}
- else
- {
- if(!(Screen =3D IntGetScreenDC()))
- {
- return (HCURSOR)0;
- }
- /* FIXME use the desktop's HDC instead of using ScreenDeviceContext =
*/
- dc =3D DC_LockDc(Screen);
-
- if (!dc)
- {
- return Ret;
- }
- dcbmp =3D dc->w.hBitmap;
- DevInfo =3D (PDEVINFO)&((GDIDEVICE *)dc->pPDev)->DevInfo;
- DC_UnlockDc(dc);
-
- BitmapObj =3D BITMAPOBJ_LockBitmap(dcbmp);
- if ( !BitmapObj )
- return (HCURSOR)0;
- SurfObj =3D &BitmapObj->SurfObj;
- ASSERT(SurfObj);
- }
-
- if (!NewCursor && (CurInfo->CurrentCursorObject || ForceChange))
- {
- if (NULL !=3D CurInfo->CurrentCursorObject)
- {
- UserDereferenceObject(CurInfo->CurrentCursorObject);
- if (CurInfo->ShowingCursor)
+
+ if(!(Screen =3D IntGetScreenDC()))
+ {
+ return (HCURSOR)0;
+ }
+ /* FIXME use the desktop's HDC instead of using ScreenDeviceContext */
+ dc =3D DC_LockDc(Screen);
+
+ if (!dc)
+ {
+ return Ret;
+ }
+ dcbmp =3D dc->w.hBitmap;
+ DevInfo =3D (PDEVINFO)&((GDIDEVICE *)dc->pPDev)->DevInfo;
+ DC_UnlockDc(dc);
+
+ BitmapObj =3D BITMAPOBJ_LockBitmap(dcbmp);
+ if (!BitmapObj)
+ return (HCURSOR)0;
+ SurfObj =3D &BitmapObj->SurfObj;
+
+ if (!NewCursor)
+ {
+ if (CurInfo->CurrentCursorObject || ForceChange)
+ {
+ if (CurInfo->CurrentCursorObject)
{
- /* Remove the cursor if it was displayed */
- IntEngMovePointer(SurfObj, -1, -1, &GDIDEV(SurfObj)->Pointer.E=
xclude);
+ UserDereferenceObject(CurInfo->CurrentCursorObject);
+ if (CurInfo->ShowingCursor)
+ {
+ DPRINT1("Removing pointer!\n");
+ /* Remove the cursor if it was displayed */
+ IntEngMovePointer(SurfObj, -1, -1, &GDIDEV(SurfObj)->Pointe=
r.Exclude);
+ }
}
- }
-
- GDIDEV(SurfObj)->Pointer.Status =3D SPS_ACCEPT_NOEXCLUDE;
-
- CurInfo->CurrentCursorObject =3D NewCursor; /* i.e. CurrentCursorObj=
ect =3D NULL */
- CurInfo->ShowingCursor =3D 0;
+
+ GDIDEV(SurfObj)->Pointer.Status =3D SPS_ACCEPT_NOEXCLUDE;
+
+ CurInfo->CurrentCursorObject =3D NewCursor; /* i.e. CurrentCursor=
Object =3D NULL */
+ CurInfo->ShowingCursor =3D 0;
+ }
+
BITMAPOBJ_UnlockBitmap(BitmapObj);
return Ret;
}
=
- if (!NewCursor)
- {
- BITMAPOBJ_UnlockBitmap(BitmapObj);
- return Ret;
- }
-
/* TODO: Fixme. Logic is screwed above */
=
- ASSERT(NewCursor);
MaskBmpObj =3D BITMAPOBJ_LockBitmap(NewCursor->IconInfo.hbmMask);
if (MaskBmpObj)
{
@@ -249,6 +244,12 @@
{
CurInfo->ShowingCursor =3D 0;
CurInfo->CurrentCursorObject =3D NULL;
+ }
+
+ /* OldCursor is not in use anymore */
+ if (OldCursor)
+ {
+ UserDereferenceObject(OldCursor);
}
=
if (GDIDEVFUNCS(SurfObj).SetPointerShape)
@@ -1107,15 +1108,25 @@
RETURN(NULL);
}
=
- if(!(CurIcon =3D UserGetCurIconObject(hCursor)))
- {
- ObDereferenceObject(WinSta);
- RETURN(NULL);
+ if(hCursor)
+ {
+ if(!(CurIcon =3D UserGetCurIconObject(hCursor)))
+ {
+ ObDereferenceObject(WinSta);
+ RETURN(NULL);
+ }
+ }
+ else
+ {
+ CurIcon =3D NULL;
}
=
OldCursor =3D IntSetCursor(WinSta, CurIcon, FALSE);
=
- UserDereferenceObject(CurIcon);
+ if(CurIcon)
+ {
+ UserDereferenceObject(CurIcon);
+ }
ObDereferenceObject(WinSta);
=
RETURN(OldCursor);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3=
2k/ntuser/input.c?rev=3D32676&r1=3D32675&r2=3D32676&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c Thu Mar 13 19:05:5=
8 2008
@@ -1096,7 +1096,10 @@
{
SurfObj =3D &BitmapObj->SurfObj;
=
- IntEngMovePointer(SurfObj, MousePos.x, MousePos.y, &(GDIDEV(Su=
rfObj)->Pointer.Exclude));
+ if (CurInfo->ShowingCursor)
+ {
+ IntEngMovePointer(SurfObj, MousePos.x, MousePos.y, &(GDIDEV=
(SurfObj)->Pointer.Exclude));
+ }
/* Only now, update the info in the GDIDEVICE, so EngMovePoint=
er can
* use the old values to move the pointer image */
GDIDEV(SurfObj)->Pointer.Pos.x =3D MousePos.x;