diff options
author | Andreas Kling <kling@serenityos.org> | 2021-04-17 18:50:10 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-17 20:49:53 +0200 |
commit | ec6debb46f43540eadcc681454ad05fb26926562 (patch) | |
tree | 0fcca30b801453adb110891c2562e9c21d907578 /Userland/Services/WindowServer | |
parent | e67f392576d35b0f86de2b2781f180691f915be6 (diff) | |
download | serenity-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')
-rw-r--r-- | Userland/Services/WindowServer/Menu.cpp | 5 |
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; |