diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Services/WindowServer/Menu.cpp | 6 | ||||
-rw-r--r-- | Userland/Services/WindowServer/MenuManager.cpp | 18 | ||||
-rw-r--r-- | Userland/Services/WindowServer/MenuManager.h | 7 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowFrame.cpp | 2 |
4 files changed, 9 insertions, 24 deletions
diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 4d72eb8dbb..70b3c51407 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -322,7 +322,7 @@ void Menu::descend_into_submenu_at_hovered_item() VERIFY(hovered_item()); auto submenu = hovered_item()->submenu(); VERIFY(submenu); - MenuManager::the().open_menu(*submenu, false, false); + MenuManager::the().open_menu(*submenu, false); submenu->set_hovered_item(0); VERIFY(submenu->hovered_item()->type() != MenuItem::Separator); } @@ -473,7 +473,7 @@ void Menu::did_activate(MenuItem& item) if (on_item_activation) on_item_activation(item); - MenuManager::the().close_bar(); + MenuManager::the().close_everyone(); if (m_client) m_client->post_message(Messages::WindowClient::MenuItemActivated(m_menu_id, item.identifier())); @@ -553,7 +553,7 @@ void Menu::do_popup(const Gfx::IntPoint& position, bool make_input) window.move_to(adjusted_pos); window.set_visible(true); - MenuManager::the().open_menu(*this, false, make_input); + MenuManager::the().open_menu(*this, make_input); WindowManager::the().did_popup_a_menu({}); } diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp index ac4bf133a1..863d6eb661 100644 --- a/Userland/Services/WindowServer/MenuManager.cpp +++ b/Userland/Services/WindowServer/MenuManager.cpp @@ -158,7 +158,7 @@ void MenuManager::event(Core::Event& event) auto* target_menu = previous_menu(m_current_menu); if (target_menu) { target_menu->ensure_menu_window().move_to(target_menu->rect_in_window_menubar().bottom_left().translated(wm.window_with_active_menu()->frame().rect().location()).translated(wm.window_with_active_menu()->frame().menubar_rect().location())); - open_menu(*target_menu, false); + open_menu(*target_menu); } } } @@ -174,7 +174,7 @@ void MenuManager::event(Core::Event& event) auto* target_menu = next_menu(m_current_menu); if (target_menu) { target_menu->ensure_menu_window().move_to(target_menu->rect_in_window_menubar().bottom_left().translated(wm.window_with_active_menu()->frame().rect().location()).translated(wm.window_with_active_menu()->frame().menubar_rect().location())); - open_menu(*target_menu, false); + open_menu(*target_menu); close_everyone_not_in_lineage(*target_menu); } } @@ -238,7 +238,7 @@ void MenuManager::handle_mouse_event(MouseEvent& mouse_event) continue; return; } - close_bar(); + MenuManager::the().close_everyone(); topmost_menu->set_window_menu_open(false); } } @@ -354,11 +354,8 @@ void MenuManager::set_hovered_menu(Menu* menu) } } -void MenuManager::open_menu(Menu& menu, bool from_menu_bar, bool as_current_menu) +void MenuManager::open_menu(Menu& menu, bool as_current_menu) { - if (from_menu_bar) - m_current_menu_bar_menu = &menu; - if (is_open(menu)) { if (as_current_menu || current_menu() != &menu) { // This menu is already open. If requested, or if the current @@ -391,7 +388,6 @@ void MenuManager::clear_current_menu() { Menu* previous_current_menu = m_current_menu; m_current_menu = nullptr; - m_current_menu_bar_menu = nullptr; if (previous_current_menu) { // When closing the last menu, restore the previous active input window auto& wm = WindowManager::the(); @@ -432,12 +428,6 @@ void MenuManager::set_current_menu(Menu* menu) wm.set_active_input_window(m_current_menu->menu_window()); } -void MenuManager::close_bar() -{ - close_everyone(); - m_bar_open = false; -} - Gfx::IntRect MenuManager::menubar_rect() const { return { 0, 0, Screen::the().rect().width(), 19 }; diff --git a/Userland/Services/WindowServer/MenuManager.h b/Userland/Services/WindowServer/MenuManager.h index c1a8e8e035..579a84984e 100644 --- a/Userland/Services/WindowServer/MenuManager.h +++ b/Userland/Services/WindowServer/MenuManager.h @@ -57,9 +57,8 @@ public: Menu* current_menu() { return m_current_menu.ptr(); } void set_current_menu(Menu*); void clear_current_menu(); - void open_menu(Menu&, bool from_menu_bar, bool as_current_menu = true); + void open_menu(Menu&, bool as_current_menu = true); - void close_bar(); void close_everyone(); void close_everyone_not_in_lineage(Menu&); void close_menu_and_descendants(Menu&); @@ -85,23 +84,19 @@ private: virtual void event(Core::Event&) override; void handle_mouse_event(MouseEvent&); - void handle_menu_mouse_event(Menu&, const MouseEvent&); void draw(); RefPtr<Window> m_window; WeakPtr<Menu> m_current_menu; - WeakPtr<Menu> m_current_menu_bar_menu; WeakPtr<Window> m_previous_input_window; Vector<WeakPtr<Menu>> m_open_menu_stack; RefPtr<Core::Timer> m_search_timer; StringBuilder m_current_search; - WeakPtr<Menu> m_system_menu; bool m_needs_window_resize { false }; - bool m_bar_open { false }; int m_theme_index { 0 }; diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index 9acfffd2b2..8b65955576 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -759,7 +759,7 @@ void WindowFrame::handle_menu_mouse_event(Menu& menu, const MouseEvent& event) if (should_open_menu) { MenuManager::the().close_everyone(); menu.ensure_menu_window().move_to(menu.rect_in_window_menubar().bottom_left().translated(rect().location()).translated(menubar_rect.location())); - MenuManager::the().open_menu(menu, false); + MenuManager::the().open_menu(menu); WindowManager::the().set_window_with_active_menu(&m_window); invalidate(menubar_rect); return; |