src/video/uikit/SDL_uikitwindow.m
changeset 12744 cbd7a9f0a05e
parent 12728 24cff6812c23
child 12852 afe3c46cc37e
equal deleted inserted replaced
12743:c653e9fa9ca9 12744:cbd7a9f0a05e
   158 
   158 
   159     /* Sets this view as the controller's view, and adds the view to the window
   159     /* Sets this view as the controller's view, and adds the view to the window
   160      * heirarchy. */
   160      * heirarchy. */
   161     [view setSDLWindow:window];
   161     [view setSDLWindow:window];
   162 
   162 
   163     /* Make this window the current mouse focus for touch input */
       
   164     if (displaydata.uiscreen == [UIScreen mainScreen]) {
       
   165         SDL_SetMouseFocus(window);
       
   166         SDL_SetKeyboardFocus(window);
       
   167     }
       
   168 
       
   169     return 0;
   163     return 0;
   170 }
   164 }
   171 
   165 
   172 int
   166 int
   173 UIKit_CreateWindow(_THIS, SDL_Window *window)
   167 UIKit_CreateWindow(_THIS, SDL_Window *window)
   253 UIKit_ShowWindow(_THIS, SDL_Window * window)
   247 UIKit_ShowWindow(_THIS, SDL_Window * window)
   254 {
   248 {
   255     @autoreleasepool {
   249     @autoreleasepool {
   256         SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
   250         SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
   257         [data.uiwindow makeKeyAndVisible];
   251         [data.uiwindow makeKeyAndVisible];
       
   252 
       
   253         /* Make this window the current mouse focus for touch input */
       
   254         SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
       
   255         SDL_DisplayData *displaydata = (__bridge SDL_DisplayData *) display->driverdata;
       
   256         if (displaydata.uiscreen == [UIScreen mainScreen]) {
       
   257             SDL_SetMouseFocus(window);
       
   258             SDL_SetKeyboardFocus(window);
       
   259         }
   258     }
   260     }
   259 }
   261 }
   260 
   262 
   261 void
   263 void
   262 UIKit_HideWindow(_THIS, SDL_Window * window)
   264 UIKit_HideWindow(_THIS, SDL_Window * window)