From 76041265d641a510245782b94162c1461ba7226f Mon Sep 17 00:00:00 2001 From: Gus Wynn Date: Thu, 1 Apr 2021 08:06:54 -0700 Subject: [PATCH] other_mouse_down as well --- window/src/os/macos/window.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index 0978f4d8b..98ed1bb0b 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -1577,7 +1577,14 @@ impl WindowView { } extern "C" fn other_mouse_down(this: &mut Object, _sel: Sel, nsevent: id) { - Self::mouse_common(this, nsevent, MouseEventKind::Press(MousePress::Middle)); + // Safety: See `other_mouse_up` + unsafe { + let button_number = NSEvent::buttonNumber(nsevent); + // See `other_mouse_up` + if [2, 4].contains(&button_number) { + Self::mouse_common(this, nsevent, MouseEventKind::Press(MousePress::Middle)); + } + } } extern "C" fn mouse_moved_or_dragged(this: &mut Object, _sel: Sel, nsevent: id) {