tkMainWindowList hiding

Daniel G. Downey danmotif at mrco2.carleton.ca
Tue Jun 22 10:59:48 EDT 1999


I had a similar problem.  Here is a response I got.  I didn't try it.
I solved my problem by using tcl/tk 8.0.5  instead of 8.1.1

Dan Downey

----- Begin Included Message -----

>From Stef.Desmet at esat.kuleuven.ac.be Fri Jun 18 03:25 EDT 1999
From: Stef Desmet <Stef.Desmet at esat.kuleuven.ac.be>
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
Date: Fri, 18 Jun 1999 09:27:14 +0200 (MET DST)
To: danmotif at mrco2.carleton.ca (Daniel G. Downey)
Cc: vtkusers at gsao.med.ge.com
Subject: Re: tkMainWindowList  hiding

Sorry for the late response... but it is possible to use vtk2.3 and Tcl/Tk8.1

I'll include a mail from robbel at wins.uva.nl (Robert Belleman) dating from may 30
explaining the problem. I applied the included patch and everything runs fine now


begin include
--------------
What follows is a quick fix; it is not backwards compatible with Tcl/Tk
8.0 but it should be easy to make it that way. I just though I'd keep to
the essence. Apart from that I haven't done extensive tests so I can't
guarantee this works for everyone. It does for me.

Regards,
-- Rob

[] Robert Belleman         X  Section for Computational Science        []
[] robbel at wins.uva.nl     |X| University of Amsterdam, the Netherlands []
[] tel: (+31) 20 525 7539  X  http://www.wins.uva.nl/~robbel/          []


Problem description:
--------------------
Linking Vtk nightly May 28th with Tk 8.1 results in:

  /usr/local/src/vtk/graphics/libVTKGraphicsTcl.so: undefined
  reference to `tkMainWindowList'

This is because graphics/vtkXRenderWindowTclInteractor.cxx
references (extern TkMainInfo *) tkMainWindowList
which is used in line 185:

  // use the same display as tcl/tk
  ren->SetDisplayId(Tk_Display(tkMainWindowList->winPtr));

"tkMainWindowList" used to be defined in ./generic/tkWindow.c in Tk
8.0 but vanished from Tk 8.1 because of thread-safeness issues (note
that an extern definition still exists in ./generic/tkInt.h and in a
macintosh specific file but this has probably been overseen by the Tk
team).

Fix:
----
The required reference needed by Vtk has moved into a thread specific
data structure "ThreadSpecificData" which amongst others contains

    TkMainInfo *mainWindowList;
                           /* First in list of all main windows managed
                            * by this thread. */

a reference to which can be obtained via the function
TkGetMainInfoList().

I have made these changes and it seems to work properly. Note that I
have not done extensive tests.

A context diff follows:

*** vtkXRenderWindowTclInteractor.cxx   Sun May 30 01:02:10 1999
--- vtkXRenderWindowTclInteractor.cxx.org       Sun May 30 00:29:08 1999
***************
*** 60,66 ****
    struct TkWindow *winPtr;
  };

! extern "C" { TkMainInfo *TkGetMainInfoList(); }

  // returns 1 if done
  static int vtkTclEventProc(XtPointer clientData,XEvent *event)
--- 60,66 ----
    struct TkWindow *winPtr;
  };

! extern TkMainInfo *tkMainWindowList;

  // returns 1 if done
  static int vtkTclEventProc(XtPointer clientData,XEvent *event)
***************
*** 182,188 ****
    ren = (vtkXRenderWindow *)(this->RenderWindow);

    // use the same display as tcl/tk
!   ren->SetDisplayId(Tk_Display(TkGetMainInfoList()->winPtr));
    this->DisplayId = ren->GetDisplayId();

    // get the info we need from the RenderingWindow
--- 182,188 ----
    ren = (vtkXRenderWindow *)(this->RenderWindow);

    // use the same display as tcl/tk
!   ren->SetDisplayId(Tk_Display(tkMainWindowList->winPtr));
    this->DisplayId = ren->GetDisplayId();

    // get the info we need from the RenderingWindow

-- 
Stef Desmet                                    
Katholieke Universiteit Leuven                      Tel. +32-16-321041
Departement Elektrotechniek - ESAT                  Fax. +32-16-321986
Centrum voor Beeld- en Spraakverwerking - PSI       Telex 25914 ELEKUL
Kardinaal Mercierlaan 94         eMail stef.desmet at esat.kuleuven.ac.be
B-3001 Heverlee Leuven    URL <http://www.esat.kuleuven.ac.be/~desmet>
B E L G I U M 
----------------------------------------------------------------------


----- End Included Message -----



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list