summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-04 00:02:29 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-04 08:40:00 +0200
commita3baf06549be1f0e783c2e49f8f1aa5ecc74685c (patch)
tree1b159ea0bf955cfc44ba5d94561aa04d6388e33b
parentaa70a56174117a43b0fe957cbe5bca9098d5d148 (diff)
downloadserenity-a3baf06549be1f0e783c2e49f8f1aa5ecc74685c.zip
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.
-rw-r--r--Userland/Services/WindowServer/Button.cpp19
1 files changed, 19 insertions, 0 deletions
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)) {