From 6203a4a2e9a350c9bace00a7055b78210d1fb4a1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 26 Mar 2021 09:11:44 +0100 Subject: WindowServer: Remove unused Menu->MenuBar link and "title font" We kept a backpointer from the Menu to its containing MenuBar, but it was not used for anything so let's remove it. Since all menus have the same font now, there's no need to track a separate "title font". --- Userland/Services/WindowServer/Menu.cpp | 12 +----------- Userland/Services/WindowServer/Menu.h | 9 --------- Userland/Services/WindowServer/MenuBar.cpp | 10 +--------- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 70b3c51407..ab2a5bba77 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * Copyright (c) 2020, Shannon Booth * All rights reserved. * @@ -55,16 +55,6 @@ Menu::~Menu() { } -void Menu::set_title_font(const Gfx::Font& font) -{ - m_title_font = &font; -} - -const Gfx::Font& Menu::title_font() const -{ - return *m_title_font; -} - const Gfx::Font& Menu::font() const { return Gfx::FontDatabase::default_font(); diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h index e5bf27f8eb..3a35f727ac 100644 --- a/Userland/Services/WindowServer/Menu.h +++ b/Userland/Services/WindowServer/Menu.h @@ -54,10 +54,6 @@ public: const ClientConnection* client() const { return m_client; } int menu_id() const { return m_menu_id; } - MenuBar* menubar() { return m_menubar; } - const MenuBar* menubar() const { return m_menubar; } - void set_menubar(MenuBar* menubar) { m_menubar = menubar; } - bool is_empty() const { return m_items.is_empty(); } int item_count() const { return m_items.size(); } const MenuItem& item(int index) const { return m_items.at(index); } @@ -99,8 +95,6 @@ public: void draw(); const Gfx::Font& font() const; - const Gfx::Font& title_font() const; - void set_title_font(const Gfx::Font& font); MenuItem* item_with_identifier(unsigned); void redraw(); @@ -135,8 +129,6 @@ public: private: virtual void event(Core::Event&) override; - RefPtr m_title_font { &Gfx::FontDatabase::default_font() }; - void handle_mouse_move_event(const MouseEvent&); int visible_item_count() const; @@ -150,7 +142,6 @@ private: String m_name; Gfx::IntRect m_rect_in_window_menubar; Gfx::IntRect m_text_rect_in_window_menubar; - MenuBar* m_menubar { nullptr }; NonnullOwnPtrVector m_items; RefPtr m_menu_window; diff --git a/Userland/Services/WindowServer/MenuBar.cpp b/Userland/Services/WindowServer/MenuBar.cpp index 30d739aaf7..cf2f9814c9 100644 --- a/Userland/Services/WindowServer/MenuBar.cpp +++ b/Userland/Services/WindowServer/MenuBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,8 +26,6 @@ #include "MenuBar.h" #include "Menu.h" -#include "MenuItem.h" -#include namespace WindowServer { @@ -43,12 +41,6 @@ MenuBar::~MenuBar() void MenuBar::add_menu(Menu& menu) { - menu.set_menubar(this); - - // NOTE: We assume that the first menu is the App menu, which has a bold font. - if (m_menus.is_empty()) - menu.set_title_font(Gfx::FontDatabase::default_bold_font()); - m_menus.append(&menu); } -- cgit v1.2.3