WindowServer: Make MenuBar unaware of Process.
This commit is contained in:
parent
7723c06f27
commit
2733a788eb
Notes:
sideshowbarker
2024-07-19 15:43:24 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2733a788ebe
4 changed files with 7 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue