From 00418ee526c7a16c322622cf30ba4172a5aaaf4c Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 31 Oct 2000 12:47:09 +0000 Subject: [PATCH] Added some fixes for Apple runtime git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7940 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 15 ++++++++++++++- Source/GSServicesManager.m | 5 ++--- Source/GSTextStorage.m | 35 +++++++++++++++++++---------------- Source/NSAttributedString.m | 4 +++- Source/NSMatrix.m | 13 +++++++++---- Source/NSStringDrawing.m | 4 +++- Source/NSView.m | 11 +++++++---- Source/NSWindow.m | 6 ++++-- 8 files changed, 61 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b257bad8..2667874f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,23 @@ +2000-10-31 Richard Frith-Macdonald + + * Source/GSServicesManager.m: Use new GSObjCClassOfObject() function + from NSObjCRuntime.h + * Source/GSTextStorage.m: Avoid static variable initialisation with + @selector() as it doesn't work with Apple runtime. + * Source/NSAttributedString.m: ditto + * Source/NSMatrix.m: ditto + * Source/NSStringDrawing.m: ditto + * Source/NSView.m: ditto + * Source/NSWindow.m: ditto + 2000-10-24 Fred Kiefer * Source/GSSimpleLayoutManager.m: _GNULineLayoutInfo has new ivar usedRect. Simplified the code a bit. * Source/NSText.m: [buildUpTextNetwork:] The text container no longer tracks its view by default. - [initWithFrame:textContainer:] the view is no longer resizable by default. + [initWithFrame:textContainer:] the view is no longer resizable by + default. * Source/NSTextContainer.m: [setContainerSize:] only informs layout manager if really changed. * Source/Parser/attributedStringConsumer.m diff --git a/Source/GSServicesManager.m b/Source/GSServicesManager.m index 7661bdc7f..6a28b74a5 100644 --- a/Source/GSServicesManager.m +++ b/Source/GSServicesManager.m @@ -45,8 +45,7 @@ #include #include #include - -#include +#include #include #include @@ -1271,7 +1270,7 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard) [connection setRequestTimeout: seconds]; [connection setReplyTimeout: seconds]; - msgImp = get_imp(fastClass(provider), msgSel); + msgImp = get_imp(GSObjCClassOfObject(provider), msgSel); NS_DURING { [provider performService: selName diff --git a/Source/GSTextStorage.m b/Source/GSTextStorage.m index 47aa21603..861105493 100644 --- a/Source/GSTextStorage.m +++ b/Source/GSTextStorage.m @@ -119,23 +119,19 @@ static Class infCls = 0; -static SEL infSel = @selector(newWithZone:value:at:); -static IMP infImp = 0; +static SEL infSel; +static SEL addSel; +static SEL cntSel; +static SEL insSel; +static SEL oatSel; +static SEL remSel; -static SEL addSel = @selector(addObject:); -static void (*addImp)() = 0; - -static SEL cntSel = @selector(count); -static unsigned (*cntImp)() = 0; - -static SEL insSel = @selector(insertObject:atIndex:); -static void (*insImp)() = 0; - -static SEL oatSel = @selector(objectAtIndex:); -static IMP oatImp = 0; - -static SEL remSel = @selector(removeObjectAtIndex:); -static void (*remImp)() = 0; +static IMP infImp; +static void (*addImp)(); +static unsigned (*cntImp)(); +static void (*insImp)(); +static IMP oatImp; +static void (*remImp)(); #define NEWINFO(Z,O,L) ((*infImp)(infCls, infSel, (Z), (O), (L))) #define ADDOBJECT(O) ((*addImp)(infoArray, addSel, (O))) @@ -155,6 +151,13 @@ static void _setup() { NSMutableArray *a; + infSel = @selector(newWithZone:value:at:); + addSel = @selector(addObject:); + cntSel = @selector(count); + insSel = @selector(insertObject:atIndex:); + oatSel = @selector(objectAtIndex:); + remSel = @selector(removeObjectAtIndex:); + infCls = [GSTextInfo class]; infImp = [infCls methodForSelector: infSel]; diff --git a/Source/NSAttributedString.m b/Source/NSAttributedString.m index e2df6d2b8..8b4259b2d 100644 --- a/Source/NSAttributedString.m +++ b/Source/NSAttributedString.m @@ -121,7 +121,7 @@ static NSString *attachmentString() - (NSDictionary*) fontAttributesInRange: (NSRange)range { NSDictionary *all; - static SEL sel = @selector(objectForKey:); + static SEL sel = 0; IMP objForKey; id objects[8]; id keys[8]; @@ -135,6 +135,8 @@ static NSString *attachmentString() all = [self attributesAtIndex: range.location effectiveRange: &range]; + if (sel == 0) + sel = @selector(objectForKey:); objForKey = [all methodForSelector: sel]; keys[count] = NSFontAttributeName; diff --git a/Source/NSMatrix.m b/Source/NSMatrix.m index ab99eb3b3..0a43b564e 100644 --- a/Source/NSMatrix.m +++ b/Source/NSMatrix.m @@ -131,10 +131,10 @@ enum { /* Class variables */ static Class defaultCellClass = nil; static int mouseDownFlags = 0; -static SEL copySel = @selector(copyWithZone:); -static SEL initSel = @selector(init); -static SEL allocSel = @selector(allocWithZone:); -static SEL getSel = @selector(objectAtIndex:); +static SEL copySel; +static SEL initSel; +static SEL allocSel; +static SEL getSel; + (void) initialize { @@ -143,6 +143,11 @@ static SEL getSel = @selector(objectAtIndex:); /* Set the initial version */ [self setVersion: 1]; + copySel = @selector(copyWithZone:); + initSel = @selector(init); + allocSel = @selector(allocWithZone:); + getSel = @selector(objectAtIndex:); + /* * MacOS-X docs say default cell class is NSActionCell */ diff --git a/Source/NSStringDrawing.m b/Source/NSStringDrawing.m index 900ac86d9..f77b4e59f 100644 --- a/Source/NSStringDrawing.m +++ b/Source/NSStringDrawing.m @@ -49,7 +49,7 @@ static NSFont *defFont; static NSParagraphStyle *defStyle; static NSColor *defFgCol; static NSColor *defBgCol; -static SEL advSel = @selector(advancementForGlyph:); +static SEL advSel; /* * Thne 'checkInit()' function is called to ensure that any static @@ -65,6 +65,8 @@ checkInit() NSMutableCharacterSet *ms; NSCharacterSet *whitespace; + advSel = @selector(advancementForGlyph:); + whitespace = RETAIN([NSCharacterSet whitespaceCharacterSet]); /* diff --git a/Source/NSView.m b/Source/NSView.m index 48957e988..f6ad6a184 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -70,11 +70,11 @@ static Class viewClass; static NSAffineTransform *flip = nil; -static void (*appImp)(NSAffineTransform*, SEL, NSAffineTransform*) = 0; -static SEL appSel = @selector(appendTransform:); +static SEL appSel; +static SEL invalidateSel; -static void (*invalidateImp)(NSView*, SEL) = 0; -static SEL invalidateSel = @selector(_invalidateCoordinates); +static void (*appImp)(NSAffineTransform*, SEL, NSAffineTransform*); +static void (*invalidateImp)(NSView*, SEL); /* * Stuff to maintain a map table so we know what views are @@ -156,6 +156,9 @@ GSSetDragTypes(NSView* obj, NSArray *types) NSObjectMapValueCallBacks, 0); typesLock = [NSLock new]; + appSel = @selector(appendTransform:); + invalidateSel = @selector(_invalidateCoordinates); + appImp = (void (*)(NSAffineTransform*, SEL, NSAffineTransform*)) [matrixClass instanceMethodForSelector: appSel]; diff --git a/Source/NSWindow.m b/Source/NSWindow.m index f3a214ef6..24fe7e9b9 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -391,8 +391,8 @@ typedef struct NSView_struct /* * Class variables */ -static SEL ccSel = @selector(_checkCursorRectangles:forEvent:); -static SEL ctSel = @selector(_checkTrackingRectangles:forEvent:); +static SEL ccSel; +static SEL ctSel; static IMP ccImp; static IMP ctImp; static Class responderClass; @@ -410,6 +410,8 @@ static NSMapTable* windowmaps = NULL; { NSDebugLog(@"Initialize NSWindow class\n"); [self setVersion: 2]; + ccSel = @selector(_checkCursorRectangles:forEvent:); + ctSel = @selector(_checkTrackingRectangles:forEvent:); ccImp = [self instanceMethodForSelector: ccSel]; ctImp = [self instanceMethodForSelector: ctSel]; responderClass = [NSResponder class];