From ea34ba6fa6a66b53436edefb9c80327660b310f7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 31 Mar 2021 23:26:32 +0200 Subject: [PATCH] WindowServer+LibGfx: Rename menu_bar => menubar We had a mix of "menu_bar" and "menubar". Let's just use "menubar" everywhere since that feels the most natural to write. --- Userland/Libraries/LibGfx/ClassicWindowTheme.cpp | 10 +++++----- Userland/Libraries/LibGfx/ClassicWindowTheme.h | 2 +- Userland/Libraries/LibGfx/WindowTheme.h | 2 +- Userland/Services/WindowServer/Window.cpp | 2 +- Userland/Services/WindowServer/WindowFrame.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp index a7c0a30e7d..e87699cb6b 100644 --- a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp +++ b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp @@ -33,7 +33,7 @@ namespace Gfx { -static constexpr int menu_bar_height = 20; +static constexpr int menubar_height = 20; ClassicWindowTheme::ClassicWindowTheme() { @@ -145,11 +145,11 @@ void ClassicWindowTheme::paint_tool_window_frame(Painter& painter, WindowState w } } -IntRect ClassicWindowTheme::menu_bar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette, int menu_row_count) const +IntRect ClassicWindowTheme::menubar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette, int menu_row_count) const { if (window_type != WindowType::Normal) return {}; - return { 4, 3 + title_bar_height(window_type, palette) + 2, window_rect.width(), menu_bar_height * menu_row_count }; + return { 4, 3 + title_bar_height(window_type, palette) + 2, window_rect.width(), menubar_height * menu_row_count }; } IntRect ClassicWindowTheme::title_bar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette) const @@ -209,9 +209,9 @@ IntRect ClassicWindowTheme::frame_rect_for_window(WindowType window_type, const case WindowType::ToolWindow: return { window_rect.x() - 4, - window_rect.y() - window_titlebar_height - 5 - menu_row_count * menu_bar_height, + window_rect.y() - window_titlebar_height - 5 - menu_row_count * menubar_height, window_rect.width() + 8, - window_rect.height() + 9 + window_titlebar_height + menu_row_count * menu_bar_height + window_rect.height() + 9 + window_titlebar_height + menu_row_count * menubar_height }; case WindowType::Notification: return { diff --git a/Userland/Libraries/LibGfx/ClassicWindowTheme.h b/Userland/Libraries/LibGfx/ClassicWindowTheme.h index 58015b4e24..0f3be03999 100644 --- a/Userland/Libraries/LibGfx/ClassicWindowTheme.h +++ b/Userland/Libraries/LibGfx/ClassicWindowTheme.h @@ -45,7 +45,7 @@ public: virtual IntRect title_bar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const override; virtual IntRect title_bar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const override; - virtual IntRect menu_bar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const override; + virtual IntRect menubar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const override; virtual IntRect frame_rect_for_window(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const override; diff --git a/Userland/Libraries/LibGfx/WindowTheme.h b/Userland/Libraries/LibGfx/WindowTheme.h index 9e60137f36..c69551d7a8 100644 --- a/Userland/Libraries/LibGfx/WindowTheme.h +++ b/Userland/Libraries/LibGfx/WindowTheme.h @@ -60,7 +60,7 @@ public: virtual IntRect title_bar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; virtual IntRect title_bar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; - virtual IntRect menu_bar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0; + virtual IntRect menubar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0; virtual IntRect frame_rect_for_window(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0; diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index f0967a4f5d..371aa477ef 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -971,7 +971,7 @@ void Window::set_menubar(MenuBar* menubar) auto& wm = WindowManager::the(); Gfx::IntPoint next_menu_location { 0, 0 }; - auto menubar_rect = Gfx::WindowTheme::current().menu_bar_rect(Gfx::WindowTheme::WindowType::Normal, rect(), wm.palette(), 1); + auto menubar_rect = Gfx::WindowTheme::current().menubar_rect(Gfx::WindowTheme::WindowType::Normal, rect(), wm.palette(), 1); m_menubar->for_each_menu([&](Menu& menu) { int text_width = wm.font().width(menu.name()); menu.set_rect_in_window_menubar({ next_menu_location.x(), 0, text_width + menubar_menu_margin, menubar_rect.height() }); diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index a9f10125e8..e40fe4b106 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -240,7 +240,7 @@ Gfx::IntRect WindowFrame::menubar_rect() const { if (!m_window.menubar() || !m_window.should_show_menubar()) return {}; - return Gfx::WindowTheme::current().menu_bar_rect(to_theme_window_type(m_window.type()), m_window.rect(), WindowManager::the().palette(), menu_row_count()); + return Gfx::WindowTheme::current().menubar_rect(to_theme_window_type(m_window.type()), m_window.rect(), WindowManager::the().palette(), menu_row_count()); } Gfx::IntRect WindowFrame::title_bar_rect() const