[MPlayer-dev-eng] [PATCH] binding to keypad & functional keys
Vladimir Mosgalin
mosgalin at VM10124.spb.edu
Sun Mar 23 17:52:02 CET 2003
This patch adds ability to bind commands to functional keys and keypad.
The functional keys part works with x11 drivers (except sdl), sdl and
console, keypad is supported only in x11 and sdl - it isn't possible to
distinguish keypad from other keys in console, at least no easy way...
Also it fixes bug in vo_sdl - now esc produces KEY_ESC, not just
quits, like in other drivers. I hate when esc quits player and there is
no way to change it...
There is one line which i'm not sure of, in linux/keycodes.h:
#define KEY_KEYPAD (KEY_BASE+32)
32 is number from my head - it works without problems, though. Maybe it
should be changed.
Patch is against 0.90rc5.
--
Vladimir
-------------- next part --------------
diff -uNr MPlayer-0.90rc5/input/input.c MPlayer-0.90rc5.new/input/input.c
--- MPlayer-0.90rc5/input/input.c Sun Jan 12 21:56:48 2003
+++ MPlayer-0.90rc5.new/input/input.c Sun Mar 23 19:21:13 2003
@@ -136,6 +136,30 @@
{ 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 -uNr MPlayer-0.90rc5/libvo/vo_sdl.c MPlayer-0.90rc5.new/libvo/vo_sdl.c
--- MPlayer-0.90rc5/libvo/vo_sdl.c Mon Jan 13 04:20:21 2003
+++ MPlayer-0.90rc5.new/libvo/vo_sdl.c Sun Mar 23 19:23:20 2003
@@ -1254,11 +1254,44 @@
SDL_ShowCursor(1);
mplayer_put_key(KEY_ENTER);
break;
- case SDLK_ESCAPE:
+ case SDLK_ESCAPE:
+ SDL_ShowCursor(1);
+ mplayer_put_key(KEY_ESC);
+ break;
case SDLK_q:
SDL_ShowCursor(1);
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;*/
@@ -1292,6 +1325,18 @@
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 -uNr MPlayer-0.90rc5/libvo/wskeys.h MPlayer-0.90rc5.new/libvo/wskeys.h
--- MPlayer-0.90rc5/libvo/wskeys.h Fri Dec 14 20:37:45 2001
+++ MPlayer-0.90rc5.new/libvo/wskeys.h Sun Mar 23 19:21:05 2003
@@ -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 -uNr MPlayer-0.90rc5/libvo/x11_common.c MPlayer-0.90rc5.new/libvo/x11_common.c
--- MPlayer-0.90rc5/libvo/x11_common.c Mon Feb 10 23:48:59 2003
+++ MPlayer-0.90rc5.new/libvo/x11_common.c Sun Mar 23 19:22:18 2003
@@ -420,6 +420,16 @@
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:
@@ -434,6 +444,29 @@
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 -uNr MPlayer-0.90rc5/linux/keycodes.h MPlayer-0.90rc5.new/linux/keycodes.h
--- MPlayer-0.90rc5/linux/keycodes.h Sat Feb 24 23:30:12 2001
+++ MPlayer-0.90rc5.new/linux/keycodes.h Sun Mar 23 19:22:08 2003
@@ -34,3 +34,35 @@
#define KEY_DOWN (KEY_CRSR+2)
#define KEY_UP (KEY_CRSR+3)
+/* Keypad keys */
+#define KEY_KEYPAD (KEY_BASE+32)
+#define KEY_KEYPAD_0 (KEY_KEYPAD+0)
+#define KEY_KEYPAD_1 (KEY_KEYPAD+1)
+#define KEY_KEYPAD_2 (KEY_KEYPAD+2)
+#define KEY_KEYPAD_3 (KEY_KEYPAD+3)
+#define KEY_KEYPAD_4 (KEY_KEYPAD+4)
+#define KEY_KEYPAD_5 (KEY_KEYPAD+5)
+#define KEY_KEYPAD_6 (KEY_KEYPAD+6)
+#define KEY_KEYPAD_7 (KEY_KEYPAD+7)
+#define KEY_KEYPAD_8 (KEY_KEYPAD+8)
+#define KEY_KEYPAD_9 (KEY_KEYPAD+9)
+#define KEY_KEYPAD_DECIMAL (KEY_KEYPAD+10)
+#define KEY_KEYPAD_INSERT (KEY_KEYPAD+11)
+#define KEY_KEYPAD_DELETE (KEY_KEYPAD+12)
+#define KEY_KEYPAD_ENTER (KEY_KEYPAD+13)
+
+/* Keypad keys short name */
+#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_DECIMAL
+#define KEY_KPINS KEY_KEYPAD_INSERT
+#define KEY_KPDEL KEY_KEYPAD_DELETE
+#define KEY_KPENTER KEY_KEYPAD_ENTER
More information about the MPlayer-dev-eng
mailing list