summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-21 19:35:34 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-21 21:16:13 +0200
commit80a9896e83142fb6def8c287159a36717c1f94d5 (patch)
tree79cdecdab4ef9ef93f98afefb97dc7028e0024fe
parent116c0c0ab3cffedf429e5ca74a6d4bbba15c7247 (diff)
downloadserenity-80a9896e83142fb6def8c287159a36717c1f94d5.zip
LibGfx+WindowServer: Simplify WindowTheme::paint_normal_frame() API
Don't require passing in the outer frame rect since the theme can compute that itself, based on the window rect.
-rw-r--r--Libraries/LibGfx/ClassicWindowTheme.cpp6
-rw-r--r--Libraries/LibGfx/ClassicWindowTheme.h2
-rw-r--r--Libraries/LibGfx/WindowTheme.h2
-rw-r--r--Services/WindowServer/WindowFrame.cpp3
4 files changed, 7 insertions, 6 deletions
diff --git a/Libraries/LibGfx/ClassicWindowTheme.cpp b/Libraries/LibGfx/ClassicWindowTheme.cpp
index 01957ebeea..90974cdcbc 100644
--- a/Libraries/LibGfx/ClassicWindowTheme.cpp
+++ b/Libraries/LibGfx/ClassicWindowTheme.cpp
@@ -67,9 +67,11 @@ Gfx::IntRect ClassicWindowTheme::title_bar_text_rect(WindowType window_type, con
};
}
-void ClassicWindowTheme::paint_normal_frame(Painter& painter, WindowState window_state, const IntRect& outer_rect, const IntRect& window_rect, const StringView& title_text, const Bitmap& icon, const Palette& palette, const IntRect& leftmost_button_rect) const
+void ClassicWindowTheme::paint_normal_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, const StringView& title_text, const Bitmap& icon, const Palette& palette, const IntRect& leftmost_button_rect) const
{
- Gfx::StylePainter::paint_window_frame(painter, outer_rect, palette);
+ auto frame_rect = frame_rect_for_window(WindowType::Normal, window_rect, palette);
+ frame_rect.set_location({ 0, 0 });
+ Gfx::StylePainter::paint_window_frame(painter, frame_rect, palette);
auto& title_font = Font::default_bold_font();
diff --git a/Libraries/LibGfx/ClassicWindowTheme.h b/Libraries/LibGfx/ClassicWindowTheme.h
index a4608ea4a9..3cdf4fca8a 100644
--- a/Libraries/LibGfx/ClassicWindowTheme.h
+++ b/Libraries/LibGfx/ClassicWindowTheme.h
@@ -36,7 +36,7 @@ public:
ClassicWindowTheme();
virtual ~ClassicWindowTheme() override;
- virtual void paint_normal_frame(Painter&, WindowState, const IntRect& outer_rect, const IntRect& window_rect, const StringView& title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect) const override;
+ virtual void paint_normal_frame(Painter&, WindowState, const IntRect& window_rect, const StringView& title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect) const override;
virtual void paint_notification_frame(Painter&, const IntRect& outer_rect, const IntRect& window_rect, const Palette&, const IntRect& close_button_rect) const override;
virtual IntRect title_bar_rect(WindowType, const IntRect& window_rect, const Palette&) const override;
diff --git a/Libraries/LibGfx/WindowTheme.h b/Libraries/LibGfx/WindowTheme.h
index 21c5f07975..28ed250e7f 100644
--- a/Libraries/LibGfx/WindowTheme.h
+++ b/Libraries/LibGfx/WindowTheme.h
@@ -50,7 +50,7 @@ public:
static WindowTheme& current();
- virtual void paint_normal_frame(Painter&, WindowState, const IntRect& outer_rect, const IntRect& window_rect, const StringView& title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect) const = 0;
+ virtual void paint_normal_frame(Painter&, WindowState, const IntRect& window_rect, const StringView& title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect) const = 0;
virtual void paint_notification_frame(Painter&, const IntRect& outer_rect, const IntRect& window_rect, const Palette&, const IntRect& close_button_rect) const = 0;
virtual IntRect title_bar_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0;
diff --git a/Services/WindowServer/WindowFrame.cpp b/Services/WindowServer/WindowFrame.cpp
index 73bccf7a25..26a0bbf675 100644
--- a/Services/WindowServer/WindowFrame.cpp
+++ b/Services/WindowServer/WindowFrame.cpp
@@ -180,7 +180,6 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
{
auto palette = WindowManager::the().palette();
auto& window = m_window;
- Gfx::IntRect outer_rect = { {}, rect().size() };
String title_text;
if (window.client() && window.client()->is_unresponsive()) {
StringBuilder builder;
@@ -192,7 +191,7 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
}
auto leftmost_button_rect = m_buttons.is_empty() ? Gfx::IntRect() : m_buttons.last().relative_rect();
- Gfx::WindowTheme::current().paint_normal_frame(painter, window_state_for_theme(), outer_rect, m_window.rect(), title_text, m_window.icon(), palette, leftmost_button_rect);
+ Gfx::WindowTheme::current().paint_normal_frame(painter, window_state_for_theme(), m_window.rect(), title_text, m_window.icon(), palette, leftmost_button_rect);
}
void WindowFrame::paint(Gfx::Painter& painter)