diff options
author | Kevin Walzer <kw@codebykevin.com> | 2019-05-01 01:59:36 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2019-05-01 01:59:36 (GMT) |
commit | f2e474c490d3e21f6da71c54ed1d1c621af226af (patch) | |
tree | b611e971647009680f0c5c74ef35b794be8d52dd | |
parent | 875c761e95dc11b10766063e506305bf9e47cfdd (diff) | |
download | tk-f2e474c490d3e21f6da71c54ed1d1c621af226af.zip tk-f2e474c490d3e21f6da71c54ed1d1c621af226af.tar.gz tk-f2e474c490d3e21f6da71c54ed1d1c621af226af.tar.bz2 |
Removal of needlessly large buffer for services script, thanks to Marc Culler for patch
-rw-r--r-- | macosx/tkMacOSXServices.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c index ade4747..a928df3 100644 --- a/macosx/tkMacOSXServices.c +++ b/macosx/tkMacOSXServices.c @@ -17,19 +17,14 @@ static Tcl_Interp *ServicesInterp; /* - * These two assist with asynchronous Tcl proc calling. + * Event proc which calls the PerformService procedure */ -typedef struct Services_Event { - Tcl_Event header; - char script[50000]; -} Services_Event; - int ServicesEventProc( Tcl_Event *event, int flags) { - Tcl_GlobalEval(ServicesInterp, ((Services_Event *)event)->script); + Tcl_GlobalEval(ServicesInterp, "::tk::mac::PerformService"); return 1; } @@ -110,7 +105,7 @@ int ServicesEventProc( /* * This is the method that actually calls the Tk service; this is the method - * that must be defined in info.plist + * that must be defined in info.plist. */ - (void)provideService:(NSPasteboard *)pboard @@ -119,7 +114,7 @@ int ServicesEventProc( { NSString *pboardString; NSArray *types = [pboard types]; - Services_Event *event; + Tcl_Event *event; /* * Get string from private pasteboard, write to general pasteboard to make @@ -133,14 +128,10 @@ int ServicesEventProc( [generalpasteboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:nil]; [generalpasteboard setString:pboardString forType:NSStringPboardType]; - event = (Services_Event *)ckalloc(sizeof(Services_Event)); - event->header.proc = ServicesEventProc; - strcpy(event->script, "::tk::mac::PerformService"); + event = ckalloc(sizeof(Tcl_Event)); + event->proc = ServicesEventProc; Tcl_QueueEvent((Tcl_Event *)event, TCL_QUEUE_TAIL); - } else { - return; } - return; } @end @@ -203,7 +194,7 @@ int TkMacOSXRegisterServiceWidgetObjCmd ( frame = NSMakeRect(bounds.left, bounds.top, 100000, 100000); frame.origin.y = 0; if (!NSEqualRects(frame, [serviceview frame])) { - [serviceview setFrame:frame]; + [serviceview setFrame:frame]; } [serviceview release]; [pool release]; |