@@ -15,36 +15,37 @@ namespace TestStack.White.InputDevices
1515 public class Mouse : IMouse
1616 {
1717 [ DllImport ( "user32" , EntryPoint = "SendInput" ) ]
18- private static extern int SendInput ( uint numberOfInputs , ref Input input , int structSize ) ;
18+ static extern int SendInput ( uint numberOfInputs , ref Input input , int structSize ) ;
1919
2020 [ DllImport ( "user32" , EntryPoint = "SendInput" ) ]
21- private static extern int SendInput64 ( int numberOfInputs , ref Input64 input , int structSize ) ;
22-
21+ static extern int SendInput64 ( int numberOfInputs , ref Input64 input , int structSize ) ;
22+
2323 [ DllImport ( "user32.dll" ) ]
24- private static extern IntPtr GetMessageExtraInfo ( ) ;
24+ static extern IntPtr GetMessageExtraInfo ( ) ;
2525
2626 [ DllImport ( "user32.dll" ) ]
2727
28- private static extern bool GetCursorPos ( ref System . Drawing . Point cursorInfo ) ;
28+ static extern bool GetCursorPos ( ref System . Drawing . Point cursorInfo ) ;
29+
30+ [ DllImport ( "user32.dll" ) ]
31+ static extern bool SetCursorPos ( int x , int y ) ;
2932
3033 [ DllImport ( "user32.dll" ) ]
31- private static extern bool SetCursorPos ( int x , int y ) ;
34+ static extern bool GetCursorInfo ( ref CursorInfo cursorInfo ) ;
3235
3336 [ DllImport ( "user32.dll" ) ]
34- private static extern bool GetCursorInfo ( ref CursorInfo cursorInfo ) ;
37+ static extern short GetDoubleClickTime ( ) ;
3538
3639 [ DllImport ( "user32.dll" ) ]
37- private static extern short GetDoubleClickTime ( ) ;
40+ static extern int GetSystemMetrics ( SystemMetric smIndex ) ;
3841
3942 public static Mouse Instance = new Mouse ( ) ;
40- private DateTime lastClickTime = DateTime . Now ;
41- private readonly short doubleClickTime = GetDoubleClickTime ( ) ;
42- private Point lastClickLocation ;
43- private const int ExtraMillisecondsBecauseOfBugInWindows = 13 ;
43+ DateTime lastClickTime = DateTime . Now ;
44+ readonly short doubleClickTime = GetDoubleClickTime ( ) ;
45+ Point lastClickLocation ;
46+ const int ExtraMillisecondsBecauseOfBugInWindows = 13 ;
4447
45- private Mouse ( )
46- {
47- }
48+ Mouse ( ) { }
4849
4950 public virtual Point Location
5051 {
@@ -77,22 +78,22 @@ public virtual MouseCursor Cursor
7778
7879 private static int RightMouseButtonDown
7980 {
80- get { return ( CoreAppXmlConfiguration . Instance . InvertMouseButtons ? WindowsConstants . MOUSEEVENTF_RIGHTDOWN : WindowsConstants . MOUSEEVENTF_LEFTDOWN ) ; }
81+ get { return GetSystemMetrics ( SystemMetric . SM_SWAPBUTTON ) == 0 ? WindowsConstants . MOUSEEVENTF_RIGHTDOWN : WindowsConstants . MOUSEEVENTF_LEFTDOWN ; }
8182 }
8283
8384 private static int RightMouseButtonUp
8485 {
85- get { return ( CoreAppXmlConfiguration . Instance . InvertMouseButtons ? WindowsConstants . MOUSEEVENTF_RIGHTUP : WindowsConstants . MOUSEEVENTF_LEFTUP ) ; }
86+ get { return GetSystemMetrics ( SystemMetric . SM_SWAPBUTTON ) == 0 ? WindowsConstants . MOUSEEVENTF_RIGHTUP : WindowsConstants . MOUSEEVENTF_LEFTUP ; }
8687 }
8788
8889 private static int LeftMouseButtonDown
8990 {
90- get { return ( CoreAppXmlConfiguration . Instance . InvertMouseButtons ? WindowsConstants . MOUSEEVENTF_LEFTDOWN : WindowsConstants . MOUSEEVENTF_RIGHTDOWN ) ; }
91+ get { return GetSystemMetrics ( SystemMetric . SM_SWAPBUTTON ) == 0 ? WindowsConstants . MOUSEEVENTF_LEFTDOWN : WindowsConstants . MOUSEEVENTF_RIGHTDOWN ; }
9192 }
9293
9394 private static int LeftMouseButtonUp
9495 {
95- get { return ( CoreAppXmlConfiguration . Instance . InvertMouseButtons ? WindowsConstants . MOUSEEVENTF_LEFTUP : WindowsConstants . MOUSEEVENTF_RIGHTUP ) ; }
96+ get { return GetSystemMetrics ( SystemMetric . SM_SWAPBUTTON ) == 0 ? WindowsConstants . MOUSEEVENTF_LEFTUP : WindowsConstants . MOUSEEVENTF_RIGHTUP ; }
9697 }
9798
9899 public virtual void RightClick ( )
0 commit comments