mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-27 21:42:53 +00:00
WindowServer: Clean up some of the code around menu item hovering
We were writing to the currently hovered menu item index in a bunch of places, which made it very confusing to follow how it changes. Rename Menu::set_hovered_item() to set_hovered_index() and use it in more places instead of manipulating m_hovered_item_index.
This commit is contained in:
parent
9f4e37e342
commit
b75d2d36e1
Notes:
sideshowbarker
2024-07-18 20:17:41 +09:00
Author: https://github.com/awesomekling
Commit: b75d2d36e1
4 changed files with 35 additions and 40 deletions
|
@ -96,7 +96,7 @@ void MenuManager::event(Core::Event& event)
|
|||
// with each keypress instead of activating immediately.
|
||||
auto index = shortcut_item_indexes->at(0);
|
||||
auto& item = m_current_menu->item(index);
|
||||
m_current_menu->set_hovered_item(index);
|
||||
m_current_menu->set_hovered_index(index);
|
||||
if (item.is_submenu())
|
||||
m_current_menu->descend_into_submenu_at_hovered_item();
|
||||
else
|
||||
|
@ -117,7 +117,7 @@ void MenuManager::event(Core::Event& event)
|
|||
set_current_menu(m_open_menu_stack.at(it.index() - 1));
|
||||
else {
|
||||
if (m_current_menu->hovered_item())
|
||||
m_current_menu->set_hovered_item(-1);
|
||||
m_current_menu->set_hovered_index(-1);
|
||||
else {
|
||||
auto* target_menu = previous_menu(m_current_menu);
|
||||
if (target_menu) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue