From c9951bbe6064ddfd85bef661bec5a92b54d79f3c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 11 May 2019 01:31:10 +0200 Subject: WindowServer: Improve window frames by giving them a raised frame look. :^) --- Servers/WindowServer/WSMenu.cpp | 4 ++-- Servers/WindowServer/WSMenu.h | 2 +- Servers/WindowServer/WSWindowFrame.cpp | 20 ++++---------------- Servers/WindowServer/WSWindowFrame.h | 1 - 4 files changed, 7 insertions(+), 20 deletions(-) (limited to 'Servers/WindowServer') diff --git a/Servers/WindowServer/WSMenu.cpp b/Servers/WindowServer/WSMenu.cpp index da8b96967b..e505ccf62a 100644 --- a/Servers/WindowServer/WSMenu.cpp +++ b/Servers/WindowServer/WSMenu.cpp @@ -115,8 +115,8 @@ void WSMenu::draw() Painter painter(*menu_window()->backing_store()); Rect rect { { }, menu_window()->size() }; - painter.fill_rect(rect.shrunken(4, 4), Color::LightGray); - StylePainter::paint_menu_frame(painter, rect); + painter.fill_rect(rect.shrunken(6, 6), Color::LightGray); + StylePainter::paint_window_frame(painter, rect); int width = this->width(); if (!s_checked_bitmap) diff --git a/Servers/WindowServer/WSMenu.h b/Servers/WindowServer/WSMenu.h index b0fefff92f..0366bfb56e 100644 --- a/Servers/WindowServer/WSMenu.h +++ b/Servers/WindowServer/WSMenu.h @@ -55,7 +55,7 @@ public: int height() const; int item_height() const { return 16; } - int frame_thickness() const { return 2; } + int frame_thickness() const { return 3; } int horizontal_padding() const { return left_padding() + right_padding(); } int left_padding() const { return 14; } int right_padding() const { return 14; } diff --git a/Servers/WindowServer/WSWindowFrame.cpp b/Servers/WindowServer/WSWindowFrame.cpp index 3324e0923a..1b93161a14 100644 --- a/Servers/WindowServer/WSWindowFrame.cpp +++ b/Servers/WindowServer/WSWindowFrame.cpp @@ -67,7 +67,7 @@ WSWindowFrame::~WSWindowFrame() Rect WSWindowFrame::title_bar_rect() const { - return { 2, 2, m_window.width() + 2, window_titlebar_height }; + return { 3, 2, m_window.width(), window_titlebar_height }; } Rect WSWindowFrame::title_bar_icon_rect() const @@ -93,11 +93,6 @@ Rect WSWindowFrame::title_bar_text_rect() const }; } -Rect WSWindowFrame::middle_border_rect() const -{ - return { 1, 1, m_window.width() + 4, m_window.height() + 4 + window_titlebar_height }; -} - void WSWindowFrame::paint(Painter& painter) { PainterStateSaver saver(painter); @@ -125,13 +120,6 @@ void WSWindowFrame::paint(Painter& painter) auto titlebar_title_rect = titlebar_inner_rect; titlebar_title_rect.set_width(Font::default_bold_font().width(window.title())); - Rect inner_border_rect { - 2, - 2 + window_titlebar_height, - window.width() + 2, - window.height() + 2 - }; - Color title_color; Color border_color; Color border_color2; @@ -167,9 +155,9 @@ void WSWindowFrame::paint(Painter& painter) for (int i = 2; i <= titlebar_inner_rect.height() - 2; i += 2) { painter.draw_line({ titlebar_title_rect.right() + 4, titlebar_inner_rect.y() + i }, { leftmost_button_rect.left() - 3, titlebar_inner_rect.y() + i }, border_color); } - painter.draw_rect(middle_border_rect(), middle_border_color); - painter.draw_rect(outer_rect, border_color); - painter.draw_rect(inner_border_rect, border_color); + + painter.draw_line(titlebar_rect.bottom_left().translated(0, 1), titlebar_rect.bottom_right().translated(0, 1), Color::LightGray); + StylePainter::paint_window_frame(painter, outer_rect); // FIXME: The translated(0, 1) wouldn't be necessary if we could center text based on its baseline. painter.draw_text(titlebar_title_rect.translated(0, 1), window.title(), wm.window_title_font(), TextAlignment::CenterLeft, title_color); diff --git a/Servers/WindowServer/WSWindowFrame.h b/Servers/WindowServer/WSWindowFrame.h index b58aec77b9..3e7852c531 100644 --- a/Servers/WindowServer/WSWindowFrame.h +++ b/Servers/WindowServer/WSWindowFrame.h @@ -24,7 +24,6 @@ private: Rect title_bar_rect() const; Rect title_bar_icon_rect() const; Rect title_bar_text_rect() const; - Rect middle_border_rect() const; WSWindow& m_window; Vector> m_buttons; -- cgit v1.2.3