Add ability to set keyboard focus to specific screens. Needed for searchbar on Mac.

This commit is contained in:
Henrik Rydgård committed 2026-05-04 14:29:26 +02:00
1 parent a1f83ca5c4
commit ea4c46f27c
9 files changed
+36 -6

No files matched your search

+16 -2
View File
@@ -15,8 +15,22 @@
void Screen::focusChanged(ScreenFocusChange focusChange) {
const char *eventName = "";
switch (focusChange) {
case ScreenFocusChange::FOCUS_LOST_TOP: eventName = "FOCUS_LOST_TOP"; break;
case ScreenFocusChange::FOCUS_BECAME_TOP: eventName = "FOCUS_BECAME_TOP"; break;
case ScreenFocusChange::FOCUS_LOST_TOP:
#if !defined(MOBILE_DEVICE)
if (WantsTextInput()) {
System_NotifyUIEvent(UIEventNotification::TEXT_LOSTFOCUS);
}
#endif
eventName = "FOCUS_LOST_TOP";
break;
case ScreenFocusChange::FOCUS_BECAME_TOP:
#if !defined(MOBILE_DEVICE)
if (WantsTextInput()) {
System_NotifyUIEvent(UIEventNotification::TEXT_GOTFOCUS);
}
#endif
eventName = "FOCUS_BECAME_TOP";
break;
}
DEBUG_LOG(Log::UI, "Screen %s got %s", this->tag(), eventName);
}