From da7275aac6a6b8ed59dacb1f150a9d4a7cb8b28f Mon Sep 17 00:00:00 2001 From: pkgdemon Date: Sun, 5 Apr 2026 13:17:20 -0500 Subject: [PATCH 1/2] Fix build and add gitignore --- .gitignore | 9 +++++++++ Headers/QuartzCore/CABase.h | 5 +++++ Headers/QuartzCore/CATransaction.h | 2 +- Source/CABackingStore.h | 3 ++- Source/GNUmakefile | 4 ++++ config.make | 4 ---- 6 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 .gitignore delete mode 100644 config.make diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..392a761 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Build artifacts +obj/ +derived_src/ + +# Framework output +*.framework/ + +# Application bundles +*.app/ diff --git a/Headers/QuartzCore/CABase.h b/Headers/QuartzCore/CABase.h index 7d068a8..8bef854 100644 --- a/Headers/QuartzCore/CABase.h +++ b/Headers/QuartzCore/CABase.h @@ -23,6 +23,11 @@ Boston, MA 02110-1301, USA. */ +/* Import Foundation first so CoreFoundation.h inline functions + can resolve NSObject method signatures (-hash, -isEqual:, etc.) */ +#ifdef __OBJC__ +#import +#endif #import #ifdef __cplusplus diff --git a/Headers/QuartzCore/CATransaction.h b/Headers/QuartzCore/CATransaction.h index aaa5726..712b6e5 100644 --- a/Headers/QuartzCore/CATransaction.h +++ b/Headers/QuartzCore/CATransaction.h @@ -25,7 +25,7 @@ */ #import -#import "CoreFoundation/CFDate.h" /* CFTimeInterval */ +#import /* CFTimeInterval */ @class CAMediaTimingFunction; diff --git a/Source/CABackingStore.h b/Source/CABackingStore.h index 10693c1..15e234f 100644 --- a/Source/CABackingStore.h +++ b/Source/CABackingStore.h @@ -38,14 +38,15 @@ #if GNUSTEP #import #endif -#if (__APPLE__) #define GL_GLEXT_PROTOTYPES 1 +#if (__APPLE__) #import #import #import #else #import #import +#import #endif @class CAGLTexture; diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 84e18df..fd1e89a 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -51,6 +51,10 @@ QuartzCore_RESOURCE_FILES = \ QuartzCore_OBJC_FILES = $(wildcard *.m) $(wildcard GLHelpers/*.m) QuartzCore_OBJCFLAGS += $(WARN_FLAGS) +# Newer clang treats -Wint-conversion as a hard error; suppress for +# CoreFoundation.h compatibility shim which has type mismatches in +# inline functions (CFEqual returns Boolean but message send returns id). +QuartzCore_OBJCFLAGS += -Wno-error=int-conversion # Treat warnings as errors unless someone chooses to ignore them. #ifneq ($(nonstrict), yes) #QuartzCore_OBJCFLAGS += -Werror diff --git a/config.make b/config.make deleted file mode 100644 index fce8c13..0000000 --- a/config.make +++ /dev/null @@ -1,4 +0,0 @@ -# This file should be autogenerated from config.make.in. -# However, we have no need for "configure" script yet. - - From 2ae02bb8d0a8e4bcf77fa7de14ba36e05e489f7b Mon Sep 17 00:00:00 2001 From: pkgdemon Date: Sun, 5 Apr 2026 14:56:54 -0500 Subject: [PATCH 2/2] Fixes to CALayer to make demo app work --- Demo/AppController.m | 15 ------- Demo/DemoOpenGLView.m | 2 +- Demo/QuartzCoreDemoInfo.plist | 4 +- Source/CALayer.m | 76 ++++++++++++++++++++++++----------- 4 files changed, 55 insertions(+), 42 deletions(-) diff --git a/Demo/AppController.m b/Demo/AppController.m index d413fd5..c57e4fc 100644 --- a/Demo/AppController.m +++ b/Demo/AppController.m @@ -28,27 +28,12 @@ #import #import #import -#import #import "DemoOpenGLView.h" #import "AppController.h" @implementation AppController -(void)applicationDidFinishLaunching: (NSNotification*)aNote { -#if GNUSTEP - NSMenu * menu = [[NSMenu alloc] initWithTitle: @"Main Menu"]; - - [menu addItemWithTitle: @"GSQCDemo" - action: @selector(orderFrontStandardAboutPanel:) - keyEquivalent: @""]; - [menu addItemWithTitle: @"Quit" - action: @selector(terminate:) - keyEquivalent: @"q"]; - - [NSApp setMainMenu: menu]; - [menu release]; -#endif - _window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0,0,800,600) styleMask: NSTitledWindowMask | NSClosableWindowMask backing: NSBackingStoreBuffered diff --git a/Demo/DemoOpenGLView.m b/Demo/DemoOpenGLView.m index 6efa368..a522211 100644 --- a/Demo/DemoOpenGLView.m +++ b/Demo/DemoOpenGLView.m @@ -138,7 +138,7 @@ - (void) prepareOpenGL CALayer * layer = [CALayer layer]; [_renderer setLayer: layer]; [layer setBounds: NSRectToCGRect([self bounds])]; - [layer setBackgroundColor: whiteColor]; + [layer setBackgroundColor: whiteColor]; CGPoint midPos = CGPointMake([_renderer bounds].size.width/2, [_renderer bounds].size.height/2); [layer setPosition: midPos]; diff --git a/Demo/QuartzCoreDemoInfo.plist b/Demo/QuartzCoreDemoInfo.plist index 363f878..2ceac82 100644 --- a/Demo/QuartzCoreDemoInfo.plist +++ b/Demo/QuartzCoreDemoInfo.plist @@ -1,6 +1,6 @@ { ApplicationDescription = "Demonstration of GNUstep QuartzCore"; - ApplicationName = GSQuartzCoreDemo; + ApplicationName = QuartzCoreDemo; ApplicationRelease = 1.0; Authors = ( "Ivan Vucica " @@ -8,7 +8,7 @@ Copyright = "Copyright (C) 2012 Free Software Foundation"; CopyrightDescription = "Released under GNU Lesser General Public License v2.1 or later"; FullVersionID = 1.0; - NSExecutable = GSQuartzCoreDemo; + NSExecutable = QuartzCoreDemo; NSPrincipalClass = NSApplication; NSRole = Application; URL = "http://www.gnustep.org/"; diff --git a/Source/CALayer.m b/Source/CALayer.m index 988b861..a4a0e0e 100644 --- a/Source/CALayer.m +++ b/Source/CALayer.m @@ -273,7 +273,7 @@ - (id) init _observedKeyPaths = [[NSMutableArray alloc] init]; _dynamicPropertyValueDict = [[NSMutableDictionary alloc] init]; - /* TODO: list all properties below */ + /* All properties that need default values set */ static NSString * keys[] = { @"anchorPoint", @"transform", @"sublayerTransform", @"opacity", @"delegate", @"contentsRect", @"shouldRasterize", @@ -287,25 +287,20 @@ - (id) init @"bounds", @"position" }; + /* Struct-typed properties must NOT be observed via KVO because + GNUstep's KVO generates setter overrides that corrupt struct + arguments passed by value through objc_msgSend. The custom + GSCA_OBSERVABLE_SETTER macro and the manual setBounds: method + already emit willChange/didChange notifications directly. */ + static NSString * structKeys[] = { + @"anchorPoint", @"transform", @"sublayerTransform", + @"contentsRect", @"shadowOffset", @"bounds", @"position" }; + for (int i = 0; i < sizeof(keys)/sizeof(keys[0]); i++) { id defaultValue = [[self class] defaultValueForKey: keys[i]]; if (defaultValue) { - - #if 0 - NSString * setter = [NSString stringWithFormat:@"set%@%@:", [[keys[i] substringToIndex: 1] uppercaseString], [keys[i] substringFromIndex: 1]]; - - if (![self respondsToSelector: NSSelectorFromString(setter)]) - { - NSLog(@"Key %@ is missing setter", keys[i]); - } - else - { - NSLog(@"setter %@ found", setter); - } - #endif - if ([@"shadowOffset" isEqualToString: keys[i]]) { /* TODO(ivucica): remove this block once #53994 is resolved */ @@ -320,6 +315,24 @@ - (id) init [self setShadowOffset: [defaultValue sizeValue]]; NS_ENDHANDLER } + else if ([@"transform" isEqualToString: keys[i]]) + { + NS_DURING + [self setValue: defaultValue + forKey: keys[i]]; + NS_HANDLER + [self setTransform: [defaultValue CATransform3DValue]]; + NS_ENDHANDLER + } + else if ([@"sublayerTransform" isEqualToString: keys[i]]) + { + NS_DURING + [self setValue: defaultValue + forKey: keys[i]]; + NS_HANDLER + [self setSublayerTransform: [defaultValue CATransform3DValue]]; + NS_ENDHANDLER + } else { [self setValue: defaultValue @@ -327,15 +340,30 @@ - (id) init } } - /* implicit animations support */ - /* TODO: only animatable properties should be observed */ - /* TODO: @dynamically created properties also need to be - set up and observed. */ - [self addObserver: [CAImplicitAnimationObserver sharedObserver] - forKeyPath: keys[i] - options: NSKeyValueObservingOptionOld - context: nil]; - [_observedKeyPaths addObject: keys[i]]; + /* Set up KVO observation for non-struct properties only */ + BOOL isStructKey = NO; + for (int j = 0; j < sizeof(structKeys)/sizeof(structKeys[0]); j++) + { + if ([keys[i] isEqualToString: structKeys[j]]) + { + isStructKey = YES; + break; + } + } + if (!isStructKey) + { + NS_DURING + [self addObserver: [CAImplicitAnimationObserver sharedObserver] + forKeyPath: keys[i] + options: NSKeyValueObservingOptionOld + context: nil]; + [_observedKeyPaths addObject: keys[i]]; + NS_HANDLER + /* Some property types (e.g. CGColorRef) may not support + automatic KVO observation. Properties with custom setters + handle change notifications directly. */ + NS_ENDHANDLER + } } }