# HG changeset patch # User ib # Date 1310207027 0 # Node ID cee9987bc81d825f7b8a0e599b9266fdb7bb05b9 # Parent 690c9b35f4d146b652e0eb273716683cddd859f3 Remove guiExit(). Integrate it into mplayer(). diff -r 690c9b35f4d1 -r cee9987bc81d gui/cfg.c --- a/gui/cfg.c Fri Jul 08 21:57:18 2011 +0000 +++ b/gui/cfg.c Sat Jul 09 10:23:47 2011 +0000 @@ -31,6 +31,7 @@ #include "libvo/video_out.h" #include "libvo/x11_common.h" #include "mixer.h" +#include "mp_core.h" #include "mp_msg.h" #include "mpcommon.h" #include "mplayer.h" @@ -279,14 +280,14 @@ if (!gui_conf) { gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } m_config_register_options(gui_conf, gui_opts); if (!disable_gui_conf && (m_config_parse_config_file(gui_conf, cfg) < 0)) { gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_ConfigFileError); -// guiExit(1); +// mplayer(MPLAYER_EXIT_GUI, 1, 0); } free(cfg); diff -r 690c9b35f4d1 -r cee9987bc81d gui/interface.c --- a/gui/interface.c Fri Jul 08 21:57:18 2011 +0000 +++ b/gui/interface.c Sat Jul 09 10:23:47 2011 +0000 @@ -45,6 +45,7 @@ #include "libvo/video_out.h" #include "libvo/x11_common.h" #include "mixer.h" +#include "mp_core.h" #include "mp_msg.h" #include "mpcommon.h" #include "mplayer.h" @@ -123,11 +124,11 @@ switch (i) { case -1: gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinNotFound, skinName); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); case -2: gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinCfgError, skinName); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } // initialize windows @@ -136,7 +137,7 @@ if (!mainDrawBuffer) { gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } if (gui_save_pos) { @@ -491,7 +492,7 @@ if (!video_driver_list && !video_driver_list[0]) { gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_IDFGCVD); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } { @@ -1080,6 +1081,10 @@ break; } + + case MPLAYER_EXIT_GUI: + exit_player_with_rc((enum exit_reason)fparam, (enum exit_reason)fparam >= EXIT_ERROR); + break; } } @@ -1181,11 +1186,6 @@ update_set_of_subtitles(); } -void guiExit(enum exit_reason how) -{ - exit_player_with_rc(how, how >= EXIT_ERROR); -} - // NOTE TO MYSELF: This function is nonsense. // MPlayer should pass messages to the GUI // which must decide then which message has diff -r 690c9b35f4d1 -r cee9987bc81d gui/interface.h --- a/gui/interface.h Fri Jul 08 21:57:18 2011 +0000 +++ b/gui/interface.h Sat Jul 09 10:23:47 2011 +0000 @@ -21,7 +21,6 @@ #include "config.h" #include "m_config.h" -#include "mp_core.h" #include "playtree.h" #include "stream/stream.h" @@ -65,6 +64,7 @@ #define gtkClearStruct 99 enum { + MPLAYER_EXIT_GUI, MPLAYER_SET_AUTO_QUALITY, MPLAYER_SET_BRIGHTNESS, MPLAYER_SET_CONTRAST, @@ -192,6 +192,5 @@ void mplayerLoadFont(void); void mplayerLoadSubtitle(char *name); void gmp_msg(int mod, int lev, const char *format, ...); -void guiExit(enum exit_reason how); #endif /* MPLAYER_GUI_INTERFACE_H */ diff -r 690c9b35f4d1 -r cee9987bc81d gui/ui/actions.c --- a/gui/ui/actions.c Fri Jul 08 21:57:18 2011 +0000 +++ b/gui/ui/actions.c Sat Jul 09 10:23:47 2011 +0000 @@ -176,7 +176,7 @@ if (!menuDrawBuffer) { gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } wsResizeWindow(&guiApp.menuWindow, guiApp.menu.width, guiApp.menu.height); @@ -220,7 +220,7 @@ if (!mainDrawBuffer) { gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } wsDestroyWindow(&guiApp.mainWindow); diff -r 690c9b35f4d1 -r cee9987bc81d gui/ui/main.c --- a/gui/ui/main.c Fri Jul 08 21:57:18 2011 +0000 +++ b/gui/ui/main.c Sat Jul 09 10:23:47 2011 +0000 @@ -79,7 +79,7 @@ void uiMainDraw( void ) { - if ( guiApp.mainWindow.State == wsWindowClosed ) guiExit( EXIT_QUIT ); + if ( guiApp.mainWindow.State == wsWindowClosed ) mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 ); if ( guiApp.mainWindow.Visible == wsWindowNotVisible || !mainVisible ) return; @@ -109,7 +109,7 @@ { // --- user events case evExit: - guiExit( EXIT_QUIT ); + mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 ); break; case evPlayNetwork: diff -r 690c9b35f4d1 -r cee9987bc81d gui/ui/playbar.c --- a/gui/ui/playbar.c Fri Jul 08 21:57:18 2011 +0000 +++ b/gui/ui/playbar.c Sat Jul 09 10:23:47 2011 +0000 @@ -249,7 +249,7 @@ if ( ( playbarDrawBuffer = malloc( guiApp.playbar.Bitmap.ImageSize ) ) == NULL ) { gmp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_NEMDB ); - guiExit( EXIT_ERROR ); + mplayer( MPLAYER_EXIT_GUI, EXIT_ERROR, 0 ); } guiApp.playbarWindow.Parent=guiApp.subWindow.WindowID; diff -r 690c9b35f4d1 -r cee9987bc81d gui/ui/sub.c --- a/gui/ui/sub.c Fri Jul 08 21:57:18 2011 +0000 +++ b/gui/ui/sub.c Sat Jul 09 10:23:47 2011 +0000 @@ -35,7 +35,7 @@ void uiSubDraw( void ) { - if ( guiApp.subWindow.State == wsWindowClosed ) guiExit( EXIT_QUIT ); + if ( guiApp.subWindow.State == wsWindowClosed ) mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 ); if ( guiApp.subWindow.State == wsWindowFocusIn ) subVisible++; if ( guiApp.subWindow.State == wsWindowFocusOut && metacity_hack != 3 ) subVisible--; diff -r 690c9b35f4d1 -r cee9987bc81d gui/wm/ws.c --- a/gui/wm/ws.c Fri Jul 08 21:57:18 2011 +0000 +++ b/gui/wm/ws.c Sat Jul 09 10:23:47 2011 +0000 @@ -424,7 +424,7 @@ if (depth < 15) { mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_WS_ColorDepthTooLow); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } XMatchVisualInfo(wsDisplay, wsScreen, depth, TrueColor, &win->VisualInfo); @@ -550,7 +550,7 @@ if (i == wsWLCount) { mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_WS_TooManyOpenWindows); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } wsWindowList[i] = win; @@ -1358,7 +1358,7 @@ if (win->xImage == NULL) { mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_WS_ShmError); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } win->Shminfo.shmid = shmget(IPC_PRIVATE, win->xImage->bytes_per_line * win->xImage->height, IPC_CREAT | 0777); @@ -1366,7 +1366,7 @@ if (win->Shminfo.shmid < 0) { XDestroyImage(win->xImage); mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_WS_ShmError); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } win->Shminfo.shmaddr = (char *)shmat(win->Shminfo.shmid, 0, 0); @@ -1378,7 +1378,7 @@ shmdt(win->Shminfo.shmaddr); mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_WS_ShmError); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } win->xImage->data = win->Shminfo.shmaddr; @@ -1394,7 +1394,7 @@ if ((win->xImage->data = malloc(win->xImage->bytes_per_line * win->xImage->height)) == NULL) { mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_WS_NotEnoughMemoryDrawBuffer); - guiExit(EXIT_ERROR); + mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); } }