--- deliantra/Deliantra-Client/Client.xs 2006/12/08 15:07:08 1.166 +++ deliantra/Deliantra-Client/Client.xs 2006/12/09 02:21:25 1.167 @@ -361,6 +361,10 @@ return n + 1; } +/* SDL should provide this, really. */ +#define SDLK_MODIFIER_MIN 300 +#define SDLK_MODIFIER_MAX 314 + MODULE = CFPlus PACKAGE = CFPlus PROTOTYPES: ENABLE @@ -373,6 +377,9 @@ IV iv; } *civ, const_iv[] = { # define const_iv(name) { # name, (IV)name } + const_iv (SDLK_MODIFIER_MIN), + const_iv (SDLK_MODIFIER_MAX), + const_iv (SDL_ACTIVEEVENT), const_iv (SDL_KEYDOWN), const_iv (SDL_KEYUP), @@ -391,6 +398,11 @@ const_iv (SDL_VIDEORESIZE), const_iv (SDL_VIDEOEXPOSE), const_iv (SDL_USEREVENT), + + const_iv (SDL_APPINPUTFOCUS), + const_iv (SDL_APPMOUSEFOCUS), + const_iv (SDL_APPACTIVE), + const_iv (SDLK_KP0), const_iv (SDLK_KP1), const_iv (SDLK_KP2), @@ -455,27 +467,31 @@ const_iv (SDLK_POWER), const_iv (SDLK_EURO), const_iv (SDLK_UNDO), + const_iv (KMOD_NONE), + const_iv (KMOD_SHIFT), const_iv (KMOD_LSHIFT), const_iv (KMOD_RSHIFT), + const_iv (KMOD_CTRL), const_iv (KMOD_LCTRL), const_iv (KMOD_RCTRL), + const_iv (KMOD_ALT), const_iv (KMOD_LALT), const_iv (KMOD_RALT), + const_iv (KMOD_META), const_iv (KMOD_LMETA), const_iv (KMOD_RMETA), const_iv (KMOD_NUM), const_iv (KMOD_CAPS), const_iv (KMOD_MODE), - const_iv (KMOD_CTRL), - const_iv (KMOD_SHIFT), - const_iv (KMOD_ALT), - const_iv (KMOD_META) # undef const_iv }; for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); + + assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); + assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); } int @@ -589,6 +605,7 @@ hv_store (hv, "state", 5, newSViv (ev.key.state), 0); hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); + hv_store (hv, "cmod", 4, newSViv (SDL_GetModState ()), 0); /* current mode */ hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); break;