src/video/uikit/SDL_uikitmodes.m
changeset 10019 36f7e8084508
parent 9998 f67cf37e9cd4
child 10033 03a8adcb6460
     1.1 --- a/src/video/uikit/SDL_uikitmodes.m	Wed Apr 22 16:50:48 2015 -0400
     1.2 +++ b/src/video/uikit/SDL_uikitmodes.m	Mon Jan 04 23:52:40 2016 -0500
     1.3 @@ -242,6 +242,26 @@
     1.4      return 0;
     1.5  }
     1.6  
     1.7 +int
     1.8 +UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
     1.9 +{
    1.10 +    /* the default function iterates displays to make a fake offset,
    1.11 +       as if all the displays were side-by-side, which is fine for iOS. */
    1.12 +    const int displayIndex = (int) (display - _this->displays);
    1.13 +    if (SDL_GetDisplayBounds(displayIndex, rect) < 0) {
    1.14 +        return -1;
    1.15 +    }
    1.16 +
    1.17 +    SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
    1.18 +    const CGRect frame = [data->uiscreen applicationFrame];
    1.19 +    const float scale = (float) data->scale;
    1.20 +    rect->x += (int) (frame.origin.x * scale);
    1.21 +    rect->y += (int) (frame.origin.y * scale);
    1.22 +    rect->w = (int) (frame.size.width * scale);
    1.23 +    rect->h = (int) (frame.size.height * scale);
    1.24 +    return 0;
    1.25 +}
    1.26 +
    1.27  void
    1.28  UIKit_QuitModes(_THIS)
    1.29  {