Mercurial > mplayer.hg
annotate Gui/mplayer/mplayer.c @ 1723:5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
author | arpi |
---|---|
date | Mon, 27 Aug 2001 23:56:44 +0000 |
parents | a4e0211455d8 |
children | 0880718750d5 |
rev | line source |
---|---|
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 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
51 void mplInit( int argc,char* argv[], char *envp[], void* disp ) |
1693 | 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) |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
66 wsXInit(disp); |
1693 | 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 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
78 vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC); |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
79 mplSubRender=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
80 |
1693 | 81 wsCreateWindow( &appMPlayer.mainWindow, |
82 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
83 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsShowWindow,"MPlayer" ); | |
84 | |
85 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
86 | |
87 mplMenuInit(); | |
88 | |
89 #ifdef DEBUG | |
90 dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen ); | |
91 dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); | |
92 dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); | |
93 #endif | |
94 | |
95 appMPlayer.mainWindow.ReDraw=mplMainDraw; | |
96 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
97 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
98 | |
99 appMPlayer.subWindow.ReDraw=mplSubDraw; | |
100 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
101 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
102 appMPlayer.subWindow.ReSize=mplResize; | |
103 | |
104 wsPostRedisplay( &appMPlayer.mainWindow ); | |
105 wsPostRedisplay( &appMPlayer.subWindow ); | |
106 | |
107 btnModify( evSetVolume,mplShMem->Volume ); | |
108 btnModify( evSetBalance,mplShMem->Balance ); | |
109 btnModify( evSetMoviePosition,mplShMem->Position ); | |
110 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
111 mplShMem->Playing=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
112 |
1697 | 113 // timerSetHandler( mplTimerHandler ); // various timer hacks |
114 // timerInit(); | |
1693 | 115 |
1709 | 116 // wsMainLoop(); // X event handler (calls mplTimerHandler periodically!) |
117 | |
118 } | |
119 | |
120 void mplDone(){ | |
1693 | 121 |
122 dbprintf( 1,"[mplayer] exit.\n" ); | |
123 | |
124 mplStop(); | |
1697 | 125 // timerDone(); |
126 gtkDone(); // kills the gtkThreadProc() process | |
1693 | 127 wsXDone(); |
1709 | 128 |
1693 | 129 } |
1709 | 130 |