summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-10-31 16:15:12 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-10-31 16:15:12 (GMT)
commit34cc5c31e8b9b1af15dd0c9b593806ef79299dfe (patch)
treec7b77a6c1eb05605a5d661796c0848bce4e00d04
parent81299f10f780655085bbceb9182d69f74802c7cf (diff)
downloadcpython-34cc5c31e8b9b1af15dd0c9b593806ef79299dfe.zip
cpython-34cc5c31e8b9b1af15dd0c9b593806ef79299dfe.tar.gz
cpython-34cc5c31e8b9b1af15dd0c9b593806ef79299dfe.tar.bz2
Fix to load needed resources on a mac
-rw-r--r--Modules/_tkinter.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 2e0a063..94bd729 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -5,6 +5,10 @@
#ifdef macintosh
#define MAC_TCL
+
+#include <CodeFragments.h>
+static int loaded_from_shlib = 0;
+static FSSpec library_fss;
#endif
#ifdef MAC_TCL
@@ -1271,6 +1275,9 @@ PyInit__tkinter ()
if (PyErr_Occurred ())
Py_FatalError ("can't initialize module _tkinter");
+#ifdef macintosh
+ mac_addlibresources();
+#endif
}
#ifdef macintosh
@@ -1289,4 +1296,37 @@ panic(char * format, ...)
Py_FatalError("Tcl/Tk panic");
}
+/*
+** If this module is dynamically loaded the following routine should
+** be the init routine. It takes care of adding the shared library to
+** the resource-file chain, so that the tk routines can find their
+** resources.
+*/
+OSErr pascal
+init_tkinter_shlib(InitBlockPtr data)
+{
+ if ( data == nil ) return noErr;
+ if ( data->fragLocator.where == kOnDiskFlat ) {
+ library_fss = *data->fragLocator.u.onDisk.fileSpec;
+ loaded_from_shlib = 1;
+ } else if ( data->fragLocator.where == kOnDiskSegmented ) {
+ library_fss = *data->fragLocator.u.inSegs.fileSpec;
+ loaded_from_shlib = 1;
+ }
+ return noErr;
+}
+
+/*
+** Insert the library resources into the search path. Put them after
+** the resources from the application. Again, we ignore errors.
+*/
+void
+mac_addlibresources()
+{
+ if ( !loaded_from_shlib )
+ return;
+ (void)FSpOpenResFile(&library_fss, fsRdPerm);
+}
+
+
#endif