Mercurial > mplayer.hg
annotate Gui/mplayer/psignal.c @ 4361:e7744189e03f
fix a decimation/scaling bug in vo_zr and some verbose messages have changed - patch by Rik Snel <rsnel@cube.dyndns.org>
author | arpi |
---|---|
date | Sat, 26 Jan 2002 19:01:32 +0000 |
parents | df69220a8d49 |
children | b013d01d9968 |
rev | line source |
---|---|
1693 | 1 |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
4 #include <string.h> | |
5 #include <signal.h> | |
6 #include <unistd.h> | |
7 | |
8 #include "widgets.h" | |
3596 | 9 #include "gtk/menu.h" |
1693 | 10 #include "play.h" |
3499 | 11 #include "gtk/fs.h" |
1693 | 12 |
13 #include "../app.h" | |
14 | |
3596 | 15 #include "../../config.h" |
16 #include "../../help_mp.h" | |
17 #include "../../libvo/x11_common.h" | |
18 #include "../../libmpdemux/stream.h" | |
19 | |
1693 | 20 #include "../skin/skin.h" |
21 #include "../wm/ws.h" | |
22 #include "../error.h" | |
23 | |
24 #include "./mplayer.h" | |
25 | |
26 #define gtkShow( w ) gtkShMem->vs.window=w; gtkSendMessage( evShowWindow ); | |
27 | |
28 pid_t mplMPlayerPID = 0; | |
29 pid_t mplParentPID = 0; | |
30 | |
1741 | 31 pid_t gtkPID = 0; |
1693 | 32 |
33 int mplCriticalError = 0; | |
34 int gtkIsOk = 0; | |
35 | |
36 void mplErrorHandler( int critical,const char * format, ... ) | |
37 { | |
38 char * p; | |
39 va_list ap; | |
40 int n; | |
41 | |
42 if ( (p=(char *)malloc( 512 ) ) == NULL ) return; | |
43 va_start( ap,format ); | |
44 n=vsnprintf( p,512,format,ap ); | |
45 va_end( ap ); | |
46 mplCriticalError=critical; | |
1907 | 47 gtkMessageBox( GTK_MB_ERROR,p ); |
1693 | 48 } |
49 | |
50 void gtkSigHandler( int s ) | |
51 { | |
52 if ( s != SIGTYPE ) return; | |
53 #ifdef DEBUG | |
54 dbprintf( 5,"[psignal] gtk sig handler msg: %d\n",gtkShMem->message ); | |
55 #endif | |
56 switch ( gtkShMem->message ) | |
57 { | |
58 case evHideWindow: | |
59 switch ( gtkShMem->vs.window ) | |
60 { | |
61 case evPlayList: gtk_widget_hide( PlayList ); gtkVisiblePlayList=0; break; | |
62 case evSkinBrowser: gtk_widget_hide( SkinBrowser ); gtkVisibleSkinBrowser=0; break; | |
63 case evLoad: gtk_widget_hide( FileSelect ); gtkVisibleFileSelect=0; break; | |
64 } | |
65 break; | |
66 case evSkinBrowser: | |
67 if ( gtkVisibleSkinBrowser ) gtk_widget_hide( SkinBrowser ); | |
68 gtkClearList( SkinList ); | |
1907 | 69 if ( gtkFillSkinList( sbMPlayerPrefixDir )&>kFillSkinList( sbMPlayerDirInHome ) ) |
1693 | 70 { |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1858
diff
changeset
|
71 gtkSetDefaultToCList( SkinList,skinName ); |
1693 | 72 gtk_widget_show( SkinBrowser ); |
73 gtkVisibleSkinBrowser=1; | |
74 gtkShow( evSkinBrowser ); | |
75 } | |
76 break; | |
77 case evPreferences: | |
78 if ( gtkVisibleOptions ) gtk_widget_hide( Options ); | |
79 gtk_widget_show( Options ); | |
80 gtkVisibleOptions=1; | |
81 break; | |
82 case evPlayList: | |
83 if ( gtkVisiblePlayList ) gtk_widget_hide( PlayList ); | |
84 gtk_widget_show( PlayList ); | |
85 gtkVisiblePlayList=1; | |
86 gtkShow( evPlayList ); | |
87 break; | |
88 case evLoad: | |
3499 | 89 ShowFileSelect( fsVideoSelector ); |
90 #if 0 | |
1693 | 91 if ( gtkVisibleFileSelect ) gtk_widget_hide( FileSelect ); |
92 gtk_widget_show( FileSelect ); | |
93 gtkVisibleFileSelect=1; | |
94 gtkShow( evPlay ); | |
3499 | 95 #endif |
1693 | 96 break; |
1741 | 97 case evFirstLoad: |
3499 | 98 ShowFileSelect( fsVideoSelector ); |
99 #if 0 | |
1741 | 100 if ( gtkVisibleFileSelect ) gtk_widget_hide( FileSelect ); |
101 gtk_widget_show( FileSelect ); | |
102 gtkVisibleFileSelect=1; | |
103 gtkShow( evFirstLoad ); | |
3499 | 104 #endif |
105 break; | |
106 case evLoadSubtitle: | |
107 ShowFileSelect( fsSubtitleSelector ); | |
108 // gtkShow( evPlay ); | |
1741 | 109 break; |
1693 | 110 case evMessageBox: |
3596 | 111 gtk_label_set_text( GTK_LABEL( gtkMessageBoxText ),gtkShMem->mb.str ); |
1925 | 112 if( gtkVisibleMessageBox ) gtk_widget_hide( MessageBox ); |
113 switch( gtkShMem->mb.type) | |
114 { | |
115 case GTK_MB_FATAL: | |
3595 | 116 gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_FatalError ); |
1925 | 117 gtk_widget_hide( WarningPixmap ); |
118 gtk_widget_show( ErrorPixmap ); | |
119 break; | |
120 case GTK_MB_ERROR: | |
3595 | 121 gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Error ); |
1925 | 122 gtk_widget_hide( WarningPixmap ); |
123 gtk_widget_show( ErrorPixmap ); | |
124 break; | |
125 case GTK_MB_WARNING: | |
3595 | 126 gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Warning ); |
1925 | 127 gtk_widget_show( WarningPixmap ); |
128 gtk_widget_hide( ErrorPixmap ); | |
129 break; | |
130 } | |
1693 | 131 gtk_widget_show( MessageBox ); |
132 gtkVisibleMessageBox=1; | |
133 break; | |
134 case evAbout: | |
135 if ( gtkVisibleAboutBox ) gtk_widget_hide( AboutBox ); | |
136 gtk_widget_show( AboutBox ); | |
137 gtkVisibleAboutBox=1; | |
138 break; | |
139 case evExit: | |
1700 | 140 gtk_main_quit(); |
1693 | 141 break; |
2901 | 142 case evShowPopUpMenu: |
3054 | 143 gtkShMem->popupmenu=evNone; gtkShMem->popupmenuparam=0; |
2980 | 144 if ( gtkShMem->visiblepopupmenu ) gtk_widget_hide_on_delete( PopUpMenu ); |
145 PopUpMenu=create_PopUpMenu(); | |
2901 | 146 gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 ); |
2980 | 147 gtkShMem->visiblepopupmenu=1; |
148 break; | |
149 case evHidePopUpMenu: | |
150 if ( gtkShMem->visiblepopupmenu ) gtk_widget_hide_on_delete( PopUpMenu ); | |
151 gtkShMem->visiblepopupmenu=0; | |
2901 | 152 break; |
1693 | 153 } |
154 gtkShMem->message=0; | |
155 } | |
156 | |
157 void mplMainSigHandler( int s ) | |
158 { | |
1741 | 159 if ( s != SIGTYPE ) return; |
160 | |
1801 | 161 // #ifdef DEBUG |
1802 | 162 // if ( gtkShMem->message ) dbprintf( 5,"[psignal] main sig handler gtk msg: %d\n",gtkShMem->message ); |
1741 | 163 // if ( mplShMem->message ) dbprintf( 5,"[psignal] main sig handler mpl msg: %d\n",mplShMem->message ); |
1801 | 164 // #endif |
1693 | 165 |
166 switch ( gtkShMem->message ) | |
167 { | |
168 case evGtkIsOk: | |
169 #ifdef DEBUG | |
1741 | 170 dbprintf( 5,"[psignal] gtk is ok.\n" ); |
1693 | 171 #endif |
172 gtkIsOk=True; | |
173 break; | |
174 case evShowWindow: | |
175 switch ( gtkShMem->vs.window ) | |
176 { | |
177 case evPlayList: gtkVisiblePlayList=1; break; | |
178 case evLoad: gtkVisibleFileSelect=1; break; | |
179 case evSkinBrowser: gtkVisibleSkinBrowser=1; break; | |
180 } | |
181 break; | |
182 case evHideWindow: | |
183 switch ( gtkShMem->vs.window ) | |
184 { | |
185 case evPlayList: | |
186 btnModify( evPlayList,btnReleased ); gtkVisiblePlayList=0; | |
187 mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); | |
188 break; | |
189 case evSkinBrowser: gtkVisibleSkinBrowser=0; break; | |
190 case evLoad: gtkVisibleFileSelect=0; break; | |
191 } | |
192 break; | |
1802 | 193 case evSkinBrowser: mplShMem->SkinChange=1; break; |
1693 | 194 case evFileLoaded: |
1891 | 195 printf("*** gtkShMem->fs.dir == '%s' \n",gtkShMem->fs.dir); |
196 printf("*** gtkShMem->fs.filename == '%s' \n",gtkShMem->fs.filename); | |
1815 | 197 strcpy( mplShMem->Filename,gtkShMem->fs.dir ); |
198 strcat( mplShMem->Filename,"/" ); | |
199 strcat( mplShMem->Filename,gtkShMem->fs.filename ); | |
200 printf( "%%%%%%%% Playing file: %s\n",mplShMem->Filename ); | |
1813 | 201 mplShMem->FilenameChanged=1; |
2447 | 202 mplShMem->StreamType=STREAMTYPE_FILE; |
1693 | 203 if ( mplMainAutoPlay ) mplGeneralTimer=1; |
204 break; | |
3499 | 205 case evSubtitleLoaded: |
206 printf("*** gtkShMem->fs.subtitlename == '%s' \n",gtkShMem->fs.subtitlename ); | |
207 strcpy( mplShMem->Subtitlename,gtkShMem->fs.subtitlename ); | |
208 mplShMem->SubtitleChanged=1; | |
209 break; | |
2940 | 210 case evShowPopUpMenu: |
3054 | 211 fprintf( stderr,"[psignal] PopUpMenu: %d param: %d\n",gtkShMem->popupmenu,gtkShMem->popupmenuparam ); |
2940 | 212 mplMiddleMenu=1; mplGeneralTimer=1; |
213 break; | |
1693 | 214 case evMessageBox: |
215 if ( mplCriticalError ) | |
216 { gtkSendMessage( evExit ); exit( 1 ); } | |
217 mplCriticalError=0; | |
218 break; | |
219 } | |
220 | |
221 // switch( mplShMem->message ) | |
222 // { | |
223 // } | |
224 gtkShMem->message=0; | |
1741 | 225 // mplShMem->message=0; |
1693 | 226 } |
227 | |
228 void gtkSendMessage( int msg ) | |
229 { | |
230 if ( !gtkIsOk ) return; | |
231 gtkShMem->message=msg; | |
1741 | 232 kill( gtkPID,SIGTYPE ); |
1693 | 233 } |