From: Robin Dunn Date: Fri, 17 Dec 2004 16:31:14 +0000 (+0000) Subject: Only test the high order bit from GetKeyState, otherwise we can have X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/fc32cd4a59dc7c6cedea430750b2ce2c2a342353?ds=inline Only test the high order bit from GetKeyState, otherwise we can have bogus readings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31052 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/window.cpp b/src/msw/window.cpp index d3745d4db5..65fafd055a 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1254,15 +1254,17 @@ void wxWindowMSW::OnInternalIdle() // 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; - if ( GetKeyState( VK_LBUTTON ) ) + + // Only the high-order bit should be tested + if ( GetKeyState( VK_LBUTTON ) & (1<<15) ) state |= MK_LBUTTON; - if ( GetKeyState( VK_MBUTTON ) ) + if ( GetKeyState( VK_MBUTTON ) & (1<<15) ) state |= MK_MBUTTON; - if ( GetKeyState( VK_RBUTTON ) ) + if ( GetKeyState( VK_RBUTTON ) & (1<<15) ) state |= MK_RBUTTON; POINT pt;