From 2b1f95dcc2f80cd148ab9e70b9a3bece92541d59 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 9 Apr 2003 17:05:39 +0000 Subject: [PATCH] keypad and function (f1-f10) suppport (currently only vo_sdl and the terminal input code supports it). Patch by Vladimir Mosgalin git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9892 b3059339-0415-0410-9bf9-f77b7e298cf2 --- input/input.c | 24 ++++++++++++++++++++++++ libvo/vo_sdl.c | 22 ++++++++++++++++++++++ libvo/wskeys.h | 22 ++++++++++++++++++++++ libvo/x11_common.c | 33 +++++++++++++++++++++++++++++++++ osdep/keycodes.h | 17 +++++++++++++++++ 5 files changed, 118 insertions(+) diff --git a/input/input.c b/input/input.c index 36c0a43de4..080bc16bb6 100644 --- a/input/input.c +++ b/input/input.c @@ -136,6 +136,30 @@ static mp_key_name_t key_names[] = { { KEY_LEFT, "LEFT" }, { KEY_DOWN, "DOWN" }, { KEY_UP, "UP" }, + { KEY_F+1, "F1" }, + { KEY_F+2, "F2" }, + { KEY_F+3, "F3" }, + { KEY_F+4, "F4" }, + { KEY_F+5, "F5" }, + { KEY_F+6, "F6" }, + { KEY_F+7, "F7" }, + { KEY_F+8, "F8" }, + { KEY_F+9, "F9" }, + { KEY_F+10, "F10" }, + { KEY_KP0, "KP0" }, + { KEY_KP1, "KP1" }, + { KEY_KP2, "KP2" }, + { KEY_KP3, "KP3" }, + { KEY_KP4, "KP4" }, + { KEY_KP5, "KP5" }, + { KEY_KP6, "KP6" }, + { KEY_KP7, "KP7" }, + { KEY_KP8, "KP8" }, + { KEY_KP9, "KP9" }, + { KEY_KPDEL, "KP_DEL" }, + { KEY_KPDEC, "KP_DEL" }, + { KEY_KPINS, "KP0" }, + { KEY_KPENTER, "KP_ENTER" }, { MOUSE_BTN0, "MOUSE_BTN0" }, { MOUSE_BTN1, "MOUSE_BTN1" }, { MOUSE_BTN2, "MOUSE_BTN2" }, diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c index 69d0ea5869..80a9930b4c 100644 --- a/libvo/vo_sdl.c +++ b/libvo/vo_sdl.c @@ -1256,6 +1256,16 @@ static void check_events (void) case SDLK_RETURN: mplayer_put_key(KEY_ENTER);break; case SDLK_ESCAPE: mplayer_put_key(KEY_ESC);break; case SDLK_q: mplayer_put_key('q');break; + case SDLK_F1: mplayer_put_key(KEY_F+1);break; + case SDLK_F2: mplayer_put_key(KEY_F+2);break; + case SDLK_F3: mplayer_put_key(KEY_F+3);break; + case SDLK_F4: mplayer_put_key(KEY_F+4);break; + case SDLK_F5: mplayer_put_key(KEY_F+5);break; + case SDLK_F6: mplayer_put_key(KEY_F+6);break; + case SDLK_F7: mplayer_put_key(KEY_F+7);break; + case SDLK_F8: mplayer_put_key(KEY_F+8);break; + case SDLK_F9: mplayer_put_key(KEY_F+9);break; + case SDLK_F10: mplayer_put_key(KEY_F+10);break; /*case SDLK_o: mplayer_put_key('o');break; case SDLK_SPACE: mplayer_put_key(' ');break; case SDLK_p: mplayer_put_key('p');break;*/ @@ -1289,6 +1299,18 @@ static void check_events (void) case SDLK_SLASH: case SDLK_KP_DIVIDE: mplayer_put_key('/'); break; #endif + case SDLK_KP0: mplayer_put_key(KEY_KP0); break; + case SDLK_KP1: mplayer_put_key(KEY_KP1); break; + case SDLK_KP2: mplayer_put_key(KEY_KP2); break; + case SDLK_KP3: mplayer_put_key(KEY_KP3); break; + case SDLK_KP4: mplayer_put_key(KEY_KP4); break; + case SDLK_KP5: mplayer_put_key(KEY_KP5); break; + case SDLK_KP6: mplayer_put_key(KEY_KP6); break; + case SDLK_KP7: mplayer_put_key(KEY_KP7); break; + case SDLK_KP8: mplayer_put_key(KEY_KP8); break; + case SDLK_KP9: mplayer_put_key(KEY_KP9); break; + case SDLK_KP_PERIOD: mplayer_put_key(KEY_KPDEC); break; + case SDLK_KP_ENTER: mplayer_put_key(KEY_KPENTER); break; default: //printf("got scancode: %d keysym: %d mod: %d %d\n", event.key.keysym.scancode, keypressed, event.key.keysym.mod); mplayer_put_key(keypressed); diff --git a/libvo/wskeys.h b/libvo/wskeys.h index bf61cf82ef..18eae2465c 100644 --- a/libvo/wskeys.h +++ b/libvo/wskeys.h @@ -102,6 +102,28 @@ #define wsGrayMinus 0xad + 256 #define wsGrayMul 0xaa + 256 #define wsGrayDiv 0xaf + 256 +#define wsGrayDecimal 0xae + 256 +#define wsGray0 0xb0 + 256 +#define wsGray1 0xb1 + 256 +#define wsGray2 0xb2 + 256 +#define wsGray3 0xb3 + 256 +#define wsGray4 0xb4 + 256 +#define wsGray5 0xb5 + 256 +#define wsGray6 0xb6 + 256 +#define wsGray7 0xb7 + 256 +#define wsGray8 0xb8 + 256 +#define wsGray9 0xb9 + 256 +#define wsGrayHome 0x95 + 256 +#define wsGrayLeft 0x96 + 256 +#define wsGrayUp 0x97 + 256 +#define wsGrayRight 0x98 + 256 +#define wsGrayDown 0x99 + 256 +#define wsGrayPgUp 0x9a + 256 +#define wsGrayPgDn 0x9b + 256 +#define wsGrayEnd 0x9c + 256 +#define wsGray5Dup 0x9d + 256 +#define wsGrayInsert 0x9e + 256 +#define wsGrayDelete 0x9f + 256 #endif diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 820bad441a..9d35dc2d5e 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -434,6 +434,16 @@ void vo_x11_putkey(int key){ case wsEnd: mplayer_put_key(KEY_END); break; case wsPageUp: mplayer_put_key(KEY_PAGE_UP); break; case wsPageDown: mplayer_put_key(KEY_PAGE_DOWN); break; + case wsF1: mplayer_put_key(KEY_F+1); break; + case wsF2: mplayer_put_key(KEY_F+2); break; + case wsF3: mplayer_put_key(KEY_F+3); break; + case wsF4: mplayer_put_key(KEY_F+4); break; + case wsF5: mplayer_put_key(KEY_F+5); break; + case wsF6: mplayer_put_key(KEY_F+6); break; + case wsF7: mplayer_put_key(KEY_F+7); break; + case wsF8: mplayer_put_key(KEY_F+8); break; + case wsF9: mplayer_put_key(KEY_F+9); break; + case wsF10: mplayer_put_key(KEY_F+10); break; case wsq: case wsQ: mplayer_put_key('q'); break; case wsp: @@ -448,6 +458,29 @@ void vo_x11_putkey(int key){ case wsDiv: mplayer_put_key('/'); break; case wsLess: mplayer_put_key('<'); break; case wsMore: mplayer_put_key('>'); break; + case wsGray0: mplayer_put_key(KEY_KP0); break; + case wsGrayEnd: + case wsGray1: mplayer_put_key(KEY_KP1); break; + case wsGrayDown: + case wsGray2: mplayer_put_key(KEY_KP2); break; + case wsGrayPgDn: + case wsGray3: mplayer_put_key(KEY_KP3); break; + case wsGrayLeft: + case wsGray4: mplayer_put_key(KEY_KP4); break; + case wsGray5Dup: + case wsGray5: mplayer_put_key(KEY_KP5); break; + case wsGrayRight: + case wsGray6: mplayer_put_key(KEY_KP6); break; + case wsGrayHome: + case wsGray7: mplayer_put_key(KEY_KP7); break; + case wsGrayUp: + case wsGray8: mplayer_put_key(KEY_KP8); break; + case wsGrayPgUp: + case wsGray9: mplayer_put_key(KEY_KP9); break; + case wsGrayDecimal: mplayer_put_key(KEY_KPDEC); break; + case wsGrayInsert: mplayer_put_key(KEY_KPINS); break; + case wsGrayDelete: mplayer_put_key(KEY_KPDEL); break; + case wsGrayEnter: mplayer_put_key(KEY_KPENTER); break; case wsm: case wsM: mplayer_put_key('m'); break; case wso: diff --git a/osdep/keycodes.h b/osdep/keycodes.h index 437ba0e524..b2e931c8aa 100644 --- a/osdep/keycodes.h +++ b/osdep/keycodes.h @@ -40,3 +40,20 @@ #define KEY_XF86_STOP (KEY_XF86_BASE+2) #define KEY_XF86_PREV (KEY_XF86_BASE+3) #define KEY_XF86_NEXT (KEY_XF86_BASE+4) + +/* Keypad keys */ +#define KEY_KEYPAD (KEY_BASE+32) +#define KEY_KP0 (KEY_KEYPAD+0) +#define KEY_KP1 (KEY_KEYPAD+1) +#define KEY_KP2 (KEY_KEYPAD+2) +#define KEY_KP3 (KEY_KEYPAD+3) +#define KEY_KP4 (KEY_KEYPAD+4) +#define KEY_KP5 (KEY_KEYPAD+5) +#define KEY_KP6 (KEY_KEYPAD+6) +#define KEY_KP7 (KEY_KEYPAD+7) +#define KEY_KP8 (KEY_KEYPAD+8) +#define KEY_KP9 (KEY_KEYPAD+9) +#define KEY_KPDEC (KEY_KEYPAD+10) +#define KEY_KPINS (KEY_KEYPAD+11) +#define KEY_KPDEL (KEY_KEYPAD+12) +#define KEY_KPENTER (KEY_KEYPAD+13)