wip: when exiting applet, track the calling applet

This commit is contained in:
Exverge 2024-03-24 14:25:39 -04:00
parent a9312c837e
commit dd5d36a796
No known key found for this signature in database
GPG key ID: 19AAFC0AC6A9B35A
3 changed files with 16 additions and 0 deletions

View file

@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/settings.h"
@ -335,4 +336,9 @@ void AppletManager::SetWindowSystem(WindowSystem* window_system) {
applet->process->Run();
}
void AppletManager::TrackApplet(std::shared_ptr<Applet> applet, bool is_application) {
m_window_system->TrackApplet(applet, true);
m_window_system->RequestApplicationToGetForeground();
}
} // namespace Service::AM

View file

@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
@ -46,6 +47,7 @@ public:
public:
void SetWindowSystem(WindowSystem* window_system);
void TrackApplet(std::shared_ptr<Applet> applet, bool is_application);
private:
Core::System& m_system;

View file

@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/core_timing.h"
@ -177,6 +178,13 @@ Result ILibraryAppletSelfAccessor::GetMainAppletStorageId(Out<FileSys::StorageId
Result ILibraryAppletSelfAccessor::ExitProcessAndReturn() {
LOG_INFO(Service_AM, "called");
m_applet->process->Terminate();
if(!m_applet->caller_applet.expired()) {
std::shared_ptr<Applet> applet = m_applet->caller_applet.lock();
if(applet == nullptr) R_SUCCEED();
LOG_INFO(Service_AM, "HAS CALLER");
system.GetAppletManager().TrackApplet(applet, true);
applet->lifecycle_manager.SetFocusState(FocusState::InFocus);
}
R_SUCCEED();
}