* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: mouse.c,v 1.31 2003/08/24 18:52:18 weiden Exp $
+/* $Id: mouse.c,v 1.32 2003/08/24 23:52:29 weiden Exp $
*
* PROJECT: ReactOS kernel
* PURPOSE: Mouse
return(TRUE);
}
+BOOL FASTCALL
+MouseMoveCursor(LONG X, LONG Y)
+{
+ HDC hDC;
+ PDC dc;
+ RECTL MouseRect;
+ BOOL res = FALSE;
+ PSURFOBJ SurfObj;
+ PSURFGDI SurfGDI;
+ PSYSTEM_CURSORINFO CurInfo;
+ MSG Msg;
+ LARGE_INTEGER LargeTickCount;
+ ULONG TickCount;
+
+ hDC = IntGetScreenDC();
+
+ if(!hDC || !InputWindowStation)
+ return FALSE;
+
+ if(IntGetWindowStationObject(InputWindowStation))
+ {
+ dc = DC_LockDc(hDC);
+ SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
+ SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
+ DC_UnlockDc( hDC );
+ CurInfo = &InputWindowStation->SystemCursor;
+ CheckClipCursor(&X, &X, CurInfo);
+ if((X != CurInfo->x) || (Y != CurInfo->y))
+ {
+ /* send MOUSEMOVE message */
+ KeQueryTickCount(&LargeTickCount);
+ TickCount = LargeTickCount.u.LowPart;
+ Msg.wParam = 0;
+ Msg.lParam = MAKELPARAM(X, Y);
+ Msg.message = WM_MOUSEMOVE;
+ Msg.time = TickCount;
+ Msg.pt.x = X;
+ Msg.pt.y = Y;
+ MsqInsertSystemMessage(&Msg);
+ /* move cursor */
+ CurInfo->x = X;
+ CurInfo->y = Y;
+ if(!CurInfo->SafetySwitch && !CurInfo->SafetySwitch2 && CurInfo->Enabled)
+ {
+ SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &MouseRect);
+ }
+ res = TRUE;
+ }
+
+ ObDereferenceObject(InputWindowStation);
+ return res;
+ }
+ else
+ return FALSE;
+}
+
VOID /* STDCALL */
MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
/*
CheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo);
- if (SysCursor->hCursor && !CurInfo->SafetySwitch && !CurInfo->SafetySwitch2 &&
+ if (!CurInfo->SafetySwitch && !CurInfo->SafetySwitch2 &&
((mouse_ox != CurInfo->x) || (mouse_oy != CurInfo->y)))
{
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &MouseRect);
PSYSCURSOR SysCursor;
if( hDisplayDC && InputWindowStation)
- {DbgPrint("EnableMouse(TRUE)\n");
+ {
if(!IntGetWindowStationObject(InputWindowStation))
{
InputWindowStation->SystemCursor.Enabled = FALSE;
if(IntGetWindowStationObject(InputWindowStation))
{
InputWindowStation->SystemCursor.Enabled = FALSE;
+ InputWindowStation->SystemCursor.CursorClipInfo.IsClipped = FALSE;
ObDereferenceObject(InputWindowStation);
return;
}
#include <include/winsta.h>
//#include <ddk/ntddmou.h>
+BOOL FASTCALL CheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo);
INT STDCALL MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1, LONG HazardY1, LONG HazardX2, LONG HazardY2);
INT FASTCALL MouseSafetyOnDrawEnd(PSURFOBJ SurfObj, PSURFGDI SurfGDI);
+BOOL FASTCALL MouseMoveCursor(LONG X, LONG Y);
VOID FASTCALL EnableMouse(HDC hDisplayDC);
VOID MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount);
-/* $Id: misc.c,v 1.10 2003/08/24 18:52:18 weiden Exp $
+/* $Id: misc.c,v 1.11 2003/08/24 23:52:29 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* 2003/05/22 Created
*/
#include <ddk/ntddk.h>
+#include <ddk/ntddmou.h>
#include <win32k/win32k.h>
+#include <win32k/dc.h>
#include <include/error.h>
#include <include/window.h>
#include <include/painting.h>
#include <include/dce.h>
+#include <include/mouse.h>
#include <include/winsta.h>
#define NDEBUG
{
NTSTATUS Status;
PWINDOW_OBJECT WindowObject;
+ PSYSTEM_CURSORINFO CurInfo;
PWINSTATION_OBJECT WinStaObject;
PPOINT Pos;
if(Param2)
{
/* set cursor position */
+
+ CurInfo = &WinStaObject->SystemCursor;
/* FIXME - check if process has WINSTA_WRITEATTRIBUTES */
- WinStaObject->SystemCursor.x = Pos->x;
- WinStaObject->SystemCursor.y = Pos->y;
- /* FIXME move cursor */
+ CheckClipCursor(&Pos->x, &Pos->y, CurInfo);
+ if((Pos->x != CurInfo->x) || (Pos->y != CurInfo->y))
+ {
+ MouseMoveCursor(Pos->x, Pos->y);
+ }
+
}
else
{
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: winsta.c,v 1.28 2003/08/24 18:52:18 weiden Exp $
+/* $Id: winsta.c,v 1.29 2003/08/24 23:52:29 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
return((HWINSTA)0);
}
- WinStaObject->SystemCursor.Enabled = TRUE;
+ WinStaObject->SystemCursor.Enabled = FALSE;
WinStaObject->SystemCursor.CurrentCursor = 0;
- WinStaObject->SystemCursor.x = (LONG)-1;
- WinStaObject->SystemCursor.y = (LONG)-1;
+ WinStaObject->SystemCursor.x = (LONG)0;
+ WinStaObject->SystemCursor.y = (LONG)0;
WinStaObject->SystemCursor.SafetySwitch = FALSE;
- WinStaObject->SystemCursor.SafetySwitch2 = FALSE;
+ WinStaObject->SystemCursor.SafetySwitch2 = TRUE;
WinStaObject->SystemCursor.CursorClipInfo.IsClipped = FALSE;
WinStaObject->SystemCursor.SystemCursors[0].hCursor = (HANDLE)1;
#undef WIN32_LEAN_AND_MEAN
+#include <ddk/ntddk.h>
+#include <ddk/ntddmou.h>
#include <win32k/win32k.h>
#include <windows.h>
#include <stdlib.h>
#include <win32k/bitmaps.h>
#include <include/winsta.h>
#include <include/error.h>
+#include <include/mouse.h>
#define NDEBUG
#include <win32k/debug1.h>
/* FIXME - check if process has WINSTA_WRITEATTRIBUTES */
PWINSTATION_OBJECT WinStaObject;
+ PSYSTEM_CURSORINFO CurInfo;
+ LONG newx, newy;
NTSTATUS Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode,
SetLastWin32Error(Status);
return FALSE;
}
+
+ CurInfo = &WinStaObject->SystemCursor;
if(lpRect)
{
- WinStaObject->SystemCursor.CursorClipInfo.IsClipped = TRUE;
- WinStaObject->SystemCursor.CursorClipInfo.Left = lpRect->left;
- WinStaObject->SystemCursor.CursorClipInfo.Top = lpRect->top;
- WinStaObject->SystemCursor.CursorClipInfo.Right = lpRect->right;
- WinStaObject->SystemCursor.CursorClipInfo.Bottom = lpRect->bottom;
+ CurInfo->CursorClipInfo.IsClipped = TRUE;
+ CurInfo->CursorClipInfo.Left = lpRect->left;
+ CurInfo->CursorClipInfo.Top = lpRect->top;
+ CurInfo->CursorClipInfo.Right = lpRect->right;
+ CurInfo->CursorClipInfo.Bottom = lpRect->bottom;
+
+ newx = CurInfo->x;
+ newy = CurInfo->y;
+ CheckClipCursor(&newx, &newy, CurInfo);
+ if((newx != CurInfo->x) || (newy != CurInfo->y))
+ {
+ MouseMoveCursor(newx, newy);
+ }
- /* FIXME - update cursor position in case the cursor is not within the rectangle */
}
else
WinStaObject->SystemCursor.CursorClipInfo.IsClipped = FALSE;