tvOS: Back on the main screen goes to the home screen, like on Android

tvOS only does that with a Back press it gets to see, so the view controller
lets controller events through to UIKit while the top screen is top level
(the new TOP_LEVEL_CHANGED notification), and passes presses that aren't
keyboard keys on to super. Elsewhere Back stays ours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-13 09:29:26 +02:00
1 parent 5b05b34b4e
commit 625db43746
5 files changed
+45 -4

No files matched your search

+6 -3
View File
@@ -1,4 +1,5 @@
#include "Common/System/Display.h"
#include "Common/System/System.h"
#include "Common/Data/Collections/TinySet.h"
#include "Common/UI/ScreenManager.h"
#include "Common/UI/Root.h"
@@ -133,13 +134,15 @@ void ScreenManager::Update() {
overlayScreen_->update();
}
bool topLevel = false;
if (!stack_.empty()) {
Screen *backScreen = stack_.back().screen;
backScreen->update();
passInputToMapper_ = backScreen->PassInputToMapper();
topIsTopLevel_ = backScreen->isTopLevel();
} else {
topIsTopLevel_ = false;
topLevel = backScreen->isTopLevel();
}
if (topIsTopLevel_.exchange(topLevel) != topLevel) {
System_Notify(SystemNotification::TOP_LEVEL_CHANGED);
}
}