[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] AES related question: How to keep track if my application is receiving input?




Hello to the list,

...Sorry for the long posting...

I'm having a question regarding input handling of GEM Windows.
My application need's to capture more input events than the AES evnt_() functions provide.
I need to keep track of the mouse position and key up / down press.
I would do this by using other TOS functions / interrupts, and then store the data into an event pipe. There is one problem - how do I know if I must ignore input, because the window has lost input focus or is inactive?

Will it be enough to watch for WM_BOTTOMED / WM_BACKDROPPED / WM_ICONIFY / WM_SHADED message, and if they occur, ignore further VDI mouse / key input until WM_TOPPED, WM_UNSHADED etc. arrives? I expect this won't be OK, because the application could be yielded. As far as I understand evnt_keybd / evnt_multi just informs me about key down.

I looked into SDL source code how it is done there, but I have one problem with that code (explained later). I don't know if evnt_keybd queues the Keyboard events or if it just waits for one event to occur.
But because of SDL's code I expect it is queuing the events...

In SDL Keyup / down it is done this way:

		resultat = evnt_multi(
			event_mask,
			0,0,0,
			mouse_event,x2,y2,w2,h2,
			0,0,0,0,0,
			buffer,
			10,
			&dummy,&dummy,&dummy,&kstate,&kc,&dummy
		);

		...

		if ( gem_currentkeyboard[i] && !gem_previouskeyboard[i] )
			SDL_PrivateKeyboard(SDL_PRESSED,
				SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));

		/* Key unpressed ? */
		if ( gem_previouskeyboard[i] && !gem_currentkeyboard[i] )
			SDL_PrivateKeyboard(SDL_RELEASED,
				SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));


I expect this code is working as long as the event routine is called often enough ( before the event queue is full). But the problem I have with this code is: If I call SDL_WaitEvent( endless ); it internally enters an endless loop which calls the evnt_multi function VERY often, until an event occured. This is only true when you use the SDL GEM backend, of course. What I don't like about it: it costs to much CPU time, so I want to use another way. ehm.... anyone implemented something like this and wants to share experience, or is there some xaees special function that could help me?
(something like xaaes_get_input_receiver_pid() ;) )

Anyone has information how to do it properly?

Kind regards,
m0n0