2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2002-01-31 08:39:21 +00:00
|
|
|
#include <inttypes.h>
|
2002-08-11 13:12:38 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <unistd.h>
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include "./mplayer.h"
|
|
|
|
#include "../events.h"
|
|
|
|
#include "../app.h"
|
2002-07-25 20:26:38 +00:00
|
|
|
#include "../cfg.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "../interface.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
#include "../skin/skin.h"
|
|
|
|
#include "../skin/font.h"
|
|
|
|
#include "../wm/ws.h"
|
|
|
|
#include "../wm/wskeys.h"
|
|
|
|
#include "../wm/widget.h"
|
2002-08-11 13:12:38 +00:00
|
|
|
#include "../wm/wsxdnd.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
#include "../bitmap/bitmap.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-11-18 15:05:25 +00:00
|
|
|
#include "../../libmpdemux/stream.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "../../mp_msg.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2002-07-05 23:47:00 +00:00
|
|
|
#include <gdk/gdkprivate.h>
|
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
#include <gdk/gdk.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-08-25 23:02:26 +00:00
|
|
|
#define mplRedrawTimerConst 5
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
int mplRedrawTimer = mplRedrawTimerConst;
|
|
|
|
int mplTimer = 0;
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
void mplEventHandling( int msg,float param );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
2002-05-28 11:55:17 +00:00
|
|
|
void mplInit( 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
|
|
|
|
2002-08-04 17:24:00 +00:00
|
|
|
#if 0
|
2001-08-25 23:02:26 +00:00
|
|
|
// init fields of this struct to default values
|
2002-05-28 12:54:57 +00:00
|
|
|
guiIntfStruct.Balance=50.0f;
|
|
|
|
guiIntfStruct.StreamType=-1;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2002-05-28 11:55:17 +00:00
|
|
|
gtkInit();
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2002-08-04 11:09:20 +00:00
|
|
|
// read gui.conf, gui.pl
|
|
|
|
cfg_read();
|
|
|
|
|
2001-08-25 23:02:26 +00:00
|
|
|
// opens X display, checks for extensions (XShape, DGA etc)
|
2002-05-28 11:55:17 +00:00
|
|
|
wsXInit( disp );
|
2002-08-05 01:14:14 +00:00
|
|
|
#endif
|
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,
|
2001-11-23 01:41:45 +00:00
|
|
|
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"ViDEO" );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2001-11-23 01:41:45 +00:00
|
|
|
wsDestroyImage( &appMPlayer.subWindow );
|
|
|
|
wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
|
2002-08-11 13:12:38 +00:00
|
|
|
wsXDNDMakeAwareness(&appMPlayer.subWindow);
|
2001-11-23 01:41:45 +00:00
|
|
|
|
|
|
|
vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC );
|
2002-02-23 15:12:55 +00:00
|
|
|
|
2002-06-03 15:06:32 +00:00
|
|
|
// i=wsHideFrame|wsMaxSize|wsHideWindow;
|
|
|
|
// if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
|
|
|
|
i=wsShowFrame|wsMaxSize|wsHideWindow;
|
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 );
|
2002-08-11 13:12:38 +00:00
|
|
|
wsXDNDMakeAwareness(&appMPlayer.mainWindow);
|
2002-02-23 15:12:55 +00:00
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
mplMenuInit();
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] Depth on screen: %d\n",wsDepthOnScreen );
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
|
2001-08-25 21:04:29 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
appMPlayer.mainWindow.ReDraw=mplMainDraw;
|
|
|
|
appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
|
|
|
|
appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
|
2002-08-11 13:12:38 +00:00
|
|
|
appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
appMPlayer.subWindow.ReDraw=mplSubDraw;
|
|
|
|
appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
|
|
|
|
appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
|
2002-08-11 13:12:38 +00:00
|
|
|
appMPlayer.subWindow.DandDHandler=mplDandDHandler;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2001-10-01 12:28:39 +00:00
|
|
|
wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
|
2001-11-23 01:41:45 +00:00
|
|
|
wsClearWindow( appMPlayer.subWindow );
|
2001-10-01 09:30:46 +00:00
|
|
|
if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
btnModify( evSetVolume,guiIntfStruct.Volume );
|
|
|
|
btnModify( evSetBalance,guiIntfStruct.Balance );
|
|
|
|
btnModify( evSetMoviePosition,guiIntfStruct.Position );
|
2002-07-05 23:47:00 +00:00
|
|
|
|
|
|
|
wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
|
|
|
|
wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask );
|
2002-03-11 09:19:15 +00:00
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
guiIntfStruct.Playing=0;
|
2001-08-27 00:55:25 +00:00
|
|
|
|
2002-06-03 15:06:32 +00:00
|
|
|
if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
|
|
|
|
|
2001-11-23 01:41:45 +00:00
|
|
|
wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
|
2002-08-04 17:24:00 +00:00
|
|
|
#if 1
|
2001-11-23 01:41:45 +00:00
|
|
|
wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
|
2002-07-25 20:26:38 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
XEvent xev;
|
|
|
|
do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
|
|
|
|
appMPlayer.subWindow.Mapped=wsMapped;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( fullscreen )
|
|
|
|
{
|
|
|
|
mplFullScreen();
|
|
|
|
btnModify( evFullScreen,btnPressed );
|
|
|
|
}
|
2002-07-30 11:50:20 +00:00
|
|
|
#endif
|
2002-07-25 20:26:38 +00:00
|
|
|
mplSubRender=1;
|
2001-08-27 00:55:25 +00:00
|
|
|
}
|
|
|
|
|