src/video/cocoa/SDL_cocoawindow.m
changeset 7507 885b4aab4190
parent 7469 4310d5aee6fe
child 7534 f0f5143b27cf
equal deleted inserted replaced
7506:ccf5fbfa2afa 7507:885b4aab4190
    79     [window setNextResponder:self];
    79     [window setNextResponder:self];
    80     [window setAcceptsMouseMovedEvents:YES];
    80     [window setAcceptsMouseMovedEvents:YES];
    81 
    81 
    82     [view setNextResponder:self];
    82     [view setNextResponder:self];
    83 
    83 
    84 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
       
    85     if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) {
    84     if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) {
    86         [view setAcceptsTouchEvents:YES];
    85         [view setAcceptsTouchEvents:YES];
    87     }
    86     }
    88 #endif
       
    89 }
    87 }
    90 
    88 
    91 - (void)observeValueForKeyPath:(NSString *)keyPath
    89 - (void)observeValueForKeyPath:(NSString *)keyPath
    92                       ofObject:(id)object
    90                       ofObject:(id)object
    93                         change:(NSDictionary *)change
    91                         change:(NSDictionary *)change
   448     [self handleTouches:COCOA_TOUCH_CANCELLED withEvent:theEvent];
   446     [self handleTouches:COCOA_TOUCH_CANCELLED withEvent:theEvent];
   449 }
   447 }
   450 
   448 
   451 - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event
   449 - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event
   452 {
   450 {
   453 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
       
   454     NSSet *touches = 0;
   451     NSSet *touches = 0;
   455     NSEnumerator *enumerator;
   452     NSEnumerator *enumerator;
   456     NSTouch *touch;
   453     NSTouch *touch;
   457 
   454 
   458     switch (type) {
   455     switch (type) {
   497             break;
   494             break;
   498         }
   495         }
   499 
   496 
   500         touch = (NSTouch*)[enumerator nextObject];
   497         touch = (NSTouch*)[enumerator nextObject];
   501     }
   498     }
   502 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 */
       
   503 }
   499 }
   504 
   500 
   505 @end
   501 @end
   506 
   502 
   507 @interface SDLWindow : NSWindow
   503 @interface SDLWindow : NSWindow
   937 }
   933 }
   938 
   934 
   939 void
   935 void
   940 Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
   936 Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
   941 {
   937 {
   942     /* this message arrived in 10.6. You're out of luck on older OSes. */
       
   943 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
       
   944     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   938     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   945     NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   939     NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   946     if ([nswindow respondsToSelector:@selector(setStyleMask:)]) {
   940     if ([nswindow respondsToSelector:@selector(setStyleMask:)]) {
   947         [nswindow setStyleMask:GetWindowStyle(window)];
   941         [nswindow setStyleMask:GetWindowStyle(window)];
   948         if (bordered) {
   942         if (bordered) {
   949             Cocoa_SetWindowTitle(_this, window);  /* this got blanked out. */
   943             Cocoa_SetWindowTitle(_this, window);  /* this got blanked out. */
   950         }
   944         }
   951     }
   945     }
   952     [pool release];
   946     [pool release];
   953 #endif
       
   954 }
   947 }
   955 
   948 
   956 void
   949 void
   957 Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
   950 Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
   958 {
   951 {