Mercurial > mplayer.hg
annotate Gui/mplayer/mplayer.c @ 1838:4984bd55518e
add lgb's localhost detect
author | pontscho |
---|---|
date | Sun, 02 Sep 2001 17:49:48 +0000 |
parents | a6c67352ccac |
children | c65abbc91c5c |
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" | |
1801 | 18 #include "../config.h" |
1693 | 19 |
20 #include "../../config.h" | |
1776 | 21 #include "../../libvo/x11_common.h" |
1693 | 22 |
1697 | 23 #define mplMouseTimerConst 10 |
24 #define mplRedrawTimerConst 5 | |
1693 | 25 |
26 int mplMouseTimer = mplMouseTimerConst; | |
27 int mplRedrawTimer = mplRedrawTimerConst; | |
28 int mplGeneralTimer = -1; | |
29 int mplTimer = 0; | |
30 | |
31 int mplSkinChanged = 0; | |
32 | |
33 void mplMsgHandle( int msg,float param ); | |
34 | |
35 #include "widgets.h" | |
36 #include "play.h" | |
37 #include "menu.h" | |
38 #include "mw.h" | |
39 #include "sw.h" | |
1801 | 40 #include "widgets.h" |
1693 | 41 |
42 void mplTimerHandler( int signum ) | |
43 { | |
44 mplTimer++; | |
45 mplMouseTimer--; | |
46 mplRedrawTimer--; | |
47 mplGeneralTimer--; | |
48 if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 ); | |
49 if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 ); | |
50 if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 ); | |
51 } | |
52 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
53 void mplInit( int argc,char* argv[], char *envp[], void* disp ) |
1693 | 54 { |
1697 | 55 // allocates shmem to gtkShMem |
1742 | 56 // fork() a process which runs gtkThreadProc() [gtkPID] |
1693 | 57 gtkInit( argc,argv,envp ); |
1801 | 58 strcpy( gtkShMem->sb.name,cfgSkin ); |
1697 | 59 |
60 // allocates shmem to mplShMem | |
61 // init fields of this struct to default values | |
1693 | 62 mplMPlayerInit( argc,argv,envp ); |
63 | |
1697 | 64 message=mplErrorHandler; // error messagebox drawing function |
1693 | 65 |
1697 | 66 // 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
|
67 wsXInit(disp); |
1693 | 68 |
69 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
70 { | |
71 fprintf( stderr,langNEMDB ); | |
72 exit( 0 ); | |
73 } | |
74 | |
75 wsCreateWindow( &appMPlayer.subWindow, | |
76 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
77 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" ); | |
78 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
79 vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC); |
1742 | 80 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
|
81 |
1693 | 82 wsCreateWindow( &appMPlayer.mainWindow, |
83 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
84 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsShowWindow,"MPlayer" ); | |
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 | |
105 wsPostRedisplay( &appMPlayer.mainWindow ); | |
106 wsPostRedisplay( &appMPlayer.subWindow ); | |
107 | |
108 btnModify( evSetVolume,mplShMem->Volume ); | |
109 btnModify( evSetBalance,mplShMem->Balance ); | |
110 btnModify( evSetMoviePosition,mplShMem->Position ); | |
111 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
112 mplShMem->Playing=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
113 |
1697 | 114 // timerSetHandler( mplTimerHandler ); // various timer hacks |
115 // timerInit(); | |
1693 | 116 |
1709 | 117 // wsMainLoop(); // X event handler (calls mplTimerHandler periodically!) |
118 | |
119 } | |
120 | |
121 void mplDone(){ | |
1693 | 122 |
123 dbprintf( 1,"[mplayer] exit.\n" ); | |
124 | |
125 mplStop(); | |
1697 | 126 // timerDone(); |
127 gtkDone(); // kills the gtkThreadProc() process | |
1693 | 128 wsXDone(); |
1709 | 129 |
1693 | 130 } |
1709 | 131 |