Testing commit for OS X trackpad and scroll events.

Now:
- code is wrapped for OS X releases (10.6 and 10.7)
- It now detects scrollwheel (old mouse) and gesture strokes (mighty mouse or trackpad).

If you have 10.6, things will work as for release. 

Next todo for tomorrow: make trackpad work actually smooth and not with steps.
Will also try to figure out the device type, to handle mighty mouse differently.
This commit is contained in:
Ton Roosendaal
2012-12-28 19:10:21 +00:00
parent cfd0b3c5f2
commit 4e24bcf6c9
2 changed files with 18 additions and 1 deletions

View File

@@ -1577,9 +1577,21 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
}
break;
case NSEventTypeBeginGesture:
m_hasMultiTouchTrackpad = true;
break;
case NSEventTypeEndGesture:
m_hasMultiTouchTrackpad = false;
break;
case NSScrollWheel:
{
if (!m_hasMultiTouchTrackpad) {
int momentum = 0;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
momentum = [event momentumPhase];
#endif
if (!m_hasMultiTouchTrackpad && momentum==0) {
GHOST_TInt32 delta;
double deltaF = [event deltaY];

View File

@@ -595,6 +595,11 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
[m_window setAcceptsMouseMovedEvents:YES];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
NSView *view = [m_window contentView];
[view setAcceptsTouchEvents:YES];
#endif
[m_window registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType,
NSStringPboardType, NSTIFFPboardType, nil]];