1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 00:08:11 +00:00

LibGUI: Update active tooltip when source widget changes the label

Application::show_tooltip() now keeps track of the application's active
tooltip source widget so it can be updated while being shown when the
same widget updates its tooltip label.
Application::hide_tooltip() will unset the tooltip source widget,
respectively.

This is pretty useful for the ResourceGraph applet's tooltips!

Also re-use the Application::TooltipWindow's rect position in its
set_tooltip() method to avoid flickering from the window temporarily
being moved to 100, 100 and the position adjusted moments later.
This commit is contained in:
Linus Groh 2020-08-15 11:44:34 +02:00 committed by Andreas Kling
parent f19b88c965
commit 47d7faa998
5 changed files with 27 additions and 7 deletions

View file

@ -183,7 +183,7 @@ void PageView::page_did_middle_click_link(const URL& url, const String& target,
void PageView::page_did_enter_tooltip_area(const Gfx::IntPoint& content_position, const String& title)
{
GUI::Application::the()->show_tooltip(title, screen_relative_rect().location().translated(to_widget_position(content_position)));
GUI::Application::the()->show_tooltip(title, screen_relative_rect().location().translated(to_widget_position(content_position)), nullptr);
}
void PageView::page_did_leave_tooltip_area()