mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 09:18:52 +00:00
LibGUI: Unbreak popup menus, now that invalid menus have ID -1.
This commit is contained in:
parent
41ebb3eba3
commit
90dbf689c0
Notes:
sideshowbarker
2024-07-19 13:57:11 +09:00
Author: https://github.com/awesomekling
Commit: 90dbf689c0
3 changed files with 17 additions and 12 deletions
|
@ -25,24 +25,24 @@ int GMenuBar::realize_menubar()
|
|||
|
||||
void GMenuBar::unrealize_menubar()
|
||||
{
|
||||
if (!m_menubar_id)
|
||||
if (m_menubar_id == -1)
|
||||
return;
|
||||
WSAPI_ClientMessage request;
|
||||
request.type = WSAPI_ClientMessage::Type::DestroyMenubar;
|
||||
request.menu.menubar_id = m_menubar_id;
|
||||
GEventLoop::current().sync_request(request, WSAPI_ServerMessage::Type::DidDestroyMenubar);
|
||||
m_menubar_id = 0;
|
||||
m_menubar_id = -1;
|
||||
}
|
||||
|
||||
void GMenuBar::notify_added_to_application(Badge<GApplication>)
|
||||
{
|
||||
ASSERT(!m_menubar_id);
|
||||
ASSERT(m_menubar_id == -1);
|
||||
m_menubar_id = realize_menubar();
|
||||
ASSERT(m_menubar_id > 0);
|
||||
ASSERT(m_menubar_id != -1);
|
||||
for (auto& menu : m_menus) {
|
||||
ASSERT(menu);
|
||||
int menu_id = menu->realize_menu();
|
||||
ASSERT(menu_id > 0);
|
||||
ASSERT(menu_id != -1);
|
||||
WSAPI_ClientMessage request;
|
||||
request.type = WSAPI_ClientMessage::Type::AddMenuToMenubar;
|
||||
request.menu.menubar_id = m_menubar_id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue