mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:58:14 +00:00
WindowServer: Clear window switcher's hovered item when cursor leaves
When the mouse cursor leaves the switcher window, we'll want to clear the hovered item index so it stops showing as hovered. :^)
This commit is contained in:
parent
6f80d91850
commit
7fb2540ffe
2 changed files with 15 additions and 1 deletions
|
@ -42,7 +42,7 @@ void WindowSwitcher::set_visible(bool visible)
|
|||
m_switcher_window->set_visible(visible);
|
||||
if (!m_visible)
|
||||
return;
|
||||
m_hovered_index = -1;
|
||||
clear_hovered_index();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,11 @@ Window* WindowSwitcher::selected_window()
|
|||
|
||||
void WindowSwitcher::event(Core::Event& event)
|
||||
{
|
||||
if (event.type() == Event::WindowLeft) {
|
||||
clear_hovered_index();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!static_cast<Event&>(event).is_mouse_event())
|
||||
return;
|
||||
|
||||
|
@ -261,4 +266,12 @@ void WindowSwitcher::refresh_if_needed()
|
|||
refresh();
|
||||
}
|
||||
|
||||
void WindowSwitcher::clear_hovered_index()
|
||||
{
|
||||
if (m_hovered_index == -1)
|
||||
return;
|
||||
m_hovered_index = -1;
|
||||
redraw();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue