From ea52fe528a1b34590661c4556b6a4bbf68bb75f0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 29 Nov 2019 15:46:38 +0100 Subject: [PATCH] LibGUI: Keep the (1, 1) text offset on GButton after it becomes checked This makes the text offset "stick" after you click to select a window in the taskbar, for example. --- Libraries/LibGUI/GButton.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibGUI/GButton.cpp b/Libraries/LibGUI/GButton.cpp index 8d81b28024..1170f35ffd 100644 --- a/Libraries/LibGUI/GButton.cpp +++ b/Libraries/LibGUI/GButton.cpp @@ -32,11 +32,11 @@ void GButton::paint_event(GPaintEvent& event) if (text().is_empty() && !m_icon) return; - auto content_rect = rect().shrunken(10, 2); + auto content_rect = rect().shrunken(8, 2); auto icon_location = m_icon ? content_rect.center().translated(-(m_icon->width() / 2), -(m_icon->height() / 2)) : Point(); if (m_icon && !text().is_empty()) icon_location.set_x(content_rect.x()); - if (is_being_pressed()) + if (is_being_pressed() || is_checked()) painter.translate(1, 1); if (m_icon) { if (is_enabled())