Skip to content

Commit d9034b2

Browse files
committed
iOS: Dirty fix for non 16:9 screens
1 parent 57ff4aa commit d9034b2

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

app/platforms/ios/apple_display.mm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#import <UIKit/UIKit.h>
2+
13
#ifdef PLATFORM_TVOS
24

3-
#import <UIKit/UIKit.h>
45
#import <AVFoundation/AVDisplayCriteria.h>
56
#import <AVKit/AVDisplayManager.h>
67
#import <AVKit/UIWindow.h>
@@ -37,5 +38,10 @@ void updatePreferredDisplayMode(bool streamActive) {
3738
displayManager.preferredDisplayCriteria = nil;
3839
}
3940
}
40-
4141
#endif
42+
43+
void getWindowSize(int* w, int* h) {
44+
UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
45+
*w = window.frame.size.width * window.traitCollection.displayScale;
46+
*h = window.frame.size.height * window.traitCollection.displayScale;
47+
}

app/src/streaming/MoonlightSession.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
#include "Settings.hpp"
66
#include "borealis.hpp"
77
#include <string.h>
8+
#include <SDL.h>
9+
10+
#ifdef PLATFORM_IOS
11+
extern void getWindowSize(int* w, int* h);
12+
#endif
813

914
using namespace brls;
1015

@@ -231,8 +236,12 @@ void MoonlightSession::start(ServerCallback<bool> callback, bool is_sunshine) {
231236
int h = Settings::instance().resolution();
232237
int w = h * 16 / 9;
233238
if (h == -1) {
239+
#if defined(PLATFORM_IOS)
240+
getWindowSize(&w, &h);
241+
#else
234242
h = Application::windowHeight;
235243
w = Application::windowWidth;
244+
#endif
236245
}
237246

238247
// 480p cannot fit into 16/9 aspect ratio without manual adjustments

0 commit comments

Comments
 (0)