src/video/uikit/SDL_uikitview.m
author Alex Szpakowski <slime73@gmail.com>
Mon, 14 Jul 2014 16:50:25 -0300
branchiOS-improvements
changeset 9487 f9fbc2d1edb0
parent 8983 21f5923cfd15
child 9488 f15520430c94
permissions -rw-r--r--
Misc. iOS code improvements.

- Use @autoreleasepool instead of NSAutoReleasePool.

- Code style fixups.
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
slouken@2765
    40
@implementation SDL_uikitview
slouken@2765
    41
kees@6003
    42
- (void)dealloc
kees@6003
    43
{
slouken@5131
    44
    [super dealloc];
slouken@2765
    45
}
slouken@2765
    46
kees@6003
    47
- (id)initWithFrame:(CGRect)frame
kees@6003
    48
{
slouken@5131
    49
    self = [super initWithFrame: frame];
kees@6001
    50
slouken@2765
    51
#if SDL_IPHONE_KEYBOARD
slouken@5131
    52
    [self initializeKeyboard];
kees@6001
    53
#endif
slouken@2765
    54
slouken@5445
    55
    self.multipleTouchEnabled = YES;
slouken@5445
    56
slouken@6951
    57
    touchId = 1;
slouken@6951
    58
    SDL_AddTouch(touchId, "");
slouken@4661
    59
slouken@5131
    60
    return self;
slouken@2765
    61
slouken@2765
    62
}
slouken@2765
    63
slouken@6436
    64
- (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize
slouken@6079
    65
{
slouken@6079
    66
    CGPoint point = [touch locationInView: self];
slouken@6436
    67
slouken@7191
    68
    /* Get the display scale and apply that to the input coordinates */
slime73@9487
    69
    SDL_Window *window = viewcontroller.window;
slouken@6436
    70
    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
slouken@6436
    71
    SDL_DisplayModeData *displaymodedata = (SDL_DisplayModeData *) display->current_mode.driverdata;
slouken@7191
    72
slouken@6436
    73
    if (normalize) {
slouken@6439
    74
        CGRect bounds = [self bounds];
slouken@6439
    75
        point.x /= bounds.size.width;
slouken@6439
    76
        point.y /= bounds.size.height;
slouken@6519
    77
    } else {
slouken@6519
    78
        point.x *= displaymodedata->scale;
slouken@6519
    79
        point.y *= displaymodedata->scale;
slouken@6436
    80
    }
slouken@6079
    81
    return point;
slouken@6079
    82
}
slouken@6079
    83
kees@6003
    84
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
kees@6003
    85
{
slime73@9487
    86
    for (UITouch *touch in touches) {
slouken@6597
    87
        if (!leftFingerDown) {
slouken@6597
    88
            CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
kees@6001
    89
slouken@6597
    90
            /* send moved event */
slime73@9487
    91
            SDL_SendMouseMotion(viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
slouken@4488
    92
slouken@6597
    93
            /* send mouse down event */
slime73@9487
    94
            SDL_SendMouseButton(viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
jim@4660
    95
icculus@7050
    96
            leftFingerDown = touch;
slouken@6597
    97
        }
slouken@6597
    98
slouken@6436
    99
        CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
jim@4662
   100
#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
slouken@7191
   101
        /* FIXME: TODO: Using touch as the fingerId is potentially dangerous
slouken@7191
   102
         * It is also much more efficient than storing the UITouch pointer
slouken@7191
   103
         * and comparing it to the incoming event.
slouken@7191
   104
         */
icculus@7050
   105
        SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
slouken@6951
   106
                      SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
jim@4662
   107
#else
kees@6003
   108
        int i;
kees@6003
   109
        for(i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
kees@6003
   110
            if (finger[i] == NULL) {
kees@6003
   111
                finger[i] = touch;
slouken@6951
   112
                SDL_SendTouch(touchId, i,
slouken@6951
   113
                              SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
kees@6003
   114
                break;
kees@6003
   115
            }
slouken@5131
   116
        }
jim@4662
   117
#endif
slouken@5131
   118
    }
slouken@2765
   119
}
slouken@2765
   120
kees@6003
   121
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
kees@6003
   122
{
slime73@9487
   123
    for (UITouch *touch in touches) {
icculus@7050
   124
        if (touch == leftFingerDown) {
slouken@6597
   125
            /* send mouse up */
slime73@9487
   126
            SDL_SendMouseButton(viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
icculus@7050
   127
            leftFingerDown = nil;
slouken@6597
   128
        }
slouken@4661
   129
slouken@6436
   130
        CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
jim@4662
   131
#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
slouken@6951
   132
        SDL_SendTouch(touchId, (long)touch,
slouken@6951
   133
                      SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
jim@4662
   134
#else
kees@6003
   135
        int i;
kees@6003
   136
        for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
kees@6003
   137
            if (finger[i] == touch) {
slouken@6951
   138
                SDL_SendTouch(touchId, i,
slouken@6951
   139
                              SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
kees@6003
   140
                finger[i] = NULL;
kees@6003
   141
                break;
kees@6003
   142
            }
slouken@5131
   143
        }
jim@4662
   144
#endif
slouken@5131
   145
    }
slouken@2765
   146
}
slouken@2765
   147
kees@6003
   148
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
kees@6003
   149
{
slouken@5131
   150
    /*
slouken@5131
   151
        this can happen if the user puts more than 5 touches on the screen
slouken@5131
   152
        at once, or perhaps in other circumstances.  Usually (it seems)
slouken@5131
   153
        all active touches are canceled.
slouken@5131
   154
    */
slouken@5131
   155
    [self touchesEnded: touches withEvent: event];
slouken@2765
   156
}
slouken@2765
   157
kees@6003
   158
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
kees@6003
   159
{
slime73@9487
   160
    for (UITouch *touch in touches) {
icculus@7050
   161
        if (touch == leftFingerDown) {
slouken@6597
   162
            CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
slouken@4488
   163
slouken@6597
   164
            /* send moved event */
slime73@9487
   165
            SDL_SendMouseMotion(viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
slouken@6597
   166
        }
jim@4660
   167
slouken@6436
   168
        CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
jim@4662
   169
#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
kees@6003
   170
        SDL_SendTouchMotion(touchId, (long)touch,
slouken@6951
   171
                            locationInView.x, locationInView.y, 1.0f);
jim@4662
   172
#else
kees@6003
   173
        int i;
kees@6003
   174
        for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
kees@6003
   175
            if (finger[i] == touch) {
kees@6003
   176
                SDL_SendTouchMotion(touchId, i,
slouken@6951
   177
                                    locationInView.x, locationInView.y, 1.0f);
kees@6003
   178
                break;
kees@6003
   179
            }
slouken@5131
   180
        }
jim@4662
   181
#endif
slouken@5131
   182
    }
slouken@2765
   183
}
slouken@2765
   184
slouken@2765
   185
/*
slouken@5131
   186
    ---- Keyboard related functionality below this line ----
slouken@2765
   187
*/
slouken@2765
   188
#if SDL_IPHONE_KEYBOARD
slouken@2765
   189
slouken@7962
   190
@synthesize textInputRect = textInputRect;
slouken@7962
   191
@synthesize keyboardHeight = keyboardHeight;
slouken@7962
   192
slouken@2765
   193
/* Is the iPhone virtual keyboard visible onscreen? */
kees@6003
   194
- (BOOL)keyboardVisible
kees@6003
   195
{
slouken@5131
   196
    return keyboardVisible;
slouken@2765
   197
}
slouken@2765
   198
slouken@2765
   199
/* Set ourselves up as a UITextFieldDelegate */
kees@6003
   200
- (void)initializeKeyboard
kees@6003
   201
{
slouken@5131
   202
    textField = [[UITextField alloc] initWithFrame: CGRectZero];
slouken@5131
   203
    textField.delegate = self;
slouken@5131
   204
    /* placeholder so there is something to delete! */
kees@6001
   205
    textField.text = @" ";
kees@6001
   206
slouken@5131
   207
    /* set UITextInputTrait properties, mostly to defaults */
slouken@5131
   208
    textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
slouken@5131
   209
    textField.autocorrectionType = UITextAutocorrectionTypeNo;
slouken@5131
   210
    textField.enablesReturnKeyAutomatically = NO;
slouken@5131
   211
    textField.keyboardAppearance = UIKeyboardAppearanceDefault;
slouken@5131
   212
    textField.keyboardType = UIKeyboardTypeDefault;
slouken@5131
   213
    textField.returnKeyType = UIReturnKeyDefault;
kees@6001
   214
    textField.secureTextEntry = NO;
kees@6001
   215
slouken@5131
   216
    textField.hidden = YES;
slouken@5131
   217
    keyboardVisible = NO;
slouken@5131
   218
    /* add the UITextField (hidden) to our view */
slouken@5131
   219
    [self addSubview: textField];
slouken@5131
   220
    [textField release];
slouken@7962
   221
    
slouken@7962
   222
    _uikit_keyboard_init();
slouken@2765
   223
}
slouken@2765
   224
slouken@2765
   225
/* reveal onscreen virtual keyboard */
kees@6003
   226
- (void)showKeyboard
kees@6003
   227
{
slouken@5131
   228
    keyboardVisible = YES;
slouken@5131
   229
    [textField becomeFirstResponder];
slouken@2765
   230
}
slouken@2765
   231
slouken@2765
   232
/* hide onscreen virtual keyboard */
kees@6003
   233
- (void)hideKeyboard
kees@6003
   234
{
slouken@5131
   235
    keyboardVisible = NO;
slouken@5131
   236
    [textField resignFirstResponder];
slouken@2765
   237
}
slouken@2765
   238
slouken@2765
   239
/* UITextFieldDelegate method.  Invoked when user types something. */
kees@6003
   240
- (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
kees@6003
   241
{
slouken@5131
   242
    if ([string length] == 0) {
slouken@5131
   243
        /* it wants to replace text with nothing, ie a delete */
icculus@7774
   244
        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_BACKSPACE);
icculus@7774
   245
        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_BACKSPACE);
slouken@5131
   246
    }
slouken@5131
   247
    else {
slouken@5131
   248
        /* go through all the characters in the string we've been sent
slouken@5131
   249
           and convert them to key presses */
slouken@5131
   250
        int i;
kees@6003
   251
        for (i = 0; i < [string length]; i++) {
kees@6001
   252
slouken@5131
   253
            unichar c = [string characterAtIndex: i];
kees@6001
   254
slouken@5131
   255
            Uint16 mod = 0;
slouken@5218
   256
            SDL_Scancode code;
kees@6001
   257
slouken@5131
   258
            if (c < 127) {
slouken@5218
   259
                /* figure out the SDL_Scancode and SDL_keymod for this unichar */
slouken@5131
   260
                code = unicharToUIKeyInfoTable[c].code;
slouken@5131
   261
                mod  = unicharToUIKeyInfoTable[c].mod;
slouken@5131
   262
            }
slouken@5131
   263
            else {
slouken@5131
   264
                /* we only deal with ASCII right now */
slouken@5131
   265
                code = SDL_SCANCODE_UNKNOWN;
slouken@5131
   266
                mod = 0;
slouken@5131
   267
            }
kees@6001
   268
slouken@5131
   269
            if (mod & KMOD_SHIFT) {
slouken@5131
   270
                /* If character uses shift, press shift down */
slouken@5131
   271
                SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
slouken@5131
   272
            }
slouken@5131
   273
            /* send a keydown and keyup even for the character */
slouken@5131
   274
            SDL_SendKeyboardKey(SDL_PRESSED, code);
slouken@5131
   275
            SDL_SendKeyboardKey(SDL_RELEASED, code);
slouken@5131
   276
            if (mod & KMOD_SHIFT) {
slouken@5131
   277
                /* If character uses shift, press shift back up */
slouken@5131
   278
                SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
kees@6001
   279
            }
slouken@5131
   280
        }
slouken@5461
   281
        SDL_SendKeyboardText([string UTF8String]);
slouken@5131
   282
    }
slouken@5131
   283
    return NO; /* don't allow the edit! (keep placeholder text there) */
slouken@2765
   284
}
slouken@2765
   285
slouken@2765
   286
/* Terminates the editing session */
kees@6003
   287
- (BOOL)textFieldShouldReturn:(UITextField*)_textField
kees@6003
   288
{
slouken@5134
   289
    SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN);
slouken@6054
   290
    SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN);
slouken@6654
   291
    SDL_StopTextInput();
slouken@5131
   292
    return YES;
slouken@2765
   293
}
slouken@2765
   294
slouken@2765
   295
#endif
slouken@2765
   296
slouken@2765
   297
@end
slouken@2765
   298
slouken@2765
   299
/* iPhone keyboard addition functions */
slouken@2765
   300
#if SDL_IPHONE_KEYBOARD
slouken@2765
   301
slouken@6044
   302
static SDL_uikitview * getWindowView(SDL_Window * window)
kees@6010
   303
{
kees@6010
   304
    if (window == NULL) {
kees@6010
   305
        SDL_SetError("Window does not exist");
kees@6010
   306
        return nil;
kees@6010
   307
    }
kees@6010
   308
kees@6010
   309
    SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
kees@6010
   310
    SDL_uikitview *view = data != NULL ? data->view : nil;
kees@6010
   311
kees@6010
   312
    if (view == nil) {
kees@6010
   313
        SDL_SetError("Window has no view");
kees@6010
   314
    }
kees@6010
   315
kees@6010
   316
    return view;
kees@6010
   317
}
kees@6010
   318
slouken@6654
   319
SDL_bool UIKit_HasScreenKeyboardSupport(_THIS)
slouken@6392
   320
{
slouken@6392
   321
    return SDL_TRUE;
slouken@6392
   322
}
slouken@6392
   323
slouken@6654
   324
void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window)
kees@6003
   325
{
kees@6010
   326
    SDL_uikitview *view = getWindowView(window);
slouken@6654
   327
    if (view != nil) {
slouken@6654
   328
        [view showKeyboard];
slouken@5131
   329
    }
slouken@2765
   330
}
slouken@2765
   331
slouken@6654
   332
void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window)
kees@6003
   333
{
kees@6010
   334
    SDL_uikitview *view = getWindowView(window);
slouken@6654
   335
    if (view != nil) {
slouken@6654
   336
        [view hideKeyboard];
kees@6001
   337
    }
slouken@2765
   338
}
slouken@2765
   339
slouken@6392
   340
SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window)
kees@6003
   341
{
kees@6010
   342
    SDL_uikitview *view = getWindowView(window);
kees@6010
   343
    if (view == nil) {
kees@6010
   344
        return 0;
kees@6001
   345
    }
kees@6001
   346
kees@6010
   347
    return view.keyboardVisible;
slouken@2765
   348
}
slouken@2765
   349
slouken@7962
   350
slouken@7962
   351
void _uikit_keyboard_update() {
slouken@7962
   352
    SDL_Window *window = SDL_GetFocusWindow();
slouken@7962
   353
    if (!window) { return; }
slouken@7962
   354
    SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
slouken@7962
   355
    if (!data) { return; }
slouken@7962
   356
    SDL_uikitview *view = data->view;
slouken@7962
   357
    if (!view) { return; }
slouken@7962
   358
    
slouken@7962
   359
    SDL_Rect r = view.textInputRect;
slouken@7962
   360
    int height = view.keyboardHeight;
slouken@7962
   361
    int offsetx = 0;
slouken@7962
   362
    int offsety = 0;
slouken@8891
   363
    float scale = [UIScreen mainScreen].scale;
slouken@7962
   364
    if (height) {
slouken@7962
   365
        int sw,sh;
slouken@7962
   366
        SDL_GetWindowSize(window,&sw,&sh);
slouken@7962
   367
        int bottom = (r.y + r.h);
slouken@7962
   368
        int kbottom = sh - height;
slouken@7962
   369
        if (kbottom < bottom) {
slouken@7962
   370
            offsety = kbottom-bottom;
slouken@7962
   371
        }
slouken@7962
   372
    }
slouken@7962
   373
    UIInterfaceOrientation ui_orient = [[UIApplication sharedApplication] statusBarOrientation];
slouken@7962
   374
    if (ui_orient == UIInterfaceOrientationLandscapeLeft) {
slouken@7962
   375
        int tmp = offsetx; offsetx = offsety; offsety = tmp;
slouken@7962
   376
    }
slouken@7962
   377
    if (ui_orient == UIInterfaceOrientationLandscapeRight) {
slouken@7962
   378
        offsety = -offsety;
slouken@7962
   379
        int tmp = offsetx; offsetx = offsety; offsety = tmp;
slouken@7962
   380
    }
slouken@7962
   381
    if (ui_orient == UIInterfaceOrientationPortraitUpsideDown) {
slouken@7962
   382
        offsety = -offsety;
slouken@7962
   383
    }
slouken@8891
   384
slouken@8891
   385
    offsetx /= scale;
slouken@8891
   386
    offsety /= scale;
slouken@8891
   387
slouken@7962
   388
    view.frame = CGRectMake(offsetx,offsety,view.frame.size.width,view.frame.size.height);
slouken@7962
   389
}
slouken@7962
   390
slouken@7962
   391
void _uikit_keyboard_set_height(int height) {
slouken@7962
   392
    SDL_uikitview *view = getWindowView(SDL_GetFocusWindow());
slouken@7962
   393
    if (view == nil) {
slouken@7962
   394
        return ;
slouken@7962
   395
    }
slouken@7962
   396
    
slouken@7962
   397
    view.keyboardHeight = height;
slouken@7962
   398
    _uikit_keyboard_update();
slouken@7962
   399
}
slouken@7962
   400
slouken@7962
   401
void _uikit_keyboard_init() {
slouken@7962
   402
    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
slouken@7962
   403
    NSOperationQueue *queue = [NSOperationQueue mainQueue];
slouken@7962
   404
    [center addObserverForName:UIKeyboardWillShowNotification
slouken@7962
   405
                        object:nil
slouken@7962
   406
                         queue:queue
slouken@7962
   407
                    usingBlock:^(NSNotification *notification) {
slouken@7962
   408
                        int height = 0;
slouken@7962
   409
                        CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
slouken@7962
   410
                        height = keyboardSize.height;
slouken@7962
   411
                        UIInterfaceOrientation ui_orient = [[UIApplication sharedApplication] statusBarOrientation];
slouken@7962
   412
                        if (ui_orient == UIInterfaceOrientationLandscapeRight || ui_orient == UIInterfaceOrientationLandscapeLeft) {
slouken@7962
   413
                            height = keyboardSize.width;
slouken@7962
   414
                        }
slouken@8891
   415
                        height *= [UIScreen mainScreen].scale;
slouken@7962
   416
                        _uikit_keyboard_set_height(height);
slouken@7962
   417
                    }
slouken@7962
   418
     ];
slouken@7962
   419
    [center addObserverForName:UIKeyboardDidHideNotification
slouken@7962
   420
                        object:nil
slouken@7962
   421
                         queue:queue
slouken@7962
   422
                    usingBlock:^(NSNotification *notification) {
slouken@7962
   423
                        _uikit_keyboard_set_height(0);
slouken@7962
   424
                    }
slouken@7962
   425
     ];
slouken@7962
   426
}
slouken@7962
   427
slouken@7962
   428
void
slouken@7962
   429
UIKit_SetTextInputRect(_THIS, SDL_Rect *rect)
slouken@7962
   430
{
slouken@7962
   431
    if (!rect) {
slouken@7962
   432
        SDL_InvalidParamError("rect");
slouken@7962
   433
        return;
slouken@7962
   434
    }
slouken@7962
   435
    
slouken@7962
   436
    SDL_uikitview *view = getWindowView(SDL_GetFocusWindow());
slouken@7962
   437
    if (view == nil) {
slouken@7962
   438
        return ;
slouken@7962
   439
    }
slouken@7962
   440
slouken@7962
   441
    view.textInputRect = *rect;
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: */