Hardware buttons on pocket pc

I found my code that fixed support on pocket pc’s, but don’t have time
to check it against current CVS and to patch, so I’m hoping that
someone else can do it today, otherwise I guess I’ll do it tomorow.

In src/video/wincommon/SDL_sysevents.c in function
WIN_GetKeyboardState I either edited or added the following that got
the buttons working (I did this so long ago I had trouble remembering
any of the details, hooray for comments though).

#ifdef USE_GETKEYSTATE
// Kokido 10/17/02: CE devices use GetKeyState, not GetKeyboardState
SDLMod state;
Uint8 *kstate = SDL_GetKeyState(NULL);

state = KMOD_NONE;
	if ( GetKeyState(VK_LSHIFT) ) {
		state |= KMOD_LSHIFT;
	}
	if ( GetKeyState(VK_RSHIFT) ) {
		state |= KMOD_RSHIFT;
	}
	if ( GetKeyState(VK_LCONTROL) ) {
		state |= KMOD_LCTRL;
	}
	if ( GetKeyState(VK_RCONTROL) ) {
		state |= KMOD_RCTRL;
	}
	if ( GetKeyState(VK_LMENU) ) {
		state |= KMOD_LALT;
	}
	if ( GetKeyState(VK_RMENU) ) {
		state |= KMOD_RALT;
	}
	
	// Numlock is'nt usually present on CE devices, listed for

completeness
if ( GetAsyncKeyState(VK_NUMLOCK) ) {
state |= KMOD_NUM;
kstate[SDLK_NUMLOCK] = SDL_PRESSED;
}
if ( GetAsyncKeyState(VK_CAPITAL) ) {
state |= KMOD_CAPS;
kstate[SDLK_CAPSLOCK] = SDL_PRESSED;
}

SDL_SetModState(state);

#endif

That’s the fix? Awesome. :slight_smile: Hoped it would be something simple like that.
I’ve verified that that block of code is not present in CVS…

You can patch the CVS? Do you have special permissions in the CVS, or can
anyone do that? That’d be very handy. :)On Sunday 21 September 2003 08:24 am, Phoenix Kokido wrote:

I found my code that fixed support on pocket pc’s, but don’t have time
to check it against current CVS and to patch, so I’m hoping that
someone else can do it today, otherwise I guess I’ll do it tomorow.

I have just tested this... the code compiles fine, and probably works(can't be sure though, ipaq's not having ctrl, alt, shift, or numlock keys), but does not fix the arrow keys. :( You sure you didn't modify anything in SDL_dibevents.c too?On Sunday 21 September 2003 08:24 am, Phoenix Kokido wrote: > I found my code that fixed support on pocket pc's, but don't have time > to check it against current CVS and to patch, so I'm hoping that > someone else can do it today, otherwise I guess I'll do it tomorow. > > In src/video/wincommon/SDL_sysevents.c in function > WIN_GetKeyboardState I either edited or added the following that got > the buttons working (I did this so long ago I had trouble remembering > any of the details, hooray for comments though). >

IIRC it returns different keycodes/keysyms than SDL has those keys
mapped too. The code that was in SDL last year when I made those
changes sent SDL_KEYDOWN events with no keysyms whatever, I focused on
fixing that first, but my dev system went down before I could fix the
mapping, and I never got around to reinstalling the Embedded Tools
again. I tested the key modifiers before using the soft keyboard.
For now, after the the patch to SDL_Sysevents.c is made, the only way
to read the hardware keys is to check the keysyms with the one you
want for your button. I’ll try to address it better tomorow when I
have access to my dev system and my ipaq is back in it’s cradle.

I have no special abilities to patch CVS. We just prepare a diff and
send it to either Sam directly or to the mailing list, depending on
the size of the patch.

Tyler Montbriand wrote:

I found my code that fixed support on pocket pc’s, but don’t have time
to check it against current CVS and to patch, so I’m hoping that
someone else can do it today, otherwise I guess I’ll do it tomorow.

In src/video/wincommon/SDL_sysevents.c in function
WIN_GetKeyboardState I either edited or added the following that got
the buttons working (I did this so long ago I had trouble remembering
any of the details, hooray for comments though).

I have just tested this... the code compiles fine, and probably

works(can’t> On Sunday 21 September 2003 08:24 am, Phoenix Kokido wrote:

be sure though, ipaq’s not having ctrl, alt, shift, or numlock keys), but
does not fix the arrow keys. :frowning: You sure you didn’t modify anything in
SDL_dibevents.c too?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I found it! :slight_smile:

It has to do with the UNICODE translation code, in SDL_dibevents.c, in the
#ifdef NO_GETKEYBOARDSTATE’ block in DIB_HandleMessage(). The error
handling is a little… aggressive. If it can’t translate from unicode, it
wipes out the virtual keycode. Except when unicode’s not enabled - in that
case it ALWAYS wipes out the keycode. :slight_smile: I’ve attached the difference from
CVS.
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL_dibevents.patch
Type: text/x-diff
Size: 90 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030921/6ba392d2/attachment.patch