summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-03-26 09:11:44 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-26 09:12:32 +0100
commit6203a4a2e9a350c9bace00a7055b78210d1fb4a1 (patch)
tree3e34cd3a588c3772039c80efd513f07b92a32e56
parentdfb81242f3f18383e6a9760c1b5aec039e903d95 (diff)
downloadserenity-6203a4a2e9a350c9bace00a7055b78210d1fb4a1.zip
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".
-rw-r--r--Userland/Services/WindowServer/Menu.cpp12
-rw-r--r--Userland/Services/WindowServer/Menu.h9
-rw-r--r--Userland/Services/WindowServer/MenuBar.cpp10
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 <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2020, Shannon Booth <shannon.ml.booth@gmail.com>
* 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<Gfx::Font> 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<MenuItem> m_items;
RefPtr<Window> 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 <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* 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 <LibGfx/Bitmap.h>
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);
}