src/video/uikit/SDL_uikitview.m
author Alex Szpakowski <slime73@gmail.com>
Wed, 06 Aug 2014 03:24:16 -0300
branchiOS-improvements
changeset 9510 e19faa3b5d88
parent 9506 18e3f94bd860
child 9519 37ade10d4570
permissions -rw-r--r--
Updated the iOS backend code to use Objective-C's automatic reference counting (ARC).
slouken@6079
     1
 /*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@8149
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
slouken@5262
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@5262
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@5262
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@5262
    20
*/
icculus@8093
    21
#include "../../SDL_internal.h"
slouken@6044
    22
slouken@6044
    23
#if SDL_VIDEO_DRIVER_UIKIT
slouken@2765
    24
slouken@6518
    25
#include "SDL_uikitview.h"
slouken@2765
    26
slouken@4490
    27
#include "../../events/SDL_keyboard_c.h"
slouken@4490
    28
#include "../../events/SDL_mouse_c.h"
jimtla@4677
    29
#include "../../events/SDL_touch_c.h"
slouken@4490
    30
slouken@2765
    31
#if SDL_IPHONE_KEYBOARD
slouken@6518
    32
#include "keyinfotable.h"
urkle@7111
    33
#endif
slouken@6518
    34
#include "SDL_uikitappdelegate.h"
slouken@6518
    35
#include "SDL_uikitmodes.h"
slouken@6518
    36
#include "SDL_uikitwindow.h"
slouken@2765
    37
slime73@9487
    38
void _uikit_keyboard_init();
slouken@7962
    39
slime73@9501
    40
@implementation SDL_uikitview {
slime73@9501
    41
slime73@9501
    42
    SDL_TouchID touchId;
slime73@9501
    43
    UITouch *leftFingerDown;
slime73@9501
    44
#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
slime73@9501
    45
    UITouch *finger[MAX_SIMULTANEOUS_TOUCHES];
slime73@9501
    46
#endif
slime73@9501
    47
slime73@9501
    48
#if SDL_IPHONE_KEYBOARD
slime73@9501
    49
    UITextField *textField;
slime73@9501
    50
#endif
slime73@9501
    51
slime73@9501
    52
}
slouken@2765
    53
slime73@9510
    54
@synthesize viewcontroller;
slime73@9510
    55
kees@6003
    56
- (id)initWithFrame:(CGRect)frame
kees@6003
    57
{
slime73@9505
    58
    if (self = [super initWithFrame: frame]) {
slouken@2765
    59
#if SDL_IPHONE_KEYBOARD
slime73@9505
    60
        [self initializeKeyboard];
kees@6001
    61
#endif
slouken@2765
    62
slime73@9505
    63
        self.multipleTouchEnabled = YES;
slouken@5445
    64
slime73@9505
    65
        touchId = 1;
slime73@9505
    66
        SDL_AddTouch(touchId, "");
slime73@9505
    67
    }
slouken@4661
    68
slouken@5131
    69
    return self;
slouken@2765
    70
slouken@2765
    71
}
slouken@2765
    72
slouken@6436
    73
