mirror of
https://github.com/mpv-player/mpv
synced 2025-01-01 04:36:24 +01:00
add half new input support for gui
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4859 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
c256e5a766
commit
4b6f1667db
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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" },
|
||||
|
@ -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
|
||||
|
13
mplayer.c
13
mplayer.c
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user