From 4e766c8159c54948b55cce6fd65a92c0e022ff86 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 10 May 2020 19:45:12 +0200 Subject: [PATCH] Taskbar: Let's custom paint the background instead of using GUI::Frame Previously we were wasting the bottom pixel row on darkness. Use the base button color all the way to the bottom row and offset the top highlight by one pixel instead. --- Services/Taskbar/TaskbarWindow.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Services/Taskbar/TaskbarWindow.cpp b/Services/Taskbar/TaskbarWindow.cpp index 7e2638ebd0..92b49f7914 100644 --- a/Services/Taskbar/TaskbarWindow.cpp +++ b/Services/Taskbar/TaskbarWindow.cpp @@ -33,11 +33,31 @@ #include #include #include +#include #include +#include #include //#define EVENT_DEBUG +class TaskbarWidget final : public GUI::Widget { + C_OBJECT(TaskbarWidget); + +public: + virtual ~TaskbarWidget() override {} + +private: + TaskbarWidget() {} + + virtual void paint_event(GUI::PaintEvent& event) override + { + GUI::Painter painter(*this); + painter.add_clip_rect(event.rect()); + painter.fill_rect(rect(), palette().button()); + painter.draw_line({ 0, 1 }, { width() - 1, 1 }, palette().threed_highlight()); + } +}; + TaskbarWindow::TaskbarWindow() { set_window_type(GUI::WindowType::Taskbar); @@ -47,14 +67,10 @@ TaskbarWindow::TaskbarWindow() GUI::Desktop::the().on_rect_change = [this](const Gfx::Rect& rect) { on_screen_rect_change(rect); }; - auto& widget = set_main_widget(); - widget.set_fill_with_background_color(true); + auto& widget = set_main_widget(); widget.set_layout(); widget.layout()->set_margins({ 3, 2, 3, 2 }); widget.layout()->set_spacing(3); - widget.set_frame_thickness(1); - widget.set_frame_shape(Gfx::FrameShape::Panel); - widget.set_frame_shadow(Gfx::FrameShadow::Raised); m_default_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png");