diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-14 10:49:59 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-14 10:49:59 +0100 |
commit | 2733a788ebe0d9cac08f6ca489a221b69a4136c5 (patch) | |
tree | c253bd50961f9c5843a0369e0113f52e599d320c | |
parent | 7723c06f27c514e1f7cc6200a490d465858d28b5 (diff) | |
download | serenity-2733a788ebe0d9cac08f6ca489a221b69a4136c5.zip |
WindowServer: Make MenuBar unaware of Process.
-rw-r--r-- | WindowServer/WSClientConnection.cpp | 2 | ||||
-rw-r--r-- | WindowServer/WSMenuBar.cpp | 7 | ||||
-rw-r--r-- | WindowServer/WSMenuBar.h | 8 | ||||
-rw-r--r-- | WindowServer/WSWindowManager.h | 1 |
4 files changed, 7 insertions, 11 deletions
diff --git a/WindowServer/WSClientConnection.cpp b/WindowServer/WSClientConnection.cpp index 9af3a148b6..2fa49bffbf 100644 --- a/WindowServer/WSClientConnection.cpp +++ b/WindowServer/WSClientConnection.cpp @@ -90,7 +90,7 @@ void WSClientConnection::on_message(WSMessage& message) void WSClientConnection::handle_request(WSAPICreateMenubarRequest& request) { int menubar_id = m_next_menubar_id++; - auto menubar = make<WSMenuBar>(menubar_id, *WSMessageLoop::process_from_client_id(request.client_id())); + auto menubar = make<WSMenuBar>(request.client_id(), menubar_id); m_menubars.set(menubar_id, move(menubar)); GUI_ServerMessage response; response.type = GUI_ServerMessage::Type::DidCreateMenubar; diff --git a/WindowServer/WSMenuBar.cpp b/WindowServer/WSMenuBar.cpp index a2d93ae8c0..0f6b389936 100644 --- a/WindowServer/WSMenuBar.cpp +++ b/WindowServer/WSMenuBar.cpp @@ -1,11 +1,10 @@ #include "WSMenuBar.h" #include "WSMenu.h" #include "WSMenuItem.h" -#include <Kernel/Process.h> -WSMenuBar::WSMenuBar(int menubar_id, Process& process) - : m_menubar_id(menubar_id) - , m_process(process.make_weak_ptr()) +WSMenuBar::WSMenuBar(int client_id, int menubar_id) + : m_client_id(client_id) + , m_menubar_id(menubar_id) { } diff --git a/WindowServer/WSMenuBar.h b/WindowServer/WSMenuBar.h index 285aa8d067..da209e9b9d 100644 --- a/WindowServer/WSMenuBar.h +++ b/WindowServer/WSMenuBar.h @@ -5,15 +5,13 @@ #include <AK/Weakable.h> #include <AK/WeakPtr.h> -class Process; - class WSMenuBar : public Weakable<WSMenuBar> { public: - WSMenuBar(int menubar_id, Process&); + WSMenuBar(int client_id, int menubar_id); ~WSMenuBar(); + int client_id() const { return m_client_id; } int menubar_id() const { return m_menubar_id; } - const Process* process() const { return m_process.ptr(); } void add_menu(WSMenu* menu) { m_menus.append(menu); } template<typename Callback> @@ -26,7 +24,7 @@ public: } private: + int m_client_id { 0 }; int m_menubar_id { 0 }; - WeakPtr<Process> m_process; Vector<WSMenu*> m_menus; }; diff --git a/WindowServer/WSWindowManager.h b/WindowServer/WSWindowManager.h index d27a98b18e..91ff9e6967 100644 --- a/WindowServer/WSWindowManager.h +++ b/WindowServer/WSWindowManager.h @@ -65,7 +65,6 @@ public: int api$menu_add_separator(int menu_id); int api$menu_add_item(int menu_id, unsigned identifier, String&& text); - void destroy_all_menus(Process&); private: WSWindowManager(); |