From 163b49ab9e191299ebf0b928b887ee4ab9aac012 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Thu, 17 Jul 2003 13:22:02 +0000 Subject: [PATCH] Use protocols git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@17249 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 4 ++++ Tools/gpbs.m | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6340438..ce58e1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-07-27 Richard Frith-Macdonald + + * Tools/gpbs.m: Use protocols + 2003-07-16 Fred Kiefer * Source/x11/XGServer.m diff --git a/Tools/gpbs.m b/Tools/gpbs.m index 10bf362..9c5bb53 100644 --- a/Tools/gpbs.m +++ b/Tools/gpbs.m @@ -583,6 +583,13 @@ NSMutableDictionary *pasteboards = nil; { PasteboardEntry *e = [self entryByCount: count]; + if ([owner isProxy] == YES) + { + Protocol *p = @protocol(GSPasteboardCallback); + + [owner setProtocolForProxy: p]; + } + if (e) { id x = [xPbClass ownerByOsPb: name]; @@ -702,6 +709,12 @@ NSMutableDictionary *pasteboards = nil; PasteboardEntry *old = RETAIN(current); id x = [xPbClass ownerByOsPb: name]; + if ([owner isProxy] == YES) + { + Protocol *p = @protocol(GSPasteboardCallback); + + [owner setProtocolForProxy: p]; + } /* * If neither the new nor the old owner of the pasteboard is the X * pasteboard owner corresponding to this pasteboard, we will need @@ -1226,3 +1239,32 @@ main(int argc, char** argv, char **env) exit(EXIT_SUCCESS); } +/* + * The following dummy classe is here solely as a workaround for pre 3.3 + * versions of gcc where protocols didn't work properly unless implemented + * in the source where the '@protocol()' directive is used. + */ +@interface NSPasteboardOwnerDummy : NSObject +- (void) pasteboard: (NSPasteboard*)pb + provideDataForType: (NSString*)type; +- (void) pasteboard: (NSPasteboard*)pb + provideDataForType: (NSString*)type + andVersion:(int)v; +- (void) pasteboardChangedOwner: (NSPasteboard*)pb; +@end + +@implementation NSPasteboardOwnerDummy +- (void) pasteboard: (NSPasteboard*)pb + provideDataForType: (NSString*)type +{ +} +- (void) pasteboard: (NSPasteboard*)pb + provideDataForType: (NSString*)type + andVersion:(int)v +{ +} +- (void) pasteboardChangedOwner: (NSPasteboard*)pb +{ +} +@end +