From 32fc8da9174a44d6810f95ed3c24e568aa74cc3c Mon Sep 17 00:00:00 2001 From: Marcus Nilsson Date: Sat, 19 Jun 2021 12:13:10 +0200 Subject: [PATCH] Browser: Enable close button on tabs --- Userland/Applications/Browser/BrowserWindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index e1273669cc..a00feabe78 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -60,6 +60,7 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url) auto& top_line = *widget.find_descendant_of_type_named("top_line"); m_tab_widget = *widget.find_descendant_of_type_named("tab_widget"); + m_tab_widget->set_close_button_enabled(true); m_tab_widget->on_tab_count_change = [&top_line](size_t tab_count) { top_line.set_visible(tab_count > 1); @@ -76,6 +77,11 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url) tab.on_tab_close_request(tab); }; + m_tab_widget->on_tab_close_click = [](auto& clicked_widget) { + auto& tab = static_cast(clicked_widget); + tab.on_tab_close_request(tab); + }; + m_tab_widget->on_context_menu_request = [](auto& clicked_widget, const GUI::ContextMenuEvent& context_menu_event) { auto& tab = static_cast(clicked_widget); tab.context_menu_requested(context_menu_event.screen_position());