polled input sticking
Archives Forums/BlitzMax Bug Reports/polled input sticking
| ||
When holding a key down continuously the key eventually stops returning its pressed state until you release and press again? I am running in windowed mode. And calling enablepolledinput() All works fine under Windows and OSX but not Linux. Here is an example of the problem, use the left arrow key to change screen colour. Also if you change KEY_LEFT to KEY_ESCAPE then nothing ever happens? Const WINDOW_WIDTH=640 Const WINDOW_HEIGHT=384 Local wx=(GadgetWidth(Desktop())-WINDOW_WIDTH)/2 Local wy=(GadgetHeight(Desktop())-WINDOW_HEIGHT)/2 Global main_window:TGadget = CreateWindow( Title$,wx,wy,WINDOW_WIDTH,WINDOW_HEIGHT,Null,WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS) Global canvas:TGadget=CreateCanvas(0,0,WINDOW_WIDTH,WINDOW_HEIGHT,main_window) SetGraphics CanvasGraphics(canvas) ActivateGadget canvas CreateTimer(10) enablepolledinput() While WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_TIMERTICK If KeyDown(KEY_LEFT) SetClsColor Rnd(255),Rnd(255),Rnd(255) Cls Flip EndIf EndSelect End While |
| ||
Problem is not just with polled input. Here is another example but this time using EVENT_KEYDOWN and EVENT_KEYUP hold a key down and watch the KEYUP event being generated?Const WINDOW_WIDTH=640 Const WINDOW_HEIGHT=384 Global hit[1024] Function MyKeyDown( key:Int ) Return HIT[Key] End Function Local wx=(GadgetWidth(Desktop())-WINDOW_WIDTH)/2 Local wy=(GadgetHeight(Desktop())-WINDOW_HEIGHT)/2 Global main_window:TGadget = CreateWindow( Title$,wx,wy,WINDOW_WIDTH,WINDOW_HEIGHT,Null,WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS) Global canvas:TGadget=CreateCanvas(0,0,WINDOW_WIDTH,WINDOW_HEIGHT,main_window) SetGraphics CanvasGraphics(canvas) ActivateGadget canvas CreateTimer(10) 'enablepolledinput() While WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_KEYUP DebugLog "KEY UP" Select EventData() Case KEY_LEFT HIT[KEY_LEFT]=0 End Select Case EVENT_KEYDOWN DebugLog "KEY DOWN" Select EventData() Case KEY_LEFT HIT[KEY_LEFT]=1 End Select Case EVENT_TIMERTICK If MyKeyDown(KEY_LEFT) SetClsColor Rnd(255),Rnd(255),Rnd(255) Cls Flip EndIf EndSelect End While |
| ||
See this thread for further exploration: http://www.blitzbasic.com/Community/posts.php?topic=65197 |
| ||
My spacekey is sticking in Windows XP. |
| ||
I doubt this will resolve this issue, but if you are using a USB KVM, the KVM will make keys "stick" like this. I resolved this by not sharing the components when I need the polling more responsive. |