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:
parent
288e97a206
commit
b34f376329
Notes:
sideshowbarker
2024-07-19 14:23:35 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b34f3763299
1 changed files with 3 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue