src/video/cocoa/SDL_cocoawindow.m
changeset 10022 30807689ca1b
parent 10010 cc07869515b2
child 10025 bf4f8cde1c54
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Tue Jan 05 01:30:40 2016 -0500
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Tue Jan 05 01:42:00 2016 -0500
     1.3 @@ -116,9 +116,12 @@
     1.4  - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
     1.5  { @autoreleasepool
     1.6  {
     1.7 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
     1.8      NSPasteboard *pasteboard = [sender draggingPasteboard];
     1.9      NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType];
    1.10      NSString *desiredType = [pasteboard availableTypeFromArray:types];
    1.11 +    SDL_Window *sdlwindow = nil;
    1.12 +
    1.13      if (desiredType == nil) {
    1.14          return NO;  /* can't accept anything that's being dropped here. */
    1.15      }
    1.16 @@ -157,11 +160,22 @@
    1.17              }
    1.18          }
    1.19  
    1.20 -        if (!SDL_SendDropFile([[fileURL path] UTF8String])) {
    1.21 +        /* !!! FIXME: is there a better way to do this? */
    1.22 +        if (_this) {
    1.23 +            for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) {
    1.24 +                NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow;
    1.25 +                if (nswindow == self) {
    1.26 +                    break;
    1.27 +                }
    1.28 +            }
    1.29 +        }
    1.30 +
    1.31 +        if (!SDL_SendDropFile(sdlwindow, [[fileURL path] UTF8String])) {
    1.32              return NO;
    1.33          }
    1.34      }
    1.35  
    1.36 +    SDL_SendDropComplete(sdlwindow);
    1.37      return YES;
    1.38  }}
    1.39