summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2019-03-09 03:16:05 (GMT)
committerKevin Walzer <kw@codebykevin.com>2019-03-09 03:16:05 (GMT)
commitf56def12413b4e64d7208e14287fc2dc7c455d85 (patch)
treeb90b73c40c773a75eeb3231c5080977a510ccd67
parent8579cbea202b7f81f0f89ea380112c2945e532e9 (diff)
downloadtk-f56def12413b4e64d7208e14287fc2dc7c455d85.zip
tk-f56def12413b4e64d7208e14287fc2dc7c455d85.tar.gz
tk-f56def12413b4e64d7208e14287fc2dc7c455d85.tar.bz2
Ensure ::tk::mac::GetAppPath is included
-rw-r--r--macosx/tkMacOSXInit.c88
-rw-r--r--macosx/tkMacOSXServices.c5
2 files changed, 41 insertions, 52 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index e559bfc..d61fddf 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -133,6 +133,8 @@ static char scriptPath[PATH_MAX + 1] = "";
[NSApp _lockAutoreleasePool];
while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT)) {}
[NSApp _unlockAutoreleasePool];
+
+ Tk_MacOSXServices_Init(_eventInterp);
}
- (void) _setup: (Tcl_Interp *) interp
@@ -374,8 +376,6 @@ TkpInit(
TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE);
}
- Tk_MacOSXServices_Init(interp);
-
Tcl_CreateObjCommand(interp, "::tk::mac::standardAboutPanel",
TkMacOSXStandardAboutPanelObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::registerServiceWidget",
@@ -383,15 +383,6 @@ TkpInit(
Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap",
TkMacOSXIconBitmapObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
-
-
- /*
- * Workaround for 3efbe4a397; console not accepting keyboard input on 10.14
- * if displayed before main window. This places console in background and it
- * accepts input after being raised.
- */
-
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
return TCL_OK;
}
@@ -432,6 +423,43 @@ TkpGetAppName(
}
Tcl_DStringAppend(namePtr, name, -1);
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetAppPath --
+ *
+ * Returns the path of the Wish application bundle.
+ *
+ * Results:
+ * Returns the application path.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ *//*Tcl function to get path to app bundle.*/
+int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *CONST objv[]) {
+
+ CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle());
+
+
+ /* Convert the URL reference into a string reference. */
+ CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
+
+ /* Get the system encoding method. */
+ CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
+
+ /* Convert the string reference into a C string. */
+ char *path = CFStringGetCStringPtr(appPath, encodingMethod);
+
+ Tcl_SetResult(ip, path, NULL);
+
+ CFRelease(mainBundleURL);
+ CFRelease(appPath);
+ return TCL_OK;
+
+}
/*
*----------------------------------------------------------------------
@@ -585,44 +613,6 @@ TkMacOSXGetStringObjFromCFString(
}
return obj;
}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacOSXGetAppPath --
- *
- * Retrieves the path to the current installed Wish application.
- *
- * Results:
- * Returns the application name path.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *CONST objv[]) {
-
- CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle());
-
-
- /* Convert the URL reference into a string reference. */
- CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
-
- /* Get the system encoding method. */
- CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
-
- /* Convert the string reference into a C string. */
- char *path = CFStringGetCStringPtr(appPath, encodingMethod);
-
- Tcl_SetResult(ip, path, NULL);
-
- CFRelease(mainBundleURL);
- CFRelease(appPath);
- return TCL_OK;
-
-}
/*
* Local Variables:
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index d622081..1f053ca 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -80,7 +80,7 @@ int ServicesEventProc(Tcl_Event *event, int flags) {
return YES;
}
-//get selected text, copy to pasteboard
+/*Get selected text, copy to pasteboard.*/
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types {
NSArray *typesDeclared;
if ([types containsObject:NSStringPboardType] == NO) {
@@ -181,13 +181,12 @@ int Tk_MacOSXServices_Init (Tcl_Interp *interp) {
/* Set up an autorelease pool. */
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
/* Initialize instance of TclServices to provide service functionality. */
TkService *service = [[TkService alloc] init];
ServicesInterp = interp;
[NSApp setServicesProvider:service];
- [pool release];
+ [pool drain];
return TCL_OK;