Use protocols

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@17249 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-07-17 13:22:02 +00:00
parent c306047b9c
commit 163b49ab9e
2 changed files with 46 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2003-07-27 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/gpbs.m: Use protocols
2003-07-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServer.m

View file

@ -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 <GSPasteboardCallback>
- (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