How to detect trackpad/magic mouse scrolling on godot? - macos

I am using a macbook, and have noticed that when adding an input to my project's input map to detect the scroll wheel, then calling it with "Input.is_action_just_released(scroll_up)", it works with a regular mouse with a normal scroll wheel, but not with my magic mouse or the trackpad on my mac. The input is set to be for all devices, not just device 0.
What am I doing wrong? I cannot seem to find an answer to this anywhere.

Related

Intercepting the mouse coordinates and modifying it

I would like to create an app that intercepts the mouse coordinates and modify them.
I want to build an app that runs in the background and intercepts the mouse movement, filtering it, for all apps running on macOS.
Suppose the mouse is scrolling freely but if the user presses a global shortcut, like CMD ALT X, the vertical scrolling is filtered and just the horizontal scrolling passes to macOS.
First question: what should I use to do that? Just point me in the right direction if the topic is too extensive.
Second question: is that possible to do for a sandbox app?

How to distinguish real mouse wheel events in Qt6?

I'm trying to get zooming working so that the normal pan/pinch-zoom touchpad features work as expected, and scrolling a real mouse wheel zooms in/out (without any modifiers held).
Unfortunately it seems like touchpad pan gestures get converted into wheel events (there is Qt::PanGesture but it doesn't seem to be used). Therefore I need some way to distinguish real QWheelEvent events from touchpad ones.
The obvious thing is QWheelEvent::device()->type():
if (event->device()->type() == QInputDevice::DeviceType::Mouse)
// zoom
else
// pan
Unfortunately the QWheelEvents from my actual real physical mouse have a device()->type() of DeviceType::TouchPad.
I also tried
event->source() != Qt::MouseEventNotSynthesized
But again both real and touchpad events have that set to Qt::MouseEventSynthesizedBySystem.
Is there any way to do this?

How to recognise two finger panning on trackpad?

I see that the SingleChildScrollView allows scrolling via the MacBook trackpad with two-finger-panning.
However, I cannot find any gesture recogniser that is triggered by two-finger-panning.
How is two-finger-panning implemented for SingleChildScrollView?
I found the answer. Scrollable listens to PointerScrollEvent.
https://github.com/flutter/flutter/blob/b007a81ad498eb9b7cd687fda0aa9d8d2bb77dc3/packages/flutter/lib/src/widgets/scrollable.dart#L642
However, there is no reliable way to detect when scrolling actually ended and is not just idle (the user lifted the fingers).

GetLastInputInfo does not detect touchpad scrolling

I am trying to find CPU idle time using GetLastInputInfo(). This works for all keyboard buttons and mouse/touchpad movement and clicks. While this also detects external mouse's scrolling, it fails to detect two finger scrolling on laptop touchpad!!
Any solutions?

Mouse over effect on touchscreen

Obviously you dont have a mouse over effect on a touchscreen, but I would like some effect, maybe onclick? Does anybody have any suggestions?
On the touchscreen I'm working with right now, the mouse over is a persistent effect of clicks. In other words, it's as if after clicking an item with an actual mouse and releasing the button, one never moved the mouse pointer afterwards.

Resources