[GRASS-dev] debugging nviz with TclTk 8.5 aqua

Glynn Clements glynn at gclements.plus.com
Wed Jul 23 08:17:00 EDT 2008


Michael Barton wrote:

> > Oh; while you're at it, can you post your tkMacOSXInt.h header?
> 
> I've put it at <http://www.public.asu.edu/~cmbarton/files/tcltk/>
> 
> This is for aqua and (I assume) for 8.5.

Yep; that's 8.5:

struct TkWindowPrivate {
    TkWindow *winPtr;		/* Ptr to tk window or NULL if Pixmap */
    CGrafPtr grafPtr;
    CGContextRef context;
    ControlRef rootControl;
    int xOff;			/* X offset from toplevel window */
    int yOff;			/* Y offset from toplevel window */
    CGSize size;
    HIShapeRef visRgn;		/* Visible region of window */
    HIShapeRef aboveVisRgn;	/* Visible region of window & its children */
    CGRect drawRect;		/* Clipped drawing rect */
    int referenceCount;		/* Don't delete toplevel until children are
				 * gone. */
    struct TkWindowPrivate *toplevel;
				/* Pointer to the toplevel datastruct. */
    int flags;			/* Various state see defines below. */
};

For 8.4.9, it looks like:

struct TkWindowPrivate {
    TkWindow *winPtr;     	/* Ptr to tk window or NULL if Pixmap */
    CGrafPtr  grafPtr;
    ControlRef rootControl;
    int xOff;	       		/* X offset from toplevel window */
    int yOff;		       	/* Y offset from toplevel window */
    RgnHandle clipRgn;		/* Visable region of window */
    RgnHandle aboveClipRgn;	/* Visable region of window & it's children */
    int referenceCount;		/* Don't delete toplevel until children are
				 * gone. */
    struct TkWindowPrivate *toplevel;	/* Pointer to the toplevel
					 * datastruct. */
    int flags;			/* Various state see defines below. */
};

> > Can you try:
> >
> > 	print *((struct TkWindowPrivate *) (window))

Okay; decoding to hex and/or strings:

> (gdb) print *((struct TkWindowPrivate *) (window))
> $1 = {
>    winPtr = 0x5cf0608,
>    grafPtr = 0x0,
>    context = 0x6c63542f,	// = "/Tcl"
>    rootControl = 0x0,
>    xOff = 0,
>    yOff = 7337416,		// 0x006ff5c8
>    size = {
>      width = 1.02819154e-38,	// 0x006ff5cc
>      height = 0
>    },
>    visRgn = 0x936b48,
>    aboveVisRgn = 0x0,
>    drawRect = {
>      origin = {
>        x = 6.97764217e+22,	// 0x656c6966 = "file"
>        y = 1.8089652e+25	// 0x696f6a20 = " joi"
>      },
>      size = {
>        width = 1.41764467e+22,// 0x6440206e = "n @d"
>        height = 1.63008877e-19// 0x20407269 = "ir@ "
>      }
>    },
>    referenceCount = -271777041,// 0xefcd02ef
>    toplevel = 0x28,
>    flags = 97452040		// 0x05cf0008
> }

As raw data, that's:

     0x05cf0608,
     0,
     0x6c63542f = "/Tcl"
     0,
     0,
     0x006ff5c8
     0x006ff5cc
     0
     0x0936b48,
     0,
     0x656c6966 = "file"
     0x696f6a20 = " joi"
     0x6440206e = "n @d"
     0x20407269 = "ir@ "
     0xefcd02ef
     0x28,
     0x05cf0008

If I map that to the 8.4 TkWindowPrivate structure:

     TkWindow *   winPtr          = 0x5cf0608
     CGrafPtr     grafPtr         = 0
     ControlRef   rootControl     = 0x6c63542f = "/Tcl"
     int          xOff            = 0
     int          yOff            = 0
     RgnHandle    clipRgn         = 0x006ff5c8
     RgnHandle    aboveClipRgn    = 0x006ff5cc
     int          referenceCount  = 0
     struct ... * toplevel        = 0x00936b48
     int          flags           = 0

which looks quite sane (the rootControl field isn't initialised by
TkpMakeWindow(), so it isn't unusual that it contains garbage at this
point).

> Mac OS X 10.5 comes with TclTk aqua 8.4 and 8.5. But I also have to  
> install an x11 version that I compile (in /usr/local/tcltk) in order  
> to compile and run GRASS with the standard x11 tcltk.

I'd say it's a fairly safe bet that Togl is being compiled with the
8.5 headers but linked against the 8.4 library.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list