From 2161f20aa64057ea43449f8535d5cb2d210a8d10 Mon Sep 17 00:00:00 2001 From: networkException Date: Tue, 23 Aug 2022 12:41:31 +0200 Subject: [PATCH] LibGUI: Call on_segment_change handler from on_{click,focus_change} The on_segment_change handler introduced in a00fa793b37550a8b44122192346eeeb1d692bf9 was only getting called by programmatically setting the segment, not by clicking a button or using tab navigation. --- Userland/Libraries/LibGUI/Breadcrumbbar.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp index d0c0eb0a4f..3f552fcd33 100644 --- a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp +++ b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp @@ -84,10 +84,12 @@ void Breadcrumbbar::append_segment(String text, Gfx::Bitmap const* icon, String button.on_click = [this, index = m_segments.size()](auto) { if (on_segment_click) on_segment_click(index); + if (on_segment_change && m_selected_segment != index) + on_segment_change(index); }; button.on_focus_change = [this, index = m_segments.size()](auto has_focus, auto) { - if (has_focus && on_segment_click) - on_segment_click(index); + if (has_focus && on_segment_change && m_selected_segment != index) + on_segment_change(index); }; button.on_drop = [this, index = m_segments.size()](auto& drop_event) { if (on_segment_drop)