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_ISWINDOWUNICODE 0x02
#define ONEPARAM_ROUTINE_WINDOWFROMDC 0x03 #define ONEPARAM_ROUTINE_WINDOWFROMDC 0x03
#define ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID 0x04 #define ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID 0x04
#define ONEPARAM_ROUTINE_SWAPMOUSEBUTTON 0x05
DWORD DWORD
STDCALL STDCALL
NtUserCallOneParam( 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -400,19 +400,6 @@ SetSysColors(
} }
/*
* @unimplemented
*/
WINBOOL
STDCALL
SwapMouseButton(
WINBOOL fSwap)
{
UNIMPLEMENTED;
return FALSE;
}
/* /*
* @unimplemented * @unimplemented
*/ */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c * 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 * @unimplemented
*/ */

View file

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

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * PROJECT: ReactOS kernel
* PURPOSE: Mouse * PURPOSE: Mouse
@ -118,7 +118,7 @@ static UCHAR DefaultCursor[256] = {
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
BOOL FASTCALL BOOL FASTCALL
CheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo) IntCheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo)
{ {
if(CurInfo->CursorClipInfo.IsClipped) if(CurInfo->CursorClipInfo.IsClipped)
{ {
@ -135,6 +135,14 @@ CheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo)
return TRUE; return TRUE;
} }
BOOL FASTCALL
IntSwapMouseButton(PWINSTATION_OBJECT WinStaObject, BOOL Swap)
{
BOOL res = WinStaObject->SystemCursor.SwapButtons;
WinStaObject->SystemCursor.SwapButtons = Swap;
return res;
}
INT STDCALL INT STDCALL
MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1, MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1,
LONG HazardY1, LONG HazardX2, LONG HazardY2) LONG HazardY1, LONG HazardX2, LONG HazardY2)
@ -299,7 +307,7 @@ MouseMoveCursor(LONG X, LONG Y)
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface); SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface); SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
DC_UnlockDc( hDC ); DC_UnlockDc( hDC );
CheckClipCursor(&X, &Y, CurInfo); IntCheckClipCursor(&X, &Y, CurInfo);
if((X != CurInfo->x) || (Y != CurInfo->y)) if((X != CurInfo->x) || (Y != CurInfo->y))
{ {
/* send MOUSEMOVE message */ /* send MOUSEMOVE message */
@ -394,7 +402,7 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
CurInfo->x = min(CurInfo->x, SurfObj->sizlBitmap.cx - 20); CurInfo->x = min(CurInfo->x, SurfObj->sizlBitmap.cx - 20);
CurInfo->y = min(CurInfo->y, SurfObj->sizlBitmap.cy - 20); CurInfo->y = min(CurInfo->y, SurfObj->sizlBitmap.cy - 20);
CheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo); IntCheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo);
KeQueryTickCount(&LargeTickCount); KeQueryTickCount(&LargeTickCount);
TickCount = LargeTickCount.u.LowPart; TickCount = LargeTickCount.u.LowPart;
@ -419,8 +427,8 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_DOWN) > 0)
{ {
Msg.wParam = MK_LBUTTON; Msg.wParam = CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON;
Msg.message = WM_LBUTTONDOWN; Msg.message = CurInfo->SwapButtons ? WM_RBUTTONDOWN : WM_LBUTTONDOWN;
} }
if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_DOWN) > 0) 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) if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_DOWN) > 0)
{ {
Msg.wParam = MK_RBUTTON; Msg.wParam = CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON;
Msg.message = WM_RBUTTONDOWN; Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN;
} }
if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_UP) > 0) if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_UP) > 0)
{ {
Msg.wParam = MK_LBUTTON; Msg.wParam = CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON;
Msg.message = WM_LBUTTONUP; Msg.message = CurInfo->SwapButtons ? WM_RBUTTONUP : WM_LBUTTONUP;
} }
if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_UP) > 0) 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) if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_UP) > 0)
{ {
Msg.wParam = MK_RBUTTON; Msg.wParam = CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON;
Msg.message = WM_RBUTTONUP; Msg.message = CurInfo->SwapButtons ? WM_LBUTTONUP : WM_RBUTTONUP;
} }
MsqInsertSystemMessage(&Msg, FALSE); MsqInsertSystemMessage(&Msg, FALSE);
@ -527,9 +535,9 @@ EnableMouse(HDC hDisplayDC)
MouseSurf = (PSURFOBJ)AccessUserObject((ULONG) hMouseSurf); MouseSurf = (PSURFOBJ)AccessUserObject((ULONG) hMouseSurf);
DbgPrint("Setting Cursor up at 0x%x, 0x%x\n", CurInfo->x, CurInfo->y); DbgPrint("Setting Cursor up at 0x%x, 0x%x\n", CurInfo->x, CurInfo->y);
CheckClipCursor(&CurInfo->x, IntCheckClipCursor(&CurInfo->x,
&CurInfo->y, &CurInfo->y,
CurInfo); CurInfo);
PointerStatus = SurfGDI->SetPointerShape(SurfObj, MouseSurf, NULL, NULL, PointerStatus = SurfGDI->SetPointerShape(SurfObj, MouseSurf, NULL, NULL,
SysCursor->hx, SysCursor->hx,

View file

@ -5,7 +5,8 @@
#include <include/winsta.h> #include <include/winsta.h>
//#include <ddk/ntddmou.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 STDCALL MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1, LONG HazardY1, LONG HazardX2, LONG HazardY2);
INT FASTCALL MouseSafetyOnDrawEnd(PSURFOBJ SurfObj, PSURFGDI SurfGDI); INT FASTCALL MouseSafetyOnDrawEnd(PSURFOBJ SurfObj, PSURFGDI SurfGDI);
BOOL FASTCALL MouseMoveCursor(LONG X, LONG Y); 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -48,8 +48,11 @@ NtUserCallOneParam(
DWORD Param, DWORD Param,
DWORD Routine) DWORD Routine)
{ {
NTSTATUS Status;
DWORD Result = 0; DWORD Result = 0;
PWINSTATION_OBJECT WinStaObject;
PWINDOW_OBJECT WindowObject; PWINDOW_OBJECT WindowObject;
switch(Routine) switch(Routine)
{ {
case ONEPARAM_ROUTINE_GETMENU: case ONEPARAM_ROUTINE_GETMENU:
@ -91,6 +94,18 @@ NtUserCallOneParam(
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
return Result; 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", 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 * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -354,6 +354,7 @@ NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
ExInitializeFastMutex(&WinStaObject->SystemCursor.CursorMutex); ExInitializeFastMutex(&WinStaObject->SystemCursor.CursorMutex);
WinStaObject->SystemCursor.Enabled = FALSE; WinStaObject->SystemCursor.Enabled = FALSE;
WinStaObject->SystemCursor.SwapButtons = FALSE;
WinStaObject->SystemCursor.CurrentCursor = 0; WinStaObject->SystemCursor.CurrentCursor = 0;
WinStaObject->SystemCursor.x = (LONG)0; WinStaObject->SystemCursor.x = (LONG)0;
WinStaObject->SystemCursor.y = (LONG)0; WinStaObject->SystemCursor.y = (LONG)0;