1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "./mplayer.h"
#include "../events.h"
#include "../app.h"
#include "../cfg.h"
#include "../interface.h"
#include "../skin/skin.h"
#include "../skin/font.h"
#include "../wm/ws.h"
#include "../wm/wskeys.h"
#include "../wm/widget.h"
#include "../wm/wsxdnd.h"
#include "../bitmap/bitmap.h"
#include "../../config.h"
#include "../../help_mp.h"
#include "../../libvo/x11_common.h"
#include "../../libmpdemux/stream.h"
#include "../../mp_msg.h"
#include <gdk/gdkprivate.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#define mplRedrawTimerConst 5
int mplRedrawTimer = mplRedrawTimerConst;
int mplTimer = 0;
void mplEventHandling( int msg,float param );
#include "widgets.h"
#include "play.h"
#include "menu.h"
#include "mw.h"
#include "sw.h"
#include "widgets.h"
void mplInit( void * disp )
{
int i;
#if 0
// init fields of this struct to default values
guiIntfStruct.Balance=50.0f;
guiIntfStruct.StreamType=-1;
gtkInit();
// read gui.conf, gui.pl
cfg_read();
// opens X display, checks for extensions (XShape, DGA etc)
wsXInit( disp );
#endif
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
{
fprintf( stderr,MSGTR_NEMDB );
exit( 0 );
}
wsCreateWindow( &appMPlayer.subWindow,
appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"ViDEO" );
wsDestroyImage( &appMPlayer.subWindow );
wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
wsXDNDMakeAwareness(&appMPlayer.subWindow);
vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC );
// i=wsHideFrame|wsMaxSize|wsHideWindow;
// if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
i=wsShowFrame|wsMaxSize|wsHideWindow;
wsCreateWindow( &appMPlayer.mainWindow,
appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize|
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
wsXDNDMakeAwareness(&appMPlayer.mainWindow);
mplMenuInit();
#ifdef DEBUG
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 );
#endif
appMPlayer.mainWindow.ReDraw=mplMainDraw;
appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
appMPlayer.subWindow.ReDraw=mplSubDraw;
appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
appMPlayer.subWindow.DandDHandler=mplDandDHandler;
wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
wsClearWindow( appMPlayer.subWindow );
if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
btnModify( evSetVolume,guiIntfStruct.Volume );
btnModify( evSetBalance,guiIntfStruct.Balance );
btnModify( evSetMoviePosition,guiIntfStruct.Position );
wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask );
guiIntfStruct.Playing=0;
if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
#if 1
wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
{
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 );
}
#endif
mplSubRender=1;
}
|