[MPlayer-dev-eng] [PATCH] binding to keypad & functional keys

Vladimir Mosgalin mosgalin at VM10124.spb.edu
Sat Mar 29 20:08:38 CET 2003


On Mon, 24 Mar 2003, Vladimir Mosgalin wrote:

Here goes this patch for current cvs.

VM>AB>the linux/keycodes.h is probably bad.  Get here a list of the
VM>AB>keycodes for the keypad:
VM>AB>http://www.georgehernandez.com/xVB/zMisc/Keyboarding.htm#Numeric%20Keypad%20KeyCodes
VM>
VM>Are you really sure? As far as I can see, codes in keycodes.h are mostly
VM>random, look at "Control keys" - I see no logic there except comfort way
VM>to define some similar keys.
VM>
VM>Bindings for these defines to actual keys for console, x11 and sdl go in
VM>linux/getch2.c, libvo/x11_common.c and libvo/vo_sdl.c accordingly. And
VM>these defines can be set to any values, in my opinion.

-- 

Vladimir
-------------- next part --------------
diff -uNr main.orig/input/input.c main/input/input.c
--- main.orig/input/input.c	Sat Mar 29 20:31:06 2003
+++ main/input/input.c	Sat Mar 29 20:44:04 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 main.orig/libvo/vo_sdl.c main/libvo/vo_sdl.c
--- main.orig/libvo/vo_sdl.c	Sat Mar 29 20:31:06 2003
+++ main/libvo/vo_sdl.c	Sat Mar 29 20:45:41 2003
@@ -1256,6 +1256,36 @@
 				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 +1319,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 main.orig/libvo/wskeys.h main/libvo/wskeys.h
--- main.orig/libvo/wskeys.h	Sat Mar 29 20:31:06 2003
+++ main/libvo/wskeys.h	Sat Mar 29 20:44:04 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 main.orig/libvo/x11_common.c main/libvo/x11_common.c
--- main.orig/libvo/x11_common.c	Sat Mar 29 20:31:06 2003
+++ main/libvo/x11_common.c	Sat Mar 29 20:44:04 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 main.orig/osdep/keycodes.h main/osdep/keycodes.h
--- main.orig/osdep/keycodes.h	Sat Mar 29 20:31:07 2003
+++ main/osdep/keycodes.h	Sat Mar 29 20:44:04 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