Mercurial > mplayer.hg
annotate Gui/mplayer/mplayer.c @ 2574:cc926eda63cd
fixed
author | arpi |
---|---|
date | Tue, 30 Oct 2001 21:55:28 +0000 |
parents | 9582af160d04 |
children | fd44ecf77f8d |
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 "../error.h" | |
17 | |
18 #include "../../config.h" | |
1884 | 19 #include "../../help_mp.h" |
1776 | 20 #include "../../libvo/x11_common.h" |
1693 | 21 |
1697 | 22 #define mplMouseTimerConst 10 |
23 #define mplRedrawTimerConst 5 | |
1693 | 24 |
25 int mplMouseTimer = mplMouseTimerConst; | |
26 int mplRedrawTimer = mplRedrawTimerConst; | |
27 int mplGeneralTimer = -1; | |
28 int mplTimer = 0; | |
29 | |
30 void mplMsgHandle( int msg,float param ); | |
31 | |
32 #include "widgets.h" | |
33 #include "play.h" | |
34 #include "menu.h" | |
35 #include "mw.h" | |
36 #include "sw.h" | |
1801 | 37 #include "widgets.h" |
1693 | 38 |
39 void mplTimerHandler( int signum ) | |
40 { | |
41 mplTimer++; | |
42 mplMouseTimer--; | |
43 mplRedrawTimer--; | |
44 mplGeneralTimer--; | |
45 if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 ); | |
46 if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 ); | |
47 if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 ); | |
48 } | |
49 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
50 void mplInit( int argc,char* argv[], char *envp[], void* disp ) |
1693 | 51 { |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
52 int i; |
1697 | 53 // allocates shmem to gtkShMem |
1742 | 54 // fork() a process which runs gtkThreadProc() [gtkPID] |
1693 | 55 gtkInit( argc,argv,envp ); |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
56 strcpy( gtkShMem->sb.name,skinName ); |
1697 | 57 |
58 // allocates shmem to mplShMem | |
59 // init fields of this struct to default values | |
1693 | 60 mplMPlayerInit( argc,argv,envp ); |
61 | |
1697 | 62 message=mplErrorHandler; // error messagebox drawing function |
1693 | 63 |
1697 | 64 // 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
|
65 wsXInit(disp); |
1693 | 66 |
67 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
68 { | |
1884 | 69 fprintf( stderr,MSGTR_NEMDB ); |
1693 | 70 exit( 0 ); |
71 } | |
72 | |
73 wsCreateWindow( &appMPlayer.subWindow, | |
74 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
75 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" ); | |
76 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
77 vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC); |
1742 | 78 vo_setwindowsize( appMPlayer.sub.width,appMPlayer.sub.height ); |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
79 |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
80 i=wsHideFrame|wsMaxSize|wsShowWindow; |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
81 if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsShowWindow; |
1693 | 82 wsCreateWindow( &appMPlayer.mainWindow, |
83 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
84 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| |
1693 | 85 |
86 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
87 | |
88 mplMenuInit(); | |
89 | |
90 #ifdef DEBUG | |
91 dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen ); | |
92 dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); | |
93 dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); | |
94 #endif | |
95 | |
96 appMPlayer.mainWindow.ReDraw=mplMainDraw; | |
97 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
98 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
99 | |
100 appMPlayer.subWindow.ReDraw=mplSubDraw; | |
101 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
102 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
103 appMPlayer.subWindow.ReSize=mplResize; | |
104 | |
2029 | 105 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
106 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); |
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
107 |
1693 | 108 wsPostRedisplay( &appMPlayer.mainWindow ); |
109 wsPostRedisplay( &appMPlayer.subWindow ); | |
110 | |
111 btnModify( evSetVolume,mplShMem->Volume ); | |
112 btnModify( evSetBalance,mplShMem->Balance ); | |
113 btnModify( evSetMoviePosition,mplShMem->Position ); | |
114 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
115 mplShMem->Playing=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
116 |
1697 | 117 // timerSetHandler( mplTimerHandler ); // various timer hacks |
118 // timerInit(); | |
1693 | 119 |
1709 | 120 // wsMainLoop(); // X event handler (calls mplTimerHandler periodically!) |
121 | |
122 } | |
123 | |
124 void mplDone(){ | |
1693 | 125 |
126 dbprintf( 1,"[mplayer] exit.\n" ); | |
127 | |
128 mplStop(); | |
1697 | 129 // timerDone(); |
130 gtkDone(); // kills the gtkThreadProc() process | |
1693 | 131 wsXDone(); |
1709 | 132 |
1693 | 133 } |
1709 | 134 |