1693
|
1
|
|
2 #include <stdlib.h>
|
|
3 #include <stdio.h>
|
|
4 #include <string.h>
|
|
5
|
|
6 #include "./mplayer.h"
|
|
7 #include "../events.h"
|
|
8 #include "../app.h"
|
|
9 #include "../skin/skin.h"
|
|
10 #include "../skin/font.h"
|
|
11 #include "../wm/ws.h"
|
|
12 #include "../wm/wskeys.h"
|
|
13 #include "../wm/widget.h"
|
|
14 #include "../bitmap/bitmap.h"
|
|
15 #include "../timer.h"
|
|
16 #include "../language.h"
|
|
17 #include "../error.h"
|
|
18
|
|
19 #include "../../config.h"
|
|
20
|
1697
|
21 #define mplMouseTimerConst 10
|
|
22 #define mplRedrawTimerConst 5
|
1693
|
23
|
|
24 int mplMouseTimer = mplMouseTimerConst;
|
|
25 int mplRedrawTimer = mplRedrawTimerConst;
|
|
26 int mplGeneralTimer = -1;
|
|
27 int mplTimer = 0;
|
|
28
|
|
29 int mplSkinChanged = 0;
|
|
30
|
|
31 void mplMsgHandle( int msg,float param );
|
|
32
|
|
33 #include "widgets.h"
|
|
34 #include "play.h"
|
|
35 #include "menu.h"
|
|
36 #include "mw.h"
|
|
37 #include "sw.h"
|
|
38 #include "widget.h"
|
|
39
|
|
40 void mplTimerHandler( int signum )
|
|
41 {
|
|
42 mplTimer++;
|
|
43 mplMouseTimer--;
|
|
44 mplRedrawTimer--;
|
|
45 mplGeneralTimer--;
|
|
46 if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 );
|
|
47 if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 );
|
|
48 if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 );
|
|
49 }
|
|
50
|
|
51 void mplInit( int argc,char* argv[], char *envp[] )
|
|
52 {
|
|
53 // parse_cfgfiles( argc,argv,envp );
|
1697
|
54
|
|
55 // allocates shmem to gtkShMem
|
|
56 // fork() a process which runs gtkThreadProc() [gtkChildPID]
|
1693
|
57 gtkInit( argc,argv,envp );
|
1697
|
58
|
|
59 // allocates shmem to mplShMem
|
|
60 // init fields of this struct to default values
|
1693
|
61 mplMPlayerInit( argc,argv,envp );
|
|
62
|
1697
|
63 message=mplErrorHandler; // error messagebox drawing function
|
1693
|
64
|
1697
|
65 // opens X display, checks for extensions (XShape, DGA etc)
|
1693
|
66 wsXInit();
|
|
67
|
|
68 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
|
|
69 {
|
|
70 fprintf( stderr,langNEMDB );
|
|
71 exit( 0 );
|
|
72 }
|
|
73
|
|
74 wsCreateWindow( &appMPlayer.subWindow,
|
|
75 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
|
|
76 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" );
|
|
77
|
|
78 wsCreateWindow( &appMPlayer.mainWindow,
|
|
79 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
|
|
80 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsShowWindow,"MPlayer" );
|
|
81
|
|
82 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
|
|
83
|
|
84 mplMenuInit();
|
|
85
|
|
86 #ifdef DEBUG
|
|
87 dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen );
|
|
88 dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
|
|
89 dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
|
|
90 #endif
|
|
91
|
|
92 appMPlayer.mainWindow.ReDraw=mplMainDraw;
|
|
93 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
|
|
94 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
|
|
95
|
|
96 appMPlayer.subWindow.ReDraw=mplSubDraw;
|
|
97 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
|
|
98 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
|
|
99 appMPlayer.subWindow.ReSize=mplResize;
|
|
100
|
|
101 wsPostRedisplay( &appMPlayer.mainWindow );
|
|
102 wsPostRedisplay( &appMPlayer.subWindow );
|
|
103
|
|
104 btnModify( evSetVolume,mplShMem->Volume );
|
|
105 btnModify( evSetBalance,mplShMem->Balance );
|
|
106 btnModify( evSetMoviePosition,mplShMem->Position );
|
|
107
|
1697
|
108 // timerSetHandler( mplTimerHandler ); // various timer hacks
|
|
109 // timerInit();
|
1693
|
110
|
1709
|
111 // wsMainLoop(); // X event handler (calls mplTimerHandler periodically!)
|
|
112
|
|
113 }
|
|
114
|
|
115 void mplDone(){
|
1693
|
116
|
|
117 dbprintf( 1,"[mplayer] exit.\n" );
|
|
118
|
|
119 mplStop();
|
1697
|
120 // timerDone();
|
|
121 gtkDone(); // kills the gtkThreadProc() process
|
1693
|
122 wsXDone();
|
1709
|
123
|
1693
|
124 }
|
1709
|
125
|