From e77991e63a91d48ec80560cecd027f20682b8234 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 13 Aug 2020 21:15:13 +0200 Subject: [PATCH] LibGUI: Fix Widget::screen_relative_rect() for WindowType::MenuApplet This was using window()->position(), which is unset for windows with WindowType::MenuApplet. Now it checks the window type and then uses rect_in_menubar() for MenuApplet windows and rect() for everything else. This makes tooltips show up for MenuApplet windows, previously they were positioned off-screen :^) --- Libraries/LibGUI/Widget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/LibGUI/Widget.cpp b/Libraries/LibGUI/Widget.cpp index 8142d8b14b..f62e89c227 100644 --- a/Libraries/LibGUI/Widget.cpp +++ b/Libraries/LibGUI/Widget.cpp @@ -464,7 +464,10 @@ Gfx::IntRect Widget::window_relative_rect() const Gfx::IntRect Widget::screen_relative_rect() const { - return window_relative_rect().translated(window()->position()); + auto window_position = window()->window_type() == WindowType::MenuApplet + ? window()->rect_in_menubar().location() + : window()->rect().location(); + return window_relative_rect().translated(window_position); } Widget* Widget::child_at(const Gfx::IntPoint& point) const