polled input sticking

Miscellaneous Forums/Linux Discussion/polled input sticking

Have just got Pushy compiled and running, and I am having problems with polled input.

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.

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?

I am using Suse 10.1 not sure if this matters or not.

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



Guess I'll have to reply to this again since the posts have all gone missing.

It sticks on my Linux box too (Ubuntu 6.10) so it's not a SuSE problem.

I did notice an error in the output tab of the editor whilst the program was running though. I'll have to check later to see what it was.

The error is this:

bad fl_display= 136741528

Don't know what it means though.

Wellmt, I have posted that as a bug. Brucey seemed to think it may be a module not being loaded?

The problem seems to be worse than just polled input. I get KEYUP events when holding a key down? look at this:

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