Author: tkreuzer
Date: Fri Apr 2 00:30:44 2010
New Revision: 46657
URL:
http://svn.reactos.org/svn/reactos?rev=46657&view=rev
Log:
[WIN32K]
Refactor NtUserClipCursor, don't acquire user lock in UserRedrawDesktop,
Modified:
branches/reactos-yarotows/subsystems/win32/win32k/ntuser/cursoricon.c
branches/reactos-yarotows/subsystems/win32/win32k/ntuser/desktop.c
Modified: branches/reactos-yarotows/subsystems/win32/win32k/ntuser/cursoricon.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Fri
Apr 2 00:30:44 2010
@@ -776,6 +776,39 @@
END_CLEANUP;
}
+BOOL
+APIENTRY
+UserClipCursor(
+ RECTL *prcl)
+{
+ /* FIXME - check if process has WINSTA_WRITEATTRIBUTES */
+ PSYSTEM_CURSORINFO CurInfo;
+ PWINDOW_OBJECT DesktopWindow = NULL;
+
+ CurInfo = IntGetSysCursorInfo();
+
+ DesktopWindow = UserGetDesktopWindow();
+
+ if (prcl != NULL &&
+ (prcl->right > prcl->left) &&
+ (prcl->bottom > prcl->top) &&
+ DesktopWindow != NULL)
+ {
+ CurInfo->CursorClipInfo.IsClipped = TRUE;
+ CurInfo->CursorClipInfo.Left = max(prcl->left,
DesktopWindow->Wnd->rcWindow.left);
+ CurInfo->CursorClipInfo.Top = max(prcl->top,
DesktopWindow->Wnd->rcWindow.top);
+ CurInfo->CursorClipInfo.Right = min(prcl->right,
DesktopWindow->Wnd->rcWindow.right);
+ CurInfo->CursorClipInfo.Bottom = min(prcl->bottom,
DesktopWindow->Wnd->rcWindow.bottom);
+
+ UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y);
+ }
+ else
+ {
+ CurInfo->CursorClipInfo.IsClipped = FALSE;
+ }
+
+ return TRUE;
+}
/*
* @implemented
@@ -783,49 +816,38 @@
BOOL
APIENTRY
NtUserClipCursor(
- RECTL *UnsafeRect)
+ RECTL *prcl)
{
/* FIXME - check if process has WINSTA_WRITEATTRIBUTES */
- PSYSTEM_CURSORINFO CurInfo;
- RECTL Rect;
- PWINDOW_OBJECT DesktopWindow = NULL;
- DECLARE_RETURN(BOOL);
-
- DPRINT("Enter NtUserClipCursor\n");
+ RECTL rclLocal;
+ BOOL bResult;
+
+ if (prcl)
+ {
+ _SEH2_TRY
+ {
+ /* Probe and copy rect */
+ ProbeForRead(prcl, sizeof(RECTL), 1);
+ rclLocal = *prcl;
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ _SEH2_YIELD(return FALSE;)
+ }
+ _SEH2_END
+
+ prcl = &rclLocal;
+ }
+
UserEnterExclusive();
- if (NULL != UnsafeRect && ! NT_SUCCESS(MmCopyFromCaller(&Rect,
UnsafeRect, sizeof(RECT))))
- {
- SetLastWin32Error(ERROR_INVALID_PARAMETER);
- RETURN(FALSE);
- }
-
- CurInfo = IntGetSysCursorInfo();
-
- DesktopWindow = UserGetDesktopWindow();
-
- if ((Rect.right > Rect.left) && (Rect.bottom > Rect.top)
- && 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);
-
- UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y);
-
- RETURN(TRUE);
- }
-
- CurInfo->CursorClipInfo.IsClipped = FALSE;
- RETURN(TRUE);
-
-CLEANUP:
- DPRINT("Leave NtUserClipCursor, ret=%i\n",_ret_);
+ /* Call the internal function */
+ bResult = UserClipCursor(prcl);
+
UserLeave();
- END_CLEANUP;
+
+ return bResult;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/ntuser/desktop.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Fri
Apr 2 00:30:44 2010
@@ -645,8 +645,6 @@
{
PWINDOW_OBJECT Window = NULL;
- UserEnterExclusive();
-
Window = UserGetDesktopWindow();
IntInvalidateWindows( Window,
@@ -655,7 +653,6 @@
RDW_ERASE |
RDW_INVALIDATE |
RDW_ALLCHILDREN);
- UserLeave();
}