From 0b9639eb259bf10efee48c319ce0330e757474bd Mon Sep 17 00:00:00 2001 From: Matthias Moninger <5415177+ZehMatt@users.noreply.github.com> Date: Sun, 2 Jul 2023 22:34:02 +0300 Subject: [PATCH] Fix disabled widgets sharing the same space as active widgets (#20535) * Fix disabled widgets sharing the same space as active widgets * Add PR for reference in comment Co-authored-by: Hielke Morsink --- src/openrct2-ui/interface/Window.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 5d2f8d753a..bc53a6b2b1 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -805,13 +805,20 @@ void WindowAlignTabs(WindowBase* w, WidgetIndex start_tab_id, WidgetIndex end_ta for (i = start_tab_id; i <= end_tab_id; i++) { + auto& widget = w->widgets[i]; if (!WidgetIsDisabled(*w, i)) { - auto& widget = w->widgets[i]; widget.left = x; widget.right = x + tab_width; x += tab_width + 1; } + else + { + // Workaround #20535: Avoid disabled widgets from sharing the same space as active ones, otherwise + // WindowFindWidgetFromPoint could return the disabled one, causing issues. + widget.left = 0; + widget.right = 0; + } } }