diff options
author | James Ross-Gowan <rossymiles@gmail.com> | 2014-01-20 00:20:02 +1100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-01-19 14:42:15 +0100 |
commit | 32c0df1b5374834145b4a373fcd560766b997c52 (patch) | |
tree | ddbc82c81ac86e156312c6fc045a9dc3dae55ec1 /osdep/terminal-win.c | |
parent | 55ea419ae32fa81df3835886ae82aa0b6916905c (diff) | |
download | mpv-32c0df1b5374834145b4a373fcd560766b997c52.tar.bz2 mpv-32c0df1b5374834145b4a373fcd560766b997c52.tar.xz |
w32: use the w32_common keymap in terminal-win too
Diffstat (limited to 'osdep/terminal-win.c')
-rw-r--r-- | osdep/terminal-win.c | 53 |
1 files changed, 13 insertions, 40 deletions
diff --git a/osdep/terminal-win.c b/osdep/terminal-win.c index 9d49936d70..918a073a17 100644 --- a/osdep/terminal-win.c +++ b/osdep/terminal-win.c @@ -33,6 +33,7 @@ #include "input/keycodes.h" #include "input/input.h" #include "terminal.h" +#include "osdep/w32_keyboard.h" int screen_width = 79; int screen_height = 24; @@ -121,52 +122,24 @@ static int getch2_internal(void) /*filter out keyevents*/ for (i = 0; i < retval; i++) { switch (eventbuffer[i].EventType) { - case KEY_EVENT: + case KEY_EVENT: { + KEY_EVENT_RECORD *record = &eventbuffer[i].Event.KeyEvent; + /*only a pressed key is interresting for us*/ - if (eventbuffer[i].Event.KeyEvent.bKeyDown == TRUE) { - /*check for special keys*/ - switch (eventbuffer[i].Event.KeyEvent.wVirtualKeyCode) { - case VK_HOME: - return MP_KEY_HOME; - case VK_END: - return MP_KEY_END; - case VK_DELETE: - return MP_KEY_DEL; - case VK_INSERT: - return MP_KEY_INS; - case VK_BACK: - return MP_KEY_BS; - case VK_PRIOR: - return MP_KEY_PGUP; - case VK_NEXT: - return MP_KEY_PGDWN; - case VK_RETURN: - return MP_KEY_ENTER; - case VK_ESCAPE: - return MP_KEY_ESC; - case VK_LEFT: - return MP_KEY_LEFT; - case VK_UP: - return MP_KEY_UP; - case VK_RIGHT: - return MP_KEY_RIGHT; - case VK_DOWN: - return MP_KEY_DOWN; - case VK_SHIFT: - continue; - } - /*check for function keys*/ - if (0x87 >= eventbuffer[i].Event.KeyEvent.wVirtualKeyCode && - eventbuffer[i].Event.KeyEvent.wVirtualKeyCode >= 0x70) - return MP_KEY_F + 1 + - eventbuffer[i].Event.KeyEvent.wVirtualKeyCode - 0x70; + if (record->bKeyDown) { + UINT vkey = record->wVirtualKeyCode; + bool ext = record->dwControlKeyState & ENHANCED_KEY; + + int mpkey = mp_w32_vkey_to_mpkey(vkey, ext); + if (mpkey) + return mpkey; /*only characters should be remaining*/ //printf("getch2: YOU PRESSED \"%c\" \n",eventbuffer[i].Event.KeyEvent.uChar.AsciiChar); - return eventbuffer[i].Event.KeyEvent.uChar.AsciiChar; + return eventbuffer[i].Event.KeyEvent.uChar.UnicodeChar; } break; - + } case MOUSE_EVENT: case WINDOW_BUFFER_SIZE_EVENT: case FOCUS_EVENT: |