WindowServer: Ignore mouse clicks we're not handling

This ignores unhandled mouse clicks for the window buttons. Right now
right-clicking on the window buttons animates them as if some action
were to occur when the mouse button is released.
This commit is contained in:
Gunnar Beutner 2021-05-04 00:02:29 +02:00 committed by Andreas Kling
parent aa70a56174
commit a3baf06549
Notes: sideshowbarker 2024-07-18 18:44:00 +09:00

View file

@ -40,6 +40,25 @@ void Button::paint(Gfx::Painter& painter)
void Button::on_mouse_event(const MouseEvent& event)
{
auto interesting_button = false;
switch (event.button()) {
case MouseButton::Left:
interesting_button = !!on_click;
break;
case MouseButton::Middle:
interesting_button = !!on_middle_click;
break;
case MouseButton::Right:
interesting_button = !!on_right_click;
break;
default:
break;
}
if (!interesting_button)
return;
auto& wm = WindowManager::the();
if (event.type() == Event::MouseDown && (event.button() == MouseButton::Left || event.button() == MouseButton::Right || event.button() == MouseButton::Middle)) {