From 6e3c3db8630f629578ea034020ae7d920aadf4ce Mon Sep 17 00:00:00 2001 From: hobbs Date: Thu, 10 Feb 2000 08:52:32 +0000 Subject: * generic/tkImgGIF.c (FileReadGIF): added cast for trashBuffer * generic/tkIntXlibDecls.h: * generic/tkInt.decls: declared some Xlib emulation calls for the Mac * generic/tkFrame.c (TkInstallFrameMenu): added extra panic to inform user of bad call when framePtr is NULL [Bug: 2530] * generic/tkMenu.c (DestroyMenuInstance): Placed checks around menu name objects before trying to incr the ref. [Bug: 3402] * generic/tkTest.c: removed USE_OLD_IMAGE def for Mac --- generic/tkFrame.c | 5 ++++- generic/tkImgGIF.c | 4 ++-- generic/tkInt.decls | 29 +++++++++++++++++++++++++- generic/tkIntXlibDecls.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++- generic/tkMenu.c | 18 ++++++++++------ generic/tkStubInit.c | 8 ++++++- generic/tkTest.c | 6 +----- 7 files changed, 107 insertions(+), 17 deletions(-) diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 4af8d7e..3ebe0f2 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFrame.c,v 1.5 1999/12/14 06:52:28 hobbs Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.6 2000/02/10 08:52:32 hobbs Exp $ */ #include "default.h" @@ -975,6 +975,9 @@ TkInstallFrameMenu(tkwin) if (winPtr->mainPtr != NULL) { Frame *framePtr; framePtr = (Frame*) winPtr->instanceData; + if (framePtr == NULL) { + panic("TkInstallFrameMenu couldn't get frame pointer"); + } TkpMenuNotifyToplevelCreate(winPtr->mainPtr->interp, framePtr->menuName); } diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index e3a4085..b6fec53 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -29,7 +29,7 @@ * | provided "as is" without express or implied warranty. | * +-------------------------------------------------------------------+ * - * RCS: @(#) $Id: tkImgGIF.c,v 1.11 2000/02/08 11:31:33 hobbs Exp $ + * RCS: @(#) $Id: tkImgGIF.c,v 1.12 2000/02/10 08:52:33 hobbs Exp $ */ /* @@ -391,7 +391,7 @@ FileReadGIF(interp, chan, fileName, format, imageHandle, destX, destY, * marginally improve the speed of the less frequent case, I chose * to maintain high performance for the common case. */ - if (ReadImage(interp, trashBuffer, chan, fileWidth, + if (ReadImage(interp, (char *) trashBuffer, chan, fileWidth, fileHeight, colorMap, 0, 0, 0, 0, 0, -1) != TCL_OK) { goto error; } diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 6a34794..f698177 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tkInt.decls,v 1.15 2000/02/09 02:13:50 hobbs Exp $ +# RCS: @(#) $Id: tkInt.decls,v 1.16 2000/02/10 08:52:34 hobbs Exp $ library tk @@ -1913,3 +1913,30 @@ declare 83 mac { void XFillRectangle (Display* display, Drawable d, GC gc, \ int x, int y, unsigned int width, unsigned int height) } +declare 84 mac { + void XClearWindow (Display* d, Window w) +} + +declare 85 mac { + void XDrawPoint (Display* display, Drawable d, GC gc, int x, int y) +} + +declare 86 mac { + void XDrawPoints (Display* display, Drawable d, GC gc, XPoint *points, \ + int npoints, int mode) +} + +declare 87 mac { + void XWarpPointer (Display* display, Window src_w, Window dest_w, \ + int src_x, int src_y, unsigned int src_width, \ + unsigned int src_height, int dest_x, int dest_y) +} + +declare 88 mac { + void XQueryColor (Display *display, Colormap colormap, XColor *def_in_out) +} + +declare 89 mac { + void XQueryColors (Display *display, Colormap colormap, \ + XColor *defs_in_out, int ncolors) +} diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 5f22fd8..36cdcf9 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -9,7 +9,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tkIntXlibDecls.h,v 1.12 1999/12/14 06:52:29 hobbs Exp $ + * RCS: @(#) $Id: tkIntXlibDecls.h,v 1.13 2000/02/10 08:52:34 hobbs Exp $ */ #ifndef _TKINTXLIBDECLS @@ -629,6 +629,28 @@ EXTERN void XDrawLine _ANSI_ARGS_((Display* d, Drawable dr, GC g, EXTERN void XFillRectangle _ANSI_ARGS_((Display* display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); +/* 84 */ +EXTERN void XClearWindow _ANSI_ARGS_((Display* d, Window w)); +/* 85 */ +EXTERN void XDrawPoint _ANSI_ARGS_((Display* display, Drawable d, + GC gc, int x, int y)); +/* 86 */ +EXTERN void XDrawPoints _ANSI_ARGS_((Display* display, + Drawable d, GC gc, XPoint * points, + int npoints, int mode)); +/* 87 */ +EXTERN void XWarpPointer _ANSI_ARGS_((Display* display, + Window src_w, Window dest_w, int src_x, + int src_y, unsigned int src_width, + unsigned int src_height, int dest_x, + int dest_y)); +/* 88 */ +EXTERN void XQueryColor _ANSI_ARGS_((Display * display, + Colormap colormap, XColor * def_in_out)); +/* 89 */ +EXTERN void XQueryColors _ANSI_ARGS_((Display * display, + Colormap colormap, XColor * defs_in_out, + int ncolors)); #endif /* MAC_TCL */ typedef struct TkIntXlibStubs { @@ -829,6 +851,12 @@ typedef struct TkIntXlibStubs { void (*xForceScreenSaver) _ANSI_ARGS_((Display* display, int mode)); /* 81 */ void (*xDrawLine) _ANSI_ARGS_((Display* d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 82 */ void (*xFillRectangle) _ANSI_ARGS_((Display* display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 83 */ + void (*xClearWindow) _ANSI_ARGS_((Display* d, Window w)); /* 84 */ + void (*xDrawPoint) _ANSI_ARGS_((Display* display, Drawable d, GC gc, int x, int y)); /* 85 */ + void (*xDrawPoints) _ANSI_ARGS_((Display* display, Drawable d, GC gc, XPoint * points, int npoints, int mode)); /* 86 */ + void (*xWarpPointer) _ANSI_ARGS_((Display* display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y)); /* 87 */ + void (*xQueryColor) _ANSI_ARGS_((Display * display, Colormap colormap, XColor * def_in_out)); /* 88 */ + void (*xQueryColors) _ANSI_ARGS_((Display * display, Colormap colormap, XColor * defs_in_out, int ncolors)); /* 89 */ #endif /* MAC_TCL */ } TkIntXlibStubs; @@ -1610,6 +1638,30 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr; #define XFillRectangle \ (tkIntXlibStubsPtr->xFillRectangle) /* 83 */ #endif +#ifndef XClearWindow +#define XClearWindow \ + (tkIntXlibStubsPtr->xClearWindow) /* 84 */ +#endif +#ifndef XDrawPoint +#define XDrawPoint \ + (tkIntXlibStubsPtr->xDrawPoint) /* 85 */ +#endif +#ifndef XDrawPoints +#define XDrawPoints \ + (tkIntXlibStubsPtr->xDrawPoints) /* 86 */ +#endif +#ifndef XWarpPointer +#define XWarpPointer \ + (tkIntXlibStubsPtr->xWarpPointer) /* 87 */ +#endif +#ifndef XQueryColor +#define XQueryColor \ + (tkIntXlibStubsPtr->xQueryColor) /* 88 */ +#endif +#ifndef XQueryColors +#define XQueryColors \ + (tkIntXlibStubsPtr->xQueryColors) /* 89 */ +#endif #endif /* MAC_TCL */ #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 806e513..b3f906d 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMenu.c,v 1.5 1999/04/21 21:53:26 rjohnson Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.6 2000/02/10 08:52:35 hobbs Exp $ */ /* @@ -1178,11 +1178,17 @@ DestroyMenuInstance(menuPtr) parentMasterMenuPtr->entries[cascadePtr->index]; newObjv[0] = menuNamePtr; newObjv[1] = parentMasterEntryPtr->namePtr; - Tcl_IncrRefCount(newObjv[0]); - Tcl_IncrRefCount(newObjv[1]); - ConfigureMenuEntry(cascadePtr, 2, newObjv); - Tcl_DecrRefCount(newObjv[0]); - Tcl_DecrRefCount(newObjv[1]); + /* + * It is possible that the menu info is out of sync, and + * these things point to NULL, so verify existence [Bug: 3402] + */ + if (newObjv[0] && newObjv[1]) { + Tcl_IncrRefCount(newObjv[0]); + Tcl_IncrRefCount(newObjv[1]); + ConfigureMenuEntry(cascadePtr, 2, newObjv); + Tcl_DecrRefCount(newObjv[0]); + Tcl_DecrRefCount(newObjv[1]); + } } else { ConfigureMenuEntry(cascadePtr, 0, (Tcl_Obj **) NULL); } diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 0b8472f..df67260 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubInit.c,v 1.17 2000/02/09 02:13:51 hobbs Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.18 2000/02/10 08:52:36 hobbs Exp $ */ #include "tkInt.h" @@ -664,6 +664,12 @@ TkIntXlibStubs tkIntXlibStubs = { XForceScreenSaver, /* 81 */ XDrawLine, /* 82 */ XFillRectangle, /* 83 */ + XClearWindow, /* 84 */ + XDrawPoint, /* 85 */ + XDrawPoints, /* 86 */ + XWarpPointer, /* 87 */ + XQueryColor, /* 88 */ + XQueryColors, /* 89 */ #endif /* MAC_TCL */ }; diff --git a/generic/tkTest.c b/generic/tkTest.c index 755bc1b..970f0c0 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -13,13 +13,9 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTest.c,v 1.10 2000/02/08 11:31:34 hobbs Exp $ + * RCS: @(#) $Id: tkTest.c,v 1.11 2000/02/10 08:52:36 hobbs Exp $ */ -#ifdef MAC_TCL -#define USE_OLD_IMAGE -#endif - #include "tkInt.h" #include "tkPort.h" #include "tkText.h" -- cgit v0.12