Author: gadamopoulos
Date: Sat Sep 25 16:59:53 2010
New Revision: 48879
URL:
http://svn.reactos.org/svn/reactos?rev=48879&view=rev
Log:
[win32k]
- Cleanup UserSetCursorPos
- UserSetCursorPos: set the new position after sending WM_MOUSEMOVE message
now we pass all tests for SetCursorPos
Modified:
trunk/reactos/subsystems/win32/win32k/include/cursoricon.h
trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
Modified: trunk/reactos/subsystems/win32/win32k/include/cursoricon.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/cursoricon.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/cursoricon.h [iso-8859-1] Sat Sep 25
16:59:53 2010
@@ -22,15 +22,6 @@
ICONINFO IconInfo;
} CURICON_OBJECT, *PCURICON_OBJECT;
-typedef struct _CURSORCLIP_INFO
-{
- BOOL IsClipped;
- UINT Left;
- UINT Top;
- UINT Right;
- UINT Bottom;
-} CURSORCLIP_INFO, *PCURSORCLIP_INFO;
-
typedef struct _CURSORACCELERATION_INFO
{
UINT FirstThreshold;
@@ -45,7 +36,8 @@
DWORD ClickLockTime;
// BOOL SwapButtons;
UINT ButtonsDown;
- CURSORCLIP_INFO CursorClipInfo;
+ RECTL rcClip;
+ BOOL bClipped;
PCURICON_OBJECT CurrentCursorObject;
INT ShowingCursor;
/*
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Sat Sep 25
16:59:53 2010
@@ -60,7 +60,7 @@
gSysCursorInfo.Enabled = FALSE;
gSysCursorInfo.ButtonsDown = 0;
- gSysCursorInfo.CursorClipInfo.IsClipped = FALSE;
+ gSysCursorInfo.bClipped = FALSE;
gSysCursorInfo.LastBtnDown = 0;
gSysCursorInfo.CurrentCursorObject = NULL;
gSysCursorInfo.ShowingCursor = 0;
@@ -180,58 +180,51 @@
PSYSTEM_CURSORINFO CurInfo;
HDC hDC;
MSG Msg;
+ RECTL rcClip;
+ POINT pt;
if(!(hDC = IntGetScreenDC()))
{
return FALSE;
}
+ if(!(DesktopWindow = UserGetDesktopWindow()))
+ {
+ return FALSE;
+ }
+
CurInfo = IntGetSysCursorInfo();
- DesktopWindow = UserGetDesktopWindow();
-
- if (DesktopWindow)
- {
- if(x >= DesktopWindow->Wnd->rcClient.right)
- x = DesktopWindow->Wnd->rcClient.right - 1;
- if(y >= DesktopWindow->Wnd->rcClient.bottom)
- y = DesktopWindow->Wnd->rcClient.bottom - 1;
- }
-
- if(x < 0)
- x = 0;
- if(y < 0)
- y = 0;
-
- //Clip cursor position
- if(CurInfo->CursorClipInfo.IsClipped)
- {
- if(x >= (LONG)CurInfo->CursorClipInfo.Right)
- x = (LONG)CurInfo->CursorClipInfo.Right - 1;
- if(x < (LONG)CurInfo->CursorClipInfo.Left)
- x = (LONG)CurInfo->CursorClipInfo.Left;
- if(y >= (LONG)CurInfo->CursorClipInfo.Bottom)
- y = (LONG)CurInfo->CursorClipInfo.Bottom - 1;
- if(y < (LONG)CurInfo->CursorClipInfo.Top)
- y = (LONG)CurInfo->CursorClipInfo.Top;
- }
-
- //Store the new cursor position
- gpsi->ptCursor.x = x;
- gpsi->ptCursor.y = y;
-
- //Move the mouse pointer
+ /* Clip cursor position */
+ if (!CurInfo->bClipped)
+ rcClip = DesktopWindow->Wnd->rcClient;
+ else
+ rcClip = CurInfo->rcClip;
+
+ if(x >= rcClip.right) x = rcClip.right - 1;
+ if(x < rcClip.left) x = rcClip.left;
+ if(y >= rcClip.bottom) y = rcClip.bottom - 1;
+ if(y < rcClip.top) y = rcClip.top;
+
+ pt.x = x;
+ pt.y = y;
+
+
+ if (SendMouseMoveMsg)
+ {
+ /* Generate a mouse move message */
+ Msg.message = WM_MOUSEMOVE;
+ Msg.wParam = CurInfo->ButtonsDown;
+ Msg.lParam = MAKELPARAM(x, y);
+ Msg.pt = pt;
+ MsqInsertSystemMessage(&Msg);
+ }
+
+ /* Store the new cursor position */
+ gpsi->ptCursor = pt;
+
+ /* Move the mouse pointer */
GreMovePointer(hDC, x, y);
-
- if (!SendMouseMoveMsg)
- return TRUE;
-
- //Generate a mouse move message
- Msg.message = WM_MOUSEMOVE;
- Msg.wParam = CurInfo->ButtonsDown;
- Msg.lParam = MAKELPARAM(x, y);
- Msg.pt = gpsi->ptCursor;
- MsqInsertSystemMessage(&Msg);
return TRUE;
}
@@ -731,18 +724,14 @@
&& DesktopWindow && UnsafeRect != NULL)
{
- CurInfo->CursorClipInfo.IsClipped = TRUE;
- CurInfo->CursorClipInfo.Left = max(Rect.left,
DesktopWindow->Wnd->rcWindow.left);
- CurInfo->CursorClipInfo.Top = max(Rect.top,
DesktopWindow->Wnd->rcWindow.top);
- CurInfo->CursorClipInfo.Right = min(Rect.right,
DesktopWindow->Wnd->rcWindow.right);
- CurInfo->CursorClipInfo.Bottom = min(Rect.bottom,
DesktopWindow->Wnd->rcWindow.bottom);
-
+ CurInfo->bClipped = TRUE;
+ RECTL_bIntersectRect(&CurInfo->rcClip, &Rect,
&DesktopWindow->Wnd->rcWindow);
UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y, FALSE);
RETURN(TRUE);
}
- CurInfo->CursorClipInfo.IsClipped = FALSE;
+ CurInfo->bClipped = FALSE;
RETURN(TRUE);
CLEANUP:
@@ -843,12 +832,9 @@
RETURN(FALSE);
CurInfo = IntGetSysCursorInfo();
- if (CurInfo->CursorClipInfo.IsClipped)
- {
- Rect.left = CurInfo->CursorClipInfo.Left;
- Rect.top = CurInfo->CursorClipInfo.Top;
- Rect.right = CurInfo->CursorClipInfo.Right;
- Rect.bottom = CurInfo->CursorClipInfo.Bottom;
+ if (CurInfo->bClipped)
+ {
+ Rect = CurInfo->rcClip;
}
else
{