diff options
author | Shannon Booth <shannon.ml.booth@gmail.com> | 2020-01-12 15:52:54 +1300 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-12 09:52:40 +0100 |
commit | 4f6b9b64c394a51b40d1254b41dbba66c0000525 (patch) | |
tree | 3397b45d44db83066fc7653b1d1c91c41a22f69d /Servers | |
parent | 0d2bfc4ea08eee7921889cf2016a1a381318b22b (diff) | |
download | serenity-4f6b9b64c394a51b40d1254b41dbba66c0000525.zip |
WindowServer: Fix incorrect current menu when switching to new item
We were forgetting to update the current menu when switching to a new
item.
We also rename the function from implying that only a redraw is
happening, as is actually not the case. It is now more correctly named:
update_for_new_hovered_item()
Diffstat (limited to 'Servers')
-rw-r--r-- | Servers/WindowServer/WSMenu.cpp | 14 | ||||
-rw-r--r-- | Servers/WindowServer/WSMenu.h | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/Servers/WindowServer/WSMenu.cpp b/Servers/WindowServer/WSMenu.cpp index 3851342068..a7ea75178f 100644 --- a/Servers/WindowServer/WSMenu.cpp +++ b/Servers/WindowServer/WSMenu.cpp @@ -207,7 +207,7 @@ void WSMenu::draw() } } -void WSMenu::redraw_for_new_hovered_item() +void WSMenu::update_for_new_hovered_item() { if (m_hovered_item && m_hovered_item->is_submenu()) { ASSERT(m_hovered_item == &m_items.at(m_current_index)); @@ -215,6 +215,8 @@ void WSMenu::redraw_for_new_hovered_item() m_hovered_item->submenu()->popup(m_hovered_item->rect().top_right().translated(menu_window()->rect().location()), true); } else { WSMenuManager::the().close_everyone_not_in_lineage(*this); + WSMenuManager::the().set_current_menu(this); + menu_window()->set_visible(true); } redraw(); } @@ -239,7 +241,7 @@ void WSMenu::decend_into_submenu_at_hovered_item() ASSERT(submenu->m_current_index == 0); submenu->m_hovered_item = &submenu->m_items.at(0); ASSERT(submenu->m_hovered_item->type() != WSMenuItem::Separator); - submenu->redraw_for_new_hovered_item(); + submenu->update_for_new_hovered_item(); m_in_submenu = true; } @@ -259,7 +261,7 @@ void WSMenu::event(CEvent& event) } m_in_submenu = false; - redraw_for_new_hovered_item(); + update_for_new_hovered_item(); return; } @@ -280,7 +282,7 @@ void WSMenu::event(CEvent& event) // Default to the first item on key press if one has not been selected yet if (!m_hovered_item) { m_hovered_item = &m_items.at(0); - redraw_for_new_hovered_item(); + update_for_new_hovered_item(); return; } @@ -309,7 +311,7 @@ void WSMenu::event(CEvent& event) m_hovered_item = &m_items.at(m_current_index); } while (m_hovered_item->type() == WSMenuItem::Separator); - redraw_for_new_hovered_item(); + update_for_new_hovered_item(); return; } @@ -323,7 +325,7 @@ void WSMenu::event(CEvent& event) m_hovered_item = &m_items.at(m_current_index); } while (m_hovered_item->type() == WSMenuItem::Separator); - redraw_for_new_hovered_item(); + update_for_new_hovered_item(); return; } diff --git a/Servers/WindowServer/WSMenu.h b/Servers/WindowServer/WSMenu.h index 6201871cbd..2bb34bae90 100644 --- a/Servers/WindowServer/WSMenu.h +++ b/Servers/WindowServer/WSMenu.h @@ -93,7 +93,7 @@ private: int padding_between_text_and_shortcut() const { return 50; } void did_activate(WSMenuItem&); void open_hovered_item(); - void redraw_for_new_hovered_item(); + void update_for_new_hovered_item(); void decend_into_submenu_at_hovered_item(); WSClientConnection* m_client { nullptr }; |