src/video/cocoa/SDL_cocoawindow.m
changeset 5367 71fe70373e58
parent 5361 1d9e27849ed9
child 5371 fc3d3d580777
equal deleted inserted replaced
5366:d032ec40e7c1 5367:71fe70373e58
   133     SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
   133     SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
   134 }
   134 }
   135 
   135 
   136 - (void)windowDidBecomeKey:(NSNotification *)aNotification
   136 - (void)windowDidBecomeKey:(NSNotification *)aNotification
   137 {
   137 {
       
   138     SDL_Window *window = _data->window;
       
   139 
   138     /* We're going to get keyboard events, since we're key. */
   140     /* We're going to get keyboard events, since we're key. */
   139     SDL_SetKeyboardFocus(_data->window);
   141     SDL_SetKeyboardFocus(window);
       
   142 
       
   143     /* If we just gained focus we need the updated mouse position */
       
   144     if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
       
   145         NSPoint point;
       
   146         point = [NSEvent mouseLocation];
       
   147         point = [_data->nswindow convertScreenToBase:point];
       
   148         point = [[_data->nswindow contentView] convertPoint:point fromView:nil];
       
   149         point.y = window->h - point.y;
       
   150         SDL_SendMouseMotion(window, 0, (int)point.x, (int)point.y);
       
   151     }
   140 
   152 
   141     /* Check to see if someone updated the clipboard */
   153     /* Check to see if someone updated the clipboard */
   142     Cocoa_CheckClipboardUpdate(_data->videodata);
   154     Cocoa_CheckClipboardUpdate(_data->videodata);
   143 }
   155 }
   144 
   156