From f44a70d4ecc621897eb723eb30c848cb6235fd9d Mon Sep 17 00:00:00 2001 From: IoI_xD Date: Mon, 13 Apr 2026 16:21:30 -0700 Subject: [PATCH] mac: untested code but i'll fall asleep at night with this in the codebase compared to the other thing --- include/Mw/LowLevel/Cocoa.h | 1 - src/backend/cocoa.m | 51 +++++++++---------------------------- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/include/Mw/LowLevel/Cocoa.h b/include/Mw/LowLevel/Cocoa.h index fc39b07..89e5f58 100644 --- a/include/Mw/LowLevel/Cocoa.h +++ b/include/Mw/LowLevel/Cocoa.h @@ -104,7 +104,6 @@ - (void)destroy; - (NSBitmapImageRep*)getRep; - (void)setChild; -- (void)drawRectSub:(NSRect)dirtyRect; @end @interface MilskoCocoaSubView : MilskoCocoaView { diff --git a/src/backend/cocoa.m b/src/backend/cocoa.m index dc30287..0f979b9 100644 --- a/src/backend/cocoa.m +++ b/src/backend/cocoa.m @@ -669,51 +669,24 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) { NSArray* subviews = [self subviews]; int i; - if(!self->rep) { - if(dirtyRect.size.width && dirtyRect.size.height) { - [self initRepAndContextWithWidth:dirtyRect.size.width - Height:dirtyRect.size.height]; - self->width = dirtyRect.size.width; - self->height = dirtyRect.size.height; - } else { - [pool release]; - return; - } + if(self->rep) { + [self->rep release]; + } + if(dirtyRect.size.width && dirtyRect.size.height) { + [self initRepAndContextWithWidth:dirtyRect.size.width + Height:dirtyRect.size.height]; + self->width = dirtyRect.size.width; + self->height = dirtyRect.size.height; + } else { + [pool release]; + return; } - if(!_child) - [self->rep drawInRect:[self bounds]]; + [self->rep drawInRect:[self bounds]]; - for(i = 0; i < [subviews count]; i++) { - MilskoCocoaView* subview = [subviews objectAtIndex:i]; - NSRect bounds = [subview bounds]; - if([subview respondsToSelector:@selector(drawRectSub:)]) { - [subview drawRectSub:bounds]; - } - } [pool release]; } -- (void)drawRectSub:(NSRect)dirtyRect { - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - - if(!self->rep) { - if(dirtyRect.size.width && dirtyRect.size.height) { - [self initRepAndContextWithWidth:dirtyRect.size.width - Height:dirtyRect.size.height]; - self->width = dirtyRect.size.width; - self->height = dirtyRect.size.height; - } else { - [pool release]; - return; - } - } - - [self->rep drawInRect:dirtyRect]; - - [pool release]; -}; - - (void)initRepAndContextWithWidth:(float)w Height:(float)h { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; self->rep =