[Plib-cvs] plib/src/pw pwWindows.cxx,1.11,1.12
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2004-04-09 00:18:32
|
Update of /cvsroot/plib/plib/src/pw In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14969/plib/src/pw Modified Files: pwWindows.cxx Log Message: Prevent Ctrl, Alt, Shift, etc from causing keystroke callbacks. Index: pwWindows.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pw/pwWindows.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pwWindows.cxx 8 Apr 2004 00:42:19 -0000 1.11 +++ pwWindows.cxx 9 Apr 2004 00:05:19 -0000 1.12 @@ -72,8 +72,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - int key = -1 ; + static int key = -1 ; static int updown = PW_UP ; + static int old_key = -1 ; // We need this because "key" changes case int button = -1 ; static int mb = 0 ; static int lastx = 0 ; @@ -120,13 +121,19 @@ case WM_KEYDOWN: /* If the key is already down, we are on auto-repeat. Break if the autorepeat is disabled. */ - if ( ( updown == PW_DOWN ) && !autoRepeat ) break ; + if ( ( updown == PW_DOWN ) && ( int(wParam) == old_key ) && !autoRepeat ) break ; updown = PW_DOWN ; + old_key = wParam ; /* FALLTHROUGH */ case WM_KEYUP: if ( uMsg == WM_KEYUP ) updown = PW_UP ; key = wParam ; + + /* Disable CTRL, SHIFT, CapsLock keys from making a callback */ + if ( ( key == VK_CONTROL ) || ( key == VK_SHIFT ) || ( key == VK_CAPITAL ) ) + break ; + switch ( key ) { case VK_F1: key = PW_KEY_F1; break; @@ -152,6 +159,7 @@ case VK_HOME: key = PW_KEY_HOME; break; case VK_END: key = PW_KEY_END; break; case VK_INSERT: key = PW_KEY_INSERT; break; + default: // don't do this for WinCE BYTE state[ 256 ]; |