Change-Id: I9e5084cc359b98a379a1f0b2a2c0cf5c3b0c031e
const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
mWindow = Dali::Window::New( windowPosition, mName, windowClassName, mWindowMode == Dali::Application::TRANSPARENT );
const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
mWindow = Dali::Window::New( windowPosition, mName, windowClassName, mWindowMode == Dali::Application::TRANSPARENT );
+
+ // Quit the application when the window is closed
+ GetImplementation( mWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit );
}
void Application::CreateAdaptor()
}
void Application::CreateAdaptor()
{
public:
typedef Dali::Window::IndicatorSignalType IndicatorSignalType;
{
public:
typedef Dali::Window::IndicatorSignalType IndicatorSignalType;
+ typedef Signal< void () > SignalType;
/**
* Create a new Window. This should only be called once by the Application class
/**
* Create a new Window. This should only be called once by the Application class
virtual void OnDestroy();
public: // Signals
virtual void OnDestroy();
public: // Signals
/**
* The user should connect to this signal to get a timing when indicator was shown / hidden.
*/
IndicatorSignalType& IndicatorVisibilityChangedSignal() { return mIndicatorVisibilityChangedSignal; }
/**
* The user should connect to this signal to get a timing when indicator was shown / hidden.
*/
IndicatorSignalType& IndicatorVisibilityChangedSignal() { return mIndicatorVisibilityChangedSignal; }
+ /**
+ * This signal is emitted when the window is requesting to be deleted
+ */
+ SignalType& DeleteRequestSignal() { return mDeleteRequestSignal; }
+
private:
typedef std::vector<Indicator*> DiscardedIndicators;
private:
typedef std::vector<Indicator*> DiscardedIndicators;
// Signals
IndicatorSignalType mIndicatorVisibilityChangedSignal;
// Signals
IndicatorSignalType mIndicatorVisibilityChangedSignal;
+ SignalType mDeleteRequestSignal;
};
} // namespace Adaptor
};
} // namespace Adaptor
mAbortHandler.AbortOnSignal( SIGINT );
mAbortHandler.AbortOnSignal( SIGQUIT );
mAbortHandler.AbortOnSignal( SIGKILL );
mAbortHandler.AbortOnSignal( SIGINT );
mAbortHandler.AbortOnSignal( SIGQUIT );
mAbortHandler.AbortOnSignal( SIGKILL );
+ mAbortHandler.AbortOnSignal( SIGTERM );
+ mAbortHandler.AbortOnSignal( SIGHUP );
mObserver.OnInit();
break;
mObserver.OnInit();
break;
: mWindow( window ),
mWindowPropertyHandler( NULL ),
mClientMessagehandler( NULL ),
: mWindow( window ),
mWindowPropertyHandler( NULL ),
mClientMessagehandler( NULL ),
+ mWindowDeleteRequestHandler( NULL ),
mEcoreWindow( 0 )
{
// store ecore window handle
mEcoreWindow( 0 )
{
// store ecore window handle
if( mWindow->mEcoreEventHander )
{
ecore_x_input_multi_select( mEcoreWindow );
if( mWindow->mEcoreEventHander )
{
ecore_x_input_multi_select( mEcoreWindow );
+
+ // This ensures that we catch the window close (or delete) request
+ ecore_x_icccm_protocol_set( mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE );
+
mWindowPropertyHandler= ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this );
mClientMessagehandler = ecore_event_handler_add( ECORE_X_EVENT_CLIENT_MESSAGE, EcoreEventClientMessage, this );
mWindowPropertyHandler= ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this );
mClientMessagehandler = ecore_event_handler_add( ECORE_X_EVENT_CLIENT_MESSAGE, EcoreEventClientMessage, this );
+ mWindowDeleteRequestHandler = ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this );
{
ecore_event_handler_del( mClientMessagehandler );
}
{
ecore_event_handler_del( mClientMessagehandler );
}
+ if ( mWindowDeleteRequestHandler )
+ {
+ ecore_event_handler_del( mWindowDeleteRequestHandler );
+ }
+ /// Called when the window receives a delete request
+ static Eina_Bool EcoreEventWindowDeleteRequest( void* data, int type, void* event )
+ {
+ EventHandler* handler( (EventHandler*)data );
+ handler->mWindow->mDeleteRequestSignal.Emit();
+ return ECORE_CALLBACK_DONE;
+ }
+
// Data
Window* mWindow;
Ecore_Event_Handler* mWindowPropertyHandler;
Ecore_Event_Handler* mClientMessagehandler;
// Data
Window* mWindow;
Ecore_Event_Handler* mWindowPropertyHandler;
Ecore_Event_Handler* mClientMessagehandler;
+ Ecore_Event_Handler* mWindowDeleteRequestHandler;
Ecore_X_Window mEcoreWindow;
};
Ecore_X_Window mEcoreWindow;
};