]> git.saurik.com Git - wxWidgets.git/commitdiff
Only test the high order bit from GetKeyState, otherwise we can have
authorRobin Dunn <robin@alldunn.com>
Fri, 17 Dec 2004 16:31:14 +0000 (16:31 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 17 Dec 2004 16:31:14 +0000 (16:31 +0000)
bogus readings.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31052 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index d3745d4db5de6d660736e3c99e8aff804b0ef30f..65fafd055a687fea2aaf7462648fe12958281095 100644 (file)
@@ -1254,15 +1254,17 @@ void wxWindowMSW::OnInternalIdle()
             // changed by the time the OnInternalIdle function is called, so 'state'
             // may be meaningless.
             int state = 0;
             // changed by the time the OnInternalIdle function is called, so 'state'
             // may be meaningless.
             int state = 0;
-            if ( wxIsShiftDown() )
+                       if ( wxIsShiftDown() )
                 state |= MK_SHIFT;
             if ( wxIsCtrlDown() )
                 state |= MK_CONTROL;
                 state |= MK_SHIFT;
             if ( wxIsCtrlDown() )
                 state |= MK_CONTROL;
-            if ( GetKeyState( VK_LBUTTON ) )
+
+            // Only the high-order bit should be tested
+            if ( GetKeyState( VK_LBUTTON ) & (1<<15) )
                 state |= MK_LBUTTON;
                 state |= MK_LBUTTON;
-            if ( GetKeyState( VK_MBUTTON ) )
+            if ( GetKeyState( VK_MBUTTON ) & (1<<15) )
                 state |= MK_MBUTTON;
                 state |= MK_MBUTTON;
-            if ( GetKeyState( VK_RBUTTON ) )
+            if ( GetKeyState( VK_RBUTTON ) & (1<<15) )
                 state |= MK_RBUTTON;
 
             POINT pt;
                 state |= MK_RBUTTON;
 
             POINT pt;