Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorYevgeny Makarov <jenkm>2020-01-28 13:29:38 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-01-28 13:35:18 +0300
commit773beec541474616eda18583567c9934745c71ba (patch)
tree2bb1f0cd585ccb8395517a295d69d3c73ca2f7d4 /intern
parent92d606ba268f5172228a19d5614298e7cf387714 (diff)
macOS: add trackpad smart zoom event support
This is done with two-finger double tap on trackpads, and is usually used to zoom into an element under the cursor. It can now be used for toggling local view in the 3D viewport. Differential Revision: https://developer.blender.org/D6588
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_Types.h3
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm13
-rw-r--r--intern/ghost/intern/GHOST_WindowViewCocoa.h5
3 files changed, 20 insertions, 1 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index c7c9f91a361..98dd1de867f 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -436,7 +436,8 @@ typedef enum {
GHOST_kTrackpadEventScroll,
GHOST_kTrackpadEventRotate,
GHOST_kTrackpadEventSwipe, /* Reserved, not used for now */
- GHOST_kTrackpadEventMagnify
+ GHOST_kTrackpadEventMagnify,
+ GHOST_kTrackpadEventSmartMagnify
} GHOST_TTrackpadEventSubTypes;
typedef struct {
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index e50e478b9fc..b0e11bd4a96 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1726,6 +1726,19 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
0));
} break;
+ case NSEventTypeSmartMagnify: {
+ NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream];
+ GHOST_TInt32 x, y;
+ window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
+ pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000,
+ window,
+ GHOST_kTrackpadEventSmartMagnify,
+ x,
+ y,
+ 0,
+ 0));
+ } break;
+
case NSEventTypeRotate: {
NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream];
GHOST_TInt32 x, y;
diff --git a/intern/ghost/intern/GHOST_WindowViewCocoa.h b/intern/ghost/intern/GHOST_WindowViewCocoa.h
index cee40924b73..14c70382916 100644
--- a/intern/ghost/intern/GHOST_WindowViewCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowViewCocoa.h
@@ -154,6 +154,11 @@
systemCocoa->handleMouseEvent(event);
}
+- (void)smartMagnifyWithEvent:(NSEvent *)event
+{
+ systemCocoa->handleMouseEvent(event);
+}
+
- (void)rotateWithEvent:(NSEvent *)event
{
systemCocoa->handleMouseEvent(event);