src/video/uikit/SDL_uikitview.m
branchiOS-improvements
changeset 9510 e19faa3b5d88
parent 9506 18e3f94bd860
child 9519 37ade10d4570
     1.1 --- a/src/video/uikit/SDL_uikitview.m	Wed Aug 06 00:45:11 2014 -0300
     1.2 +++ b/src/video/uikit/SDL_uikitview.m	Wed Aug 06 03:24:16 2014 -0300
     1.3 @@ -51,6 +51,8 @@
     1.4  
     1.5  }
     1.6  
     1.7 +@synthesize viewcontroller;
     1.8 +
     1.9  - (id)initWithFrame:(CGRect)frame
    1.10  {
    1.11      if (self = [super initWithFrame: frame]) {
    1.12 @@ -88,10 +90,10 @@
    1.13              CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
    1.14  
    1.15              /* send moved event */
    1.16 -            SDL_SendMouseMotion(viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
    1.17 +            SDL_SendMouseMotion(self.viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
    1.18  
    1.19              /* send mouse down event */
    1.20 -            SDL_SendMouseButton(viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
    1.21 +            SDL_SendMouseButton(self.viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
    1.22  
    1.23              leftFingerDown = touch;
    1.24          }
    1.25 @@ -123,7 +125,7 @@
    1.26      for (UITouch *touch in touches) {
    1.27          if (touch == leftFingerDown) {
    1.28              /* send mouse up */
    1.29 -            SDL_SendMouseButton(viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
    1.30 +            SDL_SendMouseButton(self.viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
    1.31              leftFingerDown = nil;
    1.32          }
    1.33  
    1.34 @@ -162,7 +164,7 @@
    1.35              CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
    1.36  
    1.37              /* send moved event */
    1.38 -            SDL_SendMouseMotion(viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
    1.39 +            SDL_SendMouseMotion(self.viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
    1.40          }
    1.41  
    1.42          CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
    1.43 @@ -212,7 +214,6 @@
    1.44      keyboardVisible = NO;
    1.45      /* add the UITextField (hidden) to our view */
    1.46      [self addSubview: textField];
    1.47 -    [textField release];
    1.48      
    1.49      _uikit_keyboard_init();
    1.50  }
    1.51 @@ -301,8 +302,8 @@
    1.52          return nil;
    1.53      }
    1.54  
    1.55 -    SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
    1.56 -    SDL_uikitview *view = data != NULL ? data->view : nil;
    1.57 +    SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
    1.58 +    SDL_uikitview *view = data != nil ? data.view : nil;
    1.59  
    1.60      if (view == nil) {
    1.61          SDL_SetError("Window has no view");
    1.62 @@ -352,11 +353,11 @@
    1.63  void _uikit_keyboard_update() {
    1.64      SDL_Window *window = SDL_GetFocusWindow();
    1.65      if (!window) { return; }
    1.66 -    SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
    1.67 +    SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
    1.68      if (!data) { return; }
    1.69 -    SDL_uikitview *view = data->view;
    1.70 +    SDL_uikitview *view = data.view;
    1.71      if (!view) { return; }
    1.72 -    
    1.73 +
    1.74      SDL_Rect r = view.textInputRect;
    1.75      int height = view.keyboardHeight;
    1.76      int offsetx = 0;