| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent edeea04 commit cb85244
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,8 +41,13 @@ Copyright (C) 1994 Steen Lumholt. | |||
| 41 | 41 | #define MAC_TCL | |
| 42 | 42 | #endif | |
| 43 | 43 | ||
| 44 | + #ifdef TK_FRAMEWORK | ||
| 45 | + #include <Tcl/tcl.h> | ||
| 46 | + #include <Tk/tk.h> | ||
| 47 | + #else | ||
| 44 | 48 | #include <tcl.h> | |
| 45 | 49 | #include <tk.h> | |
| 50 | + #endif | ||
| 46 | 51 | ||
| 47 | 52 | #define TKMAJORMINOR (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) | |
| 48 | 53 | ||
@@ -454,6 +459,7 @@ Tkapp_New(char *screenName, char *baseName, char *className, int interactive) | |||
| 454 | 459 | ClearMenuBar(); | |
| 455 | 460 | TkMacInitMenus(v->interp); | |
| 456 | 461 | #endif | |
| 462 | + | ||
| 457 | 463 | /* Delete the 'exit' command, which can screw things up */ | |
| 458 | 464 | Tcl_DeleteCommand(v->interp, "exit"); | |
| 459 | 465 | ||
@@ -1580,7 +1586,7 @@ Tktt_Repr(PyObject *self) | |||
| 1580 | 1586 | char buf[100]; | |
| 1581 | 1587 | ||
| 1582 | 1588 | PyOS_snprintf(buf, sizeof(buf), "<tktimertoken at %p%s>", v, | |
| 1583 | - v->func == NULL ? ", handler deleted" : ""); | ||
| 1589 | + v->func == NULL ? ", handler deleted" : ""); | ||
| 1584 | 1590 | return PyString_FromString(buf); | |
| 1585 | 1591 | } | |
| 1586 | 1592 | ||
@@ -2137,6 +2143,22 @@ init_tkinter(void) | |||
| 2137 | 2143 | Tktt_Type.ob_type = &PyType_Type; | |
| 2138 | 2144 | PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type); | |
| 2139 | 2145 | ||
| 2146 | + | ||
| 2147 | + #ifdef TK_AQUA | ||
| 2148 | + /* Tk_MacOSXSetupTkNotifier must be called before Tcl's subsystems | ||
| 2149 | + * start waking up. Note that Tcl_FindExecutable will do this, this | ||
| 2150 | + * code must be above it! The original warning from | ||
| 2151 | + * tkMacOSXAppInit.c is copied below. | ||
| 2152 | + * | ||
| 2153 | + * NB - You have to swap in the Tk Notifier BEFORE you start up the | ||
| 2154 | + * Tcl interpreter for now. It probably should work to do this | ||
| 2155 | + * in the other order, but for now it doesn't seem to. | ||
| 2156 | + * | ||
| 2157 | + */ | ||
| 2158 | + Tk_MacOSXSetupTkNotifier(); | ||
| 2159 | + #endif | ||
| 2160 | + | ||
| 2161 | + | ||
| 2140 | 2162 | /* This helps the dynamic loader; in Unicode aware Tcl versions | |
| 2141 | 2163 | it also helps Tcl find its encodings. */ | |
| 2142 | 2164 | Tcl_FindExecutable(Py_GetProgramName()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,13 +20,64 @@ Tcl_AppInit(Tcl_Interp *interp) | |||
| 20 | 20 | { | |
| 21 | 21 | Tk_Window main_window; | |
| 22 | 22 | ||
| 23 | + #ifdef TK_AQUA | ||
| 24 | + #ifndef MAX_PATH_LEN | ||
| 25 | + #define MAX_PATH_LEN 1024 | ||
| 26 | + #endif | ||
| 27 | + char tclLibPath[MAX_PATH_LEN], tkLibPath[MAX_PATH_LEN]; | ||
| 28 | + Tcl_Obj* pathPtr; | ||
| 29 | + | ||
| 30 | + /* pre- Tcl_Init code copied from tkMacOSXAppInit.c */ | ||
| 31 | + Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tcllibrary", | ||
| 32 | + tclLibPath, MAX_PATH_LEN, 0); | ||
| 33 | + | ||
| 34 | + if (tclLibPath[0] != '\0') { | ||
| 35 | + Tcl_SetVar(interp, "tcl_library", tclLibPath, TCL_GLOBAL_ONLY); | ||
| 36 | + Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY); | ||
| 37 | + Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + if (tclLibPath[0] != '\0') { | ||
| 41 | + Tcl_SetVar(interp, "tcl_library", tclLibPath, TCL_GLOBAL_ONLY); | ||
| 42 | + Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY); | ||
| 43 | + Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY); | ||
| 44 | + } | ||
| 45 | + #endif | ||
| 23 | 46 | if (Tcl_Init (interp) == TCL_ERROR) | |
| 24 | 47 | return TCL_ERROR; | |
| 48 | + | ||
| 49 | + #ifdef TK_AQUA | ||
| 50 | + /* pre- Tk_Init code copied from tkMacOSXAppInit.c */ | ||
| 51 | + Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tklibrary", | ||
| 52 | + tkLibPath, MAX_PATH_LEN, 1); | ||
| 53 | + | ||
| 54 | + if (tclLibPath[0] != '\0') { | ||
| 55 | + pathPtr = Tcl_NewStringObj(tclLibPath, -1); | ||
| 56 | + } else { | ||
| 57 | + Tcl_Obj *pathPtr = TclGetLibraryPath(); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + if (tkLibPath[0] != '\0') { | ||
| 61 | + Tcl_Obj *objPtr; | ||
| 62 | + | ||
| 63 | + Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY); | ||
| 64 | + objPtr = Tcl_NewStringObj(tkLibPath, -1); | ||
| 65 | + Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + TclSetLibraryPath(pathPtr); | ||
| 69 | + #endif | ||
| 70 | + | ||
| 25 | 71 | if (Tk_Init (interp) == TCL_ERROR) | |
| 26 | 72 | return TCL_ERROR; | |
| 27 | 73 | ||
| 28 | 74 | main_window = Tk_MainWindow(interp); | |
| 29 | 75 | ||
| 76 | + #ifdef TK_AQUA | ||
| 77 | + TkMacOSXInitAppleEvents(interp); | ||
| 78 | + TkMacOSXInitMenus(interp); | ||
| 79 | + #endif | ||
| 80 | + | ||
| 30 | 81 | #ifdef WITH_MOREBUTTONS | |
| 31 | 82 | { | |
| 32 | 83 | extern Tcl_CmdProc studButtonCmd; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments