X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmisc%2Fbeos_specific.cpp;h=7ddd9fd48d2266cdca8aec57492549efbf58fca1;hb=743502ebb1619cde44cb86b9fe6d9ac9867dc422;hp=d1740e0ca22c03a91193408c40cf18936ab158ee;hpb=4effacde134d7d0d5edd12b43dd352eedda7edc7;p=vlc diff --git a/src/misc/beos_specific.cpp b/src/misc/beos_specific.cpp index d1740e0ca2..7ddd9fd48d 100644 --- a/src/misc/beos_specific.cpp +++ b/src/misc/beos_specific.cpp @@ -1,8 +1,8 @@ /***************************************************************************** - * beos_init.cpp: Initialization for BeOS specific features + * beos_init.cpp: Initialization for BeOS specific features ***************************************************************************** - * Copyright (C) 1999-2001 VideoLAN - * $Id: beos_specific.cpp,v 1.31 2003/05/08 01:05:14 titer Exp $ + * Copyright (C) 1999-2004 VideoLAN + * $Id: beos_specific.cpp,v 1.37 2004/01/25 17:16:06 zorglub Exp $ * * Authors: Jean-Marc Dressler * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -29,7 +29,7 @@ #include #include /* strdup() */ -#include /* free() */ +#include /* free() */ extern "C" { @@ -52,18 +52,19 @@ public: virtual void RefsReceived(BMessage* message); virtual void MessageReceived(BMessage* message); virtual bool QuitRequested(); - + private: BWindow* fInterfaceWindow; BMessage* fRefsMessage; + bool fReadyToQuit; }; /***************************************************************************** * Static vars *****************************************************************************/ -//const uint32 INTERFACE_CREATED = 'ifcr'; /* message sent from interface */ #include "../../modules/gui/beos/MsgVals.h" +#define REALLY_QUIT 'requ' extern "C" { @@ -89,9 +90,8 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] ) /***************************************************************************** * system_Configure: check for system specific configuration options. *****************************************************************************/ -void system_Configure( vlc_t * ) +void system_Configure( vlc_t *, int *pi_argc, char *ppsz_argv[] ) { - } /***************************************************************************** @@ -100,7 +100,7 @@ void system_Configure( vlc_t * ) void system_End( vlc_t *p_this ) { /* Tell the BApplication to die */ - be_app->PostMessage( B_QUIT_REQUESTED ); + be_app->PostMessage( REALLY_QUIT ); vlc_thread_join( p_this->p_libvlc->p_appthread ); vlc_object_destroy( p_this->p_libvlc->p_appthread ); @@ -115,7 +115,8 @@ void system_End( vlc_t *p_this ) *****************************************************************************/ static void AppThread( vlc_object_t * p_this ) { - VlcApplication *BeApp = new VlcApplication("application/x-vnd.videolan-vlc"); + VlcApplication * BeApp = + new VlcApplication("application/x-vnd.videolan-vlc"); vlc_object_attach( p_this, p_this->p_vlc ); BeApp->p_this = p_this; BeApp->Run(); @@ -131,7 +132,8 @@ static void AppThread( vlc_object_t * p_this ) VlcApplication::VlcApplication( char * psz_mimetype ) :BApplication( psz_mimetype ), fInterfaceWindow( NULL ), - fRefsMessage( NULL ) + fRefsMessage( NULL ), + fReadyToQuit( false ) { /* Nothing to do, we use the default constructor */ } @@ -163,12 +165,12 @@ void VlcApplication::AboutRequested( ) void VlcApplication::ReadyToRun( ) { BPath path; - app_info info; + app_info info; /* Get the program path */ - be_app->GetAppInfo( &info ); - BEntry entry( &info.ref ); - entry.GetPath( &path ); + be_app->GetAppInfo( &info ); + BEntry entry( &info.ref ); + entry.GetPath( &path ); path.GetParent( &path ); p_this->p_libvlc->psz_vlcpath = strdup( path.Path() ); @@ -182,12 +184,12 @@ void VlcApplication::ReadyToRun( ) *****************************************************************************/ void VlcApplication::RefsReceived(BMessage* message) { - if (fInterfaceWindow) - fInterfaceWindow->PostMessage(message); - else { - delete fRefsMessage; - fRefsMessage = new BMessage(*message); - } + if (fInterfaceWindow) + fInterfaceWindow->PostMessage(message); + else { + delete fRefsMessage; + fRefsMessage = new BMessage(*message); + } } /***************************************************************************** @@ -203,33 +205,35 @@ void VlcApplication::RefsReceived(BMessage* message) *****************************************************************************/ void VlcApplication::MessageReceived(BMessage* message) { - switch (message->what) { - case INTERFACE_CREATED: { - BWindow* interfaceWindow; - if (message->FindPointer("window", (void**)&interfaceWindow) == B_OK) { - fInterfaceWindow = interfaceWindow; - if (fRefsMessage) { - fInterfaceWindow->PostMessage(fRefsMessage); - delete fRefsMessage; - fRefsMessage = NULL; - } - } - break; - } - - default: - BApplication::MessageReceived(message); - } + switch (message->what) { + case INTERFACE_CREATED: { + BWindow* interfaceWindow; + if (message->FindPointer("window", (void**)&interfaceWindow) == B_OK) { + fInterfaceWindow = interfaceWindow; + if (fRefsMessage) { + fInterfaceWindow->PostMessage(fRefsMessage); + delete fRefsMessage; + fRefsMessage = NULL; + } + } + break; + } + + case REALLY_QUIT: + fReadyToQuit = true; + PostMessage( B_QUIT_REQUESTED ); + break; + + default: + BApplication::MessageReceived(message); + } } bool VlcApplication::QuitRequested() { - if( CurrentMessage() && CurrentMessage()->FindBool( "shortcut" ) ) + if( !fReadyToQuit ) { - /* The user hit Alt+Q, don't let the be_app exit without cleaning. - Let the interface do the job */ - if( fInterfaceWindow ) - fInterfaceWindow->PostMessage( B_QUIT_REQUESTED ); + p_this->p_vlc->b_die = 1; return false; }