- (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize
slouken@6079
    74
{
slouken@6079
    75
    CGPoint point = [touch locationInView: self];
slouken@6436
    76
slouken@6436
    77
    if (normalize) {
slime73@9501
    78
        CGRect bounds = self.bounds;
slouken@6439
    79
        point.x /= bounds.size.width;
slouken@6439
    80
        point.y /= bounds.size.height;
slouken@6436
    81
    }
slime73@9488
    82
slouken@6079
    83
    return point;
slouken@6079
    84
}
slouken@6079
    85
kees@6003
    86
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
kees@6003
    87
{
slime73@9487
    88
    for (UITouch *touch in touches) {
slouken@6597
    89
        if (!leftFingerDown) {
slouken@6597
    90
            CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
kees@6001
    91
slouken@6597
    92
            /* send moved event */
slime73@9510
    93
            SDL_SendMouseMotion(self.viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
slouken@4488
    94
slouken@6597
    95
            /* send mouse down event */
slime73@9510
    96
            SDL_SendMouseButton(self.viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
jim@4660
    97
icculus@7050
    98
            leftFingerDown = touch;
slouken@6597
    99
        }
slouken@6597
   100
slouken@6436
   101
        CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
jim@4662
   102
#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
slouken@7191
   103
        /* FIXME: TODO: Using touch as the fingerId is potentially dangerous
slouken@7191
   104
         * It is also much more efficient than storing the UITouch pointer
slouken@7191
   105
         * and comparing it to the incoming event.
slouken@7191
   106
         */
icculus@7050
   107
        SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
slouken@6951
   108
                      SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
jim@4662
   109
#else
kees@6003
   110
        int i;
kees@6003
   111
        for(i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
kees@6003
   112
            if (finger[i] == NULL) {
kees@6003
   113
                finger[i] = touch;
slouken@6951
   114
                SDL_SendTouch(touchId, i,
slouken@6951
   115
                              SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
kees@6003
   116
                break;
kees@6003
   117
            }
slouken@5131
   118
        }
jim@4662
   119
#endif
slouken@5131
   120
    }
slouken@2765
   121
}
slouken@2765
   122
kees@6003
   123
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
kees@6003
   124
{
slime73@9487
   125
    for (UITouch *touch in touches) {
icculus@7050
   126
        if (touch == leftFingerDown) {
slouken@6597
   127
            /* send mouse up */
slime73@9510
   128
            SDL_SendMouseButton(self.viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
icculus@7050
   129
            leftFingerDown = nil;
slouken@6597
   130
        }
slouken@4661
   131
slouken@6436
   132
        CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
jim@4662
   133
#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
slime73@9501
   134
        SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
slouken@6951
   135
                      SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
jim@4662
   136
#else
kees@6003
   137
        int i;
kees@6003
   138
        for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
kees@6003
   139
            if (finger[i] == touch) {
slouken@6951
   140
                SDL_SendTouch(touchId, i,
slouken@6951
   141
                              SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
kees@6003
   142
                finger[i] = NULL;
kees@6003
   143
                break;
kees@6003
   144
            }
slouken@5131
   145
        }
jim@4662
   146
#endif
slouken@5131
   147
    }
slouken@2765
   148
}
slouken@2765
   149
kees@6003
   150
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
kees@6003
   151
{
slouken@5131
   152
    /*
slouken@5131
   153
        this can happen if the user puts more than 5 touches on the screen
slouken@5131
   154
        at once, or perhaps in other circumstances.  Usually (it seems)
slouken@5131
   155
        all active touches are canceled.
slouken@5131
   156
    */
slouken@5131
   157
    [self touchesEnded: touches withEvent: event];
slouken@2765
   158
}
slouken@2765
   159
kees@6003
   160
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
kees@6003
   161
{
slime73@9487
   162
    for (UITouch *touch in touches) {
icculus@7050
   163
        if (touch == leftFingerDown) {
slouken@6597
   164
            CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
slouken@4488
   165
slouken@6597
   166
            /* send moved event */
slime73@9510
   167
            SDL_SendMouseMotion(self.viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
slouken@6597
   168
        }
jim@4660
   169
slouken@6436
   170
        CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
jim@4662
   171
#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
slime73@9501
   172
        SDL_SendTouchMotion(touchId, (SDL_FingerID)((size_t)touch),
slouken@6951
   173
                            locationInView.x, locationInView.y, 1.0f);
jim@4662
   174
#else
kees@6003
   175
        int i;
kees@6003
   176
        for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
kees@6003
   177
            if (finger[i] == touch) {
kees@6003
   178
                SDL_SendTouchMotion(touchId, i,
slouken@6951
   179
                                    locationInView.x, locationInView.y, 1.0f);
kees@6003
   180
                break;
kees@6003
   181
            }
slouken@5131
   182
        }
jim@4662
   183
#endif
slouken@5131
   184
    }
slouken@2765
   185
}
slouken@2765
   186
slouken@2765
   187
/*
slouken@5131
   188
    ---- Keyboard related functionality below this line ----
slouken@2765
   189
*/
slouken@2765
   190
#if SDL_IPHONE_KEYBOARD
slouken@2765
   191
slime73@9501
   192
@synthesize textInputRect;
slime73@9501
   193
@synthesize keyboardHeight;
slime73@9501
   194
@synthesize keyboardVisible;
slouken@2765
   195
slouken@2765
   196
/* Set ourselves up as a UITextFieldDelegate */
kees@6003
   197
- (void)initializeKeyboard
kees@6003
   198
{
slouken@5131
   199
    textField = [[UITextField alloc] initWithFrame: CGRectZero];
slouken@5131
   200
    textField.delegate = self;
slouken@5131
   201
    /* placeholder so there is something to delete! */
kees@6001
   202
    textField.text = @" ";
kees@6001
   203
slouken@5131
   204
    /* set UITextInputTrait properties, mostly to defaults */
slouken@5131
   205
    textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
slouken@5131
   206
    textField.autocorrectionType = UITextAutocorrectionTypeNo;
slouken@5131
   207
    textField.enablesReturnKeyAutomatically = NO;
slouken@5131
   208
    textField.keyboardAppearance = UIKeyboardAppearanceDefault;
slouken@5131
   209
    textField.keyboardType = UIKeyboardTypeDefault;
slouken@5131
   210
    textField.returnKeyType = UIReturnKeyDefault;
kees@6001
   211
    textField.secureTextEntry = NO;
kees@6001
   212
slouken@5131
   213
    textField.hidden = YES;
slouken@5131
   214
    keyboardVisible = NO;
slouken@5131
   215
    /* add the UITextField (hidden) to our view */
slouken@5131
   216
    [self addSubview: textField];
slouken@7962
   217
    
slouken@7962
   218
    _uikit_keyboard_init();
slouken@2765
   219
}
slouken@2765
   220
slouken@2765
   221
/* reveal onscreen virtual keyboard */
kees@6003
   222
- (void)showKeyboard
kees@6003
   223
{
slouken@5131
   224
    keyboardVisible = YES;
slouken@5131
   225
    [textField becomeFirstResponder];
slouken@2765
   226
}
slouken@2765
   227
slouken@2765
   228
/* hide onscreen virtual keyboard */
kees@6003
   229
- (void)hideKeyboard
kees@6003
   230
{
slouken@5131
   231
    keyboardVisible = NO;
slouken@5131
   232
    [textField resignFirstResponder];
slouken@2765
   233
}
slouken@2765
   234
slouken@2765
   235
/* UITextFieldDelegate method.  Invoked when user types something. */
kees@6003
   236
- (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
kees@6003
   237
{
slouken@5131
   238
    if ([string length] == 0) {
slouken@5131
   239
        /* it wants to replace text with nothing, ie a delete */
icculus@7774
   240
        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_BACKSPACE);
icculus@7774
   241
        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_BACKSPACE);
slouken@5131
   242
    }
slouken@5131
   243
    else {
slouken@5131
   244
        /* go through all the characters in the string we've been sent
slouken@5131
   245
           and convert them to key presses */
slouken@5131
   246
        int i;
kees@6003
   247
        for (i = 0; i < [string length]; i++) {
kees@6001
   248
slouken@5131
   249
            unichar c = [string characterAtIndex: i];
kees@6001
   250
slouken@5131
   251
            Uint16 mod = 0;
slouken@5218
   252
            SDL_Scancode code;
kees@6001
   253
slouken@5131
   254
            if (c < 127) {
slouken@5218
   255
                /* figure out the SDL_Scancode and SDL_keymod for this unichar */
slouken@5131
   256
                code = unicharToUIKeyInfoTable[c].code;
slouken@5131
   257
                mod  = unicharToUIKeyInfoTable[c].mod;
slouken@5131
   258
            }
slouken@5131
   259
            else {
slouken@5131
   260
                /* we only deal with ASCII right now */
slouken@5131
   261
                code = SDL_SCANCODE_UNKNOWN;
slouken@5131
   262
                mod = 0;
slouken@5131
   263
            }
kees@6001
   264
slouken@5131
   265
            if (mod & KMOD_SHIFT) {
slouken@5131
   266
                /* If character uses shift, press shift down */
slouken@5131
   267
                SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
slouken@5131
   268
            }
slouken@5131
   269
            /* send a keydown and keyup even for the character */
slouken@5131
   270
            SDL_SendKeyboardKey(SDL_PRESSED, code);
slouken@5131
   271
            SDL_SendKeyboardKey(SDL_RELEASED, code);
slouken@5131
   272
            if (mod & KMOD_SHIFT) {
slouken@5131
   273
                /* If character uses shift, press shift back up */
slouken@5131
   274
                SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
kees@6001
   275
            }
slouken@5131
   276
        }
slouken@5461
   277
        SDL_SendKeyboardText([string UTF8String]);
slouken@5131
   278
    }
slouken@5131
   279
    return NO; /* don't allow the edit! (keep placeholder text there) */
slouken@2765
   280
}
slouken@2765
   281
slouken@2765
   282
/* Terminates the editing session */
kees@6003
   283
- (BOOL)textFieldShouldReturn:(UITextField*)_textField
kees@6003
   284
{
slouken@5134
   285
    SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN);
slouken@6054
   286
    SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN);
slouken@6654
   287
    SDL_StopTextInput();
slouken@5131
   288
    return YES;
slouken@2765
   289
}
slouken@2765
   290
slouken@2765
   291
#endif
slouken@2765
   292
slouken@2765
   293
@end
slouken@2765
   294
slouken@2765
   295
/* iPhone keyboard addition functions */
slouken@2765
   296
#if SDL_IPHONE_KEYBOARD
slouken@2765
   297
slouken@6044
   298
static SDL_uikitview * getWindowView(SDL_Window * window)
kees@6010
   299
{
kees@6010
   300
    if (window == NULL) {
kees@6010
   301
        SDL_SetError("Window does not exist");
kees@6010
   302
        return nil;
kees@6010
   303
    }
kees@6010
   304
slime73@9510
   305
    SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
slime73@9510
   306
    SDL_uikitview *view = data != nil ? data.view : nil;
kees@6010
   307
kees@6010
   308
    if (view == nil) {
kees@6010
   309
        SDL_SetError("Window has no view");
kees@6010
   310
    }
kees@6010
   311
kees@6010
   312
    return view;
kees@6010
   313
}
kees@6010
   314
slouken@6654
   315
SDL_bool UIKit_HasScreenKeyboardSupport(_THIS)
slouken@6392
   316
{
slouken@6392
   317
    return SDL_TRUE;
slouken@6392
   318
}
slouken@6392
   319
slouken@6654
   320
void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window)
kees@6003
   321
{
slime73@9506
   322
    @autoreleasepool {
slime73@9506
   323
        SDL_uikitview *view = getWindowView(window);
slime73@9506
   324
        if (view != nil) {
slime73@9506
   325
            [view showKeyboard];
slime73@9506
   326
        }
slouken@5131
   327
    }
slouken@2765
   328
}
slouken@2765
   329
slouken@6654
   330
void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window)
kees@6003
   331
{
slime73@9506
   332
    @autoreleasepool {
slime73@9506
   333
        SDL_uikitview *view = getWindowView(window);
slime73@9506
   334
        if (view != nil) {
slime73@9506
   335
            [view hideKeyboard];
slime73@9506
   336
        }
kees@6001
   337
    }
slouken@2765
   338
}
slouken@2765
   339
slouken@6392
   340
SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window)
kees@6003
   341
{
slime73@9506
   342
    @autoreleasepool {
slime73@9506
   343
        SDL_uikitview *view = getWindowView(window);
slime73@9506
   344
        if (view == nil) {
slime73@9506
   345
            return 0;
slime73@9506
   346
        }
slime73@9506
   347
slime73@9506
   348
        return view.isKeyboardVisible;
kees@6001
   349
    }
slouken@2765
   350
}
slouken@2765
   351
slouken@7962
   352
slouken@7962
   353
void _uikit_keyboard_update() {
slouken@7962
   354
    SDL_Window *window = SDL_GetFocusWindow();
slouken@7962
   355
    if (!window) { return; }
slime73@9510
   356
    SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
slouken@7962
   357
    if (!data) { return; }
slime73@9510
   358
    SDL_uikitview *view = data.view;
slouken@7962
   359
    if (!view) { return; }
slime73@9510
   360
slouken@7962
   361
    SDL_Rect r = view.textInputRect;
slouken@7962
   362
    int height = view.keyboardHeight;
slouken@7962
   363
    int offsetx = 0;
slouken@7962
   364
    int offsety = 0;
slouken@7962
   365
    if (height) {
slouken@7962
   366
        int sw,sh;
slouken@7962
   367
        SDL_GetWindowSize(window,&sw,&sh);
slouken@7962
   368
        int bottom = (r.y + r.h);
slouken@7962
   369
        int kbottom = sh - height;
slouken@7962
   370
        if (kbottom < bottom) {
slouken@7962
   371
            offsety = kbottom-bottom;
slouken@7962
   372
        }
slouken@7962
   373
    }
slouken@7962
   374
    UIInterfaceOrientation ui_orient = [[UIApplication sharedApplication] statusBarOrientation];
slouken@7962
   375
    if (ui_orient == UIInterfaceOrientationLandscapeLeft) {
slouken@7962
   376
        int tmp = offsetx; offsetx = offsety; offsety = tmp;
slouken@7962
   377
    }
slouken@7962
   378
    if (ui_orient == UIInterfaceOrientationLandscapeRight) {
slouken@7962
   379
        offsety = -offsety;
slouken@7962
   380
        int tmp = offsetx; offsetx = offsety; offsety = tmp;
slouken@7962
   381
    }
slouken@7962
   382
    if (ui_orient == UIInterfaceOrientationPortraitUpsideDown) {
slouken@7962
   383
        offsety = -offsety;
slouken@7962
   384
    }
slouken@8891
   385
slouken@7962
   386
    view.frame = CGRectMake(offsetx,offsety,view.frame.size.width,view.frame.size.height);
slouken@7962
   387
}
slouken@7962
   388
