Turns out the last Cocoa fix was neither reliable or actually working.

This commit is contained in:
Lior Halphon 2018-07-11 19:46:27 +03:00
parent 5f58323c01
commit e5f4495ca0
5 changed files with 40 additions and 12 deletions

View File

@ -334,8 +334,6 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height,
NSMutableParagraphStyle *paragraph_style = [[NSMutableParagraphStyle alloc] init]; NSMutableParagraphStyle *paragraph_style = [[NSMutableParagraphStyle alloc] init];
[paragraph_style setLineSpacing:2]; [paragraph_style setLineSpacing:2];
self.mainWindow.contentView.layer.backgroundColor = [[NSColor blackColor] CGColor];
self.debuggerSideViewInput.font = [NSFont userFixedPitchFontOfSize:12]; self.debuggerSideViewInput.font = [NSFont userFixedPitchFontOfSize:12];
self.debuggerSideViewInput.textColor = [NSColor whiteColor]; self.debuggerSideViewInput.textColor = [NSColor whiteColor];
self.debuggerSideViewInput.defaultParagraphStyle = paragraph_style; self.debuggerSideViewInput.defaultParagraphStyle = paragraph_style;

View File

@ -49,12 +49,18 @@
<view key="contentView" id="gIp-Ho-8D9"> <view key="contentView" id="gIp-Ho-8D9">
<rect key="frame" x="0.0" y="0.0" width="160" height="144"/> <rect key="frame" x="0.0" y="0.0" width="160" height="144"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews>
<customView id="KTk-4M-J7t" customClass="GBBorderView">
<rect key="frame" x="0.0" y="0.0" width="160" height="144"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view id="uqf-pe-VAF" customClass="GBView"> <view id="uqf-pe-VAF" customClass="GBView">
<rect key="frame" x="0.0" y="0.0" width="160" height="144"/> <rect key="frame" x="0.0" y="0.0" width="160" height="144"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view> </view>
</subviews> </subviews>
</customView>
</subviews>
</view> </view>
<connections> <connections>
<outlet property="delegate" destination="-2" id="jvM-lC-fKb"/> <outlet property="delegate" destination="-2" id="jvM-lC-fKb"/>

5
Cocoa/GBBorderView.h Normal file
View File

@ -0,0 +1,5 @@
#import <Cocoa/Cocoa.h>
@interface GBBorderView : NSView
@end

26
Cocoa/GBBorderView.m Normal file
View File

@ -0,0 +1,26 @@
#import "GBBorderView.h"
@implementation GBBorderView
- (void)awakeFromNib
{
self.wantsLayer = YES;
}
- (BOOL)wantsUpdateLayer
{
return YES;
}
- (void)updateLayer
{
/* Wonderful, wonderful windowserver(?) bug. Using 0,0,0 here would cause it to render garbage
on fullscreen windows on some High Sierra machines. Any other value, including the one used
here (which is rendered exactly the same due to rounding) works around this bug. */
self.layer.backgroundColor = [NSColor colorWithCalibratedRed:0
green:0
blue:1.0 / 1024.0
alpha:1.0].CGColor;
}
@end

View File

@ -71,13 +71,6 @@ static const vector_float2 rect[] =
[self loadShader]; [self loadShader];
} }
- (void)addSubview:(NSView *)view
{
/* Fixes rounded corners */
[super addSubview:view];
[self setWantsLayer:YES];
}
- (void) loadShader - (void) loadShader
{ {
NSError *error = nil; NSError *error = nil;