1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:17:34 +00:00

WindowServer: Only clear the hovered item if the item was enabled

Otherwise, we emit a menu_item_left to the WindowServer client even
though the mouse never left the menu item (as is the case when a
disabled menu item is clicked).
This commit is contained in:
sin-ack 2021-08-18 18:29:08 +00:00 committed by Andreas Kling
parent d8fd4eee9b
commit 705e5a3d87

View file

@ -338,10 +338,11 @@ void Menu::open_hovered_item(bool leave_menu_open)
VERIFY(menu_window()->is_visible()); VERIFY(menu_window()->is_visible());
if (!hovered_item()) if (!hovered_item())
return; return;
if (hovered_item()->is_enabled()) if (hovered_item()->is_enabled()) {
did_activate(*hovered_item(), leave_menu_open); did_activate(*hovered_item(), leave_menu_open);
if (!leave_menu_open) if (!leave_menu_open)
clear_hovered_item(); clear_hovered_item();
}
} }
void Menu::descend_into_submenu_at_hovered_item() void Menu::descend_into_submenu_at_hovered_item()