src/video/cocoa/SDL_cocoawindow.m
changeset 7271 963d2ba35cfe
parent 7270 76df5476a6ce
child 7282 df78adc8ba04
equal deleted inserted replaced
7270:76df5476a6ce 7271:963d2ba35cfe
   238 }
   238 }
   239 
   239 
   240 - (void)windowDidBecomeKey:(NSNotification *)aNotification
   240 - (void)windowDidBecomeKey:(NSNotification *)aNotification
   241 {
   241 {
   242     SDL_Window *window = _data->window;
   242     SDL_Window *window = _data->window;
       
   243     SDL_Mouse *mouse = SDL_GetMouse();
   243 
   244 
   244     /* We're going to get keyboard events, since we're key. */
   245     /* We're going to get keyboard events, since we're key. */
   245     SDL_SetKeyboardFocus(window);
   246     SDL_SetKeyboardFocus(window);
   246 
   247 
   247     /* If we just gained focus we need the updated mouse position */
   248     /* If we just gained focus we need the updated mouse position */
   248     {
   249     if (!mouse->relative_mode) {
   249         NSPoint point;
   250         NSPoint point;
   250         int x, y;
   251         int x, y;
   251 
   252 
   252         point = [_data->nswindow mouseLocationOutsideOfEventStream];
   253         point = [_data->nswindow mouseLocationOutsideOfEventStream];
   253         x = (int)point.x;
   254         x = (int)point.x;