ui_cocoa: cast [CocoaView get] to (NSView*) before setFrame:

GCC 4.0 (Xcode 3.1, PowerPC) reports:

    ui_cocoa.m:629: error: incompatible type for argument 1
        of 'setFrame:'

cocoa_common.h pulls in <QuartzCore/QuartzCore.h>, which declares
CALayer's -(void)setFrame:(CGRect).  NSView also declares -(void)
setFrame:(NSRect).  On 32-bit 10.5, NSRect and CGRect are separate,
incompatible types — Apple only unified them on LP64 (NS_BUILD_32_
LIKE_64 changes the 32-bit behavior).

GCC 4.0's Objective-C method picker, when faced with two visible
setFrame: selectors, doesn't always disambiguate based on the
receiver's static type.  It picked CALayer's CGRect variant and
rejected the NSRect that [[self.window contentView] bounds]
returned.  Modern clang resolves this correctly.

Add an explicit (NSView*) cast on the receiver so the compiler
unambiguously picks the NSView variant.  Zero runtime change.
The neighboring _renderView call at line 726 doesn't need the same
treatment because _renderView is already declared as NSView*.
This commit is contained in:
U-DESKTOP-SPFP6AQ\twistedtechre committed 2026-04-21 01:49:45 +02:00
1 parent c49a5258c6
commit 47a7fd4804
1 file changed
+1 -1
+1 -1
View File
@@ -626,7 +626,7 @@ static ui_application_t ui_application_cocoa = {
[self.window setNextResponder:_listener];
self.window.delegate = _listener;
#else
[[CocoaView get] setFrame: [[self.window contentView] bounds]];
[(NSView*)[CocoaView get] setFrame: [[self.window contentView] bounds]];
#endif
[[self.window contentView] setAutoresizesSubviews:YES];