Initial state of key modifiers

I noticed that in "SDL-1.1.6/src/events/SDL_keyboard.c"
in function at line 63: "int SDL_KeyboardInit(void)"
the initial state of key modifiers is KMOD_NONE

	SDL_ModState = KMOD_NONE;

This is ok when the program starts itself with
the permanent key modifiers (CapsLock, NumLock…)
in OFF state.
If they are ON SDL returns always the state reversed.
The part of the code that handle the changes is:

	case SDLK_NUMLOCK:
			modstate ^= KMOD_NUM;
			if ( ! (modstate&KMOD_NUM) )
				state = SDL_RELEASED;
			keysym->mod = (SDLMod)modstate;
			break;
	case SDLK_CAPSLOCK:
			modstate ^= KMOD_CAPS;
			if ( ! (modstate&KMOD_CAPS) )
				state = SDL_RELEASED;
			keysym->mod = (SDLMod)modstate;
			break;

that only invert the current bit state when the key is pressed.

I think that in SDL_KeyboardInit we must add something that
gets the current state of the keyboard to set the first
SDL_ModState properly.

Is this right?

Thanks for any comment.
Enzo.

I noticed that in "SDL-1.1.6/src/events/SDL_keyboard.c"
in function at line 63: "int SDL_KeyboardInit(void)"
the initial state of key modifiers is KMOD_NONE

The keyboard code should query the system for the current modifier state
when it obtains the keyboard focus. It doesn’t currently do this, but is
on the TODO list for SDL 1.2

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

I noticed that in "SDL-1.1.6/src/events/SDL_keyboard.c"
in function at line 63: "int SDL_KeyboardInit(void)"
the initial state of key modifiers is KMOD_NONE

This is fixed for Win32 in CVS, and will be part of the next CVS snapshot.

Thanks!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Sam Lantinga wrote:

This is fixed for Win32 in CVS, and will be part of the next CVS snapshot.

Thanks much!
The SDL team is incredibly fast in fixing bugs! :-)))

Bye,
Enzo.