From b58c170c4dd6c766bc61866098a218f66c8d9e2c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 9 Mar 2005 11:51:31 +0000 Subject: [PATCH] Make the SwapMouseButton function and the SPI_SETMOUSEBUTTONSWAP parameter work on the same flag. --- dlls/user/sysparams.c | 9 +++++++++ windows/input.c | 29 ++++++++--------------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/dlls/user/sysparams.c b/dlls/user/sysparams.c index 0918f0bf67d..b50c1d07ac6 100644 --- a/dlls/user/sysparams.c +++ b/dlls/user/sysparams.c @@ -2683,6 +2683,15 @@ INT WINAPI GetSystemMetrics( INT index ) } +/*********************************************************************** + * SwapMouseButton (USER32.@) + */ +BOOL WINAPI SwapMouseButton( BOOL fSwap ) +{ + return SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0); +} + + /********************************************************************** * SetDoubleClickTime (USER32.@) */ diff --git a/windows/input.c b/windows/input.c index 866654616fb..228cb245905 100644 --- a/windows/input.c +++ b/windows/input.c @@ -52,12 +52,10 @@ WINE_DECLARE_DEBUG_CHANNEL(keyboard); WINE_DECLARE_DEBUG_CHANNEL(win); WINE_DEFAULT_DEBUG_CHANNEL(event); -static BOOL SwappedButtons; - BYTE InputKeyStateTable[256]; -BYTE AsyncKeyStateTable[256]; -BYTE TrackSysKey = 0; /* determine whether ALT key up will cause a WM_SYSKEYUP - or a WM_KEYUP message */ +static BYTE AsyncKeyStateTable[256]; +static BYTE TrackSysKey = 0; /* determine whether ALT key up will cause a WM_SYSKEYUP + or a WM_KEYUP message */ /* Storage for the USER-maintained mouse positions */ static DWORD PosX, PosY; @@ -91,7 +89,7 @@ static WORD get_key_state(void) { WORD ret = 0; - if (SwappedButtons) + if (GetSystemMetrics( SM_SWAPBUTTON )) { if (InputKeyStateTable[VK_RBUTTON] & 0x80) ret |= MK_LBUTTON; if (InputKeyStateTable[VK_LBUTTON] & 0x80) ret |= MK_RBUTTON; @@ -292,26 +290,26 @@ static void queue_mouse_event( const MOUSEINPUT *mi, UINT flags ) { InputKeyStateTable[VK_LBUTTON] |= 0x80; AsyncKeyStateTable[VK_LBUTTON] |= 0x80; - queue_raw_mouse_message( SwappedButtons ? WM_RBUTTONDOWN : WM_LBUTTONDOWN, + queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_RBUTTONDOWN : WM_LBUTTONDOWN, flags, PosX, PosY, mi ); } if (mi->dwFlags & MOUSEEVENTF_LEFTUP) { InputKeyStateTable[VK_LBUTTON] &= ~0x80; - queue_raw_mouse_message( SwappedButtons ? WM_RBUTTONUP : WM_LBUTTONUP, + queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_RBUTTONUP : WM_LBUTTONUP, flags, PosX, PosY, mi ); } if (mi->dwFlags & MOUSEEVENTF_RIGHTDOWN) { InputKeyStateTable[VK_RBUTTON] |= 0x80; AsyncKeyStateTable[VK_RBUTTON] |= 0x80; - queue_raw_mouse_message( SwappedButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN, + queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_LBUTTONDOWN : WM_RBUTTONDOWN, flags, PosX, PosY, mi ); } if (mi->dwFlags & MOUSEEVENTF_RIGHTUP) { InputKeyStateTable[VK_RBUTTON] &= ~0x80; - queue_raw_mouse_message( SwappedButtons ? WM_LBUTTONUP : WM_RBUTTONUP, + queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_LBUTTONUP : WM_RBUTTONUP, flags, PosX, PosY, mi ); } if (mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN) @@ -401,17 +399,6 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy, } -/*********************************************************************** - * SwapMouseButton (USER32.@) - */ -BOOL WINAPI SwapMouseButton( BOOL fSwap ) -{ - BOOL ret = SwappedButtons; - SwappedButtons = fSwap; - return ret; -} - - /*********************************************************************** * GetCursorPos (USER32.@) */