summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-03-06 15:32:03 +0100
committerGitHub <noreply@github.com>2019-03-06 15:32:03 +0100
commite60465dd7508cd540ec5a7f13e28a8fd73dc7eb1 (patch)
tree00982ca1789c3a963eb8479e41034d018235b0ae
parent4d099e901b0c176f8da8e63384c235f23f8c440c (diff)
parent37f0a6d99a7e959f76a8b6c1691c157eb9ba5585 (diff)
Merge pull request #26707 from bruvzg/fix_macos_mscroll
Fix macOS accumulated mouse scroll events.
-rw-r--r--platform/osx/os_osx.mm7
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index d72e6038d4..fee20de804 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1096,6 +1096,7 @@ static int remapKey(unsigned int key) {
inline void sendScrollEvent(int button, double factor, int modifierFlags) {
unsigned int mask = 1 << (button - 1);
+ Vector2 mouse_pos = Vector2(mouse_x, mouse_y);
Ref<InputEventMouseButton> sc;
sc.instance();
@@ -1104,14 +1105,18 @@ inline void sendScrollEvent(int button, double factor, int modifierFlags) {
sc->set_button_index(button);
sc->set_factor(factor);
sc->set_pressed(true);
- Vector2 mouse_pos = Vector2(mouse_x, mouse_y);
sc->set_position(mouse_pos);
sc->set_global_position(mouse_pos);
button_mask |= mask;
sc->set_button_mask(button_mask);
OS_OSX::singleton->push_input(sc);
+ sc.instance();
+ sc->set_button_index(button);
+ sc->set_factor(factor);
sc->set_pressed(false);
+ sc->set_position(mouse_pos);
+ sc->set_global_position(mouse_pos);
button_mask &= ~mask;
sc->set_button_mask(button_mask);
OS_OSX::singleton->push_input(sc);