summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer/Menu.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-04-17 18:50:10 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-17 20:49:53 +0200
commitec6debb46f43540eadcc681454ad05fb26926562 (patch)
tree0fcca30b801453adb110891c2562e9c21d907578 /Userland/Services/WindowServer/Menu.cpp
parente67f392576d35b0f86de2b2781f180691f915be6 (diff)
downloadserenity-ec6debb46f43540eadcc681454ad05fb26926562.zip
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.
Diffstat (limited to 'Userland/Services/WindowServer/Menu.cpp')
-rw-r--r--Userland/Services/WindowServer/Menu.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp
index fe5d3d794d..8f9dbc7ff6 100644
--- a/Userland/Services/WindowServer/Menu.cpp
+++ b/Userland/Services/WindowServer/Menu.cpp
@@ -556,8 +556,11 @@ int Menu::item_index_at(const Gfx::IntPoint& position)
{
int i = 0;
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;
+ }
++i;
}
return -1;