summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXInit.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r--macosx/tkMacOSXInit.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index b21e95e..3efe0c6 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -116,6 +116,7 @@ static char scriptPath[PATH_MAX + 1] = "";
-(void)applicationDidFinishLaunching:(NSNotification *)notification
{
+
/*
* It is not safe to force activation of the NSApp until this method is
* called. Activating too early can cause the menu bar to be unresponsive.
@@ -335,7 +336,7 @@ TkpInit(
* immediately since the queue is empty.
*/
- Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT);
+ Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT);
/*
* If we don't have a TTY and stdin is a special character file of
@@ -383,8 +384,19 @@ TkpInit(
Tcl_CreateObjCommand(interp, "::tk::mac::standardAboutPanel",
TkMacOSXStandardAboutPanelObjCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::mac::registerServiceWidget",
+ TkMacOSXRegisterServiceWidgetObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap",
TkMacOSXIconBitmapObjCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
+
+ /*
+ * Initialize the NSServices object here. Apple's docs say to do this
+ * in applicationDidFinishLaunching, but the Tcl interpreter is not
+ * initialized until this function call.
+ */
+
+ TkMacOSXServices_Init(interp);
return TCL_OK;
}
@@ -425,7 +437,58 @@ TkpGetAppName(
}
Tcl_DStringAppend(namePtr, name, -1);
}
-
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetAppPath --
+ *
+ * Returns the path of the Wish application bundle.
+ *
+ * Results:
+ * Returns the application 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 = (char *) CFStringGetCStringPtr(appPath, encodingMethod);
+
+ Tcl_SetResult(ip, path, NULL);
+
+ CFRelease(mainBundleURL);
+ CFRelease(appPath);
+ return TCL_OK;
+
+}
+
/*
*----------------------------------------------------------------------
*