WinRT: emit SDL_APP_TERMINATING
authorDavid Ludwig <dludwig@pobox.com>
Tue, 04 Mar 2014 19:49:11 -0500
changeset 8581 c001dc3e258b
parent 8580 2754762c0860
child 8582 c3e9a2b93517
WinRT: emit SDL_APP_TERMINATING
src/core/winrt/SDL_winrtapp_direct3d.cpp
src/core/winrt/SDL_winrtapp_direct3d.h
--- a/src/core/winrt/SDL_winrtapp_direct3d.cpp	Tue Mar 04 19:30:36 2014 -0500
+++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp	Tue Mar 04 19:49:11 2014 -0500
@@ -259,6 +259,9 @@
     CoreApplication::Resuming +=
         ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnResuming);
 
+    CoreApplication::Exiting +=
+        ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnExiting);
+
     DisplayProperties::OrientationChanged +=
         ref new DisplayPropertiesEventHandler(this, &SDL_WinRTApp::OnOrientationChanged);
 
@@ -578,6 +581,11 @@
     }
 }
 
+void SDL_WinRTApp::OnExiting(Platform::Object^ sender, Platform::Object^ args)
+{
+    SDL_SendAppEvent(SDL_APP_TERMINATING);
+}
+
 static void
 WINRT_LogPointerEvent(const char * header, Windows::UI::Core::PointerEventArgs ^ args, Windows::Foundation::Point transformedPoint)
 {
--- a/src/core/winrt/SDL_winrtapp_direct3d.h	Tue Mar 04 19:30:36 2014 -0500
+++ b/src/core/winrt/SDL_winrtapp_direct3d.h	Tue Mar 04 19:49:11 2014 -0500
@@ -35,6 +35,7 @@
     void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
     void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
     void OnResuming(Platform::Object^ sender, Platform::Object^ args);
+    void OnExiting(Platform::Object^ sender, Platform::Object^ args);
     void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
     void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
     void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);