Detecting multitouch iPhone-like "tap" on MacBookPro - cocoa

After a period of iPhone work, I'm once again working on normal Cocoa apps on my MBP
and I miss the "tap" gesture. I know that I can turn on the incredibly annoying "Tap to Click",
feature in the Trackpad control pannel, but I don't want a click, I want a tap.
I know it's probably not mac canon, but is it possible to receive this multi-touch style event?

You might want to have a look at the native code underpinning my Java API: http://kenai.com/projects/macmultitouch

Related

How to recognize mouse wheel in MAUI view for desktop application

How to get notified for mouse wheel interaction for MacCatalyst and windows at MAUI platform.
Answer 1: Scrolling.
What do you want to do based on mouse wheel interaction? If you simply want to scroll, or know when scrolling has occurred, then you can rely on ScrollView, and other views that handle scrolling themselves. E.g. ScrollView.Scrolled event.
Answer 2: General use of mouse scroll wheel.
Input functionality for mouse or keyboard has not yet been implemented in MAUI. Nor has a specification been finalized.
Here is one mouse proposal.
You could add a comment to that proposal requesting that mouse wheel support be included.
However, this might not be in the first release of MAUI, as the current emphasis is on stabilizing the functionality that is needed on all platforms (including mobile), some of which don't have mice.
In case anyone is wondering "shouldn't this be specified in .net 6?" (And then MAUI would simply use it.)
There are interactions between what is happening on the display (views or windows) and how mouse/keyboard input should be handled - it makes sense to put that input in the same code base that is displaying to the screen - therefore MAUI is a good place for it.
Especially given that touch is part of MAUI.
Until then, the solution is to make a DependencyService on each platform, to refer to the platform's APIs that you need.
Surprisingly, I'm not finding one that anyone has done for mouse on Windows and Mac.
Other than "implicitly", since a mouse can be used similar to a touch device. And text can be typed on a keyboard. The point is that there is no API specific to functionality that only makes sense if you have a physical mouse (scroll wheel) or a physical keyboard (global keyboard hooks).
TBD I'll look into this further.
Basic approach would be to look at what WinUI 3 uses as input APIs.
On Windows Desktop app, forward to those input APIs. Write an adapter on other platforms (Mac, Linux).
I'll see if Uno Platform or Avalonia have taken this approach.

Detect pinch-n-zoom on Macbook touchpad in Electron

The only way that I could find to detect pinch-n-zoom in Javascript is by means of Gesture and Touch events. But those events are only implemented in Safari (not even chrome). The same code that detects gesture events in safari, didn't detect anything in my electron app. Is there any way to detect pinch-n-zoom or other two finger gestures on macbook trackpads in Electron?

How can I synthesize Cocoa multi-touch gesture events?

Dear stackoverflow folks! To this day I never saw the need to ask a question, because all of you have done a great job in asking and answering nearly all of the code-related problems I encountered. So, thank you for that!
At the moment I am working on an iOS application that is able to process raw touch events. These are then sent to an iMac over a WiFi network (the protocol I use is OSC). On the OS X side there is a server application listening for these OSC messages and converting them to mouse pointer movement / mouse button press / multi-touch gestures. So basically I want to build a (of course much more basic) software-bundle like mobile mouse (http://mobilemouse.com/) that I am able to adapt to the needs of our customers (by the means of customizing colors / additional buttons / gestures, and so on) for small remote control projects.
Right now, everything works but the multitouch gestures (pinch, rotate, two-finger-scroll). So my question is: How can I programmatically create and post a multitouch gesture event?
I searched a lot and found some threads about it here on stackoverflow, but none of them could help me:
Is there a way to trigger gesture events on Mac OS X? - Is there a way to change rotation of gesture events? - Generate and post Multitouch-Events in OS X to control the mac using an external camera - ...
Update 1:
The last thing I tried was:
CGEventSourceRef eventSource = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
CGEventRef event = CGEventCreate(eventSource);
CGEventSetType(event, NSEventTypeMagnify);
CGEventPost(kCGHIDEventTap, event);
CFRelease(eventSource);

How can I implement gesture recognizers in OS X?

I have done quite a bit with gesture recognizers for iOS, but I am now doing work in OS X, and I am lost.
I want to duplicate the functionality that exists like in Finder where you can two-finger swipe (on your magic mouse) to go back/forward through a directory tree.
I have an NSWindow based app that looks very similar to Finder. I have used apps before that allows you to build your own gesture recognizers so I know it is possible to do it, but I don't see any documentation on it.
What do I need to do to implement these gestures?
Mac now has:
NSClickGestureRecognizer
NSMagnificationGestureRecognizer
NSPanGestureRecognizer
NSPressGestureRecognizer
NSRotationGestureRecognizer
Available in storyboards too.
You can read about Handling Trackpad Events in the Cocoa Event Handling guide. The system can detect some pre-defined gestures (swipe, rotate, etc.) or you can listen to the raw touch events, which travel up the NSResponder chain, just like regular mouse events.
Looks like there is also an Event Recognizer class in CZKit. https://github.com/CarterA/CZKit
I haven't used this (yet), so YMMV.

Xcode SDK & Trackpad gestures: animations setup

Q The question is, is there a way to disable the animations happening with the trackpad-gestures at the currently public-available Xcode 4.3.2 running MacOS 10.7.3 ?
Description I'm very concerned with the new Lion animations while going forward/back with a trackpad gestures. With a keyboard shortcuts the page changes instantly and with a gesture it takes about a second or two spraying around my concentration on the things that need to be found in the code.
Tried What i tried is to read the defaults in the Terminal looking for any animation/duration keys - without success.
Notes Looks like mr. Cook criticizes the things Apple is doing itself while preparing the combined mobile/stationary look&feel. If there's any startup project that collects all the user's customizing, i'll be glad to know. So far i tried the itweax application, it doesn't have yet the expected features however.
Safari stuff is not as much about the content importance, so i would not mind to leave the Safari animations, but changing it on the system level for all the apps is also good.
PS I believe that is about the “software tools commonly used by programmers” mentioned at “What kind of questions can I ask here?” SO FAQ section.
Don't know about disabling animations but if you want to trigger app keyboard commands through gestures, I found BetterTouchTool helpful with some of the major Lion annoyances. Ex. I was able to configure FireFox to do Home/End on a 3-finger swipe up/down.
No, there is no way to disable the animation.
You can, however, disable the page swiping functionality:
System Preferences > Trackpad > More Gestures > Deselect "Swipe between pages"
Unfortunately, there is no setting to disable or change the speed of the animation.

Resources