Support for PgUp/PgDown

This commit is contained in:
Martin Pulec
2019-11-27 15:35:15 +01:00
parent 5d39d49879
commit 5f349ea55a
4 changed files with 12 additions and 4 deletions

View File

@@ -344,6 +344,8 @@ static string get_keycode_representation(int64_t ch) {
case K_DOWN: return "K_DOWN";
case K_LEFT: return "K_LEFT";
case K_RIGHT: return "K_RIGHT";
case K_PGUP: return "K_PGUP";
case K_PGDOWN: return "K_PGDOWN";
}
if (ch >= 1 && ch <= 'z' - 'a' + 1) {

View File

@@ -105,10 +105,12 @@ private:
#endif // __cplusplus
// values are byte represenations of escape sequences (without ESC itself)
#define K_UP 0x1b5b41
#define K_DOWN 0x1b5b42
#define K_RIGHT 0x1b5b43
#define K_LEFT 0x1b5b44
#define K_UP 0x1b5b41
#define K_DOWN 0x1b5b42
#define K_RIGHT 0x1b5b43
#define K_LEFT 0x1b5b44
#define K_PGUP 0x1b5b357e
#define K_PGDOWN 0x1b5b367e
#define K_CTRL(x) (1 + ((x) >= 'A' && (x) <= 'Z' ? (x) - 'A' + 'a' : (x)) - 'a')
#define K_CTRL_UP 0x1b5b313b3541LL
#define K_CTRL_DOWN 0x1b5b313b3542LL

View File

@@ -1014,6 +1014,8 @@ static int64_t translate_glut_to_ug(int key, bool is_special) {
case GLUT_KEY_UP: return K_UP;
case GLUT_KEY_RIGHT: return K_RIGHT;
case GLUT_KEY_DOWN: return K_DOWN;
case GLUT_KEY_PAGE_UP: return K_PGUP;
case GLUT_KEY_PAGE_DOWN: return K_PGDOWN;
}
} else {
if (glutGetModifiers() == 0) {

View File

@@ -226,6 +226,8 @@ static int64_t translate_sdl_key_to_ug(SDL_Keysym sym) {
case SDLK_LEFT: return K_LEFT;
case SDLK_DOWN: return K_DOWN;
case SDLK_UP: return K_UP;
case SDLK_PAGEDOWN: return K_PGDOWN;
case SDLK_PAGEUP: return K_PGUP;
}
return -1;
}