mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
GButton: Update hovered state on mouseover as well.
We can't rely exclusively on enter and leave events to update the hovered state, since leave will not be delivered while the widget is auto-tracking the mouse (between mousedown and mouseup.)
This commit is contained in:
@@ -65,9 +65,11 @@ void GButton::paint_event(GPaintEvent& event)
|
||||
|
||||
void GButton::mousemove_event(GMouseEvent& event)
|
||||
{
|
||||
bool is_over = rect().contains(event.position());
|
||||
m_hovered = is_over;
|
||||
if (event.buttons() & GMouseButton::Left) {
|
||||
if (is_enabled()) {
|
||||
bool being_pressed = rect().contains(event.position());
|
||||
bool being_pressed = is_over;
|
||||
if (being_pressed != m_being_pressed) {
|
||||
m_being_pressed = being_pressed;
|
||||
update();
|
||||
|
||||
Reference in New Issue
Block a user