changeset 16892:3470c810527b

libvo input cleanup: remove the dependency on libinput, remove most of the crappy mappings (like O->o or ESC->q).
author albeu
date Wed, 02 Nov 2005 21:50:55 +0000
parents 26cb0e11c9e9
children 8091dc510d18
files input/input.c libvo/vo_dfbmga.c libvo/vo_directfb2.c libvo/vo_directx.c libvo/vo_quartz.c libvo/vo_sdl.c libvo/vo_winvidix.c libvo/w32_common.c libvo/x11_common.c osdep/keycodes.h
diffstat 10 files changed, 92 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/input/input.c	Wed Nov 02 16:09:44 2005 +0000
+++ b/input/input.c	Wed Nov 02 21:50:55 2005 +0000
@@ -240,10 +240,27 @@
   { JOY_BTN8, "JOY_BTN8" },
   { JOY_BTN9, "JOY_BTN9" },
 
-  { KEY_XF86_PAUSE, "XF86_PAUSE" },
-  { KEY_XF86_STOP, "XF86_STOP" },
-  { KEY_XF86_PREV, "XF86_PREV" },
-  { KEY_XF86_NEXT, "XF86_NEXT" },
+  { KEY_POWER, "POWER" },
+  { KEY_MENU, "MENU" },
+  { KEY_PLAY, "PLAY" },
+  { KEY_PAUSE, "PAUSE" },
+  { KEY_PLAYPAUSE, "PLAYPAUSE" },
+  { KEY_STOP, "STOP" },
+  { KEY_FORWARD, "FORWARD" },
+  { KEY_REWIND, "REWIND" },
+  { KEY_NEXT, "NEXT" },
+  { KEY_PREV, "PREV" },
+  { KEY_VOLUME_UP, "VOLUME_UP" },
+  { KEY_VOLUME_DOWN, "VOLUME_DOWN" },
+  { KEY_MUTE, "MUTE" },
+
+  // These are kept for backward compatibility
+  { KEY_PAUSE, "XF86_PAUSE" },
+  { KEY_STOP, "XF86_STOP" },
+  { KEY_PREV, "XF86_PREV" },
+  { KEY_NEXT, "XF86_NEXT" },
+
+  { KEY_CLOSE_WIN, "CLOSE_WIN" },
 
   { 0, NULL }
 };
@@ -282,9 +299,11 @@
   { { '}', 0 }, "speed_mult 2.0" },
   { { KEY_BACKSPACE, 0 }, "speed_set 1.0" },
   { { 'q', 0 }, "quit" },
+  { { 'Q', 0 }, "quit" },
 #ifndef HAVE_NEW_GUI
   { { KEY_ESC, 0 }, "quit" },
   { { 'p', 0 }, "pause" },
+  { { 'P', 0 }, "pause" },
 #endif
   { { ' ', 0 }, "pause" },
   { { '.', 0 }, "frame_step" },
@@ -298,6 +317,7 @@
   { { KEY_INS, 0 }, "alt_src_step 1" },
   { { KEY_DEL, 0 }, "alt_src_step -1" },
   { { 'o', 0 }, "osd" },
+  { { 'O', 0 }, "osd" },
   { { 'z', 0 }, "sub_delay -0.1" },
   { { 'x', 0 }, "sub_delay +0.1" },
   { { 'g', 0 }, "sub_step -1" },
@@ -307,6 +327,7 @@
   { { '0', 0 }, "volume 1" },
   { { '*', 0 }, "volume 1" },
   { { 'm', 0 }, "mute" },
+  { { 'M', 0 }, "mute" },
   { { '1', 0 }, "contrast -1" },
   { { '2', 0 }, "contrast 1" },
   { { '3', 0 }, "brightness -1" },
@@ -358,10 +379,21 @@
   { { 'w', 0 }, "panscan -0.1" },
   { { 'e', 0 }, "panscan +0.1" },
 
-  { { KEY_XF86_PAUSE, 0 }, "pause" },
-  { { KEY_XF86_STOP, 0 }, "quit" },
-  { { KEY_XF86_PREV, 0 }, "seek -60" },
-  { { KEY_XF86_NEXT, 0 }, "seek +60" },
+  { { KEY_POWER, 0 }, "quit" },
+  { { KEY_MENU, 0 }, "osd" },
+  { { KEY_PLAY, 0 }, "pause" },
+  { { KEY_PAUSE, 0 }, "pause" },
+  { { KEY_PLAYPAUSE, 0 }, "pause" },
+  { { KEY_STOP, 0 }, "quit" },
+  { { KEY_FORWARD, 0 }, "seek 60" },
+  { { KEY_REWIND, 0 }, "seek -60" },
+  { { KEY_NEXT, 0 }, "pt_step 1" },
+  { { KEY_PREV, 0 }, "pt_step -1" },
+  { { KEY_VOLUME_UP, 0 }, "volume 1" },
+  { { KEY_VOLUME_DOWN, 0 }, "volume -1" },
+  { { KEY_MUTE, 0 }, "mute" },
+          
+  { { KEY_CLOSE_WIN, 0 }, "quit" },
 
   { { 0 }, NULL }
 };
