2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "./mplayer.h"
|
|
|
|
#include "../events.h"
|
|
|
|
#include "../app.h"
|
|
|
|
#include "../skin/skin.h"
|
|
|
|
#include "../skin/font.h"
|
|
|
|
#include "../wm/ws.h"
|
|
|
|
#include "../wm/wskeys.h"
|
|
|
|
#include "../wm/widget.h"
|
|
|
|
#include "../bitmap/bitmap.h"
|
|
|
|
#include "../timer.h"
|
|
|
|
#include "../error.h"
|
|
|
|
|
|
|
|
#include "../../config.h"
|
2001-09-12 15:08:53 +00:00
|
|
|
#include "../../help_mp.h"
|
2001-08-30 16:11:59 +00:00
|
|
|
#include "../../libvo/x11_common.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2001-08-25 23:02:26 +00:00
|
|
|
#define mplMouseTimerConst 10
|
|
|
|
#define mplRedrawTimerConst 5
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
int mplMouseTimer = mplMouseTimerConst;
|
|
|
|
int mplRedrawTimer = mplRedrawTimerConst;
|
|
|
|
int mplGeneralTimer = -1;
|
|
|
|
int mplTimer = 0;
|
|
|
|
|
|
|
|
void mplMsgHandle( int msg,float param );
|
|
|
|
|
|
|
|
#include "widgets.h"
|
|
|
|
#include "play.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "mw.h"
|
|
|
|
#include "sw.h"
|
2001-08-31 13:05:37 +00:00
|
|
|
#include "widgets.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
void mplTimerHandler( int signum )
|
|
|
|
{
|
|
|
|
mplTimer++;
|
|
|
|
mplMouseTimer--;
|
|
|
|
mplRedrawTimer--;
|
|
|
|
mplGeneralTimer--;
|
|
|
|
if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 );
|
|
|
|
if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 );
|
|
|
|
if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 );
|
|
|
|
}
|
|
|
|
|
2001-08-27 23:56:44 +00:00
|
|
|
void mplInit( int argc,char* argv[], char *envp[], void* disp )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
2001-09-07 21:04:14 +00:00
|
|
|
int i;
|
2001-08-25 23:02:26 +00:00
|
|
|
// allocates shmem to gtkShMem
|
2001-08-29 13:52:08 +00:00
|
|
|
// fork() a process which runs gtkThreadProc() [gtkPID]
|
2001-08-25 21:04:29 +00:00
|
|
|
gtkInit( argc,argv,envp );
|
2001-09-07 21:04:14 +00:00
|
|
|
strcpy( gtkShMem->sb.name,skinName );
|
2001-08-25 23:02:26 +00:00
|
|
|
|
|
|
|
// allocates shmem to mplShMem
|
|
|
|
// init fields of this struct to default values
|
2001-08-25 21:04:29 +00:00
|
|
|
mplMPlayerInit( argc,argv,envp );
|
|
|
|
|
2001-08-25 23:02:26 +00:00
|
|
|
message=mplErrorHandler; // error messagebox drawing function
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2001-08-25 23:02:26 +00:00
|
|
|
// opens X display, checks for extensions (XShape, DGA etc)
|
2001-08-27 23:56:44 +00:00
|
|
|
wsXInit(disp);
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
|
|
|
|
{
|
2001-09-12 15:08:53 +00:00
|
|
|
fprintf( stderr,MSGTR_NEMDB );
|
2001-08-25 21:04:29 +00:00
|
|
|
exit( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
wsCreateWindow( &appMPlayer.subWindow,
|
|
|
|
appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
|
|
|
|
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" );
|
|
|
|
|
2001-08-27 23:56:44 +00:00
|
|
|
vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC);
|
2001-08-29 13:52:08 +00:00
|
|
|
vo_setwindowsize( appMPlayer.sub.width,appMPlayer.sub.height );
|
2001-08-27 23:56:44 +00:00
|
|
|
|
2001-09-07 21:04:14 +00:00
|
|
|
i=wsHideFrame|wsMaxSize|wsShowWindow;
|
|
|
|
if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsShowWindow;
|
2001-08-25 21:04:29 +00:00
|
|
|
wsCreateWindow( &appMPlayer.mainWindow,
|
|
|
|
appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
|
2001-09-07 21:04:14 +00:00
|
|
|
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize|
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
|
|
|
|
|
|
|
|
mplMenuInit();
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen );
|
|
|
|
dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
|
|
|
|
dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
appMPlayer.mainWindow.ReDraw=mplMainDraw;
|
|
|
|
appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
|
|
|
|
appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
|
|
|
|
|
|
|
|
appMPlayer.subWindow.ReDraw=mplSubDraw;
|
|
|
|
appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
|
|
|
|
appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
|
|
|
|
appMPlayer.subWindow.ReSize=mplResize;
|
|
|
|
|
2001-10-01 12:28:39 +00:00
|
|
|
wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
|
2001-10-01 09:30:46 +00:00
|
|
|
if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
wsPostRedisplay( &appMPlayer.mainWindow );
|
|
|
|
wsPostRedisplay( &appMPlayer.subWindow );
|
|
|
|
|
|
|
|
btnModify( evSetVolume,mplShMem->Volume );
|
|
|
|
btnModify( evSetBalance,mplShMem->Balance );
|
|
|
|
btnModify( evSetMoviePosition,mplShMem->Position );
|
|
|
|
|
2001-08-27 23:56:44 +00:00
|
|
|
mplShMem->Playing=0;
|
|
|
|
|
2001-08-25 23:02:26 +00:00
|
|
|
// timerSetHandler( mplTimerHandler ); // various timer hacks
|
|
|
|
// timerInit();
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2001-08-27 00:55:25 +00:00
|
|
|
// wsMainLoop(); // X event handler (calls mplTimerHandler periodically!)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void mplDone(){
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
dbprintf( 1,"[mplayer] exit.\n" );
|
|
|
|
|
|
|
|
mplStop();
|
2001-08-25 23:02:26 +00:00
|
|
|
// timerDone();
|
|
|
|
gtkDone(); // kills the gtkThreadProc() process
|
2001-08-25 21:04:29 +00:00
|
|
|
wsXDone();
|
2001-08-27 00:55:25 +00:00
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
2001-08-27 00:55:25 +00:00
|
|
|
|