FullscreenUI: Fix scroll not resetting in split window

pull/3699/head
Stenzek 8 months ago
parent 740998b84d
commit 24c43abef0
No known key found for this signature in database

@ -1086,6 +1086,8 @@ void FullscreenUI::EndLayout()
s_state.left_fullscreen_footer_text.clear();
s_state.fullscreen_footer_text.clear();
s_state.split_window_focus_change = SplitWindowFocusChange::None;
s_state.rendered_menu_item_border = false;
s_state.had_hovered_menu_item = std::exchange(s_state.has_hovered_menu_item, false);
@ -3410,8 +3412,6 @@ void FullscreenUI::BeginInnerSplitWindow()
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 0.0f);
s_state.split_window_focus_change = SplitWindowFocusChange::None;
if (!ImGui::IsPopupOpen(0u, ImGuiPopupFlags_AnyPopup))
{
if (ImGui::IsKeyPressed(ImGuiKey_GamepadDpadLeft, true) || ImGui::IsKeyPressed(ImGuiKey_LeftArrow, true))
@ -3453,6 +3453,7 @@ bool FullscreenUI::BeginSplitWindowSidebar(float sidebar_width /*= 0.2f*/)
// cancel any pending focus change
if (s_state.split_window_focus_change == SplitWindowFocusChange::FocusSidebar)
{
// don't eat the right keypress
s_state.split_window_focus_change = SplitWindowFocusChange::None;
CancelResetFocus();
}
@ -3542,7 +3543,7 @@ bool FullscreenUI::BeginSplitWindowContent(bool background)
ImGui::PushStyleColor(ImGuiCol_ChildBg,
ModAlpha(DarkerColor(ImGui::GetStyle().Colors[ImGuiCol_WindowBg], 1.5f), 0.25f));
if (IsFocusResetFromWindowChange())
if (IsFocusResetFromWindowChange() || s_state.split_window_focus_change == SplitWindowFocusChange::FocusContent)
ImGui::SetNextWindowScroll(ImVec2(0.0f, 0.0f));
ImGuiWindow* const window = ImGui::GetCurrentWindow();
@ -3557,10 +3558,16 @@ bool FullscreenUI::BeginSplitWindowContent(bool background)
// cancel any pending focus change
if (s_state.split_window_focus_change == SplitWindowFocusChange::FocusContent)
{
// don't eat the right keypress
s_state.split_window_focus_change = SplitWindowFocusChange::None;
CancelResetFocus();
}
}
else
{
if (s_state.split_window_focus_change == SplitWindowFocusChange::FocusContent)
ResetFocusHere();
}
return ret;
}

Loading…
Cancel
Save