[Plib-cvs] plib/src/pw pwWindows.cxx,1.10,1.11
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2004-04-08 00:55:23
|
Update of /cvsroot/plib/plib/src/pw In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6058/plib/src/pw Modified Files: pwWindows.cxx Log Message: Added John Fay's patch to make pwSetAutoRepeatKey work. Index: pwWindows.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pw/pwWindows.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pwWindows.cxx 6 Apr 2004 23:45:19 -0000 1.10 +++ pwWindows.cxx 8 Apr 2004 00:42:19 -0000 1.11 @@ -39,6 +39,8 @@ static int origin [2] = { 0, 0 } ; static int size [2] = { 640, 480 } ; +static bool autoRepeat = false ; + static pwResizeCB *resizeCB = NULL ; static pwExitCB *exitCB = NULL ; static pwKeybdFunc *kbCB = NULL ; @@ -71,7 +73,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { int key = -1 ; - int updown = PW_UP ; + static int updown = PW_UP ; int button = -1 ; static int mb = 0 ; static int lastx = 0 ; @@ -117,9 +119,13 @@ break; 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 ; + updown = PW_DOWN ; /* FALLTHROUGH */ case WM_KEYUP: + if ( uMsg == WM_KEYUP ) updown = PW_UP ; key = wParam ; switch ( key ) { @@ -185,7 +191,7 @@ void pwSetAutoRepeatKey ( bool enable ) { - fprintf(stderr,"pwSetAutoRepeatKey is not yet functional under Windows.\n" ) ; + autoRepeat = enable ; } |