mirror of
https://github.com/reactos/reactos.git
synced 2024-09-05 18:26:53 +00:00
[WIN32K]
Refactor NtUserClipCursor, don't acquire user lock in UserRedrawDesktop, svn path=/branches/reactos-yarotows/; revision=46657
This commit is contained in:
parent
ac6192b1b0
commit
5fa6a416ca
|
@ -776,6 +776,39 @@ CLEANUP:
|
|||
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 @@ CLEANUP:
|
|||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
DPRINT("Enter NtUserClipCursor\n");
|
||||
UserEnterExclusive();
|
||||
|
||||
if (NULL != UnsafeRect && ! NT_SUCCESS(MmCopyFromCaller(&Rect, UnsafeRect, sizeof(RECT))))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
RETURN(FALSE);
|
||||
}
|
||||
/* Call the internal function */
|
||||
bResult = UserClipCursor(prcl);
|
||||
|
||||
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_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -645,8 +645,6 @@ UserRedrawDesktop()
|
|||
{
|
||||
PWINDOW_OBJECT Window = NULL;
|
||||
|
||||
UserEnterExclusive();
|
||||
|
||||
Window = UserGetDesktopWindow();
|
||||
|
||||
IntInvalidateWindows( Window,
|
||||
|
@ -655,7 +653,6 @@ UserRedrawDesktop()
|
|||
RDW_ERASE |
|
||||
RDW_INVALIDATE |
|
||||
RDW_ALLCHILDREN);
|
||||
UserLeave();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue