Skip to content
Permalink
Browse files

UWP: Full screen support, config save fix

  • Loading branch information...
driver1998 committed Jun 7, 2019
1 parent 2db67e1 commit 6cd12678d383993e711dc81429f4ec5b5073adb1
Showing with 25 additions and 5 deletions.
  1. +17 −5 UWP/App.cpp
  2. +8 −0 UWP/PPSSPP_UWPMain.cpp
@@ -217,9 +217,10 @@ void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^
// Run() won't start until the CoreWindow is activated.
CoreWindow::GetForCurrentThread()->Activate();
// On mobile, we force-enter fullscreen mode.
if (m_isPhone) {
if (m_isPhone) g_Config.bFullScreen = true;

if (g_Config.bFullScreen)
Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->TryEnterFullScreenMode();
}
}

void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) {
@@ -228,9 +229,10 @@ void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) {
// aware that a deferral may not be held indefinitely. After about five seconds,
// the app will be forced to exit.
SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral();
auto app = this;

create_task([this, deferral]() {
m_deviceResources->Trim();
create_task([app, deferral]() {
app->m_deviceResources->Trim();
deferral->Complete();
});
}
@@ -246,6 +248,9 @@ void App::OnResuming(Platform::Object^ sender, Platform::Object^ args) {
// Window event handlers.

void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) {
auto view = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView();
g_Config.bFullScreen = view->IsFullScreenMode;

int width = sender->Bounds.Width;
int height = sender->Bounds.Height;
float scale = m_deviceResources->GetDpi() / 96.0f;
@@ -263,10 +268,17 @@ void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ ar
}

void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) {

if (args->Visible == false) {
// MainScreen::OnExit and even App::OnWindowClosed
// doesn't seem to be called when closing the window
// Try to save the config here
g_Config.Save("App::OnVisibilityChanged");
}
m_windowVisible = args->Visible;
}

void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) {
void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) {
m_windowClosed = true;
}

@@ -429,6 +429,14 @@ void System_SendMessage(const char *command, const char *parameter) {
g_main->LoadStorageFile(file);
}
});
} else if (!strcmp(command, "toggle_fullscreen")) {
auto view = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView();
if (strcmp(parameter, "0") == 0) {
view->ExitFullScreenMode();
}
else if (strcmp(parameter, "1") == 0){
view->TryEnterFullScreenMode();
}
}
}

0 comments on commit 6cd1267

Please sign in to comment.
You can’t perform that action at this time.