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

LibGUI: Show tooltip after a small delay

It always felt a bit jarring that tooltips would pop in right away when
you hover over a toolbar button. This patch adds a 700ms delay before
they appear, and a 50ms delay before they disappear.

Once a tooltip is up, moving the cursor between two widgets that both
have tooltips will leave the tooltip on screen without delays.
This commit is contained in:
Andreas Kling 2020-12-28 21:26:47 +01:00
parent 3717e5dbae
commit 7e79563bb9
4 changed files with 84 additions and 51 deletions

View file

@ -919,7 +919,7 @@ void Widget::set_tooltip(const StringView& tooltip)
void Widget::show_tooltip()
{
if (has_tooltip())
Application::the()->show_tooltip(m_tooltip, screen_relative_rect().center().translated(0, height() / 2), this);
Application::the()->show_tooltip(m_tooltip, this);
}
Gfx::IntRect Widget::children_clip_rect() const