Permalink
Browse files

LinkBack 1.0.1 from <http://linkbackproject.org/files/LinkBack-101.zip>

  • Loading branch information...
1 parent 544c9ac commit a6bc51cf24c6302b7ed13052e4a000981baea236 @tjw tjw committed May 18, 2010
View
@@ -0,0 +1,16 @@
+{\rtf1\mac\ansicpg10000\cocoartf809
+{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+{\info}\margl1440\margr1440\vieww9000\viewh8400\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
+
+\f0\b\fs24 \cf0 LinkBack Release Notes\
+
+\f1\b0 \
+LinkBack: \
+\
+LinkBack: version number included in linkback data \
+\
+LiveSketch: SKTGraphicView.m:1067 -- LiveSketch did not declare the LinkBackPboardType during a copy operation. This did not cause incorrect behavior, but it was technically incorrect.\
+ \
+1.0alpha -- initial public release}
@@ -1064,7 +1064,7 @@ - (IBAction)copy:(id)sender {
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
id dta ;
- [pboard declareTypes:[NSArray arrayWithObjects:SKTDrawDocumentType, NSTIFFPboardType, NSPDFPboardType, nil] owner:nil];
+ [pboard declareTypes:[NSArray arrayWithObjects:SKTDrawDocumentType, NSTIFFPboardType, NSPDFPboardType, LinkBackPboardType, nil] owner:nil];
dta = [document drawDocumentDataForGraphics:orderedSelection] ;
[pboard setData: dta forType:SKTDrawDocumentType];
View
@@ -52,7 +52,7 @@ id MakeLinkBackData(NSString* serverName, id appData)
{
NSMutableDictionary* ret = [[NSMutableDictionary alloc] init] ;
NSString* bundleId = [[NSBundle mainBundle] bundleIdentifier] ;
- id version = @"alpha.01" ;
+ id version = @"A" ;
[ret setObject: bundleId forKey: LinkBackServerBundleIdentifierKey];
[ret setObject: serverName forKey: LinkBackServerNameKey] ;
View
@@ -71,18 +71,35 @@ + (BOOL)publishServerWithName:(NSString*)aName delegate:(id<LinkBackServerDelega
+ (LinkBackServer*)LinkBackServerWithName:(NSString*)aName inApplication:(NSString*)bundleIdentifier launchIfNeeded:(BOOL)flag
{
- NSString* serverName = MakeLinkBackServerName(bundleIdentifier, aName) ;
- id ret ;
+ NSString* serverName = MakeLinkBackServerName(bundleIdentifier, aName) ;
+ id ret = nil ;
+ NSTimeInterval tryMark ;
+
+ // Let see if its already running
+ BOOL appLaunched = FALSE;
+ NSArray *appsArray = [[NSWorkspace sharedWorkspace] launchedApplications];
+ NSEnumerator *appsArrayEnumerator = [appsArray objectEnumerator];
+ NSDictionary *appDict;
+ NSString *appBundleIdentifier;
+ while (appDict = [appsArrayEnumerator nextObject])
+ {
+ appBundleIdentifier = [appDict objectForKey:@"NSApplicationBundleIdentifier"];
+ if((appBundleIdentifier) && ([appBundleIdentifier isEqualToString:bundleIdentifier]))
+ appLaunched = TRUE;
+ }
+
+ // if flag, and not launched try to launch.
+ if((!appLaunched) && (flag))
+ [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier: bundleIdentifier options: (NSWorkspaceLaunchWithoutAddingToRecents | NSWorkspaceLaunchWithoutActivation) additionalEventParamDescriptor: nil launchIdentifier: nil] ;
- // if flag, try to launch. If the app is already launched, this method will do nothing anyway.
- [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier: bundleIdentifier options: (NSWorkspaceLaunchWithoutAddingToRecents | NSWorkspaceLaunchWithoutActivation) additionalEventParamDescriptor: nil launchIdentifier: nil] ;
-
- // now, try to connect
- ret = [NSConnection rootProxyForConnectionWithRegisteredName: serverName host: nil] ;
+ // now, try to connect. retry connection for a while if we did not succeed at first. This gives the app time to launch.
+ tryMark = [NSDate timeIntervalSinceReferenceDate] ;
+ do {
+ ret = [NSConnection rootProxyForConnectionWithRegisteredName: serverName host: nil] ;
+ } while ((!ret) && (([NSDate timeIntervalSinceReferenceDate]-tryMark)<10)) ;
+
[ret setProtocolForProxy: @protocol(LinkBackServer)] ;
- // MAY NEED TO RETRY HERE, esp if launching app.
-
return ret ;
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Binary file not shown.

0 comments on commit a6bc51c

Please sign in to comment.