WindowServer: Don't "enter" menu item when hovering over a separator
Since menu separator items don't have an associated identifier, make sure we don't falsely report that we've enter item 0. This fixes an issue where hovering over a separator would behave as if we'd hovered over the first item in the menu wrt sending MenuItemEntered.
This commit is contained in:
parent
e67f392576
commit
ec6debb46f
Notes:
sideshowbarker
2024-07-18 19:29:53 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ec6debb46f4
1 changed files with 4 additions and 1 deletions
|
@ -556,8 +556,11 @@ int Menu::item_index_at(const Gfx::IntPoint& position)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto& item : m_items) {
|
for (auto& item : m_items) {
|
||||||
if (item.rect().contains(position))
|
if (item.rect().contains(position)) {
|
||||||
|
if (item.type() == MenuItem::Type::Separator)
|
||||||
|
return -1;
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue