diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-25 21:41:39 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-25 22:14:09 +0100 |
commit | 78b12e1521a5ab4e0a212c0e125b76a813be6f64 (patch) | |
tree | 63b47fca86bfba4ef53d62f301856e63f5bb2f28 /Userland/Libraries/LibGUI/Window.cpp | |
parent | fcc8e3484f9c2312d80063fe8d6251830609385a (diff) | |
download | serenity-78b12e1521a5ab4e0a212c0e125b76a813be6f64.zip |
Userland: Turn all application menus into window menus :^)
Diffstat (limited to 'Userland/Libraries/LibGUI/Window.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/Window.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index a7f3c79911..23332112b1 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.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 @@ -110,6 +110,8 @@ Window::Window(Core::Object* parent) Window::~Window() { + if (m_menubar) + m_menubar->notify_removed_from_window({}); all_windows->remove(this); hide(); } @@ -161,6 +163,12 @@ void Window::show() apply_icon(); + if (m_menubar) { + // This little dance makes us create a server-side menubar. + auto menubar = move(m_menubar); + set_menubar(menubar); + } + reified_windows->set(m_window_id, this); Application::the()->did_create_window({}); update(); @@ -1057,9 +1065,13 @@ void Window::set_menubar(RefPtr<MenuBar> menubar) { if (m_menubar == menubar) return; + if (m_menubar) + m_menubar->notify_removed_from_window({}); m_menubar = move(menubar); - if (m_window_id && m_menubar) + if (m_window_id && m_menubar) { + m_menubar->notify_added_to_window({}); WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowMenubar>(m_window_id, m_menubar->menubar_id()); + } } } |