--- a/libvo/vo_dfbmga.c	Wed Nov 02 16:09:44 2005 +0000
+++ b/libvo/vo_dfbmga.c	Wed Nov 02 21:50:55 2005 +0000
@@ -1439,7 +1439,7 @@
           if (event.type == DIET_KEYPRESS) {
                switch (event.key_symbol) {
                case DIKS_ESCAPE:
-                    mplayer_put_key( 'q' );
+                    mplayer_put_key( KEY_ESC );
                     break;
                case DIKS_PAGE_UP:
                     mplayer_put_key( KEY_PAGE_UP );
@@ -1473,33 +1473,43 @@
                     break;
 
                case DIKS_POWER:
-                    mplayer_put_key( 'q' );
+                    mplayer_put_key( KEY_POWER );
                     break;
                case DIKS_MENU:
-                    mplayer_put_key( 'o' );
+                    mplayer_put_key( KEY_MENU );
                     break;
                case DIKS_PLAY:
+                    mplayer_put_key( KEY_PLAY );
+                    break;
                case DIKS_STOP:
+                    mplayer_put_key( KEY_STOP );
+                    break;
                case DIKS_PAUSE:
+                    mplayer_put_key( KEY_PAUSE );
+                    break;
                case DIKS_PLAYPAUSE:
-                    mplayer_put_key( ' ' );
+                    mplayer_put_key( KEY_PLAYPAUSE );
                     break;
                case DIKS_FORWARD:
+                    mplayer_put_key( KEY_FORWARD );
+                    break;
                case DIKS_NEXT:
-                    mplayer_put_key( KEY_PAGE_UP );
+                    mplayer_put_key( KEY_NEXT );
                     break;
                case DIKS_REWIND:
+                    mplayer_put_key( KEY_REWIND );
+                    break;
                case DIKS_PREVIOUS:
-                    mplayer_put_key( KEY_PAGE_DOWN );
+                    mplayer_put_key( KEY_PREVIOUS );
                     break;
                case DIKS_VOLUME_UP:
-                    mplayer_put_key( '0' );
+                     mplayer_put_key( KEY_VOLUME_UP );
                     break;
                case DIKS_VOLUME_DOWN:
-                    mplayer_put_key( '9' );
+                    mplayer_put_key( KEY_VOLUME_DOWN );
                     break;
                case DIKS_MUTE:
-                    mplayer_put_key( 'm' );
+                    mplayer_put_key( KEY_MUTE );
                     break;
 
                default:
--- a/libvo/vo_directfb2.c	Wed Nov 02 16:09:44 2005 +0000
+++ b/libvo/vo_directfb2.c	Wed Nov 02 21:50:55 2005 +0000
@@ -909,7 +909,7 @@
      if (event.type == DIET_KEYPRESS) { 
     		switch (event.key_symbol) {
                                 case DIKS_ESCAPE:
-					mplayer_put_key('q');
+					mplayer_put_key(KEY_ESC);
 				break;
 				case DIKS_PAGE_UP: mplayer_put_key(KEY_PAGE_UP);break;
 				case DIKS_PAGE_DOWN: mplayer_put_key(KEY_PAGE_DOWN);break;
--- a/libvo/vo_directx.c	Wed Nov 02 16:09:44 2005 +0000
+++ b/libvo/vo_directx.c	Wed Nov 02 21:50:55 2005 +0000
@@ -889,7 +889,7 @@
 		}
         case WM_CLOSE:
 		{
-			mp_input_queue_cmd(mp_input_parse_cmd("quit"));
+			mplayer_put_key(KEY_CLOSE_WIN);
 			return 0;
 		}
         case WM_WINDOWPOSCHANGED:
--- a/libvo/vo_quartz.c	Wed Nov 02 16:09:44 2005 +0000
+++ b/libvo/vo_quartz.c	Wed Nov 02 21:50:55 2005 +0000
@@ -378,7 +378,7 @@
 		switch ( theHICommand.commandID )
 		{
 			case kHICommandQuit:
-				mplayer_put_key(KEY_ESC);
+				mplayer_put_key(KEY_CLOSE_WIN);
 				break;
 				
 			case kHalfScreenCmd:
@@ -476,7 +476,7 @@
 		{
 			case kEventWindowClosed:
 				theWindow = NULL;
-				mplayer_put_key(KEY_ESC);
+				mplayer_put_key(KEY_CLOSE_WIN);
 				break;
 				
 			//resize window
--- a/libvo/vo_sdl.c	Wed Nov 02 16:09:44 2005 +0000
+++ b/libvo/vo_sdl.c	Wed Nov 02 21:50:55 2005 +0000
@@ -1320,7 +1320,7 @@
                                 }
                                 
 				break;
-				case SDL_QUIT: mplayer_put_key('q');break;
+				case SDL_QUIT: mplayer_put_key(KEY_CLOSE_WIN);break;
 		}
 	}
 }
--- a/libvo/vo_winvidix.c	Wed Nov 02 16:09:44 2005 +0000
+++ b/libvo/vo_winvidix.c	Wed Nov 02 21:50:55 2005 +0000
@@ -65,7 +65,7 @@
 			PostQuitMessage(0);
 			return 0;
 	    case WM_CLOSE:
-			mp_input_queue_cmd(mp_input_parse_cmd("quit"));
+			mplayer_put_key(KEY_CLOSE_WIN);
 			break;
 		case WM_WINDOWPOSCHANGED:
            {
--- a/libvo/w32_common.c	Wed Nov 02 16:09:44 2005 +0000
+++ b/libvo/w32_common.c	Wed Nov 02 21:50:55 2005 +0000
@@ -25,7 +25,7 @@
 static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
     switch (message) {
 	case WM_CLOSE:
-	    mp_input_queue_cmd(mp_input_parse_cmd("quit"));
+	    mplayer_put_key(KEY_CLOSE_WIN);
 	    break;
         case WM_SYSCOMMAND:
 	    switch (wParam) {
--- a/libvo/x11_common.c	Wed Nov 02 16:09:44 2005 +0000
+++ b/libvo/x11_common.c	Wed Nov 02 21:50:55 2005 +0000
@@ -548,16 +548,16 @@
     switch (keysym)
     {
         case XF86XK_AudioPause:
-            mplayer_put_key(KEY_XF86_PAUSE);
+            mplayer_put_key(KEY_PAUSE);
             break;
         case XF86XK_AudioStop:
-            mplayer_put_key(KEY_XF86_STOP);
+            mplayer_put_key(KEY_STOP);
             break;
         case XF86XK_AudioPrev:
-            mplayer_put_key(KEY_XF86_PREV);
+            mplayer_put_key(KEY_PREV);
             break;
         case XF86XK_AudioNext:
-            mplayer_put_key(KEY_XF86_NEXT);
+            mplayer_put_key(KEY_NEXT);
             break;
         default:
             break;
@@ -587,6 +587,9 @@
         case wsEscape:
             mplayer_put_key(KEY_ESC);
             break;
+        case wsTab:
+            mplayer_put_key(KEY_TAB);
+            break;
         case wsEnter:
             mplayer_put_key(KEY_ENTER);
             break;
@@ -647,14 +650,6 @@
         case wsF12:
             mplayer_put_key(KEY_F + 12);
             break;
-        case wsq:
-        case wsQ:
-            mplayer_put_key('q');
-            break;
-        case wsp:
-        case wsP:
-            mplayer_put_key('p');
-            break;
         case wsMinus:
         case wsGrayMinus:
             mplayer_put_key('-');
@@ -728,15 +723,6 @@
         case wsGrayEnter:
             mplayer_put_key(KEY_KPENTER);
             break;
-        case wsm:
-        case wsM:
-            mplayer_put_key('m');
-            break;
-        case wso:
-        case wsO:
-            mplayer_put_key('o');
-            break;
-
         case wsGrave:
             mplayer_put_key('`');
             break;
--- a/osdep/keycodes.h	Wed Nov 02 16:09:44 2005 +0000
+++ b/osdep/keycodes.h	Wed Nov 02 21:50:55 2005 +0000
@@ -34,12 +34,21 @@
 #define KEY_DOWN (KEY_CRSR+2)
 #define KEY_UP (KEY_CRSR+3)
 
-/* XF86 Multimedia keyboard keys */
-#define KEY_XF86_BASE (0x100+384)
-#define KEY_XF86_PAUSE (KEY_XF86_BASE+1)
-#define KEY_XF86_STOP (KEY_XF86_BASE+2)
-#define KEY_XF86_PREV (KEY_XF86_BASE+3)
-#define KEY_XF86_NEXT (KEY_XF86_BASE+4)
+/* Multimedia keyboard/remote keys */
+#define KEY_MM_BASE (0x100+384)
+#define KEY_POWER (KEY_MM_BASE+0)
+#define KEY_MENU (KEY_MM_BASE+1)
+#define KEY_PLAY (KEY_MM_BASE+2)
+#define KEY_PAUSE (KEY_MM_BASE+3)
+#define KEY_PLAYPAUSE (KEY_MM_BASE+4)
+#define KEY_STOP (KEY_MM_BASE+5)
+#define KEY_FORWARD (KEY_MM_BASE+6)
+#define KEY_REWIND (KEY_MM_BASE+7)
+#define KEY_NEXT (KEY_MM_BASE+8)
+#define KEY_PREV (KEY_MM_BASE+9)
+#define KEY_VOLUME_UP (KEY_MM_BASE+10)
+#define KEY_VOLUME_DOWN (KEY_MM_BASE+11)
+#define KEY_MUTE (KEY_MM_BASE+12)
   
 /* Keypad keys */
 #define KEY_KEYPAD (KEY_BASE+32)
@@ -57,3 +66,7 @@
 #define KEY_KPINS (KEY_KEYPAD+11)
 #define KEY_KPDEL (KEY_KEYPAD+12)
 #define KEY_KPENTER (KEY_KEYPAD+13)
+
+/* Special keys */
+#define KEY_INTERN (0x1000)
+#define KEY_CLOSE_WIN (KEY_INTERN+0)