From 6ce44f2ce80afbbeaef97f4eea04625fe1f70864 Mon Sep 17 00:00:00 2001 From: administrator Date: Tue, 17 May 2022 00:22:31 +0100 Subject: [PATCH 1/2] Fix macOS compilation with FPC >= 3.2.0 Since FPC 3.2.0, one has to use `ObjCBool` instead of `Boolean`, otherwise GLPT compilation fails at various overrides because the methods are declared in ancestor with `ObjCBool` (not compatible with Pascal `Boolean`). E.g. in latest FPC, `packages/cocoaint/src/appkit/NSWindow.inc` defines ``` function initWithContentRect_styleMask_backing_defer (contentRect: NSRect; aStyle: NSUInteger; bufferingType: NSBackingStoreType; flag: ObjCBOOL): instancetype; message 'initWithContentRect:styleMask:backing:defer:'; ``` In GLPT, this should be overridden with `flag: ObjCBool`, not `flag: Boolean`. See https://fpcwiki.coderetro.net/User_Changes_3.2.0#objcbase . --- GLPT_Cocoa.inc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/GLPT_Cocoa.inc b/GLPT_Cocoa.inc index 385487f..197616f 100644 --- a/GLPT_Cocoa.inc +++ b/GLPT_Cocoa.inc @@ -230,10 +230,10 @@ end; type TBorderlessWindow = objcclass (NSWindow) public - function initWithContentRect_styleMask_backing_defer (contentRect: NSRect; aStyle: NSUInteger; bufferingType: NSBackingStoreType; flag: boolean): id; override; + function initWithContentRect_styleMask_backing_defer (contentRect: NSRect; aStyle: NSUInteger; bufferingType: NSBackingStoreType; flag: ObjCBool): id; override; function initWithContentRect(contentRect: NSRect): id; message 'initWithContentRect:'; - function canBecomeKeyWindow: boolean; override; - function canBecomeMainWindow: boolean; override; + function canBecomeKeyWindow: ObjCBool; override; + function canBecomeMainWindow: ObjCBool; override; procedure setKeepFullScreenAlways (newValue: boolean); message 'setKeepFullScreenAlways:'; private keepFullScreenAlways: boolean; @@ -241,12 +241,12 @@ type procedure dealloc; override; end; -function TBorderlessWindow.canBecomeKeyWindow: boolean; +function TBorderlessWindow.canBecomeKeyWindow: ObjCBool; begin result := true; end; -function TBorderlessWindow.canBecomeMainWindow: boolean; +function TBorderlessWindow.canBecomeMainWindow: ObjCBool; begin result := true; end; @@ -271,7 +271,7 @@ begin inherited dealloc; end; -function TBorderlessWindow.initWithContentRect_styleMask_backing_defer (contentRect: NSRect; aStyle: NSUInteger; bufferingType: NSBackingStoreType; flag: boolean): id; +function TBorderlessWindow.initWithContentRect_styleMask_backing_defer (contentRect: NSRect; aStyle: NSUInteger; bufferingType: NSBackingStoreType; flag: ObjCBool): id; begin result := inherited initWithContentRect_styleMask_backing_defer(contentRect, aStyle, bufferingType, flag); if result <> nil then @@ -442,7 +442,7 @@ type TOpenGLView = objcclass (NSView) public function initWithFrame(frameRect: NSRect): id; override; - function isOpaque: Boolean; override; + function isOpaque: ObjCBool; override; private openGLContext: NSOpenGLContext; trackingArea: NSTrackingArea; @@ -556,7 +556,7 @@ begin end; end; -function TOpenGLView.isOpaque: Boolean; +function TOpenGLView.isOpaque: ObjCBool; begin // return false to make the view transparent result := window.backgroundColor.alphaComponent > 0; From 0fd0871387657ca8c043fa339612188f5b54c359 Mon Sep 17 00:00:00 2001 From: Michalis Kamburelis Date: Wed, 1 Jun 2022 23:39:32 +0200 Subject: [PATCH 2/2] Fix attributes count in TOpenGLView.defaultPixelFormat Current count (5) is too small to fit various possible values we want to put on that list. --- GLPT_Cocoa.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GLPT_Cocoa.inc b/GLPT_Cocoa.inc index 197616f..d162e77 100644 --- a/GLPT_Cocoa.inc +++ b/GLPT_Cocoa.inc @@ -575,7 +575,7 @@ const NSOpenGLProfileVersion3_2Core = $3200 { available in 10_7 }; NSOpenGLProfileVersion4_1Core = $4100 { available in 10_10 }; var - attributes: array[0..4] of NSOpenGLPixelFormatAttribute; + attributes: array[0..32] of NSOpenGLPixelFormatAttribute; i: integer = -1; context: GLPT_Context; begin