WinRT: emit SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events
authorDavid Ludwig <dludwig@pobox.com>
Tue, 04 Mar 2014 19:30:36 -0500
changeset 8580 2754762c0860
parent 8579 ee7126c459d0
child 8581 c001dc3e258b
WinRT: emit SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events
src/core/winrt/SDL_winrtapp_direct3d.cpp
--- a/src/core/winrt/SDL_winrtapp_direct3d.cpp	Sat Mar 01 16:37:30 2014 -0500
+++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp	Tue Mar 04 19:30:36 2014 -0500
@@ -35,6 +35,7 @@
 #include "SDL_render.h"
 #include "../../video/SDL_sysvideo.h"
 //#include "../../SDL_hints_c.h"
+#include "../../events/SDL_events_c.h"
 #include "../../events/SDL_keyboard_c.h"
 #include "../../events/SDL_mouse_c.h"
 #include "../../events/SDL_windowevents_c.h"
@@ -547,12 +548,19 @@
             SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MINIMIZED, 0, 0);   // TODO: see if SDL_WINDOWEVENT_SIZE_CHANGED should be getting triggered here (it is, currently)
             SDL_FilterEvents(RemoveAppSuspendAndResumeEvents, 0);
         }
+
+        SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
+        SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
+
         deferral->Complete();
     });
 }
 
 void SDL_WinRTApp::OnResuming(Platform::Object^ sender, Platform::Object^ args)
 {
+    SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
+    SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
+
     // Restore any data or state that was unloaded on suspend. By default, data
     // and state are persisted when resuming from suspend. Note that this event
     // does not occur if the app was previously terminated.