Allow more than one window on iOS as long as they're on different displays

This commit is contained in:
Sam Lantinga 2020-10-15 12:00:15 -07:00
parent a90f0400a5
commit 58976bda31

View File

@ -162,14 +162,14 @@ UIKit_CreateWindow(_THIS, SDL_Window *window)
@autoreleasepool { @autoreleasepool {
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata; SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata;
SDL_Window *other;
/* SDL currently puts this window at the start of display's linked list. We rely on this. */
SDL_assert(_this->windows == window);
/* We currently only handle a single window per display on iOS */ /* We currently only handle a single window per display on iOS */
if (window->next != NULL) { for (other = _this->windows; other; other = other->next) {
return SDL_SetError("Only one window allowed per display."); if (other != window && SDL_GetDisplayForWindow(other) == display) {
} return SDL_SetError("Only one window allowed per display.");
}
}
/* If monitor has a resolution of 0x0 (hasn't been explicitly set by the /* If monitor has a resolution of 0x0 (hasn't been explicitly set by the
* user, so it's in standby), try to force the display to a resolution * user, so it's in standby), try to force the display to a resolution