From 611370e7dcf7e2820738036133dafb2b45340780 Mon Sep 17 00:00:00 2001 From: sin-ack Date: Thu, 29 Jul 2021 10:14:12 +0000 Subject: LibGUI, WindowServer: Greatly simplify menubar logic Currently, any number of menubars can be plugged in and out of a window. This is unnecessary complexity, since we only need one menubar on a window. This commit removes most of the logic for dynamically attaching and detaching menubars and makes one menubar always available. The menubar is only considered existent if it has at least a single menu in it (in other words, an empty menubar will not be shown). This commit additionally fixes a bug wherein menus added after a menubar has been attached would not have their rects properly setup, and would therefore appear glitched out on the top left corner of the menubar. --- Userland/Libraries/LibGUI/Window.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Userland/Libraries/LibGUI/Window.h') diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h index 0b597f90ed..18945fee26 100644 --- a/Userland/Libraries/LibGUI/Window.h +++ b/Userland/Libraries/LibGUI/Window.h @@ -201,7 +201,6 @@ public: void did_disable_focused_widget(Badge); Menu& add_menu(String name); - void set_menubar(RefPtr); protected: Window(Core::Object* parent = nullptr); @@ -242,7 +241,7 @@ private: OwnPtr m_front_store; OwnPtr m_back_store; - RefPtr m_menubar; + NonnullRefPtr m_menubar; RefPtr m_icon; RefPtr m_custom_cursor; -- cgit v1.2.3