From 1318f29c8d3e95f3a519973382c8a0f7a9ce8a30 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 23 Jan 2016 02:23:04 -0800 Subject: [PATCH] UI: Update layout on recreate to focus subviews. --- ext/native/ui/ui_screen.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/native/ui/ui_screen.cpp b/ext/native/ui/ui_screen.cpp index 41fd375630..ef0e0bbce8 100644 --- a/ext/native/ui/ui_screen.cpp +++ b/ext/native/ui/ui_screen.cpp @@ -36,6 +36,14 @@ void UIScreen::DoRecreateViews() { if (persisting && root_ != nullptr) { root_->PersistData(UI::PERSIST_RESTORE, "root", persisted); + + // Update layout and refocus so things scroll into view. + // This is for resizing down, when focused on something now offscreen. + UI::LayoutViewHierarchy(*screenManager()->getUIContext(), root_); + UI::View *focused = UI::GetFocusedView(); + if (focused) { + root_->SubviewFocused(focused); + } } } }