mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +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);
|
m_switcher_window->set_visible(visible);
|
||||||
if (!m_visible)
|
if (!m_visible)
|
||||||
return;
|
return;
|
||||||
m_hovered_index = -1;
|
clear_hovered_index();
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,11 @@ Window* WindowSwitcher::selected_window()
|
||||||
|
|
||||||
void WindowSwitcher::event(Core::Event& event)
|
void WindowSwitcher::event(Core::Event& event)
|
||||||
{
|
{
|
||||||
|
if (event.type() == Event::WindowLeft) {
|
||||||
|
clear_hovered_index();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!static_cast<Event&>(event).is_mouse_event())
|
if (!static_cast<Event&>(event).is_mouse_event())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -261,4 +266,12 @@ void WindowSwitcher::refresh_if_needed()
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowSwitcher::clear_hovered_index()
|
||||||
|
{
|
||||||
|
if (m_hovered_index == -1)
|
||||||
|
return;
|
||||||
|
m_hovered_index = -1;
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ private:
|
||||||
void select_window_at_index(int index);
|
void select_window_at_index(int index);
|
||||||
Gfx::IntRect item_rect(int index) const;
|
Gfx::IntRect item_rect(int index) const;
|
||||||
Window* selected_window();
|
Window* selected_window();
|
||||||
|
void clear_hovered_index();
|
||||||
|
|
||||||
virtual void event(Core::Event&) override;
|
virtual void event(Core::Event&) override;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue