diff options
-rw-r--r-- | Gui/interface.c | 28 | ||||
-rw-r--r-- | Gui/mplayer/mw.h | 10 | ||||
-rw-r--r-- | input/input.c | 28 | ||||
-rw-r--r-- | input/input.h | 11 | ||||
-rw-r--r-- | mplayer.c | 13 |
5 files changed, 80 insertions, 10 deletions
diff --git a/Gui/interface.c b/Gui/interface.c index ccb107f386..d0f368573e 100644 --- a/Gui/interface.c +++ b/Gui/interface.c @@ -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 @@ void guiDone( void ) wsXDone(); } +int guiCMDArray[] = + { + evLoad, + evLoadSubtitle, + evAbout, + evPlay, + evStop, + evPlayList, + evPreferences, + evFullScreen, + evSkinBrowser + }; + void guiGetEvent( int type,char * arg ) { switch ( type ) @@ -40,6 +54,20 @@ void guiGetEvent( int type,char * arg ) 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; } } diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h index 2de88e348a..92333e3847 100644 --- a/Gui/mplayer/mw.h +++ b/Gui/mplayer/mw.h @@ -559,9 +559,11 @@ int keyPressed = 0; 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 @@ void mplMainKeyHandle( int State,int Type,int Key ) 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 @@ void mplMainKeyHandle( int State,int Type,int Key ) default: vo_x11_putkey( Key ); return; } - if ( msg != evNone ) - { - mplEventHandling( msg,0 ); -// mplMainRender=1; -// wsPostRedisplay( &appMPlayer.mainWindow ); - } + if ( msg != evNone ) mplEventHandling( msg,0 ); } diff --git a/input/input.c b/input/input.c index 2c61eb5b8e..537a897f0f 100644 --- a/input/input.c +++ b/input/input.c @@ -55,6 +55,18 @@ static mp_cmd_t mp_cmds[] = { { 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 @@ static mp_cmd_bind_t def_cmd_binds[] = { { { '-', 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 @@ static mp_cmd_bind_t def_cmd_binds[] = { { { '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" }, diff --git a/input/input.h b/input/input.h index 7fc30d1ee4..1591eeea9d 100644 --- a/input/input.h +++ b/input/input.h @@ -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 @@ -783,8 +783,10 @@ if(!use_stdin && !slave_mode){ 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 @@ if(step_sec>0) { #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); } } |