Fixed touch events on Mac OS X 10.6
authorSam Lantinga <slouken@libsdl.org>
Thu, 02 Dec 2010 11:56:23 -0800
changeset 4927d716dff4b13e
parent 4926 ab02a7242f08
child 4929 aa8888658021
Fixed touch events on Mac OS X 10.6
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Wed Dec 01 12:52:48 2010 -0800
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Thu Dec 02 11:56:23 2010 -0800
     1.3 @@ -57,11 +57,13 @@
     1.4      } else {
     1.5          [_data->nswindow setDelegate:self];
     1.6      }
     1.7 +// FIXME: Why doesn't this work?
     1.8 +//    [center addObserver:self selector:@selector(rightMouseDown:) name:[NSString stringWithCString:"rightMouseDown" encoding:NSUTF8StringEncoding] object:[_data->nswindow contentView]];
     1.9      [center addObserver:self selector:@selector(windowDidHide:) name:NSApplicationDidHideNotification object:NSApp];
    1.10      [center addObserver:self selector:@selector(windowDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp];
    1.11  
    1.12      [_data->nswindow setAcceptsMouseMovedEvents:YES];
    1.13 -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
    1.14 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
    1.15      [[_data->nswindow contentView] setAcceptsTouchEvents:YES];
    1.16  #endif
    1.17  }
    1.18 @@ -295,7 +297,7 @@
    1.19  
    1.20  - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event
    1.21  {
    1.22 -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
    1.23 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
    1.24      NSSet *touches = 0;
    1.25      NSEnumerator *enumerator;
    1.26      NSTouch *touch;
    1.27 @@ -357,7 +359,7 @@
    1.28          
    1.29          touch = (NSTouch*)[enumerator nextObject];
    1.30      }
    1.31 -#endif /* MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 */
    1.32 +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 */
    1.33  }
    1.34  
    1.35  @end
    1.36 @@ -437,6 +439,9 @@
    1.37          NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
    1.38          NSView *contentView = [[SDLView alloc] initWithFrame: rect
    1.39                                                      listener: data->listener];
    1.40 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
    1.41 +        [contentView setAcceptsTouchEvents:YES];
    1.42 +#endif
    1.43          [nswindow setContentView: contentView];
    1.44          [contentView release];
    1.45