1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:37:43 +00:00

WindowServer: Detach WSMenuManager from WSWindowManager

You can now get to the WSMenuManager via WSMenuManager::the().
Also note that it's initialized after WSWindowManager.
This commit is contained in:
Andreas Kling 2020-01-08 13:19:31 +01:00
parent 2d75396c94
commit 8ddd053c2a
8 changed files with 41 additions and 39 deletions

View file

@ -11,8 +11,17 @@
//#define DEBUG_MENUS
static WSMenuManager* s_the;
WSMenuManager& WSMenuManager::the()
{
ASSERT(s_the);
return *s_the;
}
WSMenuManager::WSMenuManager()
{
s_the = this;
m_username = getlogin();
m_needs_window_resize = true;
@ -140,18 +149,15 @@ WSMenuManager::WSMenuManager()
// NOTE: This ensures that the system menu has the correct dimensions.
set_current_menubar(nullptr);
m_window = WSWindow::construct(*this, WSWindowType::Menubar);
m_window->set_rect(menubar_rect());
}
WSMenuManager::~WSMenuManager()
{
}
void WSMenuManager::setup()
{
m_window = WSWindow::construct(*this, WSWindowType::Menubar);
m_window->set_rect(menubar_rect());
}
bool WSMenuManager::is_open(const WSMenu& menu) const
{
for (int i = 0; i < m_open_menu_stack.size(); ++i) {