Cocoa Port:
- Fix bugs with window resizing with certain configurations of display orientation and using a minimum display size of less than 1x.
This commit is contained in:
parent
1a1f92877c
commit
1a48e36abb
|
@ -108,6 +108,7 @@
|
||||||
@property (assign) BOOL isSheetControllingExecution;
|
@property (assign) BOOL isSheetControllingExecution;
|
||||||
@property (assign) BOOL isShowingSaveStateSheet;
|
@property (assign) BOOL isShowingSaveStateSheet;
|
||||||
@property (assign) BOOL isShowingFileMigrationSheet;
|
@property (assign) BOOL isShowingFileMigrationSheet;
|
||||||
|
@property (assign) BOOL isMinSizeNormal;
|
||||||
@property (assign) NSInteger selectedRomSaveTypeID;
|
@property (assign) NSInteger selectedRomSaveTypeID;
|
||||||
|
|
||||||
@property (readonly) NSMutableDictionary *bindings;
|
@property (readonly) NSMutableDictionary *bindings;
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
@synthesize isSheetControllingExecution;
|
@synthesize isSheetControllingExecution;
|
||||||
@synthesize isShowingSaveStateSheet;
|
@synthesize isShowingSaveStateSheet;
|
||||||
@synthesize isShowingFileMigrationSheet;
|
@synthesize isShowingFileMigrationSheet;
|
||||||
|
@dynamic isMinSizeNormal;
|
||||||
@synthesize selectedRomSaveTypeID;
|
@synthesize selectedRomSaveTypeID;
|
||||||
|
|
||||||
@synthesize bindings;
|
@synthesize bindings;
|
||||||
|
@ -292,6 +293,46 @@
|
||||||
return (NSString *)[bindings valueForKey:@"status"];
|
return (NSString *)[bindings valueForKey:@"status"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setIsMinSizeNormal:(BOOL)theState
|
||||||
|
{
|
||||||
|
isMinSizeNormal = theState;
|
||||||
|
|
||||||
|
if ([dispViewDelegate displayType] == DS_DISPLAY_TYPE_COMBO)
|
||||||
|
{
|
||||||
|
if ([dispViewDelegate displayOrientation] == DS_DISPLAY_ORIENTATION_HORIZONTAL)
|
||||||
|
{
|
||||||
|
minDisplayViewSize.width = GPU_DISPLAY_WIDTH * 2;
|
||||||
|
minDisplayViewSize.height = GPU_DISPLAY_HEIGHT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minDisplayViewSize.width = GPU_DISPLAY_WIDTH;
|
||||||
|
minDisplayViewSize.height = GPU_DISPLAY_HEIGHT * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minDisplayViewSize.width = GPU_DISPLAY_WIDTH;
|
||||||
|
minDisplayViewSize.height = GPU_DISPLAY_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isMinSizeNormal)
|
||||||
|
{
|
||||||
|
minDisplayViewSize.width /= 4;
|
||||||
|
minDisplayViewSize.height /= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the minimum content size, keeping the display rotation in mind.
|
||||||
|
NSSize transformedMinSize = GetTransformedBounds(minDisplayViewSize, 1.0, CLOCKWISE_DEGREES([dispViewDelegate rotation]));
|
||||||
|
transformedMinSize.height += statusBarHeight;
|
||||||
|
[window setContentMinSize:transformedMinSize];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) isMinSizeNormal
|
||||||
|
{
|
||||||
|
return isMinSizeNormal;
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction) openRom:(id)sender
|
- (IBAction) openRom:(id)sender
|
||||||
{
|
{
|
||||||
if (isRomLoading)
|
if (isRomLoading)
|
||||||
|
@ -872,11 +913,8 @@
|
||||||
- (IBAction) changeDisplayOrientation:(id)sender
|
- (IBAction) changeDisplayOrientation:(id)sender
|
||||||
{
|
{
|
||||||
[dispViewDelegate setDisplayOrientation:[CocoaDSUtil getIBActionSenderTag:sender]];
|
[dispViewDelegate setDisplayOrientation:[CocoaDSUtil getIBActionSenderTag:sender]];
|
||||||
|
[self setIsMinSizeNormal:[self isMinSizeNormal]];
|
||||||
if ([dispViewDelegate displayType] == DS_DISPLAY_TYPE_COMBO)
|
[self resizeWithTransform:[dispViewDelegate normalSize] scalar:[dispViewDelegate scale] rotation:[dispViewDelegate rotation]];
|
||||||
{
|
|
||||||
[self resizeWithTransform:[dispViewDelegate normalSize] scalar:[dispViewDelegate scale] rotation:[dispViewDelegate rotation]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) changeDisplayOrder:(id)sender
|
- (IBAction) changeDisplayOrder:(id)sender
|
||||||
|
@ -962,39 +1000,34 @@
|
||||||
|
|
||||||
- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender
|
- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender
|
||||||
{
|
{
|
||||||
if (isMinSizeNormal)
|
if ([self isMinSizeNormal])
|
||||||
{
|
{
|
||||||
minDisplayViewSize.width /= 4;
|
[self setIsMinSizeNormal:NO];
|
||||||
minDisplayViewSize.height /= 4;
|
|
||||||
isMinSizeNormal = NO;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
minDisplayViewSize.width = GPU_DISPLAY_WIDTH;
|
[self setIsMinSizeNormal:YES];
|
||||||
minDisplayViewSize.height = GPU_DISPLAY_HEIGHT * 2;
|
|
||||||
isMinSizeNormal = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the minimum content size, keeping the display rotation in mind.
|
|
||||||
NSSize transformedMinSize = GetTransformedBounds(minDisplayViewSize, 1.0, CLOCKWISE_DEGREES([dispViewDelegate rotation]));
|
|
||||||
transformedMinSize.height += statusBarHeight;
|
|
||||||
[window setContentMinSize:transformedMinSize];
|
|
||||||
|
|
||||||
// Resize the window if it's smaller than the minimum content size.
|
|
||||||
NSRect windowContentRect = [window contentRectForFrameRect:[window frame]];
|
|
||||||
if (windowContentRect.size.width < transformedMinSize.width || windowContentRect.size.height < transformedMinSize.height)
|
|
||||||
{
|
|
||||||
// Prepare to resize.
|
|
||||||
NSRect oldFrameRect = [window frame];
|
|
||||||
windowContentRect.size = transformedMinSize;
|
|
||||||
NSRect newFrameRect = [window frameRectForContentRect:windowContentRect];
|
|
||||||
|
|
||||||
// Keep the window centered when expanding the size.
|
// Set the minimum content size, keeping the display rotation in mind.
|
||||||
newFrameRect.origin.x = oldFrameRect.origin.x - ((newFrameRect.size.width - oldFrameRect.size.width) / 2);
|
NSSize transformedMinSize = GetTransformedBounds(minDisplayViewSize, 1.0, CLOCKWISE_DEGREES([dispViewDelegate rotation]));
|
||||||
newFrameRect.origin.y = oldFrameRect.origin.y - ((newFrameRect.size.height - oldFrameRect.size.height) / 2);
|
transformedMinSize.height += statusBarHeight;
|
||||||
|
|
||||||
// Set the window size.
|
// Resize the window if it's smaller than the minimum content size.
|
||||||
[window setFrame:newFrameRect display:YES animate:NO];
|
NSRect windowContentRect = [window contentRectForFrameRect:[window frame]];
|
||||||
|
if (windowContentRect.size.width < transformedMinSize.width || windowContentRect.size.height < transformedMinSize.height)
|
||||||
|
{
|
||||||
|
// Prepare to resize.
|
||||||
|
NSRect oldFrameRect = [window frame];
|
||||||
|
windowContentRect.size = transformedMinSize;
|
||||||
|
NSRect newFrameRect = [window frameRectForContentRect:windowContentRect];
|
||||||
|
|
||||||
|
// Keep the window centered when expanding the size.
|
||||||
|
newFrameRect.origin.x = oldFrameRect.origin.x - ((newFrameRect.size.width - oldFrameRect.size.width) / 2);
|
||||||
|
newFrameRect.origin.y = oldFrameRect.origin.y - ((newFrameRect.size.height - oldFrameRect.size.height) / 2);
|
||||||
|
|
||||||
|
// Set the window size.
|
||||||
|
[window setFrame:newFrameRect display:YES animate:NO];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue