implemented SwapMouseButton()

svn path=/trunk/; revision=5897
This commit is contained in:
Thomas Bluemel 2003-08-28 14:22:05 +00:00
parent 6381c3ac66
commit 9719db631e
8 changed files with 60 additions and 33 deletions

View file

@ -165,6 +165,7 @@ NtUserCallNoParam(
#define ONEPARAM_ROUTINE_ISWINDOWUNICODE 0x02
#define ONEPARAM_ROUTINE_WINDOWFROMDC 0x03
#define ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID 0x04
#define ONEPARAM_ROUTINE_SWAPMOUSEBUTTON 0x05
DWORD
STDCALL
NtUserCallOneParam(

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.37 2003/08/24 01:12:15 weiden Exp $
/* $Id: stubs.c,v 1.38 2003/08/28 14:22:05 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -400,19 +400,6 @@ SetSysColors(
}
/*
* @unimplemented
*/
WINBOOL
STDCALL
SwapMouseButton(
WINBOOL fSwap)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: input.c,v 1.14 2003/08/20 03:07:33 silverblade Exp $
/* $Id: input.c,v 1.15 2003/08/28 14:22:05 weiden Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c
@ -330,6 +330,19 @@ SetKeyboardState(LPBYTE lpKeyState)
}
/*
* @implemented
*/
WINBOOL
STDCALL
SwapMouseButton(
WINBOOL fSwap)
{
return (WINBOOL)NtUserCallOneParam((DWORD)fSwap,
ONEPARAM_ROUTINE_SWAPMOUSEBUTTON);
}
/*
* @unimplemented
*/

View file

@ -32,6 +32,7 @@ typedef struct _SYSCURSOR
typedef struct _SYSTEM_CURSORINFO
{
BOOL Enabled;
BOOL SwapButtons;
UINT CurrentCursor;
LONG x, y;
BOOL SafetySwitch, SafetySwitch2;

View file

@ -16,7 +16,7 @@
* 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.36 2003/08/26 19:26:02 weiden Exp $
/* $Id: mouse.c,v 1.37 2003/08/28 14:22:05 weiden Exp $
*
* PROJECT: ReactOS kernel
* PURPOSE: Mouse
@ -118,7 +118,7 @@ static UCHAR DefaultCursor[256] = {
/* FUNCTIONS *****************************************************************/
BOOL FASTCALL
CheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo)
IntCheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo)
{
if(CurInfo->CursorClipInfo.IsClipped)
{
@ -135,6 +135,14 @@ CheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo)
return TRUE;
}
BOOL FASTCALL
IntSwapMouseButton(PWINSTATION_OBJECT WinStaObject, BOOL Swap)
{
BOOL res = WinStaObject->SystemCursor.SwapButtons;
WinStaObject->SystemCursor.SwapButtons = Swap;
return res;
}
INT STDCALL
MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1,
LONG HazardY1, LONG HazardX2, LONG HazardY2)
@ -299,7 +307,7 @@ MouseMoveCursor(LONG X, LONG Y)
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
DC_UnlockDc( hDC );
CheckClipCursor(&X, &Y, CurInfo);
IntCheckClipCursor(&X, &Y, CurInfo);
if((X != CurInfo->x) || (Y != CurInfo->y))
{
/* send MOUSEMOVE message */
@ -394,7 +402,7 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
CurInfo->x = min(CurInfo->x, SurfObj->sizlBitmap.cx - 20);
CurInfo->y = min(CurInfo->y, SurfObj->sizlBitmap.cy - 20);
CheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo);
IntCheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo);
KeQueryTickCount(&LargeTickCount);
TickCount = LargeTickCount.u.LowPart;
@ -419,8 +427,8 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_DOWN) > 0)
{
Msg.wParam = MK_LBUTTON;
Msg.message = WM_LBUTTONDOWN;
Msg.wParam = CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON;
Msg.message = CurInfo->SwapButtons ? WM_RBUTTONDOWN : WM_LBUTTONDOWN;
}
if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_DOWN) > 0)
{
@ -429,14 +437,14 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
}
if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_DOWN) > 0)
{
Msg.wParam = MK_RBUTTON;
Msg.message = WM_RBUTTONDOWN;
Msg.wParam = CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON;
Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN;
}
if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_UP) > 0)
{
Msg.wParam = MK_LBUTTON;
Msg.message = WM_LBUTTONUP;
Msg.wParam = CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON;
Msg.message = CurInfo->SwapButtons ? WM_RBUTTONUP : WM_LBUTTONUP;
}
if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_UP) > 0)
{
@ -445,8 +453,8 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
}
if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_UP) > 0)
{
Msg.wParam = MK_RBUTTON;
Msg.message = WM_RBUTTONUP;
Msg.wParam = CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON;
Msg.message = CurInfo->SwapButtons ? WM_LBUTTONUP : WM_RBUTTONUP;
}
MsqInsertSystemMessage(&Msg, FALSE);
@ -527,9 +535,9 @@ EnableMouse(HDC hDisplayDC)
MouseSurf = (PSURFOBJ)AccessUserObject((ULONG) hMouseSurf);
DbgPrint("Setting Cursor up at 0x%x, 0x%x\n", CurInfo->x, CurInfo->y);
CheckClipCursor(&CurInfo->x,
&CurInfo->y,
CurInfo);
IntCheckClipCursor(&CurInfo->x,
&CurInfo->y,
CurInfo);
PointerStatus = SurfGDI->SetPointerShape(SurfObj, MouseSurf, NULL, NULL,
SysCursor->hx,

View file

@ -5,7 +5,8 @@
#include <include/winsta.h>
//#include <ddk/ntddmou.h>
BOOL FASTCALL CheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo);
BOOL FASTCALL IntCheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo);
BOOL FASTCALL IntSwapMouseButton(PWINSTATION_OBJECT WinStaObject, BOOL Swap);
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);

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.12 2003/08/25 00:28:23 weiden Exp $
/* $Id: misc.c,v 1.13 2003/08/28 14:22:05 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -48,8 +48,11 @@ NtUserCallOneParam(
DWORD Param,
DWORD Routine)
{
NTSTATUS Status;
DWORD Result = 0;
PWINSTATION_OBJECT WinStaObject;
PWINDOW_OBJECT WindowObject;
switch(Routine)
{
case ONEPARAM_ROUTINE_GETMENU:
@ -91,6 +94,18 @@ NtUserCallOneParam(
IntReleaseWindowObject(WindowObject);
return Result;
case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON:
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode,
0,
&WinStaObject);
if (!NT_SUCCESS(Status))
return (DWORD)FALSE;
Result = (DWORD)IntSwapMouseButton(WinStaObject, (BOOL)Param);
ObDereferenceObject(WinStaObject);
return Result;
}
DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam()\n Param=0x%x\n",

View file

@ -16,7 +16,7 @@
* 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.30 2003/08/25 00:28:23 weiden Exp $
/* $Id: winsta.c,v 1.31 2003/08/28 14:22:05 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -354,6 +354,7 @@ NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
ExInitializeFastMutex(&WinStaObject->SystemCursor.CursorMutex);
WinStaObject->SystemCursor.Enabled = FALSE;
WinStaObject->SystemCursor.SwapButtons = FALSE;
WinStaObject->SystemCursor.CurrentCursor = 0;
WinStaObject->SystemCursor.x = (LONG)0;
WinStaObject->SystemCursor.y = (LONG)0;