From a3baf06549be1f0e783c2e49f8f1aa5ecc74685c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 4 May 2021 00:02:29 +0200 Subject: 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. --- Userland/Services/WindowServer/Button.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Userland/Services/WindowServer/Button.cpp b/Userland/Services/WindowServer/Button.cpp index 49ecb243ef..caf98dcefb 100644 --- a/Userland/Services/WindowServer/Button.cpp +++ b/Userland/Services/WindowServer/Button.cpp @@ -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)) { -- cgit v1.2.3