From 3c0afccca0d780946242552c440c25ff583e638f Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 18 Apr 2019 19:58:25 +0200 Subject: WindowServer: Improve the look of menu separators. --- Servers/WindowServer/WSMenu.cpp | 13 ++++++++----- Servers/WindowServer/WSMenu.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'Servers') diff --git a/Servers/WindowServer/WSMenu.cpp b/Servers/WindowServer/WSMenu.cpp index ba952a11d7..017d259bed 100644 --- a/Servers/WindowServer/WSMenu.cpp +++ b/Servers/WindowServer/WSMenu.cpp @@ -59,6 +59,7 @@ void WSMenu::redraw() WSWindow& WSMenu::ensure_menu_window() { + int width = this->width(); if (!m_menu_window) { Point next_item_location(frame_thickness(), frame_thickness()); for (auto& item : m_items) { @@ -66,14 +67,14 @@ WSWindow& WSMenu::ensure_menu_window() if (item->type() == WSMenuItem::Text) height = item_height(); else if (item->type() == WSMenuItem::Separator) - height = 7; - item->set_rect({ next_item_location, { width() - frame_thickness() * 2, height } }); + height = 8; + item->set_rect({ next_item_location, { width - frame_thickness() * 2, height } }); next_item_location.move_by(0, height); } auto window = make(*this, WSWindowType::Menu); window->set_opacity(0.95f); - window->set_rect(0, 0, width(), height()); + window->set_rect(0, 0, width, height()); m_menu_window = move(window); draw(); } @@ -89,6 +90,7 @@ void WSMenu::draw() Rect rect { { }, menu_window()->size() }; painter.fill_rect(rect.shrunken(4, 4), Color::LightGray); StylePainter::paint_menu_frame(painter, rect); + int width = this->width(); for (auto& item : m_items) { if (item->type() == WSMenuItem::Text) { @@ -104,9 +106,10 @@ void WSMenu::draw() painter.draw_text(item->rect().translated(-right_padding(), 0), item->shortcut_text(), TextAlignment::CenterRight, text_color); } } else if (item->type() == WSMenuItem::Separator) { - Point p1(1, item->rect().center().y()); - Point p2(width() - 2, item->rect().center().y()); + Point p1(4, item->rect().center().y()); + Point p2(width - 5, item->rect().center().y()); painter.draw_line(p1, p2, Color::MidGray); + painter.draw_line(p1.translated(0, 1), p2.translated(0, 1), Color::White); } } } diff --git a/Servers/WindowServer/WSMenu.h b/Servers/WindowServer/WSMenu.h index 2c2362186d..70d9cedb55 100644 --- a/Servers/WindowServer/WSMenu.h +++ b/Servers/WindowServer/WSMenu.h @@ -54,7 +54,7 @@ public: int width() const; int height() const; - int item_height() const { return 18; } + int item_height() const { return 16; } int frame_thickness() const { return 2; } int horizontal_padding() const { return left_padding() + right_padding(); } int left_padding() const { return 14; } -- cgit v1.2.3