mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Limit cursor clip region to desktop region
svn path=/trunk/; revision=6030
This commit is contained in:
parent
7479009d8c
commit
05023f216e
1 changed files with 22 additions and 9 deletions
|
@ -9,6 +9,8 @@
|
|||
#include <include/winsta.h>
|
||||
#include <include/error.h>
|
||||
#include <include/mouse.h>
|
||||
#include <include/window.h>
|
||||
#include <internal/safe.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <win32k/debug1.h>
|
||||
|
@ -229,12 +231,14 @@ NtUserGetCursorInfo(
|
|||
BOOL
|
||||
STDCALL
|
||||
NtUserClipCursor(
|
||||
RECT *lpRect)
|
||||
RECT *UnsafeRect)
|
||||
{
|
||||
/* FIXME - check if process has WINSTA_WRITEATTRIBUTES */
|
||||
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
PSYSTEM_CURSORINFO CurInfo;
|
||||
PWINDOW_OBJECT DesktopWindow;
|
||||
RECT Rect;
|
||||
|
||||
NTSTATUS Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||
KernelMode,
|
||||
|
@ -242,23 +246,32 @@ NtUserClipCursor(
|
|||
&WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||
DPRINT1("Validation of window station handle (0x%X) failed\n",
|
||||
PROCESS_WINDOW_STATION());
|
||||
SetLastWin32Error(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (NULL != UnsafeRect && ! NT_SUCCESS(MmCopyFromCaller(&Rect, UnsafeRect, sizeof(RECT))))
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CurInfo = &WinStaObject->SystemCursor;
|
||||
if(lpRect)
|
||||
if(UnsafeRect)
|
||||
{
|
||||
if((lpRect->right >= lpRect->left) &&
|
||||
(lpRect->bottom >= lpRect->top))
|
||||
if((Rect.right >= Rect.left) &&
|
||||
(Rect.bottom >= Rect.top))
|
||||
{
|
||||
DesktopWindow = IntGetWindowObject(WinStaObject->ActiveDesktop->DesktopWindow);
|
||||
CurInfo->CursorClipInfo.IsClipped = TRUE;
|
||||
CurInfo->CursorClipInfo.Left = lpRect->left;
|
||||
CurInfo->CursorClipInfo.Top = lpRect->top;
|
||||
CurInfo->CursorClipInfo.Right = lpRect->right;
|
||||
CurInfo->CursorClipInfo.Bottom = lpRect->bottom;
|
||||
CurInfo->CursorClipInfo.Left = max(Rect.left, DesktopWindow->WindowRect.left);
|
||||
CurInfo->CursorClipInfo.Top = max(Rect.top, DesktopWindow->WindowRect.top);
|
||||
CurInfo->CursorClipInfo.Right = min(Rect.right, DesktopWindow->WindowRect.right);
|
||||
CurInfo->CursorClipInfo.Bottom = min(Rect.bottom, DesktopWindow->WindowRect.bottom);
|
||||
IntReleaseWindowObject(DesktopWindow);
|
||||
|
||||
MouseMoveCursor(CurInfo->x, CurInfo->y);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue