Mercurial > mplayer.hg
annotate Gui/mplayer/mplayer.c @ 1801:e16646a140fd
fix skin change
author | pontscho |
---|---|
date | Fri, 31 Aug 2001 13:05:37 +0000 |
parents | 2e86c5c8071e |
children | a6c67352ccac |
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 { |
55 // parse_cfgfiles( argc,argv,envp ); | |
1697 | 56 |
57 // allocates shmem to gtkShMem | |
1742 | 58 // fork() a process which runs gtkThreadProc() [gtkPID] |
1693 | 59 gtkInit( argc,argv,envp ); |
1801 | 60 strcpy( gtkShMem->sb.name,cfgSkin ); |
1697 | 61 |
62 // allocates shmem to mplShMem | |
63 // init fields of this struct to default values | |
1693 | 64 mplMPlayerInit( argc,argv,envp ); |
65 | |
1697 | 66 message=mplErrorHandler; // error messagebox drawing function |
1693 | 67 |
1697 | 68 // 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
|
69 wsXInit(disp); |
1693 | 70 |
71 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
72 { | |
73 fprintf( stderr,langNEMDB ); | |
74 exit( 0 ); | |
75 } | |
76 | |
77 wsCreateWindow( &appMPlayer.subWindow, | |
78 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
79 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" ); | |
80 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
81 vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC); |
1742 | 82 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
|
83 |
1693 | 84 wsCreateWindow( &appMPlayer.mainWindow, |
85 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
86 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsShowWindow,"MPlayer" ); | |
87 | |
88 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
89 | |
90 mplMenuInit(); | |
91 | |
92 #ifdef DEBUG | |
93 dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen ); | |
94 dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); | |
95 dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); | |
96 #endif | |
97 | |
98 appMPlayer.mainWindow.ReDraw=mplMainDraw; | |
99 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
100 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
101 | |
102 appMPlayer.subWindow.ReDraw=mplSubDraw; | |
103 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
104 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
105 appMPlayer.subWindow.ReSize=mplResize; | |
106 | |
107 wsPostRedisplay( &appMPlayer.mainWindow ); | |
108 wsPostRedisplay( &appMPlayer.subWindow ); | |
109 | |
110 btnModify( evSetVolume,mplShMem->Volume ); | |
111 btnModify( evSetBalance,mplShMem->Balance ); | |
112 btnModify( evSetMoviePosition,mplShMem->Position ); | |
113 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
114 mplShMem->Playing=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
115 |
1697 | 116 // timerSetHandler( mplTimerHandler ); // various timer hacks |
117 // timerInit(); | |
1693 | 118 |
1709 | 119 // wsMainLoop(); // X event handler (calls mplTimerHandler periodically!) |
120 | |
121 } | |
122 | |
123 void mplDone(){ | |
1693 | 124 |
125 dbprintf( 1,"[mplayer] exit.\n" ); | |
126 | |
127 mplStop(); | |
1697 | 128 // timerDone(); |
129 gtkDone(); // kills the gtkThreadProc() process | |
1693 | 130 wsXDone(); |
1709 | 131 |
1693 | 132 } |
1709 | 133 |