mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
WindowServer: WSButton should be more discerning with MouseUp/MouseMove.
This commit is contained in:
parent
2d7cad6a16
commit
62f7e8ac62
2 changed files with 8 additions and 2 deletions
|
@ -40,7 +40,9 @@ void WSButton::on_mouse_event(const WSMouseEvent& event)
|
|||
}
|
||||
|
||||
if (event.type() == WSEvent::MouseUp && event.button() == MouseButton::Left) {
|
||||
WSWindowManager::the().set_cursor_tracking_button(nullptr);
|
||||
if (wm.cursor_tracking_button() != this)
|
||||
return;
|
||||
wm.set_cursor_tracking_button(nullptr);
|
||||
bool old_pressed = m_pressed;
|
||||
m_pressed = false;
|
||||
if (rect().contains(event.position())) {
|
||||
|
@ -61,6 +63,8 @@ void WSButton::on_mouse_event(const WSMouseEvent& event)
|
|||
}
|
||||
|
||||
if (event.type() == WSEvent::MouseMove && event.buttons() & (unsigned)MouseButton::Left) {
|
||||
if (wm.cursor_tracking_button() != this)
|
||||
return;
|
||||
bool old_pressed = m_pressed;
|
||||
m_pressed = m_hovered;
|
||||
if (old_pressed != m_pressed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue