diff --git a/Limelight/Database/DataManager.h b/Limelight/Database/DataManager.h
index c6e00979..fd6e03ec 100644
--- a/Limelight/Database/DataManager.h
+++ b/Limelight/Database/DataManager.h
@@ -42,7 +42,8 @@
// absoluteTouchMode:(BOOL)absoluteTouchMode
touchMode:(NSInteger)touchMode
statsOverlay:(BOOL)statsOverlay
- allowPortrait:(BOOL)allowPortrait;
+ allowPortrait:(BOOL)allowPortrait
+ resolutionSelected:(NSInteger)resolutionSelected;
- (NSArray*) getHosts;
- (void) updateHost:(TemporaryHost*)host;
diff --git a/Limelight/Database/DataManager.m b/Limelight/Database/DataManager.m
index 407194e9..95be2e2d 100644
--- a/Limelight/Database/DataManager.m
+++ b/Limelight/Database/DataManager.m
@@ -81,7 +81,8 @@
// absoluteTouchMode:(BOOL)absoluteTouchMode
touchMode:(NSInteger)touchMode
statsOverlay:(BOOL)statsOverlay
- allowPortrait:(BOOL)allowPortrait{
+ allowPortrait:(BOOL)allowPortrait
+ resolutionSelected:(NSInteger)resolutionSelected {
[_managedObjectContext performBlockAndWait:^{
Settings* settingsToSave = [self retrieveSettings];
@@ -115,6 +116,7 @@
settingsToSave.touchMode = [NSNumber numberWithInteger:(uint16_t)touchMode];
settingsToSave.statsOverlay = statsOverlay;
settingsToSave.allowPortrait = allowPortrait;
+ settingsToSave.resolutionSelected = [NSNumber numberWithInteger:resolutionSelected];
[self saveData];
}];
diff --git a/Limelight/Database/TemporarySettings.h b/Limelight/Database/TemporarySettings.h
index 7e58f722..1c238c05 100644
--- a/Limelight/Database/TemporarySettings.h
+++ b/Limelight/Database/TemporarySettings.h
@@ -33,6 +33,7 @@
@property (nonatomic, retain) NSNumber * mousePointerVelocityFactor;
@property (nonatomic, retain) NSNumber * pointerVelocityModeDivider;
@property (nonatomic, retain) NSString * uniqueId;
+@property (nonatomic, retain) NSNumber * resolutionSelected;
@property (nonatomic) enum {
CODEC_PREF_AUTO,
CODEC_PREF_H264,
diff --git a/Limelight/Database/TemporarySettings.m b/Limelight/Database/TemporarySettings.m
index 75d66e23..c3eef3c0 100644
--- a/Limelight/Database/TemporarySettings.m
+++ b/Limelight/Database/TemporarySettings.m
@@ -99,6 +99,7 @@
self.mousePointerVelocityFactor = settings.mousePointerVelocityFactor;
self.pointerVelocityModeDivider = settings.pointerVelocityModeDivider;
self.allowPortrait = settings.allowPortrait;
+ self.resolutionSelected = settings.resolutionSelected;
#endif
self.uniqueId = settings.uniqueId;
diff --git a/Limelight/Limelight-Info.plist b/Limelight/Limelight-Info.plist
index f29ea4d0..e3f9934d 100644
--- a/Limelight/Limelight-Info.plist
+++ b/Limelight/Limelight-Info.plist
@@ -73,8 +73,6 @@
armv7
- UIRequiresFullScreen
-
UIStatusBarHidden
UISupportedInterfaceOrientations
diff --git a/Limelight/Limelight.xcdatamodeld/.xccurrentversion b/Limelight/Limelight.xcdatamodeld/.xccurrentversion
index b202eb9f..cffa4ac2 100644
--- a/Limelight/Limelight.xcdatamodeld/.xccurrentversion
+++ b/Limelight/Limelight.xcdatamodeld/.xccurrentversion
@@ -3,6 +3,6 @@
_XCCurrentVersionName
- Moonlight v1.10.xcdatamodel
+ Moonlight v1.11.xcdatamodel
diff --git a/Limelight/Limelight.xcdatamodeld/Moonlight v1.11.xcdatamodel/contents b/Limelight/Limelight.xcdatamodeld/Moonlight v1.11.xcdatamodel/contents
new file mode 100644
index 00000000..16301b49
--- /dev/null
+++ b/Limelight/Limelight.xcdatamodeld/Moonlight v1.11.xcdatamodel/contents
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m
index 0588c3ac..95137f60 100644
--- a/Limelight/ViewControllers/MainFrameViewController.m
+++ b/Limelight/ViewControllers/MainFrameViewController.m
@@ -1149,9 +1149,11 @@ static NSMutableSet* hostList;
//[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
//[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
[self swapResolutionWidthHeightAccordingly];
+
+ SettingsViewController* settingsViewController = (SettingsViewController*)[self.revealViewController rearViewController];
+ [settingsViewController updateResolutionTable];
}
-
-(void)handleRealOrientationChange{
}
@@ -1194,14 +1196,26 @@ static NSMutableSet* hostList;
}
--(void)swapResolutionWidthHeightAccordingly{
+-(void) swapResolutionWidthHeightAccordingly {
+ return;
DataManager* dataMan = [[DataManager alloc] init];
Settings *currentSettings = [dataMan retrieveSettings];
- CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
- CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
- bool needSwap = ((currentSettings.width.floatValue - currentSettings.height.floatValue) * (screenWidthInPoints - screenHeightInPoints)) < 0; //update the current resolution accordingly
- NSLog(@"need to swap width & height: %d", needSwap);
- if(needSwap){
+
+ UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
+ CGFloat screenScale = window.screen.scale;
+ CGFloat screenWidthInPoints = CGRectGetWidth(window.frame);
+ CGFloat screenHeightInPoints = CGRectGetHeight(window.frame);
+ CGFloat fullScreenWidth = screenWidthInPoints * screenScale;
+ CGFloat fullScreenHeight = screenHeightInPoints * screenScale;
+
+ bool needSwap = ((currentSettings.width.floatValue - currentSettings.height.floatValue) *
+ (fullScreenWidth - fullScreenHeight)) < 0;
+
+ NSLog(@"Current screen size: %.0f x %.0f", fullScreenWidth, fullScreenHeight);
+ NSLog(@"Current setting size: %.0f x %.0f", currentSettings.width.floatValue, currentSettings.height.floatValue);
+ NSLog(@"Need to swap width & height: %d", needSwap);
+
+ if(needSwap) {
CGFloat tmpLength = currentSettings.width.floatValue;
currentSettings.width = @(currentSettings.height.floatValue);
currentSettings.height = @(tmpLength);
@@ -1209,7 +1223,6 @@ static NSMutableSet* hostList;
}
}
-
#if TARGET_OS_TV
-(void)handleCollectionViewLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
{
diff --git a/Limelight/ViewControllers/SettingsViewController.h b/Limelight/ViewControllers/SettingsViewController.h
index d7c22125..852a5e77 100644
--- a/Limelight/ViewControllers/SettingsViewController.h
+++ b/Limelight/ViewControllers/SettingsViewController.h
@@ -68,6 +68,7 @@
- (void) saveSettings;
+ (bool) isLandscapeNow;
+- (void)updateResolutionTable;
- (void) widget:(UISlider*)widget setEnabled:(bool)enabled;
@end
diff --git a/Limelight/ViewControllers/SettingsViewController.m b/Limelight/ViewControllers/SettingsViewController.m
index f3ba2808..587b4df6 100644
--- a/Limelight/ViewControllers/SettingsViewController.m
+++ b/Limelight/ViewControllers/SettingsViewController.m
@@ -217,6 +217,7 @@ BOOL isCustomResolution(CGSize res) {
CGFloat safeAreaWidth = (window.frame.size.width - window.safeAreaInsets.left - window.safeAreaInsets.right) * screenScale;
CGFloat fullScreenWidth = window.frame.size.width * screenScale;
CGFloat fullScreenHeight = window.frame.size.height * screenScale;
+ bool isLandscapeNow = fullScreenWidth > fullScreenHeight;
resolutionTable[4] = CGSizeMake(safeAreaWidth, fullScreenHeight);
resolutionTable[5] = CGSizeMake(fullScreenWidth, fullScreenHeight);
@@ -224,13 +225,27 @@ BOOL isCustomResolution(CGSize res) {
for(uint8_t i=0;i<7;i++){
CGFloat longSideLen = resolutionTable[i].height > resolutionTable[i].width ? resolutionTable[i].height : resolutionTable[i].width;
CGFloat shortSideLen = resolutionTable[i].height < resolutionTable[i].width ? resolutionTable[i].height : resolutionTable[i].width;
- if([SettingsViewController isLandscapeNow]) resolutionTable[i] = CGSizeMake(longSideLen, shortSideLen);
+ if(isLandscapeNow) resolutionTable[i] = CGSizeMake(longSideLen, shortSideLen);
else resolutionTable[i] = CGSizeMake(shortSideLen, longSideLen);
}
+ [self updateResolutionSettings];
[self updateResolutionDisplayViewText];
}
+- (void)updateResolutionSettings{
+ DataManager* dataMgr = [[DataManager alloc] init];
+ Settings *currentSettings = [dataMgr retrieveSettings];
+ int resolution = currentSettings.resolutionSelected.intValue;
+
+ if(resolution==4 || resolution==5){
+ currentSettings.width = @(resolutionTable[resolution].width);
+ currentSettings.height = @(resolutionTable[resolution].height);
+ NSLog(@"Modify setting width & height: %.0f x %.0f", currentSettings.width.floatValue, currentSettings.height.floatValue);
+ [dataMgr saveData];
+ }
+}
+
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self updateResolutionTable];
@@ -359,13 +374,10 @@ BOOL isCustomResolution(CGSize res) {
break;
}
- NSInteger resolution = 1;
- for (int i = 0; i < RESOLUTION_TABLE_SIZE; i++) {
- if (((int) resolutionTable[i].height == [currentSettings.height intValue] && (int) resolutionTable[i].width == [currentSettings.width intValue]) || ((int) resolutionTable[i].width == [currentSettings.height intValue] && (int) resolutionTable[i].height == [currentSettings.width intValue])){
- resolution = i;
- break;
- }
- }
+ NSInteger resolution = currentSettings.resolutionSelected.integerValue;
+ if(resolution >= RESOLUTION_TABLE_SIZE){
+ resolution = 0;
+ }
// Only show the 120 FPS option if we have a > 60-ish Hz display
bool enable120Fps = false;
@@ -1030,6 +1042,7 @@ BOOL isCustomResolution(CGSize res) {
BOOL statsOverlay = [self.statsOverlaySelector selectedSegmentIndex] == 1;
BOOL enableHdr = [self.hdrSelector selectedSegmentIndex] == 1;
BOOL allowPortrait = [self.allowPortraitSelector selectedSegmentIndex] == 1;
+ NSInteger resolutionSelected = [self.resolutionSelector selectedSegmentIndex];
[dataMan saveSettingsWithBitrate:_bitrate
framerate:framerate
height:height
@@ -1059,7 +1072,8 @@ BOOL isCustomResolution(CGSize res) {
// absoluteTouchMode:absoluteTouchMode
touchMode:touchMode
statsOverlay:statsOverlay
- allowPortrait:allowPortrait];
+ allowPortrait:allowPortrait
+ resolutionSelected:resolutionSelected];
}
- (void)didReceiveMemoryWarning {
@@ -1073,5 +1087,10 @@ BOOL isCustomResolution(CGSize res) {
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
}
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator {
+ [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
+
+ [self deviceOrientationDidChange];
+}
@end
diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m
index 19a19f32..3af3db5b 100644
--- a/Limelight/ViewControllers/StreamFrameViewController.m
+++ b/Limelight/ViewControllers/StreamFrameViewController.m
@@ -860,4 +860,11 @@
}
#endif
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator {
+ [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
+
+ Log(LOG_I, @"View size changed, terminating stream");
+ [self returnToMainFrame];
+}
+
@end