mirror of https://github.com/encounter/SDL.git
Fixed SDL_SetWindowFullscreen on iOS to properly update the view's frame.
This commit is contained in:
parent
e02e34521a
commit
cf2958a8de
|
@ -240,6 +240,7 @@ UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
||||||
SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
|
||||||
SDL_uikitviewcontroller *viewcontroller = windowdata->viewcontroller;
|
SDL_uikitviewcontroller *viewcontroller = windowdata->viewcontroller;
|
||||||
UIWindow *uiwindow = windowdata->uiwindow;
|
UIWindow *uiwindow = windowdata->uiwindow;
|
||||||
|
CGRect bounds;
|
||||||
|
|
||||||
if (fullscreen || (window->flags & SDL_WINDOW_BORDERLESS)) {
|
if (fullscreen || (window->flags & SDL_WINDOW_BORDERLESS)) {
|
||||||
[UIApplication sharedApplication].statusBarHidden = YES;
|
[UIApplication sharedApplication].statusBarHidden = YES;
|
||||||
|
@ -253,13 +254,17 @@ UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CGRect bounds;
|
if (fullscreen || (window->flags & SDL_WINDOW_BORDERLESS)) {
|
||||||
if (fullscreen) {
|
|
||||||
bounds = [displaydata->uiscreen bounds];
|
bounds = [displaydata->uiscreen bounds];
|
||||||
} else {
|
} else {
|
||||||
bounds = [displaydata->uiscreen applicationFrame];
|
bounds = [displaydata->uiscreen applicationFrame];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update the view's frame to account for the status bar change. */
|
||||||
|
windowdata->view.frame = bounds;
|
||||||
|
[windowdata->view setNeedsLayout];
|
||||||
|
[windowdata->view layoutIfNeeded];
|
||||||
|
|
||||||
/* Get frame dimensions */
|
/* Get frame dimensions */
|
||||||
int width = (int) bounds.size.width;
|
int width = (int) bounds.size.width;
|
||||||
int height = (int) bounds.size.height;
|
int height = (int) bounds.size.height;
|
||||||
|
@ -268,21 +273,11 @@ UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
||||||
screen to match, so we pick the closest to what we wanted.
|
screen to match, so we pick the closest to what we wanted.
|
||||||
*/
|
*/
|
||||||
if (window->w >= window->h) {
|
if (window->w >= window->h) {
|
||||||
if (width > height) {
|
window->w = SDL_max(width, height);
|
||||||
window->w = width;
|
window->h = SDL_min(width, height);
|
||||||
window->h = height;
|
|
||||||
} else {
|
|
||||||
window->w = height;
|
|
||||||
window->h = width;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (width > height) {
|
window->w = SDL_min(width, height);
|
||||||
window->w = height;
|
window->h = SDL_max(width, height);
|
||||||
window->h = width;
|
|
||||||
} else {
|
|
||||||
window->w = width;
|
|
||||||
window->h = height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue