From 11ed35c32c2c0c0363df8cf278ab3eebae8bd6e0 Mon Sep 17 00:00:00 2001 From: hobbs Date: Wed, 4 Apr 2001 07:57:16 +0000 Subject: see ChangeLog for specific file details --- ChangeLog | 332 ++++ README | 16 +- generic/tk.decls | 11 +- generic/tk.h | 10 +- generic/tkBind.c | 12 +- generic/tkBitmap.c | 19 +- generic/tkCanvLine.c | 12 +- generic/tkCanvas.c | 37 +- generic/tkConfig.c | 11 +- generic/tkConsole.c | 19 +- generic/tkDecls.h | 18 +- generic/tkEntry.c | 70 +- generic/tkEvent.c | 197 ++- generic/tkFileFilter.c | 8 +- generic/tkGeometry.c | 31 +- generic/tkImgPhoto.c | 15 +- generic/tkListbox.c | 31 +- generic/tkMenu.c | 10 +- generic/tkStubImg.c | 4 +- generic/tkStubInit.c | 4 +- library/entry.tcl | 9 +- library/safetk.tcl | 4 +- library/text.tcl | 27 +- library/tk.tcl | 16 +- mac/README | 5 +- tests/bind.test | 24 +- tests/canvas.test | 46 +- tests/color.test | 8 +- tests/cursor.test | 26 +- tests/entry.test | 59 +- tests/event.test | 376 +++- tests/focus.test | 4 +- tests/imgPhoto.test | 55 +- tests/listbox.test | 20 +- tests/macEmbed.test | 4 +- tests/macMenu.test | 4 +- tests/menu.test | 6 +- tests/safe.test | 35 +- tests/tk.test | 5 +- tests/unixWm.test | 4 +- tests/winClipboard.test | 26 +- tests/winDialog.test | 18 +- unix/Makefile.in | 30 +- unix/configure | 4515 +++++++++++++++++++++++++++++++++++++++++++++++ unix/configure.in | 8 +- unix/tk.spec | 6 +- unix/tkUnixDraw.c | 8 +- win/Makefile.in | 57 +- win/configure | 2421 +++++++++++++++++++++++++ win/configure.in | 63 +- win/makefile.vc | 92 +- win/rc/tk.rc | 56 +- win/rc/wish.rc | 54 +- win/stubs.c | 2 +- win/tcl.m4 | 16 +- win/tkConfig.sh.in | 8 +- win/tkWinButton.c | 19 +- win/tkWinColor.c | 4 +- win/tkWinDialog.c | 470 ++++- win/tkWinDraw.c | 14 +- win/tkWinEmbed.c | 4 +- win/tkWinFont.c | 14 +- win/tkWinInt.h | 4 +- win/tkWinKey.c | 29 +- win/tkWinMenu.c | 6 +- win/tkWinScrlbr.c | 15 +- win/tkWinTest.c | 6 +- win/tkWinWindow.c | 4 +- win/tkWinWm.c | 979 +++++++++- win/tkWinX.c | 242 ++- xlib/ximage.c | 4 +- 71 files changed, 10230 insertions(+), 568 deletions(-) create mode 100755 unix/configure create mode 100755 win/configure diff --git a/ChangeLog b/ChangeLog index 75bb980..b23d7a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,335 @@ +2001-04-04 Jeff Hobbs + + * README: + * mac/README: updated patchlevel to 8.3.3 and corrected links and + notes. + + * generic/tk.h: + * unix/configure.in (TK_PATCH_LEVEL): + * unix/configure: + * unix/tk.spec: + * win/configure.in (TK_PATCH_LEVEL): + * win/configure: updated patchlevel to 8.3.3, configure scripts + are now part of CVS for 8.3.x + + *************************************************************** + ** START OF ASYNC BACKPORT LOG (8.4aCVS 2001-04-03 -> 8.3.3) ** + *************************************************************** + + * doc/CanvPsY.3: + * doc/ConfigWidg.3: + * doc/CrtImgType.3: + * doc/CrtItemType.3: + * doc/FontId.3: + * doc/GetFont.3: + * doc/GetHWND.3: + * doc/HWNDToWindow.3: + * doc/MaintGeom.3: + * doc/Tk_Init.3: + * doc/bind.n: + * doc/canvas.n: + * doc/event.n: + * doc/font.n: + * doc/frame.n: + * doc/getOpenFile.n: + * doc/grid.n: + * doc/image.n: + * doc/loadTk.n: + * doc/message.n: + * doc/messageBox.n: + * doc/options.n: + * doc/photo.n: + * doc/scale.n: + * doc/scrollbar.n: + * doc/text.n: + * doc/tk.n: + * doc/toplevel.n: + * doc/wm.n: doc cleanup and clarifications + +2001-04-03 Jeff Hobbs + + * tests/winClipboard.test: improved results for understanding when + tests fail. + + * tests/winDialog.test: string totitle'd some results that + expected [pwd] to return a capital drive letter. + + * tests/cursor.test: changed tests to use 'heart' cursor because + 'arrow' on windows has a pre-skewed use count. + +2001-04-02 Jeff Hobbs + + * win/configure: + * win/tcl.m4 (SHLIB_LD): added -incremental:no. [Bug #219381] + + * generic/tkMenu.c (TkInvokeMenu): checked for menu deletion + before calling associated menu entry command. [Bug #220821] + + * generic/tkImgPhoto.c (ImgPhotoCmd): corrected the src and dest + values for $imageName put when -format and -to are used. + [Bug #232741] + + * tests/listbox.test: added test listbox-27.1, delete during + scrollbar update + * generic/tkListbox.c (DestroyListbox, ListboxEventProc): + corrected listbox to make proper use of Tcl_EventuallyFree and + protect against unusual listbox deletion. + + * tests/entry.test: added tests entry-20.*, delete during widget + activity + * generic/tkEntry.c (DestroyEntry, EntryEventProc): fixed the + entry widget to survive deletion while processing scrollbar + updates and validation. + + * tests/canvas.test: test of canvas delete during event + * generic/tkCanvas.c (DestroyCanvas, CanvasEventProc): fixed the + canvas to survive deletion during event processing. [Bug #228024] + +2001-03-30 Jeff Hobbs + + * tests/safe.test: added note about correcting failures in + safe.test. + + * win/tcl.m4: added imm32.lib to LIBS_GUI for Tk IME support. + * win/tkWinInt.h: + * win/tkWinKey.c: + * win/tkWinX.c: added support for changing IME on the fly in + Windows (2000). (lam) [Patch #402993] + + * tests/bind.test (bind-22.18): + * generic/tkBind.c (NameToWindow): handled the error case where a + valid-looking but invalid identifier could be passed in certain + event generate options causing a crash. [Bug #411307] + + * win/tkWinWm.c (UpdateWrapper): ensured that the passed in winPtr + had an existent window to operate on. [Bug #409172] + + * win/Makefile.in (install-*): improved install-* targets to use + their base build dependency. + +2001-03-29 Jeff Hobbs + + * library/tk.tcl: put a catch around adding to the + <> virtual event as it doesn't seem to work on all HP + systems. [Bug #411669] + +2001-03-29 Mo DeJong + + * library/entry.tcl (tkEntryMouseSelect): + * library/text.tcl (tkTextSelectTo): When + the mouse is dragged with the button down, + move the insertion cursor to the current + mouse position. + * tests/event.test: Add a series of tests + for event generation. Add tests for selection, + check the position of the insertion cursor. + +2001-03-28 Jeff Hobbs + + * unix/configure: + * unix/tcl.m4: corrected IRIX-5.x config to not use -n32. + (english) [Patch 403626] + +2001-03-28 Don Porter + + * tests/focus.test (focus-6.1): + * tests/macEmbed.testi (unixEmbed-5.1): + * tests/macMenu.test (macMenu-21.3): + * tests/menu.testi (menu-27.1): + * tests/unixEmbed.test (unixEmbed-8.2): + * tests/unixWm.testi (unixWm-50.4): Replaced all [load {} tk] + in Tk test suite with [load {} Tk]. [Bug 220940, Patch 411952] + +2001-01-02 Andreas Kupries + + * Everything below belongs together and implements TIP #8 + (SF patch #102833). + + * win/tkWinWm.c (line 56f): Added icon structures. + * win/tkWinWm.c (struct WmInfo, line 242): Added reference to + optional icon for titlebar. + * win/tkWinWm.c (struct ThreadSpecificData, line 335): Added + reference to optional default icon for toplevel windows. + * win/tkWinWm.c (line 387 ... 1169): All the new functions required + to deal with icon specifications, 'InitWm' changed. + * win/tkWinWm.c (TkWmNewWindow, UpdateWrapper, TkWmDeadWindow, Tk_WmCmd): + Added initialization and handling of the new fields. + * doc/wm.n: Documentation updated to explain the newly available + functionality. + +2000-11-02 Jeff Hobbs + + * win/tkWinButton.c: + * win/tkWinDialog.c: + * win/tkWinScrlbr.c: + * win/tkWinWm.c: fixed up code for Win64 support. This mostly + remains in _WIN64 #ifdef's, until updated compilers are standard. + + * win/tcl.m4: + * win/makefile.vc: updated for Win64 compile support + +2000-11-01 Jeff Hobbs + + * win/tkWinDialog.c (GetFileNameW, GetFileNameA, + Tk_ChooseDirectoryObjCmd): created + work-around for change in NT5.0/98 that caused no initialdir + setting to open the browser up in the user's documents dir. + + * tests/color.test: marked color-2.6 nonPortable as we can't + reliably assume what 'red' maps to. + +2000-11-01 Eric Melski + + * win/tkWinDialog.c: Added branch for 0 return from + CommDlgExtendedError() switches; this was formerly treated as an + error, but it actually is not, since it just means the user hit + cancel or closed the dialog. (GetFileNameW): Added better smarts + such that -multiple is not considered a valid option for + tk_getSaveFile. + Removed CommDlgExtendedError() checks for color and choosedir + dialogs, and removed all except the explicit invalid filename + checks for the file dialogs. + +2000-10-30 David Gravereaux + + * win/configure.in: + * win/Makefile.in: + * win/makefile.vc: + * win/rc/tk.rc: + * win/rc/tk_base.rc (new): + * win/rc/wish.rc: Added logic to derive filenames better in the + resource scripts based on compile options along with better + support for building a static wish shell with cursor resources. + +2000-10-27 Jeff Hobbs + + * unix/tcl.m4: added support for AIX-5. + + * tests/tk.test: + * doc/tk.n: updated to reflect default on status of useinputmethods. + * library/tk.tcl: tk useinputmethods is set to 1 by default. This + enables Kanji and dead-char input by default. Intro'd in + 1999-12-16 with default off to avoid some problems with older X + servers that would slow down widget creation over time. + + * win/Makefile.in (test, winhelp, tktest): corrected the + TCL_LIBRARY path specification. + +2000-10-18 Eric Melski + + * win/tkWinDraw.c (RenderObject): Applied patch from [Bug: 6368], + which corrects rendering of 1-pixel wide stippled lines on Windows. + + * generic/tkCanvLine.c (DisplayLine): Applied patch from + [Bug: 6368], corrects bugs relating to use of active- and + disabledwidth values for displaying lines (disabledwidth was never + used, and activewidth/disablewidths would only possibly be used + when greater than default width, rather than when simply not equal + to default width). + + * win/tkWinDialog.c (GetFileNameW, GetFileNameA, + Tk_ChooseColorObjCmd, Tk_ChooseDirectoryObjCmd): Added error + checking for the return value from the common dialog functions, so + that the commands will not silently fail if the common dialog + returns an error. [Bug: 6369]. + +2000-10-10 Eric Melski + + * generic/tkConfig.c (Tk_InitOptions): Added + Tcl_IncrRefCount/Tcl_DecrRefCount calls on valuePtr, to prevent + memory leaks when the value object comes from the option + database. [Bug: 6275]. + +2000-10-06 Jeff Hobbs + + * win/Makefile.in (cat32.${OBJEXT}): add win/ subdirectory to + cat32 target to correctly find the source file. + +2000-10-04 Eric Melski + + * generic/tkGeometry.c (Tk_MaintainGeometry): Added a check for + the case in which the slave window is a direct descendant of the + master window. In this case, we need not set up the additional + infrastructure normally provide by Tk_MaintainGeometry, because we + can rely on the parent/child relationship to handle it for us + implicitly. In this case, Tk_MaintainGeometry just calls directly + to Tk_MoveResizeWindow. This allows geometry managers to simply + always use Tk_MaintainGeometry to maintain geometry for slaves, + and avoid doing the direct descendant check themselves. + (Tk_UnmaintainGeometry): Added a matching check for the direct + descendant case; in this case, Tk_UnmaintainGeometry simply + returns immediately. + +2000-09-29 D. Richard Hipp + + * generic/tkBitmap.c: Changes to prevent a BadMatch error from the + Xserver when the same bitmap is used on two or more screens of the + same display. + + * tests/menu.test: Print a warning if the TK_ALT_DISPLAY environment + variable is not configured so as to test for the bug fix above. + + * library/tk.tcl (::tk::SetGrabFocus): "Catch" the grab in case + another application already holds the grab and the "grab" command + fails. + +2000-09-29 Jeff Hobbs + + * win/Makefile.in: commented use of TESTFLAGS + * unix/Makefile.in: added TESTFLAGS to test and testlang targets to + conform with Windows makefile and TEA style. + +2000-09-06 Eric Melski + + * doc/HWNDToWindow.3: + * doc/GetHWND.3: Changed synopsis to indicate the tkPlatDecls.h + should be included, not tk.h. + + * generic/tkPlatDecls.h: Removed #include for Windows, + a better solution for now is to update the docs and have extension + authors #include . + + * generic/tk.h: Removed '#include "tkPlatDecls.h"', as the + incorrect inclusion order between windows.h/tkPlatDecls.h causes + build conflicts on Windows. + + * generic/tkPlatDecls.h: Added #include for Windows, + so that HWND, etc., are defined properly. + +2000-09-01 Eric Melski + + * win/makefile.vc (install-libraries): + * win/Makefile.in (install-libraries): + * unix/Makefile.in (install-libraries): Added tkPlatDecls.h to + list of header files to install. + + * generic/tk.h: Added #include "tkPlatDecls.h", which declares the + platform specific component of the public Tk stubs API's. + +2000-08-29 Eric Melski + + * win/tkWinMenu.c (DrawWindowsSystemBitmap): Use scratchDC + for determining the source's logical coordinates. Patch from + [Bug: 6134 (Markus Oberhumer)]. + + * win/tkWinMenu.c (SetDefaults): Compute the indicatorDimensions[] + under Windows NT/2000 in the same way as under Windows 95/98. + Patch from [Bug: 6134 (Markus Oberhumer)]. + + * win/tkWinFont.c (GetScreenFont): Added a memset() to + pacify memory checkers. Patch from [Bug: 6134 (Markus Oberhumer)]. + +2000-08-18 Eric Melski + + * generic/tkImgPhoto.c (ImgPhotoGet): Removed redundant call to + DitherInstance; this call was formerly being made from + ImgPhotoGet->ImgPhotoConfigureInstance->DitherInstance, and + ImgPhotoGet->DitherInstance. The second call was removed. + + *************************************************************** + ** END OF ASYNC BACKPORT LOG (8.4aCVS 2001-04-03 -> 8.3.3) ** + *************************************************************** + 2000-08-08 Jeff Hobbs 8.3.2 RELEASE finalized diff --git a/README b/README index 687f207..1d54774 100644 --- a/README +++ b/README @@ -1,11 +1,11 @@ README: Tk - This is the Tk 8.3.2 source distribution. + This is the Tk 8.3.3 source distribution. You can get any release of Tcl from: http://dev.scriptics.com/registration/.html Tcl/Tk is also available through NetCVS: - http://dev.scriptics.com/software/tcltk/netcvs.html + http://tcl.sourceforge.net/ -RCS: @(#) $Id: README,v 1.25.2.1 2000/07/27 01:05:57 hobbs Exp $ +RCS: @(#) $Id: README,v 1.25.2.2 2001/04/04 07:57:16 hobbs Exp $ 1. Introduction --------------- @@ -21,9 +21,13 @@ this release, see the Tcl/Tk 8.3 Web page at or refer to the "changes" file in this directory, which contains a historical record of all changes to Tk. -Tk is maintained, enhanced, and distributed freely as a -service to the Tcl community by Scriptics Corporation. -The official home for Tcl/Tk is on the Scriptics Web site: +Tk is maintained, enhanced, and distributed freely by members of the +Tcl community. The home for Tcl/Tk sources and bug database is on +SourceForge at: + + http://tcl.sourceforge.net/ + +with the Tcl Developer Xchange at: http://dev.scriptics.com diff --git a/generic/tk.decls b/generic/tk.decls index d5af12a..cf1a8bc 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -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: tk.decls,v 1.10 2000/04/25 01:03:05 hobbs Exp $ +# RCS: @(#) $Id: tk.decls,v 1.10.2.1 2001/04/04 07:57:16 hobbs Exp $ library tk @@ -1126,6 +1126,15 @@ declare 238 generic { int width, int height) } +# New in 8.4a1 / 8.3.3 +# +declare 239 generic { + void Tk_CreateClientMessageHandler (Tk_ClientMessageProc *proc) +} +declare 240 generic { + void Tk_DeleteClientMessageHandler (Tk_ClientMessageProc *proc) +} + # Define the platform specific public Tk interface. These functions are # only available on the designated platform. diff --git a/generic/tk.h b/generic/tk.h index 62efbc6..353f0bf 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -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: tk.h,v 1.39.2.1 2000/07/27 01:05:57 hobbs Exp $ + * RCS: @(#) $Id: tk.h,v 1.39.2.2 2001/04/04 07:57:16 hobbs Exp $ */ #ifndef _TK @@ -39,7 +39,7 @@ extern "C" { * win/README (not patchlevel) * unix/README (not patchlevel) * unix/tk.spec (3 LOC Major/Minor, 2 LOC patch) - * win/aclocal.m4 (not patchlevel) + * win/tcl.m4 (not patchlevel) * * You may also need to update some of these files when the numbers change * for the version of Tcl that this release of Tk is compiled against. @@ -48,10 +48,10 @@ extern "C" { #define TK_MAJOR_VERSION 8 #define TK_MINOR_VERSION 3 #define TK_RELEASE_LEVEL TCL_FINAL_RELEASE -#define TK_RELEASE_SERIAL 2 +#define TK_RELEASE_SERIAL 3 #define TK_VERSION "8.3" -#define TK_PATCH_LEVEL "8.3.2" +#define TK_PATCH_LEVEL "8.3.3" /* * The following definitions set up the proper options for Macintosh @@ -1339,6 +1339,8 @@ typedef void (Tk_EventProc) _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr)); typedef int (Tk_GenericProc) _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr)); +typedef int (Tk_ClientMessageProc) _ANSI_ARGS_((Tk_Window tkwin, + XEvent *eventPtr)); typedef int (Tk_GetSelProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, char *portion)); typedef void (Tk_LostSelProc) _ANSI_ARGS_((ClientData clientData)); diff --git a/generic/tkBind.c b/generic/tkBind.c index e105d4d..0e9cce5 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.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: tkBind.c,v 1.13 2000/04/19 01:06:50 ericm Exp $ + * RCS: @(#) $Id: tkBind.c,v 1.13.2.1 2001/04/04 07:57:16 hobbs Exp $ */ #include "tkPort.h" @@ -3722,12 +3722,18 @@ NameToWindow(interp, mainWin, objPtr, tkwinPtr) } *tkwinPtr = tkwin; } else { - if (TkpScanWindowId(NULL, name, &id) != TCL_OK) { + /* + * Check for the winPtr being valid, even if it looks ok to + * TkpScanWindowId. [Bug #411307] + */ + + if ((TkpScanWindowId(NULL, name, &id) != TCL_OK) || + ((*tkwinPtr = Tk_IdToWindow(Tk_Display(mainWin), (Window) id)) + == NULL)) { Tcl_AppendResult(interp, "bad window name/identifier \"", name, "\"", (char *) NULL); return TCL_ERROR; } - *tkwinPtr = Tk_IdToWindow(Tk_Display(mainWin), (Window) id); } return TCL_OK; } diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 6facc97..1ea4a89 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.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: tkBitmap.c,v 1.7 1999/04/16 01:51:10 stanton Exp $ + * RCS: @(#) $Id: tkBitmap.c,v 1.7.12.1 2001/04/04 07:57:16 hobbs Exp $ */ #include "tkPort.h" @@ -57,6 +57,7 @@ typedef struct TkBitmap { * and it isn't currently in use. */ int width, height; /* Dimensions of bitmap. */ Display *display; /* Display for which bitmap is valid. */ + int screenNum; /* Screen on which bitmap is valid */ int resourceRefCount; /* Number of active uses of this bitmap (each * active use corresponds to a call to * Tk_AllocBitmapFromObj or Tk_GetBitmap). @@ -75,9 +76,9 @@ typedef struct TkBitmap { * (needed when deleting). */ struct TkBitmap *nextPtr; /* Points to the next TkBitmap structure with * the same name. All bitmaps with the - * same name (but different displays) are - * chained together off a single entry in - * nameTable. */ + * same name (but different displays or + * screens) are chained together off a + * single entry in nameTable. */ } TkBitmap; /* @@ -186,7 +187,8 @@ Tk_AllocBitmapFromObj(interp, tkwin, objPtr) FreeBitmapObjProc(objPtr); bitmapPtr = NULL; - } else if (Tk_Display(tkwin) == bitmapPtr->display) { + } else if ( (Tk_Display(tkwin) == bitmapPtr->display) + && (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum) ) { bitmapPtr->resourceRefCount++; return bitmapPtr->bitmap; } @@ -204,7 +206,8 @@ Tk_AllocBitmapFromObj(interp, tkwin, objPtr) FreeBitmapObjProc(objPtr); for (bitmapPtr = firstBitmapPtr; bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { - if (Tk_Display(tkwin) == bitmapPtr->display) { + if ( (Tk_Display(tkwin) == bitmapPtr->display) && + (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum) ) { bitmapPtr->resourceRefCount++; bitmapPtr->objRefCount++; objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) bitmapPtr; @@ -321,7 +324,8 @@ GetBitmap(interp, tkwin, string) existingBitmapPtr = (TkBitmap *) Tcl_GetHashValue(nameHashPtr); for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { - if (Tk_Display(tkwin) == bitmapPtr->display) { + if ( (Tk_Display(tkwin) == bitmapPtr->display) && + (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum) ) { bitmapPtr->resourceRefCount++; return bitmapPtr; } @@ -418,6 +422,7 @@ GetBitmap(interp, tkwin, string) bitmapPtr->width = width; bitmapPtr->height = height; bitmapPtr->display = Tk_Display(tkwin); + bitmapPtr->screenNum = Tk_ScreenNumber(tkwin); bitmapPtr->resourceRefCount = 1; bitmapPtr->objRefCount = 0; bitmapPtr->nameHashPtr = nameHashPtr; diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index 7fbd51e..d7beb71 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.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: tkCanvLine.c,v 1.7 2000/02/01 11:41:09 hobbs Exp $ + * RCS: @(#) $Id: tkCanvLine.c,v 1.7.2.1 2001/04/04 07:57:16 hobbs Exp $ */ #include @@ -866,18 +866,18 @@ DisplayLine(canvas, itemPtr, display, drawable, x, y, width, height) } linewidth = linePtr->outline.width; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (linePtr->outline.activeStipple!=None) { + if (linePtr->outline.activeStipple != None) { stipple = linePtr->outline.activeStipple; } - if (linePtr->outline.activeWidth>linewidth) { + if (linePtr->outline.activeWidth != linewidth) { linewidth = linePtr->outline.activeWidth; } } else if (state==TK_STATE_DISABLED) { - if (linePtr->outline.disabledStipple!=None) { + if (linePtr->outline.disabledStipple != None) { stipple = linePtr->outline.disabledStipple; } - if (linePtr->outline.disabledWidth>linewidth) { - linewidth = linePtr->outline.activeWidth; + if (linePtr->outline.disabledWidth != linewidth) { + linewidth = linePtr->outline.disabledWidth; } } /* diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 709375a..9d3e59c 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.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: tkCanvas.c,v 1.14 2000/04/14 08:33:15 hobbs Exp $ + * RCS: @(#) $Id: tkCanvas.c,v 1.14.2.1 2001/04/04 07:57:16 hobbs Exp $ */ /* #define USE_OLD_TAG_SEARCH 1 */ @@ -1930,14 +1930,10 @@ DestroyCanvas(memPtr) { TkCanvas *canvasPtr = (TkCanvas *) memPtr; Tk_Item *itemPtr; +#ifndef USE_OLD_TAG_SEARCH + TagSearchExpr *expr, *next; +#endif - if (canvasPtr->tkwin != NULL) { - Tcl_DeleteCommandFromToken(canvasPtr->interp, canvasPtr->widgetCmd); - } - if (canvasPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(DisplayCanvas, (ClientData) canvasPtr); - } - /* * Free up all of the items in the canvas. */ @@ -1964,15 +1960,11 @@ DestroyCanvas(memPtr) Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } #ifndef USE_OLD_TAG_SEARCH - { - TagSearchExpr *expr, *next; - - expr = canvasPtr->bindTagExprs; - while (expr) { - next = expr->next; - TagSearchExprDestroy(expr); - expr = next; - } + expr = canvasPtr->bindTagExprs; + while (expr) { + next = expr->next; + TagSearchExprDestroy(expr); + expr = next; } #endif Tcl_DeleteTimerHandler(canvasPtr->insertBlinkHandler); @@ -2448,7 +2440,16 @@ CanvasEventProc(clientData, eventPtr) canvasPtr->flags |= REDRAW_BORDERS; } } else if (eventPtr->type == DestroyNotify) { - DestroyCanvas((char *) canvasPtr); + if (canvasPtr->tkwin != NULL) { + canvasPtr->tkwin = NULL; + Tcl_DeleteCommandFromToken(canvasPtr->interp, + canvasPtr->widgetCmd); + } + if (canvasPtr->flags & REDRAW_PENDING) { + Tcl_CancelIdleCall(DisplayCanvas, (ClientData) canvasPtr); + } + Tcl_EventuallyFree((ClientData) canvasPtr, + (Tcl_FreeProc *) DestroyCanvas); } else if (eventPtr->type == ConfigureNotify) { canvasPtr->flags |= UPDATE_SCROLLBARS; diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 471af9d..a34b6d6 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -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: tkConfig.c,v 1.7 2000/04/25 01:02:30 hobbs Exp $ + * RCS: @(#) $Id: tkConfig.c,v 1.7.2.1 2001/04/04 07:57:16 hobbs Exp $ */ /* @@ -539,6 +539,13 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin) continue; } + /* + * Bump the reference count on valuePtr, so that it is strongly + * referenced here, and will be properly free'd when finished, + * regardless of what DoObjConfig does. + */ + Tcl_IncrRefCount(valuePtr); + if (DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, (Tk_SavedOption *) NULL) != TCL_OK) { if (interp != NULL) { @@ -563,8 +570,10 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin) } Tcl_AddErrorInfo(interp, msg); } + Tcl_DecrRefCount(valuePtr); return TCL_ERROR; } + Tcl_DecrRefCount(valuePtr); } return TCL_OK; } diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 5892df5..9e1036e 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.11 1999/11/19 22:00:03 hobbs Exp $ + * RCS: @(#) $Id: tkConsole.c,v 1.11.2.1 2001/04/04 07:57:16 hobbs Exp $ */ #include "tk.h" @@ -151,6 +151,23 @@ static int ShouldUseConsoleChannel(type) if ((handle == INVALID_HANDLE_VALUE) || (handle == 0)) { return 1; } + + /* + * Win2K BUG: GetStdHandle(STD_OUTPUT_HANDLE) can return what appears + * to be a valid handle. See TclpGetDefaultStdChannel() for this change + * implemented. We didn't change it here because GetFileType() [below] + * will catch this with FILE_TYPE_UNKNOWN and appropriately return a + * value of 1, anyways. + * + * char dummyBuff[1]; + * DWORD dummyWritten; + * + * if ((type == TCL_STDOUT) + * && !WriteFile(handle, dummyBuff, 0, &dummyWritten, NULL)) { + * return 1; + * } + */ + fileType = GetFileType(handle); /* diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 6b6d241..24775d3 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -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: tkDecls.h,v 1.11 2000/04/25 01:03:06 hobbs Exp $ + * RCS: @(#) $Id: tkDecls.h,v 1.11.2.1 2001/04/04 07:57:16 hobbs Exp $ */ #ifndef _TKDECLS @@ -820,6 +820,12 @@ EXTERN int Tk_PostscriptPhoto _ANSI_ARGS_((Tcl_Interp * interp, Tk_PhotoImageBlock * blockPtr, Tk_PostscriptInfo psInfo, int width, int height)); +/* 239 */ +EXTERN void Tk_CreateClientMessageHandler _ANSI_ARGS_(( + Tk_ClientMessageProc * proc)); +/* 240 */ +EXTERN void Tk_DeleteClientMessageHandler _ANSI_ARGS_(( + Tk_ClientMessageProc * proc)); typedef struct TkStubHooks { struct TkPlatStubs *tkPlatStubs; @@ -1071,6 +1077,8 @@ typedef struct TkStubs { int (*tk_PostscriptStipple) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap)); /* 236 */ double (*tk_PostscriptY) _ANSI_ARGS_((double y, Tk_PostscriptInfo psInfo)); /* 237 */ int (*tk_PostscriptPhoto) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PhotoImageBlock * blockPtr, Tk_PostscriptInfo psInfo, int width, int height)); /* 238 */ + void (*tk_CreateClientMessageHandler) _ANSI_ARGS_((Tk_ClientMessageProc * proc)); /* 239 */ + void (*tk_DeleteClientMessageHandler) _ANSI_ARGS_((Tk_ClientMessageProc * proc)); /* 240 */ } TkStubs; #ifdef __cplusplus @@ -2037,6 +2045,14 @@ extern TkStubs *tkStubsPtr; #define Tk_PostscriptPhoto \ (tkStubsPtr->tk_PostscriptPhoto) /* 238 */ #endif +#ifndef Tk_CreateClientMessageHandler +#define Tk_CreateClientMessageHandler \ + (tkStubsPtr->tk_CreateClientMessageHandler) /* 239 */ +#endif +#ifndef Tk_DeleteClientMessageHandler +#define Tk_DeleteClientMessageHandler \ + (tkStubsPtr->tk_DeleteClientMessageHandler) /* 240 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 21d2a46..70e8622 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.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: tkEntry.c,v 1.14 2000/04/21 04:06:26 hobbs Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.14.2.1 2001/04/04 07:57:16 hobbs Exp $ */ #include "tkInt.h" @@ -1043,12 +1043,6 @@ DestroyEntry(memPtr) char *memPtr; /* Info about entry widget. */ { Entry *entryPtr = (Entry *) memPtr; - entryPtr->flags |= ENTRY_DELETED; - - Tcl_DeleteCommandFromToken(entryPtr->interp, entryPtr->widgetCmd); - if (entryPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(DisplayEntry, (ClientData) entryPtr); - } /* * Free up all the stuff that requires special handling, then @@ -1076,6 +1070,14 @@ DestroyEntry(memPtr) Tk_FreeConfigOptions((char *) entryPtr, entryPtr->optionTable, entryPtr->tkwin); entryPtr->tkwin = NULL; + + /* + * Tcl_EventuallyFree should be used here or better yet in the + * DestroyNotify branch of EntryEventProc. However, that can lead + * complications in Tk_FreeConfigOptions where the display for the + * entry has been deleted by Tk_DestroyWindow, which is needed + * when freeing the cursor option. + */ ckfree((char *) entryPtr); } @@ -1324,13 +1326,12 @@ DisplayEntry(clientData) Entry *entryPtr = (Entry *) clientData; Tk_Window tkwin = entryPtr->tkwin; int baseY, selStartX, selEndX, cursorX; - int xBound; + int showSelection, xBound; Tk_FontMetrics fm; Pixmap pixmap; - int showSelection; entryPtr->flags &= ~REDRAW_PENDING; - if ((entryPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { + if ((entryPtr->flags & ENTRY_DELETED) || !Tk_IsMapped(tkwin)) { return; } @@ -1346,6 +1347,15 @@ DisplayEntry(clientData) } /* + * We do this check twice because updating the scrollbar can have + * the side-effect of destroying or unmapping the entry widget. + */ + + if ((entryPtr->flags & ENTRY_DELETED) || !Tk_IsMapped(tkwin)) { + return; + } + + /* * In order to avoid screen flashes, this procedure redraws the * textual area of the entry into off-screen memory, then copies * it back on-screen in a single operation. This means there's @@ -2023,7 +2033,15 @@ EntryEventProc(clientData, eventPtr) EventuallyRedraw(entryPtr); entryPtr->flags |= BORDER_NEEDED; } else if (eventPtr->type == DestroyNotify) { - DestroyEntry((char *) clientData); + if (!(entryPtr->flags & ENTRY_DELETED)) { + entryPtr->flags |= (ENTRY_DELETED | VALIDATE_ABORT); + Tcl_DeleteCommandFromToken(entryPtr->interp, + entryPtr->widgetCmd); + if (entryPtr->flags & REDRAW_PENDING) { + Tcl_CancelIdleCall(DisplayEntry, clientData); + } + DestroyEntry((char *) entryPtr); + } } else if (eventPtr->type == ConfigureNotify) { Tcl_Preserve((ClientData) entryPtr); entryPtr->flags |= UPDATE_SCROLLBAR; @@ -2431,7 +2449,7 @@ static void EventuallyRedraw(entryPtr) Entry *entryPtr; /* Information about widget. */ { - if ((entryPtr->tkwin == NULL) || !Tk_IsMapped(entryPtr->tkwin)) { + if ((entryPtr->flags & ENTRY_DELETED) || !Tk_IsMapped(entryPtr->tkwin)) { return; } @@ -2727,6 +2745,10 @@ EntryValidate(entryPtr, cmd) code = Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); + /* + * We accept TCL_OK and TCL_RETURN as valid return codes from the + * command callback. + */ if (code != TCL_OK && code != TCL_RETURN) { Tcl_AddErrorInfo(interp, "\n\t(in validation command executed by entry)"); @@ -2734,6 +2756,9 @@ EntryValidate(entryPtr, cmd) return TCL_ERROR; } + /* + * The command callback should return an acceptable Tcl boolean. + */ if (Tcl_GetBooleanFromObj(interp, Tcl_GetObjResult(interp), &bool) != TCL_OK) { Tcl_AddErrorInfo(interp, @@ -2817,15 +2842,27 @@ EntryValidateChange(entryPtr, change, new, index, type) * it means that a loop condition almost occured. Do not allow * this validation result to finish. */ + if (entryPtr->validate == VALIDATE_NONE || (!varValidate && (entryPtr->flags & VALIDATE_VAR))) { code = TCL_ERROR; } + + /* + * It's possible that the user deleted the entry during validation. + * In that case, abort future validation and return an error. + */ + + if (entryPtr->flags & ENTRY_DELETED) { + return TCL_ERROR; + } + /* * If validate will return ERROR, then disallow further validations * Otherwise, if it didn't accept the new string (returned TCL_BREAK) * then eval the invalidCmd (if it's set) */ + if (code == TCL_ERROR) { entryPtr->validate = VALIDATE_NONE; } else if (code == TCL_BREAK) { @@ -2854,6 +2891,15 @@ EntryValidateChange(entryPtr, change, new, index, type) entryPtr->validate = VALIDATE_NONE; } Tcl_DStringFree(&script); + + /* + * It's possible that the user deleted the entry during validation. + * In that case, abort future validation and return an error. + */ + + if (entryPtr->flags & ENTRY_DELETED) { + return TCL_ERROR; + } } } diff --git a/generic/tkEvent.c b/generic/tkEvent.c index abb2b14..57a15ac 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -6,12 +6,12 @@ * * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1995 Sun Microsystems, Inc. - * Copyright (c) 1998 by Scriptics Corporation. + * Copyright (c) 1998-2000 Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEvent.c,v 1.7 1999/12/16 21:57:36 hobbs Exp $ + * RCS: @(#) $Id: tkEvent.c,v 1.7.2.1 2001/04/04 07:57:16 hobbs Exp $ */ #include "tkPort.h" @@ -130,17 +130,16 @@ static unsigned long eventMasks[TK_LASTEVENT] = { */ typedef struct ThreadSpecificData { - - int genericHandlersActive; - /* The following variable has a non-zero + int handlersActive; /* The following variable has a non-zero * value when a handler is active. */ - InProgress *pendingPtr; - /* Topmost search in progress, or + InProgress *pendingPtr; /* Topmost search in progress, or * NULL if none. */ - GenericHandler *genericList; - /* First handler in the list, or NULL. */ - GenericHandler *lastGenericPtr; - /* Last handler in list. */ + + GenericHandler *genericList; /* First handler in the list, or NULL. */ + GenericHandler *lastGenericPtr; /* Last handler in list. */ + + GenericHandler *cmList; /* First handler in the list, or NULL. */ + GenericHandler *lastCmPtr; /* Last handler in list. */ /* * If someone has called Tk_RestrictEvents, the information below @@ -150,7 +149,7 @@ typedef struct ThreadSpecificData { Tk_RestrictProc *restrictProc; /* Procedure to call. NULL means no * restrictProc is currently in effect. */ - ClientData restrictArg; /* Argument to pass to restrictProc. */ + ClientData restrictArg; /* Argument to pass to restrictProc. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; @@ -162,6 +161,7 @@ static Tcl_ThreadDataKey dataKey; static void DelayedMotionProc _ANSI_ARGS_((ClientData clientData)); static int WindowEventProc _ANSI_ARGS_((Tcl_Event *evPtr, int flags)); + /* *-------------------------------------------------------------- @@ -354,16 +354,16 @@ Tk_CreateGenericHandler(proc, clientData) handlerPtr = (GenericHandler *) ckalloc (sizeof (GenericHandler)); - handlerPtr->proc = proc; - handlerPtr->clientData = clientData; - handlerPtr->deleteFlag = 0; - handlerPtr->nextPtr = NULL; + handlerPtr->proc = proc; + handlerPtr->clientData = clientData; + handlerPtr->deleteFlag = 0; + handlerPtr->nextPtr = NULL; if (tsdPtr->genericList == NULL) { - tsdPtr->genericList = handlerPtr; + tsdPtr->genericList = handlerPtr; } else { tsdPtr->lastGenericPtr->nextPtr = handlerPtr; } - tsdPtr->lastGenericPtr = handlerPtr; + tsdPtr->lastGenericPtr = handlerPtr; } /* @@ -392,7 +392,7 @@ Tk_DeleteGenericHandler(proc, clientData) { GenericHandler * handler; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (handler = tsdPtr->genericList; handler; handler = handler->nextPtr) { if ((handler->proc == proc) && (handler->clientData == clientData)) { @@ -401,6 +401,86 @@ Tk_DeleteGenericHandler(proc, clientData) } } +/*-------------------------------------------------------------- + * + * Tk_CreateClientMessageHandler -- + * + * Register a procedure to be called on each ClientMessage event. + * ClientMessage handlers are useful for Drag&Drop extensions. + * + * Results: + * None. + * + * Side Effects: + * From now on, whenever a ClientMessage event is received that isn't + * a WM_PROTOCOL event or SelectionEvent, invoke proc, giving it + * tkwin and the event as arguments. + * + *-------------------------------------------------------------- + */ + +void +Tk_CreateClientMessageHandler(proc) + Tk_ClientMessageProc *proc; /* Procedure to call on event. */ +{ + GenericHandler *handlerPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + + /* + * We use a GenericHandler struct, because it's basically the same, + * except with an extra clientData field we'll never use. + */ + handlerPtr = (GenericHandler *) + ckalloc (sizeof (GenericHandler)); + + handlerPtr->proc = (Tk_GenericProc *) proc; + handlerPtr->clientData = NULL; /* never used */ + handlerPtr->deleteFlag = 0; + handlerPtr->nextPtr = NULL; + if (tsdPtr->cmList == NULL) { + tsdPtr->cmList = handlerPtr; + } else { + tsdPtr->lastCmPtr->nextPtr = handlerPtr; + } + tsdPtr->lastCmPtr = handlerPtr; +} + +/* + *-------------------------------------------------------------- + * + * Tk_DeleteClientMessageHandler -- + * + * Delete a previously-created ClientMessage handler. + * + * Results: + * None. + * + * Side Effects: + * If there existed a handler as described by the parameters, + * that handler is logically deleted so that proc will not be + * invoked again. The physical deletion happens in the event + * loop in TkClientMessageEventProc. + * + *-------------------------------------------------------------- + */ + +void +Tk_DeleteClientMessageHandler(proc) + Tk_ClientMessageProc *proc; +{ + GenericHandler * handler; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + + for (handler = tsdPtr->cmList; handler != NULL; + handler = handler->nextPtr) { + if (handler->proc == (Tk_GenericProc *) proc) { + handler->deleteFlag = 1; + } + } +} + /* *-------------------------------------------------------------- * @@ -424,14 +504,16 @@ void TkEventInit _ANSI_ARGS_((void)) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - - tsdPtr->genericHandlersActive = 0; - tsdPtr->pendingPtr = NULL; - tsdPtr->genericList = NULL; - tsdPtr->lastGenericPtr = NULL; - tsdPtr->restrictProc = NULL; - tsdPtr->restrictArg = NULL; + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + + tsdPtr->handlersActive = 0; + tsdPtr->pendingPtr = NULL; + tsdPtr->genericList = NULL; + tsdPtr->lastGenericPtr = NULL; + tsdPtr->cmList = NULL; + tsdPtr->lastCmPtr = NULL; + tsdPtr->restrictProc = NULL; + tsdPtr->restrictArg = NULL; } /* @@ -465,7 +547,7 @@ Tk_HandleEvent(eventPtr) TkDisplay *dispPtr; Tcl_Interp *interp = (Tcl_Interp *) NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * Hack for simulated X-events: Correct the state field @@ -503,7 +585,7 @@ Tk_HandleEvent(eventPtr) for (genPrevPtr = NULL, genericPtr = tsdPtr->genericList; genericPtr != NULL; ) { if (genericPtr->deleteFlag) { - if (!tsdPtr->genericHandlersActive) { + if (!tsdPtr->handlersActive) { GenericHandler *tmpPtr; /* @@ -528,9 +610,9 @@ Tk_HandleEvent(eventPtr) } else { int done; - tsdPtr->genericHandlersActive++; + tsdPtr->handlersActive++; done = (*genericPtr->proc)(genericPtr->clientData, eventPtr); - tsdPtr->genericHandlersActive--; + tsdPtr->handlersActive--; if (done) { return; } @@ -710,10 +792,55 @@ Tk_HandleEvent(eventPtr) || (eventPtr->type == SelectionRequest) || (eventPtr->type == SelectionNotify)) { TkSelEventProc((Tk_Window) winPtr, eventPtr); - } else if ((eventPtr->type == ClientMessage) - && (eventPtr->xclient.message_type == - Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS"))) { - TkWmProtocolEventProc(winPtr, eventPtr); + } else if (eventPtr->type == ClientMessage) { + if (eventPtr->xclient.message_type == + Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS")) { + TkWmProtocolEventProc(winPtr, eventPtr); + } else { + /* + * Finally, invoke any ClientMessage event handlers. + */ + + for (genPrevPtr = NULL, genericPtr = tsdPtr->cmList; + genericPtr != NULL; ) { + if (genericPtr->deleteFlag) { + if (!tsdPtr->handlersActive) { + GenericHandler *tmpPtr; + + /* + * This handler needs to be deleted and there are + * no calls pending through any handlers, so now + * is a safe time to delete it. + */ + + tmpPtr = genericPtr->nextPtr; + if (genPrevPtr == NULL) { + tsdPtr->cmList = tmpPtr; + } else { + genPrevPtr->nextPtr = tmpPtr; + } + if (tmpPtr == NULL) { + tsdPtr->lastGenericPtr = genPrevPtr; + } + (void) ckfree((char *) genericPtr); + genericPtr = tmpPtr; + continue; + } + } else { + int done; + + tsdPtr->handlersActive++; + done = (*(Tk_ClientMessageProc *)genericPtr->proc) + ((Tk_Window) winPtr, eventPtr); + tsdPtr->handlersActive--; + if (done) { + break; + } + } + genPrevPtr = genericPtr; + genericPtr = genPrevPtr->nextPtr; + } + } } } else { for (handlerPtr = winPtr->handlerList; handlerPtr != NULL; ) { diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index 0528351..4dd8031 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -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: tkFileFilter.c,v 1.3 1999/04/16 01:51:13 stanton Exp $ + * RCS: @(#) $Id: tkFileFilter.c,v 1.3.12.1 2001/04/04 07:57:16 hobbs Exp $ */ #include "tkInt.h" @@ -270,7 +270,7 @@ static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows) /* * Prepend a "*" to patterns that do not have a leading "*" */ - globPtr->pattern = (char*)ckalloc(len+1); + globPtr->pattern = (char*)ckalloc((unsigned int) len+1); globPtr->pattern[0] = '*'; strcpy(globPtr->pattern+1, globList[i]); } @@ -289,11 +289,11 @@ static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows) strcpy(globPtr->pattern, "*."); } else { - globPtr->pattern = (char*)ckalloc(len); + globPtr->pattern = (char*)ckalloc((unsigned int) len); strcpy(globPtr->pattern, globList[i]); } } else { - globPtr->pattern = (char*)ckalloc(len); + globPtr->pattern = (char*)ckalloc((unsigned int) len); strcpy(globPtr->pattern, globList[i]); } diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 1851965..c9d6030 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.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: tkGeometry.c,v 1.3 1999/04/16 01:51:14 stanton Exp $ + * RCS: @(#) $Id: tkGeometry.c,v 1.3.12.1 2001/04/04 07:57:16 hobbs Exp $ */ #include "tkPort.h" @@ -250,6 +250,26 @@ Tk_MaintainGeometry(slave, master, x, y, width, height) Tk_Window ancestor, parent; TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr; + if (master == Tk_Parent(slave)) { + /* + * If the slave is a direct descendant of the master, don't bother + * setting up the extra infrastructure for management, just make a + * call to Tk_MoveResizeWindow; the parent/child relationship will + * take care of the rest. + */ + Tk_MoveResizeWindow(slave, x, y, width, height); + + /* + * Map the slave if the master is already mapped; otherwise, wait + * until the master is mapped later (in which case mapping the slave + * is taken care of elsewhere). + */ + if (Tk_IsMapped(master)) { + Tk_MapWindow(slave); + } + return; + } + if (!dispPtr->geomInit) { dispPtr->geomInit = 1; Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS); @@ -374,6 +394,15 @@ Tk_UnmaintainGeometry(slave, master) Tk_Window ancestor; TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; + if (master == Tk_Parent(slave)) { + /* + * If the slave is a direct descendant of the master, + * Tk_MaintainGeometry will not have set up any of the extra + * infrastructure. Don't even bother to look for it, just return. + */ + return; + } + if (!dispPtr->geomInit) { dispPtr->geomInit = 1; Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS); diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index e3aad9f..f2f3bec 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -15,7 +15,7 @@ * Department of Computer Science, * Australian National University. * - * RCS: @(#) $Id: tkImgPhoto.c,v 1.18 2000/04/25 01:03:06 hobbs Exp $ + * RCS: @(#) $Id: tkImgPhoto.c,v 1.18.2.1 2001/04/04 07:57:16 hobbs Exp $ */ #include "tkInt.h" @@ -963,7 +963,7 @@ ImgPhotoCmd(clientData, interp, objc, objv) } if ((*imageFormat->stringReadProc)(interp, data, format, (Tk_PhotoHandle) masterPtr, - 0, 0, imageWidth, imageHeight, options.toX, options.toY) + options.toX, options.toY, imageWidth, imageHeight, 0, 0) != TCL_OK) { return TCL_ERROR; } @@ -1976,7 +1976,6 @@ ImgPhotoGet(tkwin, masterData) Colormap colormap; int mono, nRed, nGreen, nBlue; XVisualInfo visualInfo, *visInfoPtr; - XRectangle validBox; char buf[TCL_INTEGER_SPACE * 3]; int numVisuals; XColor *white, *black; @@ -2136,16 +2135,6 @@ ImgPhotoGet(tkwin, masterData) masterPtr->width, masterPtr->height); } - /* - * Dither the image to fill in this instance's pixmap. - */ - - TkClipBox(masterPtr->validRegion, &validBox); - if ((validBox.width > 0) && (validBox.height > 0)) { - DitherInstance(instancePtr, validBox.x, validBox.y, validBox.width, - validBox.height); - } - return (ClientData) instancePtr; } diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 4e9081a..89cd345 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.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: tkListbox.c,v 1.16 2000/03/02 21:52:41 hobbs Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.16.2.1 2001/04/04 07:57:17 hobbs Exp $ */ #include "tkPort.h" @@ -1412,16 +1412,6 @@ DestroyListbox(memPtr) Tcl_HashEntry *entry; Tcl_HashSearch search; - listPtr->flags |= LISTBOX_DELETED; - - Tcl_DeleteCommandFromToken(listPtr->interp, listPtr->widgetCmd); - if (listPtr->setGrid) { - Tk_UnsetGrid(listPtr->tkwin); - } - if (listPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(DisplayListbox, (ClientData) listPtr); - } - /* If we have an internal list object, free it */ if (listPtr->listObj != NULL) { Tcl_DecrRefCount(listPtr->listObj); @@ -1766,6 +1756,9 @@ DisplayListbox(clientData) Pixmap pixmap; listPtr->flags &= ~REDRAW_PENDING; + if (listPtr->flags & LISTBOX_DELETED) { + return; + } if (listPtr->flags & MAXWIDTH_IS_STALE) { ListboxComputeGeometry(listPtr, 0, 1, 0); @@ -1780,7 +1773,7 @@ DisplayListbox(clientData) ListboxUpdateHScrollbar(listPtr); } listPtr->flags &= ~(REDRAW_PENDING|UPDATE_V_SCROLLBAR|UPDATE_H_SCROLLBAR); - if ((listPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { + if ((listPtr->flags & LISTBOX_DELETED) || !Tk_IsMapped(tkwin)) { return; } @@ -2365,7 +2358,17 @@ ListboxEventProc(clientData, eventPtr) NearestListboxElement(listPtr, eventPtr->xexpose.y + eventPtr->xexpose.height)); } else if (eventPtr->type == DestroyNotify) { - DestroyListbox((char *) clientData); + if (!(listPtr->flags & LISTBOX_DELETED)) { + listPtr->flags |= LISTBOX_DELETED; + Tcl_DeleteCommandFromToken(listPtr->interp, listPtr->widgetCmd); + if (listPtr->setGrid) { + Tk_UnsetGrid(listPtr->tkwin); + } + if (listPtr->flags & REDRAW_PENDING) { + Tcl_CancelIdleCall(DisplayListbox, clientData); + } + Tcl_EventuallyFree(clientData, DestroyListbox); + } } else if (eventPtr->type == ConfigureNotify) { int vertSpace; @@ -2979,7 +2982,7 @@ EventuallyRedrawRange(listPtr, first, last) /* We don't have to register a redraw callback if one is already pending, * or if the window doesn't exist, or if the window isn't mapped */ if ((listPtr->flags & REDRAW_PENDING) - || (listPtr->tkwin == NULL) + || (listPtr->flags & LISTBOX_DELETED) || !Tk_IsMapped(listPtr->tkwin)) { return; } diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 6ceddf0..d735cf5 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.6.2.1 2000/08/05 23:53:12 hobbs Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.6.2.2 2001/04/04 07:57:17 hobbs Exp $ */ /* @@ -1106,7 +1106,13 @@ TkInvokeMenu(interp, menuPtr, index) } Tcl_DecrRefCount(valuePtr); } - if ((result == TCL_OK) && (mePtr->commandPtr != NULL)) { + /* + * We check numEntries in addition to whether the menu entry + * has a command because that goes to zero if the menu gets + * deleted (e.g., during command evaluation). + */ + if ((menuPtr->numEntries != 0) && (result == TCL_OK) + && (mePtr->commandPtr != NULL)) { Tcl_Obj *commandPtr = mePtr->commandPtr; Tcl_IncrRefCount(commandPtr); diff --git a/generic/tkStubImg.c b/generic/tkStubImg.c index 7e1e23f..1cb0090 100644 --- a/generic/tkStubImg.c +++ b/generic/tkStubImg.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: tkStubImg.c,v 1.1 2000/02/08 11:31:33 hobbs Exp $ + * RCS: @(#) $Id: tkStubImg.c,v 1.1.2.1 2001/04/04 07:57:17 hobbs Exp $ */ #include "tcl.h" @@ -61,6 +61,8 @@ Tk_InitImageArgs(interp, argc, argvPtr) } if (cmdInfo.isNativeObjectProc == 1) { useNewImage = 1; /* Tk uses the new image interface */ + } else { + useNewImage = 0; /* Tk uses old image interface */ } } if (useNewImage && (argc > 0)) { diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index ea50f6a..fc483ed 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.22 2000/04/25 01:03:07 hobbs Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.22.2.1 2001/04/04 07:57:17 hobbs Exp $ */ #include "tkInt.h" @@ -949,6 +949,8 @@ TkStubs tkStubs = { Tk_PostscriptStipple, /* 236 */ Tk_PostscriptY, /* 237 */ Tk_PostscriptPhoto, /* 238 */ + Tk_CreateClientMessageHandler, /* 239 */ + Tk_DeleteClientMessageHandler, /* 240 */ }; /* !END!: Do not edit above this line. */ diff --git a/library/entry.tcl b/library/entry.tcl index 9e51397..3487796 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk entry widgets and provides # procedures that help in implementing those bindings. # -# RCS: @(#) $Id: entry.tcl,v 1.11 2000/01/06 02:22:24 hobbs Exp $ +# RCS: @(#) $Id: entry.tcl,v 1.11.2.1 2001/04/04 07:57:17 hobbs Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -336,7 +336,7 @@ proc tkEntryButton1 {w x} { set tkPriv(pressX) $x $w icursor [tkEntryClosestGap $w $x] $w selection from insert - if {[string equal [$w cget -state] "normal"]} {focus $w} + if {[string compare "disabled" [$w cget -state]]} {focus $w} } # tkEntryMouseSelect -- @@ -390,6 +390,9 @@ proc tkEntryMouseSelect {w x} { $w selection range 0 end } } + if {$tkPriv(mouseMoved)} { + $w icursor $cur + } update idletasks } @@ -406,7 +409,7 @@ proc tkEntryPaste {w x} { $w icursor [tkEntryClosestGap $w $x] catch {$w insert insert [selection get -displayof $w]} - if {[string equal [$w cget -state] "normal"]} {focus $w} + if {[string compare "disabled" [$w cget -state]]} {focus $w} } # tkEntryAutoScan -- diff --git a/library/safetk.tcl b/library/safetk.tcl index 5287d5e..62d7934 100644 --- a/library/safetk.tcl +++ b/library/safetk.tcl @@ -2,7 +2,7 @@ # # Support procs to use Tk in safe interpreters. # -# RCS: @(#) $Id: safetk.tcl,v 1.6.2.1 2000/08/05 23:52:07 hobbs Exp $ +# RCS: @(#) $Id: safetk.tcl,v 1.6.2.2 2001/04/04 07:57:17 hobbs Exp $ # # Copyright (c) 1997 Sun Microsystems, Inc. # @@ -40,7 +40,7 @@ namespace eval ::safe { # We have to make sure that the tk_library variable uses a file # pathname that works better in Tk (of the style returned by # [file join], ie C:/path/to/tk/lib, not C:\path\to\tk\lib - set tk_library [eval [list file join] [file split $tk_library]] + set tk_library [file join $tk_library] # Clear Tk's access for that interp (path). allowTk $slave $argv diff --git a/library/text.tcl b/library/text.tcl index 9eb2cd0..7b306cc 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk text widgets and provides # procedures that help in implementing the bindings. # -# RCS: @(#) $Id: text.tcl,v 1.12 2000/04/17 23:24:29 ericm Exp $ +# RCS: @(#) $Id: text.tcl,v 1.12.2.1 2001/04/04 07:57:17 hobbs Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -36,7 +36,7 @@ #------------------------------------------------------------------------- #------------------------------------------------------------------------- -# The code below creates the default class bindings for entries. +# The code below creates the default class bindings for text widgets. #------------------------------------------------------------------------- # Standard Motif bindings: @@ -182,9 +182,11 @@ bind Text { } bind Text { - tkTextInsert %W \t - focus %W - break + if { [string equal [%W cget -state] "normal"] } { + tkTextInsert %W \t + focus %W + break + } } bind Text { # Needed only to keep binding from triggering; doesn't @@ -579,15 +581,9 @@ proc tkTextSelectTo {w x y {extend 0}} { } } if {$tkPriv(mouseMoved) || [string compare $tkPriv(selectMode) "char"]} { - if {[string compare $tcl_platform(platform) "unix"] \ - && [$w compare $cur < anchor]} { - $w mark set insert $first - } else { - $w mark set insert $last - } - $w tag remove sel 0.0 $first + $w tag remove sel 0.0 end + $w mark set insert $cur $w tag add sel $first $last - $w tag remove sel $last end update idletasks } } @@ -740,7 +736,10 @@ proc tkTextResetAnchor {w index} { global tkPriv if {[string equal [$w tag ranges sel] ""]} { - $w mark set anchor $index + # Don't move the anchor if there is no selection now; this makes + # the widget behave "correctly" when the user clicks once, then + # shift-clicks somewhere -- ie, the area between the two clicks will be + # selected. [Bug: 5929]. return } set a [$w index $index] diff --git a/library/tk.tcl b/library/tk.tcl index 333816b..79d743e 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -3,7 +3,7 @@ # Initialization script normally executed in the interpreter for each # Tk-based application. Arranges class bindings for widgets. # -# RCS: @(#) $Id: tk.tcl,v 1.20 2000/03/24 19:38:57 ericm Exp $ +# RCS: @(#) $Id: tk.tcl,v 1.20.2.1 2001/04/04 07:57:17 hobbs Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -29,6 +29,11 @@ if {[info exists auto_path] && [string compare {} $tk_library] && \ set tk_strictMotif 0 +# Turn on useinputmethods (X Input Methods) by default. +# We catch this because safe interpreters may not allow the call. + +catch {tk useinputmethods 1} + # Create a ::tk namespace namespace eval ::tk { @@ -104,7 +109,9 @@ proc ::tk::SetFocusGrab {grab {focus {}}} { if {[winfo exists $oldGrab]} { lappend data [grab status $oldGrab] } - grab $grab + # The "grab" command will fail if another application + # already holds the grab. So catch it. + catch {grab $grab} if {[winfo exists $focus]} { focus $focus } @@ -280,7 +287,10 @@ switch $tcl_platform(platform) { switch $tcl_platform(os) { "IRIX" - "Linux" { event add <> } - "HP-UX" { event add <> } + "HP-UX" { + # This seems to be correct on *some* HP systems. + catch { event add <> } + } } } trace variable tk_strictMotif w tkEventMotifBindings diff --git a/mac/README b/mac/README index e99ba87..c0ea9d8 100644 --- a/mac/README +++ b/mac/README @@ -8,7 +8,7 @@ Jim Ingham Cygnus Solutions jingham@cygnus.com -RCS: @(#) $Id: README,v 1.13 2000/04/26 17:37:35 hobbs Exp $ +RCS: @(#) $Id: README,v 1.13.2.1 2001/04/04 07:57:17 hobbs Exp $ 1. Introduction --------------- @@ -83,5 +83,4 @@ Special notes: If you have comments or Bug reports, use our on-line database at - http://dev.scriptics.com/ticket/ - + http://tcl.sourceforge.net/ diff --git a/tests/bind.test b/tests/bind.test index 25ac2c3..f32b346 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: bind.test,v 1.7 1999/12/14 06:53:11 hobbs Exp $ +# RCS: @(#) $Id: bind.test,v 1.7.2.1 2001/04/04 07:57:17 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -1945,7 +1945,7 @@ test bind-22.2 {HandleEventGenerate} { } {1 {bad window name/identifier "zzz"}} test bind-22.3 {HandleEventGenerate} { list [catch {event gen 47 } msg] $msg -} {1 {window id "47" doesn't exist in this application}} +} {1 {bad window name/identifier "47"}} test bind-22.4 {HandleEventGenerate} { setup bind .b.f