diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2003-06-10 13:30:57 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2003-06-10 13:30:57 +0000 |
commit | e420b33c1a48b26dd200c47cb79486dada0253bd (patch) | |
tree | 4cdf2a3678548539cd5cacd6b9ce8524ff063cac /vcl | |
parent | c70ea68cc1c2e8483b06ee7a989e0e66c8eab9af (diff) |
INTEGRATION: CWS vcl11 (1.11.34); FILE MERGED
2003/05/28 13:19:10 pl 1.11.34.2: #14606# refined SaveYourself request handling
2003/05/27 16:59:01 pl 1.11.34.1: #14606# save documents in session
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/source/app/sm.cxx | 79 |
1 files changed, 72 insertions, 7 deletions
diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx index dcd835223d06..eb34d9c81ea3 100644 --- a/vcl/unx/source/app/sm.cxx +++ b/vcl/unx/source/app/sm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sm.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: vg $ $Date: 2003-04-15 16:08:43 $ + * last change: $Author: vg $ $Date: 2003-06-10 14:30:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,8 @@ #include <svapp.hxx> #endif +#include <osl/conditn.h> + #define USE_SM_EXTENSION extern "C" void SAL_CALL ICEConnectionWorker( void* ); @@ -125,6 +127,9 @@ IceConn* ICEConnectionObserver::pConnections = NULL; int ICEConnectionObserver::nConnections = 0; oslMutex ICEConnectionObserver::ICEMutex = NULL; oslThread ICEConnectionObserver::ICEThread = NULL; +oslCondition SessionManagerClient::aSaveCond = NULL; +oslCondition SessionManagerClient::aDieCond = NULL; + static SmProp* pSmProps = NULL; static SmProp** ppSmProps = NULL; @@ -188,6 +193,24 @@ static void BuildSmPropertyList() } +IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, pDummy ) +{ +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "posting save documents event\n" ); +#endif + Application::EnableDialogCancel( TRUE ); + ApplicationEvent aEvent( String( RTL_CONSTASCII_USTRINGPARAM( "SessionManager" ) ), + ApplicationAddress(), + ByteString( APPEVENT_SAVEDOCUMENTS_STRING ), + String( RTL_CONSTASCII_USTRINGPARAM( "All" ) ) ); + + if( GetpApp() ) + GetpApp()->AppEvent( aEvent ); + if( aSaveCond ) + osl_setCondition( aSaveCond ); + return 0; +} + void SessionManagerClient::SaveYourselfProc( SmcConn connection, SmPointer client_data, @@ -211,6 +234,22 @@ void SessionManagerClient::SaveYourselfProc( #endif BuildSmPropertyList(); #ifdef USE_SM_EXTENSION + if( shutdown ) + { + aSaveCond = osl_createCondition(); + if( aSaveCond ) + osl_resetCondition( aSaveCond ); + Application::PostUserEvent( STATIC_LINK( NULL, SessionManagerClient, SaveYourselfHdl ) ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "waiting for save yourself event to be processed\n" ); +#endif + osl_waitCondition( aSaveCond, NULL ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "wakeup on save yourself condition\n" ); +#endif + osl_destroyCondition( aSaveCond ); + aSaveCond = NULL; + } SmcSetProperties( aSmcConnection, nSmProps, ppSmProps ); SmcSaveYourselfDone( aSmcConnection, True ); #endif @@ -222,12 +261,21 @@ IMPL_STATIC_LINK( SessionManagerClient, ShutDownHdl, void*, pDummy ) fprintf( stderr, GetSalData()->pFirstFrame_ ? "shutdown on first frame\n" : "shutdown event but no frame\n" ); #endif if( GetSalData()->pFirstFrame_ ) - { GetSalData()->pFirstFrame_->maFrameData.ShutDown(); - } return 0; } +void SessionManagerClient::shutdownDone() +{ +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "SessionManagerClient::shutdownDone\n" ); + if( ! aDieCond ) + fprintf( stderr, "no DieCond\n" ); +#endif + if( aDieCond ) + osl_setCondition( aDieCond ); +} + void SessionManagerClient::DieProc( SmcConn connection, SmPointer client_data @@ -236,12 +284,29 @@ void SessionManagerClient::DieProc( #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "Session: die\n" ); #endif + if( connection == aSmcConnection ) + { + aSmcConnection = NULL; + aDieCond = osl_createCondition(); + if( aDieCond ) + osl_resetCondition( aDieCond ); + Application::PostUserEvent( STATIC_LINK( NULL, SessionManagerClient, ShutDownHdl ) ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "waiting for shutdown event to be processed\n" ); +#endif + osl_waitCondition( aDieCond, NULL ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "wakeup on die condition\n" ); +#endif + osl_destroyCondition( aDieCond ); + aDieCond = NULL; + } #ifdef USE_SM_EXTENSION +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "closing connection\n" ); +#endif SmcCloseConnection( connection, 0, NULL ); #endif - if( connection == aSmcConnection ) - aSmcConnection = NULL; - Application::PostUserEvent( STATIC_LINK( NULL, SessionManagerClient, ShutDownHdl ) ); } void SessionManagerClient::SaveCompleteProc( |