diff options
author | Joe Mistachkin <joe@mistachkin.com> | 2014-11-11 22:23:34 (GMT) |
---|---|---|
committer | Joe Mistachkin <joe@mistachkin.com> | 2014-11-11 22:23:34 (GMT) |
commit | b15c525eedc93a453dfea94482bc1198e27748fc (patch) | |
tree | 49a88f59bc168351fe802d8aa68da6d853b823aa | |
parent | 07f85cd3c1b4934fb746ea36516ba2944b4eea11 (diff) | |
parent | ee9722cf78769c35f57383613f570b6e797e74bf (diff) | |
download | tk-b15c525eedc93a453dfea94482bc1198e27748fc.zip tk-b15c525eedc93a453dfea94482bc1198e27748fc.tar.gz tk-b15c525eedc93a453dfea94482bc1198e27748fc.tar.bz2 |
Merge updates from core 8.5 branch.
295 files changed, 3516 insertions, 2733 deletions
diff --git a/.fossil-settings/binary-glob b/.fossil-settings/binary-glob new file mode 100644 index 0000000..ca85874 --- /dev/null +++ b/.fossil-settings/binary-glob @@ -0,0 +1,3 @@ +*.bmp +*.gif +*.png diff --git a/.fossil-settings/crnl-glob b/.fossil-settings/crnl-glob new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.fossil-settings/crnl-glob diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob new file mode 100644 index 0000000..e404f52 --- /dev/null +++ b/.fossil-settings/ignore-glob @@ -0,0 +1,21 @@ +*.a +*.dll +*.dylib +*.exe +*.exp +*.lib +*.o +*.obj +*.res +*.sl +*.so +*/Makefile +*/config.cache +*/config.log +*/config.status +*/tkConfig.sh +*/wish* +*/tktest* +*/versions.vc +doc/man.macros +unix/tk.pc diff --git a/.project b/.project new file mode 100644 index 0000000..c98b39d --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>tk8.5</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + </buildSpec> + <natures> + </natures> +</projectDescription> diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 0000000..5a0ad22 --- /dev/null +++ b/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +line.separator=\n @@ -1,3 +1,137 @@ +A NOTE ON THE CHANGELOG: +Starting in early 2011, Tk source code has been under the management of +fossil, hosted at http://core.tcl.tk/tk/ . Fossil presents a "Timeline" +view of changes made that is superior in every way to a hand edited log file. +Because of this, many Tcl developers are now out of the habit of maintaining +this log file. You may still find useful things in it, but the Timeline is +a better first place to look now. +============================================================================ + +2013-08-30 Don Porter <dgp@users.sourceforge.net> + + * generic/tk.h: Bump to 8.5.15 for release. + * library/tk.tcl: + * unix/configure.in: + * unix/tk.spec: + * win/configure.in: + * README: + + * unix/configure: autoconf-2.59 + * win/configure: + +2013-08-25 Kevin Walzer <wordtech@users.sourceforge.net> + + * macosx/tkMacOSXButton.c: Bug [3016181]: Crash after scrollbar + * macosx/tkMacOSXMenu.c: destroyed, Tk Cocoa. + * macosx/tkMacOSXScrlbr.c: + * macosx/tkMacOSXWm.c: + +2012-08-15 Joe English <jenglish@users.sourceforge.net> + + * library/ttk/progress.tcl: Bug [c597acdab3]: Call [$pb step] + in tail position in ttk::progressbar::Autoincrement, so that + the widget is in a consistent state when any write traces on + the linked -variable are fired. + +2013-07-02 Jan Nijtmans <nijtmans@users.sf.net> + + * unix/tcl.m4: Bug [32afa6e256]: dirent64 check is incorrect in tcl.m4 + * unix/configure: (thanks to Brian Griffin) + +2012-06-28 Jan Nijtmans <nijtmans@users.sf.net> + + * library/ttk/scale.tcl: [Bug 2501278]: ttk::scale keyboard binding + problem. + +2012-06-07 Jan Nijtmans <nijtmans@users.sf.net> + + * win/tkWinDialog.c: [Bug 1913750]: tk_chooseDirectory -initialdir + internationalization problem. + [Bug 3500545]: tk_getOpenFile -multiple 1 wrong on windows. + [Bug 3416492]: Crash in open/save file dialog in Windows 7 libraries. + [Bug 3095112]: crash when selecting file from Win7 Library. + (All of those backported from Tk 8.6) + +2013-06-05 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/ttk/ttkScroll.c: [Bug 3613759]: ttk::entry and symbolic + index names. + * generic/ttk/ttkEntry.c: [Bug 2100430]: ttk::entry widget index + must be integer + * generic/tkEntry.c: Don't set interp result when it will be + overwritten later. + +2013-05-19 Jan Nijtmans <nijtmans@users.sf.net> + + * unix/tcl.m4: Fix for FreeBSD, and remove support for older + * unix/configure: FreeBSD versions. Patch by Pietro Cerutti. + +2013-04-10 Jan Nijtmans <nijtmans@users.sf.net> + + * win/makefile.vc: [Bug 3568760]: Tk documentation fails to build + +2013-04-01 Don Porter <dgp@users.sourceforge.net> + + *** 8.5.14 TAGGED FOR RELEASE *** + + * generic/tk.h: Bump to 8.5.14 for release. + * library/tk.tcl: + * unix/configure.in: + * unix/tk.spec: + * win/configure.in: + * README: + + * unix/configure: autoconf-2.59 + * win/configure: + + * generic/tkInt.h: [Bug 3607830] Runtime checks that Xkb is + * unix/tkUnixEvent.c: available in the X server before trying to + * unix/tkUnixKey.c: use. Adapted from patch from Brian Griffin. + +2013-03-27 Jan Nijtmans <nijtmans@users.sf.net> + + * library/button.tcl: [Bug 3608074]: Add <<Invoke>> bindings to + * library/listbox.tcl: Button's, Listbox and Menu. + * library/menu.tcl: + * doc/event.n: Document <<Invoke>>, <<ThemeChanged>>, + * doc/ttk_panedwindow.n: <<EnteredChild>> (ttk_pandedwindow only) and + * doc/ttk_spinbox.n: <<Increment/Decrement>> (ttk_spinbox only) + +2013-03-13 Jan Nijtmans <nijtmans@users.sf.net> + + * unix/tcl.m4: Patch by Andrew Shadura, providing better support for + three architectures they have in Debian. + +2013-03-11 Don Porter <dgp@users.sourceforge.net> + + * generic/tkListbox.c: [Bug 3607326] Stop segfault from + * tests/listbox.test: [listbox .l -listvariable $array]. + +2013-02-28 Donal K. Fellows <dkf@users.sf.net> + + * unix/tkUnixKey.c (TkpGetKeySym): [Bug 3599312]: Put the + initialization of the key mapping before the input method handling so + that Alt key handling is correct on non-OSX Unix. Thanks to Colin + McDonald for developing the fix. + +2013-01-16 Jan Nijtmans <nijtmans@users.sf.net> + + * win/Makefile.in: Don't compile Tk with -DTCL_NO_DEPRECATED by + * unix/Makefile.in: default any more, it might hurt when we compile Tk + 8.x against Tcl 8.y with y > x, because new deprecated constructs + might be added in higher Tcl versions (except for Tk 8.6, for now, + because there is no higher 8.x yet). + +2013-01-14 Jan Nijtmans <nijtmans@users.sf.net> + + * win/tcl.m4: More flexible search for win32 tclConfig.sh, + * win/configure: backported from TEA. + +2012-12-03 François Vogel <fvogelnew1@free.fr> + + * generic/tkTextIndex.c: [Bug 3588824]: bug in image index handling + * tests/textIndex.test: for weird image names + 2012-11-16 Joe Mistachkin <joe@mistachkin.com> * generic/tkBind.c: Add support for an 'M' binding substitution @@ -7,8 +141,8 @@ 2012-11-13 Jan Nijtmans <nijtmans@users.sf.net> * win/tkWinTest.c: [Bug 3585396]: winDialog.test requires user - * tests/winDialog.test: interaction. Renumber test-cases as in - Tk 8.6, and convert various to tcltest-2 style. + * tests/winDialog.test: interaction. Renumber test-cases as in Tk 8.6, + and convert various to tcltest-2 style. 2012-11-09 Don Porter <dgp@users.sourceforge.net> @@ -121,7 +255,7 @@ * win/rules.vc: Backport some improvements from Tcl 8.6 * win/makefile.vc: -2012-08-11 Francois Vogel <fvogelnew1@free.fr> +2012-08-11 François Vogel <fvogelnew1@free.fr> * generic/tkTextTag.c: [Bug 3554273]: Test textDisp-32.2 failed @@ -132,11 +266,11 @@ * unix/tkUnixKey.c: The warnings were false flags from a * unix/tkUnixRFont.c: faulty OpenBSD C compiler. -2012-08-03 Francois Vogel <fvogelnew1@free.fr> +2012-08-03 François Vogel <fvogelnew1@free.fr> * tests/bind.test: [Bug 3554081]: Test bind-22.10 failed -2012-08-02 Francois Vogel <fvogelnew1@free.fr> +2012-08-02 François Vogel <fvogelnew1@free.fr> * tests/spinbox.test: [Bug 3553311]: Test spinbox-3.70 failed @@ -267,11 +401,11 @@ * generic/tk*Decls.h: re-generated * win/Makefile.in: "make genstubs" when cross-compiling on UNIX -2012-05-28 Francois Vogel <fvogelnew1@free.fr> +2012-05-28 François Vogel <fvogelnew1@free.fr> * doc/text.n: [Bug 1630251]: Doc for -endline option was wrong -2012-05-28 Francois Vogel <fvogelnew1@free.fr> +2012-05-28 François Vogel <fvogelnew1@free.fr> * generic/tkTextDisp.c: [Bug 1630254]: missing scrolling of text widget when from a -startline == -endline initial state it is configured to @@ -381,7 +515,7 @@ * unix/tcl.m4: Patch from the cygwin folks * unix/configure: (re-generated) -2012-02-28 Francois Vogel <fvogelnew1@free.fr> +2012-02-28 François Vogel <fvogelnew1@free.fr> * generic/tkText.c: [Bug 1630262, Bug 1615425]: segfault * generic/tkTextBTree.c when deleting lines or tagging outside of @@ -427,7 +561,7 @@ * win/tkWinDialog.c: [Bug 3480471]: tk_getOpenFile crashes on Win64 -2012-01-26 Francois Vogel <fvogelnew1@free.fr> +2012-01-26 François Vogel <fvogelnew1@free.fr> * generic/tkTextDisp.c: [Bug-1754043] and [Bug-2321450]: When -blockcursor is true, the cursor appears as a blinking bar which @@ -438,26 +572,26 @@ * generic/tkImgPhoto.c: [Bug 2433260]: non-critical error in Tk_PhotoPutBlock -2012-01-25 Francois Vogel <fvogelnew1@free.fr> +2012-01-25 François Vogel <fvogelnew1@free.fr> * generic/tkText.c: Don't increase the epoch twice -2012-01-25 Francois Vogel <fvogelnew1@free.fr> +2012-01-25 François Vogel <fvogelnew1@free.fr> * generic/tkText.c: [Bug-1630271]: segfault/infinite loop * generic/tkTextMark.c: when a mark is before -startline * tests/textMark.test: -2012-01-25 Francois Vogel <fvogelnew1@free.fr> +2012-01-25 François Vogel <fvogelnew1@free.fr> * generic/tkText.c: [Bug-3475627]: Test text-31.11 fails -2012-01-22 Francois Vogel <fvogelnew1@free.fr> +2012-01-22 François Vogel <fvogelnew1@free.fr> * generic/tkTextMark.c: [Bug-3288113,3288121]: Missing marks/endless * tests/textMark.test: loop in text mark prev/next -2012-01-19 Francois Vogel <fvogelnew1@free.fr> +2012-01-19 François Vogel <fvogelnew1@free.fr> * generic/tkText.c: [Bug-3021557]: Moving the cursor in * tests/text.test: elided text freezes Tk @@ -1,14 +1,13 @@ README: Tk - This is the Tk 8.5.13 source distribution. - http://tcl.sourceforge.net/ - You can get any source release of Tcl from the file distributions - link at the above URL. + This is the Tk 8.5.17 source distribution. + http://sourceforge.net/projects/tcl/files/Tcl/ + You can get any source release of Tk from the URL above. 1. Introduction --------------- -This directory contains the sources and documentation for Tk, an X11 -toolkit implemented with the Tcl scripting language. +This directory contains the sources and documentation for Tk, a +cross-platform GUI toolkit implemented with the Tcl scripting language. For details on features, incompatibilities, and potential problems with this release, see the Tcl/Tk 8.5 Web page at @@ -18,11 +17,11 @@ this release, see the Tcl/Tk 8.5 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 by members of the -Tcl community. The home for Tcl/Tk sources and bug database is on -SourceForge at: +Tk is maintained, enhanced, and distributed freely by the Tcl community. +Source code development and tracking of bug reports and feature requests +takes place at: - http://tcl.sourceforge.net/ + http://core.tcl.tk/tk/ with the Tcl Developer Xchange at: @@ -6867,3 +6867,101 @@ Many revisions to better support a Cygwin environment (nijtmans) 2012-11-07 (bug fix)[3574708] TkSetFocusWin() crash on XP (mcdonald) --- Released 8.5.13, November 12, 2012 --- See ChangeLog for details --- + +2012-12-04 (bug fix)[3588824] text index of images with weird names (gavilan) + +2012-12-06 (bug fix) avoid buggy syscall to parse hex color values (fellows) + +2013-01-22 (bug fix)[3601782] Tcl_InitStubs failure message (nijtmans) + +2013-01-31 (bug fix)[3599928] use XKeycodeToKeysym on old systems (cassoff) + +2013-02-04 (bug fix)[3603077] treeview update on tag add/remove (english) + +2013-02-28 (bug fix)[3599312] First Alt key event is lost (mcdonald) + +2013-03-11 (bug fix)[3607326] Crash [listbox .l -listvariable $array] (porter) + +2013-03-13 (enhancement) better build support for Debian arch (shadura) + +2013-03-27 (bug fix)[3608074] button, listbox, menu <<Invoke>> (nijtmans) + +2013-04-01 (bug fix)[3607830] Xkb runtime checks (griffin) + +--- Released 8.5.14, April 3, 2013 --- See ChangeLog for details --- + +2013-05-19 (platform support) FreeBSD updates (cerutti) + +2013-06-05 (bug fix)[3613759] [ttk::entry .e; .e xview end] (nijtmans) + +2013-06-05 (bug fix)[2100430] [ttk::entry .e; .e xview insert] (nijtmans) + +2013-06-07 (bug fix)[1913750,3500545,3416492,3095112] file dialogs (nijtmans) + +2013-06-28 (bug fix)[2501278] reverse ttk::scale key bindings {mcdonald) + +2013-06-28 (bug fix)[3588364] crash loading Tk 64-bit windows (nijtmans) + +2013-07-02 (bug fix)[32afa6] corrected dirent64 check (griffin) + +2013-08-25 (bug fix)[3016181] Cocoa: [destroy $scrollbar] => crash (goddard) + +2013-08-26 (bug fix)[c597acd] [$pb step] work with traces (english) + +2013-09-15 (bug fix)[8eb5671] macosx Tk compile errors w/clang (deily) + +--- Released 8.5.15, September 18, 2013 --- http://core.tcl.tk/tk/ for details + +2013-10-27 (bug fix) OSX drawing lags (deily,steffen,walzer) + +2013-10-28 (bug fix)[3603436] png wrong component indices (nijtmans) + +2013-10-31 (bug fix) C++ friendly stubs struct declarations (nijtmans) + +2013-10-31 (bug fix) double free of a TkFont (nijtmans) + +2013-11-03 (bug fix)[1632447] support PPM maxval up to 65535 (fellows) + +2013-11-05 (bug fix)[426679e] OpenBSD man page rendering (nijtmans) + +2013-11-11 (bug fix)[0aa5e85] option file \n syntax support (nijtmans) + +2013-11-20 (platforms) Support for Windows 8.1 (nijtmans) + +2014-01-23 (bug fix)[3606644] X: correct fontconfig dependence (venable) + +2014-01-23 (bug fix) FreeBSD build fixes (cerutti) + +2014-02-06 (bug fix)[3279221] [menu] event race (danckaert,kupries) + +2014-02-11 (bug fix)[52ca3e7] XkbOpenDisplay macro correction (nijtmans) + +2014-03-16 (bug fix) Xcode 5.1 update; Retina displays (walzer) + +2014-03-20 (bug fix)[2f7cbd0] FreeBSD 10.0 build failure (nijtmans) + +2014-04-01 (bug fix)[5bcb502] @TK_LIBS@ in pkgconfig (badshah400,nijtmans) + +2014-05-27 (bug fix)[a80f5d7] autoscroll initiation (crogers,english) + +2014-07-07 (bug fix) OSX alpha channel rendering (culler,walzer) + +2014-07-24 (bug fix) OSX [text] image display & scrolling (culler,walzer) + +2014-08-01 (bug fix) OSX font config crash (rob@bitkeeper) + +--- Released 8.5.16, August 25, 2014 --- http://core.tcl.tk/tk/ for details + +2014-08-27 (bug) Cocoa: Crash after [$button destroy] (walzer) + +2014-09-23 (bug) Cocoa: button and scroll display fixes (walzer) + +2014-09-24 (bug) Cocoa: improved drawing performance (walzer) + +2014-10-11 (bug)[9e487e] Phony button clicks from browsers to plugin (nijtmans) + +2014-10-11 (bug)[810c43] [text] elide changes advance epoch (vogel) + +2014-10-14 (bug)[fb35eb] fix PNG transparency appearance (walton,culler) + +--- Released 8.5.17, October 25, 2014 --- http://core.tcl.tk/tk/ for details diff --git a/doc/3DBorder.3 b/doc/3DBorder.3 index 01b359b..b41b84f 100644 --- a/doc/3DBorder.3 +++ b/doc/3DBorder.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_Alloc3DBorderFromObj 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_Alloc3DBorderFromObj, Tk_Get3DBorder, Tk_Get3DBorderFromObj, Tk_Draw3DRectangle, Tk_Fill3DRectangle, Tk_Draw3DPolygon, Tk_Fill3DPolygon, Tk_3DVerticalBevel, Tk_3DHorizontalBevel, Tk_SetBackgroundFromBorder, Tk_NameOf3DBorder, Tk_3DBorderColor, Tk_3DBorderGC, Tk_Free3DBorderFromObj, Tk_Free3DBorder \- draw borders with three-dimensional appearance diff --git a/doc/AddOption.3 b/doc/AddOption.3 index 09a6d9e..8b921e2 100644 --- a/doc/AddOption.3 +++ b/doc/AddOption.3 @@ -2,8 +2,8 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -.so man.macros .TH Tk_AddOption 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_AddOption \- Add an option to the option database diff --git a/doc/BindTable.3 b/doc/BindTable.3 index 223c37b..34a2101 100644 --- a/doc/BindTable.3 +++ b/doc/BindTable.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CreateBindingTable 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateBindingTable, Tk_DeleteBindingTable, Tk_CreateBinding, Tk_DeleteBinding, Tk_GetBinding, Tk_GetAllBindings, Tk_DeleteAllBindings, Tk_BindEvent \- invoke scripts in response to X events diff --git a/doc/CanvPsY.3 b/doc/CanvPsY.3 index 08b17a4..91109ea 100644 --- a/doc/CanvPsY.3 +++ b/doc/CanvPsY.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CanvasPs 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CanvasPsY, Tk_CanvasPsBitmap, Tk_CanvasPsColor, Tk_CanvasPsFont, Tk_CanvasPsPath, Tk_CanvasPsStipple \- utility procedures for generating Postscript for canvases diff --git a/doc/CanvTkwin.3 b/doc/CanvTkwin.3 index 14db15e..05ffca2 100644 --- a/doc/CanvTkwin.3 +++ b/doc/CanvTkwin.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CanvasTkwin 3 4.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CanvasTkwin, Tk_CanvasGetCoord, Tk_CanvasDrawableCoords, Tk_CanvasSetStippleOrigin, Tk_CanvasWindowCoords, Tk_CanvasEventuallyRedraw, Tk_CanvasTagsOption \- utility procedures for canvas type managers diff --git a/doc/CanvTxtInfo.3 b/doc/CanvTxtInfo.3 index 58bf6e1..a4c0d3b 100644 --- a/doc/CanvTxtInfo.3 +++ b/doc/CanvTxtInfo.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CanvasTextInfo 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CanvasTextInfo \- additional information for managing text items in canvases diff --git a/doc/Clipboard.3 b/doc/Clipboard.3 index 6555290..769b63b 100644 --- a/doc/Clipboard.3 +++ b/doc/Clipboard.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_ClipboardClear 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_ClipboardClear, Tk_ClipboardAppend \- Manage the clipboard diff --git a/doc/ClrSelect.3 b/doc/ClrSelect.3 index 961f2d7..963260e 100644 --- a/doc/ClrSelect.3 +++ b/doc/ClrSelect.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_ClearSelection 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_ClearSelection \- Deselect a selection diff --git a/doc/ConfigWidg.3 b/doc/ConfigWidg.3 index 6a3e41a..3abb4f5 100644 --- a/doc/ConfigWidg.3 +++ b/doc/ConfigWidg.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_ConfigureWidget 3 4.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_ConfigureWidget, Tk_ConfigureInfo, Tk_ConfigureValue, Tk_FreeOptions \- process configuration options for widgets diff --git a/doc/ConfigWind.3 b/doc/ConfigWind.3 index f19512a..7c7adab 100644 --- a/doc/ConfigWind.3 +++ b/doc/ConfigWind.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_ConfigureWindow 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_ConfigureWindow, Tk_MoveWindow, Tk_ResizeWindow, Tk_MoveResizeWindow, Tk_SetWindowBorderWidth, Tk_ChangeWindowAttributes, Tk_SetWindowBackground, Tk_SetWindowBackgroundPixmap, Tk_SetWindowBorder, Tk_SetWindowBorderPixmap, Tk_SetWindowColormap, Tk_DefineCursor, Tk_UndefineCursor \- change window configuration or attributes diff --git a/doc/CoordToWin.3 b/doc/CoordToWin.3 index f984f8e..f0a9837 100644 --- a/doc/CoordToWin.3 +++ b/doc/CoordToWin.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CoordsToWindow 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CoordsToWindow \- Find window containing a point diff --git a/doc/CrtCmHdlr.3 b/doc/CrtCmHdlr.3 index f8c72e5..54cee95 100644 --- a/doc/CrtCmHdlr.3 +++ b/doc/CrtCmHdlr.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CreateClientMessageHandler 3 "8.4" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateClientMessageHandler, Tk_DeleteClientMessageHandler \- associate procedure callback with ClientMessage type X events diff --git a/doc/CrtConsoleChan.3 b/doc/CrtConsoleChan.3 index 65feab7..7fd8a6a 100644 --- a/doc/CrtConsoleChan.3 +++ b/doc/CrtConsoleChan.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_InitConsoleChannels 3 8.5 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_InitConsoleChannels \- Install the console channels as standard channels diff --git a/doc/CrtErrHdlr.3 b/doc/CrtErrHdlr.3 index a75414e..f30ceb2 100644 --- a/doc/CrtErrHdlr.3 +++ b/doc/CrtErrHdlr.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CreateErrorHandler 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateErrorHandler, Tk_DeleteErrorHandler \- handle X protocol errors diff --git a/doc/CrtGenHdlr.3 b/doc/CrtGenHdlr.3 index a1bc637..1e4f10c 100644 --- a/doc/CrtGenHdlr.3 +++ b/doc/CrtGenHdlr.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CreateGenericHandler 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateGenericHandler, Tk_DeleteGenericHandler \- associate procedure callback with all X events diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3 index da083e0..b7c3bb6 100644 --- a/doc/CrtImgType.3 +++ b/doc/CrtImgType.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CreateImageType 3 8.5 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind of image diff --git a/doc/CrtItemType.3 b/doc/CrtItemType.3 index 4f06438..10b1cc0 100644 --- a/doc/CrtItemType.3 +++ b/doc/CrtItemType.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CreateItemType 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateItemType, Tk_GetItemTypes \- define new kind of canvas item diff --git a/doc/CrtPhImgFmt.3 b/doc/CrtPhImgFmt.3 index 0575d40..b5559c8 100644 --- a/doc/CrtPhImgFmt.3 +++ b/doc/CrtPhImgFmt.3 @@ -9,8 +9,8 @@ '\" Department of Computer Science, '\" Australian National University. '\" -.so man.macros .TH Tk_CreatePhotoImageFormat 3 8.5 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreatePhotoImageFormat \- define new file format for photo images diff --git a/doc/CrtSelHdlr.3 b/doc/CrtSelHdlr.3 index c081c71..b5eb841 100644 --- a/doc/CrtSelHdlr.3 +++ b/doc/CrtSelHdlr.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CreateSelHandler 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateSelHandler, Tk_DeleteSelHandler \- arrange to handle requests for a selection diff --git a/doc/CrtWindow.3 b/doc/CrtWindow.3 index 8e36cb0..82a5c80 100644 --- a/doc/CrtWindow.3 +++ b/doc/CrtWindow.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CreateWindow 3 4.2 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateWindow, Tk_CreateWindowFromPath, Tk_DestroyWindow, Tk_MakeWindowExist \- create or delete window diff --git a/doc/DeleteImg.3 b/doc/DeleteImg.3 index 2b9288e..2d3d83c 100644 --- a/doc/DeleteImg.3 +++ b/doc/DeleteImg.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_DeleteImage 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_DeleteImage \- Destroy an image. diff --git a/doc/DrawFocHlt.3 b/doc/DrawFocHlt.3 index 688cfdb..ed29857 100644 --- a/doc/DrawFocHlt.3 +++ b/doc/DrawFocHlt.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_DrawFocusHighlight 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_DrawFocusHighlight \- draw the traversal highlight ring for a widget diff --git a/doc/EventHndlr.3 b/doc/EventHndlr.3 index 2ea04ae..80003d8 100644 --- a/doc/EventHndlr.3 +++ b/doc/EventHndlr.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_CreateEventHandler 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateEventHandler, Tk_DeleteEventHandler \- associate procedure callback with an X event diff --git a/doc/FindPhoto.3 b/doc/FindPhoto.3 index 08e0221..30df3a2 100644 --- a/doc/FindPhoto.3 +++ b/doc/FindPhoto.3 @@ -9,8 +9,8 @@ '\" Department of Computer Science, '\" Australian National University. '\" -.so man.macros .TH Tk_FindPhoto 3 8.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_FindPhoto, Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock, Tk_PhotoGetImage, Tk_PhotoBlank, Tk_PhotoExpand, Tk_PhotoGetSize, Tk_PhotoSetSize \- manipulate the image data stored in a photo image. diff --git a/doc/FontId.3 b/doc/FontId.3 index 60905a7..4c0d8d4 100644 --- a/doc/FontId.3 +++ b/doc/FontId.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_FontId 3 8.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_FontId, Tk_GetFontMetrics, Tk_PostscriptFontName \- accessor functions for diff --git a/doc/FreeXId.3 b/doc/FreeXId.3 index eb1da96..dd1d141 100644 --- a/doc/FreeXId.3 +++ b/doc/FreeXId.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_FreeXId 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_FreeXId \- make X resource identifier available for reuse diff --git a/doc/GeomReq.3 b/doc/GeomReq.3 index 4d8e788..0296132 100644 --- a/doc/GeomReq.3 +++ b/doc/GeomReq.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GeometryRequest 3 "8.4" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GeometryRequest, Tk_SetMinimumRequestSize, Tk_SetInternalBorder, Tk_SetInternalBorderEx \- specify desired geometry or internal border for a window diff --git a/doc/GetAnchor.3 b/doc/GetAnchor.3 index 8698353..032d838 100644 --- a/doc/GetAnchor.3 +++ b/doc/GetAnchor.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetAnchorFromObj 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor \- translate between strings and anchor positions diff --git a/doc/GetBitmap.3 b/doc/GetBitmap.3 index a9bd2c2..f1ab120 100644 --- a/doc/GetBitmap.3 +++ b/doc/GetBitmap.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_AllocBitmapFromObj 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_AllocBitmapFromObj, Tk_GetBitmap, Tk_GetBitmapFromObj, Tk_DefineBitmap, Tk_NameOfBitmap, Tk_SizeOfBitmap, Tk_FreeBitmapFromObj, Tk_FreeBitmap \- maintain database of single-plane pixmaps diff --git a/doc/GetCapStyl.3 b/doc/GetCapStyl.3 index 5463f12..e26ed31 100644 --- a/doc/GetCapStyl.3 +++ b/doc/GetCapStyl.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetCapStyle 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetCapStyle, Tk_NameOfCapStyle \- translate between strings and cap styles diff --git a/doc/GetClrmap.3 b/doc/GetClrmap.3 index 13ad9b2..9e6da12 100644 --- a/doc/GetClrmap.3 +++ b/doc/GetClrmap.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetColormap 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetColormap, Tk_PreserveColormap, Tk_FreeColormap \- allocate and free colormaps diff --git a/doc/GetColor.3 b/doc/GetColor.3 index 25fe16e..c1bd0dc 100644 --- a/doc/GetColor.3 +++ b/doc/GetColor.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_AllocColorFromObj 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_AllocColorFromObj, Tk_GetColor, Tk_GetColorFromObj, Tk_GetColorByValue, Tk_NameOfColor, Tk_FreeColorFromObj, Tk_FreeColor \- maintain database of colors diff --git a/doc/GetCursor.3 b/doc/GetCursor.3 index 953252b..5784792 100644 --- a/doc/GetCursor.3 +++ b/doc/GetCursor.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_AllocCursorFromObj 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_AllocCursorFromObj, Tk_GetCursor, Tk_GetCursorFromObj, Tk_GetCursorFromData, Tk_NameOfCursor, Tk_FreeCursorFromObj, Tk_FreeCursor \- maintain database of cursors diff --git a/doc/GetDash.3 b/doc/GetDash.3 index cc54c5a..8acc660 100644 --- a/doc/GetDash.3 +++ b/doc/GetDash.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetDash 3 8.3 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetDash \- convert from string to valid dash structure. diff --git a/doc/GetFont.3 b/doc/GetFont.3 index 2ca1395..23dcf25 100644 --- a/doc/GetFont.3 +++ b/doc/GetFont.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_AllocFontFromObj 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FreeFontFromObj, Tk_FreeFont \- maintain database of fonts diff --git a/doc/GetGC.3 b/doc/GetGC.3 index 146b527..621e109 100644 --- a/doc/GetGC.3 +++ b/doc/GetGC.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetGC 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetGC, Tk_FreeGC \- maintain database of read-only graphics contexts diff --git a/doc/GetHINSTANCE.3 b/doc/GetHINSTANCE.3 index 07c9ddd..de38051 100644 --- a/doc/GetHINSTANCE.3 +++ b/doc/GetHINSTANCE.3 @@ -2,8 +2,8 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -.so man.macros .TH Tk_GetHISTANCE 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetHINSTANCE \- retrieve the global application instance handle diff --git a/doc/GetHWND.3 b/doc/GetHWND.3 index 06bdf37..54e7351 100644 --- a/doc/GetHWND.3 +++ b/doc/GetHWND.3 @@ -2,8 +2,8 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -.so man.macros .TH HWND 3 8.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetHWND, Tk_AttachHWND \- manage interactions between the Windows handle and an X window diff --git a/doc/GetImage.3 b/doc/GetImage.3 index fb6e4c8..2d481f8 100644 --- a/doc/GetImage.3 +++ b/doc/GetImage.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetImage 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetImage, Tk_RedrawImage, Tk_SizeOfImage, Tk_FreeImage \- use an image in a widget diff --git a/doc/GetJoinStl.3 b/doc/GetJoinStl.3 index 1af1a06..81b5e9a 100644 --- a/doc/GetJoinStl.3 +++ b/doc/GetJoinStl.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetJoinStyle 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetJoinStyle, Tk_NameOfJoinStyle \- translate between strings and join styles diff --git a/doc/GetJustify.3 b/doc/GetJustify.3 index e8535e7..7e879db 100644 --- a/doc/GetJustify.3 +++ b/doc/GetJustify.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetJustifyFromObj 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetJustifyFromObj, Tk_GetJustify, Tk_NameOfJustify \- translate between strings and justification styles diff --git a/doc/GetOption.3 b/doc/GetOption.3 index 79817b7..432e18b 100644 --- a/doc/GetOption.3 +++ b/doc/GetOption.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetOption 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetOption \- retrieve an option from the option database diff --git a/doc/GetPixels.3 b/doc/GetPixels.3 index 814c4eb..2e6cc57 100644 --- a/doc/GetPixels.3 +++ b/doc/GetPixels.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetPixelsFromObj 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM \- translate between strings and screen units diff --git a/doc/GetPixmap.3 b/doc/GetPixmap.3 index 9e9628a..4bcab61 100644 --- a/doc/GetPixmap.3 +++ b/doc/GetPixmap.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetPixmap 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetPixmap, Tk_FreePixmap \- allocate and free pixmaps diff --git a/doc/GetRelief.3 b/doc/GetRelief.3 index b97a615..a65baf7 100644 --- a/doc/GetRelief.3 +++ b/doc/GetRelief.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetReliefFromObj 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetReliefFromObj, Tk_GetRelief, Tk_NameOfRelief \- translate between strings and relief values diff --git a/doc/GetRootCrd.3 b/doc/GetRootCrd.3 index 7c46b5f..a9d2cd9 100644 --- a/doc/GetRootCrd.3 +++ b/doc/GetRootCrd.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetRootCoords 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetRootCoords \- Compute root-window coordinates of window diff --git a/doc/GetScroll.3 b/doc/GetScroll.3 index 43fbab8..2c98403 100644 --- a/doc/GetScroll.3 +++ b/doc/GetScroll.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetScrollInfo 3 8.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetScrollInfo, Tk_GetScrollInfoObj \- parse arguments for scrolling commands diff --git a/doc/GetSelect.3 b/doc/GetSelect.3 index 4f8fa8d..47e2b60 100644 --- a/doc/GetSelect.3 +++ b/doc/GetSelect.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetSelection 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetSelection \- retrieve the contents of a selection diff --git a/doc/GetUid.3 b/doc/GetUid.3 index 32d4cbf..18300cc 100644 --- a/doc/GetUid.3 +++ b/doc/GetUid.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetUid 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetUid, Tk_Uid \- convert from string to unique identifier diff --git a/doc/GetVRoot.3 b/doc/GetVRoot.3 index d95f3ee..18214b9 100644 --- a/doc/GetVRoot.3 +++ b/doc/GetVRoot.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetVRootGeometry 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetVRootGeometry \- Get location and size of virtual root for window diff --git a/doc/GetVisual.3 b/doc/GetVisual.3 index 2796660..d0d95e8 100644 --- a/doc/GetVisual.3 +++ b/doc/GetVisual.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_GetVisual 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetVisual \- translate from string to visual @@ -2,8 +2,8 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -.so man.macros .TH Tk_Grab 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_Grab, Tk_Ungrab \- manipulate grab state in an application diff --git a/doc/HWNDToWindow.3 b/doc/HWNDToWindow.3 index 0478d78..e58a2cd 100644 --- a/doc/HWNDToWindow.3 +++ b/doc/HWNDToWindow.3 @@ -2,8 +2,8 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -.so man.macros .TH Tk_HWNDToWindow 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_HWNDToWindow \- Find Tk's window information for a Windows window diff --git a/doc/HandleEvent.3 b/doc/HandleEvent.3 index 4d24c14..91a76aa 100644 --- a/doc/HandleEvent.3 +++ b/doc/HandleEvent.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_HandleEvent 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_HandleEvent \- invoke event handlers for window system events diff --git a/doc/IdToWindow.3 b/doc/IdToWindow.3 index a913661..7d83a4c 100644 --- a/doc/IdToWindow.3 +++ b/doc/IdToWindow.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_IdToWindow 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_IdToWindow \- Find Tk's window information for an X window diff --git a/doc/ImgChanged.3 b/doc/ImgChanged.3 index 3d6e823..3049e63 100644 --- a/doc/ImgChanged.3 +++ b/doc/ImgChanged.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_ImageChanged 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_ImageChanged \- notify widgets that image needs to be redrawn diff --git a/doc/Inactive.3 b/doc/Inactive.3 index 8f37553..7338676 100644 --- a/doc/Inactive.3 +++ b/doc/Inactive.3 @@ -2,8 +2,8 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -.so man.macros .TH Tk_GetUserInactiveTime 3 8.5 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime \- discover user inactivity time diff --git a/doc/InternAtom.3 b/doc/InternAtom.3 index a4ca96c..8e5e866 100644 --- a/doc/InternAtom.3 +++ b/doc/InternAtom.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_InternAtom 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_InternAtom, Tk_GetAtomName \- manage cache of X atoms diff --git a/doc/MainLoop.3 b/doc/MainLoop.3 index 8653c17..6588713 100644 --- a/doc/MainLoop.3 +++ b/doc/MainLoop.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_MainLoop 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_MainLoop \- loop for events until all windows are deleted diff --git a/doc/MainWin.3 b/doc/MainWin.3 index 14acec7..495e799 100644 --- a/doc/MainWin.3 +++ b/doc/MainWin.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_MainWindow 3 7.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_MainWindow, Tk_GetNumMainWindows \- functions for querying main diff --git a/doc/MaintGeom.3 b/doc/MaintGeom.3 index c96a646..b052ba1 100644 --- a/doc/MaintGeom.3 +++ b/doc/MaintGeom.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_MaintainGeometry 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_MaintainGeometry, Tk_UnmaintainGeometry \- maintain geometry of one window relative to another diff --git a/doc/ManageGeom.3 b/doc/ManageGeom.3 index 5dcf688..371b896 100644 --- a/doc/ManageGeom.3 +++ b/doc/ManageGeom.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_ManageGeometry 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_ManageGeometry \- arrange to handle geometry requests for a window diff --git a/doc/MapWindow.3 b/doc/MapWindow.3 index 25d7ff5..ead9cd5 100644 --- a/doc/MapWindow.3 +++ b/doc/MapWindow.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_MapWindow 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_MapWindow, Tk_UnmapWindow \- map or unmap a window diff --git a/doc/MeasureChar.3 b/doc/MeasureChar.3 index c8164f3..7433451 100644 --- a/doc/MeasureChar.3 +++ b/doc/MeasureChar.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_MeasureChars 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_MeasureChars, Tk_TextWidth, Tk_DrawChars, Tk_UnderlineChars \- routines to measure and display simple single-line strings. diff --git a/doc/MoveToplev.3 b/doc/MoveToplev.3 index 24653ab..18436a3 100644 --- a/doc/MoveToplev.3 +++ b/doc/MoveToplev.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_MoveToplevelWindow 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_MoveToplevelWindow \- Adjust the position of a top-level window @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_Name 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_Name, Tk_PathName, Tk_NameToWindow \- convert between names and window tokens diff --git a/doc/NameOfImg.3 b/doc/NameOfImg.3 index a1a69a8..049b94c 100644 --- a/doc/NameOfImg.3 +++ b/doc/NameOfImg.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_NameOfImage 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_NameOfImage \- Return name of image. diff --git a/doc/OwnSelect.3 b/doc/OwnSelect.3 index cf2559d..2977fcd 100644 --- a/doc/OwnSelect.3 +++ b/doc/OwnSelect.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_OwnSelection 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_OwnSelection \- make a window the owner of the primary selection diff --git a/doc/ParseArgv.3 b/doc/ParseArgv.3 index b7592b7..65f184b 100644 --- a/doc/ParseArgv.3 +++ b/doc/ParseArgv.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_ParseArgv 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_ParseArgv \- process command-line options diff --git a/doc/QWinEvent.3 b/doc/QWinEvent.3 index 5eada22..e801fbc 100644 --- a/doc/QWinEvent.3 +++ b/doc/QWinEvent.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_QueueWindowEvent 3 7.5 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CollapseMotionEvents, Tk_QueueWindowEvent \- Add a window event to the Tcl event queue diff --git a/doc/Restack.3 b/doc/Restack.3 index a9a6c3a..f026aeb 100644 --- a/doc/Restack.3 +++ b/doc/Restack.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_RestackWindow 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_RestackWindow \- Change a window's position in the stacking order diff --git a/doc/RestrictEv.3 b/doc/RestrictEv.3 index da8b822..0d17806 100644 --- a/doc/RestrictEv.3 +++ b/doc/RestrictEv.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_RestrictEvents 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_RestrictEvents \- filter and selectively delay X events diff --git a/doc/SetAppName.3 b/doc/SetAppName.3 index b2df656..f69f920 100644 --- a/doc/SetAppName.3 +++ b/doc/SetAppName.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_SetAppName 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_SetAppName \- Set the name of an application for 'send' commands diff --git a/doc/SetCaret.3 b/doc/SetCaret.3 index 210cb21..571cf55 100644 --- a/doc/SetCaret.3 +++ b/doc/SetCaret.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_SetCaretPos 3 8.4 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_SetCaretPos \- set the display caret location diff --git a/doc/SetClass.3 b/doc/SetClass.3 index a457777..b485b7d 100644 --- a/doc/SetClass.3 +++ b/doc/SetClass.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_SetClass 3 "" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_SetClass, Tk_Class \- set or retrieve a window's class diff --git a/doc/SetClassProcs.3 b/doc/SetClassProcs.3 index e8820b6..8e6004a 100644 --- a/doc/SetClassProcs.3 +++ b/doc/SetClassProcs.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_SetClassProcs 3 8.4 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_SetClassProcs \- register widget specific procedures diff --git a/doc/SetGrid.3 b/doc/SetGrid.3 index c304ba2..385c920 100644 --- a/doc/SetGrid.3 +++ b/doc/SetGrid.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_SetGrid 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_SetGrid, Tk_UnsetGrid \- control the grid for interactive resizing diff --git a/doc/SetOptions.3 b/doc/SetOptions.3 index bd1d8ab..028467a 100644 --- a/doc/SetOptions.3 +++ b/doc/SetOptions.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_SetOptions 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_CreateOptionTable, Tk_DeleteOptionTable, Tk_InitOptions, Tk_SetOptions, Tk_FreeSavedOptions, Tk_RestoreSavedOptions, Tk_GetOptionValue, Tk_GetOptionInfo, Tk_FreeConfigOptions, Tk_Offset \- process configuration options diff --git a/doc/SetVisual.3 b/doc/SetVisual.3 index 2082220..11d6e76 100644 --- a/doc/SetVisual.3 +++ b/doc/SetVisual.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_SetWindowVisual 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_SetWindowVisual \- change visual characteristics of window diff --git a/doc/StrictMotif.3 b/doc/StrictMotif.3 index 770b335..6d1e049 100644 --- a/doc/StrictMotif.3 +++ b/doc/StrictMotif.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_StrictMotif 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_StrictMotif \- Return value of tk_strictMotif variable diff --git a/doc/TextLayout.3 b/doc/TextLayout.3 index 6c4da60..cd4a938 100644 --- a/doc/TextLayout.3 +++ b/doc/TextLayout.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_ComputeTextLayout 3 8.1 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_ComputeTextLayout, Tk_FreeTextLayout, Tk_DrawTextLayout, Tk_UnderlineTextLayout, Tk_PointToChar, Tk_CharBbox, Tk_DistanceToTextLayout, Tk_IntersectTextLayout, Tk_TextLayoutToPostscript \- routines to measure and display single-font, multi-line, justified text. diff --git a/doc/TkInitStubs.3 b/doc/TkInitStubs.3 index 3806f95..69c0fb2 100644 --- a/doc/TkInitStubs.3 +++ b/doc/TkInitStubs.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_InitStubs 3 8.4 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_InitStubs \- initialize the Tk stubs mechanism diff --git a/doc/Tk_Init.3 b/doc/Tk_Init.3 index 65e2d0a..8682c7d 100644 --- a/doc/Tk_Init.3 +++ b/doc/Tk_Init.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_Init 3 8.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_Init, Tk_SafeInit \- add Tk to an interpreter and make a new Tk application. diff --git a/doc/Tk_Main.3 b/doc/Tk_Main.3 index e67cf00..e45d597 100644 --- a/doc/Tk_Main.3 +++ b/doc/Tk_Main.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_Main 3 4.0 Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_Main \- main program for Tk-based applications diff --git a/doc/WindowId.3 b/doc/WindowId.3 index efa326d..a6050a2 100644 --- a/doc/WindowId.3 +++ b/doc/WindowId.3 @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Tk_WindowId 3 "8.4" Tk "Tk Library Procedures" +.so man.macros .BS .SH NAME Tk_WindowId, Tk_Parent, Tk_Display, Tk_DisplayName, Tk_ScreenNumber, Tk_Screen, Tk_X, Tk_Y, Tk_Width, Tk_Height, Tk_Changes, Tk_Attributes, Tk_IsContainer, Tk_IsEmbedded, Tk_IsMapped, Tk_IsTopLevel, Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop, Tk_InternalBorderBottom, Tk_Visual, Tk_Depth, Tk_Colormap, Tk_Interp \- retrieve information from Tk's local data structure @@ -6,8 +6,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH bell n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -6,8 +6,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH bind n 8.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/bindtags.n b/doc/bindtags.n index c5cf71b..7db16f8 100644 --- a/doc/bindtags.n +++ b/doc/bindtags.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH bindtags n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/bitmap.n b/doc/bitmap.n index 0dde8d5..bcc44f8 100644 --- a/doc/bitmap.n +++ b/doc/bitmap.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH bitmap n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/button.n b/doc/button.n index 4b655a4..4acc05a 100644 --- a/doc/button.n +++ b/doc/button.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH button n 4.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/canvas.n b/doc/canvas.n index 9338b8d..676c1cd 100644 --- a/doc/canvas.n +++ b/doc/canvas.n @@ -6,8 +6,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH canvas n 8.3 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/checkbutton.n b/doc/checkbutton.n index 1e05c96..34d230b 100644 --- a/doc/checkbutton.n +++ b/doc/checkbutton.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH checkbutton n 4.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/chooseColor.n b/doc/chooseColor.n index 565934c..c71577b 100644 --- a/doc/chooseColor.n +++ b/doc/chooseColor.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk_chooseColor n 4.2 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/chooseDirectory.n b/doc/chooseDirectory.n index c380ccf..da21762 100644 --- a/doc/chooseDirectory.n +++ b/doc/chooseDirectory.n @@ -2,8 +2,8 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -.so man.macros .TH tk_chooseDirectory n 8.3 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/clipboard.n b/doc/clipboard.n index b689328..442288d 100644 --- a/doc/clipboard.n +++ b/doc/clipboard.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH clipboard n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/colors.n b/doc/colors.n index 4b8cda1..6e73390 100644 --- a/doc/colors.n +++ b/doc/colors.n @@ -4,8 +4,8 @@ '\" Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net> '\" Copyright (c) 2008 Donal K. Fellows '\" -.so man.macros .TH colors n 8.3 Tk "Tk Built-In Commands" +.so man.macros .BS .\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/console.n b/doc/console.n index 8e0691c..bd98961 100644 --- a/doc/console.n +++ b/doc/console.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH console n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/cursors.n b/doc/cursors.n index 8bc2a8f..b36f537 100644 --- a/doc/cursors.n +++ b/doc/cursors.n @@ -4,8 +4,8 @@ '\" '\" Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net> '\" -.so man.macros .TH cursors n 8.3 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/destroy.n b/doc/destroy.n index 93aedd5..00da4a7 100644 --- a/doc/destroy.n +++ b/doc/destroy.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH destroy n "" Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/dialog.n b/doc/dialog.n index e72cbac..e154a7f 100644 --- a/doc/dialog.n +++ b/doc/dialog.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk_dialog n 4.1 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/entry.n b/doc/entry.n index 58c5d64..8015f1c 100644 --- a/doc/entry.n +++ b/doc/entry.n @@ -6,8 +6,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH entry n 8.3 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/event.n b/doc/event.n index 69f336a..0a5ced5 100644 --- a/doc/event.n +++ b/doc/event.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH event n 8.3 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -318,6 +318,10 @@ been pressed in combination with the Alt key. The usual response to this is to either focus into the widget (or some related widget) or to invoke the widget. .TP +\fB<<Invoke>>\fR +This can be sent to some widgets (e.g. button, listbox, menu) as an +alternative to <space>. +.TP \fB<<ListboxSelect>>\fR This is sent to a listbox when the set of selected item(s) in the listbox is updated. @@ -334,6 +338,9 @@ changed. This is sent to a text widget when the selection in the widget is changed. .TP +\fB<<ThemeChanged>>\fR +This is sent to a text widget when the ttk (Tile) theme changed. +.TP \fB<<TraverseIn>>\fR This is sent to a widget when the focus enters the widget because of a user-driven diff --git a/doc/focus.n b/doc/focus.n index f37e1cd..d4f29e8 100644 --- a/doc/focus.n +++ b/doc/focus.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH focus n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/focusNext.n b/doc/focusNext.n index ede496f..11a3a49 100644 --- a/doc/focusNext.n +++ b/doc/focusNext.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk_focusNext n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH font n 8.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/frame.n b/doc/frame.n index 208e414..7eaed62 100644 --- a/doc/frame.n +++ b/doc/frame.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH frame n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/getOpenFile.n b/doc/getOpenFile.n index 8162078..a57143e 100644 --- a/doc/getOpenFile.n +++ b/doc/getOpenFile.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk_getOpenFile n 4.2 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH grab n "" Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH grid n 8.5 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/image.n b/doc/image.n index e536916..c4cfbfd 100644 --- a/doc/image.n +++ b/doc/image.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH image n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/keysyms.n b/doc/keysyms.n index bab9d16..c599bca 100644 --- a/doc/keysyms.n +++ b/doc/keysyms.n @@ -2,8 +2,8 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -.so man.macros .TH keysyms n 8.3 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/label.n b/doc/label.n index ef121cb..9bbc9e0 100644 --- a/doc/label.n +++ b/doc/label.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH label n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/labelframe.n b/doc/labelframe.n index 70d04cb..cea4804 100644 --- a/doc/labelframe.n +++ b/doc/labelframe.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH labelframe n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/listbox.n b/doc/listbox.n index 341ce9a..b2e8e38 100644 --- a/doc/listbox.n +++ b/doc/listbox.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH listbox n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/loadTk.n b/doc/loadTk.n index e1fecf6..2b34cc0 100644 --- a/doc/loadTk.n +++ b/doc/loadTk.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH "Safe Tk" n 8.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/lower.n b/doc/lower.n index be8ca4e..3a47094 100644 --- a/doc/lower.n +++ b/doc/lower.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH lower n 3.3 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH menu n 4.1 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/menubar.n b/doc/menubar.n index 34fd2e7..b80a6e1 100644 --- a/doc/menubar.n +++ b/doc/menubar.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk_menuBar n "" Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/menubutton.n b/doc/menubutton.n index ade9523..3680abc 100644 --- a/doc/menubutton.n +++ b/doc/menubutton.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH menubutton n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/message.n b/doc/message.n index 92434f0..926f0cb 100644 --- a/doc/message.n +++ b/doc/message.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH message n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/messageBox.n b/doc/messageBox.n index 5cdd26e..bbeffee 100644 --- a/doc/messageBox.n +++ b/doc/messageBox.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk_messageBox n 4.2 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/option.n b/doc/option.n index b7342e2..dd1a644 100644 --- a/doc/option.n +++ b/doc/option.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH option n "" Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/optionMenu.n b/doc/optionMenu.n index 1f9f831..db2c109 100644 --- a/doc/optionMenu.n +++ b/doc/optionMenu.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk_optionMenu n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/options.n b/doc/options.n index 25b0c9d..2faca8c 100644 --- a/doc/options.n +++ b/doc/options.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH options n 4.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/pack-old.n b/doc/pack-old.n index 532b4ae..f29c454 100644 --- a/doc/pack-old.n +++ b/doc/pack-old.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH pack-old n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH pack n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/palette.n b/doc/palette.n index 4b1dcff..27a6460 100644 --- a/doc/palette.n +++ b/doc/palette.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk_setPalette n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/panedwindow.n b/doc/panedwindow.n index ccc87e7..a686ce1 100644 --- a/doc/panedwindow.n +++ b/doc/panedwindow.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH panedwindow n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/photo.n b/doc/photo.n index c14abe3..dc30f08 100644 --- a/doc/photo.n +++ b/doc/photo.n @@ -9,8 +9,8 @@ '\" Department of Computer Science, '\" Australian National University. '\" -.so man.macros .TH photo n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/place.n b/doc/place.n index fc7e0fb..81aaff1 100644 --- a/doc/place.n +++ b/doc/place.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH place n "" Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/popup.n b/doc/popup.n index 7b7d69f..ddce3cb 100644 --- a/doc/popup.n +++ b/doc/popup.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk_popup n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/radiobutton.n b/doc/radiobutton.n index 29c2eec..565931c 100644 --- a/doc/radiobutton.n +++ b/doc/radiobutton.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH radiobutton n 4.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/raise.n b/doc/raise.n index 02f805f..b71a637 100644 --- a/doc/raise.n +++ b/doc/raise.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH raise n 3.3 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/scale.n b/doc/scale.n index e750fdd..a9355a9 100644 --- a/doc/scale.n +++ b/doc/scale.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH scale n 4.1 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/scrollbar.n b/doc/scrollbar.n index a13574b..b12b5dd 100644 --- a/doc/scrollbar.n +++ b/doc/scrollbar.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH scrollbar n 4.1 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/selection.n b/doc/selection.n index 8aee321..41d5d4b 100644 --- a/doc/selection.n +++ b/doc/selection.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH selection n 8.1 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH send n 4.0 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/spinbox.n b/doc/spinbox.n index dc98251..8ae6161 100644 --- a/doc/spinbox.n +++ b/doc/spinbox.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH spinbox n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH text n 8.5 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tk n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/tkerror.n b/doc/tkerror.n index b75dcfe..d66bf0f 100644 --- a/doc/tkerror.n +++ b/doc/tkerror.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tkerror n 4.1 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/tkvars.n b/doc/tkvars.n index 9971698..4a45868 100644 --- a/doc/tkvars.n +++ b/doc/tkvars.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tkvars n 4.1 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/tkwait.n b/doc/tkwait.n index 32bfb44..334d518 100644 --- a/doc/tkwait.n +++ b/doc/tkwait.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH tkwait n "" Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/toplevel.n b/doc/toplevel.n index e02eb35..80008be 100644 --- a/doc/toplevel.n +++ b/doc/toplevel.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH toplevel n 8.4 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/doc/ttk_Geometry.3 b/doc/ttk_Geometry.3 index 5a0ce4f..f403004 100644 --- a/doc/ttk_Geometry.3 +++ b/doc/ttk_Geometry.3 @@ -1,8 +1,8 @@ '\" '\" Copyright (c) 2004 Joe English '\" -.so man.macros .TH Geometry 3 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME Ttk_MakeBox, Ttk_PadBox, Ttk_ExpandBox, Ttk_PackBox, Ttk_StickBox, Ttk_PlaceBox, Ttk_BoxContains, Ttk_MakePadding, Ttk_UniformPadding, Ttk_AddPadding, Ttk_RelievePadding, Ttk_GetPaddingFromObj, Ttk_GetBorderFromObj, Ttk_GetStickyFromObj \- Tk themed geometry utilities diff --git a/doc/ttk_Theme.3 b/doc/ttk_Theme.3 index acd0e98..8031b8a 100644 --- a/doc/ttk_Theme.3 +++ b/doc/ttk_Theme.3 @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH Ttk_CreateTheme 3 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME Ttk_CreateTheme, Ttk_GetTheme, Ttk_GetDefaultTheme, Ttk_GetCurrentTheme \- create and use Tk themes. diff --git a/doc/ttk_button.n b/doc/ttk_button.n index c6f2308..2f3c845 100644 --- a/doc/ttk_button.n +++ b/doc/ttk_button.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::button n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::button \- Widget that issues a command when pressed diff --git a/doc/ttk_checkbutton.n b/doc/ttk_checkbutton.n index 07b3205..6236503 100644 --- a/doc/ttk_checkbutton.n +++ b/doc/ttk_checkbutton.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::checkbutton n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::checkbutton \- On/off widget diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n index e01c6f6..dc1c7d1 100644 --- a/doc/ttk_combobox.n +++ b/doc/ttk_combobox.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::combobox n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::combobox \- text field with popdown selection list diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n index b42bd31..924aa05 100644 --- a/doc/ttk_entry.n +++ b/doc/ttk_entry.n @@ -6,8 +6,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::entry n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::entry \- Editable text field widget diff --git a/doc/ttk_frame.n b/doc/ttk_frame.n index 9dcf2dc..3b885e0 100644 --- a/doc/ttk_frame.n +++ b/doc/ttk_frame.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::frame n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::frame \- Simple container widget diff --git a/doc/ttk_image.n b/doc/ttk_image.n index 3d8b13c..99d38c6 100644 --- a/doc/ttk_image.n +++ b/doc/ttk_image.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk_image n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk_image \- Define an element based on an image diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n index cb0c440..baef34d 100644 --- a/doc/ttk_intro.n +++ b/doc/ttk_intro.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::intro n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::intro \- Introduction to the Tk theme engine diff --git a/doc/ttk_label.n b/doc/ttk_label.n index 66dafeb..ff93adf 100644 --- a/doc/ttk_label.n +++ b/doc/ttk_label.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::label n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::label \- Display a text string and/or image diff --git a/doc/ttk_labelframe.n b/doc/ttk_labelframe.n index e782f87..2dae91f 100644 --- a/doc/ttk_labelframe.n +++ b/doc/ttk_labelframe.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::labelframe n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::labelframe \- Container widget with optional label diff --git a/doc/ttk_menubutton.n b/doc/ttk_menubutton.n index 99b7c4d..33189e8 100644 --- a/doc/ttk_menubutton.n +++ b/doc/ttk_menubutton.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::menubutton n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::menubutton \- Widget that pops down a menu when pressed diff --git a/doc/ttk_notebook.n b/doc/ttk_notebook.n index c0de39e..12c3d6b 100644 --- a/doc/ttk_notebook.n +++ b/doc/ttk_notebook.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::notebook n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::notebook \- Multi-paned container widget diff --git a/doc/ttk_panedwindow.n b/doc/ttk_panedwindow.n index c5851c3..27eb57d 100644 --- a/doc/ttk_panedwindow.n +++ b/doc/ttk_panedwindow.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::panedwindow n 8.5.9 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::panedwindow \- Multi-pane container window @@ -105,6 +105,12 @@ and the total size of the widget. .\" depending on which changed most recently. Returns the new position of sash number \fIindex\fR. .\" Full story: new position may be different than the requested position. +.SH "VIRTUAL EVENTS" +.PP +The panedwindow widget generates an \fB<<EnteredChild>>\fR virtual event on +LeaveNotify/NotifyInferior events, because Tk does not execute binding scripts +for <Leave> events when the pointer crosses from a parent to a child. The +panedwindow widget needs to know when that happens. .SH "SEE ALSO" ttk::widget(n), ttk::notebook(n), panedwindow(n) '\" Local Variables: diff --git a/doc/ttk_progressbar.n b/doc/ttk_progressbar.n index 9381c61..3b90371 100644 --- a/doc/ttk_progressbar.n +++ b/doc/ttk_progressbar.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::progressbar n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::progressbar \- Provide progress feedback diff --git a/doc/ttk_radiobutton.n b/doc/ttk_radiobutton.n index cbea359..86fc417 100644 --- a/doc/ttk_radiobutton.n +++ b/doc/ttk_radiobutton.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::radiobutton n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::radiobutton \- Mutually exclusive option widget diff --git a/doc/ttk_scale.n b/doc/ttk_scale.n index 2fd485b..7371b58 100644 --- a/doc/ttk_scale.n +++ b/doc/ttk_scale.n @@ -4,8 +4,8 @@ .\" See the file "license.terms" for information on usage and redistribution .\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. .\" -.so man.macros .TH ttk::scale n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::scale \- Create and manipulate a scale widget diff --git a/doc/ttk_scrollbar.n b/doc/ttk_scrollbar.n index ce9eeed..0a2c719 100644 --- a/doc/ttk_scrollbar.n +++ b/doc/ttk_scrollbar.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::scrollbar n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::scrollbar \- Control the viewport of a scrollable widget diff --git a/doc/ttk_separator.n b/doc/ttk_separator.n index 78114bd..d955fc4 100644 --- a/doc/ttk_separator.n +++ b/doc/ttk_separator.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::separator n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::separator \- Separator bar diff --git a/doc/ttk_sizegrip.n b/doc/ttk_sizegrip.n index 38de1ed..8b3429e 100644 --- a/doc/ttk_sizegrip.n +++ b/doc/ttk_sizegrip.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::sizegrip n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::sizegrip \- Bottom-right corner resize widget diff --git a/doc/ttk_spinbox.n b/doc/ttk_spinbox.n index fefd287..3c7287a 100644 --- a/doc/ttk_spinbox.n +++ b/doc/ttk_spinbox.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::spinbox n 8.5.9 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::spinbox \- Selecting text field widget @@ -77,6 +77,11 @@ Set the spinbox string to \fIvalue\fR. If a \fI\-format\fR option has been configured then this format will be applied. If formatting fails or is not set or the \fI\-values\fR option has been used then the value is set directly. +.SH "VIRTUAL EVENTS" +.PP +The spinbox widget generates a \fB<<Increment>>\fR virtual event when +the user presses <Up>, and a \fB<<Decrement>>\fR virtual event when the +user presses <Down>. .SH "SEE ALSO" ttk::widget(n), ttk::entry(n), spinbox(n) .SH KEYWORDS diff --git a/doc/ttk_style.n b/doc/ttk_style.n index c32b028..dc3bade 100644 --- a/doc/ttk_style.n +++ b/doc/ttk_style.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::style n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::style \- Manipulate style database diff --git a/doc/ttk_treeview.n b/doc/ttk_treeview.n index 33cca55..ef8d34d 100644 --- a/doc/ttk_treeview.n +++ b/doc/ttk_treeview.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::treeview n 8.5.9 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::treeview \- hierarchical multicolumn data display widget diff --git a/doc/ttk_vsapi.n b/doc/ttk_vsapi.n index 7506ec4..96fdf28 100644 --- a/doc/ttk_vsapi.n +++ b/doc/ttk_vsapi.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk_vsapi n 8.5 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk_vsapi \- Define a Microsoft Visual Styles element diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n index 98968ad..390635c 100644 --- a/doc/ttk_widget.n +++ b/doc/ttk_widget.n @@ -4,8 +4,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH ttk::widget n 8.5.9 Tk "Tk Themed Widget" +.so man.macros .BS .SH NAME ttk::widget \- Standard options and commands supported by Tk themed widgets diff --git a/doc/winfo.n b/doc/winfo.n index 4b75eb9..bb8e057 100644 --- a/doc/winfo.n +++ b/doc/winfo.n @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH winfo n 4.3 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH wish 1 8.0 Tk "Tk Applications" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -5,8 +5,8 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.so man.macros .TH wm n 8.5 Tk "Tk Built-In Commands" +.so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME diff --git a/generic/tk.decls b/generic/tk.decls index 50b2837..2825111 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1067,6 +1067,9 @@ declare 272 { declare 273 { void Tk_CreateOldPhotoImageFormat(Tk_PhotoImageFormat *formatPtr) } +declare 275 { + void TkUnusedStubEntry(void) +} # 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 8c13df2..186732b 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -17,10 +17,18 @@ #define _TK #include <tcl.h> -#if (TCL_MAJOR_VERSION != 8) || (TCL_MINOR_VERSION != 5) -# error Tk 8.5 must be compiled with tcl.h from Tcl 8.5 +#if (TCL_MAJOR_VERSION != 8) || (TCL_MINOR_VERSION < 5) +# error Tk 8.5 must be compiled with tcl.h from Tcl 8.5 or better #endif +#ifndef _ANSI_ARGS_ +# ifndef NO_PROTOTYPES +# define _ANSI_ARGS_(x) x +# else +# define _ANSI_ARGS_(x) () +# endif +#endif + /* * For C++ compilers, use extern "C" */ @@ -33,7 +41,7 @@ extern "C" { * When version numbers change here, you must also go into the following files * and update the version numbers: * - * library/tk.tcl (2 LOC patch) + * library/tk.tcl (1 LOC patch) * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch) * win/configure.in (as above) * README (sections 0 and 1) @@ -51,10 +59,10 @@ extern "C" { #define TK_MAJOR_VERSION 8 #define TK_MINOR_VERSION 5 #define TK_RELEASE_LEVEL TCL_FINAL_RELEASE -#define TK_RELEASE_SERIAL 13 +#define TK_RELEASE_SERIAL 17 #define TK_VERSION "8.5" -#define TK_PATCH_LEVEL "8.5.13" +#define TK_PATCH_LEVEL "8.5.17" /* * A special definition used to allow this header file to be included from @@ -69,11 +77,9 @@ extern "C" { #ifndef RC_INVOKED #ifndef _XLIB_H -# if defined(MAC_OSX_TK) -# include <X11/Xlib.h> +# include <X11/Xlib.h> +# ifdef MAC_OSX_TK # include <X11/X.h> -# else -# include <X11/Xlib.h> # endif #endif #ifdef __STDC__ @@ -81,18 +87,20 @@ extern "C" { #endif #ifdef BUILD_tk -# undef TCL_STORAGE_CLASS -# define TCL_STORAGE_CLASS DLLEXPORT +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLEXPORT #endif - + /* + *---------------------------------------------------------------------- + * * Decide whether or not to use input methods. */ #ifdef XNQueryInputStyle #define TK_USE_INPUT_METHODS #endif - + /* * Dummy types that are used by clients: */ @@ -118,8 +126,10 @@ typedef struct Tk_StyledElement_ *Tk_StyledElement; */ typedef const char *Tk_Uid; - + /* + *---------------------------------------------------------------------- + * * The enum below defines the valid types for Tk configuration options as * implemented by Tk_InitOptions, Tk_SetOptions, etc. */ @@ -217,7 +227,7 @@ typedef void (Tk_CustomOptionFreeProc) _ANSI_ARGS_((ClientData clientData, Tk_Window tkwin, char *internalPtr)); typedef struct Tk_ObjCustomOption { - const char *name; /* Name of the custom option. */ + const char *name; /* Name of the custom option. */ Tk_CustomOptionSetProc *setProc; /* Function to use to set a record's option * value from a Tcl_Obj */ @@ -293,7 +303,7 @@ typedef struct Tk_SavedOptions { * old values in a single structure. NULL * means no more structures. */ } Tk_SavedOptions; - + /* * Structure used to describe application-specific configuration options: * indicates procedures to call to parse an option and to return a text string @@ -392,7 +402,7 @@ typedef enum { #define TK_CONFIG_OPTION_SPECIFIED (1 << 4) #define TK_CONFIG_USER_BIT 0x100 #endif /* __NO_OLD_CONFIG */ - + /* * Structure used to specify how to handle argv options. */ @@ -436,7 +446,7 @@ typedef struct { #define TK_ARGV_NO_LEFTOVERS 0x2 #define TK_ARGV_NO_ABBREV 0x4 #define TK_ARGV_DONT_SKIP_FIRST_ARG 0x8 - + /* * Enumerated type for describing actions to be taken in response to a * restrictProc established by Tk_RestrictEvents. @@ -494,7 +504,7 @@ typedef enum { TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW, TK_ANCHOR_CENTER } Tk_Anchor; - + /* * Enumerated type for describing a style of justification: */ @@ -538,7 +548,7 @@ typedef struct Tk_FontMetrics { #define TK_IGNORE_TABS 8 #define TK_IGNORE_NEWLINES 16 - + /* * Widget class procedures used to implement platform specific widget * behavior. @@ -582,7 +592,7 @@ typedef struct Tk_ClassProcs { #define Tk_GetClassProc(procs, which) \ (((procs) == NULL) ? NULL : \ (((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which)) - + /* * Each geometry manager (the packer, the placer, etc.) is represented by a * structure of the following form, which indicates procedures to invoke in @@ -616,13 +626,13 @@ typedef struct Tk_GeomMgr { #define TK_SCROLL_PAGES 2 #define TK_SCROLL_UNITS 3 #define TK_SCROLL_ERROR 4 - + /* - *--------------------------------------------------------------------------- + *---------------------------------------------------------------------- * * Extensions to the X event set * - *--------------------------------------------------------------------------- + *---------------------------------------------------------------------- */ #define VirtualEvent (MappingNotify + 1) @@ -681,12 +691,12 @@ typedef XActivateDeactivateEvent XActivateEvent; typedef XActivateDeactivateEvent XDeactivateEvent; /* - *-------------------------------------------------------------- + *---------------------------------------------------------------------- * * Macros for querying Tk_Window structures. See the manual entries for * documentation. * - *-------------------------------------------------------------- + *---------------------------------------------------------------------- */ #define Tk_Display(tkwin) (((Tk_FakeWin *) (tkwin))->display) @@ -883,11 +893,11 @@ typedef struct Tk_FakeWin { #define TK_WM_MANAGEABLE 0x80000 /* - *-------------------------------------------------------------- + *---------------------------------------------------------------------- * * Procedure prototypes and structures used for defining new canvas items: * - *-------------------------------------------------------------- + *---------------------------------------------------------------------- */ typedef enum { @@ -1124,7 +1134,7 @@ typedef struct Tk_CanvasTextInfo { * should be displayed in focusItemPtr. * Read-only to items.*/ } Tk_CanvasTextInfo; - + /* * Structures used for Dashing and Outline. */ @@ -1180,11 +1190,11 @@ typedef struct Tk_Outline { } Tk_Outline; /* - *-------------------------------------------------------------- + *---------------------------------------------------------------------- * * Procedure prototypes and structures used for managing images: * - *-------------------------------------------------------------- + *---------------------------------------------------------------------- */ typedef struct Tk_ImageType Tk_ImageType; @@ -1247,13 +1257,13 @@ struct Tk_ImageType { * manager. */ char *reserved; /* reserved for future expansion */ }; - + /* - *-------------------------------------------------------------- + *---------------------------------------------------------------------- * * Additional definitions used to manage images of type "photo". * - *-------------------------------------------------------------- + *---------------------------------------------------------------------- */ /* @@ -1363,18 +1373,13 @@ struct Tk_PhotoImageFormat { * currently known. Filled in by Tk, not by * image format handler. */ }; - -#ifdef USE_OLD_IMAGE -#define Tk_CreateImageType Tk_CreateOldImageType -#define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat -#endif /* - *-------------------------------------------------------------- + *---------------------------------------------------------------------- * * Procedure prototypes and structures used for managing styles: * - *-------------------------------------------------------------- + *---------------------------------------------------------------------- */ /* @@ -1438,13 +1443,13 @@ typedef struct Tk_ElementSpec { #define TK_ELEMENT_STATE_PRESSED 1<<3 /* - *-------------------------------------------------------------- + *---------------------------------------------------------------------- * * The definitions below provide backward compatibility for functions and * types related to event handling that used to be in Tk but have moved to * Tcl. * - *-------------------------------------------------------------- + *---------------------------------------------------------------------- */ #define TK_READABLE TCL_READABLE @@ -1491,21 +1496,18 @@ EXTERN const char * Tk_PkgInitStubsCheck _ANSI_ARGS_((Tcl_Interp *interp, const char *version, int exact)); #ifndef USE_TK_STUBS - #define Tk_InitStubs(interp, version, exact) \ Tk_PkgInitStubsCheck(interp, version, exact) - -#endif +#endif /* USE_TK_STUBS */ #define Tk_InitImageArgs(interp, argc, argv) /**/ - /* - *-------------------------------------------------------------- + *---------------------------------------------------------------------- * * Additional procedure types defined by Tk. * - *-------------------------------------------------------------- + *---------------------------------------------------------------------- */ typedef int (Tk_ErrorProc) _ANSI_ARGS_((ClientData clientData, @@ -1523,18 +1525,27 @@ typedef Tk_RestrictAction (Tk_RestrictProc) _ANSI_ARGS_(( ClientData clientData, XEvent *eventPtr)); typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData, int offset, char *buffer, int maxBytes)); - + /* - *-------------------------------------------------------------- + *---------------------------------------------------------------------- * - * Platform independant exported procedures and variables. + * Platform independent exported procedures and variables. * - *-------------------------------------------------------------- + *---------------------------------------------------------------------- */ #include "tkDecls.h" + +#ifdef USE_OLD_IMAGE +#undef Tk_CreateImageType +#define Tk_CreateImageType Tk_CreateOldImageType +#undef Tk_CreatePhotoImageFormat +#define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat +#endif /* USE_OLD_IMAGE */ /* + *---------------------------------------------------------------------- + * * Allow users to say that they don't want to alter their source to add extra * arguments to Tk_PhotoPutBlock() et al; DO NOT DEFINE THIS WHEN BUILDING TK. * @@ -1574,11 +1585,7 @@ typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData, # endif # define Tk_PhotoSetSize Tk_PhotoSetSize_Panic #endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */ - -/* - * Tcl commands exported by Tk: - */ - + #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT diff --git a/generic/tkBind.c b/generic/tkBind.c index dbbaaf4..d7c8c04 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -4603,7 +4603,7 @@ TkKeysymToString( * * TkCopyAndGlobalEval -- * - * This function makes a copy of a script then calls Tcl_GlobalEval to + * This function makes a copy of a script then calls Tcl_EvalEx to * evaluate it. It's used in situations where the execution of a command * may cause the original command string to be reallocated. * diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index eca3789..b4d0c3b 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -1660,8 +1660,10 @@ TkCanvTranslatePath( double *a, *b, *t; /* Pointers to parts of the temporary * storage */ int i, j; /* Loop counters */ +#ifndef NDEBUG int maxOutput; /* Maximum number of outputs that we will * allow */ +#endif double limit[4]; /* Boundries at which clipping occurs */ double staticSpace[480]; /* Temp space from the stack */ @@ -1756,7 +1758,9 @@ TkCanvTranslatePath( * This is the loop that makes the four passes through the data. */ +#ifndef NDEBUG maxOutput = numVertex*3; +#endif for (j=0; j<4; j++){ double xClip = limit[j]; int inside = a[0]<xClip; diff --git a/generic/tkCmds.c b/generic/tkCmds.c index a86ef84..2010b6e 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -232,7 +232,7 @@ TkBindEventProc( ClientData objects[MAX_OBJS], *objPtr; TkWindow *topLevPtr; int i, count; - char *p; + const char *p; Tcl_HashEntry *hPtr; if ((winPtr->mainPtr == NULL) || (winPtr->mainPtr->bindingTable == NULL)) { @@ -251,7 +251,7 @@ TkBindEventProc( (winPtr->numTags * sizeof(ClientData))); } for (i = 0; i < winPtr->numTags; i++) { - p = (char *) winPtr->tagPtr[i]; + p = winPtr->tagPtr[i]; if (*p == '.') { hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p); if (hPtr != NULL) { @@ -327,7 +327,6 @@ Tk_BindtagsObjCmd( } if (objc == 2) { listPtr = Tcl_NewObj(); - Tcl_IncrRefCount(listPtr); if (winPtr->numTags == 0) { Tcl_ListObjAppendElement(interp, listPtr, Tcl_NewStringObj(winPtr->pathName, -1)); @@ -350,7 +349,6 @@ Tk_BindtagsObjCmd( } } Tcl_SetObjResult(interp, listPtr); - Tcl_DecrRefCount(listPtr); return TCL_OK; } if (winPtr->tagPtr != NULL) { @@ -411,17 +409,17 @@ TkFreeBindingTags( TkWindow *winPtr) /* Window whose tags are to be released. */ { int i; - char *p; + const char *p; for (i = 0; i < winPtr->numTags; i++) { - p = (char *) (winPtr->tagPtr[i]); + p = winPtr->tagPtr[i]; if (*p == '.') { /* * Names starting with "." are malloced rather than Uids, so they * have to be freed. */ - ckfree(p); + ckfree((char *)p); } } ckfree((char *) winPtr->tagPtr); @@ -1503,9 +1501,7 @@ Tk_WinfoObjCmd( Tcl_SetStringObj(resultPtr, Tk_PathName(tkwin), -1); } break; - case WIN_INTERPS: { - int result; - + case WIN_INTERPS: skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; @@ -1514,9 +1510,7 @@ Tk_WinfoObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?"); return TCL_ERROR; } - result = TkGetInterpNames(interp, tkwin); - return result; - } + return TkGetInterpNames(interp, tkwin); case WIN_PATHNAME: { Window id; diff --git a/generic/tkConsole.c b/generic/tkConsole.c index b10aaaf..2cd2632 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -220,11 +220,10 @@ Tk_InitConsoleChannels( Tcl_Channel consoleChannel; /* - * Ensure that we are getting the matching version of Tcl. This is really - * only an issue when Tk is loaded dynamically. + * Ensure that we are getting a compatible version of Tcl. */ - if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { + if (Tcl_InitStubs(interp, "8.5.0", 0) == NULL) { return; } @@ -436,7 +435,8 @@ Tk_CreateConsoleWindow( } Tcl_Preserve((ClientData) consoleInterp); - result = Tcl_GlobalEval(consoleInterp, "source $tk_library/console.tcl"); + result = Tcl_EvalEx(consoleInterp, "source $tk_library/console.tcl", + -1, TCL_EVAL_GLOBAL); if (result == TCL_ERROR) { Tcl_SetReturnOptions(interp, Tcl_GetReturnOptions(consoleInterp, result)); @@ -528,7 +528,7 @@ ConsoleOutput( Tcl_DStringFree(&ds); Tcl_IncrRefCount(cmd); - Tcl_GlobalEvalObj(consoleInterp, cmd); + Tcl_EvalObjEx(consoleInterp, cmd, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(cmd); } } @@ -732,7 +732,7 @@ ConsoleObjCmd( Tcl_IncrRefCount(cmd); if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { Tcl_Preserve((ClientData) consoleInterp); - result = Tcl_GlobalEvalObj(consoleInterp, cmd); + result = Tcl_EvalObjEx(consoleInterp, cmd, TCL_EVAL_GLOBAL); Tcl_SetReturnOptions(interp, Tcl_GetReturnOptions(consoleInterp, result)); Tcl_SetObjResult(interp, Tcl_GetObjResult(consoleInterp)); @@ -794,7 +794,7 @@ InterpreterObjCmd( Tcl_Preserve((ClientData) otherInterp); switch ((enum option) index) { case OTHER_EVAL: - result = Tcl_GlobalEvalObj(otherInterp, objv[2]); + result = Tcl_EvalObjEx(otherInterp, objv[2], TCL_EVAL_GLOBAL); /* * TODO: Should exceptions be filtered here? */ @@ -929,7 +929,7 @@ ConsoleEventProc( Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { - Tcl_GlobalEval(consoleInterp, "tk::ConsoleExit"); + Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL); } if (--info->refCount <= 0) { diff --git a/generic/tkDecls.h b/generic/tkDecls.h index d06df4b..00a3dde 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -25,6 +25,10 @@ /* !BEGIN!: Do not edit below this line. */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Exported function declarations: */ @@ -1674,6 +1678,12 @@ EXTERN void Tk_CreateOldImageType(Tk_ImageType *typePtr); EXTERN void Tk_CreateOldPhotoImageFormat( Tk_PhotoImageFormat *formatPtr); #endif +/* Slot 274 is reserved */ +#ifndef TkUnusedStubEntry_TCL_DECLARED +#define TkUnusedStubEntry_TCL_DECLARED +/* 275 */ +EXTERN void TkUnusedStubEntry(void); +#endif typedef struct TkStubHooks { struct TkPlatStubs *tkPlatStubs; @@ -1960,12 +1970,12 @@ typedef struct TkStubs { Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */ void (*tk_CreateOldImageType) (Tk_ImageType *typePtr); /* 272 */ void (*tk_CreateOldPhotoImageFormat) (Tk_PhotoImageFormat *formatPtr); /* 273 */ + VOID *reserved274; + void (*tkUnusedStubEntry) (void); /* 275 */ } TkStubs; -#ifdef __cplusplus -extern "C" { -#endif extern TkStubs *tkStubsPtr; + #ifdef __cplusplus } #endif @@ -3066,6 +3076,11 @@ extern TkStubs *tkStubsPtr; #define Tk_CreateOldPhotoImageFormat \ (tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */ #endif +/* Slot 274 is reserved */ +#ifndef TkUnusedStubEntry +#define TkUnusedStubEntry \ + (tkStubsPtr->tkUnusedStubEntry) /* 275 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ @@ -3074,5 +3089,7 @@ extern TkStubs *tkStubsPtr; #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT +#undef TkUnusedStubEntry + #endif /* _TKDECLS */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 26311a3..816b7fa 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -2519,12 +2519,6 @@ GetEntryIndex( } else { badIndex: - /* - * Some of the paths here leave messages in the interp's result, - * so we have to clear it out before storing our own message. - */ - - Tcl_SetResult(interp, NULL, TCL_STATIC); Tcl_AppendResult(interp, "bad ", (entryPtr->type == TK_ENTRY) ? "entry" : "spinbox", " index \"", string, "\"", NULL); @@ -2544,7 +2538,6 @@ GetEntryIndex( } } else if (string[0] == 's') { if (entryPtr->selectFirst < 0) { - Tcl_SetResult(interp, NULL, TCL_STATIC); Tcl_AppendResult(interp, "selection isn't in widget ", Tk_PathName(entryPtr->tkwin), NULL); return TCL_ERROR; @@ -2562,7 +2555,7 @@ GetEntryIndex( } else if (string[0] == '@') { int x, roundUp, maxWidth; - if (Tcl_GetInt(interp, string + 1, &x) != TCL_OK) { + if (Tcl_GetInt(NULL, string + 1, &x) != TCL_OK) { goto badIndex; } if (x < entryPtr->inset) { @@ -2589,7 +2582,7 @@ GetEntryIndex( *indexPtr += 1; } } else { - if (Tcl_GetInt(interp, string, indexPtr) != TCL_OK) { + if (Tcl_GetInt(NULL, string, indexPtr) != TCL_OK) { goto badIndex; } if (*indexPtr < 0){ diff --git a/generic/tkFont.c b/generic/tkFont.c index 1a6474f..9eaaf94 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -1522,8 +1522,8 @@ FreeFontObjProc( fontPtr->objRefCount--; if ((fontPtr->resourceRefCount == 0) && (fontPtr->objRefCount == 0)) { ckfree((char *) fontPtr); - objPtr->internalRep.twoPtrValue.ptr1 = NULL; } + objPtr->internalRep.twoPtrValue.ptr1 = NULL; } } diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index 8a46fde..ddd16b2 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -140,7 +140,7 @@ FileReadPPM( * image being read. */ { int fileWidth, fileHeight, maxIntensity; - int nLines, nBytes, h, type, count; + int nLines, nBytes, h, type, count, bytesPerChannel = 1; unsigned char *pixelPtr; Tk_PhotoImageBlock block; @@ -155,13 +155,15 @@ FileReadPPM( "\" has dimension(s) <= 0", NULL); return TCL_ERROR; } - if ((maxIntensity <= 0) || (maxIntensity >= 256)) { + if ((maxIntensity <= 0) || (maxIntensity > 0xffff)) { char buffer[TCL_INTEGER_SPACE]; sprintf(buffer, "%d", maxIntensity); Tcl_AppendResult(interp, "PPM image file \"", fileName, "\" has bad maximum intensity value ", buffer, NULL); return TCL_ERROR; + } else if (maxIntensity > 0x00ff) { + bytesPerChannel = 2; } if ((srcX + width) > fileWidth) { @@ -171,20 +173,20 @@ FileReadPPM( height = fileHeight - srcY; } if ((width <= 0) || (height <= 0) - || (srcX >= fileWidth) || (srcY >= fileHeight)) { + || (srcX >= fileWidth) || (srcY >= fileHeight)) { return TCL_OK; } if (type == PGM) { - block.pixelSize = 1; + block.pixelSize = 1 * bytesPerChannel; block.offset[0] = 0; block.offset[1] = 0; block.offset[2] = 0; } else { - block.pixelSize = 3; + block.pixelSize = 3 * bytesPerChannel; block.offset[0] = 0; - block.offset[1] = 1; - block.offset[2] = 2; + block.offset[1] = 1 * bytesPerChannel; + block.offset[2] = 2 * bytesPerChannel; } block.offset[3] = 0; block.width = width; @@ -224,12 +226,21 @@ FileReadPPM( ckfree((char *) pixelPtr); return TCL_ERROR; } - if (maxIntensity != 255) { + if (maxIntensity < 0x00ff) { unsigned char *p; for (p = pixelPtr; count > 0; count--, p++) { *p = (((int) *p) * 255)/maxIntensity; } + } else if (maxIntensity > 0x00ff) { + unsigned char *p; + unsigned int value; + + for (p = pixelPtr; count > 0; count--, p += 2) { + value = ((unsigned int) p[0]) * 256 + ((unsigned int) p[1]); + value = value * 255 / maxIntensity; + p[0] = p[1] = (unsigned char) value; + } } block.height = nLines; if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, @@ -474,7 +485,7 @@ StringReadPPM( * image being read. */ { int fileWidth, fileHeight, maxIntensity; - int nLines, nBytes, h, type, count, dataSize; + int nLines, nBytes, h, type, count, dataSize, bytesPerChannel = 1; unsigned char *pixelPtr, *dataBuffer; Tk_PhotoImageBlock block; @@ -490,7 +501,7 @@ StringReadPPM( NULL); return TCL_ERROR; } - if ((maxIntensity <= 0) || (maxIntensity >= 256)) { + if ((maxIntensity <= 0) || (maxIntensity > 0xffff)) { char buffer[TCL_INTEGER_SPACE]; sprintf(buffer, "%d", maxIntensity); @@ -498,6 +509,8 @@ StringReadPPM( "PPM image data has bad maximum intensity value ", buffer, NULL); return TCL_ERROR; + } else if (maxIntensity > 0x00ff) { + bytesPerChannel = 2; } if ((srcX + width) > fileWidth) { @@ -512,15 +525,15 @@ StringReadPPM( } if (type == PGM) { - block.pixelSize = 1; + block.pixelSize = 1 * bytesPerChannel; block.offset[0] = 0; block.offset[1] = 0; block.offset[2] = 0; } else { - block.pixelSize = 3; + block.pixelSize = 3 * bytesPerChannel; block.offset[0] = 0; - block.offset[1] = 1; - block.offset[2] = 2; + block.offset[1] = 1 * bytesPerChannel; + block.offset[2] = 2 * bytesPerChannel; } block.offset[3] = 0; block.width = width; @@ -531,7 +544,7 @@ StringReadPPM( dataSize -= srcY * block.pitch; } - if (maxIntensity == 255) { + if (maxIntensity == 0x00ff) { /* * We have all the data in memory, so write everything in one go. */ @@ -574,8 +587,19 @@ StringReadPPM( Tcl_AppendResult(interp, "truncated PPM data", NULL); return TCL_ERROR; } - for (p=pixelPtr,count=nBytes ; count>0 ; count--,p++,dataBuffer++) { - *p = (((int) *dataBuffer) * 255)/maxIntensity; + if (maxIntensity < 0x00ff) { + for (p=pixelPtr,count=nBytes ; count>0 ; count--,p++,dataBuffer++) { + *p = (((int) *dataBuffer) * 255)/maxIntensity; + } + } else { + unsigned char *p; + unsigned int value; + + for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2) { + value = ((unsigned int) p[0]) * 256 + ((unsigned int) p[1]); + value = value * 255 / maxIntensity; + p[0] = p[1] = (unsigned char) value; + } } dataSize -= nBytes; block.height = nLines; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 85c7de5..58c4484 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -5648,12 +5648,6 @@ ImgGetPhoto( break; } } - if (!alphaOffset) { - blockPtr->pixelPtr--; - blockPtr->offset[0]++; - blockPtr->offset[1]++; - blockPtr->offset[2]++; - } greenOffset = blockPtr->offset[1] - blockPtr->offset[0]; blueOffset = blockPtr->offset[2] - blockPtr->offset[0]; if (((optPtr->options & OPT_BACKGROUND) && alphaOffset) || @@ -5766,9 +5760,14 @@ ImgGetPhoto( if (newPixelSize>2) { blockPtr->offset[1]= 1; blockPtr->offset[2]= 2; + blockPtr->offset[3]= 3; } else { blockPtr->offset[1]= 0; blockPtr->offset[2]= 0; + blockPtr->offset[3]= 1; + } + if (!alphaOffset) { + blockPtr->offset[3]= -1; } return data; } diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 6794edb..17f39ba 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -568,6 +568,9 @@ declare 180 { char *TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } +declare 184 { + void TkUnusedStubEntry(void) +} ############################################################################## diff --git a/generic/tkInt.h b/generic/tkInt.h index 9a36e1e..15a01c5 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -570,6 +570,7 @@ typedef struct TkDisplay { #define TK_DISPLAY_USE_IM (1 << 1) #define TK_DISPLAY_WM_TRACING (1 << 3) #define TK_DISPLAY_IN_WARP (1 << 4) +#define TK_DISPLAY_USE_XKB (1 << 5) /* * One of the following structures exists for each error handler created by a @@ -975,11 +976,6 @@ MODULE_SCOPE CONST char *const tkWebColors[20]; #include "tkIntDecls.h" -#ifdef BUILD_tk -#undef TCL_STORAGE_CLASS -#define TCL_STORAGE_CLASS DLLEXPORT -#endif - /* * Themed widget set init function: */ @@ -1200,9 +1196,6 @@ MODULE_SCOPE int TkUnsupported1ObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -#undef TCL_STORAGE_CLASS -#define TCL_STORAGE_CLASS DLLIMPORT - #endif /* _TKINT */ /* diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 5fcce30..9dea8d4 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -28,6 +28,10 @@ /* !BEGIN!: Do not edit below this line. */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Exported function declarations: */ @@ -962,6 +966,14 @@ EXTERN char * TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); #endif +/* Slot 181 is reserved */ +/* Slot 182 is reserved */ +/* Slot 183 is reserved */ +#ifndef TkUnusedStubEntry_TCL_DECLARED +#define TkUnusedStubEntry_TCL_DECLARED +/* 184 */ +EXTERN void TkUnusedStubEntry(void); +#endif typedef struct TkIntStubs { int magic; @@ -1175,12 +1187,14 @@ typedef struct TkIntStubs { char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 178 */ int (*tkSmoothParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, CONST char *value, char *widgRec, int offset); /* 179 */ char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 180 */ + VOID *reserved181; + VOID *reserved182; + VOID *reserved183; + void (*tkUnusedStubEntry) (void); /* 184 */ } TkIntStubs; -#ifdef __cplusplus -extern "C" { -#endif extern TkIntStubs *tkIntStubsPtr; + #ifdef __cplusplus } #endif @@ -1846,6 +1860,13 @@ extern TkIntStubs *tkIntStubsPtr; #define TkSmoothPrintProc \ (tkIntStubsPtr->tkSmoothPrintProc) /* 180 */ #endif +/* Slot 181 is reserved */ +/* Slot 182 is reserved */ +/* Slot 183 is reserved */ +#ifndef TkUnusedStubEntry +#define TkUnusedStubEntry \ + (tkIntStubsPtr->tkUnusedStubEntry) /* 184 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ @@ -1881,6 +1902,7 @@ extern TkIntStubs *tkIntStubsPtr; (Region) (src), (Region) (ret)) #endif /* !__CYGWIN__*/ +#undef TkUnusedStubEntry #if defined(__CYGWIN__) && defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) # undef TkBindDeadWindow # define TkBindDeadWindow(winPtr) /* Removed from Cygwins stub table, just do nothing */ diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index a181073..9b800f3 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -26,6 +26,10 @@ /* !BEGIN!: Do not edit below this line. */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Exported function declarations: */ @@ -731,10 +735,8 @@ typedef struct TkIntPlatStubs { #endif /* X11 */ } TkIntPlatStubs; -#ifdef __cplusplus -extern "C" { -#endif extern TkIntPlatStubs *tkIntPlatStubsPtr; + #ifdef __cplusplus } #endif diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 1357ceb..b978561 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -36,6 +36,10 @@ typedef int (*XAfterFunction) ( /* WARNING, this type not in Xlib spec */ /* !BEGIN!: Do not edit below this line. */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Exported function declarations: */ @@ -1453,10 +1457,8 @@ typedef struct TkIntXlibStubs { #endif /* AQUA */ } TkIntXlibStubs; -#ifdef __cplusplus -extern "C" { -#endif extern TkIntXlibStubs *tkIntXlibStubsPtr; + #ifdef __cplusplus } #endif diff --git a/generic/tkListbox.c b/generic/tkListbox.c index d803d7b..248dd7b 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -1630,9 +1630,6 @@ ConfigureListbox( if (Tcl_SetVar2Ex(interp, listPtr->listVarName, NULL, listVarObj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) { - if (oldListObj == NULL) { - Tcl_DecrRefCount(listVarObj); - } continue; } } diff --git a/generic/tkMain.c b/generic/tkMain.c index 3be7189..00ac165 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -132,15 +132,18 @@ Tk_MainEx( Tcl_DString appName; /* - * Ensure that we are getting the matching version of Tcl. This is really - * only an issue when Tk is loaded dynamically. + * Ensure that we are getting a compatible version of Tcl. */ - if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { - abort(); + if (Tcl_InitStubs(interp, "8.5.0", 0) == NULL) { + if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { + abort(); + } else { + Tcl_Panic("%s", Tcl_GetStringResult(interp)); + } } -#if defined(__WIN32__) && !defined(__WIN64__) && !defined(STATIC_BUILD) +#if defined(__WIN32__) && !defined(STATIC_BUILD) if (tclStubsPtr->reserved9) { /* We are running win32 Tk under Cygwin, so let's check diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 064eaca..49b5935 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -1461,13 +1461,14 @@ DestroyMenuEntry( } } UnhookCascadeEntry(mePtr); + menuRefPtr = mePtr->childMenuRefPtr; if (menuRefPtr != NULL) { if (menuRefPtr->menuPtr == destroyThis) { menuRefPtr->menuPtr = NULL; } - if (destroyThis != NULL) { - TkDestroyMenu(destroyThis); - } + } + if (destroyThis != NULL) { + TkDestroyMenu(destroyThis); } } else { UnhookCascadeEntry(mePtr); diff --git a/generic/tkObj.c b/generic/tkObj.c index 7672240..f30742b 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -189,7 +189,7 @@ GetPixelsFromObjEx( int *intPtr, double *dblPtr) /* Places to store resulting pixels. */ { - int result,fresh; + int result, fresh; double d; PixelRep *pixelPtr; static double bias[] = { @@ -204,16 +204,16 @@ GetPixelsFromObjEx( */ if (objPtr->typePtr != &pixelObjType) { - ThreadSpecificData *tsdPtr = GetTypeCache(); + ThreadSpecificData *typeCache = GetTypeCache(); - if (objPtr->typePtr == tsdPtr->doubleTypePtr) { + if (objPtr->typePtr == typeCache->doubleTypePtr) { (void) Tcl_GetDoubleFromObj(interp, objPtr, &d); if (dblPtr != NULL) { *dblPtr = d; } *intPtr = (int) (d<0 ? d-0.5 : d+0.5); return TCL_OK; - } else if (objPtr->typePtr == tsdPtr->intTypePtr) { + } else if (objPtr->typePtr == typeCache->intTypePtr) { (void) Tcl_GetIntFromObj(interp, objPtr, intPtr); if (dblPtr) { *dblPtr = (double) (*intPtr); @@ -223,14 +223,12 @@ GetPixelsFromObjEx( } retry: - if (objPtr->typePtr != &pixelObjType) { + fresh = (objPtr->typePtr != &pixelObjType); + if (fresh) { result = SetPixelFromAny(interp, objPtr); if (result != TCL_OK) { return result; } - fresh = 1; - } else { - fresh = 0; } if (SIMPLE_PIXELREP(objPtr)) { @@ -242,14 +240,14 @@ GetPixelsFromObjEx( pixelPtr = GET_COMPLEXPIXEL(objPtr); if ((!fresh) && (pixelPtr->tkwin != tkwin)) { /* - * In case of exo-screen conversions of non-pixels we force a + * In the case of exo-screen conversions of non-pixels, we force a * recomputation from the string. */ FreePixelInternalRep(objPtr); goto retry; } - if ((pixelPtr->tkwin != tkwin)||dblPtr) { + if ((pixelPtr->tkwin != tkwin) || dblPtr) { d = pixelPtr->value; if (pixelPtr->units >= 0) { d *= bias[pixelPtr->units] * WidthOfScreen(Tk_Screen(tkwin)); @@ -294,7 +292,7 @@ Tk_GetPixelsFromObj( Tcl_Obj *objPtr, /* The object from which to get pixels. */ int *intPtr) /* Place to store resulting pixels. */ { - return GetPixelsFromObjEx(interp,tkwin,objPtr,intPtr,NULL); + return GetPixelsFromObjEx(interp, tkwin, objPtr, intPtr, NULL); } /* @@ -326,7 +324,7 @@ Tk_GetDoublePixelsFromObj( double *doublePtr) /* Place to store resulting pixels. */ { double d; - int result,val; + int result, val; result = GetPixelsFromObjEx(interp, tkwin, objPtr, &val, &d); if (result != TCL_OK) { @@ -448,7 +446,7 @@ SetPixelFromAny( double d; int i, units; - string = Tcl_GetStringFromObj(objPtr, NULL); + string = Tcl_GetString(objPtr); d = strtod(string, &rest); if (rest == string) { @@ -561,7 +559,7 @@ Tk_GetMMFromObj( } } - mmPtr = (MMRep *) objPtr->internalRep.otherValuePtr; + mmPtr = (MMRep *) objPtr->internalRep.twoPtrValue.ptr1; if (mmPtr->tkwin != tkwin) { d = mmPtr->value; if (mmPtr->units == -1) { @@ -600,8 +598,8 @@ static void FreeMMInternalRep( Tcl_Obj *objPtr) /* MM object with internal rep to free. */ { - ckfree((char *) objPtr->internalRep.otherValuePtr); - objPtr->internalRep.otherValuePtr = NULL; + ckfree((char *) objPtr->internalRep.twoPtrValue.ptr1); + objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->typePtr = NULL; } @@ -631,13 +629,13 @@ DupMMInternalRep( MMRep *oldPtr, *newPtr; copyPtr->typePtr = srcPtr->typePtr; - oldPtr = (MMRep *) srcPtr->internalRep.otherValuePtr; + oldPtr = (MMRep *) srcPtr->internalRep.twoPtrValue.ptr1; newPtr = (MMRep *) ckalloc(sizeof(MMRep)); newPtr->value = oldPtr->value; newPtr->units = oldPtr->units; newPtr->tkwin = oldPtr->tkwin; newPtr->returnValue = oldPtr->returnValue; - copyPtr->internalRep.otherValuePtr = (VOID *) newPtr; + copyPtr->internalRep.twoPtrValue.ptr1 = (VOID *) newPtr; } /* @@ -667,7 +665,7 @@ UpdateStringOfMM( char buffer[TCL_DOUBLE_SPACE]; register int len; - mmPtr = (MMRep *) objPtr->internalRep.otherValuePtr; + mmPtr = (MMRep *) objPtr->internalRep.twoPtrValue.ptr1; /* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */ if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) { Tcl_Panic("UpdateStringOfMM: false precondition"); @@ -705,17 +703,17 @@ SetMMFromAny( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { - ThreadSpecificData *tsdPtr = GetTypeCache(); + ThreadSpecificData *typeCache = GetTypeCache(); const Tcl_ObjType *typePtr; char *string, *rest; double d; int units; MMRep *mmPtr; - if (objPtr->typePtr == tsdPtr->doubleTypePtr) { + if (objPtr->typePtr == typeCache->doubleTypePtr) { Tcl_GetDoubleFromObj(interp, objPtr, &d); units = -1; - } else if (objPtr->typePtr == tsdPtr->intTypePtr) { + } else if (objPtr->typePtr == typeCache->intTypePtr) { Tcl_GetIntFromObj(interp, objPtr, &units); d = (double) units; units = -1; @@ -726,13 +724,13 @@ SetMMFromAny( * ints again from mm obj types. */ - (void) Tcl_GetStringFromObj(objPtr, NULL); + (void) Tcl_GetString(objPtr); } else { /* * It wasn't a known int or double, so parse it. */ - string = Tcl_GetStringFromObj(objPtr, NULL); + string = Tcl_GetString(objPtr); d = strtod(string, &rest); if (rest == string) { @@ -780,15 +778,15 @@ SetMMFromAny( (*typePtr->freeIntRepProc)(objPtr); } - objPtr->typePtr = &mmObjType; + objPtr->typePtr = &mmObjType; - mmPtr = (MMRep *) ckalloc(sizeof(MMRep)); - mmPtr->value = d; - mmPtr->units = units; - mmPtr->tkwin = NULL; + mmPtr = (MMRep *) ckalloc(sizeof(MMRep)); + mmPtr->value = d; + mmPtr->units = units; + mmPtr->tkwin = NULL; mmPtr->returnValue = d; - objPtr->internalRep.otherValuePtr = (VOID *) mmPtr; + objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) mmPtr; return TCL_OK; } @@ -821,7 +819,7 @@ TkGetWindowFromObj( Tcl_Obj *objPtr, /* The object from which to get window. */ Tk_Window *windowPtr) /* Place to store resulting window. */ { - TkMainInfo *mainPtr = ((TkWindow *)tkwin)->mainPtr; + TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; register WindowRep *winPtr; int result; @@ -830,28 +828,28 @@ TkGetWindowFromObj( return result; } - winPtr = (WindowRep *) objPtr->internalRep.otherValuePtr; - if ( winPtr->tkwin == NULL - || winPtr->mainPtr == NULL - || winPtr->mainPtr != mainPtr - || winPtr->epoch != mainPtr->deletionEpoch) + winPtr = (WindowRep *) objPtr->internalRep.twoPtrValue.ptr1; + if (winPtr->tkwin == NULL + || winPtr->mainPtr == NULL + || winPtr->mainPtr != mainPtr + || winPtr->epoch != mainPtr->deletionEpoch) { /* * Cache is invalid. */ winPtr->tkwin = Tk_NameToWindow(interp, - Tcl_GetStringFromObj(objPtr, NULL), tkwin); + Tcl_GetString(objPtr), tkwin); + if (winPtr->tkwin == NULL) { + /* ASSERT: Tk_NameToWindow has left error message in interp */ + return TCL_ERROR; + } + winPtr->mainPtr = mainPtr; winPtr->epoch = mainPtr ? mainPtr->deletionEpoch : 0; } *windowPtr = winPtr->tkwin; - - if (winPtr->tkwin == NULL) { - /* ASSERT: Tk_NameToWindow has left error message in interp */ - return TCL_ERROR; - } return TCL_OK; } @@ -887,7 +885,7 @@ SetWindowFromAny( * Free the old internalRep before setting the new one. */ - Tcl_GetStringFromObj(objPtr, NULL); + (void)Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { (*typePtr->freeIntRepProc)(objPtr); @@ -898,7 +896,7 @@ SetWindowFromAny( winPtr->mainPtr = NULL; winPtr->epoch = 0; - objPtr->internalRep.otherValuePtr = (VOID*)winPtr; + objPtr->internalRep.twoPtrValue.ptr1 = (VOID*)winPtr; objPtr->typePtr = &windowObjType; return TCL_OK; @@ -929,12 +927,12 @@ DupWindowInternalRep( { register WindowRep *oldPtr, *newPtr; - oldPtr = srcPtr->internalRep.otherValuePtr; + oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; newPtr = (WindowRep *) ckalloc(sizeof(WindowRep)); newPtr->tkwin = oldPtr->tkwin; newPtr->mainPtr = oldPtr->mainPtr; newPtr->epoch = oldPtr->epoch; - copyPtr->internalRep.otherValuePtr = (VOID *)newPtr; + copyPtr->internalRep.twoPtrValue.ptr1 = (VOID *)newPtr; copyPtr->typePtr = srcPtr->typePtr; } @@ -960,13 +958,13 @@ static void FreeWindowInternalRep( Tcl_Obj *objPtr) /* Window object with internal rep to free. */ { - ckfree((char *) objPtr->internalRep.otherValuePtr); - objPtr->internalRep.otherValuePtr = NULL; + ckfree((char *) objPtr->internalRep.twoPtrValue.ptr1); + objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->typePtr = NULL; } /* - *-------------------------------------------------------------- + *---------------------------------------------------------------------- * * TkParsePadAmount -- * @@ -984,7 +982,7 @@ FreeWindowInternalRep( * An error message is written to the interpreter if something is not * right. * - *-------------------------------------------------------------- + *---------------------------------------------------------------------- */ int diff --git a/generic/tkOption.c b/generic/tkOption.c index de92627..91a6cc0 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -1019,14 +1019,25 @@ AddFromString( Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } - if ((src[0] == '\\') && (src[1] == '\n')) { - src += 2; - lineNum++; - } else { - *dst = *src; - dst++; - src++; + if (*src == '\\'){ + if (src[1] == '\n') { + src += 2; + lineNum++; + continue; + } else if (src[1] == 'n') { + src += 2; + *dst++ = '\n'; + continue; + } else if (src[1] == '\t' || src[1] == ' ' || src[1] == '\\') { + ++src; + } else if (src[1] >= '0' && src[1] <= '3' && src[2] >= '0' && + src[2] <= '9' && src[3] >= '0' && src[3] <= '9') { + *dst++ = ((src[1]&7)<<6) | ((src[2]&7)<<3) | (src[3]&7); + src += 4; + continue; + } } + *dst++ = *src++; } *dst = 0; diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index 549ae30..eb3d74d 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -25,6 +25,10 @@ /* !BEGIN!: Do not edit below this line. */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Exported function declarations: */ @@ -154,10 +158,8 @@ typedef struct TkPlatStubs { #endif /* AQUA */ } TkPlatStubs; -#ifdef __cplusplus -extern "C" { -#endif extern TkPlatStubs *tkPlatStubsPtr; + #ifdef __cplusplus } #endif diff --git a/generic/tkScale.c b/generic/tkScale.c index 28e5b16..69a7d91 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -808,6 +808,9 @@ ComputeFormat( */ numDigits = scalePtr->digits; + if (numDigits > TCL_MAX_PREC) { + numDigits = 0; + } if (numDigits <= 0) { if (scalePtr->resolution > 0) { /* @@ -888,7 +891,7 @@ static void ComputeScaleGeometry( register TkScale *scalePtr) /* Information about widget. */ { - char valueString[PRINT_CHARS]; + char valueString[TCL_DOUBLE_SPACE]; int tmp, valuePixels, x, y, extraSpace; Tk_FontMetrics fm; @@ -1304,7 +1307,7 @@ ScaleSetVariable( register TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { - char string[PRINT_CHARS]; + char string[TCL_DOUBLE_SPACE]; sprintf(string, scalePtr->format, scalePtr->value); scalePtr->flags |= SETTING_VAR; diff --git a/generic/tkScale.h b/generic/tkScale.h index f406bf6..a2c5f2b 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -220,12 +220,6 @@ typedef struct TkScale { #define SPACING 2 /* - * How many characters of space to provide when formatting the scale's value: - */ - -#define PRINT_CHARS 150 - -/* * Declaration of procedures used in the implementation of the scale widget. */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index c2ef290..79edc4d 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -30,6 +30,8 @@ #include "tkPlatDecls.h" #include "tkIntXlibDecls.h" +#define TkUnusedStubEntry NULL + #ifdef __WIN32__ static int @@ -476,6 +478,10 @@ TkIntStubs tkIntStubs = { TkOrientPrintProc, /* 178 */ TkSmoothParseProc, /* 179 */ TkSmoothPrintProc, /* 180 */ + NULL, /* 181 */ + NULL, /* 182 */ + NULL, /* 183 */ + TkUnusedStubEntry, /* 184 */ }; TkIntPlatStubs tkIntPlatStubs = { @@ -1130,6 +1136,8 @@ TkStubs tkStubs = { Tk_Interp, /* 271 */ Tk_CreateOldImageType, /* 272 */ Tk_CreateOldPhotoImageFormat, /* 273 */ + NULL, /* 274 */ + TkUnusedStubEntry, /* 275 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index 5349a0b..f605b5d 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.c @@ -1,33 +1,16 @@ /* * tkStubLib.c -- * - * Stub object that will be statically linked into extensions that wish + * Stub object that will be statically linked into extensions that want * to access Tk. * - * Copyright (c) 1998 Paul Duffin. * Copyright (c) 1998-1999 by Scriptics Corporation. + * Copyright (c) 1998 Paul Duffin. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -/* - * We need to ensure that we use the stub macros so that this file contains no - * references to any of the stub functions. This will make it possible to - * build an extension that references Tk_InitStubs but doesn't end up - * including the rest of the stub functions. - */ - -#ifndef USE_TCL_STUBS -#define USE_TCL_STUBS -#endif -#undef USE_TCL_STUB_PROCS - -#ifndef USE_TK_STUBS -#define USE_TK_STUBS -#endif -#undef USE_TK_STUB_PROCS - #include "tkInt.h" #ifdef __WIN32__ @@ -56,7 +39,8 @@ TkIntXlibStubs *tkIntXlibStubsPtr = NULL; * Use our own isdigit to avoid linking to libc on windows */ -static int isDigit(const int c) +static int +isDigit(const int c) { return (c >= '0' && c <= '9'); } @@ -78,66 +62,73 @@ static int isDigit(const int c) * *---------------------------------------------------------------------- */ - -#ifdef Tk_InitStubs #undef Tk_InitStubs -#endif - CONST char * Tk_InitStubs( Tcl_Interp *interp, CONST char *version, int exact) { - CONST char *actualVersion; - TkStubs **stubsPtrPtr = &tkStubsPtr; /* squelch warning */ - - actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 0, - (ClientData *) stubsPtrPtr); - if (!actualVersion) { + const char *packageName = "Tk"; + const char *errMsg = NULL; + ClientData clientData = NULL; + CONST char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, + packageName, version, 0, &clientData); + TkStubs *stubsPtr = (TkStubs *)clientData; + + if (actualVersion == NULL) { return NULL; } + if (exact) { - CONST char *p = version; - int count = 0; + CONST char *p = version; + int count = 0; - while (*p) { - count += !isDigit(*p++); - } - if (count == 1) { + while (*p) { + count += !isDigit(*p++); + } + if (count == 1) { CONST char *q = actualVersion; p = version; while (*p && (*p == *q)) { p++; q++; } - if (*p) { + if (*p || isDigit(*q)) { /* Construct error message */ - Tcl_PkgRequireEx(interp, "Tk", version, 1, NULL); - return NULL; - - } - } else { - actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 1, NULL); - if (actualVersion == NULL) { - return NULL; - } - } + tclStubsPtr->tcl_PkgRequireEx(interp, "Tk", version, 1, NULL); + return NULL; + } + } else { + actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, "Tk", + version, 1, NULL); + if (actualVersion == NULL) { + return NULL; + } + } } - - if (!tkStubsPtr) { - Tcl_SetResult(interp, - "This implementation of Tk does not support stubs", - TCL_STATIC); - return NULL; + if (stubsPtr == NULL) { + errMsg = "missing stub table pointer"; + } else { + tkStubsPtr = stubsPtr; + if (stubsPtr->hooks) { + tkPlatStubsPtr = stubsPtr->hooks->tkPlatStubs; + tkIntStubsPtr = stubsPtr->hooks->tkIntStubs; + tkIntPlatStubsPtr = stubsPtr->hooks->tkIntPlatStubs; + tkIntXlibStubsPtr = stubsPtr->hooks->tkIntXlibStubs; + } else { + tkPlatStubsPtr = NULL; + tkIntStubsPtr = NULL; + tkIntPlatStubsPtr = NULL; + tkIntXlibStubsPtr = NULL; + } + return actualVersion; } - - tkPlatStubsPtr = tkStubsPtr->hooks->tkPlatStubs; - tkIntStubsPtr = tkStubsPtr->hooks->tkIntStubs; - tkIntPlatStubsPtr = tkStubsPtr->hooks->tkIntPlatStubs; - tkIntXlibStubsPtr = tkStubsPtr->hooks->tkIntXlibStubs; - - return actualVersion; + tclStubsPtr->tcl_ResetResult(interp); + tclStubsPtr->tcl_AppendResult(interp, "Error loading ", packageName, + " (requested version ", version, ", actual version ", + actualVersion, "): ", errMsg, NULL); + return NULL; } /* diff --git a/generic/tkStyle.c b/generic/tkStyle.c index dd3b2e8..c2eed8f 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -62,7 +62,7 @@ typedef struct StyleEngine { StyledElement *elements; /* Table of widget element descriptors. Each * element is indexed by a unique system-wide * ID. Table grows dynamically as new elements - * are registered. Malloc'd*/ + * are registered. Malloc'd. */ struct StyleEngine *parentPtr; /* Parent engine. Engines may be layered to * form a fallback chain, terminated by the @@ -146,7 +146,7 @@ static int SetStyleFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); /* * The following structure defines the implementation of the "style" Tcl - * object, used for drawing. The internalRep.otherValuePtr field of each style + * object, used for drawing. The internalRep.twoPtrValue.ptr1 field of each style * object points to the Style structure for the stylefont, or NULL. */ @@ -375,14 +375,12 @@ InitStyleEngine( */ enginePtr->parentPtr = NULL; - } else if (parentPtr == NULL) { /* * The default style engine is the parent. */ enginePtr->parentPtr = tsdPtr->defaultEnginePtr; - } else { enginePtr->parentPtr = parentPtr; } @@ -602,17 +600,16 @@ FreeStyledElement( static int CreateElement( - const char *name, /* Name of the element. */ - int create) /* Boolean, whether the element is being created - * explicitly (being registered) or implicitly (by a - * derived element). */ + const char *name, /* Name of the element. */ + int create) /* Boolean, whether the element is being + * created explicitly (being registered) or + * implicitly (by a derived element). */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr, *engineEntryPtr; Tcl_HashSearch search; - int newEntry; - int elementId, genericId = -1; + int newEntry, elementId, genericId = -1; char *dot; StyleEngine *enginePtr; @@ -1261,8 +1258,7 @@ Tk_CreateStyle( stylePtr = (Style *) ckalloc(sizeof(Style)); InitStyle(stylePtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr), - (engine != NULL ? (StyleEngine *) engine : - tsdPtr->defaultEnginePtr), + (engine!=NULL ? (StyleEngine *) engine : tsdPtr->defaultEnginePtr), clientData); Tcl_SetHashValue(entryPtr, (ClientData) stylePtr); @@ -1415,10 +1411,8 @@ Tk_AllocStyleFromObj( if (objPtr->typePtr != &styleObjType) { SetStyleFromAny(interp, objPtr); - stylePtr = (Style *) objPtr->internalRep.otherValuePtr; - } else { - stylePtr = (Style *) objPtr->internalRep.otherValuePtr; } + stylePtr = (Style *) objPtr->internalRep.twoPtrValue.ptr1; return (Tk_Style) stylePtr; } @@ -1450,7 +1444,7 @@ Tk_GetStyleFromObj( SetStyleFromAny(NULL, objPtr); } - return (Tk_Style) objPtr->internalRep.otherValuePtr; + return (Tk_Style) objPtr->internalRep.twoPtrValue.ptr1; } /* @@ -1505,7 +1499,7 @@ SetStyleFromAny( } objPtr->typePtr = &styleObjType; - objPtr->internalRep.otherValuePtr = (VOID *) Tk_GetStyle(interp, name); + objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) Tk_GetStyle(interp, name); return TCL_OK; } @@ -1528,7 +1522,7 @@ static void FreeStyleObjProc( Tcl_Obj *objPtr) /* The object we are releasing. */ { - objPtr->internalRep.otherValuePtr = NULL; + objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->typePtr = NULL; } @@ -1549,7 +1543,8 @@ DupStyleObjProc( Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { dupObjPtr->typePtr = srcObjPtr->typePtr; - dupObjPtr->internalRep.otherValuePtr=srcObjPtr->internalRep.otherValuePtr; + dupObjPtr->internalRep.twoPtrValue.ptr1 = + srcObjPtr->internalRep.twoPtrValue.ptr1; } /* diff --git a/generic/tkTest.c b/generic/tkTest.c index 307ca34..d06769d 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -164,7 +164,7 @@ static int TestfontObjCmd(ClientData dummy, Tcl_Obj *const objv[]); static int TestmakeexistCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#if !(defined(__WIN32__) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestmenubarCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); #endif @@ -190,7 +190,7 @@ static void CustomOptionFree(ClientData clientData, Tk_Window tkwin, char *internalPtr); static int TestpropCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#if !(defined(__WIN32__) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestwrapperCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); #endif @@ -277,7 +277,7 @@ Tktest_Init( #if defined(__WIN32__) || defined(MAC_OSX_TK) Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd, (ClientData) Tk_MainWindow(interp), NULL); -#else +#elif !defined(__CYGWIN__) Tcl_CreateCommand(interp, "testmenubar", TestmenubarCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateCommand(interp, "testsend", TkpTestsendCmd, @@ -400,7 +400,7 @@ CBindingEvalProc( cbindPtr = (CBinding *) clientData; - return Tcl_GlobalEval(interp, cbindPtr->command); + return Tcl_EvalEx(interp, cbindPtr->command, -1, TCL_EVAL_GLOBAL); } static void @@ -410,7 +410,7 @@ CBindingFreeProc( CBinding *cbindPtr = (CBinding *) clientData; if (cbindPtr->delete != NULL) { - Tcl_GlobalEval(cbindPtr->interp, cbindPtr->delete); + Tcl_EvalEx(cbindPtr->interp, cbindPtr->delete, -1, TCL_EVAL_GLOBAL); ckfree((char *) cbindPtr->delete); } ckfree((char *) cbindPtr->command); @@ -1813,7 +1813,7 @@ TestmakeexistCmd( */ /* ARGSUSED */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#if !(defined(__WIN32__) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestmenubarCmd( ClientData clientData, /* Main window for application. */ @@ -2016,7 +2016,7 @@ TestpropCmd( return TCL_OK; } -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#if !(defined(__WIN32__) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) /* *---------------------------------------------------------------------- * diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 2516e1c..cd232bf 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -3968,6 +3968,16 @@ DisplayText( UpdateDisplayInfo(textPtr); dInfoPtr->dLinesInvalidated = 0; +#ifdef MAC_OSX_TK + /* + * Make sure that unmapped subwindows really have been unmapped. + * If the unmap request is pending as an idle request, the window + * can get redrawn on top of the widget. + */ + while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} +#endif + + /* * See if it's possible to bring some parts of the screen up-to-date by * scrolling (copying from other parts of the screen). We have to be diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 771347d..bc2b7c4 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -779,6 +779,10 @@ TkTextImageIndex( Tcl_HashEntry *hPtr; TkTextSegment *eiPtr; + if (textPtr == NULL) { + return 0; + } + hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->imageTable, name); if (hPtr == NULL) { return 0; diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index a9b0bed..70c94db 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -758,9 +758,11 @@ GetIndex( /* *--------------------------------------------------------------------- - * Stage 1: check to see if the index consists of nothing but a mark name. - * We do this check now even though it's also done later, in order to - * allow mark names that include funny characters such as spaces or "+1c". + * Stage 1: check to see if the index consists of nothing but a mark + * name, an embedded window or an embedded image. We do this check + * now even though it's also done later, in order to allow mark names, + * embedded window names or image names that include funny characters + * such as spaces or "+1c". *--------------------------------------------------------------------- */ @@ -768,6 +770,14 @@ GetIndex( goto done; } + if (TkTextWindowIndex(textPtr, string, indexPtr) != 0) { + return TCL_OK; + } + + if (TkTextImageIndex(textPtr, string, indexPtr) != 0) { + return TCL_OK; + } + /* *------------------------------------------------ * Stage 2: start again by parsing the base index. diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 5162e16..dad03bf 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -169,6 +169,14 @@ TkTextTagCmd( return TCL_ERROR; } tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), NULL); + if (tagPtr->elide) { + /* + * Indices are potentially obsolete after adding or removing + * elided character ranges, especially indices having "display" + * or "any" submodifier, therefore increase the epoch. + */ + textPtr->sharedTextPtr->stateEpoch++; + } for (i = 4; i < objc; i += 2) { if (TkTextGetObjIndex(interp, textPtr, objv[i], &index1) != TCL_OK) { diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index ecafd4e..8d1f850 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -902,10 +902,10 @@ EmbWinLayoutProc( if (dsPtr != NULL) { Tcl_DStringAppend(dsPtr, before, (int) (string-before)); - code = Tcl_GlobalEval(textPtr->interp, Tcl_DStringValue(dsPtr)); + code = Tcl_EvalEx(textPtr->interp, Tcl_DStringValue(dsPtr), -1, TCL_EVAL_GLOBAL); Tcl_DStringFree(dsPtr); } else { - code = Tcl_GlobalEval(textPtr->interp, ewPtr->body.ew.create); + code = Tcl_EvalEx(textPtr->interp, ewPtr->body.ew.create, -1, TCL_EVAL_GLOBAL); } if (code != TCL_OK) { createError: @@ -1329,6 +1329,10 @@ TkTextWindowIndex( Tcl_HashEntry *hPtr; TkTextSegment *ewPtr; + if (textPtr == NULL) { + return 0; + } + hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->windowTable, name); if (hPtr == NULL) { return 0; diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 2a8240b..bfa5d5c 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -976,89 +976,6 @@ TkFindStateNumObj( } /* - * ---------------------------------------------------------------------- - * - * TkBackgroundEvalObjv -- - * - * Evaluate a command while ensuring that we do not affect the - * interpreters state. This is important when evaluating script - * during background tasks. - * - * Results: - * A standard Tcl result code. - * - * Side Effects: - * The interpreters variables and code may be modified by the script - * but the result will not be modified. - * - * ---------------------------------------------------------------------- - */ - -int -TkBackgroundEvalObjv( - Tcl_Interp *interp, - int objc, - Tcl_Obj *const *objv, - int flags) -{ - Tcl_DString errorInfo, errorCode; - Tcl_SavedResult state; - int n, r = TCL_OK; - - Tcl_DStringInit(&errorInfo); - Tcl_DStringInit(&errorCode); - - Tcl_Preserve(interp); - - /* - * Record the state of the interpreter - */ - - Tcl_SaveResult(interp, &state); - Tcl_DStringAppend(&errorInfo, - Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY), -1); - Tcl_DStringAppend(&errorCode, - Tcl_GetVar(interp, "errorCode", TCL_GLOBAL_ONLY), -1); - - /* - * Evaluate the command and handle any error. - */ - - for (n = 0; n < objc; ++n) { - Tcl_IncrRefCount(objv[n]); - } - r = Tcl_EvalObjv(interp, objc, objv, flags); - for (n = 0; n < objc; ++n) { - Tcl_DecrRefCount(objv[n]); - } - if (r == TCL_ERROR) { - Tcl_AddErrorInfo(interp, "\n (background event handler)"); - Tcl_BackgroundError(interp); - } - - Tcl_Release(interp); - - /* - * Restore the state of the interpreter - */ - - Tcl_SetVar(interp, "errorInfo", - Tcl_DStringValue(&errorInfo), TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "errorCode", - Tcl_DStringValue(&errorCode), TCL_GLOBAL_ONLY); - Tcl_RestoreResult(interp, &state); - - /* - * Clean up references. - */ - - Tcl_DStringFree(&errorInfo); - Tcl_DStringFree(&errorCode); - - return r; -} - -/* * Local Variables: * mode: c * c-basic-offset: 4 diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 995f71f..f2e98e8 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -2831,7 +2831,7 @@ DeleteWindowsExitProc( tsdPtr->initialized = 0; } -#if defined(__WIN32__) && !defined(__WIN64__) +#if defined(__WIN32__) static HMODULE tkcygwindll = NULL; @@ -2903,7 +2903,7 @@ int Tk_Init( Tcl_Interp *interp) /* Interpreter to initialize. */ { -#if defined(__WIN32__) && !defined(__WIN64__) +#if defined(__WIN32__) if (tkcygwindll) { int (*sym)(Tcl_Interp *); @@ -2976,7 +2976,7 @@ Tk_SafeInit( * checked at several places to differentiate the two initialisations. */ -#if defined(__WIN32__) && !defined(__WIN64__) +#if defined(__WIN32__) if (tkcygwindll) { int (*sym)(Tcl_Interp *); @@ -3021,11 +3021,10 @@ Initialize( ThreadSpecificData *tsdPtr; /* - * Ensure that we are getting the matching version of Tcl. This is really - * only an issue when Tk is loaded dynamically. + * Ensure that we are getting a compatible version of Tcl. */ - if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { + if (Tcl_InitStubs(interp, "8.5.0", 0) == NULL) { return TCL_ERROR; } @@ -3257,11 +3256,6 @@ Initialize( geometry = NULL; } - if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) { - code = TCL_ERROR; - goto done; - } - /* * Provide Tk and its stub table. */ @@ -3281,9 +3275,11 @@ Initialize( Tcl_SetMainLoop(Tk_MainLoop); -#undef Tk_InitStubs - +#ifndef _WIN32 + /* On Windows, this has no added value. */ +# undef Tk_InitStubs Tk_InitStubs(interp, TK_VERSION, 1); +#endif /* * Initialized the themed widget set diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h index ee679b7..8473d36 100644 --- a/generic/ttk/ttkDecls.h +++ b/generic/ttk/ttkDecls.h @@ -23,6 +23,10 @@ extern const char *TtkInitializeStubs( #define TTK_STUBS_EPOCH 0 #define TTK_STUBS_REVISION 31 +#ifdef __cplusplus +extern "C" { +#endif + /* * Exported function declarations: */ @@ -178,10 +182,8 @@ typedef struct TtkStubs { int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); /* 40 */ } TtkStubs; -#ifdef __cplusplus -extern "C" { -#endif extern const TtkStubs *ttkStubsPtr; + #ifdef __cplusplus } #endif diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 5c280e4..ae43ae6 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1642,6 +1642,14 @@ static int EntryXViewCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Entry *entryPtr = recordPtr; + if (objc == 3) { + int newFirst; + if (EntryIndex(interp, entryPtr, objv[2], &newFirst) != TCL_OK) { + return TCL_ERROR; + } + TtkScrollTo(entryPtr->entry.xscrollHandle, newFirst); + return TCL_OK; + } return TtkScrollviewCommand(interp, objc, objv, entryPtr->entry.xscrollHandle); } diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl index 90dea25..3c8eb19 100644 --- a/generic/ttk/ttkGenStubs.tcl +++ b/generic/ttk/ttkGenStubs.tcl @@ -187,7 +187,6 @@ proc genStubs::declare {args} { variable revision incr revision - if {[llength $args] == 2} { lassign $args index decl set status current @@ -214,7 +213,25 @@ proc genStubs::declare {args} { if {$index > $stubs($curName,lastNum)} { set stubs($curName,lastNum) $index } + return +} + +# genStubs::export -- +# +# This function is used in the declarations file to declare a symbol +# that is exported from the library but is not in the stubs table. +# +# Arguments: +# decl The C function declaration, or {} for an undefined +# entry. +# +# Results: +# None. +proc genStubs::export {args} { + if {[llength $args] != 1} { + puts stderr "wrong # args: export $args" + } return } @@ -410,7 +427,6 @@ proc genStubs::parseArg {arg} { proc genStubs::makeDecl {name decl index} { variable scspec - lassign $decl rtype fname args append text "/* $index */\n" @@ -731,6 +747,8 @@ proc genStubs::emitHeader {name} { append text "#define ${CAPName}_STUBS_EPOCH $epoch\n" append text "#define ${CAPName}_STUBS_REVISION $revision\n" + append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n" + emitDeclarations $name text if {[info exists hooks($name)]} { @@ -752,8 +770,7 @@ proc genStubs::emitHeader {name} { append text "} ${capName}Stubs;\n\n" - append text "#ifdef __cplusplus\nextern \"C\" {\n#endif\n" - append text "extern const ${capName}Stubs *${name}StubsPtr;\n" + append text "extern const ${capName}Stubs *${name}StubsPtr;\n\n" append text "#ifdef __cplusplus\n}\n#endif\n" emitMacros $name text @@ -778,10 +795,9 @@ proc genStubs::emitInit {name textVar} { variable interfaces variable epoch variable revision - upvar $textVar text - set root 1 + set root 1 set capName [string toupper [string index $name 0]] append capName [string range $name 1 end] set CAPName [string toupper $name] diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 597682f..d51388b 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -347,6 +347,8 @@ static void ImageDraw( * Do not stipple at all under Aqua, just draw the image: it shows up * as a white rectangle otherwise. */ + + if (state & TTK_STATE_DISABLED) { if (TtkSelectImage(image->imageSpec, 0ul) == image->tkimg) { #ifndef MAC_OSX_TK @@ -484,6 +486,7 @@ static Ttk_ElementOptionSpec LabelElementOptions[] = { * Calculate the text, image, and total width and height. */ +#undef MAX #define MAX(a,b) ((a) > (b) ? a : b); static void LabelSetup( LabelElement *c, Tk_Window tkwin, Ttk_State state) diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index ba9e5c0..2fcb190 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -237,7 +237,7 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) ckfree((ClientData)mgr->slaves); } - Tk_CancelIdleCall(ManagerIdleProc, mgr); + Tcl_CancelIdleCall(ManagerIdleProc, mgr); ckfree((ClientData)mgr); } diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index defe05a..fc305e9 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -34,7 +34,7 @@ * TtkScrollbarUpdateRequired, which will invoke step (5) (@@@ Fix this) */ -#include <tk.h> +#include <tkInt.h> #include "ttkTheme.h" #include "ttkWidget.h" @@ -78,6 +78,7 @@ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h) char arg1[TCL_DOUBLE_SPACE + 2]; char arg2[TCL_DOUBLE_SPACE + 2]; int code; + Tcl_DString buf; h->flags &= ~SCROLL_UPDATE_REQUIRED; @@ -88,9 +89,14 @@ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h) arg1[0] = arg2[0] = ' '; Tcl_PrintDouble(interp, (double)s->first / s->total, arg1+1); Tcl_PrintDouble(interp, (double)s->last / s->total, arg2+1); + Tcl_DStringInit(&buf); + Tcl_DStringAppend(&buf, s->scrollCmd, -1); + Tcl_DStringAppend(&buf, arg1, -1); + Tcl_DStringAppend(&buf, arg2, -1); Tcl_Preserve(corePtr); - code = Tcl_VarEval(interp, s->scrollCmd, arg1, arg2, NULL); + code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL); + Tcl_DStringFree(&buf); if (WidgetDestroyed(corePtr)) { Tcl_Release(corePtr); return TCL_ERROR; diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 5095487..a2c51c0 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -509,7 +509,7 @@ static void ThemeChangedProc(ClientData clientData) static char ThemeChangedScript[] = "ttk::ThemeChanged"; StylePackageData *pkgPtr = clientData; - if (Tcl_GlobalEval(pkgPtr->interp, ThemeChangedScript) != TCL_OK) { + if (Tcl_EvalEx(pkgPtr->interp, ThemeChangedScript, -1, TCL_EVAL_GLOBAL) != TCL_OK) { Tcl_BackgroundError(pkgPtr->interp); } pkgPtr->themeChangePending = 0; diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 862c7f6..f0a3003 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -3169,6 +3169,8 @@ static int TreeviewTagAddCommand( AddTag(items[i], tag); } + TtkRedisplayWidget(&tv->core); + return TCL_OK; } @@ -3213,6 +3215,9 @@ static int TreeviewTagRemoveCommand( item=NextPreorder(item); } } + + TtkRedisplayWidget(&tv->core); + return TCL_OK; } diff --git a/library/button.tcl b/library/button.tcl index d095b8a..75378cc 100644 --- a/library/button.tcl +++ b/library/button.tcl @@ -109,6 +109,15 @@ bind Checkbutton <space> { bind Radiobutton <space> { tk::CheckRadioInvoke %W } +bind Button <<Invoke>> { + tk::ButtonInvoke %W +} +bind Checkbutton <<Invoke>> { + tk::CheckRadioInvoke %W +} +bind Radiobutton <<Invoke>> { + tk::CheckRadioInvoke %W +} bind Button <FocusIn> {} bind Button <Enter> { diff --git a/library/listbox.tcl b/library/listbox.tcl index f3434a5..2d9af20 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -142,6 +142,9 @@ bind Listbox <<Copy>> { bind Listbox <space> { tk::ListboxBeginSelect %W [%W index active] } +bind Listbox <<Invoke>> { + tk::ListboxBeginSelect %W [%W index active] +} bind Listbox <Select> { tk::ListboxBeginSelect %W [%W index active] } diff --git a/library/menu.tcl b/library/menu.tcl index cc57532..8b29f00 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -106,6 +106,10 @@ bind Menubutton <space> { tk::MbPost %W tk::MenuFirstEntry [%W cget -menu] } +bind Menubutton <<Invoke>> { + tk::MbPost %W + tk::MenuFirstEntry [%W cget -menu] +} # Must set focus when mouse enters a menu, in order to allow # mixed-mode processing using both the mouse and the keyboard. @@ -143,6 +147,9 @@ bind Menu <ButtonRelease> { bind Menu <space> { tk::MenuInvoke %W 0 } +bind Menu <<Invoke>> { + tk::MenuInvoke %W 0 +} bind Menu <Return> { tk::MenuInvoke %W 0 } @@ -1337,6 +1344,7 @@ proc ::tk_popup {menu x y {entry {}}} { tk::SaveGrabInfo $menu grab -global $menu set Priv(popup) $menu + set Priv(window) $menu set Priv(menuActivated) 1 tk_menuSetFocus $menu } diff --git a/library/scale.tcl b/library/scale.tcl index b4da824..771c7a4 100644 --- a/library/scale.tcl +++ b/library/scale.tcl @@ -223,7 +223,13 @@ proc ::tk::ScaleIncrement {w dir big repeat} { set inc [$w cget -resolution] } if {([$w cget -from] > [$w cget -to]) ^ ($dir eq "up")} { - set inc [expr {-$inc}] + if {$inc > 0} { + set inc [expr {-$inc}] + } + } else { + if {$inc < 0} { + set inc [expr {-$inc}] + } } $w set [expr {[$w get] + $inc}] diff --git a/library/tk.tcl b/library/tk.tcl index 8d6f0f9..3dae5d4 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -15,7 +15,7 @@ package require Tcl 8.5 ;# Guard against [source] in an 8.4- interp before # Insist on running with compatible version of Tcl package require Tcl 8.5.0 # Verify that we have Tk binary and script components from the same release -package require -exact Tk 8.5.13 +package require -exact Tk 8.5.17 # Create a ::tk namespace namespace eval ::tk { diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index 2c9fbc8..f16cf8b 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -14,7 +14,7 @@ namespace eval ttk { variable State set State(x) 0 - set State(selectMode) char + set State(selectMode) none set State(anchor) 0 set State(scanX) 0 set State(scanIndex) 0 @@ -74,9 +74,9 @@ bind TEntry <Double-ButtonPress-1> { ttk::entry::Select %W %x word } bind TEntry <Triple-ButtonPress-1> { ttk::entry::Select %W %x line } bind TEntry <B1-Motion> { ttk::entry::Drag %W %x } -bind TEntry <B1-Leave> { ttk::Repeatedly ttk::entry::AutoScroll %W } -bind TEntry <B1-Enter> { ttk::CancelRepeat } -bind TEntry <ButtonRelease-1> { ttk::CancelRepeat } +bind TEntry <B1-Leave> { ttk::entry::DragOut %W %m } +bind TEntry <B1-Enter> { ttk::entry::DragIn %W } +bind TEntry <ButtonRelease-1> { ttk::entry::Release %W } bind TEntry <Control-ButtonPress-1> { %W instate {!readonly !disabled} { %W icursor @%x ; focus %W } @@ -404,14 +404,40 @@ proc ttk::entry::DragTo {w x} { char { CharSelect $w $State(anchor) $cur } word { WordSelect $w $State(anchor) $cur } line { LineSelect $w $State(anchor) $cur } + none { # no-op } } } +## <B1-Leave> binding: +# Begin autoscroll. +# +proc ttk::entry::DragOut {w mode} { + variable State + if {$State(selectMode) ne "none" && $mode eq "NotifyNormal"} { + ttk::Repeatedly ttk::entry::AutoScroll $w + } +} + +## <B1-Enter> binding +# Suspend autoscroll. +# +proc ttk::entry::DragIn {w} { + ttk::CancelRepeat +} + +## <ButtonRelease-1> binding +# +proc ttk::entry::Release {w} { + variable State + set State(selectMode) none + ttk::CancelRepeat ;# suspend autoscroll +} + ## AutoScroll # Called repeatedly when the mouse is outside an entry window # with Button 1 down. Scroll the window left or right, -# depending on where the mouse is, and extend the selection -# according to the current selection mode. +# depending on where the mouse left the window, and extend +# the selection according to the current selection mode. # # TODO: AutoScroll should repeat faster (50ms) than normal autorepeat. # TODO: Need a way for Repeat scripts to cancel themselves. diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl index 52298c5..a2781c6 100644 --- a/library/ttk/fonts.tcl +++ b/library/ttk/fonts.tcl @@ -60,7 +60,7 @@ namespace eval ttk { -set tip145 [catch {font create TkDefaultFont}] +variable tip145 [catch {font create TkDefaultFont}] catch {font create TkTextFont} catch {font create TkHeadingFont} catch {font create TkCaptionFont} diff --git a/library/ttk/progress.tcl b/library/ttk/progress.tcl index b6e2ffb..34dce72 100644 --- a/library/ttk/progress.tcl +++ b/library/ttk/progress.tcl @@ -18,10 +18,10 @@ proc ttk::progressbar::Autoincrement {pb steptime stepsize} { return } - $pb step $stepsize - set Timers($pb) [after $steptime \ [list ttk::progressbar::Autoincrement $pb $steptime $stepsize] ] + + $pb step $stepsize } # ttk::progressbar::start -- diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl index 23d08ed..4a534de 100644 --- a/library/ttk/scale.tcl +++ b/library/ttk/scale.tcl @@ -39,7 +39,7 @@ proc ttk::scale::Press {w x y} { switch -glob -- [$w identify $x $y] { *track - *trough { - set inc [expr {([$w get $x $y] <= [$w get]) ? -1 : 1}] + set inc [expr {([$w get $x $y] <= [$w get]) ^ ([$w cget -from] > [$w cget -to]) ? -1 : 1}] ttk::Repeatedly Increment $w $inc } *slider { @@ -84,5 +84,8 @@ proc ttk::scale::Release {w x y} { proc ttk::scale::Increment {w delta} { if {![winfo exists $w]} return + if {([$w cget -from] > [$w cget -to])} { + set delta [expr {-$delta}] + } $w set [expr {[$w get] + $delta}] } diff --git a/macosx/README b/macosx/README index 8bd33d4..b992a2e 100644 --- a/macosx/README +++ b/macosx/README @@ -19,8 +19,8 @@ before asking on the list, many questions have already been answered). http://wiki.tcl.tk/_/ref?N=3753 http://wiki.tcl.tk/_/ref?N=8361 -- Please report bugs with Tcl or Tk on Mac OS X to the sourceforge bug trackers: - http://tcl.sourceforge.net/ +- Please report bugs with Tk on Mac OS X to the tracker: + http://core.tcl.tk/tk/reportlist 2. Using Tcl/Tk on Mac OS X --------------------------- diff --git a/macosx/Wish-Info.plist.in b/macosx/Wish-Info.plist.in index 90e00a4..78170f1 100644 --- a/macosx/Wish-Info.plist.in +++ b/macosx/Wish-Info.plist.in @@ -72,5 +72,7 @@ Copyright © 2001-2002 Jim Ingham & Ian Reid</string> <true/> <key>OSAScriptingDefinition</key> <string>Wish.sdef</string> + <key>NSHighResolutionCapable</key> + <string>True</string> </dict> </plist> diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index f912b81..b9ee7a3 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -7,6 +7,7 @@ * Copyright (c) 1996-1997 by Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright 2014 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -23,9 +24,68 @@ #endif */ +static NSRect TkMacOSXGetButtonFrame(TkButton *butPtr); + +/* + * A subclass of NSButton with sanity checking: + * NSButtons created by Tk will have their tag set to a pointer to the TkButton + * which manages the NSButton. This allows a TkNSButton to be aware of the + * state of its Tk parent. This subclass overrides the drawRect method + * so that it will not draw itself unless the NSButton frame matches + * the frame which was installed by DisplayButton, and the TkButton is + * mapped. Also, it will not draw anything if the widget is completely + * outside of its container. + */ + +@interface TkNSButton: NSButton + +@end + +@implementation TkNSButton + + - (void)drawRect:(NSRect)dirtyRect + { + NSInteger tag = [self tag]; + if ( tag != -1) { + TkButton *butPtr = (TkButton *)tag; + MacDrawable* macWin = (MacDrawable *)butPtr; + NSRect Tkframe = TkMacOSXGetButtonFrame(butPtr); + Tk_Window tkwin = butPtr->tkwin; + /* Do not draw if the widget is misplaced or unmapped. */ + if ( NSIsEmptyRect(Tkframe) || + ! macWin->winPtr->flags & TK_MAPPED || + ! NSEqualRects(Tkframe, [self frame]) + ) { + return; + } + /* Do not draw if the widget is completely outside of its parent, or within 20 pixels of the lower border; this prevents buttons from being drawn on peer widgets as scrolling occurs. */ + if (tkwin) { + int parent_height = Tk_Height(Tk_Parent(tkwin)); + int widget_height = Tk_Height(tkwin); + int y = Tk_Y(tkwin); + if ( y > parent_height - 20 || y + widget_height < 0 ) { + return; + } + + /* Do not draw if the widget is completely outside of its parent, or within 50 pixels of the right border; this prevents buttons from being drawn on peer widgets as scrolling occurs. */ + int parent_width = Tk_Width(Tk_Parent(tkwin)); + int widget_width = Tk_Width(tkwin); + int x = Tk_X(tkwin); + if (x > parent_width - 50 || x < 0) { + return; + } + + } + } + [super drawRect:dirtyRect]; + } + +@end + + typedef struct MacButton { TkButton info; - NSButton *button; + TkNSButton *button; NSImage *image, *selectImage, *tristateImage; #if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS int fix; @@ -135,9 +195,10 @@ TkpDestroyButton( TkButton *butPtr) { MacButton *macButtonPtr = (MacButton *) butPtr; + [macButtonPtr->button setTag:(NSInteger)-1]; TkMacOSXMakeCollectableAndRelease(macButtonPtr->button); - TkMacOSXMakeCollectableAndRelease(macButtonPtr->selectImage); + TkMacOSXMakeCollectableAndRelease(macButtonPtr->image); TkMacOSXMakeCollectableAndRelease(macButtonPtr->selectImage); TkMacOSXMakeCollectableAndRelease(macButtonPtr->tristateImage); } @@ -186,6 +247,45 @@ TkpDisplayButton( /* *---------------------------------------------------------------------- * + * TkpShiftButton -- + * + * Moves the frame of an NSButton (or TkNSButton) and in case the tag is + * set, also adjusts the xOff and yOff of the controlling TkButton's + * MacDrawable. This is used to avoid jitter when scrolling. + * + * Results: + * None + * + * Side effects: + * Moves the NSbutton after adjusting the associated MacDrawable. + * + *---------------------------------------------------------------------- + */ +void +TkpShiftButton( + NSButton *button, + NSPoint delta ) + { + NSPoint origin = [button frame].origin; + NSInteger tag = [button tag]; + if ( tag != -1) { + TkButton* butPtr = (TkButton *)tag; + TkWindow *winPtr = (TkWindow *) (butPtr->tkwin); + if (winPtr) { + MacDrawable *macWin = (MacDrawable *) winPtr->window; + macWin->xOff += delta.x; + macWin->yOff += delta.y; + } + } + origin.x += delta.x; + origin.y -= delta.y; + [button setFrameOrigin:origin]; + } + + +/* + *---------------------------------------------------------------------- + * * TkpComputeButtonGeometry -- * * After changes in a button's text or bitmap, this procedure @@ -218,7 +318,8 @@ TkpComputeButtonGeometry( case TYPE_CHECK_BUTTON: case TYPE_RADIO_BUTTON: if (!macButtonPtr->button) { - NSButton *button = [[NSButton alloc] initWithFrame:NSZeroRect]; + TkNSButton *button = [[TkNSButton alloc] initWithFrame:NSZeroRect]; + [button setTag:(NSInteger)butPtr]; macButtonPtr->button = TkMacOSXMakeUncollectable(button); } ComputeNativeButtonGeometry(butPtr); @@ -266,6 +367,52 @@ TkpButtonSetDefaults() /* *---------------------------------------------------------------------- * + * TkMacOSXGetButtonFrame -- + * + * Computes a frame for an NSButton that will correspond to where + * Tk thinks the button is located. + * + * Results: + * Returns an NSRect describing a frame for an NSButton. + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ +NSRect TkMacOSXGetButtonFrame( + TkButton *butPtr) +{ + MacButton *macButtonPtr = (MacButton *) butPtr; + Tk_Window tkwin = butPtr->tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; + if (tkwin) { + MacDrawable *macWin = (MacDrawable *) winPtr->window; + NSView *view = TkMacOSXDrawableView(macWin); + CGFloat viewHeight = [view bounds].size.height; + NSRect frame = NSMakeRect(macWin->xOff, macWin->yOff, + Tk_Width(tkwin), Tk_Height(tkwin)); + +#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS + if (tkMacOSXUseCompatibilityMetrics) { + BoundsFix boundsFix = boundsFixes[macButtonPtr->fix]; + frame = NSOffsetRect(frame, boundsFix.offsetX, boundsFix.offsetY); + frame.size.height -= boundsFix.shrinkH + NATIVE_BUTTON_EXTRA_H; + frame = NSInsetRect(frame, boundsFix.inset + NATIVE_BUTTON_INSET, + boundsFix.inset + NATIVE_BUTTON_INSET); + } +#endif + + frame.origin.y = viewHeight - (frame.origin.y + frame.size.height); + return frame; + } else { + return NSZeroRect; + } +} + +/* + *---------------------------------------------------------------------- + * * DisplayNativeButton -- * * This procedure is invoked to display a button widget. It is @@ -286,7 +433,7 @@ DisplayNativeButton( TkButton *butPtr) { MacButton *macButtonPtr = (MacButton *) butPtr; - NSButton *button = macButtonPtr->button; + TkNSButton *button = macButtonPtr->button; Tk_Window tkwin = butPtr->tkwin; TkWindow *winPtr = (TkWindow *) tkwin; MacDrawable *macWin = (MacDrawable *) winPtr->window; @@ -349,21 +496,8 @@ DisplayNativeButton( } else { [button setKeyEquivalent:@""]; } - frame = NSMakeRect(macWin->xOff, macWin->yOff, Tk_Width(tkwin), - Tk_Height(tkwin)); -#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS - if (tkMacOSXUseCompatibilityMetrics) { - BoundsFix boundsFix = boundsFixes[macButtonPtr->fix]; - frame = NSOffsetRect(frame, boundsFix.offsetX, boundsFix.offsetY); - frame.size.height -= boundsFix.shrinkH + NATIVE_BUTTON_EXTRA_H; - frame = NSInsetRect(frame, boundsFix.inset + NATIVE_BUTTON_INSET, - boundsFix.inset + NATIVE_BUTTON_INSET); - } -#endif - frame.origin.y = viewHeight - (frame.origin.y + frame.size.height); - if (!NSEqualRects(frame, [button frame])) { - [button setFrame:frame]; - } + frame = TkMacOSXGetButtonFrame(butPtr); + [button setFrame:frame]; [button displayRectIgnoringOpacity:[button bounds]]; TkMacOSXRestoreDrawingContext(&dc); #ifdef TK_MAC_DEBUG_BUTTON @@ -396,7 +530,7 @@ ComputeNativeButtonGeometry( TkButton *butPtr) /* Button whose geometry may have changed. */ { MacButton *macButtonPtr = (MacButton *) butPtr; - NSButton *button = macButtonPtr->button; + TkNSButton *button = macButtonPtr->button; NSButtonCell *cell = [button cell]; NSButtonType type = -1; NSBezelStyle style = 0; @@ -429,7 +563,7 @@ ComputeNativeButtonGeometry( } break; case TYPE_RADIO_BUTTON: - case TYPE_CHECK_BUTTON: + case TYPE_CHECK_BUTTON: if (!haveImage /*|| butPtr->indicatorOn*/) { // TODO: indicatorOn type = butPtr->type == TYPE_RADIO_BUTTON ? NSRadioButton : NSSwitchButton; @@ -454,7 +588,7 @@ ComputeNativeButtonGeometry( } [button setButtonType:type]; if (style) { - [button setBezelStyle:style]; + [button setBezelStyle:style]; } if (highlightsBy) { [cell setHighlightsBy:highlightsBy|[cell highlightsBy]]; @@ -1169,6 +1303,7 @@ ComputeUnixButtonGeometry( Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset); } + /* * Local Variables: * mode: objc diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index 7cd9c30..6ac7830 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -168,6 +168,7 @@ XSetSelectionOwner( changeCount = [pb declareTypes:[NSArray array] owner:NSApp]; } } + return Success; } /* @@ -194,7 +195,6 @@ TkMacOSXSelDeadWindow( if (winPtr && winPtr == (TkWindow *)clipboardOwner) { clipboardOwner = NULL; } - return Success; } /* diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index d9e824a..bc11b96 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -14,6 +14,9 @@ #include "tkMacOSXPrivate.h" #include "tkFileFilter.h" +static int TkBackgroundEvalObjv(Tcl_Interp *interp, int objc, + Tcl_Obj *const *objv, int flags); + static const char *colorOptionStrings[] = { "-initialcolor", "-parent", "-title", NULL }; @@ -1057,6 +1060,68 @@ end: } /* + * ---------------------------------------------------------------------- + * + * TkBackgroundEvalObjv -- + * + * Evaluate a command while ensuring that we do not affect the + * interpreters state. This is important when evaluating script + * during background tasks. + * + * Results: + * A standard Tcl result code. + * + * Side Effects: + * The interpreters variables and code may be modified by the script + * but the result will not be modified. + * + * ---------------------------------------------------------------------- + */ + +int +TkBackgroundEvalObjv( + Tcl_Interp *interp, + int objc, + Tcl_Obj *const *objv, + int flags) +{ + Tcl_InterpState state; + int n, r = TCL_OK; + + /* + * Record the state of the interpreter. + */ + + Tcl_Preserve(interp); + state = Tcl_SaveInterpState(interp, TCL_OK); + + /* + * Evaluate the command and handle any error. + */ + + for (n = 0; n < objc; ++n) { + Tcl_IncrRefCount(objv[n]); + } + r = Tcl_EvalObjv(interp, objc, objv, flags); + for (n = 0; n < objc; ++n) { + Tcl_DecrRefCount(objv[n]); + } + if (r == TCL_ERROR) { + Tcl_AddErrorInfo(interp, "\n (background event handler)"); + Tcl_BackgroundError(interp); + } + + /* + * Restore the state of the interpreter. + */ + + (void) Tcl_RestoreInterpState(interp, state); + Tcl_Release(interp); + + return r; +} + +/* * Local Variables: * mode: objc * c-basic-offset: 4 diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 4eb4a88..d4b2c85 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -8,6 +8,7 @@ * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright 2014 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -16,6 +17,7 @@ #include "tkMacOSXPrivate.h" #include "tkMacOSXDebug.h" #include "xbytes.h" +#include "tkButton.h" /* #ifdef TK_MAC_DEBUG @@ -113,10 +115,79 @@ TkMacOSXInitCGDrawing( /* *---------------------------------------------------------------------- * + * BitmapRepFromDrawableRect + * + * Extract bitmap data from a MacOSX drawable as an NSBitmapImageRep. + * + * Results: + * Returns an autoreleased NSBitmapRep representing the image of the given + * rectangle of the given drawable. + * + * NOTE: The x,y coordinates should be relative to a coordinate system with + * origin at the top left, as used by XImage and CGImage, not bottom + * left as used by NSView. + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ +NSBitmapImageRep* +BitmapRepFromDrawableRect( + Drawable drawable, + int x, + int y, + unsigned int width, + unsigned int height) +{ + MacDrawable *mac_drawable = (MacDrawable *) drawable; + CGContextRef cg_context=NULL; + CGImageRef cg_image=NULL, sub_cg_image=NULL; + NSBitmapImageRep *bitmap_rep=NULL; + NSView *view=NULL; + if ( mac_drawable->flags & TK_IS_PIXMAP ) { + /* + This means that the MacDrawable is functioning as a Tk Pixmap, so its view + field is NULL. It's context field should point to a CGImage. + */ + cg_context = GetCGContextForDrawable(drawable); + CGRect image_rect = CGRectMake(x, y, width, height); + cg_image = CGBitmapContextCreateImage( (CGContextRef) cg_context); + sub_cg_image = CGImageCreateWithImageInRect(cg_image, image_rect); + if ( sub_cg_image ) { + bitmap_rep = [[NSBitmapImageRep alloc] autorelease]; + [bitmap_rep initWithCGImage:sub_cg_image]; + } + if ( cg_image ) { + CGImageRelease(cg_image); + } + } else if ( (view = TkMacOSXDrawableView(mac_drawable)) ) { + /* convert top-left coordinates to NSView coordinates */ + int view_height = [view bounds].size.height; + NSRect view_rect = NSMakeRect(x + mac_drawable->xOff, + view_height - height - y - mac_drawable->yOff, + width,height); + + if ( [view lockFocusIfCanDraw] ) { + bitmap_rep = [[NSBitmapImageRep alloc] autorelease]; + bitmap_rep = [bitmap_rep initWithFocusedViewRect:view_rect]; + [view unlockFocus]; + } else { + TkMacOSXDbgMsg("Could not lock focus on view."); + } + + } else { + TkMacOSXDbgMsg("Invalid source drawable"); + } + return bitmap_rep; +} + +/* + *---------------------------------------------------------------------- + * * XCopyArea -- * - * Copies data from one drawable to another using block transfer - * routines. + * Copies data from one drawable to another. * * Results: * None. @@ -143,76 +214,50 @@ XCopyArea( { TkMacOSXDrawingContext dc; MacDrawable *srcDraw = (MacDrawable *) src; + NSBitmapImageRep *bitmap_rep = NULL; + CGImageRef img = NULL; display->request++; + if (!width || !height) { - /* TkMacOSXDbgMsg("Drawing of emtpy area requested"); */ + /* This happens all the time. + TkMacOSXDbgMsg("Drawing of empty area requested"); + */ return; } - if (srcDraw->flags & TK_IS_PIXMAP) { - if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { - return; - } - if (dc.context) { - CGImageRef img = TkMacOSXCreateCGImageWithDrawable(src); - if (img) { - DrawCGImage(dst, gc, dc.context, img, gc->foreground, - gc->background, CGRectMake(0, 0, - srcDraw->size.width, srcDraw->size.height), - CGRectMake(src_x, src_y, width, height), - CGRectMake(dest_x, dest_y, width, height)); - CFRelease(img); - } else { - TkMacOSXDbgMsg("Invalid source drawable"); + if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { + TkMacOSXDbgMsg("Failed to setup drawing context."); + } + + if ( dc.context ) { + if (srcDraw->flags & TK_IS_PIXMAP) { + img = TkMacOSXCreateCGImageWithDrawable(src); + }else if (TkMacOSXDrawableWindow(src)) { + bitmap_rep = BitmapRepFromDrawableRect(src, src_x, src_y, width, height); + if ( bitmap_rep ) { + img = [bitmap_rep CGImage]; } } else { - TkMacOSXDbgMsg("Invalid destination drawable"); - } - TkMacOSXRestoreDrawingContext(&dc); - } else if (TkMacOSXDrawableWindow(src)) { - NSView *view = TkMacOSXDrawableView(srcDraw); - NSWindow *w = [view window]; - NSInteger gs = [w windowNumber] > 0 ? [w gState] : 0; - /* // alternative using per-view gState: - NSInteger gs = [view gState]; - if (!gs) { - [view allocateGState]; - if ([view lockFocusIfCanDraw]) { - [view unlockFocus]; - } - gs = [view gState]; + TkMacOSXDbgMsg("Invalid source drawable - neither window nor pixmap."); } - */ - if (!gs || !TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { - return; - } - if (dc.context) { - NSGraphicsContext *gc = nil; - CGFloat boundsH = [view bounds].size.height; - NSRect srcRect = NSMakeRect(srcDraw->xOff + src_x, boundsH - - height - (srcDraw->yOff + src_y), width, height); - - if (((MacDrawable *) dst)->flags & TK_IS_PIXMAP) { - gc = [NSGraphicsContext graphicsContextWithGraphicsPort: - dc.context flipped:NO]; - if (gc) { - [NSGraphicsContext saveGraphicsState]; - [NSGraphicsContext setCurrentContext:gc]; - } - } - NSCopyBits(gs, srcRect, NSMakePoint(dest_x, - dc.portBounds.size.height - dest_y)); - if (gc) { - [NSGraphicsContext restoreGraphicsState]; - } + + if (img) { + DrawCGImage(dst, gc, dc.context, img, gc->foreground, gc->background, + CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height), + CGRectMake(src_x, src_y, width, height), + CGRectMake(dest_x, dest_y, width, height)); + CFRelease(img); } else { - TkMacOSXDbgMsg("Invalid destination drawable"); + TkMacOSXDbgMsg("Failed to construct CGImage."); } - TkMacOSXRestoreDrawingContext(&dc); + } else { - TkMacOSXDbgMsg("Invalid source drawable"); + TkMacOSXDbgMsg("Invalid destination drawable - no context."); + return; } + + TkMacOSXRestoreDrawingContext(&dc); } /* @@ -253,7 +298,7 @@ XCopyPlane( display->request++; if (!width || !height) { - /* TkMacOSXDbgMsg("Drawing of emtpy area requested"); */ + /* TkMacOSXDbgMsg("Drawing of empty area requested"); */ return; } if (plane != 1) { @@ -347,6 +392,7 @@ TkPutImage( TkMacOSXDbgMsg("Invalid destination drawable"); } TkMacOSXRestoreDrawingContext(&dc); + return Success; } /* @@ -382,13 +428,7 @@ CreateCGImageWithXImage( char *data = NULL; CGDataProviderReleaseDataCallback releaseData = ReleaseData; - if (image->obdata) { - /* - * Image from XGetImage - */ - - img = TkMacOSXCreateCGImageWithDrawable((Pixmap) image->obdata); - } else if (image->bits_per_pixel == 1) { + if (image->bits_per_pixel == 1) { /* * BW image */ @@ -423,13 +463,13 @@ CreateCGImageWithXImage( * Color image */ - CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); + CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); bitsPerComponent = 8; bitsPerPixel = 32; bitmapInfo = (image->byte_order == MSBFirst ? kCGBitmapByteOrder32Big : kCGBitmapByteOrder32Little) | - kCGImageAlphaNoneSkipFirst; + kCGImageAlphaNoneSkipFirst; data = memcpy(ckalloc(len), image->data + image->xoffset, len); if (data) { provider = CGDataProviderCreateWithData(data, data, len, releaseData); @@ -744,7 +784,6 @@ DrawCGImage( } else { TkMacOSXDbgMsg("Drawing of empty CGImage requested"); } - return Success; } /* @@ -1439,43 +1478,72 @@ TkScrollWindow( int dx, int dy, /* Distance rectangle should be moved. */ TkRegion damageRgn) /* Region to accumulate damage in. */ { - MacDrawable *macDraw = (MacDrawable *) Tk_WindowId(tkwin); + Drawable drawable = Tk_WindowId(tkwin); + MacDrawable *macDraw = (MacDrawable *) drawable; NSView *view = TkMacOSXDrawableView(macDraw); - CGRect visRect, srcRect, dstRect; - CGFloat boundsH; - HIShapeRef dmgRgn, dstRgn; + CGRect srcRect, dstRect; + HIShapeRef dmgRgn = NULL, extraRgn; + NSRect bounds, visRect, scrollSrc, scrollDst; + NSPoint delta = NSMakePoint(dx, dy); int result; - - if (view && !CGRectIsEmpty(visRect = NSRectToCGRect([view visibleRect]))) { - boundsH = [view bounds].size.height; - srcRect = CGRectMake(macDraw->xOff + x, boundsH - height - - (macDraw->yOff + y), width, height); - dstRect = CGRectIntersection(CGRectOffset(srcRect, dx, -dy), visRect); - srcRect = CGRectIntersection(srcRect, visRect); - if (!CGRectIsEmpty(srcRect) && !CGRectIsEmpty(dstRect)) { - /* - CGRect sRect = CGRectIntersection(CGRectOffset(dstRect, -dx, dy), - srcRect); - NSCopyBits(0, NSRectFromCGRect(sRect), - NSPointFromCGPoint(CGRectOffset(sRect, dx, -dy).origin)); - */ - [view scrollRect:NSRectFromCGRect(srcRect) by:NSMakeSize(dx, -dy)]; - } - srcRect.origin.y = boundsH - srcRect.size.height - srcRect.origin.y; - dstRect.origin.y = boundsH - dstRect.size.height - dstRect.origin.y; - srcRect = CGRectUnion(srcRect, dstRect); - dmgRgn = HIShapeCreateMutableWithRect(&srcRect); - dstRgn = HIShapeCreateWithRect(&dstRect); - ChkErr(HIShapeDifference, dmgRgn, dstRgn, (HIMutableShapeRef) dmgRgn); - CFRelease(dstRgn); - TkMacOSXInvalidateViewRegion(view, dmgRgn); - } else { - dmgRgn = HIShapeCreateEmpty(); + + if ( view ) { + /* Get the scroll area in NSView coordinates (origin at bottom left). */ + bounds = [view bounds]; + scrollSrc = NSMakeRect( + macDraw->xOff + x, + bounds.size.height - height - (macDraw->yOff + y), + width, height); + scrollDst = NSOffsetRect(scrollSrc, dx, -dy); + /* Limit scrolling to the window content area. */ + visRect = [view visibleRect]; + scrollSrc = NSIntersectionRect(scrollSrc, visRect); + scrollDst = NSIntersectionRect(scrollDst, visRect); + + if ( !NSIsEmptyRect(scrollSrc) && !NSIsEmptyRect(scrollDst) ) { + + /* + * Mark the difference between source and destination as damaged. + * This region is described in the Tk coordinate system. + */ + + srcRect = CGRectMake(x, y, width, height); + dstRect = CGRectOffset(srcRect, dx, dy); + dmgRgn = HIShapeCreateMutableWithRect(&srcRect); + extraRgn = HIShapeCreateWithRect(&dstRect); + ChkErr(HIShapeDifference, dmgRgn, extraRgn, (HIMutableShapeRef) dmgRgn); + CFRelease(extraRgn); + + /* Scroll the rectangle. */ + [view scrollRect:scrollSrc by:NSMakeSize(dx, -dy)]; + + /* + * Adjust the positions of the button subwindows that meet the scroll + * area. + */ + + for (NSView *subview in [view subviews] ) { + if ( [subview isKindOfClass:[NSButton class]] == YES ) { + NSRect subframe = [subview frame]; + if ( NSIntersectsRect(scrollSrc, subframe) || + NSIntersectsRect(scrollDst, subframe) ) { + TkpShiftButton((NSButton *)subview, delta ); + } + } + } + + /* Redisplay the scrolled area. */ + [view displayRect:scrollDst]; + + } + } + + if ( dmgRgn == NULL ) { + dmgRgn = HIShapeCreateEmpty(); } TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); result = HIShapeIsEmpty(dmgRgn) ? 0 : 1; CFRelease(dmgRgn); - return result; } @@ -1688,6 +1756,7 @@ TkMacOSXRestoreDrawingContext( { if (dcPtr->context) { CGContextSynchronize(dcPtr->context); + [[dcPtr->view window] setViewsNeedDisplay:YES]; [[dcPtr->view window] enableFlushWindow]; if (dcPtr->focusLocked) { [dcPtr->view unlockFocus]; diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 43117a1..9671ab9 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -222,7 +222,7 @@ OappHandler( if (interp && Tcl_GetCommandInfo(interp, "::tk::mac::OpenApplication", &dummy)){ - int code = Tcl_GlobalEval(interp, "::tk::mac::OpenApplication"); + int code = Tcl_EvalEx(interp, "::tk::mac::OpenApplication", -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundError(interp); } @@ -259,7 +259,7 @@ RappHandler( if (interp && Tcl_GetCommandInfo(interp, "::tk::mac::ReopenApplication", &dummy)) { - int code = Tcl_GlobalEval(interp, "::tk::mac::ReopenApplication"); + int code = Tcl_EvalEx(interp, "::tk::mac::ReopenApplication", -1, TCL_EVAL_GLOBAL); if (code != TCL_OK){ Tcl_BackgroundError(interp); } @@ -295,7 +295,7 @@ PrefsHandler( if (interp && Tcl_GetCommandInfo(interp, "::tk::mac::ShowPreferences", &dummy)){ - int code = Tcl_GlobalEval(interp, "::tk::mac::ShowPreferences"); + int code = Tcl_EvalEx(interp, "::tk::mac::ShowPreferences", -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundError(interp); } @@ -625,7 +625,7 @@ ReallyKillMe( Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp; Tcl_CmdInfo dummy; int quit = Tcl_GetCommandInfo(interp, "::tk::mac::Quit", &dummy); - int code = Tcl_GlobalEval(interp, quit ? "::tk::mac::Quit" : "exit"); + int code = Tcl_EvalEx(interp, quit ? "::tk::mac::Quit" : "exit", -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { /* diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 2bf1962..1d14990 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -225,11 +225,16 @@ TkpInit( if (!uname(&name)) { tkMacOSXMacOSXVersion = (strtod(name.release, NULL) + 96) * 10; } - if (tkMacOSXMacOSXVersion && + /*Check for new versioning scheme on Yosemite (10.10) and later.*/ + if (MAC_OS_X_VERSION_MIN_REQUIRED > 100000) { + tkMacOSXMacOSXVersion = MAC_OS_X_VERSION_MIN_REQUIRED/100; + } + if (tkMacOSXMacOSXVersion && MAC_OS_X_VERSION_MIN_REQUIRED < 100000 && tkMacOSXMacOSXVersion/10 < MAC_OS_X_VERSION_MIN_REQUIRED/10) { Tcl_Panic("Mac OS X 10.%d or later required !", (MAC_OS_X_VERSION_MIN_REQUIRED/10)-100); } + #ifdef TK_FRAMEWORK /* diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h index 813acce..249d5cf 100644 --- a/macosx/tkMacOSXInt.h +++ b/macosx/tkMacOSXInt.h @@ -24,6 +24,7 @@ #ifndef _TKMAC #include "tkMacOSX.h" +#import <Cocoa/Cocoa.h> #endif /* @@ -196,7 +197,7 @@ MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x, int y, int width, int height); MODULE_SCOPE void TkpRetainRegion(TkRegion r); MODULE_SCOPE void TkpReleaseRegion(TkRegion r); - +MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta); /* * Include the stubbed internal platform-specific API. */ diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 1d24960..0cfb663 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -241,7 +241,7 @@ static unsigned isFunctionKey(unsigned int code); finishedCompose = YES; /* first, clear any working text */ - if (_workingText != nil) + if (privateWorkingText != nil) [self deleteWorkingText]; /* now insert the string as keystrokes */ @@ -275,13 +275,13 @@ static unsigned isFunctionKey(unsigned int code); NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length], selRange.length, selRange.location); - if (_workingText != nil) + if (privateWorkingText != nil) [self deleteWorkingText]; if ([str length] == 0) return; processingCompose = YES; - _workingText = [str copy]; + privateWorkingText = [str copy]; //PENDING: insert workingText underlined } @@ -290,12 +290,12 @@ static unsigned isFunctionKey(unsigned int code); /* delete display of composing characters [not in <NSTextInput>] */ - (void)deleteWorkingText { - if (_workingText == nil) + if (privateWorkingText == nil) return; if (NS_KEYLOG) - NSLog(@"deleteWorkingText len = %d\n", [_workingText length]); - [_workingText release]; - _workingText = nil; + NSLog(@"deleteWorkingText len = %d\n", [privateWorkingText length]); + [privateWorkingText release]; + privateWorkingText = nil; processingCompose = NO; //PENDING: delete working text @@ -304,14 +304,14 @@ static unsigned isFunctionKey(unsigned int code); - (BOOL)hasMarkedText { - return _workingText != nil; + return privateWorkingText != nil; } - (NSRange)markedRange { - NSRange rng = _workingText != nil - ? NSMakeRange (0, [_workingText length]) : NSMakeRange (NSNotFound, 0); + NSRange rng = privateWorkingText != nil + ? NSMakeRange (0, [privateWorkingText length]) : NSMakeRange (NSNotFound, 0); if (NS_KEYLOG) NSLog (@"markedRange request"); return rng; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 2b4dbc8..e1cdc76 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -683,15 +683,18 @@ TkpConfigureMenuEntry( int i = 0; NSArray *itemArray = [submenu itemArray]; for (NSMenuItem *item in itemArray) { - TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; - [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; - i++; + TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; + /* Work around an apparent bug where itemArray can have + more items than the menu's entries[] array. */ + if (i >= menuRefPtr->menuPtr->numEntries) break; + [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; + i++; } } - } } } + [menuItem setSubmenu:submenu]; return TCL_OK; @@ -754,11 +757,19 @@ TkpPostMenu( * to be posted. */ int y) /* The global y-coordinate */ { - NSWindow *win = [NSApp keyWindow]; - if (!win) { + + + /* Get the object that holds this Tk Window.*/ + Tk_Window root; + root = Tk_MainWindow(interp); + if (root == NULL) { return TCL_ERROR; } - + + Drawable d = Tk_WindowId(root); + NSView *rootview = TkMacOSXGetRootControl(d); + NSWindow *win = [rootview window]; + inPostMenu = 1; int oldMode = Tcl_SetServiceMode(TCL_SERVICE_NONE); @@ -827,7 +838,7 @@ TkpSetWindowMenuBar( * *---------------------------------------------------------------------- */ - + void TkpSetMainMenubar( Tcl_Interp *interp, /* The interpreter of the application */ diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index eaa444a..abb2c6e 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -127,6 +127,7 @@ TkpDestroyMenuButton( TkMenuButton *mbPtr) { MacMenuButton *macButtonPtr = (MacMenuButton *) mbPtr; + [macButtonPtr->button setTag:(NSInteger)-1]; TkMacOSXMakeCollectableAndRelease(macButtonPtr->button); } diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 3ad0689..4855635 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -228,6 +228,8 @@ MODULE_SCOPE WindowClass TkMacOSXWindowClass(TkWindow *winPtr); MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr); MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window); MODULE_SCOPE EventModifiers TkMacOSXModifierState(void); +MODULE_SCOPE NSBitmapImageRep* BitmapRepFromDrawableRect(Drawable drawable, + int x, int y, unsigned int width, unsigned int height); MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG, TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXRestoreDrawingContext( @@ -316,9 +318,12 @@ VISIBILITY_HIDDEN VISIBILITY_HIDDEN @interface TKContentView : NSView <NSTextInput> { @private + /*Remove private API calls.*/ + #if 0 id _savedSubviews; BOOL _subviewsSetAside; - NSString *_workingText; + #endif + NSString *privateWorkingText; } @end @@ -358,9 +363,5 @@ VISIBILITY_HIDDEN keyEquivalentModifierMask:(NSUInteger)keyEquivalentModifierMask; @end -/* From WebKit/WebKit/mac/WebCoreSupport/WebChromeClient.mm: */ -@interface NSWindow(TKGrowBoxRect) -- (NSRect)_growBoxRect; -@end #endif /* _TKMACPRIV */ diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index 8432299..c716ab7 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -158,6 +158,29 @@ TkUnionRectWithRegion( /* *---------------------------------------------------------------------- * + * TkMacOSXIsEmptyRegion -- + * + * Return native region for given tk region. + * + * Results: + * 1 if empty, 0 otherwise. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TkMacOSXIsEmptyRegion( + TkRegion r) +{ + return HIShapeIsEmpty((HIMutableShapeRef) r) ? 1 : 0; +} + +/* + *---------------------------------------------------------------------- + * * TkRectInRegion -- * * Implements the equivelent of the X window function XRectInRegion. See @@ -181,12 +204,14 @@ TkRectInRegion( unsigned int width, unsigned int height) { - int result; - const CGRect r = CGRectMake(x, y, width, height); - - result = HIShapeIntersectsRect((HIShapeRef) region, &r) ? + if ( TkMacOSXIsEmptyRegion(region) ) { + return RectangleOut; + } + else { + const CGRect r = CGRectMake(x, y, width, height); + return HIShapeIntersectsRect((HIShapeRef) region, &r) ? RectanglePart : RectangleOut; - return result; + } } /* @@ -332,12 +357,11 @@ TkpReleaseRegion( { CFRelease(r); } -#if 0 /* *---------------------------------------------------------------------- * - * TkMacOSXEmtpyRegion -- + * TkMacOSXSetEmptyRegion -- * * Set region to emtpy. * @@ -351,7 +375,7 @@ TkpReleaseRegion( */ void -TkMacOSXEmtpyRegion( +TkMacOSXSetEmptyRegion( TkRegion r) { ChkErr(HIShapeSetEmpty, (HIMutableShapeRef) r); @@ -360,30 +384,6 @@ TkMacOSXEmtpyRegion( /* *---------------------------------------------------------------------- * - * TkMacOSXIsEmptyRegion -- - * - * Return native region for given tk region. - * - * Results: - * 1 if empty, 0 otherwise. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -TkMacOSXIsEmptyRegion( - TkRegion r) -{ - return HIShapeIsEmpty((HIMutableShapeRef) r) ? 1 : 0; -} -#endif - -/* - *---------------------------------------------------------------------- - * * TkMacOSXGetNativeRegion -- * * Return native region for given tk region. diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c index e94763d..a37029c 100644 --- a/macosx/tkMacOSXScale.c +++ b/macosx/tkMacOSXScale.c @@ -145,7 +145,7 @@ TkpDisplayScale( Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; int result; - char string[PRINT_CHARS]; + char string[TCL_DOUBLE_SPACE]; MacScale *macScalePtr = (MacScale *) clientData; Rect r; WindowRef windowRef; diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index ff91ffd..e0a583d 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -21,13 +21,74 @@ #endif */ +NSRect TkMacOSXGetScrollFrame(TkScrollbar *scrlPtr); + +/* + * A subclass of NSScroller with sanity checking: + * + * NSScrollers created by Tk will have their tag set to a pointer to the + * TkScrollbar which manages the NSScroller. This allows an NSScroller to be + * aware of the state of its Tk parent. This subclass overrides the drawRect + * method so that it will not draw itself if the widget is completely outside + * of its container. + */ + +@interface TkNSScroller: NSScroller +-(void) drawRect:(NSRect)dirtyRect; + +@end + +@implementation TkNSScroller + + - (void)drawRect:(NSRect)dirtyRect + { + NSInteger tag = [self tag]; + if ( tag != -1) { + TkScrollbar *scrollPtr = (TkScrollbar *)tag; + MacDrawable* macWin = (MacDrawable *)scrollPtr; + Tk_Window tkwin = scrollPtr->tkwin; + NSRect Tkframe = TkMacOSXGetScrollFrame(scrollPtr); + /* Do not draw if the widget is misplaced or unmapped. */ + if ( NSIsEmptyRect(Tkframe) || + ! macWin->winPtr->flags & TK_MAPPED || + ! NSEqualRects(Tkframe, [self frame]) + ) { + return; + } + + /* + * Do not draw if the widget is completely outside of its parent. + */ + if (tkwin) { + int parent_height = Tk_Height(Tk_Parent(tkwin)); + int widget_height = Tk_Height(tkwin); + int y = Tk_Y(tkwin); + if ( y > parent_height || y + widget_height < 0 ) { + return; + } + + int parent_width = Tk_Width(Tk_Parent(tkwin)); + int widget_width = Tk_Width(tkwin); + int x = Tk_X(tkwin); + if (x > parent_width || x + widget_width < 0) { + return; + } + } + } + [super drawRect:dirtyRect]; + } + +@end + + + /* * Declaration of Mac specific scrollbar structure. */ typedef struct MacScrollbar { TkScrollbar info; - NSScroller *scroller; + TkNSScroller *scroller; int variant; } MacScrollbar; @@ -50,6 +111,7 @@ static void UpdateScrollbarMetrics(void); static void ScrollbarEventProc(ClientData clientData, XEvent *eventPtr); + /* * The class procedure table for the scrollbar widget. */ @@ -66,7 +128,7 @@ Tk_ClassProcs tkpScrollbarProcs = { #define NSAppleAquaScrollBarVariantChanged @"AppleAquaScrollBarVariantChanged" @implementation TKApplication(TKScrlbr) -- (void) tkScroller: (NSScroller *) scroller +- (void) tkScroller: (TkNSScroller *) scroller { NSScrollerPart hitPart = [scroller hitPart]; TkScrollbar *scrollPtr = (TkScrollbar *)[scroller tag]; @@ -254,6 +316,8 @@ TkpDestroyScrollbar( TkScrollbar *scrollPtr) { MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr; + TkNSScroller *scroller = macScrollPtr->scroller; + [scroller setTag:(NSInteger)-1]; TkMacOSXMakeCollectableAndRelease(macScrollPtr->scroller); } @@ -282,7 +346,7 @@ TkpDisplayScrollbar( { TkScrollbar *scrollPtr = (TkScrollbar *) clientData; MacScrollbar *macScrollPtr = (MacScrollbar *) clientData; - NSScroller *scroller = macScrollPtr->scroller; + TkNSScroller *scroller = macScrollPtr->scroller; Tk_Window tkwin = scrollPtr->tkwin; TkWindow *winPtr = (TkWindow *) tkwin; MacDrawable *macWin = (MacDrawable *) winPtr->window; @@ -329,38 +393,22 @@ TkpDisplayScrollbar( frame = NSInsetRect(frame, scrollPtr->inset, scrollPtr->inset); frame.origin.y = viewHeight - (frame.origin.y + frame.size.height); - NSWindow *w = [view window]; - - if ([w showsResizeIndicator]) { - NSRect growBox = [view convertRect:[w _growBoxRect] fromView:nil]; - - if (NSIntersectsRect(growBox, frame)) { - if (scrollPtr->vertical) { - CGFloat y = frame.origin.y; - - frame.origin.y = growBox.origin.y + growBox.size.height; - frame.size.height -= frame.origin.y - y; - } else { - frame.size.width = growBox.origin.x - frame.origin.x; - } - TkMacOSXSetScrollbarGrow(winPtr, true); - } - } if (!NSEqualRects(frame, [scroller frame])) { [scroller setFrame:frame]; } [scroller setEnabled:(knobProportion < 1.0 && (scrollPtr->vertical ? frame.size.height : frame.size.width) > metrics[macScrollPtr->variant].minHeight)]; + // [scroller setEnabled: YES]; [scroller setDoubleValue:scrollPtr->firstFraction / (1.0 - knobProportion)]; [scroller setKnobProportion:knobProportion]; [scroller displayRectIgnoringOpacity:[scroller bounds]]; TkMacOSXRestoreDrawingContext(&dc); -#ifdef TK_MAC_DEBUG_SCROLLBAR + #ifdef TK_MAC_DEBUG_SCROLLBAR TKLog(@"scroller %s frame %@ width %d height %d", ((TkWindow *)scrollPtr->tkwin)->pathName, NSStringFromRect(frame), Tk_Width(tkwin), Tk_Height(tkwin)); -#endif + #endif } /* @@ -388,7 +436,7 @@ TkpComputeScrollbarGeometry( * changed. */ { MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr; - NSScroller *scroller = macScrollPtr->scroller; + TkNSScroller *scroller = macScrollPtr->scroller; int width, height, variant, fieldLength; if (scrollPtr->highlightWidth < 0) { @@ -416,7 +464,7 @@ TkpComputeScrollbarGeometry( } if (!scroller) { if ((width > height) ^ !scrollPtr->vertical) { - /* -[NSScroller initWithFrame:] determines horizonalness for the + /* -[NSScroller initWithFrame:] determines horizontalness for the * lifetime of the scroller via isHoriz = (width > height) */ if (scrollPtr->vertical) { width = height; @@ -427,7 +475,7 @@ TkpComputeScrollbarGeometry( width = 2; } } - scroller = [[NSScroller alloc] initWithFrame: + scroller = [[TkNSScroller alloc] initWithFrame: NSMakeRect(0, 0, width, height)]; macScrollPtr->scroller = TkMacOSXMakeUncollectable(scroller); [scroller setAction:@selector(tkScroller:)]; @@ -548,7 +596,7 @@ TkpScrollbarPosition( /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { - NSScroller *scroller = ((MacScrollbar *) scrollPtr)->scroller; + TkNSScroller *scroller = ((MacScrollbar *) scrollPtr)->scroller; MacDrawable *macWin = (MacDrawable *) ((TkWindow *) scrollPtr->tkwin)->window; NSView *view = TkMacOSXDrawableView(macWin); @@ -609,6 +657,45 @@ ScrollbarEventProc( TkScrollbarEventProc(clientData, eventPtr); } } + + +/* + *---------------------------------------------------------------------- + * + * TkMacOSXGetScrollFrame -- + * + * Computes a frame for an NSScroller that will correspond to where + * Tk thinks the scroller is located. + * + * Results: + * Returns an NSRect describing a frame for an NSScrollbar. + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ +NSRect TkMacOSXGetScrollFrame( + TkScrollbar *scrlPtr) +{ + MacScrollbar *macscrlPtr = (MacScrollbar *) scrlPtr; + Tk_Window tkwin = scrlPtr->tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; + if (tkwin) { + MacDrawable *macWin = (MacDrawable *) winPtr->window; + NSView *view = TkMacOSXDrawableView(macWin); + CGFloat viewHeight = [view bounds].size.height; + NSRect frame = NSMakeRect(macWin->xOff, macWin->yOff, + Tk_Width(tkwin), Tk_Height(tkwin)); + + frame.origin.y = viewHeight - (frame.origin.y + frame.size.height); + return frame; + } else { + return NSZeroRect; + } +} + + /* * Local Variables: diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index c235cbf..d557db3 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -651,7 +651,7 @@ XConfigureWindow( * * TkMacOSXUpdateClipRgn -- * - * This function updates the cliping regions for a given window and all of + * This function updates the clipping regions for a given window and all of * its children. Once updated the TK_CLIP_INVALID flag in the subwindow * data structure is unset. The TK_CLIP_INVALID flag should always be * unset before any drawing is attempted. @@ -741,14 +741,6 @@ TkMacOSXUpdateClipRgn( } else if (winPtr->wmInfoPtr->attributes & kWindowResizableAttribute) { NSWindow *w = TkMacOSXDrawableWindow(winPtr->window); - - if (w) { - bounds = NSRectToCGRect([w _growBoxRect]); - bounds.origin.y = [w contentRectForFrameRect: - [w frame]].size.height - bounds.size.height - - bounds.origin.y; - ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); - } } macWin->aboveVisRgn = HIShapeCreateCopy(rgn); @@ -825,7 +817,7 @@ TkMacOSXUpdateClipRgn( * * TkMacOSXVisableClipRgn -- * - * This function returns the Macintosh cliping region for the given + * This function returns the Macintosh clipping region for the given * window. The caller is responsible for disposing of the returned * region via TkDestroyRegion(). * @@ -920,7 +912,7 @@ TkMacOSXInvalidateWindow( * TK_PARENT_WINDOW */ { #ifdef TK_MAC_DEBUG_CLIP_REGIONS - TkMacOSXDbgMsg("%s", winPtr->pathName); + TkMacOSXDbgMsg("%s", macWin->winPtr->pathName); #endif if (macWin->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(macWin->winPtr); @@ -1078,7 +1070,7 @@ TkMacOSXGetRootControl( * None. * * Side effects: - * The cliping regions for the window and its children are mark invalid. + * The clipping regions for the window and its children are marked invalid. * (Make sure they are valid before drawing.) * *---------------------------------------------------------------------- @@ -1097,6 +1089,10 @@ TkMacOSXInvalClipRgns( * be marked. */ +#ifdef TK_MAC_DEBUG_CLIP_REGIONS + TkMacOSXDbgMsg("%s", winPtr->pathName); +#endif + if (!macWin || macWin->flags & TK_CLIP_INVALID) { return; } @@ -1277,7 +1273,7 @@ UpdateOffsets( * Returns a handle to a new pixmap. * * Side effects: - * Allocates a new Macintosh GWorld. + * Allocates a new CGBitmapContext. * *---------------------------------------------------------------------- */ @@ -1323,7 +1319,7 @@ Tk_GetPixmap( * None. * * Side effects: - * Deletes the Macintosh GWorld created by Tk_GetPixmap. + * Deletes the CGBitmapContext created by Tk_GetPixmap. * *---------------------------------------------------------------------- */ diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 6ced470..c4780c8 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -357,11 +357,12 @@ GenerateUpdates( event.xexpose.width = damageBounds.size.width; event.xexpose.height = damageBounds.size.height; event.xexpose.count = 0; - Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); -#ifdef TK_MAC_DEBUG_DRAWING - TKLog(@"Expose %p {{%d, %d}, {%d, %d}}", event.xany.window, event.xexpose.x, + Tk_HandleEvent(&event); + + #ifdef TK_MAC_DEBUG_DRAWING + NSLog(@"Expose %p {{%d, %d}, {%d, %d}}", event.xany.window, event.xexpose.x, event.xexpose.y, event.xexpose.width, event.xexpose.height); -#endif + #endif /* * Generate updates for the children of this window @@ -388,7 +389,7 @@ GenerateUpdates( /* * TODO: Here we should handle out of process embedding. */ - } + } return 1; } @@ -701,7 +702,7 @@ TkWmProtocolEventProc( Tcl_Preserve(protPtr); interp = protPtr->interp; Tcl_Preserve(interp); - result = Tcl_GlobalEval(interp, protPtr->command); + result = Tcl_EvalEx(interp, protPtr->command, -1, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command for \""); Tcl_AddErrorInfo(interp, @@ -764,15 +765,14 @@ Tk_MacOSXIsAppInFront(void) * Custom content view for Tk NSWindows, containing standard NSView subviews. * The goal is to emulate X11-style drawing in response to Expose events: * during the normal AppKit drawing cycle, we supress drawing of all subviews - * (using a technique adapted from WebKit's WebHTMLView) and instead send - * Expose events about the subviews that would be redrawn. Tk Expose event - * handling and drawing handlers then draw the subviews manually via their - * -displayRectIgnoringOpacity: + * and instead send Expose events about the subviews that would be redrawn. */ @interface TKContentView(TKWindowEvent) - (void) drawRect: (NSRect) rect; - (void) generateExposeEvents: (HIMutableShapeRef) shape; +- (void) viewDidEndLiveResize; +- (void) viewWillDraw; - (BOOL) isOpaque; - (BOOL) wantsDefaultClipping; - (BOOL) acceptsFirstResponder; @@ -782,6 +782,17 @@ Tk_MacOSXIsAppInFront(void) @implementation TKContentView @end +double drawTime; + +/* + * Set a minimum time for drawing to render. With removal of private NSView API's, default drawing + * is slower and less responsive. This number, which seems feasible after some experimentatation, skips + * some drawing to avoid lag. + */ + +#define MAX_DYNAMIC_TIME .000000001 + +/*Restrict event processing to Expose events.*/ static Tk_RestrictAction ExposeRestrictProc( ClientData arg, @@ -791,6 +802,7 @@ ExposeRestrictProc( ? TK_PROCESS_EVENT : TK_DEFER_EVENT); } + @implementation TKContentView(TKWindowEvent) - (void) drawRect: (NSRect) rect @@ -806,15 +818,10 @@ ExposeRestrictProc( NSCompositeSourceOver); #endif - NSWindow *w = [self window]; - - if ([self isOpaque] && [w showsResizeIndicator]) { - NSRect bounds = [self convertRect:[w _growBoxRect] fromView:nil]; + NSDate *beginTime=[NSDate date]; - if ([self needsToDrawRect:bounds]) { - NSEraseRect(bounds); - } - } + /*Skip drawing during live resize if redraw is too slow.*/ + if([self inLiveResize] && drawTime>MAX_DYNAMIC_TIME) return; CGFloat height = [self bounds].size.height; HIMutableShapeRef drawShape = HIShapeCreateMutable(); @@ -835,44 +842,64 @@ ExposeRestrictProc( nil]]; } CFRelease(drawShape); + drawTime=-[beginTime timeIntervalSinceNow]; } +/*At conclusion of resize event, send notification and set view for redraw if earlier drawing was skipped because of lagginess.*/ +- (void)viewDidEndLiveResize +{ + if(drawTime>MAX_DYNAMIC_TIME) { + [self setNeedsDisplay:YES]; + [super viewDidEndLiveResize]; + } +} + +-(void) viewWillDraw { + [self setNeedsDisplay:YES]; + } + - (void) generateExposeEvents: (HIMutableShapeRef) shape { + TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); unsigned long serial; CGRect updateBounds; if (!winPtr) { - return; + return; } + HIShapeGetBounds(shape, &updateBounds); serial = LastKnownRequestProcessed(Tk_Display(winPtr)); if (GenerateUpdates(shape, &updateBounds, winPtr) && - ![[NSRunLoop currentRunLoop] currentMode] && - Tcl_GetServiceMode() != TCL_SERVICE_NONE) { - /* - * Ensure there are no pending idle-time redraws that could prevent the - * just posted Expose events from generating new redraws. - */ + ![[NSRunLoop currentRunLoop] currentMode] && + Tcl_GetServiceMode() != TCL_SERVICE_NONE) { + /* + * Ensure there are no pending idle-time redraws that could prevent the + * just posted Expose events from generating new redraws. + */ - while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} + while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} - /* - * For smoother drawing, process Expose events and resulting redraws - * immediately instead of at idle time. - */ + /* + * For smoother drawing, process Expose events and resulting redraws + * immediately instead of at idle time. + */ - ClientData oldArg; - Tk_RestrictProc *oldProc = Tk_RestrictEvents(ExposeRestrictProc, - UINT2PTR(serial), &oldArg); + ClientData oldArg; + Tk_RestrictProc *oldProc = Tk_RestrictEvents(ExposeRestrictProc, + UINT2PTR(serial), &oldArg); - while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {} - Tk_RestrictEvents(oldProc, oldArg, &oldArg); - while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} - } + while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {} + + Tk_RestrictEvents(oldProc, oldArg, &oldArg); + while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} + + } + } +/*This is no-op on 10.7 and up because Apple has removed this widget, but leaving here for backwards compatibility.*/ - (void) tkToolbarButton: (id) sender { #ifdef TK_MAC_DEBUG_EVENTS @@ -900,21 +927,15 @@ ExposeRestrictProc( Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); } -#ifdef TK_MAC_DEBUG_DRAWING - (void) setFrameSize: (NSSize) newSize { - TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, - NSStringFromSize(newSize)); [super setFrameSize:newSize]; } - (void) setNeedsDisplayInRect: (NSRect) invalidRect { - TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, - NSStringFromRect(invalidRect)); [super setNeedsDisplayInRect:invalidRect]; } -#endif - (BOOL) isOpaque { @@ -947,153 +968,7 @@ ExposeRestrictProc( } @end - -#pragma mark TKContentViewPrivate -/* - * Technique adapted from WebKit/WebKit/mac/WebView/WebHTMLView.mm to supress - * normal AppKit subview drawing and make all drawing go through us. - * Overrides NSView internals. - */ - -@interface TKContentView(TKContentViewPrivate) -- (id) initWithFrame: (NSRect) frame; -- (void) _setAsideSubviews; -- (void) _restoreSubviews; -@end - -@interface NSView(TKContentViewPrivate) -- (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect - isVisibleRect: (BOOL) isVisibleRect - rectIsVisibleRectForView: (NSView *) visibleView - topView: (BOOL) topView; -- (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus - visRect: (NSRect) visRect; -- (void) _recursive: (BOOL) recurse - displayRectIgnoringOpacity: (NSRect) displayRect - inContext: (NSGraphicsContext *) context topView: (BOOL) topView; -- (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect; -- (BOOL) _drawRectIfEmpty; -- (void) _drawRect: (NSRect) inRect clip: (BOOL) clip; -- (void) _setDrawsOwnDescendants: (BOOL) drawsOwnDescendants; -@end - -@implementation TKContentView(TKContentViewPrivate) - -- (id) initWithFrame: (NSRect) frame -{ - self = [super initWithFrame:frame]; - if (self) { - _savedSubviews = nil; - _subviewsSetAside = NO; - [self _setDrawsOwnDescendants:YES]; - } - return self; -} - -- (void) _setAsideSubviews -{ -#ifdef TK_MAC_DEBUG - if (_subviewsSetAside || _savedSubviews) { - Tcl_Panic("TKContentView _setAsideSubviews called incorrectly"); - } -#endif - _savedSubviews = _subviews; - _subviews = nil; - _subviewsSetAside = YES; -} - -- (void) _restoreSubviews -{ -#ifdef TK_MAC_DEBUG - if (!_subviewsSetAside || _subviews) { - Tcl_Panic("TKContentView _restoreSubviews called incorrectly"); - } -#endif - _subviews = _savedSubviews; - _savedSubviews = nil; - _subviewsSetAside = NO; -} - -- (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect - isVisibleRect: (BOOL) isVisibleRect - rectIsVisibleRectForView: (NSView *) visibleView - topView: (BOOL) topView -{ - [self _setAsideSubviews]; - [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect - isVisibleRect:isVisibleRect rectIsVisibleRectForView:visibleView - topView:topView]; - [self _restoreSubviews]; -} - -- (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus - visRect: (NSRect) visRect -{ - BOOL needToSetAsideSubviews = !_subviewsSetAside; - - if (needToSetAsideSubviews) { - [self _setAsideSubviews]; - } - [super _recursiveDisplayAllDirtyWithLockFocus:needsLockFocus - visRect:visRect]; - if (needToSetAsideSubviews) { - [self _restoreSubviews]; - } -} - -- (void) _recursive: (BOOL) recurse - displayRectIgnoringOpacity: (NSRect) displayRect - inContext: (NSGraphicsContext *) context topView: (BOOL) topView -{ - [self _setAsideSubviews]; - [super _recursive:recurse - displayRectIgnoringOpacity:displayRect inContext:context - topView:topView]; - [self _restoreSubviews]; -} - -- (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect -{ - BOOL needToSetAsideSubviews = !_subviewsSetAside; - - if (needToSetAsideSubviews) { - [self _setAsideSubviews]; - } - [super _lightWeightRecursiveDisplayInRect:visRect]; - if (needToSetAsideSubviews) { - [self _restoreSubviews]; - } -} - -- (BOOL) _drawRectIfEmpty -{ - /* - * Our -drawRect manages subview drawing directly, so it needs to be called - * even if the area to be redrawn is completely obscured by subviews. - */ - - return YES; -} - -- (void) _drawRect: (NSRect) inRect clip: (BOOL) clip -{ -#ifdef TK_MAC_DEBUG_DRAWING - TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, - NSStringFromRect(inRect)); -#endif - BOOL subviewsWereSetAside = _subviewsSetAside; - - if (subviewsWereSetAside) { - [self _restoreSubviews]; - } - [super _drawRect:inRect clip:clip]; - if (subviewsWereSetAside) { - [self _setAsideSubviews]; - } -} - -@end /* * Local Variables: diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 45f0fd5..b834766 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -20,6 +20,7 @@ #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" +#include <Carbon/Carbon.h> /* #ifdef TK_MAC_DEBUG @@ -321,6 +322,10 @@ static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 +#define TK_GOT_AT_LEAST_SNOW_LEOPARD 1 +#endif + #pragma mark TKWindow(TKWm) #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 @@ -347,6 +352,7 @@ static void RemapWindows(TkWindow *winPtr, kHelpWindowClass || winPtr->wmInfoPtr->attributes & kWindowNoActivatesAttribute)) ? NO : YES; } + @end #pragma mark - @@ -665,7 +671,7 @@ TkWmMapWindow( wmPtr->flags |= WM_ABOUT_TO_MAP; if (wmPtr->flags & WM_UPDATE_PENDING) { - Tk_CancelIdleCall(UpdateGeometryInfo, winPtr); + Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr); } UpdateGeometryInfo(winPtr); wmPtr->flags &= ~WM_ABOUT_TO_MAP; @@ -769,7 +775,7 @@ TkWmDeadWindow( ckfree(wmPtr->clientMachine); } if (wmPtr->flags & WM_UPDATE_PENDING) { - Tk_CancelIdleCall(UpdateGeometryInfo, winPtr); + Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr); } /* @@ -4396,7 +4402,7 @@ Tk_MoveToplevelWindow( if (!(wmPtr->flags & WM_NEVER_MAPPED)) { if (wmPtr->flags & WM_UPDATE_PENDING) { - Tk_CancelIdleCall(UpdateGeometryInfo, winPtr); + Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr); } UpdateGeometryInfo(winPtr); } @@ -4539,7 +4545,7 @@ TkWmAddToColormapWindows( * add the toplevel itself as the last element of the list. */ - newPtr = ckalloc((count+2) * sizeof(TkWindow *)); + newPtr = (TkWindow**)ckalloc((count+2) * sizeof(TkWindow *)); if (count > 0) { memcpy(newPtr, oldPtr, count * sizeof(TkWindow *)); } @@ -5183,6 +5189,7 @@ WmWinStyle( { "brown", NULL }, { "clear", NULL }, { "opacity", NULL }, + { "fullscreen", NULL }, { NULL } }; @@ -5438,10 +5445,14 @@ TkMacOSXMakeRealWindowExist( /* Set background color and opacity of window if those flags are set. */ if (colorName != NULL) { [window setBackgroundColor: colorName]; - } + } if (opaqueTag != NULL) { +#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD [window setOpaque: opaqueTag]; +#else + [window setOpaque: YES]; +#endif } [window setDocumentEdited:NO]; @@ -5942,7 +5953,7 @@ TkWmStackorderToplevel( Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); - windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *)); + windows = (TkWindow**)ckalloc((table.numEntries+1) * sizeof(TkWindow *)); /* * Special cases: If zero or one toplevels were mapped there is no need to @@ -5967,7 +5978,7 @@ TkWmStackorderToplevel( } else { window_ptr = windows + table.numEntries; *window_ptr-- = NULL; - windowNumbers = ckalloc(windowCount * sizeof(NSInteger)); + windowNumbers = (NSInteger*)ckalloc(windowCount * sizeof(NSInteger)); NSWindowList(windowCount, windowNumbers); for (NSInteger index = 0; index < windowCount; index++) { NSWindow *w = [NSApp windowWithWindowNumber:windowNumbers[index]]; @@ -6286,7 +6297,9 @@ TkMacOSXMakeFullscreen( WmInfo *wmPtr = winPtr->wmInfoPtr; int result = TCL_OK, wasFullscreen = (wmPtr->flags & WM_FULLSCREEN); +#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD static unsigned long prevMask = 0, prevPres = 0; +#endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ if (fullscreen) { int screenWidth = WidthOfScreen(Tk_Screen(winPtr)); @@ -6310,7 +6323,7 @@ TkMacOSXMakeFullscreen( NSRect bounds = [window contentRectForFrameRect:[window frame]]; NSRect screenBounds = NSMakeRect(0, 0, screenWidth, screenHeight); - if (!NSEqualRects(bounds, screenBounds) && !wasFullscreen) { + if (!NSEqualRects(bounds, screenBounds) && !wasFullscreen) { wmPtr->configX = wmPtr->x; wmPtr->configY = wmPtr->y; wmPtr->configAttributes = wmPtr->attributes; @@ -6319,21 +6332,34 @@ TkMacOSXMakeFullscreen( wmPtr->configAttributes, wmPtr->flags, 1, 0); wmPtr->flags |= WM_SYNC_PENDING; [window setFrame:[window frameRectForContentRect: - screenBounds] display:YES]; + screenBounds] display:YES]; + wmPtr->flags &= ~WM_SYNC_PENDING; } wmPtr->flags |= WM_FULLSCREEN; } +#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD + /* + * We can't set these features on Leopard or earlier, as they don't + * exist (neither options nor API that uses them). This formally means + * that there's a bug with full-screen windows with Tk on old OSX, but + * it isn't worth blocking a build just for this. + */ + prevMask = [window styleMask]; prevPres = [NSApp presentationOptions]; [window setStyleMask: NSBorderlessWindowMask]; [NSApp setPresentationOptions: NSApplicationPresentationAutoHideDock - | NSApplicationPresentationAutoHideMenuBar]; + | NSApplicationPresentationAutoHideMenuBar]; + +#endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ } else { wmPtr->flags &= ~WM_FULLSCREEN; +#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD [NSApp setPresentationOptions: prevPres]; [window setStyleMask: prevMask]; +#endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ } if (wasFullscreen && !(wmPtr->flags & WM_FULLSCREEN)) { diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 9594cd3..c227cd6 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -9,6 +9,7 @@ * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright 2014 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -809,7 +810,6 @@ XCreateImage( int bytes_per_line) { XImage *ximage; - display->request++; ximage = (XImage *) ckalloc(sizeof(XImage)); @@ -819,6 +819,7 @@ XCreateImage( ximage->xoffset = offset; ximage->format = format; ximage->data = data; + ximage->obdata = NULL; if (format == ZPixmap) { ximage->bits_per_pixel = 32; @@ -850,7 +851,6 @@ XCreateImage( ximage->red_mask = 0x00FF0000; ximage->green_mask = 0x0000FF00; ximage->blue_mask = 0x000000FF; - ximage->obdata = NULL; ximage->f.create_image = NULL; ximage->f.destroy_image = DestroyImage; ximage->f.get_pixel = ImageGetPixel; @@ -869,8 +869,9 @@ XCreateImage( * This function copies data from a pixmap or window into an XImage. * * Results: - * Returns a newly allocated image containing the data from the given - * rectangle of the given drawable. + * Returns a newly allocated XImage containing the data from the given + * rectangle of the given drawable, or NULL if the XImage could not be + * constructed. * * Side effects: * None. @@ -889,60 +890,70 @@ XGetImage( unsigned long plane_mask, int format) { - MacDrawable *macDraw = (MacDrawable *) d; - XImage * imagePtr = NULL; - Pixmap pixmap = (Pixmap) NULL; - Tk_Window win = (Tk_Window) macDraw->winPtr; - GC gc; - char * data = NULL; - int depth = 32; - int offset = 0; - int bitmap_pad = 0; - int bytes_per_line = 0; - + NSBitmapImageRep *bitmap_rep; + XImage * imagePtr = NULL; + char * bitmap = NULL; + char * image_data=NULL; + int depth = 32; + int offset = 0; + int bitmap_pad = 0; + int bytes_per_row = 4*width; + int size; + TkMacOSXDbgMsg("XGetImage"); if (format == ZPixmap) { - if (width > 0 && height > 0) { - /* - * Tk_GetPixmap fails for zero width or height. - */ - - pixmap = Tk_GetPixmap(display, d, width, height, depth); + if (width == 0 || height == 0) { + /* This happens all the time. + TkMacOSXDbgMsg("XGetImage: empty image requested"); + */ + return NULL; } - if (win) { - XGCValues values; - gc = Tk_GetGC(win, 0, &values); - } else { - gc = XCreateGC(display, pixmap, 0, NULL); + bitmap_rep = BitmapRepFromDrawableRect(d, x, y,width, height); + + if ( bitmap_rep == Nil || + [bitmap_rep bitmapFormat] != 0 || + [bitmap_rep samplesPerPixel] != 4 || + [bitmap_rep isPlanar] != 0 ) { + TkMacOSXDbgMsg("XGetImage: Failed to construct NSBitmapRep"); + return NULL; } - if (pixmap) { - CGContextRef context; - - XCopyArea(display, d, pixmap, gc, x, y, width, height, 0, 0); - context = ((MacDrawable *) pixmap)->context; - if (context) { - data = CGBitmapContextGetData(context); - bytes_per_line = CGBitmapContextGetBytesPerRow(context); + + NSSize image_size = NSMakeSize(width, height); + NSImage* ns_image = [[NSImage alloc]initWithSize:image_size]; + [ns_image addRepresentation:bitmap_rep]; + + /* Assume premultiplied nonplanar data with 4 bytes per pixel and alpha last.*/ + if ( [bitmap_rep bitmapFormat] == 0 && + [bitmap_rep isPlanar ] == 0 && + [bitmap_rep samplesPerPixel] == 4 ) { + bytes_per_row = [bitmap_rep bytesPerRow]; + size = bytes_per_row*height; + image_data = (char*)[bitmap_rep bitmapData]; + if ( image_data ) { + int row, n, m; + bitmap = ckalloc(size); + /* + Oddly enough, the bitmap has the top row at the beginning, + and the pixels are in BGRA format. + */ + for (row=0, n=0; row<height; row++, n+=bytes_per_row) { + for (m=n; m<n+bytes_per_row; m+=4) { + *(bitmap+m) = *(image_data+m+2); + *(bitmap+m+1) = *(image_data+m+1); + *(bitmap+m+2) = *(image_data+m); + *(bitmap+m+3) = *(image_data+m+3); + } + } } } - if (data) { + if (bitmap) { imagePtr = XCreateImage(display, NULL, depth, format, offset, - data, width, height, bitmap_pad, bytes_per_line); - - /* - * Track Pixmap underlying the XImage in the unused obdata field - * so that we can treat XImages coming from XGetImage specially. - */ - - imagePtr->obdata = (XPointer) pixmap; - } else if (pixmap) { - Tk_FreePixmap(display, pixmap); - } - if (!win) { - XFreeGC(display, gc); + (char*)bitmap, width, height, bitmap_pad, bytes_per_row); + [ns_image removeRepresentation:bitmap_rep]; /*releases the rep*/ + [ns_image release]; } } else { - TkMacOSXDbgMsg("Invalid image format"); + TkMacOSXDbgMsg("Could not extract image from drawable."); } return imagePtr; } @@ -968,9 +979,7 @@ DestroyImage( XImage *image) { if (image) { - if (image->obdata) { - Tk_FreePixmap((Display*) gMacDisplay, (Pixmap) image->obdata); - } else if (image->data) { + if (image->data) { ckfree(image->data); } ckfree((char*) image); diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 5752fb1..64b96cb 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -294,14 +294,21 @@ static Ttk_StateTable TabPositionTable[] = { * TP30000359-TPXREF116> */ -static const int TAB_HEIGHT = 10; -static const int TAB_OVERLAP = 10; +int TAB_HEIGHT = 0; +int TAB_OVERLAP = 0; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - *heightPtr = TAB_HEIGHT + TAB_OVERLAP - 1; + TAB_HEIGHT = 10; + TAB_OVERLAP = 10; + /*Different metrics on 10.10/Yosemite.*/ + if (MAC_OS_X_VERSION_MIN_REQUIRED > 100000) { + TAB_OVERLAP = 5; + } + *heightPtr = TAB_HEIGHT + TAB_OVERLAP - 1; + } static void TabElementDraw( diff --git a/tests/canvText.test b/tests/canvText.test index 070011b..20a39b0 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -501,7 +501,7 @@ end %%EOF " -test canvText-18.1 {bug fix 2525, find enclosed on text with newlines} { +test canvText-18.1 {bug fix 2525, find enclosed on text with newlines} -body { catch {destroy .c} canvas .c pack .c @@ -513,7 +513,9 @@ test canvText-18.1 {bug fix 2525, find enclosed on text with newlines} { incr y2 update .c find enclosed 99 99 [expr $x2 + $i] [expr $y2 + 1] -} 1 +} -cleanup { + unset -nocomplain bbox x2 y2 +} -result 1 test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} { catch {destroy .c} diff --git a/tests/font.test b/tests/font.test index 34e4b83..a02cc2e 100644 --- a/tests/font.test +++ b/tests/font.test @@ -15,9 +15,28 @@ toplevel .b wm geom .b +0+0 update idletasks +set defaultfontlist [font names] + +proc getnondefaultfonts {} { + global defaultfontlist + set nondeffonts [list ] + foreach afont [font names] { + if {$afont ni $defaultfontlist} { + lappend nondeffonts $afont + } + } + set nondeffonts +} + +proc clearnondefaultfonts {} { + foreach afont [getnondefaultfonts] { + font delete $afont + } +} + proc setup {} { catch {destroy .b.f} - catch {eval font delete [font names]} + clearnondefaultfonts label .b.f pack .b.f update @@ -46,10 +65,9 @@ proc csetup {{str ""}} { setup -case [tk windowingsystem] { +switch [tk windowingsystem] { x11 {set fixed "fixed"} win32 {set fixed "courier 12"} - classic - aqua {set fixed "monaco 9"} } @@ -194,20 +212,20 @@ test font-6.1 {font command: create: make up name} { # (objc < 3) so name = NULL setup font create - font names -} {font1} + expr {"font1" in [font names]} +} {1} test font-6.2 {font command: create: name specified} { # not (objc < 3) setup font create xyz - font names -} {xyz} + expr {"xyz" in [font names]} +} {1} test font-6.3 {font command: create: name not really specified} { # (name[0] == '-') so name = NULL setup font create -family xyz - font names -} {font1} + expr {"font1" in [font names]} +} {1} test font-6.4 {font command: create: generate name} { # (name == NULL) setup @@ -248,9 +266,9 @@ test font-7.2 {font command: delete: loop test} { font create c -underline 1 font create d -underline 1 font create e -underline 1 - lappend x [lsort [font names]] + lappend x [lsort [getnondefaultfonts]] font delete a e c b - lappend x [lsort [font names]] + lappend x [lsort [getnondefaultfonts]] } {{a b c d e} d} test font-7.3 {font command: delete: loop test} { # (namedHashPtr == NULL) in middle of loop @@ -261,9 +279,9 @@ test font-7.3 {font command: delete: loop test} { font create c -underline 1 font create d -underline 1 font create e -underline 1 - lappend x [lsort [font names]] + lappend x [lsort [getnondefaultfonts]] catch {font delete a d q c e b} - lappend x [lsort [font names]] + lappend x [lsort [getnondefaultfonts]] } {{a b c d e} {b c e}} test font-7.4 {font command: delete: non-existent} { # (namedHashPtr == NULL) @@ -383,19 +401,19 @@ test font-11.1 {font command: names: arguments} { } {1 {wrong # args: should be "font names"}} test font-11.2 {font command: names: loop test: no passes} { setup - font names + getnondefaultfonts } {} test font-11.3 {font command: names: loop test: one pass} { setup font create - font names + getnondefaultfonts } {font1} test font-11.4 {font command: names: loop test: multiple passes} { setup font create xyz font create abc font create def - lsort [font names] + lsort [getnondefaultfonts] } {abc def xyz} test font-11.5 {font command: names: skip deletePending fonts} { # (nfPtr->deletePending == 0) @@ -403,10 +421,10 @@ test font-11.5 {font command: names: skip deletePending fonts} { set x {} font create xyz font create abc - lappend x [lsort [font names]] + lappend x [lsort [getnondefaultfonts]] .b.f config -font xyz font delete xyz - lappend x [font names] + lappend x [getnondefaultfonts] } {{abc xyz} abc} test font-12.1 {UpdateDependantFonts procedure: no users} { @@ -433,9 +451,9 @@ test font-13.1 {CreateNamedFont: new named font} { # not (new == 0) setup set x {} - lappend x [font names] + lappend x [getnondefaultfonts] font create xyz - lappend x [font names] + lappend x [getnondefaultfonts] } {{} xyz} test font-13.2 {CreateNamedFont: named font already exists} { # (new == 0) @@ -587,8 +605,8 @@ test font-17.4 {Tk_FreeFont procedure: named font} { font create xyz .b.f config -font xyz destroy .b.f - font names -} {xyz} + expr {"xyz" in [font names]} +} {1} test font-17.5 {Tk_FreeFont procedure: named font} { # not (fontPtr->refCount == 0) setup @@ -1381,6 +1399,17 @@ setup destroy .b +test font-47.1 {Bug f214b8ad5b} -body { + interp create one + interp create two + load {} Tk one + load {} Tk two + one eval menu .menubar + two eval menu .menubar + interp delete one + interp delete two +} -result {} + # cleanup cleanupTests return diff --git a/tests/imgPPM.test b/tests/imgPPM.test index a9e9dc0..8dec8c2 100644 --- a/tests/imgPPM.test +++ b/tests/imgPPM.test @@ -20,7 +20,7 @@ proc put {file data} { puts -nonewline $f $data close $f } - + test imgPPM-1.1 {FileReadPPM procedure} { put test.ppm "P6\n0 256\n255\nabcdef" list [catch {image create photo p1 -file test.ppm} msg] $msg @@ -38,9 +38,9 @@ test imgPPM-1.4 {FileReadPPM procedure} { list [catch {image create photo p1 -file test.ppm} msg] $msg } {1 {PPM image file "test.ppm" has dimension(s) <= 0}} test imgPPM-1.5 {FileReadPPM procedure} { - put test.ppm "P6\n10 20\n256\nabcdef" + put test.ppm "P6\n10 20\n100000\nabcdef" list [catch {image create photo p1 -file test.ppm} msg] $msg -} {1 {PPM image file "test.ppm" has bad maximum intensity value 256}} +} {1 {PPM image file "test.ppm" has bad maximum intensity value 100000}} test imgPPM-1.6 {FileReadPPM procedure} { put test.ppm "P6\n10 20\n0\nabcdef" list [catch {image create photo p1 -file test.ppm} msg] $msg @@ -157,9 +157,78 @@ test imgPPM-4.1 {StringReadPPM procedure, data too short [Bug 1822391]} \ -returnCodes error \ -result {truncated PPM data} +test imgPPM-5.1 {StringReadPPM procedure} -setup { + image create photo ppm +} -body { + ppm put "P6\n0 256\n255\nabcdef" +} -returnCodes error -cleanup { + image delete ppm +} -result {PPM image data has dimension(s) <= 0} +test imgPPM-5.2 {StringReadPPM procedure} -setup { + image create photo ppm +} -body { + ppm put "P6\n-2 256\n255\nabcdef" +} -returnCodes error -cleanup { + image delete ppm +} -result {PPM image data has dimension(s) <= 0} +test imgPPM-5.3 {StringReadPPM procedure} -setup { + image create photo ppm +} -body { + ppm put "P6\n10 0\n255\nabcdef" +} -returnCodes error -cleanup { + image delete ppm +} -result {PPM image data has dimension(s) <= 0} +test imgPPM-5.4 {StringReadPPM procedure} -setup { + image create photo ppm +} -body { + ppm put "P6\n10 -2\n255\nabcdef" +} -returnCodes error -cleanup { + image delete ppm +} -result {PPM image data has dimension(s) <= 0} +test imgPPM-5.5 {StringReadPPM procedure} -setup { + image create photo ppm +} -body { + ppm put "P6\n10 20\n100000\nabcdef" +} -returnCodes error -cleanup { + image delete ppm +} -result {PPM image data has bad maximum intensity value 100000} +test imgPPM-5.6 {StringReadPPM procedure} -setup { + image create photo ppm +} -body { + ppm put "P6\n10 20\n0\nabcdef" +} -returnCodes error -cleanup { + image delete ppm +} -result {PPM image data has bad maximum intensity value 0} +test imgPPM-5.7 {StringReadPPM procedure} -setup { + image create photo ppm +} -body { + ppm put "P6\n10 10\n255\nabcdef" +} -returnCodes error -cleanup { + image delete ppm +} -result {truncated PPM data} +test imgPPM-5.8 {StringReadPPM procedure} -setup { + image create photo ppm +} -body { + ppm put "P6\n5 4\n255\n01234567890123456789012345678901234567890123456789012345678" +} -returnCodes error -cleanup { + image delete ppm +} -result {truncated PPM data} +test imgPPM-5.9 {StringReadPPM procedure} -setup { + image create photo ppm +} -body { + ppm put "P6\n5 4\n150\n012345678901234567890123456789012345678901234567890123456789" + list [image width ppm] [image height ppm] +} -cleanup { + image delete ppm +} -result {5 4} + eval image delete [image names] # cleanup catch {file delete test.ppm} cleanupTests return + +# Local Variables: +# mode: tcl +# End: diff --git a/tests/listbox.test b/tests/listbox.test index 25bc606..b4046b6 100644 --- a/tests/listbox.test +++ b/tests/listbox.test @@ -2158,6 +2158,17 @@ test listbox-29.1 {listbox selection behavior, -state disabled} { lappend out [.l selection includes 2] [.l curselection] } {1 1 2} +test listbox-30.1 {Bug 3607326} -setup { + destroy .l + unset -nocomplain a +} -body { + array set a {} + listbox .l -listvariable a +} -cleanup { + destroy .l + unset -nocomplain a +} -result * -match glob -returnCodes error + resetGridInfo deleteWindows option clear diff --git a/tests/option.file1 b/tests/option.file1 index e64b6cc..32b4a18 100644 --- a/tests/option.file1 +++ b/tests/option.file1 @@ -14,4 +14,5 @@ ple # More comments, this time delimited by hash-marks. # Comment-line with space. *x6: +*x9: \ \ \\\101\n # comment line as last line of file. diff --git a/tests/option.test b/tests/option.test index 49d2975..1bfcb7c 100644 --- a/tests/option.test +++ b/tests/option.test @@ -197,13 +197,14 @@ test option-15.3 {database files} appNameIsTktest {option get . x2 color} green test option-15.4 {database files} {option get . x3 color} purple test option-15.5 {database files} {option get . {x 4} color} brown test option-15.6 {database files} {option get . x6 color} {} -test option-15.7 {database files} { +test option-15.7 {database files} {option get . x9 color} " \t\\A\n" +test option-15.8 {database files} { list [catch {option read $option1 widget foo} msg] $msg } {1 {wrong # args: should be "option readfile fileName ?priority?"}} option add *x3 burgundy catch {option read $option1 userDefault} -test option-15.8 {database files} {option get . x3 color} burgundy -test option-15.9 {database files} { +test option-15.9 {database files} {option get . x3 color} burgundy +test option-15.10 {database files} { list [catch {option read $option2} msg] $msg } {1 {missing colon on line 2}} diff --git a/tests/scale.test b/tests/scale.test index 657f668..f8e58bb 100644 --- a/tests/scale.test +++ b/tests/scale.test @@ -387,6 +387,11 @@ test scale-6.20 {ComputeFormat procedure} { .s set 1001.23456789 .s get } {1001.235} +test scale-6.21 {ComputeFormat procedure} { + .s configure -length 200 -from 1000 -to 1001.8 -resolution 0 -digits 200 + .s set 1001.23456789 + .s get +} {1001.235} test scale-7.1 {ComputeScaleGeometry procedure} {nonPortable fonts} { catch {destroy .s} @@ -862,6 +867,40 @@ test scale-18.3 {Scale button 2 events [Bug 787065]} \ } \ -result {0 {}} +test scale-19 {Bug [3529885fff] - Click in through goes in wrong direction} \ + -setup { + catch {destroy .s} + catch {destroy .s1 .s2 .s3 .s4} + unset -nocomplain x1 x2 x3 x4 x y + scale .s1 -from 0 -to 100 -resolution 1 -variable x1 -digits 4 -orient horizontal -length 100 + scale .s2 -from 0 -to 100 -resolution -1 -variable x2 -digits 4 -orient horizontal -length 100 + scale .s3 -from 100 -to 0 -resolution 1 -variable x3 -digits 4 -orient horizontal -length 100 + scale .s4 -from 100 -to 0 -resolution -1 -variable x4 -digits 4 -orient horizontal -length 100 + pack .s1 .s2 .s3 .s4 -side left + update + } \ + -body { + foreach {x y} [.s1 coord 50] {} + event generate .s1 <1> -x $x -y $y + event generate .s1 <ButtonRelease-1> -x $x -y $y + foreach {x y} [.s2 coord 50] {} + event generate .s2 <1> -x $x -y $y + event generate .s2 <ButtonRelease-1> -x $x -y $y + foreach {x y} [.s3 coord 50] {} + event generate .s3 <1> -x $x -y $y + event generate .s3 <ButtonRelease-1> -x $x -y $y + foreach {x y} [.s4 coord 50] {} + event generate .s4 <1> -x $x -y $y + event generate .s4 <ButtonRelease-1> -x $x -y $y + update + list $x1 $x2 $x3 $x4 + } \ + -cleanup { + unset x1 x2 x3 x4 x y + destroy .s1 .s2 .s3 .s4 + } \ + -result {1.0 1.0 1.0 1.0} + catch {destroy .s} option clear diff --git a/tests/textDisp.test b/tests/textDisp.test index 8e99eff..70c7208 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -27,9 +27,10 @@ proc scrollError args { # Create entries in the option database to be sure that geometry options # like border width have predictable values. - -option add *Text.borderWidth 2 -option add *Text.highlightThickness 2 +set twbw 2 +set twht 2 +option add *Text.borderWidth $twbw +option add *Text.highlightThickness $twht # The frame .f is needed to make sure that the overall window is always # fairly wide, even if the text window is very narrow. This is needed @@ -3366,7 +3367,7 @@ test textDisp-29.1 {miscellaneous: lines wrap but are still too long} {textfonts .t2.t window create 1.1 -window .t2.t.f update list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] -} [list [list 0.0 [expr {14.0/30}]] 300x50+5+[expr {$fixedDiff + 18}] [list 12 [expr {$fixedDiff + 68}] 7 $fixedHeight]] +} [list [list 0.0 [expr {20.0*$fixedWidth/300}]] 300x50+[expr {$twbw + $twht + 1}]+[expr {$twbw + $twht + $fixedHeight + 1}] [list [expr {$twbw + $twht + $fixedWidth + 1}] [expr {$twbw + $twht + $fixedHeight + 50 + 1}] $fixedWidth $fixedHeight]] test textDisp-29.2 {miscellaneous: lines wrap but are still too long} {textfonts} { catch {destroy .t2} toplevel .t2 @@ -3379,10 +3380,11 @@ test textDisp-29.2 {miscellaneous: lines wrap but are still too long} {textfonts .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f + update .t2.t xview scroll 1 unit update list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] -} [list [list [expr {7.0/300}] 0.49] 300x50+-2+[expr {$fixedDiff + 18}] [list 5 [expr {$fixedDiff + 68}] 7 $fixedHeight]] +} [list [list [expr {1.0*$fixedWidth/300}] [expr {21.0*$fixedWidth/300}]] 300x50+[expr {$twbw + $twht + 1 - $fixedWidth}]+[expr {$twbw + $twht + $fixedHeight + 1}] [list [expr {$twbw + $twht + $fixedWidth + 1 - $fixedWidth}] [expr {$twbw + $twht + $fixedHeight + 50 + 1}] $fixedWidth $fixedHeight]] test textDisp-29.2.1 {miscellaneous: lines wrap but are still too long} {textfonts} { catch {destroy .t2} toplevel .t2 @@ -3394,6 +3396,7 @@ test textDisp-29.2.1 {miscellaneous: lines wrap but are still too long} {textfon pack .t2.s -side bottom -fill x .t2.t insert end 1\n .t2.t insert end [string repeat "abc" 30] + update .t2.t xview scroll 5 unit update .t2.t xview @@ -3410,10 +3413,11 @@ test textDisp-29.2.2 {miscellaneous: lines wrap but are still too long} {textfon .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f + update .t2.t xview scroll 2 unit update list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] -} [list [list [expr {14.0/300}] [expr {154.0/300}]] 300x50+-9+[expr {$fixedDiff + 18}] {}] +} [list [list [expr {2.0*$fixedWidth/300}] [expr {22.0*$fixedWidth/300}]] 300x50+[expr {$twbw + $twht + 1 - 2*$fixedWidth}]+[expr {$twbw + $twht + $fixedHeight + 1}] {}] test textDisp-29.2.3 {miscellaneous: lines wrap but are still too long} {textfonts} { catch {destroy .t2} toplevel .t2 @@ -3426,10 +3430,11 @@ test textDisp-29.2.3 {miscellaneous: lines wrap but are still too long} {textfon .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f + update .t2.t xview scroll 7 pixels update list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] -} [list [list [expr {7.0/300}] 0.49] 300x50+-2+[expr {$fixedDiff + 18}] [list 5 [expr {$fixedDiff + 68}] 7 $fixedHeight]] +} [list [list [expr {7.0/300}] [expr {(20.0*$fixedWidth + 7)/300}]] 300x50+[expr {$twbw + $twht + 1 - 7}]+[expr {$twbw + $twht + $fixedHeight + 1}] [list [expr {$twbw + $twht + $fixedWidth + 1 - 7}] [expr {$twbw + $twht + $fixedHeight + 50 + 1}] $fixedWidth $fixedHeight]] test textDisp-29.2.4 {miscellaneous: lines wrap but are still too long} {textfonts} { catch {destroy .t2} toplevel .t2 @@ -3442,10 +3447,11 @@ test textDisp-29.2.4 {miscellaneous: lines wrap but are still too long} {textfon .t2.t insert end 123 frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised .t2.t window create 1.1 -window .t2.t.f + update .t2.t xview scroll 17 pixels update list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] -} [list [list [expr {17.0/300}] [expr {157.0/300}]] 300x50+-12+[expr {$fixedDiff + 18}] {}] +} [list [list [expr {17.0/300}] [expr {(20.0*$fixedWidth + 17)/300}]] 300x50+[expr {$twbw + $twht + 1 - 17}]+[expr {$twbw + $twht + $fixedHeight + 1}] {}] test textDisp-29.2.5 {miscellaneous: can show last character} { catch {destroy .t2} toplevel .t2 diff --git a/tests/textIndex.test b/tests/textIndex.test index 6341b6d..28dc0df 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -214,9 +214,31 @@ set weirdTag "funny . +- 22.1\n\t{" set weirdMark "asdf \n{-+ 66.2\t" .t mark set $weirdMark 4.0 .t tag config y -relief raised +set weirdImage "foo-1" +.t image create 2.1 -image [image create photo $weirdImage] +set weirdEmbWin ".t.bar-1" +entry $weirdEmbWin +.t window create 3.1 -window $weirdEmbWin test textIndex-3.1 {TkTextGetIndex, weird mark names} { list [catch {.t index $weirdMark} msg] $msg } {0 4.0} +test textIndex-3.2 {TkTextGetIndex, weird mark names} knownBug { + list [catch {.t index "$weirdMark -1char"} msg] $msg +} {0 4.0} +test textIndex-3.3 {TkTextGetIndex, weird embedded window names} { + list [catch {.t index $weirdEmbWin} msg] $msg +} {0 3.1} +test textIndex-3.4 {TkTextGetIndex, weird embedded window names} knownBug { + list [catch {.t index "$weirdEmbWin -1char"} msg] $msg +} {0 3.0} +test textIndex-3.5 {TkTextGetIndex, weird image names} { + list [catch {.t index $weirdImage} msg] $msg +} {0 2.1} +test textIndex-3.6 {TkTextGetIndex, weird image names} knownBug { + list [catch {.t index "$weirdImage -1char"} msg] $msg +} {0 2.0} +.t delete 3.1 ; # remove the weirdEmbWin +.t delete 2.1 ; # remove the weirdImage test textIndex-4.1 {TkTextGetIndex, tags} { list [catch {.t index x.first} msg] $msg diff --git a/unix/Makefile.in b/unix/Makefile.in index c530368..d869528 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -8,7 +8,6 @@ # Current Tk version; used in various names. TCLVERSION = @TCL_VERSION@ -TCLPATCHL = @TCL_PATCH_LEVEL@ VERSION = @TK_VERSION@ MAJOR_VERSION = @TK_MAJOR_VERSION@ MINOR_VERSION = @TK_MINOR_VERSION@ @@ -531,7 +530,7 @@ AQUA_XLIB_HDRS = $(XLIB_DIR)/X11/*.h $(XLIB_DIR)/xbytes.h AQUA_PRIVATE_HDRS = $(MAC_OSX_DIR)/tkMacOSXPort.h $(MAC_OSX_DIR)/tkMacOSXInt.h -X11_PRIVATE_HDRS = $(UNIX_DIR)/tkUnixPort.h $(UNIX_DIR)/tkUnixInt.h +X11_PRIVATE_HDRS = $(UNIX_DIR)/tkUnixPort.h $(UNIX_DIR)/tkUnixInt.h $(GENERIC_DIR)/tkIntXlibDecls.h # Currently private, eventually public TTK_HDRS = $(TTK_DIR)/ttkTheme.h $(TTK_DIR)/ttkDecls.h @@ -554,7 +553,7 @@ SHELL_ENV = \ all: binaries libraries doc -binaries: ${LIB_FILE} ${STUB_LIB_FILE} ${WISH_EXE} +binaries: ${LIB_FILE} ${WISH_EXE} libraries: @@ -565,11 +564,15 @@ doc: $(TOP_DIR)/doc/man.macros # The following target is configured by autoconf to generate either # a shared library or non-shared library for Tk. -${LIB_FILE}: ${OBJS} ${STUB_LIB_FILE} @LIB_RSRC_FILE@ +${LIB_FILE}: ${STUB_LIB_FILE} @LIB_RSRC_FILE@ ${OBJS} rm -f $@ @MAKE_LIB@ ${STUB_LIB_FILE}: ${STUB_LIB_OBJS} + @if test "x${LIB_FILE}" = "xlibtk${MAJOR_VERSION}.${MINOR_VERSION}.dll"; then \ + (cd ${TOP_DIR}/win; ${MAKE} tk${MAJOR_VERSION}${MINOR_VERSION}.dll); \ + cp "${TOP_DIR}/win/tk${MAJOR_VERSION}${MINOR_VERSION}.dll" .; \ + fi rm -f $@ @MAKE_STUB_LIB@ @@ -583,13 +586,9 @@ tkLibObjs: objs: ${OBJS} -${WISH_EXE}: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@ - @if test "x$(TK_SHARED_BUILD)" = "x1" -a \ - -f "${TOP_DIR}/win/tk${MAJOR_VERSION}${MINOR_VERSION}.dll"; then \ - cp "${TOP_DIR}/win/tk${MAJOR_VERSION}${MINOR_VERSION}.dll" .; \ - fi - ${CC} ${CFLAGS} ${LDFLAGS} $(WISH_OBJS) @WISH_BUILD_LIB_SPEC@ \ - $(CC_SEARCH_FLAGS) -o ${WISH_EXE} +${WISH_EXE}: $(TK_STUB_LIB_FILE) $(WISH_OBJS) $(TK_LIB_FILE) @APP_RSRC_FILE@ + ${CC} ${CFLAGS} ${LDFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ \ + $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o ${WISH_EXE} # Resetting the LIB_RUNTIME_DIR below is required so that # the generated tktest executable gets the build directory @@ -686,7 +685,7 @@ install-strip: # some ranlibs write to current directory, and this might not always be # possible (e.g. if installing as root). -install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) ${WISH_EXE} +install-binaries: $(TK_STUB_LIB_FILE) $(TK_LIB_FILE) ${WISH_EXE} @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" \ "$(PKG_INSTALL_DIR)" "$(CONFIG_INSTALL_DIR)" ; \ do \ @@ -703,13 +702,13 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) ${WISH_EXE} echo "if {[catch {package present Tcl 8.5.0}]} return";\ relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\ if test "x$(DLL_INSTALL_DIR)" != "x$(BIN_INSTALL_DIR)"; then \ - echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\ + echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}$(TK_LIB_FILE)]] Tk]";\ else \ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\ - echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)] Tk]";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)]] Tk]";\ echo "} else {";\ - echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll] Tk]";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll]] Tk]";\ echo "}";\ fi \ ) > "$(PKG_INDEX)"; \ @@ -720,6 +719,8 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) ${WISH_EXE} @if test -f "tk${MAJOR_VERSION}${MINOR_VERSION}.dll"; then \ $(INSTALL_LIBRARY) "tk${MAJOR_VERSION}${MINOR_VERSION}.dll" "$(DLL_INSTALL_DIR)";\ chmod 555 "$(DLL_INSTALL_DIR)/tk${MAJOR_VERSION}${MINOR_VERSION}.dll";\ + $(INSTALL_LIBRARY) "../win/libtk${MAJOR_VERSION}${MINOR_VERSION}.a" "$(LIB_INSTALL_DIR)";\ + chmod 555 "$(LIB_INSTALL_DIR)/libtk${MAJOR_VERSION}${MINOR_VERSION}.a";\ fi @echo "Installing ${WISH_EXE} as $(BIN_INSTALL_DIR)/wish$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${WISH_EXE} "$(BIN_INSTALL_DIR)/wish$(VERSION)${EXE_SUFFIX}" @@ -730,6 +731,9 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) ${WISH_EXE} @INSTALL_STUB_LIB@ ; \ fi @EXTRA_INSTALL_BINARIES@ + @echo "Installing pkg-config file to $(LIB_INSTALL_DIR)/pkgconfig/" + @$(INSTALL_DATA_DIR) $(LIB_INSTALL_DIR)/pkgconfig + @$(INSTALL_DATA) tk.pc $(LIB_INSTALL_DIR)/pkgconfig/tk.pc install-libraries: libraries @for i in "$(SCRIPT_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)/images" \ @@ -875,7 +879,7 @@ clean: distclean: clean rm -rf Makefile config.status config.cache config.log tkConfig.sh \ - $(PACKAGE).* prototype tkConfig.h *.plist Tk.framework + $(PACKAGE).* prototype tkConfig.h *.plist Tk.framework tk.pc depend: makedepend -- $(DEPEND_SWITCHES) -- $(SRCS) @@ -1499,7 +1503,7 @@ $(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure cd $(MAC_OSX_DIR); autoheader; touch $@ -dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(MAC_OSX_DIR)/configure genstubs +dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure genstubs rm -rf $(DISTDIR) mkdir -p $(DISTDIR)/unix cp -p $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix @@ -1509,7 +1513,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(MAC_OSX_DIR)/configure $(UNIX_DIR)/aclocal.m4 $(UNIX_DIR)/tcl.m4 \ $(UNIX_DIR)/tkConfig.sh.in $(TCLDIR)/unix/install-sh \ $(UNIX_DIR)/README $(UNIX_DIR)/installManPage \ - $(UNIX_DIR)/tkConfig.h.in $(DISTDIR)/unix + $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(DISTDIR)/unix chmod 775 $(DISTDIR)/unix/configure $(DISTDIR)/unix/configure.in mkdir $(DISTDIR)/bitmaps @(cd $(TOP_DIR); for i in bitmaps/* ; do \ diff --git a/unix/configure b/unix/configure index cc918fa..6a053d9 100755 --- a/unix/configure +++ b/unix/configure @@ -308,7 +308,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCLSH_PROG BUILD_TCLSH MAN_FLAGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP TCL_THREADS RANLIB ac_ct_RANLIB AR ac_ct_AR TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS PLAT_SRCS LDAIX_SRC CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING LDFLAGS_DEBUG LDFLAGS_OPTIMIZE CC_SEARCH_FLAGS LD_SEARCH_FLAGS STLIB_LD SHLIB_LD TCL_SHLIB_LD_EXTRAS TK_SHLIB_LD_EXTRAS SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX MAKE_LIB MAKE_STUB_LIB INSTALL_LIB DLL_INSTALL_DIR INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT LIBOBJS XFT_CFLAGS XFT_LIBS UNIX_FONT_OBJS TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_YEAR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_INCLUDE_SPEC TK_BUILD_STUB_LIB_SPEC TK_BUILD_STUB_LIB_PATH TK_SRC_DIR TK_SHARED_BUILD LD_LIBRARY_PATH_VAR TK_BUILD_LIB_SPEC WISH_BUILD_LIB_SPEC TCL_STUB_FLAGS XINCLUDES XLIBSW LOCALES TK_WINDOWINGSYSTEM TK_PKG_DIR TK_LIBRARY PRIVATE_INCLUDE_DIR HTML_DIR EXTRA_CC_SWITCHES EXTRA_APP_CC_SWITCHES EXTRA_INSTALL EXTRA_INSTALL_BINARIES EXTRA_BUILD_HTML EXTRA_WISH_LIBS CFBUNDLELOCALIZATIONS TK_RSRC_FILE WISH_RSRC_FILE LIB_RSRC_FILE APP_RSRC_FILE REZ REZ_FLAGS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCLSH_PROG BUILD_TCLSH MAN_FLAGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP TCL_THREADS RANLIB ac_ct_RANLIB AR ac_ct_AR TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS PLAT_SRCS LDAIX_SRC CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING LDFLAGS_DEBUG LDFLAGS_OPTIMIZE CC_SEARCH_FLAGS LD_SEARCH_FLAGS STLIB_LD SHLIB_LD TCL_SHLIB_LD_EXTRAS TK_SHLIB_LD_EXTRAS SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX MAKE_LIB MAKE_STUB_LIB INSTALL_LIB DLL_INSTALL_DIR INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT LIBOBJS XFT_CFLAGS XFT_LIBS UNIX_FONT_OBJS TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_YEAR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_INCLUDE_SPEC TK_BUILD_STUB_LIB_SPEC TK_BUILD_STUB_LIB_PATH TK_SRC_DIR TK_SHARED_BUILD LD_LIBRARY_PATH_VAR TK_BUILD_LIB_SPEC TCL_STUB_FLAGS XINCLUDES XLIBSW LOCALES TK_WINDOWINGSYSTEM TK_PKG_DIR TK_LIBRARY LIB_RUNTIME_DIR PRIVATE_INCLUDE_DIR HTML_DIR EXTRA_CC_SWITCHES EXTRA_APP_CC_SWITCHES EXTRA_INSTALL EXTRA_INSTALL_BINARIES EXTRA_BUILD_HTML EXTRA_WISH_LIBS CFBUNDLELOCALIZATIONS TK_RSRC_FILE WISH_RSRC_FILE LIB_RSRC_FILE APP_RSRC_FILE REZ REZ_FLAGS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -861,9 +861,9 @@ Optional Features: --enable-load allow dynamic loading and "load" command (default: on) --enable-symbols build with debugging symbols (default: off) - --enable-aqua use Aqua windowingsystem on Mac OS X (default: off) - --enable-xss use XScreenSaver for activity timer (default: on) + --enable-aqua=yes|no use Aqua windowingsystem on Mac OS X (default: no) --enable-xft use freetype/fontconfig/xft (default: on) + --enable-xss use XScreenSaver for activity timer (default: on) --enable-framework package shared libraries in MacOSX frameworks (default: off) @@ -1338,7 +1338,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TK_VERSION=8.5 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=5 -TK_PATCH_LEVEL=".13" +TK_PATCH_LEVEL=".17" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" @@ -1541,6 +1541,16 @@ echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6 +if test "${TCL_VERSION}" != "${TK_VERSION}"; then + { { echo "$as_me:$LINENO: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. +Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}. +Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&5 +echo "$as_me: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. +Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}. +Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&2;} + { (exit 1); exit 1; }; } +fi + echo "$as_me:$LINENO: checking for tclsh" >&5 echo $ECHO_N "checking for tclsh... $ECHO_C" >&6 @@ -1585,16 +1595,6 @@ echo "${ECHO_T}$BUILD_TCLSH" >&6 -if test "${TCL_VERSION}" != "${TK_VERSION}"; then - { { echo "$as_me:$LINENO: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. -Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}. -Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&5 -echo "$as_me: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. -Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}. -Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&2;} - { (exit 1); exit 1; }; } -fi - #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ @@ -3962,7 +3962,8 @@ echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you m ac_saved_libs=$LIBS LIBS="$LIBS $THREADS_LIBS" -for ac_func in pthread_attr_setstacksize + +for ac_func in pthread_attr_setstacksize pthread_atfork do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -5143,7 +5144,7 @@ fi LD_SEARCH_FLAGS="" TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.dll.a' - TCL_SHLIB_LD_EXTRAS='-Wl,--out-implib,$@.a' + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$@.a" echo "$as_me:$LINENO: checking for Cygwin version of gcc" >&5 echo $ECHO_N "checking for Cygwin version of gcc... $ECHO_C" >&6 if test "${ac_cv_cygwin+set}" = set; then @@ -5212,10 +5213,15 @@ echo "$as_me: error: ${CC} is not a cygwin compiler." >&2;} echo "$as_me: error: CYGWIN compile is only supported with --enable-threads" >&2;} { (exit 1); exit 1; }; } fi - if test "x${SHARED_BUILD}" = "x1" -a ! -f "../win/tcldde13.dll" -a ! -f "../win/tk85.dll"; then - { { echo "$as_me:$LINENO: error: Please configure and make the ../win directory first." >&5 -echo "$as_me: error: Please configure and make the ../win directory first." >&2;} - { (exit 1); exit 1; }; } + do64bit_ok=yes + if test "x${SHARED_BUILD}" = "x1"; then + echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args" + # The eval makes quoting arguments work. + if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix + then : + else + { echo "configure: error: configure failed for ../win" 1>&2; exit 1; } + fi fi ;; dgux*) @@ -5623,7 +5629,7 @@ fi fi ;; - Linux*) + Linux*|GNU*|NetBSD-Debian) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" @@ -5729,21 +5735,6 @@ fi fi ;; - GNU*) - SHLIB_CFLAGS="-fPIC" - SHLIB_SUFFIX=".so" - - SHLIB_LD='${CC} -shared' - DL_OBJS="" - DL_LIBS="-ldl" - LDFLAGS="$LDFLAGS -Wl,--export-dynamic" - CC_SEARCH_FLAGS="" - LD_SEARCH_FLAGS="" - if test "`uname -m`" = "alpha"; then - CFLAGS="$CFLAGS -mieee" -fi - - ;; Lynx*) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" @@ -5780,74 +5771,25 @@ fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - NetBSD-1.*|FreeBSD-[1-2].*) - SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld -Bshareable -x" - SHLIB_SUFFIX=".so" - DL_OBJS="tclLoadDl.o" - DL_LIBS="" - if test $doRpath = yes; then - - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' -fi - - echo "$as_me:$LINENO: checking for ELF" >&5 -echo $ECHO_N "checking for ELF... $ECHO_C" >&6 -if test "${tcl_cv_ld_elf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#ifdef __ELF__ - yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - tcl_cv_ld_elf=yes -else - tcl_cv_ld_elf=no -fi -rm -f conftest* - -fi -echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 -echo "${ECHO_T}$tcl_cv_ld_elf" >&6 - if test $tcl_cv_ld_elf = yes; then - - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' - -else - - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' - -fi - - - # Ancient FreeBSD doesn't handle version numbers with dots. - - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - TCL_LIB_VERSIONS_OK=nodots - ;; OpenBSD-*) arch=`arch -s` case "$arch" in - m88k|vax) + vax) # Equivalent using configure option --disable-load # Step 4 will set the necessary variables DL_OBJS="" SHLIB_LD_LIBS="" + LDFLAGS="" ;; *) - SHLIB_CFLAGS="-fPIC" + case "$arch" in + alpha|sparc64) + SHLIB_CFLAGS="-fPIC" + ;; + *) + SHLIB_CFLAGS="-fpic" + ;; + esac SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" @@ -5859,10 +5801,11 @@ fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" ;; esac case "$arch" in - m88k|vax) + vax) CFLAGS_OPTIMIZE="-O1" ;; sh) @@ -5872,43 +5815,6 @@ fi CFLAGS_OPTIMIZE="-O2" ;; esac - echo "$as_me:$LINENO: checking for ELF" >&5 -echo $ECHO_N "checking for ELF... $ECHO_C" >&6 -if test "${tcl_cv_ld_elf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#ifdef __ELF__ - yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - tcl_cv_ld_elf=yes -else - tcl_cv_ld_elf=no -fi -rm -f conftest* - -fi -echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 -echo "${ECHO_T}$tcl_cv_ld_elf" >&6 - if test $tcl_cv_ld_elf = yes; then - - LDFLAGS=-Wl,-export-dynamic - -else - LDFLAGS="" -fi - if test "${TCL_THREADS}" = "1"; then # On OpenBSD: Compile with -pthread @@ -5922,9 +5828,8 @@ fi UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; - NetBSD-*|FreeBSD-[3-4].*) - # FreeBSD 3.* and greater have ELF. - # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs + NetBSD-*) + # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" @@ -5946,20 +5851,12 @@ fi fi - case $system in - FreeBSD-3.*) - # FreeBSD-3 doesn't handle version numbers with dots. - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' - TCL_LIB_VERSIONS_OK=nodots - ;; - esac ;; FreeBSD-*) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" - TCL_SHLIB_LD_EXTRAS="-soname \$@" + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" @@ -5967,7 +5864,7 @@ fi if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi if test "${TCL_THREADS}" = "1"; then @@ -5978,11 +5875,15 @@ fi LDFLAGS="$LDFLAGS $PTHREAD_LIBS" fi - # Version numbers are dot-stripped by system policy. - TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1' - TCL_LIB_VERSIONS_OK=nodots + case $system in + FreeBSD-3.*) + # Version numbers are dot-stripped by system policy. + TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' + TCL_LIB_VERSIONS_OK=nodots + ;; + esac ;; Darwin-*) CFLAGS_OPTIMIZE="-Os" @@ -7876,7 +7777,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <sys/types.h> -#include <sys/dirent.h> +#include <dirent.h> int main () { @@ -9526,7 +9427,8 @@ if test "${enable_aqua+set}" = set; then else tk_aqua=no fi; - if test $tk_aqua = yes; then + if test $tk_aqua = yes -o $tk_aqua = cocoa; then + tk_aqua=yes if test $tcl_corefoundation = no; then { echo "$as_me:$LINENO: WARNING: Aqua can only be used when CoreFoundation is available" >&5 echo "$as_me: WARNING: Aqua can only be used when CoreFoundation is available" >&2;} @@ -9991,7 +9893,7 @@ cat >>confdefs.h <<\_ACEOF _ACEOF LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit" - EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c -fobjc-gc' + EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c' TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then @@ -10254,7 +10156,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <X11/XIntrinsic.h> +#include <X11/Xlib.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -10283,7 +10185,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_ext else - if test ! -r $x_includes/X11/Intrinsic.h; then + if test ! -r $x_includes/X11/Xlib.h; then not_really_there="yes" fi fi @@ -10298,7 +10200,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <X11/Intrinsic.h> +#include <X11/Xlib.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -10329,7 +10231,7 @@ rm -f conftest.err conftest.$ac_ext if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do - if test -r $i/X11/Intrinsic.h; then + if test -r $i/X11/Xlib.h; then echo "$as_me:$LINENO: result: $i" >&5 echo "${ECHO_T}$i" >&6 XINCLUDES=" -I$i" @@ -10464,7 +10366,9 @@ fi #-------------------------------------------------------------------- if test "x${x_libraries}" != "x"; then + if test "x${x_libraries}" != "xNONE"; then LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}" + fi fi if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` @@ -10632,36 +10536,43 @@ rm -f conftest.err conftest.$ac_objext \ fi #-------------------------------------------------------------------- -# Check whether the header and library for the XScreenSaver -# extension are available, and set HAVE_XSS if so. -# XScreenSaver is needed for Tk_GetUserInactiveTime(). +# Check for freetype / fontconfig / Xft support. #-------------------------------------------------------------------- if test $tk_aqua = no; then - tk_oldCFlags=$CFLAGS - CFLAGS="$CFLAGS $XINCLUDES" - tk_oldLibs=$LIBS - LIBS="$tk_oldLibs $XLIBSW" - xss_header_found=no - xss_lib_found=no - echo "$as_me:$LINENO: checking whether to try to use XScreenSaver" >&5 -echo $ECHO_N "checking whether to try to use XScreenSaver... $ECHO_C" >&6 - # Check whether --enable-xss or --disable-xss was given. -if test "${enable_xss+set}" = set; then - enableval="$enable_xss" - enable_xss=$enableval + echo "$as_me:$LINENO: checking whether to use xft" >&5 +echo $ECHO_N "checking whether to use xft... $ECHO_C" >&6 + # Check whether --enable-xft or --disable-xft was given. +if test "${enable_xft+set}" = set; then + enableval="$enable_xft" + enable_xft=$enableval else - enable_xss=yes + enable_xft="default" fi; - if test "$enable_xss" = "no" ; then - echo "$as_me:$LINENO: result: $enable_xss" >&5 -echo "${ECHO_T}$enable_xss" >&6 + XFT_CFLAGS="" + XFT_LIBS="" + if test "$enable_xft" = "no" ; then + echo "$as_me:$LINENO: result: $enable_xft" >&5 +echo "${ECHO_T}$enable_xft" >&6 else - echo "$as_me:$LINENO: result: $enable_xss" >&5 -echo "${ECHO_T}$enable_xss" >&6 - echo "$as_me:$LINENO: checking for X11/extensions/scrnsaver.h" >&5 -echo $ECHO_N "checking for X11/extensions/scrnsaver.h... $ECHO_C" >&6 -if test "${ac_cv_header_X11_extensions_scrnsaver_h+set}" = set; then + found_xft="yes" + XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no" + XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no" + if test "$found_xft" = "no" ; then + found_xft=yes + XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no" + XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no" + fi + echo "$as_me:$LINENO: result: $found_xft" >&5 +echo "${ECHO_T}$found_xft" >&6 + if test "$found_xft" = "yes" ; then + tk_oldCFlags=$CFLAGS + CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" + tk_oldLibs=$LIBS + LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" + echo "$as_me:$LINENO: checking for X11/Xft/Xft.h" >&5 +echo $ECHO_N "checking for X11/Xft/Xft.h... $ECHO_C" >&6 +if test "${ac_cv_header_X11_Xft_Xft_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10672,7 +10583,7 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <X11/Xlib.h> -#include <X11/extensions/scrnsaver.h> +#include <X11/Xft/Xft.h> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -10696,76 +10607,60 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_header_X11_extensions_scrnsaver_h=yes + ac_cv_header_X11_Xft_Xft_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_header_X11_extensions_scrnsaver_h=no +ac_cv_header_X11_Xft_Xft_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_scrnsaver_h" >&5 -echo "${ECHO_T}$ac_cv_header_X11_extensions_scrnsaver_h" >&6 -if test $ac_cv_header_X11_extensions_scrnsaver_h = yes; then +echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xft_Xft_h" >&5 +echo "${ECHO_T}$ac_cv_header_X11_Xft_Xft_h" >&6 +if test $ac_cv_header_X11_Xft_Xft_h = yes; then + : +else - xss_header_found=yes + found_xft=no fi - echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo" >&5 -echo $ECHO_N "checking for XScreenSaverQueryInfo... $ECHO_C" >&6 -if test "${ac_cv_func_XScreenSaverQueryInfo+set}" = set; then + CFLAGS=$tk_oldCFlags + LIBS=$tk_oldLibs + fi + if test "$found_xft" = "yes" ; then + tk_oldCFlags=$CFLAGS + CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" + tk_oldLibs=$LIBS + LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" + +echo "$as_me:$LINENO: checking for XftFontOpen in -lXft" >&5 +echo $ECHO_N "checking for XftFontOpen in -lXft... $ECHO_C" >&6 +if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXft $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define XScreenSaverQueryInfo to an innocuous variant, in case <limits.h> declares XScreenSaverQueryInfo. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define XScreenSaverQueryInfo innocuous_XScreenSaverQueryInfo - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char XScreenSaverQueryInfo (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef XScreenSaverQueryInfo /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char XScreenSaverQueryInfo (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_XScreenSaverQueryInfo) || defined (__stub___XScreenSaverQueryInfo) -choke me -#else -char (*f) () = XScreenSaverQueryInfo; -#endif -#ifdef __cplusplus -} -#endif - +char XftFontOpen (); int main () { -return f != XScreenSaverQueryInfo; +XftFontOpen (); ; return 0; } @@ -10792,29 +10687,47 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_XScreenSaverQueryInfo=yes + ac_cv_lib_Xft_XftFontOpen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_XScreenSaverQueryInfo=no +ac_cv_lib_Xft_XftFontOpen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_func_XScreenSaverQueryInfo" >&5 -echo "${ECHO_T}$ac_cv_func_XScreenSaverQueryInfo" >&6 -if test $ac_cv_func_XScreenSaverQueryInfo = yes; then - : +echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftFontOpen" >&5 +echo "${ECHO_T}$ac_cv_lib_Xft_XftFontOpen" >&6 +if test $ac_cv_lib_Xft_XftFontOpen = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBXFT 1 +_ACEOF + + LIBS="-lXft $LIBS" + else - echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXext" >&5 -echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXext... $ECHO_C" >&6 -if test "${ac_cv_lib_Xext_XScreenSaverQueryInfo+set}" = set; then + found_xft=no + +fi + + CFLAGS=$tk_oldCFlags + LIBS=$tk_oldLibs + fi + if test "$found_xft" = "yes" ; then + tk_oldCFlags=$CFLAGS + CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" + tk_oldLibs=$LIBS + LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW -lfontconfig" + echo "$as_me:$LINENO: checking for FcFontSort in -lfontconfig" >&5 +echo $ECHO_N "checking for FcFontSort in -lfontconfig... $ECHO_C" >&6 +if test "${ac_cv_lib_fontconfig_FcFontSort+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXext $LIBS" +LIBS="-lfontconfig $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -10828,11 +10741,11 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char XScreenSaverQueryInfo (); +char FcFontSort (); int main () { -XScreenSaverQueryInfo (); +FcFontSort (); ; return 0; } @@ -10859,33 +10772,131 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_Xext_XScreenSaverQueryInfo=yes + ac_cv_lib_fontconfig_FcFontSort=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_Xext_XScreenSaverQueryInfo=no +ac_cv_lib_fontconfig_FcFontSort=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XScreenSaverQueryInfo" >&5 -echo "${ECHO_T}$ac_cv_lib_Xext_XScreenSaverQueryInfo" >&6 -if test $ac_cv_lib_Xext_XScreenSaverQueryInfo = yes; then +echo "$as_me:$LINENO: result: $ac_cv_lib_fontconfig_FcFontSort" >&5 +echo "${ECHO_T}$ac_cv_lib_fontconfig_FcFontSort" >&6 +if test $ac_cv_lib_fontconfig_FcFontSort = yes; then - XLIBSW="$XLIBSW -lXext" - xss_lib_found=yes + XFT_LIBS="$XFT_LIBS -lfontconfig" +fi + + CFLAGS=$tk_oldCFlags + LIBS=$tk_oldLibs + fi + if test "$found_xft" = "no" ; then + if test "$enable_xft" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: Can't find xft configuration, or xft is unusable" >&5 +echo "$as_me: WARNING: Can't find xft configuration, or xft is unusable" >&2;} + fi + enable_xft=no + XFT_CFLAGS="" + XFT_LIBS="" + else + enable_xft=yes + fi + fi + if test $enable_xft = "yes" ; then + UNIX_FONT_OBJS=tkUnixRFont.o + +cat >>confdefs.h <<\_ACEOF +#define HAVE_XFT 1 +_ACEOF + + else + UNIX_FONT_OBJS=tkUnixFont.o + fi + + + +fi + +#-------------------------------------------------------------------- +# Check for XkbKeycodeToKeysym. +#-------------------------------------------------------------------- + +if test $tk_aqua = no; then + tk_oldCFlags=$CFLAGS + tk_oldLibs=$LIBS + CFLAGS="$CFLAGS $XINCLUDES" + LIBS="$LIBS $XLIBSW" + echo "$as_me:$LINENO: checking for X11/XKBlib.h" >&5 +echo $ECHO_N "checking for X11/XKBlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_X11_XKBlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <X11/Xlib.h> - echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXss" >&5 -echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXss... $ECHO_C" >&6 -if test "${ac_cv_lib_Xss_XScreenSaverQueryInfo+set}" = set; then +#include <X11/XKBlib.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_X11_XKBlib_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_X11_XKBlib_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_X11_XKBlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_X11_XKBlib_h" >&6 +if test $ac_cv_header_X11_XKBlib_h = yes; then + + xkblib_header_found=yes + +else + + xkblib_header_found=no + +fi + + + if test $xkblib_header_found = "yes" ; then + echo "$as_me:$LINENO: checking for XkbKeycodeToKeysym in -lX11" >&5 +echo $ECHO_N "checking for XkbKeycodeToKeysym in -lX11... $ECHO_C" >&6 +if test "${ac_cv_lib_X11_XkbKeycodeToKeysym+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXss -lXext $LIBS" +LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -10899,11 +10910,11 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char XScreenSaverQueryInfo (); +char XkbKeycodeToKeysym (); int main () { -XScreenSaverQueryInfo (); +XkbKeycodeToKeysym (); ; return 0; } @@ -10930,43 +10941,36 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_Xss_XScreenSaverQueryInfo=yes + ac_cv_lib_X11_XkbKeycodeToKeysym=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_Xss_XScreenSaverQueryInfo=no +ac_cv_lib_X11_XkbKeycodeToKeysym=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_Xss_XScreenSaverQueryInfo" >&5 -echo "${ECHO_T}$ac_cv_lib_Xss_XScreenSaverQueryInfo" >&6 -if test $ac_cv_lib_Xss_XScreenSaverQueryInfo = yes; then - - if test "$tcl_cv_ld_weak_l" = yes; then - # On Darwin, weak link libXss if possible, - # as it is only available on Tiger or later. - XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext" - else - XLIBSW="$XLIBSW -lXss -lXext" - fi - xss_lib_found=yes - -fi +echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XkbKeycodeToKeysym" >&5 +echo "${ECHO_T}$ac_cv_lib_X11_XkbKeycodeToKeysym" >&6 +if test $ac_cv_lib_X11_XkbKeycodeToKeysym = yes; then + xkbkeycodetokeysym_found=yes -fi +else + xkbkeycodetokeysym_found=no fi + else + xkbkeycodetokeysym_found=no fi - if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then + if test $xkbkeycodetokeysym_found = "yes" ; then cat >>confdefs.h <<\_ACEOF -#define HAVE_XSS 1 +#define HAVE_XKBKEYCODETOKEYSYM 1 _ACEOF fi @@ -10975,43 +10979,39 @@ _ACEOF fi #-------------------------------------------------------------------- -# Check for freetype / fontconfig / Xft support. +# XXX Do this last. +# It might modify XLIBSW which could affect other tests. +# +# Check whether the header and library for the XScreenSaver +# extension are available, and set HAVE_XSS if so. +# XScreenSaver is needed for Tk_GetUserInactiveTime(). #-------------------------------------------------------------------- if test $tk_aqua = no; then - echo "$as_me:$LINENO: checking whether to use xft" >&5 -echo $ECHO_N "checking whether to use xft... $ECHO_C" >&6 - # Check whether --enable-xft or --disable-xft was given. -if test "${enable_xft+set}" = set; then - enableval="$enable_xft" - enable_xft=$enableval + tk_oldCFlags=$CFLAGS + CFLAGS="$CFLAGS $XINCLUDES" + tk_oldLibs=$LIBS + LIBS="$tk_oldLibs $XLIBSW" + xss_header_found=no + xss_lib_found=no + echo "$as_me:$LINENO: checking whether to try to use XScreenSaver" >&5 +echo $ECHO_N "checking whether to try to use XScreenSaver... $ECHO_C" >&6 + # Check whether --enable-xss or --disable-xss was given. +if test "${enable_xss+set}" = set; then + enableval="$enable_xss" + enable_xss=$enableval else - enable_xft="default" + enable_xss=yes fi; - XFT_CFLAGS="" - XFT_LIBS="" - if test "$enable_xft" = "no" ; then - echo "$as_me:$LINENO: result: $enable_xft" >&5 -echo "${ECHO_T}$enable_xft" >&6 + if test "$enable_xss" = "no" ; then + echo "$as_me:$LINENO: result: $enable_xss" >&5 +echo "${ECHO_T}$enable_xss" >&6 else - found_xft="yes" - XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no" - XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no" - if test "$found_xft" = "no" ; then - found_xft=yes - XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no" - XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no" - fi - echo "$as_me:$LINENO: result: $found_xft" >&5 -echo "${ECHO_T}$found_xft" >&6 - if test "$found_xft" = "yes" ; then - tk_oldCFlags=$CFLAGS - CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" - tk_oldLibs=$LIBS - LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" - echo "$as_me:$LINENO: checking for X11/Xft/Xft.h" >&5 -echo $ECHO_N "checking for X11/Xft/Xft.h... $ECHO_C" >&6 -if test "${ac_cv_header_X11_Xft_Xft_h+set}" = set; then + echo "$as_me:$LINENO: result: $enable_xss" >&5 +echo "${ECHO_T}$enable_xss" >&6 + echo "$as_me:$LINENO: checking for X11/extensions/scrnsaver.h" >&5 +echo $ECHO_N "checking for X11/extensions/scrnsaver.h... $ECHO_C" >&6 +if test "${ac_cv_header_X11_extensions_scrnsaver_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -11022,7 +11022,7 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <X11/Xlib.h> -#include <X11/Xft/Xft.h> +#include <X11/extensions/scrnsaver.h> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -11046,42 +11046,196 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_header_X11_Xft_Xft_h=yes + ac_cv_header_X11_extensions_scrnsaver_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_header_X11_Xft_Xft_h=no +ac_cv_header_X11_extensions_scrnsaver_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xft_Xft_h" >&5 -echo "${ECHO_T}$ac_cv_header_X11_Xft_Xft_h" >&6 -if test $ac_cv_header_X11_Xft_Xft_h = yes; then +echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_scrnsaver_h" >&5 +echo "${ECHO_T}$ac_cv_header_X11_extensions_scrnsaver_h" >&6 +if test $ac_cv_header_X11_extensions_scrnsaver_h = yes; then + + xss_header_found=yes + +fi + + + echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo" >&5 +echo $ECHO_N "checking for XScreenSaverQueryInfo... $ECHO_C" >&6 +if test "${ac_cv_func_XScreenSaverQueryInfo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define XScreenSaverQueryInfo to an innocuous variant, in case <limits.h> declares XScreenSaverQueryInfo. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define XScreenSaverQueryInfo innocuous_XScreenSaverQueryInfo + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char XScreenSaverQueryInfo (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef XScreenSaverQueryInfo + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XScreenSaverQueryInfo (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XScreenSaverQueryInfo) || defined (__stub___XScreenSaverQueryInfo) +choke me +#else +char (*f) () = XScreenSaverQueryInfo; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != XScreenSaverQueryInfo; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XScreenSaverQueryInfo=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_XScreenSaverQueryInfo=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_XScreenSaverQueryInfo" >&5 +echo "${ECHO_T}$ac_cv_func_XScreenSaverQueryInfo" >&6 +if test $ac_cv_func_XScreenSaverQueryInfo = yes; then : else - found_xft=no + echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXext" >&5 +echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXext... $ECHO_C" >&6 +if test "${ac_cv_lib_Xext_XScreenSaverQueryInfo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXext $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XScreenSaverQueryInfo (); +int +main () +{ +XScreenSaverQueryInfo (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xext_XScreenSaverQueryInfo=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_Xext_XScreenSaverQueryInfo=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi +echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XScreenSaverQueryInfo" >&5 +echo "${ECHO_T}$ac_cv_lib_Xext_XScreenSaverQueryInfo" >&6 +if test $ac_cv_lib_Xext_XScreenSaverQueryInfo = yes; then + XLIBSW="$XLIBSW -lXext" + xss_lib_found=yes - CFLAGS=$tk_oldCFlags - LIBS=$tk_oldLibs - fi - if test "$found_xft" = "yes" ; then - tk_oldCFlags=$CFLAGS - CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" - tk_oldLibs=$LIBS - LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" +else -echo "$as_me:$LINENO: checking for XftFontOpen in -lXft" >&5 -echo $ECHO_N "checking for XftFontOpen in -lXft... $ECHO_C" >&6 -if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then + echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXss" >&5 +echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXss... $ECHO_C" >&6 +if test "${ac_cv_lib_Xss_XScreenSaverQueryInfo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXft $LIBS" +LIBS="-lXss -lXext $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -11095,11 +11249,11 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char XftFontOpen (); +char XScreenSaverQueryInfo (); int main () { -XftFontOpen (); +XScreenSaverQueryInfo (); ; return 0; } @@ -11126,60 +11280,48 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_Xft_XftFontOpen=yes + ac_cv_lib_Xss_XScreenSaverQueryInfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_Xft_XftFontOpen=no +ac_cv_lib_Xss_XScreenSaverQueryInfo=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftFontOpen" >&5 -echo "${ECHO_T}$ac_cv_lib_Xft_XftFontOpen" >&6 -if test $ac_cv_lib_Xft_XftFontOpen = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBXFT 1 -_ACEOF +echo "$as_me:$LINENO: result: $ac_cv_lib_Xss_XScreenSaverQueryInfo" >&5 +echo "${ECHO_T}$ac_cv_lib_Xss_XScreenSaverQueryInfo" >&6 +if test $ac_cv_lib_Xss_XScreenSaverQueryInfo = yes; then - LIBS="-lXft $LIBS" + if test "$tcl_cv_ld_weak_l" = yes; then + # On Darwin, weak link libXss if possible, + # as it is only available on Tiger or later. + XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext" + else + XLIBSW="$XLIBSW -lXss -lXext" + fi + xss_lib_found=yes -else +fi + + +fi - found_xft=no fi - CFLAGS=$tk_oldCFlags - LIBS=$tk_oldLibs - fi - if test "$found_xft" = "no" ; then - if test "$enable_xft" = "yes" ; then - { echo "$as_me:$LINENO: WARNING: Can't find xft configuration, or xft is unusable" >&5 -echo "$as_me: WARNING: Can't find xft configuration, or xft is unusable" >&2;} - fi - enable_xft=no - XFT_CFLAGS="" - XFT_LIBS="" - else - enable_xft=yes - fi fi - if test $enable_xft = "yes" ; then - UNIX_FONT_OBJS=tkUnixRFont.o + if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_XFT 1 +#define HAVE_XSS 1 _ACEOF - else - UNIX_FONT_OBJS=tkUnixFont.o fi - - - + CFLAGS=$tk_oldCFlags + LIBS=$tk_oldLibs fi #-------------------------------------------------------------------- @@ -11352,7 +11494,6 @@ _ACEOF TK_LIB_FILE="Tk" TK_LIB_FLAG="-framework Tk" TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk" - WISH_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk \${WISH_LIBS}" TK_LIB_SPEC="-F${libdir} -framework Tk" libdir="${libdir}/Tk.framework/Versions/\${VERSION}" TK_LIBRARY="${libdir}/Resources/Scripts" @@ -11367,12 +11508,13 @@ _ACEOF EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"' if test $tk_aqua = yes; then - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done' - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"' - bindir="${libdir}/Resources/Wish.app/Contents/MacOS" - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"' - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"' - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"' + bindir="${libdir}/Resources/Wish.app/Contents/MacOS" + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"' fi EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."' # Don't use AC_DEFINE for the following as the framework version define @@ -11386,16 +11528,16 @@ else fi # libdir must be a fully qualified path and not ${exec_prefix}/lib eval libdir="$libdir" - if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then - TK_LIB_FLAG="-ltk${TK_VERSION}" - else - TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`" - fi - TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}" if test "${ac_cv_cygwin}" = "yes" -a "$SHARED_BUILD" = "1"; then - WISH_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win -ltk${TK_MAJOR_VERSION}${TK_MINOR_VERSION} \${TCL_LIB_SPEC}" + TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`" + TK_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win ${TK_LIB_FLAG}" else - WISH_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG} \${WISH_LIBS}" + if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then + TK_LIB_FLAG="-ltk${TK_VERSION}" + else + TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`" + fi + TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}" fi TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" fi @@ -11480,7 +11622,7 @@ TK_SHARED_BUILD=${SHARED_BUILD} - ac_config_files="$ac_config_files Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in" + ac_config_files="$ac_config_files Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in tk.pc:../unix/tk.pc.in" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -12047,6 +12189,7 @@ do "Wish-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Wish-Info.plist:../macosx/Wish-Info.plist.in" ;; "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;; "tkConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tkConfig.sh:../unix/tkConfig.sh.in" ;; + "tk.pc" ) CONFIG_FILES="$CONFIG_FILES tk.pc:../unix/tk.pc.in" ;; "Tk.framework" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Tk.framework" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -12209,7 +12352,6 @@ s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t s,@TK_SHARED_BUILD@,$TK_SHARED_BUILD,;t t s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t s,@TK_BUILD_LIB_SPEC@,$TK_BUILD_LIB_SPEC,;t t -s,@WISH_BUILD_LIB_SPEC@,$WISH_BUILD_LIB_SPEC,;t t s,@TCL_STUB_FLAGS@,$TCL_STUB_FLAGS,;t t s,@XINCLUDES@,$XINCLUDES,;t t s,@XLIBSW@,$XLIBSW,;t t @@ -12217,6 +12359,7 @@ s,@LOCALES@,$LOCALES,;t t s,@TK_WINDOWINGSYSTEM@,$TK_WINDOWINGSYSTEM,;t t s,@TK_PKG_DIR@,$TK_PKG_DIR,;t t s,@TK_LIBRARY@,$TK_LIBRARY,;t t +s,@LIB_RUNTIME_DIR@,$LIB_RUNTIME_DIR,;t t s,@PRIVATE_INCLUDE_DIR@,$PRIVATE_INCLUDE_DIR,;t t s,@HTML_DIR@,$HTML_DIR,;t t s,@EXTRA_CC_SWITCHES@,$EXTRA_CC_SWITCHES,;t t diff --git a/unix/configure.in b/unix/configure.in index d052675..7be1791 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TK_VERSION=8.5 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=5 -TK_PATCH_LEVEL=".13" +TK_PATCH_LEVEL=".17" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" @@ -36,15 +36,15 @@ LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" SC_PATH_TCLCONFIG SC_LOAD_TCLCONFIG -SC_PROG_TCLSH -SC_BUILD_TCLSH - if test "${TCL_VERSION}" != "${TK_VERSION}"; then AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}. Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}.]) fi +SC_PROG_TCLSH +SC_BUILD_TCLSH + #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ @@ -268,10 +268,11 @@ fi if test "`uname -s`" = "Darwin" ; then AC_MSG_CHECKING([whether to use Aqua]) AC_ARG_ENABLE(aqua, - AC_HELP_STRING([--enable-aqua], - [use Aqua windowingsystem on Mac OS X (default: off)]), + AC_HELP_STRING([--enable-aqua=yes|no], + [use Aqua windowingsystem on Mac OS X (default: no)]), [tk_aqua=$enableval], [tk_aqua=no]) - if test $tk_aqua = yes; then + if test $tk_aqua = yes -o $tk_aqua = cocoa; then + tk_aqua=yes if test $tcl_corefoundation = no; then AC_MSG_WARN([Aqua can only be used when CoreFoundation is available]) tk_aqua=no @@ -364,7 +365,7 @@ fi if test $tk_aqua = yes; then AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?]) LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit" - EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c -fobjc-gc' + EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c' TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?]) @@ -398,7 +399,9 @@ fi #-------------------------------------------------------------------- if test "x${x_libraries}" != "x"; then + if test "x${x_libraries}" != "xNONE"; then LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}" + fi fi if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` @@ -457,56 +460,6 @@ if test -d /usr/include/mit -a $tk_aqua = no; then fi #-------------------------------------------------------------------- -# Check whether the header and library for the XScreenSaver -# extension are available, and set HAVE_XSS if so. -# XScreenSaver is needed for Tk_GetUserInactiveTime(). -#-------------------------------------------------------------------- - -if test $tk_aqua = no; then - tk_oldCFlags=$CFLAGS - CFLAGS="$CFLAGS $XINCLUDES" - tk_oldLibs=$LIBS - LIBS="$tk_oldLibs $XLIBSW" - xss_header_found=no - xss_lib_found=no - AC_MSG_CHECKING([whether to try to use XScreenSaver]) - AC_ARG_ENABLE(xss, - AC_HELP_STRING([--enable-xss], - [use XScreenSaver for activity timer (default: on)]), - [enable_xss=$enableval], [enable_xss=yes]) - if test "$enable_xss" = "no" ; then - AC_MSG_RESULT([$enable_xss]) - else - AC_MSG_RESULT([$enable_xss]) - AC_CHECK_HEADER(X11/extensions/scrnsaver.h, [ - xss_header_found=yes - ],,[#include <X11/Xlib.h>]) - AC_CHECK_FUNC(XScreenSaverQueryInfo,,[ - AC_CHECK_LIB(Xext, XScreenSaverQueryInfo, [ - XLIBSW="$XLIBSW -lXext" - xss_lib_found=yes - ], [ - AC_CHECK_LIB(Xss, XScreenSaverQueryInfo, [ - if test "$tcl_cv_ld_weak_l" = yes; then - # On Darwin, weak link libXss if possible, - # as it is only available on Tiger or later. - XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext" - else - XLIBSW="$XLIBSW -lXss -lXext" - fi - xss_lib_found=yes - ],, -lXext) - ]) - ]) - fi - if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then - AC_DEFINE(HAVE_XSS, 1, [Is XScreenSaver available?]) - fi - CFLAGS=$tk_oldCFlags - LIBS=$tk_oldLibs -fi - -#-------------------------------------------------------------------- # Check for freetype / fontconfig / Xft support. #-------------------------------------------------------------------- @@ -556,6 +509,18 @@ if test $tk_aqua = no; then CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi + dnl make sure that linking against fontconfig libraries finds Fc* symbols + if test "$found_xft" = "yes" ; then + tk_oldCFlags=$CFLAGS + CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" + tk_oldLibs=$LIBS + LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW -lfontconfig" + AC_CHECK_LIB(fontconfig, FcFontSort, [ + XFT_LIBS="$XFT_LIBS -lfontconfig" + ], []) + CFLAGS=$tk_oldCFlags + LIBS=$tk_oldLibs + fi dnl print a warning if xft is unusable and was specifically requested if test "$found_xft" = "no" ; then if test "$enable_xft" = "yes" ; then @@ -580,6 +545,89 @@ if test $tk_aqua = no; then fi #-------------------------------------------------------------------- +# Check for XkbKeycodeToKeysym. +#-------------------------------------------------------------------- + +if test $tk_aqua = no; then + tk_oldCFlags=$CFLAGS + tk_oldLibs=$LIBS + CFLAGS="$CFLAGS $XINCLUDES" + LIBS="$LIBS $XLIBSW" + AC_CHECK_HEADER(X11/XKBlib.h, [ + xkblib_header_found=yes + ], [ + xkblib_header_found=no + ], [#include <X11/Xlib.h>]) + if test $xkblib_header_found = "yes" ; then + AC_CHECK_LIB(X11, XkbKeycodeToKeysym, [ + xkbkeycodetokeysym_found=yes + ], [ + xkbkeycodetokeysym_found=no + ]) + else + xkbkeycodetokeysym_found=no + fi + if test $xkbkeycodetokeysym_found = "yes" ; then + AC_DEFINE(HAVE_XKBKEYCODETOKEYSYM, 1, [Do we have XkbKeycodeToKeysym?]) + fi + CFLAGS=$tk_oldCFlags + LIBS=$tk_oldLibs +fi + +#-------------------------------------------------------------------- +# XXX Do this last. +# It might modify XLIBSW which could affect other tests. +# +# Check whether the header and library for the XScreenSaver +# extension are available, and set HAVE_XSS if so. +# XScreenSaver is needed for Tk_GetUserInactiveTime(). +#-------------------------------------------------------------------- + +if test $tk_aqua = no; then + tk_oldCFlags=$CFLAGS + CFLAGS="$CFLAGS $XINCLUDES" + tk_oldLibs=$LIBS + LIBS="$tk_oldLibs $XLIBSW" + xss_header_found=no + xss_lib_found=no + AC_MSG_CHECKING([whether to try to use XScreenSaver]) + AC_ARG_ENABLE(xss, + AC_HELP_STRING([--enable-xss], + [use XScreenSaver for activity timer (default: on)]), + [enable_xss=$enableval], [enable_xss=yes]) + if test "$enable_xss" = "no" ; then + AC_MSG_RESULT([$enable_xss]) + else + AC_MSG_RESULT([$enable_xss]) + AC_CHECK_HEADER(X11/extensions/scrnsaver.h, [ + xss_header_found=yes + ],,[#include <X11/Xlib.h>]) + AC_CHECK_FUNC(XScreenSaverQueryInfo,,[ + AC_CHECK_LIB(Xext, XScreenSaverQueryInfo, [ + XLIBSW="$XLIBSW -lXext" + xss_lib_found=yes + ], [ + AC_CHECK_LIB(Xss, XScreenSaverQueryInfo, [ + if test "$tcl_cv_ld_weak_l" = yes; then + # On Darwin, weak link libXss if possible, + # as it is only available on Tiger or later. + XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext" + else + XLIBSW="$XLIBSW -lXss -lXext" + fi + xss_lib_found=yes + ],, -lXext) + ]) + ]) + fi + if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then + AC_DEFINE(HAVE_XSS, 1, [Is XScreenSaver available?]) + fi + CFLAGS=$tk_oldCFlags + LIBS=$tk_oldLibs +fi + +#-------------------------------------------------------------------- # Figure out whether "char" is unsigned. If so, set a # #define for __CHAR_UNSIGNED__. #-------------------------------------------------------------------- @@ -650,7 +698,6 @@ if test "$FRAMEWORK_BUILD" = "1" ; then TK_LIB_FILE="Tk" TK_LIB_FLAG="-framework Tk" TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk" - WISH_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk \${WISH_LIBS}" TK_LIB_SPEC="-F${libdir} -framework Tk" libdir="${libdir}/Tk.framework/Versions/\${VERSION}" TK_LIBRARY="${libdir}/Resources/Scripts" @@ -665,12 +712,13 @@ if test "$FRAMEWORK_BUILD" = "1" ; then EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"' if test $tk_aqua = yes; then - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done' - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"' - bindir="${libdir}/Resources/Wish.app/Contents/MacOS" - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"' - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"' - EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"' + bindir="${libdir}/Resources/Wish.app/Contents/MacOS" + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"' fi EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."' # Don't use AC_DEFINE for the following as the framework version define @@ -684,16 +732,16 @@ else fi # libdir must be a fully qualified path and not ${exec_prefix}/lib eval libdir="$libdir" - if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then - TK_LIB_FLAG="-ltk${TK_VERSION}" - else - TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`" - fi - TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}" if test "${ac_cv_cygwin}" = "yes" -a "$SHARED_BUILD" = "1"; then - WISH_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win -ltk${TK_MAJOR_VERSION}${TK_MINOR_VERSION} \${TCL_LIB_SPEC}" + TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`" + TK_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win ${TK_LIB_FLAG}" else - WISH_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG} \${WISH_LIBS}" + if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then + TK_LIB_FLAG="-ltk${TK_VERSION}" + else + TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`" + fi + TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}" fi TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" fi @@ -750,7 +798,6 @@ AC_SUBST(TK_SHARED_BUILD) AC_SUBST(LD_LIBRARY_PATH_VAR) AC_SUBST(TK_BUILD_LIB_SPEC) -AC_SUBST(WISH_BUILD_LIB_SPEC) AC_SUBST(TCL_STUB_FLAGS) AC_SUBST(XINCLUDES) @@ -760,6 +807,7 @@ AC_SUBST(LOCALES) AC_SUBST(TK_WINDOWINGSYSTEM) AC_SUBST(TK_PKG_DIR) AC_SUBST(TK_LIBRARY) +AC_SUBST(LIB_RUNTIME_DIR) AC_SUBST(PRIVATE_INCLUDE_DIR) AC_SUBST(HTML_DIR) @@ -781,6 +829,7 @@ AC_SUBST(REZ_FLAGS) AC_CONFIG_FILES([ Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in + tk.pc:../unix/tk.pc.in ]) AC_OUTPUT diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 3974753..b9f4896 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -679,7 +679,7 @@ AC_DEFUN([SC_ENABLE_THREADS], [ ac_saved_libs=$LIBS LIBS="$LIBS $THREADS_LIBS" - AC_CHECK_FUNCS(pthread_attr_setstacksize) + AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork) AC_CHECK_FUNC(pthread_attr_get_np,tcl_ok=yes,tcl_ok=no) if test $tcl_ok = yes ; then AC_DEFINE(HAVE_PTHREAD_ATTR_GET_NP, 1, @@ -1246,7 +1246,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LD_SEARCH_FLAGS="" TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.dll.a' - TCL_SHLIB_LD_EXTRAS='-Wl,--out-implib,$[@].a' + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$[@].a" AC_CACHE_CHECK(for Cygwin version of gcc, ac_cv_cygwin, AC_TRY_COMPILE([ @@ -1263,8 +1263,15 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if test "x${TCL_THREADS}" = "x0"; then AC_MSG_ERROR([CYGWIN compile is only supported with --enable-threads]) fi - if test "x${SHARED_BUILD}" = "x1" -a ! -f "../win/tcldde13.dll" -a ! -f "../win/tk85.dll"; then - AC_MSG_ERROR([Please configure and make the ../win directory first.]) + do64bit_ok=yes + if test "x${SHARED_BUILD}" = "x1"; then + echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args" + # The eval makes quoting arguments work. + if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix + then : + else + { echo "configure: error: configure failed for ../win" 1>&2; exit 1; } + fi fi ;; dgux*) @@ -1410,7 +1417,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ ]) ]) ;; - Linux*) + Linux*|GNU*|NetBSD-Debian) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" @@ -1448,18 +1455,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"]) ;; - GNU*) - SHLIB_CFLAGS="-fPIC" - SHLIB_SUFFIX=".so" - - SHLIB_LD='${CC} -shared' - DL_OBJS="" - DL_LIBS="-ldl" - LDFLAGS="$LDFLAGS -Wl,--export-dynamic" - CC_SEARCH_FLAGS="" - LD_SEARCH_FLAGS="" - AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"]) - ;; Lynx*) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" @@ -1493,43 +1488,25 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - NetBSD-1.*|FreeBSD-[[1-2]].*) - SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld -Bshareable -x" - SHLIB_SUFFIX=".so" - DL_OBJS="tclLoadDl.o" - DL_LIBS="" - AS_IF([test $doRpath = yes], [ - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}']) - AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ - AC_EGREP_CPP(yes, [ -#ifdef __ELF__ - yes -#endif - ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) - AS_IF([test $tcl_cv_ld_elf = yes], [ - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' - ], [ - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' - ]) - - # Ancient FreeBSD doesn't handle version numbers with dots. - - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - TCL_LIB_VERSIONS_OK=nodots - ;; OpenBSD-*) arch=`arch -s` case "$arch" in - m88k|vax) + vax) # Equivalent using configure option --disable-load # Step 4 will set the necessary variables DL_OBJS="" SHLIB_LD_LIBS="" + LDFLAGS="" ;; *) - SHLIB_CFLAGS="-fPIC" + case "$arch" in + alpha|sparc64) + SHLIB_CFLAGS="-fPIC" + ;; + *) + SHLIB_CFLAGS="-fpic" + ;; + esac SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" @@ -1538,10 +1515,11 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" ;; esac case "$arch" in - m88k|vax) + vax) CFLAGS_OPTIMIZE="-O1" ;; sh) @@ -1551,15 +1529,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_OPTIMIZE="-O2" ;; esac - AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ - AC_EGREP_CPP(yes, [ -#ifdef __ELF__ - yes -#endif - ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) - AS_IF([test $tcl_cv_ld_elf = yes], [ - LDFLAGS=-Wl,-export-dynamic - ], [LDFLAGS=""]) AS_IF([test "${TCL_THREADS}" = "1"], [ # On OpenBSD: Compile with -pthread # Don't link with -lpthread @@ -1570,9 +1539,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; - NetBSD-*|FreeBSD-[[3-4]].*) - # FreeBSD 3.* and greater have ELF. - # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs + NetBSD-*) + # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" @@ -1588,37 +1556,33 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ]) - case $system in - FreeBSD-3.*) - # FreeBSD-3 doesn't handle version numbers with dots. - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' - TCL_LIB_VERSIONS_OK=nodots - ;; - esac ;; FreeBSD-*) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" - TCL_SHLIB_LD_EXTRAS="-soname \$[@]" + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$[@]" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}']) + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) AS_IF([test "${TCL_THREADS}" = "1"], [ # The -pthread needs to go in the LDFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_LIBS"]) - # Version numbers are dot-stripped by system policy. - TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1' - TCL_LIB_VERSIONS_OK=nodots + case $system in + FreeBSD-3.*) + # Version numbers are dot-stripped by system policy. + TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' + TCL_LIB_VERSIONS_OK=nodots + ;; + esac ;; Darwin-*) CFLAGS_OPTIMIZE="-Os" @@ -2425,9 +2389,9 @@ AC_DEFUN([SC_PATH_X], [ not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then - AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes") + AC_TRY_CPP([#include <X11/Xlib.h>], , not_really_there="yes") else - if test ! -r $x_includes/X11/Intrinsic.h; then + if test ! -r $x_includes/X11/Xlib.h; then not_really_there="yes" fi fi @@ -2435,11 +2399,11 @@ AC_DEFUN([SC_PATH_X], [ if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then AC_MSG_CHECKING([for X11 header files]) found_xincludes="no" - AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no") + AC_TRY_CPP([#include <X11/Xlib.h>], found_xincludes="yes", found_xincludes="no") if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do - if test -r $i/X11/Intrinsic.h; then + if test -r $i/X11/Xlib.h; then AC_MSG_RESULT([$i]) XINCLUDES=" -I$i" found_xincludes="yes" @@ -2815,7 +2779,7 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [ # Now check for auxiliary declarations AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[ AC_TRY_COMPILE([#include <sys/types.h> -#include <sys/dirent.h>],[struct dirent64 p;], +#include <dirent.h>],[struct dirent64 p;], tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?]) diff --git a/unix/tk.pc.in b/unix/tk.pc.in new file mode 100644 index 0000000..a632bc8 --- /dev/null +++ b/unix/tk.pc.in @@ -0,0 +1,15 @@ +# tk pkg-config source file + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: The Tk Toolkit +Description: Tk is a cross-platform graphical user interface toolkit, the standard GUI not only for Tcl, but for many other dynamic languages as well. +URL: http://www.tcl.tk/ +Version: @TK_VERSION@@TK_PATCH_LEVEL@ +Requires: tcl >= 8.5 +Libs: -L${libdir} @TK_LIB_FLAG@ +Libs.private: @XFT_LIBS@ @XLIBSW@ +Cflags: -I${includedir} diff --git a/unix/tk.spec b/unix/tk.spec index ecf17c4..32c0520 100644 --- a/unix/tk.spec +++ b/unix/tk.spec @@ -4,7 +4,7 @@ Name: tk Summary: Tk graphical toolkit for the Tcl scripting language. -Version: 8.5.13 +Version: 8.5.17 Release: 2 License: BSD Group: Development/Languages diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in index 74f6d73..732bf94 100644 --- a/unix/tkConfig.h.in +++ b/unix/tkConfig.h.in @@ -43,6 +43,9 @@ /* Define to 1 if you have the `open64' function. */ #undef HAVE_OPEN64 +/* Define to 1 if you have the `pthread_atfork' function. */ +#undef HAVE_PTHREAD_ATFORK + /* Do we want a BSD-like thread-attribute interface? */ #undef HAVE_PTHREAD_ATTR_GET_NP @@ -103,6 +106,9 @@ /* Have we turned on XFT (antialiased fonts)? */ #undef HAVE_XFT +/* Do we have XkbKeycodeToKeysym? */ +#undef HAVE_XKBKEYCODETOKEYSYM + /* Is XScreenSaver available? */ #undef HAVE_XSS diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 59fba29..eb83474 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -12,6 +12,11 @@ #include "tkUnixInt.h" #include <signal.h> +#ifdef HAVE_XKBKEYCODETOKEYSYM +# include <X11/XKBlib.h> +#else +# define XkbOpenDisplay(D,V,E,M,m,R) ((V),(E),(M),(m),(R),(NULL)) +#endif /* * The following static indicates whether this module has been initialized in @@ -116,7 +121,33 @@ TkpOpenDisplay( CONST char *displayNameStr) { TkDisplay *dispPtr; - Display *display = XOpenDisplay(displayNameStr); + Display *display; + int event = 0; + int error = 0; + int major = 1; + int minor = 0; + int reason = 0; + unsigned int use_xkb = 0; + + /* + ** Bug [3607830]: Before using Xkb, it must be initialized and confirmed + ** that the serve supports it. The XkbOpenDisplay call + ** will perform this check and return NULL if the extension + ** is not supported. + ** + ** Work around un-const-ified Xkb headers using (char *) cast. + */ + display = XkbOpenDisplay((char *)displayNameStr, &event, &error, &major, + &minor, &reason); + + if (display == NULL) { + /*fprintf(stderr,"event=%d error=%d major=%d minor=%d reason=%d\nDisabling xkb\n", + event, error, major, minor, reason);*/ + display = XOpenDisplay(displayNameStr); + } else { + use_xkb = TK_DISPLAY_USE_XKB; + /*fprintf(stderr, "Using xkb %d.%d\n", major, minor);*/ + } if (display == NULL) { return NULL; @@ -124,6 +155,7 @@ TkpOpenDisplay( dispPtr = (TkDisplay *) ckalloc(sizeof(TkDisplay)); memset(dispPtr, 0, sizeof(TkDisplay)); dispPtr->display = display; + dispPtr->flags |= use_xkb; #ifdef TK_USE_INPUT_METHODS OpenIM(dispPtr); #endif diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c index b7fc97f..40cc779 100644 --- a/unix/tkUnixKey.c +++ b/unix/tkUnixKey.c @@ -11,7 +11,21 @@ */ #include "tkInt.h" -#include <X11/XKBlib.h> + +/* +** Bug [3607830]: Before using Xkb, it must be initialized. TkpOpenDisplay +** does this and sets the USE_XKB flag if xkb is supported. +** (should this be function ptr?) +*/ +#ifdef HAVE_XKBKEYCODETOKEYSYM +# include <X11/XKBlib.h> +#else +# define XkbKeycodeToKeysym(D,K,G,L) XKeycodeToKeysym(D,K,L) +#endif +#define TkKeycodeToKeysym(D,K,G,L) \ + ((D)->flags & TK_DISPLAY_USE_XKB) ? \ + XkbKeycodeToKeysym((D)->display,K,G,L) : \ + XKeycodeToKeysym((D)->display,K,L) /* * Prototypes for local functions defined in this file: @@ -212,7 +226,7 @@ TkpGetString( /* * When mapping from a keysym to a keycode, need information about the - * modifier state to be used so that when they call XkbKeycodeToKeysym taking + * modifier state to be used so that when they call TkKeycodeToKeysym taking * into account the xkey.state, they will get back the original keysym. */ @@ -222,27 +236,23 @@ TkpSetKeycodeAndState( KeySym keySym, XEvent *eventPtr) { - Display *display; + TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; int state; KeyCode keycode; - display = Tk_Display(tkwin); - if (keySym == NoSymbol) { keycode = 0; } else { - keycode = XKeysymToKeycode(display, keySym); + keycode = XKeysymToKeycode(dispPtr->display, keySym); } + eventPtr->xkey.keycode = keycode; if (keycode != 0) { for (state = 0; state < 4; state++) { - if (XkbKeycodeToKeysym(display, keycode, 0, state) == keySym) { + if (XLookupKeysym(&eventPtr->xkey, state) == keySym) { if (state & 1) { eventPtr->xkey.state |= ShiftMask; } if (state & 2) { - TkDisplay *dispPtr; - - dispPtr = ((TkWindow *) tkwin)->dispPtr; eventPtr->xkey.state |= dispPtr->modeModMask; } break; @@ -280,6 +290,15 @@ TkpGetKeySym( int index; TkKeyEvent* kePtr = (TkKeyEvent*) eventPtr; + /* + * Refresh the mapping information if it's stale. This must happen before + * we do any input method processing. [Bug 3599312] + */ + + if (dispPtr->bindInfoStale) { + TkpInitKeymapInfo(dispPtr); + } + #ifdef TK_USE_INPUT_METHODS /* * If input methods are active, we may already have determined a keysym. @@ -292,6 +311,7 @@ TkpGetKeySym( Tcl_DString ds; TkWindow *winPtr = (TkWindow *) Tk_IdToWindow(eventPtr->xany.display, eventPtr->xany.window); + Tcl_DStringInit(&ds); (void) TkpGetString(winPtr, eventPtr, &ds); Tcl_DStringFree(&ds); @@ -303,14 +323,6 @@ TkpGetKeySym( #endif /* - * Refresh the mapping information if it's stale - */ - - if (dispPtr->bindInfoStale) { - TkpInitKeymapInfo(dispPtr); - } - - /* * Figure out which of the four slots in the keymap vector to use for this * key. Refer to Xlib documentation for more info on how this computation * works. @@ -325,7 +337,7 @@ TkpGetKeySym( && (eventPtr->xkey.state & LockMask))) { index += 1; } - sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, 0, + sym = TkKeycodeToKeysym(dispPtr, eventPtr->xkey.keycode, 0, index); /* @@ -340,7 +352,7 @@ TkpGetKeySym( || ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis)) || ((sym >= XK_Ooblique) && (sym <= XK_Thorn)))) { index &= ~1; - sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, + sym = TkKeycodeToKeysym(dispPtr, eventPtr->xkey.keycode, 0, index); } } @@ -351,7 +363,7 @@ TkpGetKeySym( */ if ((index & 1) && (sym == NoSymbol)) { - sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, + sym = TkKeycodeToKeysym(dispPtr, eventPtr->xkey.keycode, 0, index & ~1); } return sym; @@ -401,7 +413,7 @@ TkpInitKeymapInfo( if (*codePtr == 0) { continue; } - keysym = XkbKeycodeToKeysym(dispPtr->display, *codePtr, 0, 0); + keysym = TkKeycodeToKeysym(dispPtr, *codePtr, 0, 0); if (keysym == XK_Shift_Lock) { dispPtr->lockUsage = LU_SHIFT; break; @@ -427,7 +439,7 @@ TkpInitKeymapInfo( if (*codePtr == 0) { continue; } - keysym = XkbKeycodeToKeysym(dispPtr->display, *codePtr, 0, 0); + keysym = TkKeycodeToKeysym(dispPtr, *codePtr, 0, 0); if (keysym == XK_Mode_switch) { dispPtr->modeModMask |= ShiftMask << (i/modMapPtr->max_keypermod); } diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 6e7a701..d122c8c 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -129,6 +129,7 @@ #endif #ifdef __CYGWIN__ +# include "tkIntXlibDecls.h" # define UINT unsigned int # define HWND void * # define HDC void * @@ -142,9 +143,6 @@ # define LPARAM void * # define LRESULT void * - extern int TkPutImage(unsigned long *, int, Display *, Drawable, - GC, XImage *, int, int, int, int, unsigned int, unsigned int); - #else /* !__CYGWIN__ */ /* * The TkPutImage macro strips off the color table information, which isn't diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index e158549..71f9ea8 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -262,7 +262,7 @@ DisplayVerticalValue( { register Tk_Window tkwin = scalePtr->tkwin; int y, width, length; - char valueString[PRINT_CHARS]; + char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); @@ -341,7 +341,7 @@ DisplayHorizontalScale( */ if (tickInterval != 0) { - char valueString[PRINT_CHARS]; + char valueString[TCL_DOUBLE_SPACE]; double ticks, maxTicks; /* @@ -478,7 +478,7 @@ DisplayHorizontalValue( { register Tk_Window tkwin = scalePtr->tkwin; int x, y, length, width; - char valueString[PRINT_CHARS]; + char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; x = TkScaleValueToPixel(scalePtr, value); @@ -535,7 +535,7 @@ TkpDisplayScale( Tcl_Interp *interp = scalePtr->interp; Pixmap pixmap; int result; - char string[PRINT_CHARS]; + char string[TCL_DOUBLE_SPACE]; XRectangle drawnArea; scalePtr->flags &= ~REDRAW_PENDING; diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index fb4cdd4..3fb745e 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -1022,7 +1022,7 @@ Tk_SendCmd( localInterp = riPtr->interp; Tcl_Preserve((ClientData) localInterp); if (firstArg == (argc-1)) { - result = Tcl_GlobalEval(localInterp, argv[firstArg]); + result = Tcl_EvalEx(localInterp, argv[firstArg], -1, TCL_EVAL_GLOBAL); } else { Tcl_DStringInit(&request); Tcl_DStringAppend(&request, argv[firstArg], -1); @@ -1030,7 +1030,7 @@ Tk_SendCmd( Tcl_DStringAppend(&request, " ", 1); Tcl_DStringAppend(&request, argv[i], -1); } - result = Tcl_GlobalEval(localInterp, Tcl_DStringValue(&request)); + result = Tcl_EvalEx(localInterp, Tcl_DStringValue(&request), -1, TCL_EVAL_GLOBAL); Tcl_DStringFree(&request); } if (interp != localInterp) { @@ -1556,7 +1556,7 @@ SendEventProc( remoteInterp = riPtr->interp; Tcl_Preserve((ClientData) remoteInterp); - result = Tcl_GlobalEval(remoteInterp, script); + result = Tcl_EvalEx(remoteInterp, script, -1, TCL_EVAL_GLOBAL); /* * The call to Tcl_Release may have released the interpreter which diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 940cf73..d230b9f 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -6206,7 +6206,7 @@ TkWmProtocolEventProc( Tcl_Preserve((ClientData) protPtr); interp = protPtr->interp; Tcl_Preserve((ClientData) interp); - result = Tcl_GlobalEval(interp, protPtr->command); + result = Tcl_EvalEx(interp, protPtr->command, -1, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command for \""); Tcl_AddErrorInfo(interp, protocolName); diff --git a/win/Makefile.in b/win/Makefile.in index eda2aed..1d18b60 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -4,8 +4,6 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. -TCLVERSION = @TCL_VERSION@ -TCLPATCHL = @TCL_PATCH_LEVEL@ VERSION = @TK_VERSION@ PATCH_LEVEL = @TK_PATCH_LEVEL@ @@ -165,7 +163,7 @@ LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. -NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED +NO_DEPRECATED_FLAGS = #NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED # To change the compiler switches, for example to change from optimization to @@ -352,7 +350,6 @@ TK_OBJS = \ tkUtil.$(OBJEXT) \ tkVisual.$(OBJEXT) \ tkStubInit.$(OBJEXT) \ - tkStubLib.$(OBJEXT) \ tkWindow.$(OBJEXT) \ $(TTK_OBJS) @@ -484,12 +481,12 @@ install-binaries: binaries @echo "Creating package index $(PKG_INDEX)"; @$(RM) $(PKG_INDEX); @(\ - echo "if {[catch {package present Tcl $(TCLVERSION).0}]} return";\ + echo "if {[catch {package present Tcl 8.5.0}]} return";\ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\ - echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file join \$$dir .. .. bin libtk$(VERSION).dll] Tk]";\ + echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]] Tk]";\ echo "} else {";\ - echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file join \$$dir .. .. bin $(TK_DLL_FILE)] Tk]";\ + echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE)]] Tk]";\ echo "}";\ ) > $(PKG_INDEX); @for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \ @@ -635,7 +632,7 @@ $(CAT32): cat32.${OBJEXT} ${TK_STUB_LIB_FILE}: ${STUB_OBJS} @$(RM) ${TK_STUB_LIB_FILE} - @MAKE_LIB@ ${STUB_OBJS} + @MAKE_STUB_LIB@ ${STUB_OBJS} @POST_MAKE_LIB@ ${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES) diff --git a/win/configure b/win/configure index 5cc7819..7a009e7 100755 --- a/win/configure +++ b/win/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR ac_ct_AR RANLIB ac_ct_RANLIB RC ac_ct_RC SET_MAKE TCL_THREADS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_DEFS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING MAN2TCLFLAGS CFLAGS_DEFAULT LDFLAGS_DEFAULT VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE BUILD_TCLSH TCLSH_PROG TK_WIN_VERSION MACHINE TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_DBGX TK_LIB_FILE TK_DLL_FILE TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_BUILD_STUB_LIB_SPEC TK_SRC_DIR TK_BIN_DIR TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_DBGX CFG_TK_SHARED_LIB_SUFFIX CFG_TK_UNSHARED_LIB_SUFFIX CFG_TK_EXPORT_FILE_SUFFIX TK_SHARED_BUILD DEPARG EXTRA_CFLAGS STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES TK_RES RES LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TK_LIB_FLAG TK_LIB_SPEC TK_BUILD_LIB_SPEC TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_BUILD_STUB_LIB_PATH TK_CC_SEARCH_FLAGS TK_LD_SEARCH_FLAGS LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR ac_ct_AR RANLIB ac_ct_RANLIB RC ac_ct_RC SET_MAKE TCL_THREADS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_DEFS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING MAN2TCLFLAGS CFLAGS_DEFAULT LDFLAGS_DEFAULT VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE BUILD_TCLSH TCLSH_PROG TK_WIN_VERSION MACHINE TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_DBGX TK_LIB_FILE TK_DLL_FILE TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_BUILD_STUB_LIB_SPEC TK_SRC_DIR TK_BIN_DIR TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_DBGX CFG_TK_SHARED_LIB_SUFFIX CFG_TK_UNSHARED_LIB_SUFFIX CFG_TK_EXPORT_FILE_SUFFIX TK_SHARED_BUILD DEPARG EXTRA_CFLAGS STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES TK_RES RES LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB MAKE_STUB_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TK_LIB_FLAG TK_LIB_SPEC TK_BUILD_LIB_SPEC TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_BUILD_STUB_LIB_PATH TK_CC_SEARCH_FLAGS TK_LD_SEARCH_FLAGS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -851,7 +851,8 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-tcl=DIR use Tcl 8.5 binaries from DIR + --with-tcl directory containing tcl configuration + (tclConfig.sh) --with-celib=DIR use Windows/CE support library from DIR Some influential environment variables: @@ -1311,7 +1312,7 @@ SHELL=/bin/sh TK_VERSION=8.5 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=5 -TK_PATCH_LEVEL=".13" +TK_PATCH_LEVEL=".17" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ @@ -3103,7 +3104,8 @@ echo "${ECHO_T}shared" >&6 echo "$as_me:$LINENO: result: static" >&5 echo "${ECHO_T}static" >&6 SHARED_BUILD=0 - cat >>confdefs.h <<\_ACEOF + +cat >>confdefs.h <<\_ACEOF #define STATIC_BUILD 1 _ACEOF @@ -3115,52 +3117,129 @@ _ACEOF #-------------------------------------------------------------------- - echo "$as_me:$LINENO: checking the location of tclConfig.sh" >&5 -echo $ECHO_N "checking the location of tclConfig.sh... $ECHO_C" >&6 - - if test -d ../../tcl8.5$TK_PATCH_LEVEL/win; then - TCL_BIN_DIR_DEFAULT=../../tcl8.5$TK_PATCH_LEVEL/win - elif test -d ../../tcl8.5/win; then - TCL_BIN_DIR_DEFAULT=../../tcl8.5/win - else - TCL_BIN_DIR_DEFAULT=../../tcl/win - fi + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + if test x"${no_tcl}" = x ; then + # we reset no_tcl in case something fails here + no_tcl=true # Check whether --with-tcl or --without-tcl was given. if test "${with_tcl+set}" = set; then withval="$with_tcl" - TCL_BIN_DIR=$withval -else - TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd` + with_tclconfig="${withval}" fi; - if test ! -d $TCL_BIN_DIR; then - { { echo "$as_me:$LINENO: error: Tcl directory $TCL_BIN_DIR does not exist" >&5 -echo "$as_me: error: Tcl directory $TCL_BIN_DIR does not exist" >&2;} + echo "$as_me:$LINENO: checking for Tcl configuration" >&5 +echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6 + if test "${ac_cv_c_tclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-tcl was specified. + if test x"${with_tclconfig}" != x ; then + case "${with_tclconfig}" in + */tclConfig.sh ) + if test -f "${with_tclconfig}"; then + { echo "$as_me:$LINENO: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5 +echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;} + with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`" + fi ;; + esac + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`" + else + { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 +echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;} { (exit 1); exit 1; }; } - fi - if test ! -f $TCL_BIN_DIR/tclConfig.sh; then - if test ! -f $TCL_BIN_DIR/../unix/tclConfig.sh; then - { { echo "$as_me:$LINENO: error: There is no tclConfig.sh in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?" >&5 -echo "$as_me: error: There is no tclConfig.sh in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?" >&2;} + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ + `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \ + `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ + `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \ + `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../../tcl \ + `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ + `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \ + `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/win/tclConfig.sh" ; then + ac_cv_c_tclconfig="`(cd $i/win; pwd)`" + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /cygdrive/c/Tcl/lib 2>/dev/null` \ + `ls -d /cygdrive/c/Progra~1/Tcl/lib 2>/dev/null` \ + `ls -d /c/Tcl/lib 2>/dev/null` \ + `ls -d /c/Progra~1/Tcl/lib 2>/dev/null` \ + `ls -d C:/Tcl/lib 2>/dev/null` \ + `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ + ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig="`(cd $i; pwd)`" + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/win/tclConfig.sh" ; then + ac_cv_c_tclconfig="`(cd $i/win; pwd)`" + break + fi + done + fi + +fi + + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + { { echo "$as_me:$LINENO: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&5 +echo "$as_me: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&2;} { (exit 1); exit 1; }; } + else + no_tcl= + TCL_BIN_DIR="${ac_cv_c_tclconfig}" + echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5 +echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6 fi - TCL_BIN_DIR=`cd ${TCL_BIN_DIR}/../unix; pwd` fi - echo "$as_me:$LINENO: result: $TCL_BIN_DIR/tclConfig.sh" >&5 -echo "${ECHO_T}$TCL_BIN_DIR/tclConfig.sh" >&6 - echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 -echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5 +echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6 - if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then echo "$as_me:$LINENO: result: loading" >&5 echo "${ECHO_T}loading" >&6 - . $TCL_BIN_DIR/tclConfig.sh + . "${TCL_BIN_DIR}/tclConfig.sh" else - echo "$as_me:$LINENO: result: file not found" >&5 -echo "${ECHO_T}file not found" >&6 + echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 +echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6 fi # @@ -3495,6 +3574,8 @@ echo "${ECHO_T}yes" >&6 # set various compiler flags depending on whether we are using gcc or cl if test "${GCC}" = "yes" ; then + extra_cflags="-pipe" + extra_ldflags="-pipe -static-libgcc" echo "$as_me:$LINENO: checking for mingw32 version of gcc" >&5 echo $ECHO_N "checking for mingw32 version of gcc... $ECHO_C" >&6 if test "${ac_cv_win32+set}" = set; then @@ -3575,13 +3656,11 @@ echo $ECHO_N "checking compiler flags... $ECHO_C" >&6 RC_DEFINE=--define RES=res.o MAKE_LIB="\${STLIB_LD} \$@" + MAKE_STUB_LIB="\${STLIB_LD} \$@" POST_MAKE_LIB="\${RANLIB} \$@" MAKE_EXE="\${CC} -o \$@" LIBPREFIX="lib" - extra_cflags="-pipe" - extra_ldflags="-pipe" - if test "${SHARED_BUILD}" = "0" ; then # static echo "$as_me:$LINENO: result: using static flags" >&5 @@ -3608,9 +3687,8 @@ echo "$as_me: error: ${CC} does not support the -shared option. runtime= # Link with gcc since ld does not link to default libs like - # -luser32 and -lmsvcrt by default. Make sure CFLAGS is - # included so -mno-cygwin passed the correct libs to the linker. - SHLIB_LD='${CC} -shared ${CFLAGS}' + # -luser32 and -lmsvcrt by default. + SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' # Add SHLIB_LD_LIBS to the Make rule, not here. MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \$@ ${extra_ldflags} \ @@ -3991,6 +4069,7 @@ _ACEOF RC_DEFINE=-d RES=res MAKE_LIB="\${STLIB_LD} -out:\$@" + MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\$@" POST_MAKE_LIB= MAKE_EXE="\${CC} -Fe\$@" LIBPREFIX="" @@ -4928,6 +5007,7 @@ TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.` + # undefined at this point for win @@ -5658,6 +5738,7 @@ s,@LIBSUFFIX@,$LIBSUFFIX,;t t s,@EXESUFFIX@,$EXESUFFIX,;t t s,@LIBRARIES@,$LIBRARIES,;t t s,@MAKE_LIB@,$MAKE_LIB,;t t +s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t s,@POST_MAKE_LIB@,$POST_MAKE_LIB,;t t s,@MAKE_DLL@,$MAKE_DLL,;t t s,@MAKE_EXE@,$MAKE_EXE,;t t diff --git a/win/configure.in b/win/configure.in index ef517e6..78cc2e7 100644 --- a/win/configure.in +++ b/win/configure.in @@ -14,7 +14,7 @@ SHELL=/bin/sh TK_VERSION=8.5 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=5 -TK_PATCH_LEVEL=".13" +TK_PATCH_LEVEL=".17" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ @@ -271,6 +271,7 @@ AC_SUBST(LIBSUFFIX) AC_SUBST(EXESUFFIX) AC_SUBST(LIBRARIES) AC_SUBST(MAKE_LIB) +AC_SUBST(MAKE_STUB_LIB) AC_SUBST(POST_MAKE_LIB) AC_SUBST(MAKE_DLL) AC_SUBST(MAKE_EXE) diff --git a/win/makefile.bc b/win/makefile.bc index 12fd5b8..295ed23 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -225,7 +225,6 @@ TKOBJS = \ $(TMPDIR)\tkUtil.obj \ $(TMPDIR)\tkVisual.obj \ $(TMPDIR)\tkStubInit.obj \ - $(TMPDIR)\tkStubLib.obj \ $(TMPDIR)\tkWindow.obj # Maintenance hint: Please have multiple members of TKSTUBOBJS be separated diff --git a/win/makefile.vc b/win/makefile.vc index 68df470..8fbe917 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -360,7 +360,6 @@ TKOBJS = \ $(TMP_DIR)\tkUtil.obj \ $(TMP_DIR)\tkVisual.obj \ $(TMP_DIR)\tkStubInit.obj \ - $(TMP_DIR)\tkStubLib.obj \ $(TMP_DIR)\tkWindow.obj \ $(TTK_OBJS) \ !if !$(STATIC_BUILD) @@ -649,7 +648,7 @@ $** $(TKSTUBLIB): $(TKSTUBOBJS) - $(lib32) -nologo -out:$@ $** + $(lib32) -nologo -nodefaultlib -out:$@ $** $(WISH): $(WISHOBJS) $(TKIMPLIB) @@ -702,7 +701,7 @@ CHMFILE=$(HTMLDIR)\$(HTMLBASE).chm htmlhelp: chmsetup $(CHMFILE) $(CHMFILE): $(DOCDIR)\* - @$(TCLSH) $(TOOLSDIR)\tcltk-man2html.tcl + @$(TCLSH) $(TCLTOOLSDIR)\tcltk-man2html.tcl @echo Compiling HTML help project @$(HHC) <<$(HHPFILE) >NUL [OPTIONS] @@ -3,50 +3,124 @@ # # Locate the tclConfig.sh file and perform a sanity check on # the Tcl compile flags -# Currently a no-op for Windows # # Arguments: -# PATCH_LEVEL The patch level for Tcl if any. +# none # # Results: # # Adds the following arguments to configure: # --with-tcl=... # -# Sets the following vars: -# TCL_BIN_DIR Full path to the tclConfig.sh file +# Defines the following vars: +# TCL_BIN_DIR Full path to the directory containing +# the tclConfig.sh file #------------------------------------------------------------------------ AC_DEFUN([SC_PATH_TCLCONFIG], [ - AC_MSG_CHECKING([the location of tclConfig.sh]) + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # - if test -d ../../tcl8.5$1/win; then - TCL_BIN_DIR_DEFAULT=../../tcl8.5$1/win - elif test -d ../../tcl8.5/win; then - TCL_BIN_DIR_DEFAULT=../../tcl8.5/win - else - TCL_BIN_DIR_DEFAULT=../../tcl/win - fi + if test x"${no_tcl}" = x ; then + # we reset no_tcl in case something fails here + no_tcl=true + AC_ARG_WITH(tcl, + AC_HELP_STRING([--with-tcl], + [directory containing tcl configuration (tclConfig.sh)]), + with_tclconfig="${withval}") + AC_MSG_CHECKING([for Tcl configuration]) + AC_CACHE_VAL(ac_cv_c_tclconfig,[ + + # First check to see if --with-tcl was specified. + if test x"${with_tclconfig}" != x ; then + case "${with_tclconfig}" in + */tclConfig.sh ) + if test -f "${with_tclconfig}"; then + AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself]) + with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`" + fi ;; + esac + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`" + else + AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) + fi + fi - AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.5 binaries from DIR], - TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`) - if test ! -d $TCL_BIN_DIR; then - AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist) - fi - if test ! -f $TCL_BIN_DIR/tclConfig.sh; then - if test ! -f $TCL_BIN_DIR/../unix/tclConfig.sh; then - AC_MSG_ERROR(There is no tclConfig.sh in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../../tcl \ + `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do + if test -f "$i/win/tclConfig.sh" ; then + ac_cv_c_tclconfig="`(cd $i/win; pwd)`" + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /cygdrive/c/Tcl/lib 2>/dev/null` \ + `ls -d /cygdrive/c/Progra~1/Tcl/lib 2>/dev/null` \ + `ls -d /c/Tcl/lib 2>/dev/null` \ + `ls -d /c/Progra~1/Tcl/lib 2>/dev/null` \ + `ls -d C:/Tcl/lib 2>/dev/null` \ + `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ + ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig="`(cd $i; pwd)`" + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do + if test -f "$i/win/tclConfig.sh" ; then + ac_cv_c_tclconfig="`(cd $i/win; pwd)`" + break + fi + done + fi + ]) + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh]) + else + no_tcl= + TCL_BIN_DIR="${ac_cv_c_tclconfig}" + AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh]) fi - TCL_BIN_DIR=`cd ${TCL_BIN_DIR}/../unix; pwd` fi - AC_MSG_RESULT($TCL_BIN_DIR/tclConfig.sh) ]) #------------------------------------------------------------------------ # SC_PATH_TKCONFIG -- # # Locate the tkConfig.sh file -# Currently a no-op for Windows # # Arguments: # none @@ -56,31 +130,109 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ # Adds the following arguments to configure: # --with-tk=... # -# Sets the following vars: -# TK_BIN_DIR Full path to the tkConfig.sh file +# Defines the following vars: +# TK_BIN_DIR Full path to the directory containing +# the tkConfig.sh file #------------------------------------------------------------------------ AC_DEFUN([SC_PATH_TKCONFIG], [ - AC_MSG_CHECKING([the location of tkConfig.sh]) + # + # Ok, lets find the tk configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tk + # - if test -d ../../tk8.5$1/win; then - TK_BIN_DIR_DEFAULT=../../tk8.5$1/win - elif test -d ../../tk8.5/win; then - TK_BIN_DIR_DEFAULT=../../tk8.5/win - else - TK_BIN_DIR_DEFAULT=../../tk/win - fi + if test x"${no_tk}" = x ; then + # we reset no_tk in case something fails here + no_tk=true + AC_ARG_WITH(tk, + AC_HELP_STRING([--with-tk], + [directory containing tk configuration (tkConfig.sh)]), + with_tkconfig="${withval}") + AC_MSG_CHECKING([for Tk configuration]) + AC_CACHE_VAL(ac_cv_c_tkconfig,[ + + # First check to see if --with-tkconfig was specified. + if test x"${with_tkconfig}" != x ; then + case "${with_tkconfig}" in + */tkConfig.sh ) + if test -f "${with_tkconfig}"; then + AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself]) + with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`" + fi ;; + esac + if test -f "${with_tkconfig}/tkConfig.sh" ; then + ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`" + else + AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh]) + fi + fi - AC_ARG_WITH(tk, [ --with-tk=DIR use Tk 8.5 binaries from DIR], - TK_BIN_DIR=$withval, TK_BIN_DIR=`cd $TK_BIN_DIR_DEFAULT; pwd`) - if test ! -d $TK_BIN_DIR; then - AC_MSG_ERROR(Tk directory $TK_BIN_DIR does not exist) - fi - if test ! -f $TK_BIN_DIR/tkConfig.sh; then - AC_MSG_ERROR(There is no tkConfig.sh in $TK_BIN_DIR: perhaps you did not specify the Tk *build* directory (not the toplevel Tk directory) or you forgot to configure Tk?) - fi + # then check for a private Tk library + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in \ + ../tk \ + `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../tk \ + `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../../tk \ + `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do + if test -f "$i/win/tkConfig.sh" ; then + ac_cv_c_tkconfig="`(cd $i/win; pwd)`" + break + fi + done + fi - AC_MSG_RESULT([$TK_BIN_DIR/tkConfig.sh]) + # check in a few common install locations + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /cygdrive/c/Tcl/lib 2>/dev/null` \ + `ls -d /cygdrive/c/Progra~1/Tcl/lib 2>/dev/null` \ + `ls -d /c/Tcl/lib 2>/dev/null` \ + `ls -d /c/Progra~1/Tcl/lib 2>/dev/null` \ + `ls -d C:/Tcl/lib 2>/dev/null` \ + `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ + ; do + if test -f "$i/tkConfig.sh" ; then + ac_cv_c_tkconfig="`(cd $i; pwd)`" + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in \ + ${srcdir}/../tk \ + `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do + if test -f "$i/win/tkConfig.sh" ; then + ac_cv_c_tkconfig="`(cd $i/win; pwd)`" + break + fi + done + fi + ]) + + if test x"${ac_cv_c_tkconfig}" = x ; then + TK_BIN_DIR="# no Tk configs found" + AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh]) + else + no_tk= + TK_BIN_DIR="${ac_cv_c_tkconfig}" + AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh]) + fi + fi ]) #------------------------------------------------------------------------ @@ -103,13 +255,13 @@ AC_DEFUN([SC_PATH_TKCONFIG], [ #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TCLCONFIG], [ - AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) + AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) - if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then AC_MSG_RESULT([loading]) - . $TCL_BIN_DIR/tclConfig.sh + . "${TCL_BIN_DIR}/tclConfig.sh" else - AC_MSG_RESULT([file not found]) + AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh]) fi # @@ -158,7 +310,6 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ # SC_LOAD_TKCONFIG -- # # Load the tkConfig.sh file -# Currently a no-op for Windows # # Arguments: # @@ -172,13 +323,13 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TKCONFIG], [ - AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh]) + AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh]) - if test -f "$TK_BIN_DIR/tkConfig.sh" ; then + if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then AC_MSG_RESULT([loading]) - . $TK_BIN_DIR/tkConfig.sh + . "${TK_BIN_DIR}/tkConfig.sh" else - AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh]) + AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh]) fi @@ -212,7 +363,7 @@ AC_DEFUN([SC_ENABLE_SHARED], [ AC_MSG_CHECKING([how to build libraries]) AC_ARG_ENABLE(shared, [ --enable-shared build and link with shared libraries (default: on)], - [tcl_ok=$enableval], [tcl_ok=yes]) + [tcl_ok=$enableval], [tcl_ok=yes]) if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -227,7 +378,7 @@ AC_DEFUN([SC_ENABLE_SHARED], [ else AC_MSG_RESULT([static]) SHARED_BUILD=0 - AC_DEFINE(STATIC_BUILD) + AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) fi ]) @@ -270,7 +421,7 @@ AC_DEFUN([SC_ENABLE_THREADS], [ #------------------------------------------------------------------------ # SC_ENABLE_SYMBOLS -- # -# Specify if debugging symbols should be used +# Specify if debugging symbols should be used. # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging # can also be enabled. # @@ -372,6 +523,7 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [ # RES # # MAKE_LIB +# MAKE_STUB_LIB # MAKE_EXE # MAKE_DLL # @@ -481,6 +633,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # set various compiler flags depending on whether we are using gcc or cl if test "${GCC}" = "yes" ; then + extra_cflags="-pipe" + extra_ldflags="-pipe -static-libgcc" AC_CACHE_CHECK(for mingw32 version of gcc, ac_cv_win32, AC_TRY_COMPILE([ @@ -510,13 +664,11 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ RC_DEFINE=--define RES=res.o MAKE_LIB="\${STLIB_LD} \[$]@" + MAKE_STUB_LIB="\${STLIB_LD} \[$]@" POST_MAKE_LIB="\${RANLIB} \[$]@" MAKE_EXE="\${CC} -o \[$]@" LIBPREFIX="lib" - extra_cflags="-pipe" - extra_ldflags="-pipe" - if test "${SHARED_BUILD}" = "0" ; then # static AC_MSG_RESULT([using static flags]) @@ -538,9 +690,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ runtime= # Link with gcc since ld does not link to default libs like - # -luser32 and -lmsvcrt by default. Make sure CFLAGS is - # included so -mno-cygwin passed the correct libs to the linker. - SHLIB_LD='${CC} -shared ${CFLAGS}' + # -luser32 and -lmsvcrt by default. + SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' # Add SHLIB_LD_LIBS to the Make rule, not here. MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \ @@ -798,6 +949,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ RC_DEFINE=-d RES=res MAKE_LIB="\${STLIB_LD} -out:\[$]@" + MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[$]@" POST_MAKE_LIB= MAKE_EXE="\${CC} -Fe\[$]@" LIBPREFIX="" diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c index efefe86..3c3d83a 100644 --- a/win/tkWin32Dll.c +++ b/win/tkWin32Dll.c @@ -17,17 +17,17 @@ /* * Unlike Borland and Microsoft, we don't register exception handlers by * pushing registration records onto the runtime stack. Instead, we register - * them by creating an EXCEPTION_REGISTRATION within the activation record. + * them by creating an TCLEXCEPTION_REGISTRATION within the activation record. */ -typedef struct EXCEPTION_REGISTRATION { - struct EXCEPTION_REGISTRATION *link; +typedef struct TCLEXCEPTION_REGISTRATION { + struct TCLEXCEPTION_REGISTRATION *link; EXCEPTION_DISPOSITION (*handler)( struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); void *ebp; void *esp; int status; -} EXCEPTION_REGISTRATION; +} TCLEXCEPTION_REGISTRATION; /* * Need to add noinline flag to DllMain declaration so that gcc -O3 does not @@ -102,7 +102,7 @@ DllMain( LPVOID reserved) { #ifdef HAVE_NO_SEH - EXCEPTION_REGISTRATION registration; + TCLEXCEPTION_REGISTRATION registration; #endif /* @@ -127,21 +127,21 @@ DllMain( __asm__ __volatile__ ( /* - * Construct an EXCEPTION_REGISTRATION to protect the call to + * Construct an TCLEXCEPTION_REGISTRATION to protect the call to * TkFinalize */ "leaq %[registration], %%rdx" "\n\t" "movq %%gs:0, %%rax" "\n\t" - "movq %%rax, 0x0(%%edx)" "\n\t" /* link */ + "movq %%rax, 0x0(%%rdx)" "\n\t" /* link */ "leaq 1f, %%rax" "\n\t" "movq %%rax, 0x8(%%rdx)" "\n\t" /* handler */ - "movq %%rbp, 0x10(%%rdx)" "\n\t" /* ebp */ - "movq %%rsp, 0x18(%%rdx)" "\n\t" /* esp */ + "movq %%rbp, 0x10(%%rdx)" "\n\t" /* rbp */ + "movq %%rsp, 0x18(%%rdx)" "\n\t" /* rsp */ "movl %[error], 0x20(%%rdx)" "\n\t" /* status */ /* - * Link the EXCEPTION_REGISTRATION on the chain + * Link the TCLEXCEPTION_REGISTRATION on the chain */ "movq %%rdx, %%gs:0" "\n\t" @@ -154,7 +154,7 @@ DllMain( "call TkFinalize" "\n\t" /* - * Come here on a normal exit. Recover the EXCEPTION_REGISTRATION + * Come here on a normal exit. Recover the TCLEXCEPTION_REGISTRATION * and store a TCL_OK status */ @@ -164,7 +164,7 @@ DllMain( "jmp 2f" "\n" /* - * Come here on an exception. Get the EXCEPTION_REGISTRATION that + * Come here on an exception. Get the TCLEXCEPTION_REGISTRATION that * we previously put on the chain. */ @@ -174,7 +174,7 @@ DllMain( /* * Come here however we exited. Restore context from the - * EXCEPTION_REGISTRATION in case the stack is unbalanced. + * TCLEXCEPTION_REGISTRATION in case the stack is unbalanced. */ "2:" "\t" @@ -197,7 +197,7 @@ DllMain( __asm__ __volatile__ ( /* - * Construct an EXCEPTION_REGISTRATION to protect the call to + * Construct an TCLEXCEPTION_REGISTRATION to protect the call to * TkFinalize */ @@ -211,7 +211,7 @@ DllMain( "movl %[error], 0x10(%%edx)" "\n\t" /* status */ /* - * Link the EXCEPTION_REGISTRATION on the chain + * Link the TCLEXCEPTION_REGISTRATION on the chain */ "movl %%edx, %%fs:0" "\n\t" @@ -224,7 +224,7 @@ DllMain( "call _TkFinalize" "\n\t" /* - * Come here on a normal exit. Recover the EXCEPTION_REGISTRATION + * Come here on a normal exit. Recover the TCLEXCEPTION_REGISTRATION * and store a TCL_OK status */ @@ -234,7 +234,7 @@ DllMain( "jmp 2f" "\n" /* - * Come here on an exception. Get the EXCEPTION_REGISTRATION that + * Come here on an exception. Get the TCLEXCEPTION_REGISTRATION that * we previously put on the chain. */ @@ -245,7 +245,7 @@ DllMain( /* * Come here however we exited. Restore context from the - * EXCEPTION_REGISTRATION in case the stack is unbalanced. + * TCLEXCEPTION_REGISTRATION in case the stack is unbalanced. */ "2:" "\t" diff --git a/win/tkWinButton.c b/win/tkWinButton.c index f4d2d05..9e1960d 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -1265,21 +1265,29 @@ ButtonProc( return 0; } case BN_CLICKED: { - int code; - Tcl_Interp *interp = butPtr->info.interp; - - if (butPtr->info.state != STATE_DISABLED) { - Tcl_Preserve((ClientData)interp); - code = TkInvokeButton((TkButton*)butPtr); - if (code != TCL_OK && code != TCL_CONTINUE - && code != TCL_BREAK) { - Tcl_AddErrorInfo(interp, "\n (button invoke)"); - Tcl_BackgroundError(interp); + /* + * OOPS: chromium fires WM_NULL regularly to ping if plugin is still + * alive. When using an external window (i.e. via the tcl plugin), this + * causes all buttons to fire once a second, so we need to make sure + * that we are not dealing with the chromium life check. + */ + if (wParam != 0 || lParam != 0) { + int code; + Tcl_Interp *interp = butPtr->info.interp; + + if (butPtr->info.state != STATE_DISABLED) { + Tcl_Preserve((ClientData)interp); + code = TkInvokeButton((TkButton*)butPtr); + if (code != TCL_OK && code != TCL_CONTINUE + && code != TCL_BREAK) { + Tcl_AddErrorInfo(interp, "\n (button invoke)"); + Tcl_BackgroundError(interp); + } + Tcl_Release((ClientData)interp); } - Tcl_Release((ClientData)interp); + Tcl_ServiceAll(); + return 0; } - Tcl_ServiceAll(); - return 0; } default: diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 069991b..e03862c 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -8,7 +8,6 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ - #define WINVER 0x0500 /* Requires Windows 2K definitions */ #define _WIN32_WINNT 0x0500 #include "tkWinInt.h" @@ -51,19 +50,6 @@ #define OPENFILENAME_SIZE_VERSION_400 76 #endif -/* - * The following structure is used by the new Tk_ChooseDirectoryObjCmd to pass - * data between it and its callback. Unqiue to Winodws platform. - */ - -typedef struct ChooseDirData { - TCHAR utfInitDir[MAX_PATH]; /* Initial folder to use */ - TCHAR utfRetDir[MAX_PATH]; /* Returned folder to use */ - Tcl_Interp *interp; - int mustExist; /* True if file must exist to return from - * callback */ -} CHOOSEDIRDATA; - typedef struct ThreadSpecificData { int debugFlag; /* Flags whether we should output debugging * information while displaying a builtin @@ -132,14 +118,14 @@ static const struct {int type; int btnIds[3];} allowedTypes[] = { */ #define TkWinGetHInstance(from) \ - ((HINSTANCE) GetWindowLongPtr((from), GWLP_HINSTANCE)) + ((HINSTANCE) GetWindowLongPtrW((from), GWLP_HINSTANCE)) #define TkWinGetUserData(from) \ - GetWindowLongPtr((from), GWLP_USERDATA) + GetWindowLongPtrW((from), GWLP_USERDATA) #define TkWinSetUserData(to,what) \ - SetWindowLongPtr((to), GWLP_USERDATA, (LPARAM)(what)) + SetWindowLongPtrW((to), GWLP_USERDATA, (LPARAM)(what)) /* - * The value of TK_MULTI_MAX_PATH dictactes how many files can be retrieved + * The value of TK_MULTI_MAX_PATH dictates how many files can be retrieved * with tk_get*File -multiple 1. It must be allocated on the stack, so make it * large enough but not too large. - hobbs * @@ -154,27 +140,17 @@ static const struct {int type; int btnIds[3];} allowedTypes[] = { * chooser function, Tk_ChooseDirectoryObjCmd(), and its dialog hook proc. */ -typedef struct ChooseDir { - Tcl_Interp *interp; /* Interp, used only if debug is turned on, - * for setting the "tk_dialog" variable. */ - int lastCtrl; /* Used by hook proc to keep track of last - * control that had input focus, so when OK is - * pressed we know whether to browse a new - * directory or return. */ - int lastIdx; /* Last item that was selected in directory - * browser listbox. */ - TCHAR path[MAX_PATH]; /* On return from choose directory dialog, - * holds the selected path. Cannot return - * selected path in ofnPtr->lpstrFile because - * the default dialog proc stores a '\0' in - * it, since, of course, no _file_ was - * selected. */ - OPENFILENAME *ofnPtr; /* pointer to the OFN structure */ +typedef struct { + WCHAR initDir[MAX_PATH]; /* Initial folder to use */ + WCHAR retDir[MAX_PATH]; /* Returned folder to use */ + Tcl_Interp *interp; + int mustExist; /* True if file must exist to return from + * callback */ } ChooseDir; /* - * The following structure is used to pass information between GetFileName/W - * functions and OFN dialog hook procedures. [Bug 2896501, Patch 2898255] + * The following structure is used to pass information between GetFileName + * function and OFN dialog hook procedures. [Bug 2896501, Patch 2898255] */ typedef struct OFNData { @@ -183,8 +159,7 @@ typedef struct OFNData { int dynFileBufferSize; /* Dynamic filename buffer size, stored to * avoid shrinking and expanding the buffer * when selection changes */ - char *dynFileBuffer; /* Dynamic filename buffer, cast to WCHAR* in - * UNICODE procedures */ + WCHAR *dynFileBuffer; /* Dynamic filename buffer */ } OFNData; /* @@ -195,23 +170,18 @@ static UINT APIENTRY ChooseDirectoryValidateProc(HWND hdlg, UINT uMsg, LPARAM wParam, LPARAM lParam); static UINT CALLBACK ColorDlgHookProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -static int GetFileNameA(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[], int isOpen); -static int GetFileNameW(ClientData clientData, +static int GetFileName(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[], int isOpen); + Tcl_Obj *const objv[], int isOpen); static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr, Tcl_DString *dsPtr, Tcl_Obj *initialPtr, - int *index); -static UINT APIENTRY OFNHookProcA(HWND hdlg, UINT uMsg, WPARAM wParam, - LPARAM lParam); -static UINT APIENTRY OFNHookProcW(HWND hdlg, UINT uMsg, WPARAM wParam, + int *indexPtr); +static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam); static void SetTkDialog(ClientData clientData); -static char * ConvertExternalFilename(Tcl_Encoding encoding, - char *filename, Tcl_DString *dsPtr); +static const char *ConvertExternalFilename(WCHAR *filename, + Tcl_DString *dsPtr); /* *------------------------------------------------------------------------- @@ -252,10 +222,10 @@ EatSpuriousMessageBugFix(void) DWORD nTime = GetTickCount() + 250; while (GetTickCount() < nTime) { - if (PeekMessage(&msg, 0, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE)){ + if (PeekMessageA(&msg, 0, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE)){ break; } - PeekMessage(&msg, 0, WM_LBUTTONUP, WM_LBUTTONUP, PM_REMOVE); + PeekMessageA(&msg, 0, WM_LBUTTONUP, WM_LBUTTONUP, PM_REMOVE); } } @@ -312,16 +282,16 @@ Tk_ChooseColorObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window) clientData, parent; HWND hWnd; int i, oldMode, winCode, result; - CHOOSECOLOR chooseColor; + CHOOSECOLORW chooseColor; static int inited = 0; static COLORREF dwCustColors[16]; static long oldColor; /* the color selected last time */ - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "-initialcolor", "-parent", "-title", NULL }; enum options { @@ -345,7 +315,7 @@ Tk_ChooseColorObjCmd( } parent = tkwin; - chooseColor.lStructSize = sizeof(CHOOSECOLOR); + chooseColor.lStructSize = sizeof(CHOOSECOLORW); chooseColor.hwndOwner = NULL; chooseColor.hInstance = NULL; chooseColor.rgbResult = oldColor; @@ -353,11 +323,11 @@ Tk_ChooseColorObjCmd( chooseColor.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK; chooseColor.lCustData = (LPARAM) NULL; chooseColor.lpfnHook = (LPOFNHOOKPROC) ColorDlgHookProc; - chooseColor.lpTemplateName = (LPTSTR) interp; + chooseColor.lpTemplateName = (LPWSTR) interp; for (i = 1; i < objc; i += 2) { int index; - char *string; + const char *string; Tcl_Obj *optionPtr, *valuePtr; optionPtr = objv[i]; @@ -405,7 +375,7 @@ Tk_ChooseColorObjCmd( chooseColor.hwndOwner = hWnd; oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); - winCode = ChooseColor(&chooseColor); + winCode = ChooseColorW(&chooseColor); (void) Tcl_SetServiceMode(oldMode); /* @@ -473,7 +443,7 @@ ColorDlgHookProc( ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *title; - CHOOSECOLOR *ccPtr; + CHOOSECOLORW *ccPtr; if (WM_INITDIALOG == uMsg) { @@ -481,14 +451,13 @@ ColorDlgHookProc( * Set the title string of the dialog. */ - ccPtr = (CHOOSECOLOR *) lParam; + ccPtr = (CHOOSECOLORW *) lParam; title = (const char *) ccPtr->lCustData; if ((title != NULL) && (title[0] != '\0')) { Tcl_DString ds; - (*tkWinProcs->setWindowText)(hDlg, - Tcl_WinUtfToTChar(title, -1, &ds)); + SetWindowTextW(hDlg, (WCHAR *)Tcl_WinUtfToTChar(title,-1,&ds)); Tcl_DStringFree(&ds); } if (tsdPtr->debugFlag) { @@ -522,13 +491,9 @@ Tk_GetOpenFileObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { - return GetFileNameW(clientData, interp, objc, objv, 1); - } else { - return GetFileNameA(clientData, interp, objc, objv, 1); - } + return GetFileName(clientData, interp, objc, objv, 1); } /* @@ -553,19 +518,15 @@ Tk_GetSaveFileObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { - return GetFileNameW(clientData, interp, objc, objv, 0); - } else { - return GetFileNameA(clientData, interp, objc, objv, 0); - } + return GetFileName(clientData, interp, objc, objv, 0); } /* *---------------------------------------------------------------------- * - * GetFileNameW -- + * GetFileName -- * * Calls GetOpenFileName() or GetSaveFileName(). * @@ -579,11 +540,11 @@ Tk_GetSaveFileObjCmd( */ static int -GetFileNameW( +GetFileName( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[], /* Argument objects. */ + Tcl_Obj *const objv[], /* Argument objects. */ int open) /* 1 to call GetOpenFileName(), 0 to call * GetSaveFileName(). */ { @@ -593,13 +554,12 @@ GetFileNameW( int cdlgerr; int filterIndex = 0, result = TCL_ERROR, winCode, oldMode, i, multi = 0; int confirmOverwrite = 1; - char *extension = NULL, *title = NULL; + const char *extension = NULL, *title = NULL; Tk_Window tkwin = (Tk_Window) clientData; HWND hWnd; Tcl_Obj *filterObj = NULL, *initialTypeObj = NULL, *typeVariableObj = NULL; Tcl_DString utfFilterString, utfDirString, ds; Tcl_DString extString, filterString, dirString, titleString; - Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding(); ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); enum options { @@ -607,10 +567,10 @@ GetFileNameW( FILE_TITLE, FILE_TYPEVARIABLE, FILE_MULTIPLE, FILE_CONFIRMOW }; struct Options { - CONST char *name; + const char *name; enum options value; }; - static CONST struct Options saveOptions[] = { + static const struct Options saveOptions[] = { {"-confirmoverwrite", FILE_CONFIRMOW}, {"-defaultextension", FILE_DEFAULT}, {"-filetypes", FILE_TYPES}, @@ -621,7 +581,7 @@ GetFileNameW( {"-typevariable", FILE_TYPEVARIABLE}, {NULL, FILE_DEFAULT/*ignored*/ } }; - static CONST struct Options openOptions[] = { + static const struct Options openOptions[] = { {"-defaultextension", FILE_DEFAULT}, {"-filetypes", FILE_TYPES}, {"-initialdir", FILE_INITDIR}, @@ -632,7 +592,7 @@ GetFileNameW( {"-typevariable", FILE_TYPEVARIABLE}, {NULL, FILE_DEFAULT/*ignored*/ } }; - CONST struct Options *options = open ? openOptions : saveOptions; + const struct Options *options = open ? openOptions : saveOptions; file[0] = '\0'; ZeroMemory(&ofnData, sizeof(OFNData)); @@ -645,7 +605,7 @@ GetFileNameW( for (i = 1; i < objc; i += 2) { int index; - char *string; + const char *string; Tcl_Obj *valuePtr = objv[i + 1]; if (Tcl_GetIndexFromObjStruct(interp, objv[i], options, @@ -679,9 +639,9 @@ GetFileNameW( if (Tcl_TranslateFileName(interp, string, &ds) == NULL) { goto end; } - Tcl_UtfToExternal(NULL, unicodeEncoding, Tcl_DStringValue(&ds), - Tcl_DStringLength(&ds), 0, NULL, (char *) file, - sizeof(file), NULL, NULL, NULL); + Tcl_UtfToExternal(NULL, TkWinGetUnicodeEncoding(), + Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), 0, NULL, + (char *) file, sizeof(file), NULL, NULL, NULL); Tcl_DStringFree(&ds); break; case FILE_PARENT: @@ -728,11 +688,11 @@ GetFileNameW( } ofn.hwndOwner = hWnd; ofn.hInstance = TkWinGetHInstance(ofn.hwndOwner); - ofn.lpstrFile = (WCHAR *) file; + ofn.lpstrFile = file; ofn.nMaxFile = TK_MULTI_MAX_PATH; ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_ENABLEHOOK| OFN_ENABLESIZING; - ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProcW; + ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProc; ofn.lCustData = (LPARAM) &ofnData; if (open != 0) { @@ -751,24 +711,22 @@ GetFileNameW( * procedure when necessary */ - ofnData.dynFileBufferSize = 1024; - ofnData.dynFileBuffer = ckalloc(1024); + ofnData.dynFileBufferSize = 512; + ofnData.dynFileBuffer = (WCHAR *)ckalloc(512 * sizeof(WCHAR)); } if (extension != NULL) { - Tcl_UtfToExternalDString(unicodeEncoding, extension, -1, &extString); + Tcl_WinUtfToTChar(extension, -1, &extString); ofn.lpstrDefExt = (WCHAR *) Tcl_DStringValue(&extString); } - Tcl_UtfToExternalDString(unicodeEncoding, - Tcl_DStringValue(&utfFilterString), + Tcl_WinUtfToTChar(Tcl_DStringValue(&utfFilterString), Tcl_DStringLength(&utfFilterString), &filterString); ofn.lpstrFilter = (WCHAR *) Tcl_DStringValue(&filterString); ofn.nFilterIndex = filterIndex; if (Tcl_DStringValue(&utfDirString)[0] != '\0') { - Tcl_UtfToExternalDString(unicodeEncoding, - Tcl_DStringValue(&utfDirString), + Tcl_WinUtfToTChar(Tcl_DStringValue(&utfDirString), Tcl_DStringLength(&utfDirString), &dirString); } else { /* @@ -784,7 +742,7 @@ GetFileNameW( Tcl_DStringValue(&utfDirString), &cwd) == NULL)) { Tcl_ResetResult(interp); } else { - Tcl_UtfToExternalDString(unicodeEncoding, Tcl_DStringValue(&cwd), + Tcl_WinUtfToTChar(Tcl_DStringValue(&cwd), Tcl_DStringLength(&cwd), &dirString); } Tcl_DStringFree(&cwd); @@ -792,7 +750,7 @@ GetFileNameW( ofn.lpstrInitialDir = (WCHAR *) Tcl_DStringValue(&dirString); if (title != NULL) { - Tcl_UtfToExternalDString(unicodeEncoding, title, -1, &titleString); + Tcl_WinUtfToTChar(title, -1, &titleString); ofn.lpstrTitle = (WCHAR *) Tcl_DStringValue(&titleString); } @@ -858,7 +816,7 @@ GetFileNameW( * first element is the directory path. */ - WCHAR *files = (WCHAR *) ofnData.dynFileBuffer; + WCHAR *files = ofnData.dynFileBuffer; Tcl_Obj *returnList = Tcl_NewObj(); int count = 0; @@ -866,8 +824,7 @@ GetFileNameW( * Get directory. */ - (void) ConvertExternalFilename(unicodeEncoding, (char *) files, - &ds); + ConvertExternalFilename(files, &ds); while (*files != '\0') { while (*files != '\0') { @@ -879,8 +836,7 @@ GetFileNameW( Tcl_DString filenameBuf; count++; - (void) ConvertExternalFilename(unicodeEncoding, - (char *) files, &filenameBuf); + ConvertExternalFilename(files, &filenameBuf); fullnameObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); @@ -906,8 +862,8 @@ GetFileNameW( Tcl_SetObjResult(interp, returnList); Tcl_DStringFree(&ds); } else { - Tcl_AppendResult(interp, ConvertExternalFilename(unicodeEncoding, - (char *) ofn.lpstrFile, &ds), NULL); + Tcl_AppendResult(interp, ConvertExternalFilename( + ofn.lpstrFile, &ds), NULL); gotFilename = (Tcl_DStringLength(&ds) > 0); Tcl_DStringFree(&ds); } @@ -932,8 +888,8 @@ GetFileNameW( } } else if (cdlgerr == FNERR_INVALIDFILENAME) { Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC); - Tcl_AppendResult(interp, ConvertExternalFilename(unicodeEncoding, - (char *) ofn.lpstrFile, &ds), "\"", NULL); + Tcl_AppendResult(interp, ConvertExternalFilename( + ofn.lpstrFile, &ds), "\"", NULL); Tcl_DStringFree(&ds); } else { result = TCL_OK; @@ -954,7 +910,7 @@ GetFileNameW( Tcl_DStringFree(&utfDirString); Tcl_DStringFree(&utfFilterString); if (ofnData.dynFileBuffer != NULL) { - ckfree(ofnData.dynFileBuffer); + ckfree((char *)ofnData.dynFileBuffer); ofnData.dynFileBuffer = NULL; } @@ -964,7 +920,7 @@ GetFileNameW( /* *------------------------------------------------------------------------- * - * OFNHookProcW -- + * OFNHookProc -- * * Dialog box hook function. This is used to sets the "tk_dialog" * variable for test/debugging when the dialog is ready to receive @@ -981,7 +937,7 @@ GetFileNameW( */ static UINT APIENTRY -OFNHookProcW( +OFNHookProc( HWND hdlg, /* Handle to child dialog window. */ UINT uMsg, /* Message identifier */ WPARAM wParam, /* Message parameter */ @@ -998,14 +954,16 @@ OFNHookProcW( OFNOTIFYW *notifyPtr = (OFNOTIFYW *) lParam; /* - * This is weird... or not. The CDN_FILEOK is NOT sent when the selection - * exceeds declared buffer size (the nMaxFile member of the OPENFILENAMEW - * struct passed to GetOpenFileNameW function). So, we have to rely on - * the most recent CDN_SELCHANGE then. Unfortunately this means, that - * gathering the selected filenames happens twice when they fit into the - * declared buffer. Luckily, it's not frequent operation so it should - * not incur any noticeable delay. See [tktoolkit-Bugs-2987995] + * This is weird... or not. The CDN_FILEOK is NOT sent when the + * selection exceeds declared buffer size (the nMaxFile member of the + * OPENFILENAME struct passed to GetOpenFileName function). So, we + * have to rely on the most recent CDN_SELCHANGE then. Unfortunately + * this means, that gathering the selected filenames happens twice + * when they fit into the declared buffer. Luckily, it's not frequent + * operation so it should not incur any noticeable delay. See [Bug + * 2987995] */ + if (notifyPtr->hdr.code == CDN_FILEOK || notifyPtr->hdr.code == CDN_SELCHANGE) { int dirsize, selsize; @@ -1019,21 +977,23 @@ OFNHookProcW( ofnPtr = notifyPtr->lpOFN; ofnData = (OFNData *) ofnPtr->lCustData; - buffer = (WCHAR *) ofnData->dynFileBuffer; + buffer = ofnData->dynFileBuffer; hdlg = GetParent(hdlg); selsize = SendMessageW(hdlg, CDM_GETSPEC, 0, 0); dirsize = SendMessageW(hdlg, CDM_GETFOLDERPATH, 0, 0); - buffersize = (selsize + dirsize + 1) * 2; + buffersize = (selsize + dirsize + 1); /* - * Just empty the buffer if dirsize indicates an error [Bug 3071836] + * Just empty the buffer if dirsize indicates an error. [Bug + * 3071836] */ + if ((selsize > 1) && (dirsize > 0)) { if (ofnData->dynFileBufferSize < buffersize) { - buffer = (WCHAR *) ckrealloc((char *) buffer, buffersize); + buffer = (WCHAR *) ckrealloc((char *) buffer, buffersize * sizeof(WCHAR)); ofnData->dynFileBufferSize = buffersize; - ofnData->dynFileBuffer = (char *) buffer; + ofnData->dynFileBuffer = buffer; } SendMessageW(hdlg, CDM_GETFOLDERPATH, dirsize, (LPARAM) buffer); @@ -1050,7 +1010,7 @@ OFNHookProcW( BOOL findquote = TRUE; WCHAR *tmp = buffer; - while(*buffer != '\0') { + while (*buffer != '\0') { if (findquote) { if (*buffer == '"') { findquote = FALSE; @@ -1066,14 +1026,24 @@ OFNHookProcW( } *tmp = '\0'; /* Second NULL terminator. */ } else { - buffer[selsize] = '\0'; /* Second NULL terminator. */ - /* - * Replace directory terminating NULL with a backslash. + /* + * Replace directory terminating NULL with a with a backslash, + * but only if not an absolute path. */ - buffer--; - *buffer = '\\'; + Tcl_DString tmpfile; + ConvertExternalFilename(buffer, &tmpfile); + if (TCL_PATH_ABSOLUTE == + Tcl_GetPathType(Tcl_DStringValue(&tmpfile))) { + /* re-get the full path to the start of the buffer */ + buffer = (WCHAR *) ofnData->dynFileBuffer; + SendMessageW(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); + } else { + *(buffer-1) = '\\'; + } + buffer[selsize] = '\0'; /* Second NULL terminator. */ + Tcl_DStringFree(&tmpfile); } } else { /* @@ -1109,557 +1079,6 @@ OFNHookProcW( /* *---------------------------------------------------------------------- * - * GetFileNameA -- - * - * Calls GetOpenFileName() or GetSaveFileName(). - * - * Results: - * See user documentation. - * - * Side effects: - * See user documentation. - * - *---------------------------------------------------------------------- - */ - -static int -GetFileNameA( - ClientData clientData, /* Main window associated with interpreter. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[], /* Argument objects. */ - int open) /* 1 to call GetOpenFileName(), 0 to call - * GetSaveFileName(). */ -{ - OPENFILENAME ofn; - TCHAR file[TK_MULTI_MAX_PATH], savePath[MAX_PATH]; - OFNData ofnData; - int cdlgerr; - int filterIndex = 0, result = TCL_ERROR, winCode, oldMode, i, multi = 0; - char *extension = NULL, *title = NULL; - Tk_Window tkwin = (Tk_Window) clientData; - HWND hWnd; - Tcl_Obj *filterObj = NULL, *initialTypeObj = NULL, *typeVariableObj = NULL; - Tcl_DString utfFilterString, utfDirString, ds; - Tcl_DString extString, filterString, dirString, titleString; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - static CONST char *saveOptionStrings[] = { - "-defaultextension", "-filetypes", "-initialdir", "-initialfile", - "-parent", "-title", "-typevariable", NULL - }; - static CONST char *openOptionStrings[] = { - "-defaultextension", "-filetypes", "-initialdir", "-initialfile", - "-multiple", "-parent", "-title", "-typevariable", NULL - }; - CONST char **optionStrings; - - enum options { - FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE, - FILE_MULTIPLE, FILE_PARENT, FILE_TITLE, FILE_TYPEVARIABLE - }; - - file[0] = '\0'; - ZeroMemory(&ofnData, sizeof(OFNData)); - Tcl_DStringInit(&utfFilterString); - Tcl_DStringInit(&utfDirString); - - /* - * Parse the arguments. - */ - - if (open) { - optionStrings = openOptionStrings; - } else { - optionStrings = saveOptionStrings; - } - - for (i = 1; i < objc; i += 2) { - int index; - char *string; - Tcl_Obj *optionPtr, *valuePtr; - - optionPtr = objv[i]; - valuePtr = objv[i + 1]; - - if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings, "option", 0, - &index) != TCL_OK) { - goto end; - } - - /* - * We want to maximize code sharing between the open and save file - * dialog implementations; in particular, the switch statement below. - * We use different sets of option strings from the GetIndexFromObj - * call above, but a single enumeration for both. The save file dialog - * doesn't support -multiple, but it falls in the middle of the - * enumeration. Ultimately, this means that when the index found by - * GetIndexFromObj is >= FILE_MULTIPLE, when doing a save file dialog, - * we have to increment the index, so that it matches the open file - * dialog enumeration. - */ - - if (!open && index >= FILE_MULTIPLE) { - index++; - } - if (i + 1 == objc) { - string = Tcl_GetString(optionPtr); - Tcl_AppendResult(interp, "value for \"", string, "\" missing", - NULL); - goto end; - } - - string = Tcl_GetString(valuePtr); - switch ((enum options) index) { - case FILE_DEFAULT: - if (string[0] == '.') { - string++; - } - extension = string; - break; - case FILE_TYPES: - filterObj = valuePtr; - break; - case FILE_INITDIR: - Tcl_DStringFree(&utfDirString); - if (Tcl_TranslateFileName(interp, string, &utfDirString) == NULL) { - goto end; - } - break; - case FILE_INITFILE: - if (Tcl_TranslateFileName(interp, string, &ds) == NULL) { - goto end; - } - Tcl_UtfToExternal(NULL, NULL, Tcl_DStringValue(&ds), - Tcl_DStringLength(&ds), 0, NULL, (char *) file, - sizeof(file), NULL, NULL, NULL); - Tcl_DStringFree(&ds); - break; - case FILE_MULTIPLE: - if (Tcl_GetBooleanFromObj(interp, valuePtr, &multi) != TCL_OK) { - return TCL_ERROR; - } - break; - case FILE_PARENT: - tkwin = Tk_NameToWindow(interp, string, tkwin); - if (tkwin == NULL) { - goto end; - } - break; - case FILE_TITLE: - title = string; - break; - case FILE_TYPEVARIABLE: - typeVariableObj = valuePtr; - initialTypeObj = Tcl_ObjGetVar2(interp, typeVariableObj, NULL, - TCL_GLOBAL_ONLY); - break; - } - } - - if (MakeFilter(interp, filterObj, &utfFilterString, initialTypeObj, - &filterIndex) != TCL_OK) { - goto end; - } - - Tk_MakeWindowExist(tkwin); - hWnd = Tk_GetHWND(Tk_WindowId(tkwin)); - - ZeroMemory(&ofn, sizeof(OPENFILENAMEA)); - if (LOBYTE(LOWORD(GetVersion())) < 5) { - ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - } else { - ofn.lStructSize = sizeof(ofn); - } - ofn.hwndOwner = hWnd; - ofn.hInstance = TkWinGetHInstance(ofn.hwndOwner); - ofn.lpstrFilter = NULL; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.lpstrFile = (LPTSTR) file; - ofn.nMaxFile = TK_MULTI_MAX_PATH; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; - ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR - | OFN_EXPLORER | OFN_ENABLEHOOK; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = NULL; - ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProcA; - ofn.lCustData = (LPARAM) &ofnData; - ofn.lpTemplateName = NULL; - - if (open != 0) { - ofn.Flags |= OFN_FILEMUSTEXIST; - } else { - ofn.Flags |= OFN_OVERWRITEPROMPT; - } - - if (tsdPtr->debugFlag != 0) { - ofnData.interp = interp; - } - - if (multi != 0) { - ofn.Flags |= OFN_ALLOWMULTISELECT; - - /* - * Starting buffer size. The buffer will be expanded by the OFN dialog - * procedure when necessary - */ - - ofnData.dynFileBufferSize = 1024; - ofnData.dynFileBuffer = ckalloc(1024); - } - - if (extension != NULL) { - Tcl_UtfToExternalDString(NULL, extension, -1, &extString); - ofn.lpstrDefExt = (LPTSTR) Tcl_DStringValue(&extString); - } - Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&utfFilterString), - Tcl_DStringLength(&utfFilterString), &filterString); - ofn.lpstrFilter = (LPTSTR) Tcl_DStringValue(&filterString); - ofn.nFilterIndex = filterIndex; - - if (Tcl_DStringValue(&utfDirString)[0] != '\0') { - Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&utfDirString), - Tcl_DStringLength(&utfDirString), &dirString); - } else { - /* - * NT 5.0 changed the meaning of lpstrInitialDir, so we have to ensure - * that we set the [pwd] if the user didn't specify anything else. - */ - - Tcl_DString cwd; - - Tcl_DStringFree(&utfDirString); - if ((Tcl_GetCwd(interp, &utfDirString) == NULL) || - (Tcl_TranslateFileName(interp, - Tcl_DStringValue(&utfDirString), &cwd) == NULL)) { - Tcl_ResetResult(interp); - } else { - Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&cwd), - Tcl_DStringLength(&cwd), &dirString); - } - Tcl_DStringFree(&cwd); - } - ofn.lpstrInitialDir = (LPTSTR) Tcl_DStringValue(&dirString); - - if (title != NULL) { - Tcl_UtfToExternalDString(NULL, title, -1, &titleString); - ofn.lpstrTitle = (LPTSTR) Tcl_DStringValue(&titleString); - } - - /* - * Popup the dialog. - */ - - GetCurrentDirectory(MAX_PATH, savePath); - oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); - if (open != 0) { - winCode = GetOpenFileName(&ofn); - } else { - winCode = GetSaveFileName(&ofn); - } - Tcl_SetServiceMode(oldMode); - EatSpuriousMessageBugFix(); - SetCurrentDirectory(savePath); - - /* - * Ensure that hWnd is enabled, because it can happen that we have updated - * the wrapper of the parent, which causes us to leave this child disabled - * (Windows loses sync). - */ - - EnableWindow(hWnd, 1); - - /* - * Clear the interp result since anything may have happened during the - * modal loop. - */ - - Tcl_ResetResult(interp); - - /* - * Process the results. - * - * Use the CommDlgExtendedError() function to retrieve the error code. - * This function can return one of about two dozen codes; most of these - * indicate some sort of gross system failure (insufficient memory, bad - * window handles, etc.) Most of the error codes will be ignored; as we - * find we want specific error messages for particular errors, we can - * extend the code as needed. - */ - - cdlgerr = CommDlgExtendedError(); - - /* - * We now allow FNERR_BUFFERTOOSMALL when multiselection is enabled. The - * filename buffer has been dynamically allocated by the OFN dialog - * procedure to accomodate all selected files. - */ - - if ((winCode != 0) - || ((cdlgerr == FNERR_BUFFERTOOSMALL) - && (ofn.Flags & OFN_ALLOWMULTISELECT))) { - if (ofn.Flags & OFN_ALLOWMULTISELECT) { - /* - * The result in dynFileBuffer contains many items, separated by - * NUL characters. It is terminated with two nulls in a row. The - * first element is the directory path (if multiple files are - * selected) or the only returned file (if only a single file has - * been chosen). - */ - - char *files = ofnData.dynFileBuffer; - Tcl_Obj *returnList = Tcl_NewObj(); - int count = 0; - - /* - * Get directory. - */ - - (void) ConvertExternalFilename(NULL, (char *) files, &ds); - - while (*files != '\0') { - while (*files != '\0') { - files++; - } - files++; - if (*files != '\0') { - Tcl_Obj *fullnameObj; - Tcl_DString filename; - - count++; - (void) ConvertExternalFilename(NULL, (char *) files, - &filename); - fullnameObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), - Tcl_DStringLength(&ds)); - Tcl_AppendToObj(fullnameObj, "/", -1); - Tcl_AppendToObj(fullnameObj, Tcl_DStringValue(&filename), - Tcl_DStringLength(&filename)); - Tcl_DStringFree(&filename); - Tcl_ListObjAppendElement(NULL, returnList, fullnameObj); - } - } - if (count == 0) { - /* - * Only one file was returned. - */ - - Tcl_ListObjAppendElement(NULL, returnList, Tcl_NewStringObj( - Tcl_DStringValue(&ds), Tcl_DStringLength(&ds))); - } - Tcl_SetObjResult(interp, returnList); - Tcl_DStringFree(&ds); - } else { - Tcl_AppendResult(interp, ConvertExternalFilename(NULL, - (char *) ofn.lpstrFile, &ds), NULL); - Tcl_DStringFree(&ds); - } - result = TCL_OK; - if ((ofn.nFilterIndex > 0) && - (Tcl_GetCharLength(Tcl_GetObjResult(interp)) > 0) && - typeVariableObj && filterObj) { - int listObjc, count; - Tcl_Obj **listObjv = NULL; - Tcl_Obj **typeInfo = NULL; - - if (Tcl_ListObjGetElements(interp, filterObj, &listObjc, - &listObjv) != TCL_OK) { - result = TCL_ERROR; - } else if (Tcl_ListObjGetElements(interp, - listObjv[ofn.nFilterIndex - 1], &count, - &typeInfo) != TCL_OK) { - result = TCL_ERROR; - } else if (Tcl_ObjSetVar2(interp, typeVariableObj, NULL, - typeInfo[0], TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) { - result = TCL_ERROR; - } - } - } else if (cdlgerr == FNERR_INVALIDFILENAME) { - Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC); - Tcl_AppendResult(interp, ConvertExternalFilename(NULL, - (char *) ofn.lpstrFile, &ds), "\"", NULL); - Tcl_DStringFree(&ds); - } else { - result = TCL_OK; - } - - if (ofn.lpstrTitle != NULL) { - Tcl_DStringFree(&titleString); - } - if (ofn.lpstrInitialDir != NULL) { - Tcl_DStringFree(&dirString); - } - Tcl_DStringFree(&filterString); - if (ofn.lpstrDefExt != NULL) { - Tcl_DStringFree(&extString); - } - - end: - Tcl_DStringFree(&utfDirString); - Tcl_DStringFree(&utfFilterString); - if (ofnData.dynFileBuffer != NULL) { - ckfree(ofnData.dynFileBuffer); - ofnData.dynFileBuffer = NULL; - } - - return result; -} - -/* - *------------------------------------------------------------------------- - * - * OFNHookProcA -- - * - * Dialog box hook function. This is used to sets the "tk_dialog" - * variable for test/debugging when the dialog is ready to receive - * messages. When multiple file selection is enabled this function - * is used to process the list of names. - * - * Results: - * Returns 0 to allow default processing of messages to occur. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static UINT APIENTRY -OFNHookProcA( - HWND hdlg, /* handle to child dialog window */ - UINT uMsg, /* message identifier */ - WPARAM wParam, /* message parameter */ - LPARAM lParam) /* message parameter */ -{ - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - OPENFILENAME *ofnPtr; - OFNData *ofnData; - - if (uMsg == WM_INITDIALOG) { - TkWinSetUserData(hdlg, lParam); - } else if (uMsg == WM_NOTIFY) { - OFNOTIFY *notifyPtr = (OFNOTIFY *) lParam; - - /* - * This is weird... or not. The CDN_FILEOK is NOT sent when the selection - * exceeds declared buffer size (the nMaxFile member of the OPENFILENAMEW - * struct passed to GetOpenFileNameW function). So, we have to rely on - * the most recent CDN_SELCHANGE then. Unfortunately this means, that - * gathering the selected filenames happens twice when they fit into the - * declared buffer. Luckily, it's not frequent operation so it should - * not incur any noticeable delay. See [tktoolkit-Bugs-2987995] - */ - if (notifyPtr->hdr.code == CDN_FILEOK || - notifyPtr->hdr.code == CDN_SELCHANGE) { - int dirsize, selsize; - char *buffer; - int buffersize; - - /* - * Change of selection. Unscramble the unholy mess that's in the - * selection buffer, resizing it if necessary. - */ - - ofnPtr = notifyPtr->lpOFN; - ofnData = (OFNData *) ofnPtr->lCustData; - buffer = ofnData->dynFileBuffer; - hdlg = GetParent(hdlg); - - selsize = SendMessage(hdlg, CDM_GETSPEC, 0, 0); - dirsize = SendMessage(hdlg, CDM_GETFOLDERPATH, 0, 0); - buffersize = selsize + dirsize + 1; - - /* - * Just empty the buffer if dirsize indicates an error [Bug 3071836] - */ - if ((selsize > 1) && (dirsize > 0)) { - if (ofnData->dynFileBufferSize < buffersize) { - buffer = ckrealloc(buffer, buffersize); - ofnData->dynFileBufferSize = buffersize; - ofnData->dynFileBuffer = buffer; - } - - SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, (LPARAM) buffer); - buffer += dirsize; - SendMessage(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); - - /* - * If there are multiple files, delete the quotes and change - * every second quote to NULL terminator. - */ - - if (buffer[0] == '"') { - BOOL findquote = TRUE; - char *tmp = buffer; - - while (*buffer != '\0') { - if (findquote) { - if (*buffer == '"') { - findquote = FALSE; - } - buffer++; - } else { - if (*buffer == '"') { - findquote = TRUE; - *buffer = '\0'; - } - *tmp++ = *buffer++; - } - } - *tmp = '\0'; /* Second NULL terminator. */ - } else { - buffer[selsize] = '\0'; /* Second NULL terminator. */ - - /* - * Replace directory terminating NULL with a backslash. - */ - - buffer--; - *buffer = '\\'; - } - - } else { - /* - * Nothing is selected, so just empty the string. - */ - - if (buffer != NULL) { - *buffer = '\0'; - } - } - } - } else if (uMsg == WM_WINDOWPOSCHANGED) { - /* - * This message is delivered at the right time to both old-style and - * explorer-style hook procs to enable Tk to set the debug - * information. Unhooks itself so it won't set the debug information - * every time it gets a WM_WINDOWPOSCHANGED message. - */ - - ofnPtr = (OPENFILENAME *) TkWinGetUserData(hdlg); - if (ofnPtr != NULL) { - ofnData = (OFNData *) ofnPtr->lCustData; - if (ofnData->interp != NULL) { - if (ofnPtr->Flags & OFN_EXPLORER) { - hdlg = GetParent(hdlg); - } - tsdPtr->debugInterp = ofnData->interp; - Tcl_DoWhenIdle(SetTkDialog, hdlg); - } - TkWinSetUserData(hdlg, NULL); - } - } - return 0; -} - -/* - *---------------------------------------------------------------------- - * * MakeFilter -- * * Allocate a buffer to store the filters in a format understood by @@ -1680,18 +1099,18 @@ MakeFilter( Tcl_Obj *valuePtr, /* Value of the -filetypes option */ Tcl_DString *dsPtr, /* Filled with windows filter string. */ Tcl_Obj *initialPtr, /* Initial type name */ - int *index) /* Index of initial type in filter string */ + int *indexPtr) /* Index of initial type in filter string */ { char *filterStr; char *p; - char *initial = NULL; + const char *initial = NULL; int pass; int ix = 0; /* index counter */ FileFilterList flist; FileFilter *filterPtr; if (initialPtr) { - initial = Tcl_GetStringFromObj(initialPtr, NULL); + initial = Tcl_GetString(initialPtr); } TkInitFileFilters(&flist); if (TkGetFileFilters(interp, &flist, valuePtr, 1) != TCL_OK) { @@ -1702,9 +1121,9 @@ MakeFilter( /* * Use "All Files (*.*) as the default filter if none is specified */ - char *defaultFilter = "All Files (*.*)"; + const char *defaultFilter = "All Files (*.*)"; - p = filterStr = (char*)ckalloc(30 * sizeof(char)); + p = filterStr = ckalloc(30); strcpy(p, defaultFilter); p+= strlen(defaultFilter); @@ -1744,16 +1163,18 @@ MakeFilter( for (filterPtr = flist.filters, p = filterStr; filterPtr; filterPtr = filterPtr->next) { - char *sep; + const char *sep; FileFilterClause *clausePtr; /* - * Check initial index for match, set index. Filter index is 1 + * Check initial index for match, set *indexPtr. Filter index is 1 * based so increment first */ + ix++; - if (index && initial && (strcmp(initial, filterPtr->name) == 0)) { - *index = ix; + if (indexPtr && initial + && (strcmp(initial, filterPtr->name) == 0)) { + *indexPtr = ix; } /* @@ -1889,22 +1310,23 @@ Tk_ChooseDirectoryObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - char path[MAX_PATH]; + WCHAR path[MAX_PATH]; int oldMode, result = TCL_ERROR, i; LPCITEMIDLIST pidl; /* Returned by browser */ - BROWSEINFO bInfo; /* Used by browser */ - CHOOSEDIRDATA cdCBData; /* Structure to pass back and forth */ + BROWSEINFOW bInfo; /* Used by browser */ + ChooseDir cdCBData; /* Structure to pass back and forth */ LPMALLOC pMalloc; /* Used by shell */ Tk_Window tkwin = (Tk_Window) clientData; HWND hWnd; - char *utfTitle = NULL;/* Title for window */ - TCHAR saveDir[MAX_PATH]; - Tcl_DString titleString; /* UTF Title */ + const char *utfTitle = NULL;/* Title for window */ + WCHAR saveDir[MAX_PATH]; + Tcl_DString titleString; /* Title */ Tcl_DString initDirString; /* Initial directory */ + Tcl_DString tempString; /* temporary */ Tcl_Obj *objPtr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "-initialdir", "-mustexist", "-parent", "-title", NULL }; enum options { @@ -1916,7 +1338,7 @@ Tk_ChooseDirectoryObjCmd( */ path[0] = '\0'; - ZeroMemory(&cdCBData, sizeof(CHOOSEDIRDATA)); + ZeroMemory(&cdCBData, sizeof(ChooseDir)); cdCBData.interp = interp; /* @@ -1925,7 +1347,8 @@ Tk_ChooseDirectoryObjCmd( for (i = 1; i < objc; i += 2) { int index; - char *string; + const char *string; + const WCHAR *uniStr; Tcl_Obj *optionPtr, *valuePtr; optionPtr = objv[i]; @@ -1948,16 +1371,19 @@ Tk_ChooseDirectoryObjCmd( if (Tcl_TranslateFileName(interp,string,&initDirString) == NULL) { goto cleanup; } - string = Tcl_DStringValue(&initDirString); + Tcl_WinUtfToTChar(Tcl_DStringValue(&initDirString), -1, + &tempString); + uniStr = (WCHAR *) Tcl_DStringValue(&tempString); /* * Convert possible relative path to full path to keep dialog * happy. */ - GetFullPathName(string, MAX_PATH, saveDir, NULL); - lstrcpyn(cdCBData.utfInitDir, saveDir, MAX_PATH); + GetFullPathNameW(uniStr, MAX_PATH, saveDir, NULL); + wcsncpy(cdCBData.initDir, saveDir, MAX_PATH); Tcl_DStringFree(&initDirString); + Tcl_DStringFree(&tempString); break; case DIR_EXIST: if (Tcl_GetBooleanFromObj(interp, valuePtr, @@ -1991,16 +1417,16 @@ Tk_ChooseDirectoryObjCmd( bInfo.hwndOwner = hWnd; bInfo.pszDisplayName = path; bInfo.pidlRoot = NULL; - if (lstrlen(cdCBData.utfInitDir) == 0) { - GetCurrentDirectory(MAX_PATH, cdCBData.utfInitDir); + if (wcslen(cdCBData.initDir) == 0) { + GetCurrentDirectoryW(MAX_PATH, cdCBData.initDir); } bInfo.lParam = (LPARAM) &cdCBData; if (utfTitle != NULL) { - Tcl_UtfToExternalDString(NULL, utfTitle, -1, &titleString); - bInfo.lpszTitle = (LPTSTR) Tcl_DStringValue(&titleString); + Tcl_WinUtfToTChar(utfTitle, -1, &titleString); + bInfo.lpszTitle = (LPWSTR) Tcl_DStringValue(&titleString); } else { - bInfo.lpszTitle = "Please choose a directory, then select OK."; + bInfo.lpszTitle = L"Please choose a directory, then select OK."; } /* @@ -2033,15 +1459,16 @@ Tk_ChooseDirectoryObjCmd( */ oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); - GetCurrentDirectory(MAX_PATH, saveDir); + GetCurrentDirectoryW(MAX_PATH, saveDir); if (SHGetMalloc(&pMalloc) == NOERROR) { - pidl = SHBrowseForFolder(&bInfo); + pidl = SHBrowseForFolderW(&bInfo); /* - * This is a fix for Windows 2000, which seems to modify the folder name - * buffer even when the dialog is canceled (in this case the buffer - * contains garbage). See [Bug #3002230] + * This is a fix for Windows 2000, which seems to modify the folder + * name buffer even when the dialog is canceled (in this case the + * buffer contains garbage). See [Bug #3002230] */ + path[0] = '\0'; /* @@ -2049,17 +1476,17 @@ Tk_ChooseDirectoryObjCmd( */ if (pidl != NULL) { - if (!SHGetPathFromIDList(pidl, path)) { + if (!SHGetPathFromIDListW(pidl, path)) { Tcl_SetResult(interp, "Error: Not a file system folder\n", TCL_VOLATILE); - }; + } pMalloc->lpVtbl->Free(pMalloc, (void *) pidl); - } else if (lstrlen(cdCBData.utfRetDir) > 0) { - lstrcpy(path, cdCBData.utfRetDir); + } else if (wcslen(cdCBData.retDir) > 0) { + wcscpy(path, cdCBData.retDir); } pMalloc->lpVtbl->Release(pMalloc); } - SetCurrentDirectory(saveDir); + SetCurrentDirectoryW(saveDir); Tcl_SetServiceMode(oldMode); /* @@ -2079,7 +1506,7 @@ Tk_ChooseDirectoryObjCmd( if (*path) { Tcl_DString ds; - Tcl_AppendResult(interp, ConvertExternalFilename(NULL, (char *) path, + Tcl_AppendResult(interp, ConvertExternalFilename(path, &ds), NULL); Tcl_DStringFree(&ds); } @@ -2117,10 +1544,11 @@ ChooseDirectoryValidateProc( LPARAM lParam, LPARAM lpData) { - TCHAR selDir[MAX_PATH]; - CHOOSEDIRDATA *chooseDirSharedData = (CHOOSEDIRDATA *) lpData; + WCHAR selDir[MAX_PATH]; + ChooseDir *chooseDirSharedData = (ChooseDir *) lpData; + Tcl_DString tempString; Tcl_DString initDirString; - char string[MAX_PATH]; + WCHAR string[MAX_PATH]; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -2128,7 +1556,7 @@ ChooseDirectoryValidateProc( tsdPtr->debugInterp = (Tcl_Interp *) chooseDirSharedData->interp; Tcl_DoWhenIdle(SetTkDialog, (ClientData) hwnd); } - chooseDirSharedData->utfRetDir[0] = '\0'; + chooseDirSharedData->retDir[0] = '\0'; switch (message) { case BFFM_VALIDATEFAILED: /* @@ -2140,21 +1568,25 @@ ChooseDirectoryValidateProc( * like ~ are converted correctly. */ + Tcl_WinTCharToUtf((TCHAR *) lParam, -1, &initDirString); if (Tcl_TranslateFileName(chooseDirSharedData->interp, - (char *) lParam, &initDirString) == NULL) { + Tcl_DStringValue(&initDirString), &tempString) == NULL) { /* * Should we expose the error (in the interp result) to the user * at this point? */ - chooseDirSharedData->utfRetDir[0] = '\0'; + chooseDirSharedData->retDir[0] = '\0'; return 1; } - lstrcpyn(string, Tcl_DStringValue(&initDirString), MAX_PATH); + Tcl_DStringFree(&initDirString); + Tcl_WinUtfToTChar(Tcl_DStringValue(&tempString), -1, &initDirString); + Tcl_DStringFree(&tempString); + wcsncpy(string, (WCHAR *) Tcl_DStringValue(&initDirString), + MAX_PATH); Tcl_DStringFree(&initDirString); - if (SetCurrentDirectory((char *)string) == 0) { - LPTSTR lpFilePart[MAX_PATH]; + if (SetCurrentDirectoryW(string) == 0) { /* * Get the full path name to the user entry, at this point it does @@ -2162,16 +1594,17 @@ ChooseDirectoryValidateProc( * it. */ - GetFullPathName(string, MAX_PATH, - chooseDirSharedData->utfRetDir, /*unused*/ lpFilePart); + GetFullPathNameW(string, MAX_PATH, + chooseDirSharedData->retDir, NULL); if (chooseDirSharedData->mustExist) { /* * User HAS to select a valid directory. */ - wsprintf(selDir, TEXT("Directory '%.200s' does not exist,\nplease select or enter an existing directory."), chooseDirSharedData->utfRetDir); - MessageBox(NULL, selDir, NULL, MB_ICONEXCLAMATION|MB_OK); - chooseDirSharedData->utfRetDir[0] = '\0'; + wsprintfW(selDir, L"Directory '%.200s' does not exist,\nplease select or enter an existing directory.", + chooseDirSharedData->retDir); + MessageBoxW(NULL, selDir, NULL, MB_ICONEXCLAMATION|MB_OK); + chooseDirSharedData->retDir[0] = '\0'; return 1; } } else { @@ -2180,7 +1613,7 @@ ChooseDirectoryValidateProc( * directory in utfRetDir. */ - GetCurrentDirectory(MAX_PATH, chooseDirSharedData->utfRetDir); + GetCurrentDirectoryW(MAX_PATH, chooseDirSharedData->retDir); return 0; } return 0; @@ -2195,13 +1628,13 @@ ChooseDirectoryValidateProc( * Not called when user changes edit box directly. */ - if (SHGetPathFromIDList((LPITEMIDLIST) lParam, selDir)) { - SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM) selDir); + if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) { + SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir); // enable the OK button - SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); + SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); } else { // disable the OK button - SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); + SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); } UpdateWindow(hwnd); return 1; @@ -2212,9 +1645,10 @@ ChooseDirectoryValidateProc( * specified parameter. */ - char *initDir = chooseDirSharedData->utfInitDir; + WCHAR *initDir = chooseDirSharedData->initDir; + + SetCurrentDirectoryW(initDir); - SetCurrentDirectory(initDir); if (*initDir == '\\') { /* * BFFM_SETSELECTION only understands UNC paths as pidls, so @@ -2228,27 +1662,23 @@ ChooseDirectoryValidateProc( if (SUCCEEDED(SHGetDesktopFolder(&psfFolder))) { LPITEMIDLIST pidlMain; ULONG ulCount, ulAttr; - Tcl_DString ds; - Tcl_UtfToExternalDString(TkWinGetUnicodeEncoding(), - initDir, -1, &ds); if (SUCCEEDED(psfFolder->lpVtbl->ParseDisplayName( psfFolder, hwnd, NULL, (WCHAR *) - Tcl_DStringValue(&ds), &ulCount,&pidlMain,&ulAttr)) + initDir, &ulCount,&pidlMain,&ulAttr)) && (pidlMain != NULL)) { - SendMessage(hwnd, BFFM_SETSELECTION, FALSE, + SendMessageW(hwnd, BFFM_SETSELECTIONW, FALSE, (LPARAM) pidlMain); pMalloc->lpVtbl->Free(pMalloc, pidlMain); } psfFolder->lpVtbl->Release(psfFolder); - Tcl_DStringFree(&ds); } pMalloc->lpVtbl->Release(pMalloc); } } else { - SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM) initDir); + SendMessageW(hwnd, BFFM_SETSELECTIONW, TRUE, (LPARAM) initDir); } - SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); + SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); break; } @@ -2279,7 +1709,7 @@ Tk_MessageBoxObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window) clientData, parent; HWND hWnd; @@ -2287,7 +1717,7 @@ Tk_MessageBoxObjCmd( int defaultBtn, icon, type; int i, oldMode, winCode; UINT flags; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "-default", "-detail", "-icon", "-message", "-parent", "-title", "-type", NULL }; @@ -2298,7 +1728,6 @@ Tk_MessageBoxObjCmd( ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - (void) TkWinGetUnicodeEncoding(); defaultBtn = -1; detailObj = NULL; icon = MB_ICONINFORMATION; @@ -2309,7 +1738,6 @@ Tk_MessageBoxObjCmd( for (i = 1; i < objc; i += 2) { int index; - char *string; Tcl_Obj *optionPtr, *valuePtr; optionPtr = objv[i]; @@ -2320,7 +1748,7 @@ Tk_MessageBoxObjCmd( return TCL_ERROR; } if (i + 1 == objc) { - string = Tcl_GetString(optionPtr); + const char *string = Tcl_GetString(optionPtr); Tcl_AppendResult(interp, "value for \"", string, "\" missing", NULL); return TCL_ERROR; @@ -2425,7 +1853,7 @@ Tk_MessageBoxObjCmd( tsdPtr->hSmallIcon = TkWinGetIcon(parent, ICON_SMALL); tsdPtr->hBigIcon = TkWinGetIcon(parent, ICON_BIG); - tsdPtr->hMsgBoxHook = SetWindowsHookEx(WH_CBT, MsgBoxCBTProc, NULL, + tsdPtr->hMsgBoxHook = SetWindowsHookExW(WH_CBT, MsgBoxCBTProc, NULL, GetCurrentThreadId()); winCode = MessageBoxW(hWnd, Tcl_GetUnicode(tmpObj), titleObj ? Tcl_GetUnicode(titleObj) : L"", flags); @@ -2453,7 +1881,7 @@ MsgBoxCBTProc( LPARAM lParam) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (nCode == HCBT_CREATEWND) { /* @@ -2469,9 +1897,9 @@ MsgBoxCBTProc( if (WC_DIALOG == lpcbtcreate->lpcs->lpszClass) { HWND hwnd = (HWND) wParam; - SendMessage(hwnd, WM_SETICON, ICON_SMALL, + SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) tsdPtr->hSmallIcon); - SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) tsdPtr->hBigIcon); + SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) tsdPtr->hBigIcon); } } @@ -2510,15 +1938,15 @@ SetTkDialog( /* * Factored out a common pattern in use in this file. */ -static char * + +static const char * ConvertExternalFilename( - Tcl_Encoding encoding, - char *filename, + WCHAR *filename, Tcl_DString *dsPtr) { char *p; - Tcl_ExternalToUtfDString(encoding, filename, -1, dsPtr); + Tcl_WinTCharToUtf((TCHAR *) filename, -1, dsPtr); for (p = Tcl_DStringValue(dsPtr); *p != '\0'; p++) { /* * Change the pathname to the Tcl "normalized" pathname, where back diff --git a/win/tkWinInit.c b/win/tkWinInit.c index 19556dd..31304d3 100644 --- a/win/tkWinInit.c +++ b/win/tkWinInit.c @@ -120,6 +120,20 @@ TkpDisplayWarning( WCHAR msgString[TK_MAX_WARN_LEN + 5]; WCHAR titleString[TK_MAX_WARN_LEN + 1]; + /* If running on Cygwin and we have a stderr channel, use it. */ +#if !defined(STATIC_BUILD) + if (tclStubsPtr->reserved9) { + Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR); + if (errChannel) { + Tcl_WriteChars(errChannel, title, -1); + Tcl_WriteChars(errChannel, ": ", 2); + Tcl_WriteChars(errChannel, msg, -1); + Tcl_WriteChars(errChannel, "\n", 1); + return; + } + } +#endif /* !STATIC_BUILD */ + MultiByteToWideChar(CP_UTF8, 0, msg, -1, msgString, TK_MAX_WARN_LEN); MultiByteToWideChar(CP_UTF8, 0, title, -1, titleString, TK_MAX_WARN_LEN); /* diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index cb40c50..48bc16b 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -3205,7 +3205,7 @@ SetDefaults( int padding; #endif } nc; - OSVERSIONINFO os; + OSVERSIONINFOW os; /* * Set all of the default options. The loop will terminate when we run out @@ -3225,8 +3225,8 @@ SetDefaults( nc.metrics.cbSize = sizeof(nc); - os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&os); + os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + GetVersionExW(&os); if (os.dwMajorVersion < 6) { nc.metrics.cbSize -= sizeof(int); } diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 14f949c..8d7778c 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -63,8 +63,8 @@ #ifndef __GNUC__ -# define strncasecmp strnicmp -# define strcasecmp stricmp +# define strncasecmp _strnicmp +# define strcasecmp _stricmp #endif #define NBBY 8 diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 2ec6883..46aad58 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -553,7 +553,7 @@ ScrollbarProc( } interp = scrollPtr->info.interp; - code = Tcl_GlobalEval(interp, cmdString.string); + code = Tcl_EvalEx(interp, cmdString.string, -1, TCL_EVAL_GLOBAL); if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (scrollbar command)"); Tcl_BackgroundError(interp); diff --git a/win/tkWinWm.c b/win/tkWinWm.c index e3816ca..9ea4957 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -5309,11 +5309,6 @@ WmStateCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0, - &index) != TCL_OK) { - return TCL_ERROR; - } - if (winPtr->flags & TK_EMBEDDED) { int state = 0; @@ -6590,7 +6585,7 @@ TkWmProtocolEventProc( Tcl_Preserve((ClientData) protPtr); interp = protPtr->interp; Tcl_Preserve((ClientData) interp); - result = Tcl_GlobalEval(interp, protPtr->command); + result = Tcl_EvalEx(interp, protPtr->command, -1, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command for \""); Tcl_AddErrorInfo(interp, name); diff --git a/win/tkWinX.c b/win/tkWinX.c index 1e218ec..cbd6032 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -166,20 +166,32 @@ TkGetServerInfo( Tk_Window tkwin) /* Token for window; this selects a particular * display and server. */ { - char buffer[60]; - OSVERSIONINFO os; - - os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&os); - sprintf(buffer, "Windows %d.%d %d %s", (int)os.dwMajorVersion, - (int)os.dwMinorVersion, (int)os.dwBuildNumber, + static char buffer[32]; /* Empty string means not initialized yet. */ + OSVERSIONINFOW os; + + if (!buffer[0]) { + HANDLE handle = LoadLibraryW(L"NTDLL"); + int(__stdcall *getversion)(void *) = + (int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion"); + os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + if (!getversion || getversion(&os)) { + GetVersionExW(&os); + } + if (handle) { + FreeLibrary(handle); + } + /* Write the first character last, preventing multi-thread issues. */ + sprintf(buffer+1, "indows %d.%d %d %s", (int)os.dwMajorVersion, + (int)os.dwMinorVersion, (int)os.dwBuildNumber, #ifdef _WIN64 - "Win64" + "Win64" #else - "Win32" + "Win32" #endif - ); - Tcl_SetResult(interp, buffer, TCL_VOLATILE); + ); + buffer[0] = 'W'; + } + Tcl_SetResult(interp, buffer, TCL_STATIC); } /* @@ -378,10 +390,10 @@ int TkWinGetPlatformId(void) { if (tkPlatformId == 0) { - OSVERSIONINFO os; + OSVERSIONINFOW os; - os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&os); + os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + GetVersionExW(&os); tkPlatformId = os.dwPlatformId; /* diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index fda7b04..80b616d 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1256,10 +1256,10 @@ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) HINSTANCE hlibrary; Ttk_Theme themePtr, parentPtr, vistaPtr; ElementInfo *infoPtr; - OSVERSIONINFO os; + OSVERSIONINFOW os; - os.dwOSVersionInfoSize = sizeof(os); - GetVersionEx(&os); + os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + GetVersionExW(&os); procs = LoadXPThemeProcs(&hlibrary); if (!procs) diff --git a/win/winMain.c b/win/winMain.c index eea7004..01a5e23 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -16,6 +16,10 @@ #undef WIN32_LEAN_AND_MEAN #include <locale.h> +#if defined(__GNUC__) +int _CRT_glob = 0; +#endif /* __GNUC__ */ + /* * The following declarations refer to internal Tk routines. These interfaces * are available for use, but are not supported. diff --git a/win/wish.exe.manifest.in b/win/wish.exe.manifest.in index 2cae0c0..4829471 100644 --- a/win/wish.exe.manifest.in +++ b/win/wish.exe.manifest.in @@ -8,6 +8,30 @@ type="win32" /> <description>Tcl/Tk windowing shell (wish)</description> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> + <security> + <requestedPrivileges> + <requestedExecutionLevel + level="asInvoker" + uiAccess="false" + /> + </requestedPrivileges> + </security> + </trustInfo> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <!-- Windows 10 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> + <!-- Windows 8.1 --> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <!-- Windows 8 --> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> + <!-- Windows 7 --> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> + <!-- Windows Vista --> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> + </application> + </compatibility> <asmv3:application> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> diff --git a/xlib/xcolors.c b/xlib/xcolors.c index 70ab3cb..66591c7 100644 --- a/xlib/xcolors.c +++ b/xlib/xcolors.c @@ -14,11 +14,14 @@ #include "tkInt.h" /* - * Index array. For each of the characters 'a'-'y', this table gives the first color - * starting with that character in the xColors table. + * Index array. For each of the characters 'a'-'y', this table gives the first + * color starting with that character in the xColors table. */ -static const unsigned char az[] = {0, 5, 13, 21, 45, 46, 50, 60, 62, 65, 66, - 67, 91, 106, 109, 115, 126, 127, 130, 144, 149, 150, 152, 155, 156, 158}; + +static const unsigned char az[] = { + 0, 5, 13, 21, 45, 46, 50, 60, 62, 65, 66, + 67, 91, 106, 109, 115, 126, 127, 130, 144, 149, 150, 152, 155, 156, 158 +}; /* * Define an array that defines the mapping from color names to RGB values. @@ -241,15 +244,17 @@ static const elem xColors[] = { * None. * *---------------------------------------------------------------------- + * + * This only handles hex-strings without 0x prefix. Luckily, that's just what + * we need. */ -#if defined(__WIN32__) && !defined(__CYGWIN__) -# ifdef NO_STRTOI64 -/* This version only handles hex-strings without 0x prefix */ -static __int64 -_strtoi64(const char *spec, char **p, int base) +static Tcl_WideInt +parseHex64bit( + const char *spec, + char **p) { - __int64 result = 0; + Tcl_WideInt result = 0; char c; while ((c = *spec)) { if ((c >= '0') && (c <= '9')) { @@ -267,16 +272,18 @@ _strtoi64(const char *spec, char **p, int base) *p = (char *) spec; return result; } -# endif -#else -# define _strtoi64 strtoll -#endif -static int colorcmp(const char *spec, const char *pname, int *special) { +static int +colorcmp( + const char *spec, + const char *pname, + int *special) +{ int r; int c, d; int notequal = 0; int num = 0; + do { d = *pname++; c = (*spec == ' '); @@ -286,9 +293,12 @@ static int colorcmp(const char *spec, const char *pname, int *special) { if ((unsigned)(d - 'A') <= (unsigned)('Z' - 'A')) { d += 'a' - 'A'; } else if (c) { - /* A space doesn't match a lowercase, but we don't know - * yet whether we should return a negative or positive - * number. That depends on what follows. */ + /* + * A space doesn't match a lowercase, but we don't know yet + * whether we should return a negative or positive number. That + * depends on what follows. + */ + notequal = 1; } c = *spec++; @@ -305,19 +315,24 @@ static int colorcmp(const char *spec, const char *pname, int *special) { } } r = c - d; - } while(!r && d); + } while (!r && d); + if (!r && notequal) { - /* Strings are equal, but difference in spacings only. We should still - * report not-equal, so "burly wood" is not a valid color */ + /* + * Strings are equal, but difference in spacings only. We should still + * report not-equal, so "burly wood" is not a valid color. + */ + r = 1; } *special = num; return r; } -#define RED(p) ((unsigned char)(p)[0]) -#define GREEN(p) ((unsigned char)(p)[1]) -#define BLUE(p) ((unsigned char)(p)[2]) +#define RED(p) ((unsigned char) (p)[0]) +#define GREEN(p) ((unsigned char) (p)[1]) +#define BLUE(p) ((unsigned char) (p)[2]) +#define US(expr) ((unsigned short) (expr)) Status XParseColor( @@ -328,42 +343,44 @@ XParseColor( { if (spec[0] == '#') { char *p; - Tcl_WideInt value = _strtoi64(++spec, &p, 16); + Tcl_WideInt value = parseHex64bit(++spec, &p); switch ((int)(p-spec)) { case 3: - colorPtr->red = (unsigned short) (((value >> 8) & 0xf) * 0x1111); - colorPtr->green = (unsigned short) (((value >> 4) & 0xf) * 0x1111); - colorPtr->blue = (unsigned short) ((value & 0xf) * 0x1111); + colorPtr->red = US(((value >> 8) & 0xf) * 0x1111); + colorPtr->green = US(((value >> 4) & 0xf) * 0x1111); + colorPtr->blue = US((value & 0xf) * 0x1111); break; case 6: - colorPtr->red = (unsigned short) (((value >> 16) & 0xff) | ((value >> 8) & 0xff00)); - colorPtr->green = (unsigned short) (((value >> 8) & 0xff) | (value & 0xff00)); - colorPtr->blue = (unsigned short) ((value & 0xff) | (value << 8)); + colorPtr->red = US(((value >> 16) & 0xff) | ((value >> 8) & 0xff00)); + colorPtr->green = US(((value >> 8) & 0xff) | (value & 0xff00)); + colorPtr->blue = US((value & 0xff) | (value << 8)); break; case 9: - colorPtr->red = (unsigned short) (((value >> 32) & 0xf) | ((value >> 20) & 0xfff0)); - colorPtr->green = (unsigned short) (((value >> 20) & 0xf) | ((value >> 8) & 0xfff0)); - colorPtr->blue = (unsigned short) (((value >> 8) & 0xf) | (value << 4)); + colorPtr->red = US(((value >> 32) & 0xf) | ((value >> 20) & 0xfff0)); + colorPtr->green = US(((value >> 20) & 0xf) | ((value >> 8) & 0xfff0)); + colorPtr->blue = US(((value >> 8) & 0xf) | (value << 4)); break; case 12: - colorPtr->red = (unsigned short) (value >> 32); - colorPtr->green = (unsigned short) (value >> 16); - colorPtr->blue = (unsigned short) value; + colorPtr->red = US(value >> 32); + colorPtr->green = US(value >> 16); + colorPtr->blue = US(value); break; default: return 0; } } else { - int size, num; - const elem *p; - const char *q; /* * Perform a binary search on the sorted array of colors. * size = current size of search range * p = pointer to current element being considered. */ + + int size, num; + const elem *p; + const char *q; int r = (spec[0] - 'A') & 0xdf; + if (r >= (int) sizeof(az) - 1) { return 0; } @@ -386,11 +403,15 @@ XParseColor( r = colorcmp(spec + 1, *p, &num); } if (num > (*p)[31]) { - if (((*p)[31] != 8) || num > 100) + if (((*p)[31] != 8) || num > 100) { return 0; + } num = (num * 255 + 50) / 100; if ((num == 230) || (num == 128)) { - /* Those two entries have a deviation i.r.t the table */ + /* + * Those two entries have a deviation i.r.t the table. + */ + num--; } num |= (num << 8); @@ -408,49 +429,6 @@ XParseColor( return 1; } - -#if 0 -int main() { - XColor color; - char buf[32]; - int charindex; - int i, result; - int repeat = 1; - int num, maxnum; - char *end; - - while (repeat--) { - buf[0] = 'a'; - charindex = 1; - for (i = 0; i < sizeof(xColors)/sizeof(xColors[0]); ++i) { - while (i >= az[charindex]) { - ++charindex; - ++(buf[0]); - } - strcpy(buf + 1, xColors[i]); - end = buf + strlen(buf); - num = 0; - result = XParseColor(0, 0, buf, &color); - printf("%3d %3d %3d\t\t%s\n", color.red >> 8, color.green >> 8, color.blue >> 8, buf); - maxnum = xColors[i][31]; - if (maxnum == 8) maxnum = 100; - while (result && ++num <= maxnum) { - sprintf(end, "%d", num); - result = XParseColor(0, 0, buf, &color); - printf("%3d %3d %3d\t\t%s\n", color.red >> 8, color.green >> 8, color.blue >> 8, buf); - } - if (!result) { - break; - } - } - } - if (!result) { - printf("NOT OK: %s\n", buf); - } else { - printf("OK\n"); - } -} -#endif /* * Local Variables: * mode: c |