diff options
author | wolfsuit <wolfsuit> | 2002-01-22 01:28:18 (GMT) |
---|---|---|
committer | wolfsuit <wolfsuit> | 2002-01-22 01:28:18 (GMT) |
commit | efc846c18b6df17d9dfd3b527214ec413d5f175f (patch) | |
tree | ea8643759449f0f1383e9132ea8ebf484c4feab1 | |
parent | d58ab8b77be18950aadcf67d1b2f99278c1c70e3 (diff) | |
download | tk-efc846c18b6df17d9dfd3b527214ec413d5f175f.zip tk-efc846c18b6df17d9dfd3b527214ec413d5f175f.tar.gz tk-efc846c18b6df17d9dfd3b527214ec413d5f175f.tar.bz2 |
* macosx/tkMacOSXInit.c (TkpInit): Move ALL the MacOS X specific
initialization code into TkpInit so extension writers don't have
to do anything special to initialize Tk.
This is patch #495549
-rw-r--r-- | macosx/tkMacOSXAppInit.c | 17 | ||||
-rw-r--r-- | macosx/tkMacOSXInit.c | 21 | ||||
-rw-r--r-- | macosx/tkMacOSXNotify.c | 24 |
3 files changed, 35 insertions, 27 deletions
diff --git a/macosx/tkMacOSXAppInit.c b/macosx/tkMacOSXAppInit.c index ee70f79..84e45e7 100644 --- a/macosx/tkMacOSXAppInit.c +++ b/macosx/tkMacOSXAppInit.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXAppInit.c,v 1.1.2.4 2001/11/11 17:54:40 wolfsuit Exp $ + * RCS: @(#) $Id: tkMacOSXAppInit.c,v 1.1.2.5 2002/01/22 01:28:18 wolfsuit Exp $ */ #include <pthread.h> #include "tk.h" @@ -26,9 +26,6 @@ #define MAX_PATH_LEN 1024 #endif -extern void TkMacOSXInitAppleEvents(Tcl_Interp *interp); -extern void TkMacOSXInitMenus(Tcl_Interp *interp); - /* * The following variable is a special hack that is needed in order for * Sun shared libraries to be used for Tcl. @@ -94,16 +91,7 @@ main(argc, argv) #endif extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp)); - - /* - * NB - You have to swap in the Tk Notifier BEFORE you start up the - * Tcl interpreter for now. It probably should work to do this - * in the other order, but for now it doesn't seem to. - */ - scriptPath[0] = '\0'; - - Tk_MacOSXSetupTkNotifier(); /* * The following #if block allows you to change how Tcl finds the startup @@ -246,9 +234,6 @@ Tcl_AppInit(interp) TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE); } - TkMacOSXInitAppleEvents(interp); - TkMacOSXInitMenus(interp); - #ifdef TK_TEST if (Tcltest_Init(interp) == TCL_ERROR) { return TCL_ERROR; diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 14634ff..e9ee26b 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXInit.c,v 1.1.2.2 2001/11/11 17:54:40 wolfsuit Exp $ + * RCS: @(#) $Id: tkMacOSXInit.c,v 1.1.2.3 2002/01/22 01:28:18 wolfsuit Exp $ */ #include "tkInt.h" @@ -47,8 +47,21 @@ TkpInit(interp) { char tkLibPath[1024]; int result; - - Tcl_SetVar2(interp, "tcl_platform", "windowingsystem", "aqua", TCL_GLOBAL_ONLY); + static int menusInitialized = false; + + /* Since it is possible for TkInit to be called multiple times + * and we don't want to do the menu initialization multiple times + * we protect against doing it more than once. + */ + + if (menusInitialized == false) { + menusInitialized = true; + Tk_MacOSXSetupTkNotifier(); + TkMacOSXInitAppleEvents(interp); + TkMacOSXInitMenus(interp); + } + Tcl_SetVar2(interp, "tcl_platform", "windowingsystem", + "aqua", TCL_GLOBAL_ONLY); /* * When Tk is in a framework, force tcl_findLibrary to look in the @@ -134,4 +147,4 @@ TkpDisplayWarning(msg, title) Tcl_WriteChars(errChannel, msg, -1); Tcl_WriteChars(errChannel, "\n", 1); } -}
\ No newline at end of file +} diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 5446f79..388f50b 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -1,9 +1,9 @@ /* - * tclUnixNotify.c -- + * tclMacOSXNotify.c -- * - * This file contains the implementation of the select-based - * Unix-specific notifier, which is the lowest-level part of the - * Tcl event loop. This file works together with + * This file contains the implementation of a merged + * Carbon/select-based notifier, which is the lowest-level part + * of the Tcl event loop. This file works together with * ../generic/tclNotify.c. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. @@ -12,13 +12,13 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $ + * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.1.2.2 2002/01/22 01:28:18 wolfsuit Exp $ */ #include "tclInt.h" #include "tclPort.h" -/* FIXME - Why do I need there here? */ +/* FIXME - Why do I need these here? */ #undef environ #include "tkMacOSX.h" @@ -228,6 +228,15 @@ Tk_MacOSXSetupTkNotifier() }; Tcl_SetNotifier(&macNotifierProcs); + + /* + * Tcl_SetNotifier doesn't call the TclInitNotifier + * so we call it now. If we don't do this the + * ThreadSpecificData will keep a pointer to the original + * InitNotifier. See tclNotify.c:TclInitNotifier(). + */ + + TclInitNotifier(); } /* @@ -673,7 +682,8 @@ FileHandlerEventProc(evPtr, flags) } return 1; } -void + +void DoActualWait(timePtr) Tcl_Time *timePtr; /* Maximum block time, or NULL. */ { |