mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:27:46 +00:00
WindowServer: Remove the global app menu
The SetApplicationMenu IPC message is still there, since we also need to clean up all of the client code before we can remove that.
This commit is contained in:
parent
05cc7d69ac
commit
fcc8e3484f
6 changed files with 3 additions and 48 deletions
|
@ -117,8 +117,6 @@ OwnPtr<Messages::WindowServer::DestroyMenubarResponse> ClientConnection::handle(
|
|||
did_misbehave("DestroyMenubar: Bad menubar ID");
|
||||
return {};
|
||||
}
|
||||
auto& menubar = *(*it).value;
|
||||
MenuManager::the().close_menubar(menubar);
|
||||
m_menubars.remove(it);
|
||||
return make<Messages::WindowServer::DestroyMenubarResponse>();
|
||||
}
|
||||
|
@ -146,17 +144,8 @@ OwnPtr<Messages::WindowServer::DestroyMenuResponse> ClientConnection::handle(con
|
|||
return make<Messages::WindowServer::DestroyMenuResponse>();
|
||||
}
|
||||
|
||||
OwnPtr<Messages::WindowServer::SetApplicationMenubarResponse> ClientConnection::handle(const Messages::WindowServer::SetApplicationMenubar& message)
|
||||
OwnPtr<Messages::WindowServer::SetApplicationMenubarResponse> ClientConnection::handle(const Messages::WindowServer::SetApplicationMenubar&)
|
||||
{
|
||||
int menubar_id = message.menubar_id();
|
||||
auto it = m_menubars.find(menubar_id);
|
||||
if (it == m_menubars.end()) {
|
||||
did_misbehave("SetApplicationMenubar: Bad menubar ID");
|
||||
return {};
|
||||
}
|
||||
auto& menubar = *(*it).value;
|
||||
m_app_menubar = menubar.make_weak_ptr();
|
||||
WindowManager::the().notify_client_changed_app_menubar(*this);
|
||||
return make<Messages::WindowServer::SetApplicationMenubarResponse>();
|
||||
}
|
||||
|
||||
|
|
|
@ -58,8 +58,6 @@ public:
|
|||
static ClientConnection* from_client_id(int client_id);
|
||||
static void for_each_client(Function<void(ClientConnection&)>);
|
||||
|
||||
MenuBar* app_menubar() { return m_app_menubar.ptr(); }
|
||||
|
||||
void notify_about_new_screen_rect(const Gfx::IntRect&);
|
||||
void post_paint_message(Window&, bool ignore_occlusion = false);
|
||||
|
||||
|
@ -169,7 +167,6 @@ private:
|
|||
HashMap<int, NonnullRefPtr<Window>> m_windows;
|
||||
HashMap<int, NonnullRefPtr<MenuBar>> m_menubars;
|
||||
HashMap<int, NonnullRefPtr<Menu>> m_menus;
|
||||
WeakPtr<MenuBar> m_app_menubar;
|
||||
|
||||
RefPtr<Core::Timer> m_ping_timer;
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ MenuManager::MenuManager()
|
|||
s_the = this;
|
||||
m_needs_window_resize = true;
|
||||
|
||||
// NOTE: This ensures that the system menu has the correct dimensions.
|
||||
set_current_menubar(nullptr);
|
||||
|
||||
m_window = Window::construct(*this, WindowType::Menubar);
|
||||
|
@ -498,15 +497,8 @@ Gfx::IntRect MenuManager::menubar_rect() const
|
|||
return { 0, 0, Screen::the().rect().width(), 19 };
|
||||
}
|
||||
|
||||
void MenuManager::set_current_menubar(MenuBar* menubar)
|
||||
void MenuManager::set_current_menubar(MenuBar*)
|
||||
{
|
||||
if (menubar)
|
||||
m_current_menubar = *menubar;
|
||||
else
|
||||
m_current_menubar = nullptr;
|
||||
|
||||
dbgln_if(MENUS_DEBUG, "[WM] Current menubar is now {}", menubar);
|
||||
|
||||
Gfx::IntPoint next_menu_location { MenuManager::menubar_menu_margin() / 2, 0 };
|
||||
for_each_active_menubar_menu([&](Menu& menu) {
|
||||
int text_width = menu.title_font().width(menu.name());
|
||||
|
@ -521,16 +513,10 @@ void MenuManager::set_current_menubar(MenuBar* menubar)
|
|||
refresh();
|
||||
}
|
||||
|
||||
void MenuManager::close_menubar(MenuBar& menubar)
|
||||
{
|
||||
if (current_menubar() == &menubar)
|
||||
set_current_menubar(nullptr);
|
||||
}
|
||||
|
||||
void MenuManager::set_system_menu(Menu& menu)
|
||||
{
|
||||
m_system_menu = menu;
|
||||
set_current_menubar(m_current_menubar);
|
||||
set_current_menubar(nullptr);
|
||||
}
|
||||
|
||||
Menu* MenuManager::previous_menu(Menu* current)
|
||||
|
|
|
@ -59,9 +59,7 @@ public:
|
|||
void clear_current_menu();
|
||||
void open_menu(Menu&, bool from_menu_bar, bool as_current_menu = true);
|
||||
|
||||
MenuBar* current_menubar() { return m_current_menubar.ptr(); }
|
||||
void set_current_menubar(MenuBar*);
|
||||
void close_menubar(MenuBar&);
|
||||
|
||||
void close_bar();
|
||||
void close_everyone();
|
||||
|
@ -84,8 +82,6 @@ public:
|
|||
if (callback(*system_menu()) == IterationDecision::Break)
|
||||
return;
|
||||
}
|
||||
if (m_current_menubar)
|
||||
m_current_menubar->for_each_menu(callback);
|
||||
}
|
||||
|
||||
Menu* previous_menu(Menu* current);
|
||||
|
@ -123,7 +119,6 @@ private:
|
|||
|
||||
int m_theme_index { 0 };
|
||||
|
||||
WeakPtr<MenuBar> m_current_menubar;
|
||||
WeakPtr<Menu> m_hovered_menu;
|
||||
};
|
||||
|
||||
|
|
|
@ -1370,11 +1370,6 @@ void WindowManager::set_active_window(Window* window, bool make_input)
|
|||
m_active_window = *window;
|
||||
Core::EventLoop::current().post_event(*m_active_window, make<Event>(Event::WindowActivated));
|
||||
m_active_window->invalidate(true, true);
|
||||
if (auto* client = window->client()) {
|
||||
MenuManager::the().set_current_menubar(client->app_menubar());
|
||||
} else {
|
||||
MenuManager::the().set_current_menubar(nullptr);
|
||||
}
|
||||
tell_wm_listeners_window_state_changed(*m_active_window);
|
||||
} else {
|
||||
MenuManager::the().set_current_menubar(nullptr);
|
||||
|
@ -1406,12 +1401,6 @@ const ClientConnection* WindowManager::active_client() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void WindowManager::notify_client_changed_app_menubar(ClientConnection& client)
|
||||
{
|
||||
if (active_client() == &client)
|
||||
MenuManager::the().set_current_menubar(client.app_menubar());
|
||||
}
|
||||
|
||||
const Cursor& WindowManager::active_cursor() const
|
||||
{
|
||||
if (m_dnd_client)
|
||||
|
|
|
@ -94,7 +94,6 @@ public:
|
|||
void notify_opacity_changed(Window&);
|
||||
void notify_occlusion_state_changed(Window&);
|
||||
void notify_progress_changed(Window&);
|
||||
void notify_client_changed_app_menubar(ClientConnection&);
|
||||
|
||||
Gfx::IntRect maximized_window_rect(const Window&) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue