From 24e122590cda16b4cae283a2ba9e36c8c680a113 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 4 Jul 2021 22:03:47 +0200 Subject: [PATCH] Taskbar: Simplify quick launch widget layout Use shrink-to-fit instead of manually calculating the widget size. --- Userland/Services/Taskbar/TaskbarWindow.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index a99573db1e..25f8de623a 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -112,14 +112,11 @@ void TaskbarWindow::show_desktop_button_clicked(unsigned) void TaskbarWindow::create_quick_launch_bar() { auto& quick_launch_bar = main_widget()->add(); + quick_launch_bar.set_shrink_to_fit(true); quick_launch_bar.set_layout(); quick_launch_bar.layout()->set_spacing(0); - quick_launch_bar.layout()->set_margins({ 3, 0, 3, 0 }); quick_launch_bar.set_frame_thickness(0); - int total_width = 6; - bool first = true; - auto config = Core::ConfigFile::get_for_app("Taskbar"); constexpr const char* quick_launch = "QuickLaunch"; @@ -154,14 +151,8 @@ void TaskbarWindow::create_quick_launch_bar() perror("disown"); } }; - - if (!first) - total_width += quick_launch_bar.layout()->spacing(); - first = false; - total_width += button_size; } - - quick_launch_bar.set_fixed_size(total_width, 24); + quick_launch_bar.set_fixed_height(24); } void TaskbarWindow::on_screen_rects_change(const Vector& rects, size_t main_screen_index)