summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkConsole.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index f43ad31..e9b406c 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.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: tkConsole.c,v 1.28 2006/03/20 22:58:46 dgp Exp $
+ * RCS: @(#) $Id: tkConsole.c,v 1.29 2006/03/21 03:01:27 dgp Exp $
*/
#include "tk.h"
@@ -372,13 +372,32 @@ Tk_CreateConsoleWindow(
ChannelData *data = (ChannelData *)Tcl_GetChannelInstanceData(chan);
info = data->info;
if (info->consoleInterp) {
- /*
- * TODO: The console channels are already connected to a console
- * window. Move channels to this new one, but leave the old one
- * functioning.
- */
-
-
+ /* New ConsoleInfo for a new console window */
+ info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo));
+ info->refCount = 0;
+
+ /* Update any console channels to make use of the new console */
+ if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDIN))
+ == &consoleChannelType) {
+ data = (ChannelData *)Tcl_GetChannelInstanceData(chan);
+ data->info->refCount--;
+ data->info = info;
+ data->info->refCount++;
+ }
+ if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDOUT))
+ == &consoleChannelType) {
+ data = (ChannelData *)Tcl_GetChannelInstanceData(chan);
+ data->info->refCount--;
+ data->info = info;
+ data->info->refCount++;
+ }
+ if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDERR))
+ == &consoleChannelType) {
+ data = (ChannelData *)Tcl_GetChannelInstanceData(chan);
+ data->info->refCount--;
+ data->info = info;
+ data->info->refCount++;
+ }
}
} else {
info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo));