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

Add a slight hover highlight to GButton and WSButton. :^)

This commit is contained in:
Andreas Kling 2019-04-06 04:08:09 +02:00
parent 22c204af66
commit f12573cb63
6 changed files with 40 additions and 13 deletions

View file

@ -623,6 +623,10 @@ void WSWindowManager::process_mouse_event(const WSMouseEvent& event, WSWindow*&
if (m_cursor_tracking_button)
return m_cursor_tracking_button->on_mouse_event(event.translated(-m_cursor_tracking_button->screen_rect().location()));
// This is quite hackish, but it's how the WSButton hover effect is implemented.
if (m_hovered_button && event.type() == WSMessage::MouseMove)
m_hovered_button->on_mouse_event(event.translated(-m_hovered_button->screen_rect().location()));
HashTable<WSWindow*> windows_who_received_mouse_event_due_to_cursor_tracking;
for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) {
@ -1099,3 +1103,8 @@ const WSCursor& WSWindowManager::active_cursor() const
return *m_arrow_cursor;
}
void WSWindowManager::set_hovered_button(WSButton* button)
{
m_hovered_button = button;
}