From 855050e68a778e200aa1a1a6310d5d346e64ec71 Mon Sep 17 00:00:00 2001 From: arpi Date: Mon, 27 Aug 2001 23:56:44 +0000 Subject: GUI stuff. now seeking works, and xmga renders to video window git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1724 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/app.c | 4 ++-- Gui/app.h | 2 +- Gui/mplayer/mplayer.c | 9 +++++++-- Gui/mplayer/mplayer.h | 2 +- Gui/mplayer/mw.h | 17 ++++++++++++++++- Gui/mplayer/play.c | 15 ++++++++++++++- Gui/mplayer/psignal.c | 14 +++++++++----- Gui/mplayer/sw.h | 2 +- Gui/wm/ws.c | 8 ++++++-- Gui/wm/ws.h | 2 +- 10 files changed, 58 insertions(+), 17 deletions(-) (limited to 'Gui') diff --git a/Gui/app.c b/Gui/app.c index 023882ee19..557645defc 100644 --- a/Gui/app.c +++ b/Gui/app.c @@ -96,7 +96,7 @@ int appFindMessage( unsigned char * str ) return -1; } -void appInit( int argc,char* argv[], char *envp[] ) +void appInit( int argc,char* argv[], char *envp[], void* disp ) { skinDirInHome=get_path("Skin"); skinMPlayerDir=DATADIR "/Skin"; @@ -124,6 +124,6 @@ void appInit( int argc,char* argv[], char *envp[] ) case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 ); case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 ); } - mplInit( argc,argv,envp ); // does gtk & ws initialization, create windows + mplInit( argc,argv,envp,disp ); // does gtk & ws initialization, create windows // } } diff --git a/Gui/app.h b/Gui/app.h index 0e78d2837f..48a4acf9b9 100644 --- a/Gui/app.h +++ b/Gui/app.h @@ -79,7 +79,7 @@ extern listItems appRadio; extern char * skinDirInHome; extern char * skinMPlayerDir; -extern void appInit( int argc,char* argv[], char *envp[] ); +extern void appInit( int argc,char* argv[], char *envp[], void* disp ); extern void appInitStruct( listItems * item ); extern void appClearItem( wItem * item ); extern void appCopy( listItems * item1,listItems * item2 ); diff --git a/Gui/mplayer/mplayer.c b/Gui/mplayer/mplayer.c index 52d04ea665..f6e67e5dd0 100644 --- a/Gui/mplayer/mplayer.c +++ b/Gui/mplayer/mplayer.c @@ -48,7 +48,7 @@ void mplTimerHandler( int signum ) if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 ); } -void mplInit( int argc,char* argv[], char *envp[] ) +void mplInit( int argc,char* argv[], char *envp[], void* disp ) { // parse_cfgfiles( argc,argv,envp ); @@ -63,7 +63,7 @@ void mplInit( int argc,char* argv[], char *envp[] ) message=mplErrorHandler; // error messagebox drawing function // opens X display, checks for extensions (XShape, DGA etc) - wsXInit(); + wsXInit(disp); if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) { @@ -75,6 +75,9 @@ void mplInit( int argc,char* argv[], char *envp[] ) appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" ); + vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC); + mplSubRender=0; + wsCreateWindow( &appMPlayer.mainWindow, appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsShowWindow,"MPlayer" ); @@ -105,6 +108,8 @@ void mplInit( int argc,char* argv[], char *envp[] ) btnModify( evSetBalance,mplShMem->Balance ); btnModify( evSetMoviePosition,mplShMem->Position ); + mplShMem->Playing=0; + // timerSetHandler( mplTimerHandler ); // various timer hacks // timerInit(); diff --git a/Gui/mplayer/mplayer.h b/Gui/mplayer/mplayer.h index dc751d1f6c..65744629d3 100644 --- a/Gui/mplayer/mplayer.h +++ b/Gui/mplayer/mplayer.h @@ -13,7 +13,7 @@ extern int mainVisible; extern int mplMainAutoPlay; -extern void mplInit( int argc,char* argv[], char *envp[] ); +extern void mplInit( int argc,char* argv[], char *envp[], void* disp ); extern void mplMsgHandle( int msg,float param ); #endif diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h index 92a7292c2d..9ee7270a73 100644 --- a/Gui/mplayer/mw.h +++ b/Gui/mplayer/mw.h @@ -178,6 +178,8 @@ drawrenderedtext: XFlush( wsDisplay ); } +#define IZE(x) printf("@@@ " x " @@@\n"); + void mplMsgHandle( int msg,float param ) { int j; @@ -186,12 +188,15 @@ void mplMsgHandle( int msg,float param ) { // --- user events case evExit: - wsDoExit(); + IZE("evExit"); + wsDoExit(); // sets wsTrue=False; break; case evIconify: + IZE("evIcon"); wsIconify( appMPlayer.mainWindow ); break; case evFullScreen: + IZE("evFullS"); for ( j=0;jPause"); if ( Filename ) { btnModify( evPlaySwitchToPause,btnDisabled ); @@ -212,20 +218,24 @@ void mplMsgHandle( int msg,float param ) } if ( mplShMem->Playing == 1 ) goto NoPause; case evPlay: + IZE("evPlay"); mplMainRender=1; mplPlay(); break; case evPauseSwitchToPlay: + IZE("evPause->Play"); btnModify( evPlaySwitchToPause,btnReleased ); btnModify( evPauseSwitchToPlay,btnDisabled ); case evPause: NoPause: + IZE("evPause"); mplMainRender=1; mplPause(); break; case evStop: + IZE("evStop"); btnModify( evPlaySwitchToPause,btnReleased ); btnModify( evPauseSwitchToPlay,btnDisabled ); mplMainRender=1; @@ -233,18 +243,22 @@ NoPause: break; case evLoadPlay: + IZE("evLoadPlay"); mplMainAutoPlay=1; case evLoad: + IZE("evLoad"); mplMainRender=1; gtkSendMessage( evLoad ); break; case evPrev: + IZE("evPrev"); mplMainRender=1; #ifdef DEBUG dbprintf( 1,"[mw.h] previous stream ...\n" ); #endif break; case evNext: + IZE("evNext"); mplMainRender=1; #ifdef DEBUG dbprintf( 1,"[mw.h] next stream ...\n" ); @@ -252,6 +266,7 @@ NoPause: break; case evPlayList: + IZE("evPlayList"); mplMainRender=1; if ( gtkVisiblePlayList ) { diff --git a/Gui/mplayer/play.c b/Gui/mplayer/play.c index 340bda2fbd..15724e2997 100644 --- a/Gui/mplayer/play.c +++ b/Gui/mplayer/play.c @@ -9,6 +9,8 @@ int mplParent = 1; int mplx,mply,mplwidth,mplheight; +float gui_position=-1; + #include "../app.h" #include "../wm/ws.h" @@ -16,6 +18,7 @@ int mplx,mply,mplwidth,mplheight; #include "../wm/widget.h" #include "../../config.h" +#include "../../libvo/x11_common.h" #include "widgets.h" #include "./mplayer.h" @@ -25,6 +28,10 @@ int mplx,mply,mplwidth,mplheight; mplCommStruct * mplShMem; char * Filename = NULL; +extern float rel_seek_secs; +extern int abs_seek_pos; + + void mplPlayerThread( void ) { // mplayer( 0,NULL,NULL ); @@ -85,6 +92,10 @@ printf("%%%%%% PAUSE \n"); void mplResize( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ) { + +printf("mplResize(%d,%d,%d,%d) \n",X,Y,width,height); + vo_resize=1; + } void mplMPlayerInit( int argc,char* argv[], char *envp[] ) @@ -109,7 +120,7 @@ void mplMPlayerInit( int argc,char* argv[], char *envp[] ) float mplGetPosition( void ) { // return 0.0 ... 100.0 - return mplShMem->Position; + return (gui_position<0)?(mplShMem->Position):(gui_position*100.0); } void mplRelSeek( float s ) @@ -118,12 +129,14 @@ void mplRelSeek( float s ) printf("%%%%%% RelSEEK=%5.3f \n",s); // --- mplShMem->Position=mplGetPosition() + s; + rel_seek_secs=s; abs_seek_pos=0; } void mplAbsSeek( float s ) { // 0.0 ... 100.0 // --- printf("%%%%%% AbsSEEK=%5.3f \n",s); + rel_seek_secs=0.01*s; abs_seek_pos=3; // --- mplShMem->Position=s; mplShMem->TimeSec=s; diff --git a/Gui/mplayer/psignal.c b/Gui/mplayer/psignal.c index 6053d40dd7..263ba0d016 100644 --- a/Gui/mplayer/psignal.c +++ b/Gui/mplayer/psignal.c @@ -18,6 +18,9 @@ #include "../../config.h" +#include "../../libvo/x11_common.h" +//#include "../../libvo/sub.h" + #include "./mplayer.h" #define gtkShow( w ) gtkShMem->vs.window=w; gtkSendMessage( evShowWindow ); @@ -55,20 +58,21 @@ void mplPlayerSigHandler( int s ) switch ( mplShMem->message ) { case mplQuit: -// exit_player( "Quit" ); + exit_player( "GUI close" ); break; case mplPauseEvent: // if ( osd_function != OSD_PAUSE ) osd_function=OSD_PAUSE; // else osd_function=OSD_PLAY; break; case mplResizeEvent: -// vo_resize=1; -// vo_expose=1; -// dbprintf( 2,"[psignal] resize.\n" ); + vo_resize=1; + vo_expose=1; + printf( "[psignal] resize.\n" ); // if (video_out != NULL ) video_out->check_events(); break; case mplExposeEvent: -// vo_expose=1; + vo_expose=1; + printf( "[psignal] expose.\n" ); // if (video_out != NULL ) video_out->check_events(); break; case mplSeekEvent: diff --git a/Gui/mplayer/sw.h b/Gui/mplayer/sw.h index 8d77c4625f..da28cd457e 100644 --- a/Gui/mplayer/sw.h +++ b/Gui/mplayer/sw.h @@ -18,8 +18,8 @@ void mplSubDraw( wsParamDisplay ) wsClearWindow( appMPlayer.subWindow ); if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); mplSubRender=0; + if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow ); } - if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow ); XFlush( wsDisplay ); XSync( wsDisplay,False ); } diff --git a/Gui/wm/ws.c b/Gui/wm/ws.c index 4922d8998a..b3c86a4b7b 100644 --- a/Gui/wm/ws.c +++ b/Gui/wm/ws.c @@ -130,12 +130,15 @@ int wsErrorHandler( Display * dpy,XErrorEvent * Event ) exit( 0 ); } -void wsXInit( void ) +void wsXInit( void* mDisplay ) { - char * DisplayName = ":0.0"; int eventbase; int errorbase; +if(mDisplay){ + wsDisplay=mDisplay; +} else { + char * DisplayName = ":0.0"; if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" ); wsDisplay=XOpenDisplay( DisplayName ); if ( !wsDisplay ) @@ -143,6 +146,7 @@ void wsXInit( void ) fprintf( stderr,"[ws] couldn't open the display !\n" ); exit( 0 ); } +} if ( !XShmQueryExtension( wsDisplay ) ) { diff --git a/Gui/wm/ws.h b/Gui/wm/ws.h index be10ff0b0d..9436dd0866 100644 --- a/Gui/wm/ws.h +++ b/Gui/wm/ws.h @@ -180,7 +180,7 @@ extern int wsUseDGA; extern unsigned long wsKeyTable[512]; extern void wsXDone( void ); -extern void wsXInit( void ); +extern void wsXInit( void* disp ); extern int wsGetDepthOnScreen( void ); -- cgit v1.2.3