mirror of
https://github.com/yawut/SDL.git
synced 2026-08-28 11:45:13 -05:00
Fixed touch events on Mac OS X 10.6
This commit is contained in:
@@ -57,11 +57,13 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||
} else {
|
||||
[_data->nswindow setDelegate:self];
|
||||
}
|
||||
// FIXME: Why doesn't this work?
|
||||
// [center addObserver:self selector:@selector(rightMouseDown:) name:[NSString stringWithCString:"rightMouseDown" encoding:NSUTF8StringEncoding] object:[_data->nswindow contentView]];
|
||||
[center addObserver:self selector:@selector(windowDidHide:) name:NSApplicationDidHideNotification object:NSApp];
|
||||
[center addObserver:self selector:@selector(windowDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp];
|
||||
|
||||
[_data->nswindow setAcceptsMouseMovedEvents:YES];
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
[[_data->nswindow contentView] setAcceptsTouchEvents:YES];
|
||||
#endif
|
||||
}
|
||||
@@ -295,7 +297,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||
|
||||
- (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
NSSet *touches = 0;
|
||||
NSEnumerator *enumerator;
|
||||
NSTouch *touch;
|
||||
@@ -357,7 +359,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||
|
||||
touch = (NSTouch*)[enumerator nextObject];
|
||||
}
|
||||
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 */
|
||||
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 */
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -437,6 +439,9 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created
|
||||
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
||||
NSView *contentView = [[SDLView alloc] initWithFrame: rect
|
||||
listener: data->listener];
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
[contentView setAcceptsTouchEvents:YES];
|
||||
#endif
|
||||
[nswindow setContentView: contentView];
|
||||
[contentView release];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user