Mac: Make cocoa backend compile on macOS 10.3

This commit is contained in:
UnknownShadow200 2023-09-03 23:12:53 +10:00
parent 40fbd0cf05
commit 0a4f26c296

View File

@ -244,12 +244,12 @@ static void RefreshWindowBounds(void) {
@end
static void DoDrawFramebuffer(CGRect dirty);
static void DoDrawFramebuffer(NSRect dirty);
@interface CCView : NSView { }
@end
@implementation CCView
- (void)drawRect:(CGRect)dirty { DoDrawFramebuffer(dirty); }
- (void)drawRect:(NSRect)dirty { DoDrawFramebuffer(dirty); }
- (void)viewDidEndLiveResize {
// When the user users left mouse to drag reisze window, this enters 'live resize' mode
@ -443,6 +443,7 @@ static int TryGetKey(NSEvent* ev) {
}
static void DebugScrollEvent(NSEvent* ev) {
#ifdef kCGScrollWheelEventDeltaAxis1
float dy = [ev deltaY];
int steps = dy > 0.0f ? Math_Ceil(dy) : Math_Floor(dy);
@ -451,12 +452,13 @@ static void DebugScrollEvent(NSEvent* ev) {
int raw = CGEventGetIntegerValueField(ref, kCGScrollWheelEventDeltaAxis1);
Platform_Log3("SCROLL: %i.0 = (%i, %f3)", &steps, &raw, &dy);
#endif
}
void Window_ProcessEvents(double delta) {
NSEvent* ev;
int key, type, steps, x, y;
CGFloat dx, dy;
float dx, dy;
// https://wiki.freepascal.org/Cocoa_Internals/Application
[pool release];
@ -560,7 +562,9 @@ void ShowDialogCore(const char* title, const char* msg) {
static NSMutableArray* GetOpenSaveFilters(const char* const* filters) {
NSMutableArray* types = [NSMutableArray array];
for (int i = 0; filters[i]; i++)
int i;
for (i = 0; filters[i]; i++)
{
NSString* filter = [NSString stringWithUTF8String:filters[i]];
filter = [filter substringFromIndex:1];
@ -630,7 +634,7 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
fb_bmp = *bmp;
}
static void DoDrawFramebuffer(CGRect dirty) {
static void DoDrawFramebuffer(NSRect dirty) {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = NULL;
CGDataProviderRef provider;