changeset 4858:65730cea02e7

add half new input support for gui
author pontscho
date Mon, 25 Feb 2002 13:14:27 +0000
parents f3f94fb55398
children c72b386debb4
files Gui/interface.c Gui/mplayer/mw.h input/input.c input/input.h mplayer.c
diffstat 5 files changed, 80 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/interface.c	Mon Feb 25 11:13:34 2002 +0000
+++ b/Gui/interface.c	Mon Feb 25 13:14:27 2002 +0000
@@ -13,6 +13,7 @@
 #include "mplayer/mplayer.h"
 #include "app.h"
 #include "../libvo/x11_common.h"
+#include "../input/input.h"
 
 guiInterface_t guiIntfStruct;
 
@@ -30,6 +31,19 @@
  wsXDone();
 }
 
+int guiCMDArray[] =
+ {
+  evLoad,
+  evLoadSubtitle,
+  evAbout,
+  evPlay,
+  evStop,
+  evPlayList,
+  evPreferences,
+  evFullScreen,
+  evSkinBrowser
+ };
+
 void guiGetEvent( int type,char * arg )
 {
  switch ( type )
@@ -40,6 +54,20 @@
         break;
    case guiCEvent:
         break;
+   case guiIEvent:
+        printf( "cmd: %d\n",(int)arg );
+	switch( (int)arg )
+	 {
+          case MP_CMD_QUIT:
+	       mplEventHandling( evExit,0 );
+	       break;
+	  case MP_CMD_VO_FULLSCREEN:
+	       mplEventHandling( evFullScreen,0 );
+	       break;
+          default:
+	       mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 );
+	 }
+	break;
   }
 }
 
--- a/Gui/mplayer/mw.h	Mon Feb 25 11:13:34 2002 +0000
+++ b/Gui/mplayer/mw.h	Mon Feb 25 13:14:27 2002 +0000
@@ -559,9 +559,11 @@
 void mplMainKeyHandle( int State,int Type,int Key )
 {
  int msg = evNone;
+// return;
  if ( Type != wsKeyPressed ) return;
  switch ( Key )
   {
+#ifndef HAVE_NEW_INPUT
    case '.':
    case '>':         msg=evNext; break;
    case ',':
@@ -589,6 +591,7 @@
    case wsS:         msg=evStop; break;
    case wsp:
    case wsP:         msg=evPlayList; break;
+#endif
 
    case wsXF86LowerVolume:  msg=evDecVolume; break;
    case wsXF86RaiseVolume:  msg=evIncVolume; break;
@@ -601,10 +604,5 @@
 
    default:          vo_x11_putkey( Key ); return;
   }
- if ( msg != evNone )
-  {
-   mplEventHandling( msg,0 );
-//   mplMainRender=1;
-//   wsPostRedisplay( &appMPlayer.mainWindow );
-  }
+ if ( msg != evNone ) mplEventHandling( msg,0 );
 }
--- a/input/input.c	Mon Feb 25 11:13:34 2002 +0000
+++ b/input/input.c	Mon Feb 25 13:14:27 2002 +0000
@@ -55,6 +55,18 @@
   { MP_CMD_TV_STEP_CHANNEL_LIST, "tv_step_chanlist", 0, { {-1,{0}} }  },
 #endif
   { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } },
+
+#ifdef HAVE_NEW_GUI  
+  { MP_CMD_GUI_LOADFILE, "gui_loadfile", 0, { {-1,{0}} } },
+  { MP_CMD_GUI_LOADSUBTITLE, "gui_loadsubtitle", 0, { {-1,{0}} } },
+  { MP_CMD_GUI_ABOUT, "gui_about", 0, { {-1,{0}} } },
+  { MP_CMD_GUI_PLAY, "gui_play", 0, { {-1,{0}} } },
+  { MP_CMD_GUI_STOP, "gui_stop", 0, { {-1,{0}} } },
+  { MP_CMD_GUI_PLAYLIST, "gui_playlist", 0, { {-1,{0}} } },
+  { MP_CMD_GUI_PREFERENCES, "gui_preferences", 0, { {-1,{0}} } },
+  { MP_CMD_GUI_SKINBROWSER, "gui_skinbrowser", 0, { {-1,{0}} } },
+#endif
+  
   { 0, NULL, 0, {} }
 };
 
@@ -137,7 +149,7 @@
   { { '-', 0 }, "audio_delay -0.100" },
   { { 'q', 0 }, "quit" },
   { { KEY_ESC, 0 }, "quit" },
-  { { 'p', 0 }, "pause" },
+//  { { 'p', 0 }, "pause" },
   { { ' ', 0 }, "pause" },
   { { KEY_HOME, 0 }, "pt_up_step 1" },
   { { KEY_END, 0 }, "pt_up_step -1" },
@@ -164,9 +176,19 @@
   { { 'd', 0 }, "frame_drop" },
 #ifdef USE_TV
   { { 'h', 0 }, "tv_step_channel 1" },
-  { { 'l', 0 }, "tv_step_channel -1" },
+  { { 'k', 0 }, "tv_step_channel -1" },
   { { 'n', 0 }, "tv_step_norm" },
-  { { 'b', 0 }, "tv_step_chanlist" },
+  { { 'm', 0 }, "tv_step_chanlist" },
+#endif
+#ifdef HAVE_NEW_GUI
+  { { 'l', 0 }, "gui_loadfile" },
+  { { 't', 0 }, "gui_loadsubtitle" },
+  { { 'a', 0 }, "gui_about" },
+  { { KEY_ENTER, 0 }, "gui_play" },
+  { { 's', 0 }, "gui_stop" },
+  { { 'p', 0 }, "gui_playlist" },
+  { { 'r', 0 }, "gui_preferences" },
+  { { 'c', 0 }, "gui_skinbrowser" },
 #endif
 #ifdef HAVE_JOYSTICK
   { { JOY_AXIS0_PLUS, 0 }, "seek 10" },
--- a/input/input.h	Mon Feb 25 11:13:34 2002 +0000
+++ b/input/input.h	Mon Feb 25 13:14:27 2002 +0000
@@ -23,6 +23,17 @@
 #define MP_CMD_TV_STEP_CHANNEL_LIST 19
 #define MP_CMD_VO_FULLSCREEN 20
 
+#define MP_CMD_GUI_EVENTS       5000
+#define MP_CMD_GUI_LOADFILE     5001
+#define MP_CMD_GUI_LOADSUBTITLE 5002
+#define MP_CMD_GUI_ABOUT        5003
+#define MP_CMD_GUI_PLAY         5004
+#define MP_CMD_GUI_STOP         5005
+#define MP_CMD_GUI_PLAYLIST     5006
+#define MP_CMD_GUI_PREFERENCES  5007
+#define MP_CMD_GUI_FULLSCREEN   5008
+#define MP_CMD_GUI_SKINBROWSER  5009
+
 #define MP_CMD_ARG_INT 0
 #define MP_CMD_ARG_FLOAT 1
 #define MP_CMD_ARG_STRING 2
--- a/mplayer.c	Mon Feb 25 11:13:34 2002 +0000
+++ b/mplayer.c	Mon Feb 25 13:14:27 2002 +0000
@@ -783,8 +783,10 @@
       if(filename && !guiIntfStruct.FilenameChanged) guiSetFilename( guiIntfStruct.Filename,filename );
 //      guiIntfStruct.Playing= (gui_no_filename) ? 0 : 1;
       while(guiIntfStruct.Playing!=1){
+        mp_cmd_t* cmd;                                                                                   
 	usleep(20000);
 	guiEventHandling();
+	if ( (cmd = mp_input_get_cmd(0,0)) != NULL) guiGetEvent( guiIEvent,(char *)cmd->id );
       }
 
 play_dvd:
@@ -2637,11 +2639,20 @@
 #endif
     case MP_CMD_VO_FULLSCREEN:
     {
+#ifdef HAVE_NEW_GUI
+     if ( use_gui ) guiGetEvent( guiIEvent,(char *)MP_CMD_GUI_FULLSCREEN );
+      else
+#endif
 	video_out->control(VOCTRL_FULLSCREEN, 0);
     } break;
-    default :
+    default : {
+#ifdef HAVE_NEW_GUI
+      if ( ( use_gui )&&( cmd->id > MP_CMD_GUI_EVENTS ) ) guiGetEvent( guiIEvent,(char *)cmd->id );
+       else
+#endif
       printf("Received unknow cmd %s\n",cmd->name);
     }
+    }
     mp_cmd_free(cmd);
   }
 }