Grab the input in setup when reading a new key binding, so that Windows
CE buttons are read properly. Map buttons to PC function keys. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1594
This commit is contained in:
parent
3a4db25094
commit
779a2157c0
3 changed files with 31 additions and 0 deletions
|
|
@ -57,6 +57,11 @@ static int KeyPressCallback(txt_window_t *window, int key,
|
|||
}
|
||||
}
|
||||
|
||||
static void ReleaseGrab(TXT_UNCAST_ARG(window), TXT_UNCAST_ARG(unused))
|
||||
{
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
}
|
||||
|
||||
static void OpenPromptWindow(txt_key_input_t *key_input)
|
||||
{
|
||||
txt_window_t *window;
|
||||
|
|
@ -78,6 +83,13 @@ static void OpenPromptWindow(txt_key_input_t *key_input)
|
|||
// Disable key mappings while we prompt for the key press
|
||||
|
||||
TXT_EnableKeyMapping(0);
|
||||
|
||||
// Grab input while reading the key. On Windows Mobile
|
||||
// handheld devices, the hardware keypresses are only
|
||||
// detected when input is grabbed.
|
||||
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
TXT_SignalConnect(window, "closed", ReleaseGrab, NULL);
|
||||
}
|
||||
|
||||
static void TXT_KeyInputSizeCalc(TXT_UNCAST_ARG(key_input))
|
||||
|
|
|
|||
|
|
@ -362,6 +362,15 @@ static int TranslateKey(SDL_keysym *sym)
|
|||
case SDLK_PAGEUP: return KEY_PGUP;
|
||||
case SDLK_PAGEDOWN: return KEY_PGDN;
|
||||
|
||||
#ifdef SDL_HAVE_APP_KEYS
|
||||
case SDLK_APP1: return KEY_F1;
|
||||
case SDLK_APP2: return KEY_F2;
|
||||
case SDLK_APP3: return KEY_F3;
|
||||
case SDLK_APP4: return KEY_F4;
|
||||
case SDLK_APP5: return KEY_F5;
|
||||
case SDLK_APP6: return KEY_F6;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return tolower(sym->sym);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,6 +368,15 @@ static int TranslateKey(SDL_keysym *sym)
|
|||
case SDLK_PAGEUP: return KEY_PGUP;
|
||||
case SDLK_PAGEDOWN: return KEY_PGDN;
|
||||
|
||||
#ifdef SDL_HAVE_APP_KEYS
|
||||
case SDLK_APP1: return KEY_F1;
|
||||
case SDLK_APP2: return KEY_F2;
|
||||
case SDLK_APP3: return KEY_F3;
|
||||
case SDLK_APP4: return KEY_F4;
|
||||
case SDLK_APP5: return KEY_F5;
|
||||
case SDLK_APP6: return KEY_F6;
|
||||
#endif
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
|
@ -508,6 +517,7 @@ static char *SpecialKeyName(int key)
|
|||
case KEYP_MINUS: return "PAD-";
|
||||
case KEYP_DIVIDE: return "PAD/";
|
||||
*/
|
||||
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue