src/video/cocoa/SDL_cocoawindow.m
changeset 5376 183ec2d4485c
parent 5375 16877f74123c
child 5378 738a96883fa6
equal deleted inserted replaced
5375:16877f74123c 5376:183ec2d4485c
   249     [self mouseUp:theEvent];
   249     [self mouseUp:theEvent];
   250 }
   250 }
   251 
   251 
   252 - (void)mouseEntered:(NSEvent *)theEvent
   252 - (void)mouseEntered:(NSEvent *)theEvent
   253 {
   253 {
       
   254     SDL_Mouse *mouse = SDL_GetMouse();
       
   255 
   254     SDL_SetMouseFocus(_data->window);
   256     SDL_SetMouseFocus(_data->window);
       
   257 
       
   258     if (!mouse->cursor_shown) {
       
   259         [NSCursor hide];
       
   260     }
   255 }
   261 }
   256 
   262 
   257 - (void)mouseExited:(NSEvent *)theEvent
   263 - (void)mouseExited:(NSEvent *)theEvent
   258 {
   264 {
   259     SDL_Window *window = _data->window;
   265     SDL_Window *window = _data->window;
       
   266     SDL_Mouse *mouse = SDL_GetMouse();
   260 
   267 
   261     if (SDL_GetMouseFocus() == window) {
   268     if (SDL_GetMouseFocus() == window) {
   262         if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
   269         if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
   263             int x, y;
   270             int x, y;
   264             NSPoint point;
   271             NSPoint point;
   273             cgpoint.y = window->y + y;
   280             cgpoint.y = window->y + y;
   274             CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
   281             CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
   275         } else {
   282         } else {
   276             SDL_SetMouseFocus(NULL);
   283             SDL_SetMouseFocus(NULL);
   277         }
   284         }
       
   285     }
       
   286 
       
   287     if (!mouse->cursor_shown) {
       
   288         [NSCursor unhide];
   278     }
   289     }
   279 }
   290 }
   280 
   291 
   281 - (void)mouseMoved:(NSEvent *)theEvent
   292 - (void)mouseMoved:(NSEvent *)theEvent
   282 {
   293 {