mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 21:45:20 +00:00
WindowServer: Take MenuApplet windows into account for hovered_window
This finally makes tooltips on menu applets the same as everywhere else! Here's what went wrong: WindowManager::process_mouse_event() receives a Window*&, determines the hovered window and sets it accordingly. However there's a branch that tests for menubar_rect().contains(event.position()) and returns early - which resulted in hovered_window never being set to any MenuApplet window, even hovered ones. The hovered_window result is being used in WindowManager::event() and passed to WindowManager::set_hovered_window(), which is responsible for creating WindowLeft and WindowEntered events when the hovered window changes, as a result of the mentioned chain of events this also never happens for MenuApplet windows. The WindowLeft event would the cause Window::handle_left_event() in LibGUI to be called, which unsets the window's hovered widget, which is necessary for the widget to receive a subsequent Enter event - again, all of this never happened. Now it's working as expected though, so we can start using tooltips on menu applets :^)
This commit is contained in:
parent
e77991e63a
commit
895ab8e745
Notes:
sideshowbarker
2024-07-19 03:39:46 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/895ab8e7458 Pull-request: https://github.com/SerenityOS/serenity/pull/3127
1 changed files with 6 additions and 0 deletions
|
@ -901,6 +901,12 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
|
||||||
|
|
||||||
// FIXME: Now that the menubar has a dedicated window, is this special-casing really necessary?
|
// FIXME: Now that the menubar has a dedicated window, is this special-casing really necessary?
|
||||||
if (MenuManager::the().has_open_menu() || menubar_rect().contains(event.position())) {
|
if (MenuManager::the().has_open_menu() || menubar_rect().contains(event.position())) {
|
||||||
|
for_each_visible_window_of_type_from_front_to_back(WindowType::MenuApplet, [&](auto& window) {
|
||||||
|
if (!window.rect_in_menubar().contains(event.position()))
|
||||||
|
return IterationDecision::Continue;
|
||||||
|
hovered_window = &window;
|
||||||
|
return IterationDecision::Break;
|
||||||
|
});
|
||||||
clear_resize_candidate();
|
clear_resize_candidate();
|
||||||
MenuManager::the().dispatch_event(event);
|
MenuManager::the().dispatch_event(event);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue