Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 26 additions and 6 deletions.
  1. +26 −6 gemrb/plugins/SDLVideo/SDLVideo.cpp
View
32 gemrb/plugins/SDLVideo/SDLVideo.cpp
@@ -164,6 +164,7 @@ int SDLVideoDriver::ProcessEvent(const SDL_Event & event)
SDL_Keycode key = SDLK_UNKNOWN;
int modstate = GetModState(event.key.keysym.mod);
+ SDLKey sym = event.key.keysym.sym;
/* Loop until there are no events left on the queue */
switch (event.type) {
@@ -174,7 +175,7 @@ int SDLVideoDriver::ProcessEvent(const SDL_Event & event)
return GEM_OK;
break;
case SDL_KEYUP:
- switch(event.key.keysym.sym) {
+ switch(sym) {
case SDLK_LALT:
case SDLK_RALT:
key = GEM_ALT;
@@ -192,8 +193,8 @@ int SDLVideoDriver::ProcessEvent(const SDL_Event & event)
}
// fallthrough
default:
- if (event.key.keysym.sym<256) {
- key = event.key.keysym.sym;
+ if (sym < 256) {
+ key = sym;
}
break;
}
@@ -201,7 +202,7 @@ int SDLVideoDriver::ProcessEvent(const SDL_Event & event)
EvntManager->KeyRelease( key, modstate );
break;
case SDL_KEYDOWN:
- if ((event.key.keysym.sym == SDLK_SPACE) && modstate & GEM_MOD_CTRL) {
+ if ((sym == SDLK_SPACE) && modstate & GEM_MOD_CTRL) {
core->PopupConsole();
break;
}
@@ -210,14 +211,31 @@ int SDLVideoDriver::ProcessEvent(const SDL_Event & event)
#else
key = event.key.keysym.unicode;
#endif
- switch (event.key.keysym.sym) {
+ // reenable special numpad keys unless numlock is off
+ if (SDL_GetModState() & KMOD_NUM) {
+ switch (sym) {
+ case SDLK_KP1: sym = SDLK_1; break;
+ case SDLK_KP2: sym = SDLK_2; break;
+ case SDLK_KP3: sym = SDLK_3; break;
+ case SDLK_KP4: sym = SDLK_4; break;
+ // 5 is not special
+ case SDLK_KP6: sym = SDLK_6; break;
+ case SDLK_KP7: sym = SDLK_7; break;
+ case SDLK_KP8: sym = SDLK_8; break;
+ case SDLK_KP9: sym = SDLK_9; break;
+ default: break;
+ }
+ }
+ switch (sym) {
case SDLK_ESCAPE:
key = GEM_ESCAPE;
break;
case SDLK_END:
+ case SDLK_KP1:
key = GEM_END;
break;
case SDLK_HOME:
+ case SDLK_KP7:
key = GEM_HOME;
break;
case SDLK_UP:
@@ -258,9 +276,11 @@ int SDLVideoDriver::ProcessEvent(const SDL_Event & event)
key = GEM_TAB;
break;
case SDLK_PAGEUP:
+ case SDLK_KP9:
key = GEM_PGUP;
break;
case SDLK_PAGEDOWN:
+ case SDLK_KP3:
key = GEM_PGDOWN;
break;
case SDLK_SCROLLOCK:
@@ -280,7 +300,7 @@ int SDLVideoDriver::ProcessEvent(const SDL_Event & event)
case SDLK_F12:
//assuming they come sequentially,
//also, there is no need to ever produce more than 12
- key = GEM_FUNCTION1+event.key.keysym.sym-SDLK_F1;
+ key = GEM_FUNCTION1 + sym-SDLK_F1;
break;
default:
if (( key != 0 )) {

No commit comments for this range

Something went wrong with that request. Please try again.