slouken@7962
   389
void _uikit_keyboard_set_height(int height) {
slouken@7962
   390
    SDL_uikitview *view = getWindowView(SDL_GetFocusWindow());
slouken@7962
   391
    if (view == nil) {
slime73@9503
   392
        return;
slouken@7962
   393
    }
slime73@9503
   394
slime73@9503
   395
    view.keyboardVisible = height > 0;
slouken@7962
   396
    view.keyboardHeight = height;
slouken@7962
   397
    _uikit_keyboard_update();
slouken@7962
   398
}
slouken@7962
   399
slouken@7962
   400
void _uikit_keyboard_init() {
slouken@7962
   401
    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
slouken@7962
   402
    NSOperationQueue *queue = [NSOperationQueue mainQueue];
slouken@7962
   403
    [center addObserverForName:UIKeyboardWillShowNotification
slouken@7962
   404
                        object:nil
slouken@7962
   405
                         queue:queue
slouken@7962
   406
                    usingBlock:^(NSNotification *notification) {
slouken@7962
   407
                        int height = 0;
slime73@9499
   408
                        CGSize keyboardSize = [[notification userInfo][UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
slouken@7962
   409
                        height = keyboardSize.height;
slouken@7962
   410
                        UIInterfaceOrientation ui_orient = [[UIApplication sharedApplication] statusBarOrientation];
slouken@7962
   411
                        if (ui_orient == UIInterfaceOrientationLandscapeRight || ui_orient == UIInterfaceOrientationLandscapeLeft) {
slouken@7962
   412
                            height = keyboardSize.width;
slouken@7962
   413
                        }
slouken@7962
   414
                        _uikit_keyboard_set_height(height);
slouken@7962
   415
                    }
slouken@7962
   416
     ];
slouken@7962
   417
    [center addObserverForName:UIKeyboardDidHideNotification
slouken@7962
   418
                        object:nil
slouken@7962
   419
                         queue:queue
slouken@7962
   420
                    usingBlock:^(NSNotification *notification) {
slouken@7962
   421
                        _uikit_keyboard_set_height(0);
slouken@7962
   422
                    }
slouken@7962
   423
     ];
slouken@7962
   424
}
slouken@7962
   425
slouken@7962
   426
void
slouken@7962
   427
UIKit_SetTextInputRect(_THIS, SDL_Rect *rect)
slouken@7962
   428
{
slouken@7962
   429
    if (!rect) {
slouken@7962
   430
        SDL_InvalidParamError("rect");
slouken@7962
   431
        return;
slouken@7962
   432
    }
slime73@9506
   433
slime73@9506
   434
    @autoreleasepool {
slime73@9506
   435
        SDL_uikitview *view = getWindowView(SDL_GetFocusWindow());
slime73@9506
   436
        if (view == nil) {
slime73@9506
   437
            return;
slime73@9506
   438
        }
slime73@9506
   439
slime73@9506
   440
        view.textInputRect = *rect;
slouken@7962
   441
    }
slouken@7962
   442
}
slouken@7962
   443
slouken@7962
   444
slouken@5132
   445
#endif /* SDL_IPHONE_KEYBOARD */
slouken@2765
   446
slouken@6044
   447
#endif /* SDL_VIDEO_DRIVER_UIKIT */
slouken@6044
   448
slouken@5132
   449
/* vi: set ts=4 sw=4 expandtab: */