mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 02:08:12 +03:00
WindowServer: Stop infinite menu movement cycle
While I really enjoyed having an infinite cycle when I implemented menu keys (and seeing it wizz around and around :D), menu key movement should be consistent between menus - and an inifinite cycle does not make much sense for a scrollable menu.
This commit is contained in:
parent
de74458f13
commit
3e05c83591
Notes:
sideshowbarker
2024-07-19 09:56:59 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/3e05c835913 Pull-request: https://github.com/SerenityOS/serenity/pull/1098
@ -392,9 +392,9 @@ void WSMenu::event(CEvent& event)
|
||||
return;
|
||||
|
||||
do {
|
||||
m_hovered_item_index--;
|
||||
if (m_hovered_item_index < 0)
|
||||
m_hovered_item_index = m_items.size() - 1;
|
||||
if (m_hovered_item_index <= 0)
|
||||
return;
|
||||
--m_hovered_item_index;
|
||||
} while (hovered_item()->type() == WSMenuItem::Separator);
|
||||
|
||||
if (is_scrollable() && m_hovered_item_index < m_scroll_offset)
|
||||
@ -411,9 +411,9 @@ void WSMenu::event(CEvent& event)
|
||||
return;
|
||||
|
||||
do {
|
||||
m_hovered_item_index++;
|
||||
if (m_hovered_item_index >= m_items.size())
|
||||
m_hovered_item_index = 0;
|
||||
if (m_hovered_item_index >= m_items.size() - 1)
|
||||
return;
|
||||
++m_hovered_item_index;
|
||||
} while (hovered_item()->type() == WSMenuItem::Separator);
|
||||
|
||||
if (is_scrollable() && m_hovered_item_index >= (m_scroll_offset + visible_item_count()))
|
||||
|
Loading…
Reference in New Issue
Block a user