Compare commits

...

3 Commits

Author SHA1 Message Date
Steve Dower
c6710de848 Import Tk 8.6.12 2021-11-08 17:29:19 +00:00
Steve Dower
070b8750b0 Import Tk 8.6.11 2021-03-30 00:54:10 +01:00
Steve Dower
42c69189d9 Import Tk 8.6.10 2020-09-24 22:55:34 +01:00
607 changed files with 48236 additions and 29440 deletions

236
.travis.yml Normal file
View File

@@ -0,0 +1,236 @@
language: c
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- binutils-mingw-w64-i686
- binutils-mingw-w64-x86-64
- gcc-mingw-w64
- gcc-mingw-w64-base
- gcc-mingw-w64-i686
- gcc-mingw-w64-x86-64
- gcc-multilib
- tcl8.6-dev
- libx11-dev
- libxss-dev
- xvfb
homebrew:
packages:
- tcl-tk
# casks:
# - xquartz
jobs:
include:
# Testing on Linux GCC
- name: "Linux/GCC/Shared"
os: linux
dist: focal
services:
- xvfb
compiler: gcc
env:
- BUILD_DIR=unix
script: &x11gui
- make binaries libraries tktest
- make install
- make test-classic >out-classic.txt
- cat out-classic.txt
- grep -q "Failed 0" out-classic.txt
- make test-ttk >out-ttk.txt
- cat out-ttk.txt
- grep -q "Failed 0" out-ttk.txt
- name: "Linux/GCC/Shared/no-xft"
os: linux
dist: focal
services:
- xvfb
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="--disable-xft"
script: *x11gui
- name: "Linux/GCC/Shared/bionic"
os: linux
dist: bionic
services:
- xvfb
compiler: gcc
env:
- BUILD_DIR=unix
script: *x11gui
- name: "Linux/GCC/Shared/xenial"
os: linux
dist: xenial
services:
- xvfb
compiler: gcc
env:
- BUILD_DIR=unix
script: *x11gui
- name: "Linux/GCC/Static"
os: linux
dist: focal
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="--disable-shared"
- name: "Linux/GCC/Debug"
os: linux
dist: focal
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols"
# Newer/Older versions of GCC
- name: "Linux/GCC 10/Shared"
os: linux
dist: focal
compiler: gcc-10
addons:
apt:
packages:
- g++-10
env:
- BUILD_DIR=unix
- name: "Linux/GCC 5/Shared"
os: linux
dist: bionic
compiler: gcc-5
addons:
apt:
packages:
- g++-5
env:
- BUILD_DIR=unix
# Testing on Linux Clang
- name: "Linux/Clang/Shared"
os: linux
dist: focal
compiler: clang
env:
- BUILD_DIR=unix
- name: "Linux/Clang/Shared/no-xft"
os: linux
dist: focal
compiler: clang
env:
- BUILD_DIR=unix
- CFGOPT="--disable-xft"
- name: "Linux/Clang/Static"
os: linux
dist: focal
compiler: clang
env:
- CFGOPT="--disable-shared"
- BUILD_DIR=unix
- name: "Linux/Clang/Debug"
os: linux
dist: focal
compiler: clang
env:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols"
# Testing on Mac, various styles
- name: "macOS/Xcode 12/Shared"
os: osx
osx_image: xcode12
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include"
- name: "macOS/Xcode 12/Static"
os: osx
osx_image: xcode12
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --disable-shared CFLAGS=-I/usr/local/opt/tcl-tk/include"
- name: "macOS/Xcode 12/Debug"
os: osx
osx_image: xcode12
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --enable-symbols CFLAGS=-I/usr/local/opt/tcl-tk/include"
# - name: "macOS/Xcode 12/Shared/XQuartz"
# os: osx
# osx_image: xcode12
# env:
# - BUILD_DIR=unix
# - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --disable-corefoundation --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib CFLAGS=-I/usr/local/opt/tcl-tk/include"
# Older MacOS versions
- name: "macOS/Xcode 11/Shared"
os: osx
osx_image: xcode11.7
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14"
- name: "macOS/Xcode 10/Shared"
os: osx
osx_image: xcode10.3
addons:
homebrew:
packages:
- tcl-tk
update: true
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14"
- name: "macOS/Xcode 9/Shared"
os: osx
osx_image: xcode9.4
addons:
homebrew:
packages:
- tcl-tk
update: true
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.13"
# Test on Windows with MSVC native
# - name: "Windows/MSVC/Shared"
# os: windows
# compiler: cl
# env: &vcenv
# - BUILD_DIR=win
# - VCDIR="/C/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build"
# before_install: &vcpreinst
# - PATH="$PATH:$VCDIR"
# - cd ${BUILD_DIR}
# install: []
# script:
# - cmd.exe //C vcvarsall.bat x64 '&&' nmake '-f' makefile.vc all tktest
# "make dist" only
- name: "Linux: make dist"
os: linux
dist: focal
compiler: gcc
env:
- BUILD_DIR=unix
script:
- touch ../doc/man.macros
- make dist
before_install:
- |-
case $TRAVIS_OS_NAME in
windows)
choco install -y magicsplat-tcl-tk
;;
esac
- cd ${BUILD_DIR}
install:
- mkdir "$HOME/install dir"
- ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1)
script:
- make binaries libraries tktest
- make install
before_cache:
- |-
case $TRAVIS_OS_NAME in
osx)
brew cleanup
;;
esac
cache:
directories:
- $HOME/Library/Caches/Homebrew
- $HOME/AppData/Local/Temp/chocolatey
- $HOME/AppData/Local/Apps/Tcl86

View File

@@ -1,6 +1,6 @@
A NOTE ON THE CHANGELOG:
Starting in early 2011, Tk source code has been under the management of
fossil, hosted at http://core.tcl-lang.org/tk/ . Fossil presents a "Timeline"
fossil, hosted at https://core.tcl-lang.org/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 Tk developers are now out of the habit of maintaining
this log file. You may still find useful things in it, but the Timeline is
@@ -3203,7 +3203,7 @@ a better first place to look now.
2009-03-25 Jan Nijtmans <nijtmans@users.sf.net>
* doc/wish.1: Bring doc and demos in line with
* library/demos/hello: http://wiki.tcl.tk/812
* library/demos/hello: https://wiki.tcl-lang.org/page/exec+magic
* library/demos/rmt
* library/demos/square
* library/demos/tcolor

View File

@@ -5218,7 +5218,7 @@
2000-05-31 Eric Melski <ericm@scriptics.com>
* library/bgerror.tcl: Improved bgerror based on work by Donal
K. Fellows; no longer dependant on tk_dialog; features a
K. Fellows; no longer dependent on tk_dialog; features a
Windows-esque "Details" button, and a customizable extra function
button that allows the user to (for example) save the stack trace
to a file.

41
README
View File

@@ -1,41 +0,0 @@
README: Tk
This is the Tk 8.6.9 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.
For details on features, incompatibilities, and potential problems with
this release, see the Tcl/Tk 8.6 Web page at
http://www.tcl-lang.org/software/tcltk/8.6.html
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 the Tcl community.
Source code development and tracking of bug reports and feature requests
takes place at:
http://core.tcl-lang.org/tk/
with the Tcl Developer Xchange at:
http://www.tcl-lang.org/
Tk is a freely available open source package. You can do virtually
anything you like with it, such as modifying it, redistributing it,
and selling it either in whole or in part. See the file
"license.terms" for complete information.
2. See Tcl README
-----------------
Please see the README file that comes with the associated Tcl release
for more information. There are pointers there to extensive
documentation. In addition, there are additional README files
in the subdirectories of this distribution.

View File

@@ -1,2 +1,40 @@
# cpython-source-deps
Source for packages that the cpython build process depends on
# README: Tk
This is the **Tk 8.6.12** source distribution.
You can get any source release of Tk from [our distribution
site](https://sourceforge.net/projects/tcl/files/Tcl/).
[![Build Status](https://github.com/tcltk/tk/workflows/Linux/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Acore-8-6-branch)
[![Build Status](https://github.com/tcltk/tk/workflows/Windows/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Acore-8-6-branch)
[![Build Status](https://github.com/tcltk/tk/workflows/macOS/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Acore-8-6-branch)
## <a id="intro">1.</a> Introduction
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.6 Web page](https://www.tcl-lang.org/software/tcltk/8.6.html)
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 the Tcl community.
Source code development and tracking of bug reports and feature requests
take place at [core.tcl-lang.org](https://core.tcl-lang.org/).
Tcl/Tk release and mailing list services are [hosted by
SourceForge](https://sourceforge.net/projects/tcl/)
with the Tcl Developer Xchange hosted at
[www.tcl-lang.org](https://www.tcl-lang.org).
Tk is a freely available open-source package. You can do virtually
anything you like with it, such as modifying it, redistributing it,
and selling it either in whole or in part. See the file
`license.terms` for complete information.
## <a id="tcl">2.</a> See Tcl README.md
Please see the README.md file that comes with the associated Tcl release
for more information. There are pointers there to extensive
documentation. In addition, there are additional README files
in the subdirectories of this distribution.

352
changes
View File

@@ -7072,7 +7072,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
2013-08-25 (bug fix)[3016181] Cocoa: [destroy $scrollbar] => crash (goddard)
--- Released 8.6.1, September 19, 2013 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.1, September 19, 2013 --- https://core.tcl-lang.org/tk/ for details
2013-10-27 (bug fix) OSX drawing lags (deily,steffen,walzer)
@@ -7120,7 +7120,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
2014-08-01 (bug fix) OSX font config crash (rob@bitkeeper)
--- Released 8.6.2, August 27, 2014 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.2, August 27, 2014 --- https://core.tcl-lang.org/tk/ for details
2014-08-27 (bug) Cocoa: Crash after [$button destroy] (walzer)
@@ -7144,7 +7144,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
2014-11-07 (bug)[3529885] [scale] handling of negative resolution (vogel)
--- Released 8.6.3, November 12, 2014 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.3, November 12, 2014 --- https://core.tcl-lang.org/tk/ for details
2014-11-14 (bug)[d43a10] shimmer-related crash in [tk_getOpenFile] (nadkarni)
@@ -7166,7 +7166,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
Tk Cocoa 2.0: App Store enabled (walzer,culler,desmera,owen,nyberg,reincke)
*** POTENTIAL INCOMPATIBILITY ***
--- Released 8.6.4, March 12, 2015 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.4, March 12, 2015 --- https://core.tcl-lang.org/tk/ for details
2015-03-10 (bug) Cocoa: premature image free crash (walzer)
@@ -7265,7 +7265,7 @@ Tk Cocoa 2.0: App Store enabled (walzer,culler,desmera,owen,nyberg,reincke)
Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
--- Released 8.6.5, February 29, 2016 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.5, February 29, 2016 --- https://core.tcl-lang.org/tk/ for details
2016-03-07 (bug)[3137232] spinbox teardown hygiene (vogel)
@@ -7312,7 +7312,7 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2016-07-21 (bug)[450bb0] Aqua: memory corruption from [tk busy] (porter)
--- Released 8.6.6, July 27, 2016 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.6, July 27, 2016 --- https://core.tcl-lang.org/tk/ for details
2016-08-23 (bug)[a2abc4] Wrong warp cursor position on 2nd display (vogel)
@@ -7414,7 +7414,7 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2017-08-08 (bug)[4966ca] Scidb race in notebook tab selection (cramer)
--- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.7, August 9, 2017 --- https://core.tcl-lang.org/tk/ for details
2017-08-24 (bug)[f1a3ca] Memory leak in [text] B-tree (edhume3)
@@ -7494,7 +7494,7 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2017-12-18 (bug)[b77626] Make [tk busy -cursor] silent no-op on macOS (vogel)
--- Released 8.6.8, December 22, 2017 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.8, December 22, 2017 --- https://core.tcl-lang.org/tk/ for details
2017-12-31 (bug)[aa7679] crash using window after master destroyed (vogel)
@@ -7568,4 +7568,338 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2018-11-04 (bug)[6b22d4] [treeview] binding fix (ohagan)
- Released 8.6.9, November 16, 2018 - http://core.tcl-lang.org/tk/ for details -
- Released 8.6.9, November 16, 2018 - https://core.tcl-lang.org/tk/ for details
2018-11-19 (bug)[0a9c91] crash in text-11a.22 (vogel)
2018-11-20 (bug)[9705d1] crash activating "Alt" theme (culler)
2018-11-24 (bug)[e3b954] cursor offset at full screen display (culler)
2019-01-04 (bug)[18a4ba] cross-platform [winfo containing] (culler)
2019-01-08 (feature) local grab on Mac OSX (culler)
2019-01-10 (build) 'None', 'ControlMask' symbol conflicts (nijtmans)
2019-01-20 (bug)[509caf] [treeview tag configure] regression (mcdonald,vogel)
2019-01-26 (bug)[3003895] [scale] res rounds and -from (tischler,pieper,vogel)
2019-02-02 (new)[TIP 533] [$mb post x y idx] (culler,vogel)
2019-02-08 (bug)[1529659] embed toplevel blocks outer menu (culler)
2019-02-10 (bug)[8814bd] crash in [NSMenu size] (culler)
2019-02-13 (bug)[b389df] Aqua: mouse position on dual screen (culler)
2019-02-23 (bug)[56a182] Aqua: [tk_getOpenFile] causes off-screen toplevels (culler,walzer)
2019-02-23 (bug)[9771ae] Aqua: workaround incompatible transient window models (culler,walzer)
2019-03-01 (bug)[1951ab] Prevent transient window cycles (crashed on Aqua) (culler,vogel)
*** POTENTIAL INCOMPATIBILITY ***
2019-03-04 (bug)[4da219] Incomplete read of multi-image GIF (oehlmann)
2019-03-14 (bug)[609e00] Aqua: wrong coords from MouseWheel binding (vogel,culler)
2019-03-25 (bug)[48c394] Aqua: recompute text layout for empty string (culler)
2019-03-31 (new)[TIP 535] Precision of ::scale widget tick mark values (vogel)
*** POTENTIAL INCOMPATIBILITY ***
2019-03-31 (bug)[da3914] [$treeview identify element] failure (ulfalizer,vogel)
2019-04-06 (bug)[897ffe] Prevent cross-manager loops of geom management (culler,vogel)
2019-04-11 (new) Apple Dark Mode support (culler)
2019-04-14 (new) Aqua: Use color names consistent with NSColor (culler)
*** POTENTIAL INCOMPATIBILITY ***
2019-04-14 (new) Aqua: [tk::unsupported::MacWindowStyle isdark] (culler)
2019-04-19 (bug)[368fa4] Prevent toggle of hidden treeview indicators (ulfalizer,vogel)
2019-04-24 (bug)[4d2e8d] Aqua: notebook pane redraws (culler)
2019-04-24 (bug)[928652] Apply TIP 533 for ttk::menubutton (culler,vogel)
2019-04-24 (bug)[1001070] X-platform rework of label options -highlight* (seal,culler,vogel)
2019-04-28 (bug)[6286fd] checkbutton handling of -selectcolor (ralfixx)
2019-04-30 (bug)[4f9a99] Win: crash in [style element create] (oehlman,vogel)
2019-05-08 (bug) Ttk scrolling bugs, see tests treeview-9.1, entry-3.[3-6] (vogel)
2019-05-08 (bug)[51b4b1] Aqua: combobox use native ttk scrollbar (bll,vogel)
*** POTENTIAL INCOMPATIBILITY ***
2019-05-18 (new)[eb2996] Win: support for horizontal scrolling (chavez,vogel)
2019-05-26 (new)[TIP 541] [combobox current] support "end" index (vogel)
2019-05-26 (bug)[2a6c62] <<TreeviewSelect>> trigger on item delete (vogel)
2019-06-05 (bug)[9ebc6f] Aqua: fix incorrect reports of mouse coords (chavez, culler)
2019-06-14 (bug)[436ad6] Corrected Aqua regressions in [wm manage] (walzer, culler)
2019-06-15 (bug)[75b8fb] Crash with some [event generate]d <ButtonRelease> (leunissen,vogel)
2019-06-15 (new)[TIP 536] New tk::mac::* commands for IPC on Mac OSX (walzer)
2019-07-13 (bug)[4566e2] Aqua: Make default background color of Tk and Ttk agree (walzer,culler)
*** POTENTIAL INCOMPATIBILITY ***
2019-07-16 (bug)[5ddeca] Stop app switching exposing withdrawn windows as zombies (culler)
2019-07-25 (new)[1fb7af] Win support for buttons 4 and 5 (chavez,vogel,nijtmans)
2019-08-18 (new) Refactor all MouseWheel bindings (nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2019-08-21 (bug)[c8ccd1] up array key in [text] takes to index 1.0 (ulfalizer,vogel)
2019-08-28 (new)[TIP 532] Tk event loop rewrite to prevent ring overflow (cramer)
*** POTENTIAL INCOMPATIBILITY ***
2019-08-28 (bug)[943d5e] Win: embedded widget destruction cancels window resize (nemethi,vogel,nijtmans)
2019-09-12 (bug)[2834776] Stop disabled spinbox from generating <<Increment>> & <<Decrement>> (vogel)
2019-09-24 (bug)[96bce5] Aqua: Prevent crash drawing 1x1 rounded rectangles (bll,culler)
2019-10-03 (bug)[3ed5b6] Win: root window position with highlightthickness>0 (leunissem,vogel,nijtmans)
2019-10-09 (bug)[a01b6f7] Workaround XWayland bug reporting screen width (werner,nijtmans)
2019-10-10 (bug) Aqua: Prevent crash deactivating menu during menu deletion (culler)
2019-10-21 (bug)[aea00b] Aqua: Better handling of resolution changes (chavez, culler)
2019-10-25 (bug)[b82bd4] Fix [style configure -compound] (culler,vogel)
2019-10-27 (bug)[f7a4f7] Aqua: embedded toplevel, forced focus and mouse coords (naaus,culler)
2019-11-13 (new) Win: keycodes Mail, AudioMedia, Launch0, Launch1 (nijtmans)
2019-11-15 (bug)[69b48f] failing test textTag-18.1 (vogel)
2019-11-17 (bug)[c4abd2] panic in stackorder command (culler)
2019-11-17 (bug)[53d280] [wm iconphoto] crash on empty image (culler)
2019-11-17 [90d555] workaround NSFontManager bad selections (culler)
2019-11-19 (new) Partial Emoji support in text displays (nijtmans,culler)
- Released 8.6.10, Nov 21, 2019 - https://core.tcl-lang.org/tk/ for details
2019-11-25 (bug)[a95373] TkKeyEvent platform variations (werner)
2019-11-26 (bug) workaround Win bug so test bind-34.3 passes (nijtmans)
2019-12-03 Aqua: white cursors in dark mode (culler)
2019-12-04 (bug)[749bd9] Aqua: systemControlAccentColor (bll,culler)
2019-12-14 (bug)[b3b56a] ttk respect -cursor option (vogel)
2019-12-14 (bug)[b094cb] Win: $tv -show grows widget width 1 pixel (vogel)
2019-12-14 (bug)[02a694] spinbox options used wrong db names (vogel)
2020-01-11 (bug)[2b8fa6] MouseWheel for ttk::scrollbar (oehlmann)
2020-01-18 (bug)[1771594] icursor and scrollregion, canvText-14.7 (vogel)
2020-01-18 (bug)[587937] tag list ops preserve list order (vogel)
2020-01-18 (bug)[2830360] lose invalid state at focus event, entry-10.1 (vogel)
2020-01-18 (bug)[077d49] string table options support null ok (vogel)
2020-01-18 (bug)[bf93d0] Aqua: unresponsive menubar (culler)
2020-01-31 (bug)[a196fb] restore support for unthreaded Tcl (porter,sebres)
2020-02-09 (bug)[90a4d7] fontconfig crash when no font installed (vogel)
2020-02-24 (bug) Aqua: incomplete floating window display (walzer)
2020-03-11 (bug)[fb2ec3] OSX 10.15+: full screen options (nicolas,walzer)
2020-03-12 (bug)[08e2f8] focus on unmapped windows, focus-7.1 (vogel)
2020-03-12 (bug)[2edd84] [$c postscript] result management (gavilan)
2020-03-22 (bug)[98662d] restore TK_MAC_DEBUG_DRAWING build (chavez)
2020-03-29 (bug)[655fe2] tearoff menu redraw artifacts (vogel)
2020-04-03 (bug)[efbedd] Aqua: compund button-like widget appearance (chavez)
2020-04-14 (bug)[87bade] Aqua: improved dealing with PressAndHold (culler)
2020-04-14 (bug)[376788] X: stop crash w/Noto Color Emoji font (nijtmans)
2020-04-15 (bug)[89354d] Aqua: text color w/o clipping (culler)
2020-04-15 (new) Aqua: assign Button 3 to the middle button (chavez)
2020-04-25 (bug)[3519111] treeview horizontal scroll, entry-2.1.1 (vogel)
2020-04-25 (bug)[141881] treeview vertical scroll, treeview-9.2 (vogel)
2020-05-01 (bug)[2712f4] X: crash angled text w/o Xft, canvText-20.2 (vogel)
2020-05-01 (bug)[cd8714] Win: long angled text (chavez)
2020-05-09 (bug)[88c9e0] treeview -selectmode none focus ring (gavilan)
2020-05-12 (new) Aqua: Rewrite of the Key event system (culler)
2020-05-12 (bug)[411359] Aqua: stop crashes/zombies related to TouchBar (culler)
2020-05-12 (new) Aqua: systemLinkColor (chavez)
2020-05-16 (bug)[40ada9] crash when active button is destroyed (chavez)
2020-05-28 (bug)[3c6660,601cea,4b50b7] Win10: ttk scale (nemethi,lanam)
2020-06-08 (bug)[2790615] Some callbacks not eval'd in global scope (nijtmans)
2020-06-25 Aqua: Update OSX version tests to support Big Sur (culler)
2020-06-27 (bug)[6920b2] dup in spinbox -values causes trouble (lanam)
2020-06-27 (bug)[5c51be] invalid mem read buffer in Tk_PhotoPut* (chavez)
2020-06-27 (bug)[16ef16] restore bind sequence support, bind-33.(16-21) (vogel)
2020-07-02 (bug)[2d2459] default style for combobox (bll)
2020-07-06 (bug)[40c4bf] double free, entry-19.21 (vogel)
2020-07-06 (bug)[e3888d] grab & warp, bind-36.1 (vogel)
2020-07-12 (bug)[2442314] fontchooser i18n (nijtmans)
2020-07-13 (bug)[7655f6] [*entry]: selected text drawing reform (chavez)
2020-07-14 (bug)[09abd7] workaround invalid key codes from Debian 10 (vogel)
2020-07-20 (bug)[cf3853] Aqua: improve bounds on non-Retina displays (chavez)
2020-08-01 Aqua: [winfo rgb] light and dark mode support (culler)
2020-08-15 (bug)[315104] Aqua: appearance change virtual events (culler)
2020-08-21 (bug)[291699] mouse binding for scrollbar grip (bll)
2020-09-08 (bug)[6c2425] buffer bounds violation (chavez)
2020-09-08 (bug)[2a6d63] OSX 10.6 crash (hellstrom,culler)
2020-09-08 (bug)[420feb] undefined behavior due to alignment (chavez,nijtmans)
2020-09-10 (bug)[ab1fea] Aqua init issues (culler)
2020-09-14 (bug)[71e18c] Aqua: crash in full screen toggle (culler)
2020-09-18 (bug)[4f4f03] Aqua: mouse drags across title bar (nab,culler)
2020-09-21 (bug)[d91e05] select/copy in disabled text (bll)
2020-09-27 (TIP #581) disfavor Master/Slave terminology (nijtmans)
2020-09-30 (bug)[59cba3] win: improve theme detection (bll,nijtmans)
2020-10-06 (bug)[175a6e] Aqua: support tiled windows (culler)
2020-10-07 (bug)[1fa8c3] Aqua: crash on resize during display (nab,culler)
2020-10-16 (bug)[c2483b] Aqua: consistent finalization (culler,nijtmans)
2020-11-06 (bug)[c9ebac] Aqua: use standard about dialog (culler)
2020-11-07 (bug)[4ebcc0] sticky fontchooser options (roseman,vogel)
2020-11-10 (bug)[f9fa92] Aqua: crash in color caching scheme (culler)
2020-11-20 (bug)[7185d2] Aqua: fixes to special menu support (culler)
2020-11-24 (bug)[4a40c6] Aqua: [wm manage] frame offset (chavez)
2020-12-04 (bug)[3ef77f] Aqua dark mode combobox focus ring (walzer,culler)
2020-12-15 (bug)[80e4c6] Aqua: progressbar animation (nab,culler)
2020-12-24 (bug)[6157a8] Aqua: file dialog -filetypes (davis,culler)
- Released 8.6.11, Dec 31, 2020 - https://core.tcl-lang.org/tk/ for details
2021-01-04 (bug)[19fb7a] Mac: [tk_messageBox] use proper icons (ericwb,culler)
2021-01-11 (bug)[7beaed] ttk::bindMouseWheel syntax error (nemethi)
2021-01-15 (new) support 4 new keycodes: CodeInput, SingleCandidate,
MultipleCandidate, PreviousCandidate (nijtmans)
2021-01-18 (new) Portable keycodes: OE, oe, Ydiaeresis (nijtmans)
2021-01-27 (bug)[bdcab8] Mac crash on non-BMP menu label (nab,culler)
2021-02-07 (bug)[9e1312] <Enter> to parent after child destroyed (leunissen)
2021-02-10 (bug)[d3cd4c] more robust notebook processing (nemethi)
2021-02-25 (bug)[234ee4] crash in [clipboard get] invalid encoding (nijtmans)
2021-02-25 (bug)[be9cad] Poor trace housekeeping -> tkwait segfault (michael)
2021-03-02 (bug)[1626ed] Mac: crash with dead key as menu accelerator (culler)
2021-03-22 (bug)[9b6065] restore Tcl [update], see window-2.12 (leunissen)
2021-04-07 (bug)[58222c] Mac: entry and spinbox bg colors (chavez,culler)
2021-04-18 (bug)[34db75,ea876b] cursor motion in peer text (vogel)
2021-04-26 (bug)[c97464] memleak in TkpDrawAngledChars (nab,culler)
2021-04-29 Mac: explicit backing CALayer to fix rendering issues (culler)
2021-05-02 Mac: respect key repeat system setting (culler)
2021-05-10 (bug)[171ba7] crash when grab and focus are not coordinated (culler)
2021-05-24 crash due to failed transient record housekeeping (culler)
2021-05-25 (bug)[7bda98] Mac: <Double-1> bindings fire twice on app activation
2021-06-03 (bug)[4401d3] Mac: improved support of pixel formats (chavez,culler)
2021-06-03 (bug)[8ecc3e] Mac: window exposed by Mission Control (chavez,culler)
2021-06-04 (bug)[099109] segfault reusing a container toplevel (culler)
2021-06-22 (bug)[4efbfe] static package init order in wish (werner)
2021-09-21 (bug)[033886] Win: hang in font loading (e-paine,vogel)
2021-10-14 (bug)[8ebed3] multi-thread safety in Xft use (werner)
2021-10-22 (new)[TIP 608] New virtual event <<TkWorldChanged>> (griffin)
2021-10-27 (bug) file dialog compatibility with Mac OS 12 (culler)
2021-10-29 (bug) Mac: stop crash when non-Tk windows go full screen (werner)
2021-10-30 (bug)[6ea0b3] Mac: grab from menu makes dead window (culler)
- Released 8.6.12, Nov 5, 2021 - https://core.tcl-lang.org/tk/ for details

View File

@@ -3,7 +3,7 @@
*
* Declares facilities exported by the "stdlib" portion of the C library.
* This file isn't complete in the ANSI-C sense; it only declares things
* that are needed by Tcl. This file is needed even on many systems with
* that are needed by Tk. This file is needed even on many systems with
* their own stdlib.h (e.g. SunOS) because not all stdlib.h files declare
* all the procedures needed here (such as strtod).
*
@@ -17,6 +17,10 @@
#ifndef _STDLIB
#define _STDLIB
#ifndef _TCL
# include <tcl.h>
#endif
extern void abort(void);
extern double atof(const char *string);
extern int atoi(const char *string);
@@ -29,6 +33,7 @@ extern char * malloc(unsigned int numBytes);
extern void qsort(void *base, int n, int size, int (*compar)(
const void *element1, const void *element2));
extern char * realloc(char *ptr, unsigned int numBytes);
extern double strtod(const char *string, char **endPtr);
extern long strtol(const char *string, char **endPtr, int base);
extern unsigned long strtoul(const char *string, char **endPtr, int base);

View File

@@ -15,6 +15,9 @@
#define _UNISTD
#include <sys/types.h>
#ifndef _TCL
# include <tcl.h>
#endif
#ifndef NULL
#define NULL 0
@@ -37,7 +40,7 @@ extern int execle(const char *path, ...);
extern int execlp(const char *file, ...);
extern int execv(const char *path, char **argv);
extern int execve(const char *path, char **argv, char **envp);
extern int execvpw(const char *file, char **argv);
extern int execvp(const char *file, char **argv);
extern pid_t fork(void);
extern char * getcwd(char *buf, size_t size);
extern gid_t getegid(void);
@@ -65,7 +68,7 @@ extern int ftruncate(int fd, unsigned long length);
extern int ioctl(int fd, int request, ...);
extern int readlink(const char *path, char *buf, int bufsize);
extern int setegid(gid_t group);
extern int seteuidw(uid_t user);
extern int seteuid(uid_t user);
extern int setreuid(int ruid, int euid);
extern int symlink(const char *, const char *);
extern int ttyslot(void);
@@ -74,3 +77,4 @@ extern int vfork(void);
#endif /* _POSIX_SOURCE */
#endif /* _UNISTD */

View File

@@ -144,7 +144,7 @@ like this:
.PP
.CS
static const Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
Tk_CanvasTagsPrintProc, (ClientData) NULL
Tk_CanvasTagsPrintProc, NULL
};
static const Tk_ConfigSpec configSpecs[] = {

View File

@@ -31,7 +31,7 @@ drop applications.
The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR;
this mechanism only works in programs that dispatch events
through \fBTk_HandleEvent\fR (or through other Tk procedures that
call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or
\fBTk_MainLoop\fR).
.PP
\fIProc\fR should have arguments and result that match the

View File

@@ -38,7 +38,7 @@ use with Tk, and so on.
The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR;
this mechanism only works in programs that dispatch events
through \fBTk_HandleEvent\fR (or through other Tk procedures that
call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or
\fBTk_MainLoop\fR).
.PP
\fIProc\fR should have arguments and result that match the

View File

@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind of image
Tk_CreateImageType, Tk_GetImageMasterData, Tk_GetImageModelData, Tk_InitImageArgs \- define new kind of image
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -19,6 +19,11 @@ Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind o
ClientData
\fBTk_GetImageMasterData\fR(\fIinterp, name, typePtrPtr\fR)
.sp
.VS "TIP 581"
ClientData
\fBTk_GetImageModelData\fR(\fIinterp, name, typePtrPtr\fR)
.VE "TIP 581"
.sp
\fBTk_InitImageArgs\fR(\fIinterp, argc, argvPtr\fR)
.SH ARGUMENTS
.AS "const Tk_ImageType" *typePtrPtr
@@ -71,7 +76,7 @@ The fields of this structure will be described in later subsections
of this entry.
.PP
The second major data structure manipulated by an image manager
is called an \fIimage master\fR; it contains overall information
is called an \fIimage model\fR; it contains overall information
about a particular image, such as the values of the configuration
options specified in an \fBimage create\fR command.
There will usually be one of these structures for each
@@ -113,8 +118,8 @@ typedef int \fBTk_ImageCreateProc\fR(
int \fIobjc\fR,
Tcl_Obj *const \fIobjv\fR[],
const Tk_ImageType *\fItypePtr\fR,
Tk_ImageMaster \fImaster\fR,
ClientData *\fImasterDataPtr\fR);
Tk_ImageMaster \fImodel\fR,
ClientData *\fImodelDataPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the \fBimage\fR
command was invoked, and \fIname\fR is the name for the new image,
@@ -123,15 +128,15 @@ or generated automatically by the \fBimage\fR command.
The \fIobjc\fR and \fIobjv\fR arguments describe all the configuration
options for the new image (everything after the name argument to
\fBimage\fR).
The \fImaster\fR argument is a token that refers to Tk's information
The \fImodel\fR argument is a token that refers to Tk's information
about this image; the image manager must return this token to
Tk when invoking the \fBTk_ImageChanged\fR procedure.
Typically \fIcreateProc\fR will parse \fIobjc\fR and \fIobjv\fR
and create an image master data structure for the new image.
and create an image model data structure for the new image.
\fIcreateProc\fR may store an arbitrary one-word value at
*\fImasterDataPtr\fR, which will be passed back to the
*\fImodelDataPtr\fR, which will be passed back to the
image manager when other callbacks are invoked.
Typically the value is a pointer to the master data
Typically the value is a pointer to the model data
structure for the image.
.PP
If \fIcreateProc\fR encounters an error, it should leave an error
@@ -148,11 +153,11 @@ This procedure must match the following prototype:
.CS
typedef ClientData \fBTk_ImageGetProc\fR(
Tk_Window \fItkwin\fR,
ClientData \fImasterData\fR);
ClientData \fImodelData\fR);
.CE
The \fItkwin\fR argument identifies the window in which the
image will be used and \fImasterData\fR is the value
returned by \fIcreateProc\fR when the image master was created.
image will be used and \fImodelData\fR is the value
returned by \fIcreateProc\fR when the image model was created.
\fIgetProc\fR will usually create a data structure for the new
instance, including such things as the resources needed to
display the image in the given window.
@@ -221,26 +226,30 @@ each of the image's instances.
\fIdeleteProc\fR must match the following prototype:
.CS
typedef void \fBTk_ImageDeleteProc\fR(
ClientData \fImasterData\fR);
ClientData \fImodelData\fR);
.CE
The \fImasterData\fR argument will be the same as the value
stored in \fI*masterDataPtr\fR by \fIcreateProc\fR when the
The \fImodelData\fR argument will be the same as the value
stored in \fI*modelDataPtr\fR by \fIcreateProc\fR when the
image was created.
\fIdeleteProc\fR should release any resources associated with
the image.
.SH TK_GETIMAGEMASTERDATA
.SH TK_GETIMAGEMODELDATA
.PP
The procedure \fBTk_GetImageMasterData\fR may be invoked to retrieve
information about an image. For example, an image manager can use this
procedure to locate its image master data for an image.
procedure to locate its image model data for an image.
If there exists an image named \fIname\fR
in the interpreter given by \fIinterp\fR, then \fI*typePtrPtr\fR is
filled in with type information for the image (the \fItypePtr\fR value
passed to \fBTk_CreateImageType\fR when the image type was registered)
and the return value is the ClientData value returned by the
\fIcreateProc\fR when the image was created (this is typically a
pointer to the image master data structure). If no such image exists
pointer to the image model data structure). If no such image exists
then NULL is returned and NULL is stored at \fI*typePtrPtr\fR.
.PP
.VS "TIP 581"
\fBTk_GetImageModelData\fR is synonym for \fBTk_GetImageMasterData\fR
.VE "TIP 581"
.SH "LEGACY INTERFACE SUPPORT"
.PP
In Tk 8.2 and earlier, the definition of \fBTk_ImageCreateProc\fR
@@ -252,8 +261,8 @@ typedef int \fBTk_ImageCreateProc\fR(
int \fIargc\fR,
char **\fIargv\fR,
Tk_ImageType *\fItypePtr\fR,
Tk_ImageMaster \fImaster\fR,
ClientData *\fImasterDataPtr\fR);
Tk_ImageMaster \fImodel\fR,
ClientData *\fImodelDataPtr\fR);
.CE
Legacy programs and libraries dating from those days may still
contain code that defines extended Tk image types using the old
@@ -261,6 +270,10 @@ interface. The Tk header file will still support this legacy
interface if the code is compiled with the macro \fBUSE_OLD_IMAGE\fR
defined.
.PP
.VS "TIP 581"
\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR
.VE "TIP 581"
.PP
When the \fBUSE_OLD_IMAGE\fR legacy support is enabled, you may
see the routine \fBTk_InitImageArgs\fR in use. This was a migration
tool used to create stub-enabled extensions that could be loaded
@@ -280,4 +293,4 @@ interfaces. Expect their support to go away in Tk 9.
.SH "SEE ALSO"
Tk_ImageChanged, Tk_GetImage, Tk_FreeImage, Tk_RedrawImage, Tk_SizeOfImage
.SH KEYWORDS
image manager, image type, instance, master
image manager, image type, instance, model

View File

@@ -38,7 +38,7 @@ by \fImask\fR occurs in the window specified by \fItkwin\fR.
The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR;
this mechanism only works in programs that dispatch events
through \fBTk_HandleEvent\fR (or through other Tk procedures that
call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or
\fBTk_MainLoop\fR).
.PP
\fIProc\fR should have arguments and result that match the

View File

@@ -15,23 +15,23 @@ Tk_GetScrollInfoObj, Tk_GetScrollInfo \- parse arguments for scrolling commands
\fB#include <tk.h>\fR
.sp
int
\fBTk_GetScrollInfoObj(\fIinterp, objc, objv, dblPtr, intPtr\fB)\fR
\fBTk_GetScrollInfoObj(\fIinterp, objc, objv, fractionPtr, stepsPtr\fB)\fR
.sp
int
\fBTk_GetScrollInfo(\fIinterp, argc, argv, dblPtr, intPtr\fB)\fR
\fBTk_GetScrollInfo(\fIinterp, argc, argv, fractionPtr, stepsPtr\fB)\fR
.SH ARGUMENTS
.AS "Tcl_Interp" *fractionPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
.AP int objc in
Number of Tcl_Obj's in \fIobjv\fR array.
.AP "Tcl_Obj *const" objv[] in
.AP "Tcl_Obj *const *" objv in
Argument objects. These represent the entire widget command, of
which the first word is typically the widget name and the second
word is typically \fBxview\fR or \fByview\fR.
.AP int argc in
Number of strings in \fIargv\fR array.
.AP "const char" *argv[] in
.AP "const char **" argv in
Argument strings. These represent the entire widget command, of
which the first word is typically the widget name and the second
word is typically \fBxview\fR or \fByview\fR.

View File

@@ -25,7 +25,7 @@ that all unused fields of the structure be set to zero.
.PP
\fBTk_HandleEvent\fR is a lower-level procedure that deals with window
events. It is called by \fBTcl_ServiceEvent\fR (and indirectly by
\fBTk_DoOneEvent\fR), and in a few other cases within Tk.
\fBTcl_DoOneEvent\fR), and in a few other cases within Tk.
It makes callbacks to any window event
handlers (created by calls to \fBTk_CreateEventHandler\fR)
that match \fIeventPtr\fR and then returns. In some cases

View File

@@ -14,10 +14,10 @@ Tk_ImageChanged \- notify widgets that image needs to be redrawn
.nf
\fB#include <tk.h>\fR
.sp
\fBTk_ImageChanged\fR(\fIimageMaster, x, y, width, height, imageWidth, imageHeight\fR)
\fBTk_ImageChanged\fR(\fImodel, x, y, width, height, imageWidth, imageHeight\fR)
.SH ARGUMENTS
.AS Tk_ImageMaster imageHeight
.AP Tk_ImageMaster imageMaster in
.AP Tk_ImageMaster model in
Token for image, which was passed to image's \fIcreateProc\fR when
the image was created.
.AP int x in
@@ -42,12 +42,16 @@ whenever anything happens that requires the image to be redrawn.
As a result of calling \fBTk_ImageChanged\fR, any widgets using
the image are notified so that they can redisplay themselves
appropriately.
The \fIimageMaster\fR argument identifies the image, and
The \fImodel\fR argument identifies the image, and
\fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR
specify a rectangular region within the image that needs to
be redrawn.
\fIimageWidth\fR and \fIimageHeight\fR specify the image's (new) size.
.PP
.VS "TIP 581"
\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR
.VE "TIP 581"
.PP
An image manager should call \fBTk_ImageChanged\fR during
its \fIcreateProc\fR to specify the image's initial size and to
force redisplay if there are existing instances for the image.

View File

@@ -14,67 +14,67 @@ Tk_MaintainGeometry, Tk_UnmaintainGeometry \- maintain geometry of one window re
.nf
\fB#include <tk.h>\fR
.sp
\fBTk_MaintainGeometry\fR(\fIslave, master, x, y, width, height\fR)
\fBTk_MaintainGeometry\fR(\fIwindow, container, x, y, width, height\fR)
.sp
\fBTk_UnmaintainGeometry\fR(\fIslave, master\fR)
\fBTk_UnmaintainGeometry\fR(\fIwindow, container\fR)
.SH ARGUMENTS
.AS Tk_Window master
.AP Tk_Window slave in
.AS Tk_Window container
.AP Tk_Window window in
Window whose geometry is to be controlled.
.AP Tk_Window master in
Window relative to which \fIslave\fR's geometry will be controlled.
.AP Tk_Window container in
Window relative to which \fIwindow\fR's geometry will be controlled.
.AP int x in
Desired x-coordinate of \fIslave\fR in \fImaster\fR, measured in pixels
from the inside of \fImaster\fR's left border to the outside of
\fIslave\fR's left border.
Desired x-coordinate of \fIwindow\fR in \fIcontainer\fR, measured in pixels
from the inside of \fIcontainer\fR's left border to the outside of
\fIwindow\fR's left border.
.AP int y in
Desired y-coordinate of \fIslave\fR in \fImaster\fR, measured in pixels
from the inside of \fImaster\fR's top border to the outside of
\fIslave\fR's top border.
Desired y-coordinate of \fIwindow\fR in \fIcontainer\fR, measured in pixels
from the inside of \fIcontainer\fR's top border to the outside of
\fIwindow\fR's top border.
.AP int width in
Desired width for \fIslave\fR, in pixels.
Desired width for \fIwindow\fR, in pixels.
.AP int height in
Desired height for \fIslave\fR, in pixels.
Desired height for \fIwindow\fR, in pixels.
.BE
.SH DESCRIPTION
.PP
\fBTk_MaintainGeometry\fR and \fBTk_UnmaintainGeometry\fR make it
easier for geometry managers to deal with slaves whose masters are not
easier for geometry managers to deal with windows whose containers are not
their parents.
Three problems arise if the master for a slave is not its parent:
Three problems arise if the container for a window is not its parent:
.IP [1]
The x- and y-position of the slave must be translated from the
coordinate system of the master to that of the parent before
positioning the slave.
The x- and y-position of the window must be translated from the
coordinate system of the container to that of the parent before
positioning the window.
.IP [2]
If the master window, or any of its ancestors up to the slave's
parent, is moved, then the slave must be repositioned within its
If the container window, or any of its ancestors up to the window's
parent, is moved, then the window must be repositioned within its
parent in order to maintain the correct position relative to the
master.
container.
.IP [3]
If the master or one of its ancestors is mapped or unmapped, then
the slave must be mapped or unmapped to correspond.
If the container or one of its ancestors is mapped or unmapped, then
the window must be mapped or unmapped to correspond.
.LP
None of these problems is an issue if the parent and master are
the same. For example, if the master or one of its ancestors
is unmapped, the slave is automatically removed by the screen
None of these problems is an issue if the parent and container are
the same. For example, if the container or one of its ancestors
is unmapped, the window is automatically removed by the screen
by X.
.PP
\fBTk_MaintainGeometry\fR deals with these problems for slaves
whose masters are not their parents, as well as handling the simpler
case of slaves whose masters are their parents.
\fBTk_MaintainGeometry\fR deals with these problems for windows
whose containers are not their parents, as well as handling the simpler
case of windows whose container are their parents.
\fBTk_MaintainGeometry\fR is typically called by a window manager
once it has decided where a slave should be positioned relative
to its master.
once it has decided where a window should be positioned relative
to its container.
\fBTk_MaintainGeometry\fR translates the coordinates to the
coordinate system of \fIslave\fR's parent and then moves and
resizes the slave appropriately.
coordinate system of \fIwindow\fR's parent and then moves and
resizes the window appropriately.
Furthermore, it remembers the desired position and creates event
handlers to monitor the master and all of its ancestors up
to (but not including) the slave's parent.
handlers to monitor the container and all of its ancestors up
to (but not including) the window's parent.
If any of these windows is moved, mapped, or unmapped,
the slave will be adjusted so that it is mapped only when the
master is mapped and its geometry relative to the master
the window will be adjusted so that it is mapped only when the
container is mapped and its geometry relative to the container
remains as specified by \fIx\fR, \fIy\fR, \fIwidth\fR, and
\fIheight\fR.
.PP
@@ -83,17 +83,17 @@ if it decides that it does not want the window to appear on the
screen under any conditions, it calls \fBTk_UnmaintainGeometry\fR.
\fBTk_UnmaintainGeometry\fR unmaps the window and cancels any
previous calls to \fBTk_MaintainGeometry\fR for the
\fImaster\fR\-\fIslave\fR pair, so that the slave's
\fIcontainer\fR\-\fIwindow\fR pair, so that the window's
geometry and mapped state are no longer maintained
automatically.
\fBTk_UnmaintainGeometry\fR need not be called by a geometry
manager if the slave, the master, or any of the master's ancestors
manager if the window, the container, or any of the container's ancestors
is destroyed: Tk will call it automatically.
.PP
If \fBTk_MaintainGeometry\fR is called repeatedly for the same
\fImaster\fR\-\fIslave\fR pair, the information from the most
\fIcontainer\fR\-\fIwindow\fR pair, the information from the most
recent call supersedes any older information.
If \fBTk_UnmaintainGeometry\fR is called for a \fImaster\fR\-\fIslave\fR
If \fBTk_UnmaintainGeometry\fR is called for a \fIcontainer\fR\-\fIwindow\fR
pair that is is not currently managed, the call has no effect.
.SH KEYWORDS
geometry manager, map, master, parent, position, slave, unmap
geometry manager, map, container, parent, position, window, unmap

View File

@@ -32,7 +32,7 @@ Arbitrary one-word value to pass to geometry manager callbacks.
.PP
\fBTk_ManageGeometry\fR arranges for a particular geometry manager,
described by the \fImgrPtr\fR argument, to control the geometry
of a particular slave window, given by \fItkwin\fR.
of a particular content window, given by \fItkwin\fR.
If \fItkwin\fR was previously managed by some other geometry manager,
the previous manager loses control in favor of the new one.
If \fImgrPtr\fR is NULL, geometry management is cancelled for
@@ -53,7 +53,7 @@ by the command \fBwinfo manager\fR.
.PP
\fIrequestProc\fR is a procedure in the geometry manager that
will be invoked whenever \fBTk_GeometryRequest\fR is called by the
slave to change its desired geometry.
content window to change its desired geometry.
\fIrequestProc\fR should have arguments and results that match the
type \fBTk_GeomRequestProc\fR:
.CS

View File

@@ -46,6 +46,6 @@ menus that want to appear at a particular place on the screen.
When \fBTk_MoveToplevelWindow\fR is called it does not immediately
pass on the new desired location to the window manager; it defers
this action until all other outstanding work has been completed,
using the \fBTk_DoWhenIdle\fR mechanism.
using the \fBTcl_DoWhenIdle\fR mechanism.
.SH KEYWORDS
position, top-level window, window manager

View File

@@ -14,10 +14,10 @@ Tk_NameOfImage \- Return name of image.
\fB#include <tk.h>\fR
.sp
const char *
\fBTk_NameOfImage\fR(\fItypePtr\fR)
\fBTk_NameOfImage\fR(\fIimageMaster\fR)
.SH ARGUMENTS
.AS Tk_ImageMaster *masterPtr
.AP Tk_ImageMaster *masterPtr in
.AS Tk_ImageMaster imageMaster
.AP Tk_ImageMaster imageMaster in
Token for image, which was passed to image manager's \fIcreateProc\fR when
the image was created.
.BE
@@ -26,5 +26,9 @@ the image was created.
This procedure is invoked by image managers to find out the name
of an image. Given the token for the image, it returns the
string name for the image.
.PP
.VS "TIP 581"
\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR
.VE "TIP 581"
.SH KEYWORDS
image manager, image name

View File

@@ -314,14 +314,14 @@ Boolean exec = FALSE;
Tk_ArgvInfo argTable[] = {
{"\-X", TK_ARGV_CONSTANT, (char *) 1, (char *) &debugFlag,
"Turn on debugging printfs"},
{"\-N", TK_ARGV_INT, (char *) NULL, (char *) &numReps,
{"\-N", TK_ARGV_INT, NULL, (char *) &numReps,
"Number of repetitions"},
{"\-of", TK_ARGV_STRING, (char *) NULL, (char *) &fileName,
{"\-of", TK_ARGV_STRING, NULL, (char *) &fileName,
"Name of file for output"},
{"x", TK_ARGV_REST, (char *) NULL, (char *) &exec,
{"x", TK_ARGV_REST, NULL, (char *) &exec,
"File to exec, followed by any arguments (must be last argument)."},
{(char *) NULL, TK_ARGV_END, (char *) NULL, (char *) NULL,
(char *) NULL}
{NULL, TK_ARGV_END, NULL, NULL,
NULL}
};
main(argc, argv)

View File

@@ -30,7 +30,7 @@ Pointer to place to save argument to previous restrict procedure.
.PP
This procedure is useful in certain situations where applications
are only prepared to receive certain X events. After
\fBTk_RestrictEvents\fR is called, \fBTk_DoOneEvent\fR (and
\fBTk_RestrictEvents\fR is called, \fBTcl_DoOneEvent\fR (and
hence \fBTk_MainLoop\fR) will filter X input events through
\fIproc\fR. \fIProc\fR indicates whether a
given event is to be processed immediately, deferred until some
@@ -48,7 +48,7 @@ to \fBTk_RestrictEvents\fR; it may be used to provide \fIproc\fR with
information it needs to filter events. The \fIeventPtr\fR points to
an event under consideration. \fIProc\fR returns a restrict action
(enumerated type \fBTk_RestrictAction\fR) that indicates what
\fBTk_DoOneEvent\fR should do with the event. If the return value is
\fBTcl_DoOneEvent\fR should do with the event. If the return value is
\fBTK_PROCESS_EVENT\fR, then the event will be handled immediately.
If the return value is \fBTK_DEFER_EVENT\fR, then the event will be
left on the event queue for later processing. If the return value is
@@ -74,6 +74,6 @@ solution in these situations is to call \fBXNextEvent\fR or
\fBXWindowEvent\fR, but these procedures cannot be used because
Tk keeps its own event queue that is separate from the X event
queue. Instead, call \fBTk_RestrictEvents\fR to set up a filter,
then call \fBTk_DoOneEvent\fR to retrieve the desired event(s).
then call \fBTcl_DoOneEvent\fR to retrieve the desired event(s).
.SH KEYWORDS
delay, event, filter, restriction

View File

@@ -56,7 +56,7 @@ The \fIinstanceData\fR parameter passed to the \fIworldChangedProc\fR
will be identical to the \fIinstanceData\fR parameter passed to
\fBTk_SetClassProcs\fR.
.PP
\fIcreateProc\fR is used to create platform-dependant windows. It is
\fIcreateProc\fR is used to create platform-dependent windows. It is
invoked by \fBTk_MakeWindowExist\fR. \fIcreateProc\fR should have
arguments and results that match the type \fBTk_ClassCreateProc\fR:
.CS

View File

@@ -63,7 +63,7 @@ no window-dependent options, then a NULL value may be supplied for
this argument.
.AP int objc in
Number of values in \fIobjv\fR.
.AP Tcl_Obj "*const objv[]" in
.AP Tcl_Obj "*const *objv" in
Command-line arguments for setting configuring options.
.AP Tk_SavedOptions *savePtr out
If not NULL, the structure pointed to by this argument is filled
@@ -443,7 +443,9 @@ suitable for passing to \fBTcl_GetIndexFromObj\fR. The value must
be one of the strings in the table, or a unique abbreviation of
one of the strings. The internal form is an integer giving the index
into the table of the matching string, like the return value
from \fBTcl_GetStringFromObj\fR.
from \fBTcl_GetStringFromObj\fR. This option type supports the
\fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal
representation is set to -1.
.TP
\fBTK_OPTION_SYNONYM\fR
This type is used to provide alternative names for an option (for

View File

@@ -201,14 +201,27 @@ substitutions you would make when binding to these events.
Many contemporary mice support a mouse wheel, which is used
for scrolling documents without using the scrollbars. By rolling the
wheel, the system will generate \fBMouseWheel\fR events that the
application can use to scroll. Like \fBKey\fR events the event is
always routed to the window that currently has focus. When the event
application can use to scroll. The event is routed to the
window currently under the mouse pointer. When the event
is received you can use the \fB%D\fR substitution to get the
\fIdelta\fR field for the event, which is a integer value describing how
\fIdelta\fR field for the event, which is an integer value describing how
the mouse wheel has moved. The smallest value for which the
system will report is defined by the OS. The sign of the
value determines which direction your widget should scroll. Positive
values should scroll up and negative values should scroll down.
.RS
.PP
Horizontal scrolling uses \fBShift-MouseWheel\fR events, with positive
\fB%D\fR \fIdelta\fR substitution indicating left scrolling and negative
right scrolling.
Only Windows and macOS Aqua typically fire \fBMouseWheel\fR and
\fBShift-MouseWheel\fR events. On
X11 vertical scrolling is rather supported through \fBButton-4\fR and
\fBButton-5\fR events, and horizontal scrolling through \fBShift-Button-4\fR
and \fBShift-Button-5\fR events. Horizontal scrolling events may fire from
many different hardware units such as tilt wheels or touchpads. Horizontal
scrolling can also be emulated by holding Shift and scrolling vertically.
.RE
.IP "\fBKeyPress\fR, \fBKeyRelease\fR" 5
The \fBKeyPress\fR and \fBKeyRelease\fR events are generated
whenever a key is pressed or released. \fBKeyPress\fR and \fBKeyRelease\fR
@@ -270,7 +283,8 @@ it is destroyed.
When the \fBDestroy\fR event is delivered
to a widget, it is in a
.QW half-dead
state: the widget still exists, but most operations on it will fail.
state: the widget still exists, but operations that involve it
may return invalid results, or return an error.
.RE
.IP "\fBFocusIn\fR, \fBFocusOut\fR" 5
The \fBFocusIn\fR and \fBFocusOut\fR events are generated
@@ -510,6 +524,9 @@ For \fBButtonPress\fR, \fBButtonRelease\fR, \fBMotion\fR,
\fBKeyPress\fR, \fBKeyRelease\fR, and \fBMouseWheel\fR events,
\fB%x\fR and \fB%y\fR indicate the position of the mouse pointer
relative to the receiving window.
For key events on the Macintosh these are the coordinates of the
mouse at the moment when an X11 KeyEvent is sent to Tk, which could
be slightly later than the time of the physical press or release.
For \fBEnter\fR and \fBLeave\fR events, the position where the
mouse pointer crossed the window, relative to the receiving window.
For \fBConfigure\fR and \fBCreate\fR requests, the \fIx\fR and \fIy\fR
@@ -517,10 +534,11 @@ coordinates of the window relative to its parent window.
.IP \fB%A\fR 5
Substitutes the UNICODE character corresponding to the event, or
the empty string if the event does not correspond to a UNICODE character
(e.g. the shift key was pressed). \fBXmbLookupString\fR (or
(e.g. the shift key was pressed). On X11, \fBXmbLookupString\fR (or
\fBXLookupString\fR when input method support is turned off) does all
the work of translating from the event to a UNICODE character.
Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
On X11, valid only for \fBKeyPress\fR event. On Windows and macOS/aqua,
valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
.IP \fB%B\fR 5
The \fIborder_width\fR field from the event. Valid only for
\fBConfigure\fR, \fBConfigureRequest\fR, and \fBCreate\fR events.
@@ -566,8 +584,8 @@ The \fIx_root\fR and \fIy_root\fR fields from the event.
If a virtual-root window manager is being used then the substituted
values are the corresponding x-coordinate and y-coordinate in the virtual root.
Valid only for
\fBButtonPress\fR, \fBButtonRelease\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
and \fBMotion\fR events.
\fBButtonPress\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBKeyPress\fR,
\fBKeyRelease\fR, \fBLeave\fR and \fBMotion\fR events.
Same meaning as \fB%x\fR and \fB%y\fR, except relative to the (virtual) root
window.
.LP
@@ -638,11 +656,11 @@ of events matched) is more specific than a shorter sequence;
.IP (c)
if the modifiers specified in one pattern are a subset of the
modifiers in another pattern, then the pattern with more modifiers
is more specific.
is more specific;
.IP (d)
a virtual event whose physical pattern matches the sequence is less
specific than the same physical pattern that is not associated with a
virtual event.
virtual event;
.IP (e)
given a sequence that matches two or more virtual events, one
of the virtual events will be chosen, but the order is undefined.

View File

@@ -753,7 +753,8 @@ This command returns an empty string.
\fIpathName \fBmoveto \fItagOrId xPos yPos\fR
.VS 8.6
Move the items given by \fItagOrId\fR in the canvas coordinate
space so that the first coordinate pair of the bottommost item with
space so that the first coordinate pair (the upper-left corner of the
bounding box) of the first item (the lowest in the display list) with
tag \fItagOrId\fR is located at
position (\fIxPos\fR,\fIyPos\fR). \fIxPos\fR and \fIyPos\fR may be
the empty string, in which case the corresponding coordinate
@@ -1122,7 +1123,7 @@ becomes visible; if it is positive then information farther to the right
becomes visible.
.RE
.TP
\fIpathName \fByview \fI?args\fR?
\fIpathName \fByview ?\fIargs\fR?
.
This command is used to query and change the vertical position of the
information displayed in the canvas's window.
@@ -1219,10 +1220,10 @@ in the \fBCOORDINATES\fR section above.
Specifies the color to be used to fill item's area.
in its normal, active, and disabled states,
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
If \fIcolor\fR is an empty string (the default),
then the item will not be filled.
For the line item, it specifies the color of the line drawn.
For the text item, it specifies the foreground color of the text.
If \fIcolor\fR is an empty string (the default for all canvas items
except line and text), then the item will not be filled.
.TP
\fB\-outline \fIcolor\fR
.TP
@@ -1233,8 +1234,8 @@ For the text item, it specifies the foreground color of the text.
This option specifies the color that should be used to draw the
outline of the item in its normal, active and disabled states.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
This option defaults to \fBblack\fR. If \fIcolor\fR is specified
as an empty string then no outline is drawn for the item.
If \fIcolor\fR is specified as an empty string then no outline is drawn
for the item.
.TP
\fB\-offset \fIoffset\fR
.
@@ -1442,8 +1443,7 @@ disabled states.
Specifies the color to use for each of the bitmap's
.QW 1
valued pixels in its normal, active and disabled states.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR and
defaults to \fBblack\fR.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
.SS "IMAGE ITEMS"
.PP
Items of type \fBimage\fR are used to display images on a
@@ -1524,6 +1524,12 @@ ends of the line.
\fBlast\fR (for an arrowhead at the last point of the line), or
\fBboth\fR (for arrowheads at both ends).
This option defaults to \fBnone\fR.
When requested to draw an arrowhead, Tk internally adjusts the corresponding
line end point so that the rendered line ends at the neck of the arrowhead
rather than at its tip so that the line doesn't extend past the edge of the
arrowhead. This may trigger a \fBLeave\fR event if the mouse is hovering this
line end. Conversely, when removing an arrowhead Tk adjusts the corresponding
line point the other way round, which may trigger an \fBEnter\fR event.
.TP
\fB\-arrowshape \fIshape\fR
This option indicates how to draw arrowheads.

View File

@@ -784,29 +784,23 @@ YellowGreen 154 205 50
.TP
\fBMac OS X\fR
.
On Mac OS X, the following additional system colors are available
(note that the actual color values depend on the currently active OS theme,
and typically many of these will in fact be patterns rather than pure colors):
On macOS, the following additional system colors are available. This
first group contains all of the HIBrush colors available in the
HIToolbox library. Note that on macOS 10.14 (Mojave) and later these
colors are unlikely to match the color actually used for the purpose
suggested by the color name.
.RS
.DS
systemActiveAreaFill
systemAlertActiveText
systemAlertBackgroundActive
systemAlertBackgroundInactive
systemAlertInactiveText
systemAlternatePrimaryHighlightColor
systemAppleGuideCoachmark
systemBevelActiveDark
systemBevelActiveLight
systemBevelButtonActiveText
systemBevelButtonInactiveText
systemBevelButtonPressedText
systemBevelButtonStickyActiveText
systemBevelButtonStickyInactiveText
systemBevelInactiveDark
systemBevelInactiveLight
systemBlack
systemBlackText
systemButtonActiveDarkHighlight
systemButtonActiveDarkShadow
systemButtonActiveLightHighlight
@@ -826,15 +820,10 @@ systemButtonPressedDarkHighlight
systemButtonPressedDarkShadow
systemButtonPressedLightHighlight
systemButtonPressedLightShadow
systemButtonText
systemChasingArrows
systemDialogActiveText
systemDialogBackgroundActive
systemDialogBackgroundInactive
systemDialogInactiveText
systemDocumentWindowBackground
systemDocumentWindowTitleActiveText
systemDocumentWindowTitleInactiveText
systemDragHilite
systemDrawerBackground
systemFinderWindowBackground
@@ -842,90 +831,87 @@ systemFocusHighlight
systemHighlight
systemHighlightAlternate
systemHighlightSecondary
systemHighlightText
systemIconLabelBackground
systemIconLabelBackgroundSelected
systemIconLabelSelectedText
systemIconLabelText
systemListViewBackground
systemListViewColumnDivider
systemListViewEvenRowBackground
systemListViewOddRowBackground
systemListViewSeparator
systemListViewSortColumnBackground
systemListViewText
systemListViewWindowHeaderBackground
systemMenu
systemMenuActive
systemMenuActiveText
systemMenuBackground
systemMenuBackgroundSelected
systemMenuDisabled
systemMenuItemActiveText
systemMenuItemDisabledText
systemMenuItemSelectedText
systemMenuText
systemMetalBackground
systemModelessDialogActiveText
systemModelessDialogBackgroundActive
systemModelessDialogBackgroundInactive
systemModelessDialogInactiveText
systemMovableModalBackground
systemMovableModalWindowTitleActiveText
systemMovableModalWindowTitleInactiveText
systemNotificationText
systemNotificationWindowBackground
systemPlacardActiveText
systemPlacardBackground
systemPlacardInactiveText
systemPlacardPressedText
systemPopupArrowActive
systemPopupArrowInactive
systemPopupArrowPressed
systemPopupButtonActiveText
systemPopupButtonInactiveText
systemPopupButtonPressedText
systemPopupLabelActiveText
systemPopupLabelInactiveText
systemPopupWindowTitleActiveText
systemPopupWindowTitleInactiveText
systemPrimaryHighlightColor
systemPushButtonActiveText
systemPushButtonInactiveText
systemPushButtonPressedText
systemRootMenuActiveText
systemRootMenuDisabledText
systemRootMenuSelectedText
systemScrollBarDelimiterActive
systemScrollBarDelimiterInactive
systemSecondaryGroupBoxBackground
systemSecondaryHighlightColor
systemSelectedTabTextColor
systemSheetBackground
systemSheetBackgroundOpaque
systemSheetBackgroundTransparent
systemStaticAreaFill
systemSystemDetailText
systemTabFrontActiveText
systemTabFrontInactiveText
systemTabNonFrontActiveText
systemTabNonFrontInactiveText
systemTabNonFrontPressedText
systemTabPaneBackground
systemToolbarBackground
systemTransparent
systemUtilityWindowBackgroundActive
systemUtilityWindowBackgroundInactive
systemUtilityWindowTitleActiveText
systemUtilityWindowTitleInactiveText
systemWhite
systemWhiteText
systemWindowBody
systemWindowHeaderActiveText
systemWindowHeaderBackground
systemWindowHeaderInactiveText
.DE
.RE
.
Tk supports all of the NSColors in the macOS System ColorList. The
convention for naming these colors is that the Tk name is generated by
capitalizing the macOS name and adding the prefix "system". On OSX
10.14 (Mojave) and later many of these "semantic" colors will appear
differently depending on whether the NSWindow in which they are used has
the Aqua or DarkAqua appearance. The System ColorList differs between
releases of macOS and some colors, such as systemLinkColor and
systemControlAccentColor, are simulated on older systems which did not
provide them. All of the colors below are available on all supported
macOS releases, but newer systems will support additional colors.
.RS
.DS
systemControlAccentColor
systemControlTextColor
systemDisabledControlTextColor
systemLabelColor
systemLinkColor
systemPlaceholderTextColor
systemSelectedTextBackgroundColor
systemSelectedTextColor
systemSeparatorColor
systemTextBackgroundColor
systemTextColor
.DE
.RE
.
The numbered systemWindowBackgroundColors below
are used in the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets
to provide a contrasting background. Each numbered color constrasts
with its predecessor.
.RS
.DS
systemWindowBackgroundColor
systemWindowBackgroundColor1
systemWindowBackgroundColor2
systemWindowBackgroundColor3
systemWindowBackgroundColor4
systemWindowBackgroundColor5
systemWindowBackgroundColor6
systemWindowBackgroundColor7
.DE
.RE
.TP
\fBWindows\fR
.
On Windows, the following additional system colors are available

View File

@@ -25,9 +25,12 @@ the Tk library. Except for TkAqua, this command is not available when
Tk is loaded into a tclsh interpreter with
.QW "\fBpackage require Tk\fR" ,
as a conventional terminal is expected to be present in that case.
In TkAqua, this command is only available when stdin is \fB/dev/null\fR
(as is the case e.g. when the application embedding Tk is started
from the Mac OS X Finder).
In TkAqua, this command is disabled when there is a startup script
and stdin is \fB/dev/null\fR (as is the case e.g. when a bundled application
embedding Tk is started by the macOS Launcher). To enable the command
in that case, define the environment variable \fBTK_CONSOLE\fR. This can be
done by modifying the Info.plist file by adding the LSEnvironment key
to the main dict and setting its value to be a dict with the key \fBTK_CONSOLE\fR.
.PP
.TP
\fBconsole eval \fIscript\fR

View File

@@ -448,9 +448,10 @@ insertion cursor in the entry without affecting the selection.
If any normal printing characters are typed in an entry, they are
inserted at the point of the insertion cursor.
.IP [7]
The view in the entry can be adjusted by dragging with mouse button 2.
If mouse button 2 is clicked without moving the mouse, the selection
is copied into the entry at the position of the mouse cursor.
The view in the entry can be adjusted by dragging with the middle
mouse button (button 2, or button 3 in TkAqua). If the middle mouse
button is clicked without moving the mouse, the selection is copied
into the entry at the position of the mouse cursor.
.IP [8]
If the mouse is dragged out of the entry on the left or right sides
while button 1 is pressed, the entry will automatically scroll to

View File

@@ -239,7 +239,8 @@ Similar to \fB%S\fR substitution for binding scripts.
.TP
\fB\-time\fI integer\fR
\fIInteger\fR must be an integer value; it specifies the \fItime\fR field
for the event.
for the event. Additonally the special value \fBcurrent\fR is allowed,
this value will be substituted by the current event time.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, \fBMotion\fR,
and \fBProperty\fR events.
@@ -342,6 +343,15 @@ This is sent to all widgets when the ttk theme changed. The ttk
widgets listen to this event and redisplay themselves when it fires.
The legacy widgets ignore this event.
.TP
\fB<<TkWorldChanged>>\fR
.
This event is sent to all widgets when a font is changed, for example,
by the use of [font configure]. The user_data field (%d) will have the
value "FontChanged". For other system wide changes, this event will
be sent to all widgets, and the user_data field will indicate the
cause of the change. NOTE: all tk and ttk widgets already handle this
event internally.
.TP
\fB<<TraverseIn>>\fR
This is sent to a widget when the focus enters the widget because of a
user-driven

View File

@@ -99,21 +99,25 @@ The \fBframe\fR command creates a new Tcl command whose
name is the same as the path name of the frame's window. This
command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
\fIpathName option \fR?\fIarg arg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
the frame widget's path name. \fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
commands are possible for frame widgets:
.TP
\fIpathName \fBcget\fR \fIoption\fR
.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBframe\fR
command.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for

View File

@@ -61,6 +61,16 @@ The \fBfocus\fR command is still used to determine which window in the
application receives the keyboard events.
The keyboard grab is released when the grab is released.
.PP
On macOS a global grab affects all windows created by one Tk process.
No window in that process other than the grab window can even be
focused, hence no other window receives key or mouse events. A local
grab on macOS affects all windows created by one Tcl interpreter. It
is possible to focus any window belonging to the Tk process during a
local grab but the grab window is the only window created by its
interpreter which receives key or mouse events. Windows belonging to the
same process but created by different interpreters continue to receive
key and mouse events normally.
.PP
Grabs apply to particular displays. If an application has windows
on multiple displays then it can establish a separate grab on each
display.

View File

@@ -17,30 +17,30 @@ grid \- Geometry manager that arranges widgets in a grid
.PP
The \fBgrid\fR command is used to communicate with the grid
geometry manager that arranges widgets in rows and columns inside
of another window, called the geometry master (or master window).
of another window, called the geometry container (or container window).
The \fBgrid\fR command can have any of several forms, depending
on the \fIoption\fR argument:
.TP
\fBgrid \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
\fBgrid \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR?
.
If the first argument to \fBgrid\fR is suitable as the first slave
If the first argument to \fBgrid\fR is suitable as the first window
argument to \fBgrid configure\fR, either a window name (any value
starting with \fB.\fR) or one of the characters \fBx\fR or \fB^\fR
(see the \fBRELATIVE PLACEMENT\fR section below), then the command is
processed in the same way as \fBgrid configure\fR.
.TP
\fBgrid anchor \fImaster\fR ?\fIanchor\fR?
\fBgrid anchor \fIwindow\fR ?\fIanchor\fR?
.
The anchor value controls how to place the grid within the master
The anchor value controls how to place the grid within the container window
when no row/column has any weight. See \fBTHE GRID ALGORITHM\fR below
for further details. The default \fIanchor\fR is \fInw\fR.
.TP
\fBgrid bbox \fImaster\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR?
\fBgrid bbox \fIwindow\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR?
.
With no arguments,
the bounding box (in pixels) of the grid is returned.
The return value consists of 4 integers. The first two are the pixel
offset from the master window (x then y) of the top-left corner of the
offset from the container window (x then y) of the top-left corner of the
grid, and the second two integers are the width and height of the grid,
also in pixels. If a single \fIcolumn\fR and \fIrow\fR is specified on
the command line, then the bounding box for that cell is returned, where the
@@ -48,18 +48,18 @@ top left cell is numbered from zero. If both \fIcolumn\fR and \fIrow\fR
arguments are specified, then the bounding box spanning the rows and columns
indicated is returned.
.TP
\fBgrid columnconfigure \fImaster index \fR?\fI\-option value...\fR?
\fBgrid columnconfigure \fIwindow index \fR?\fI\-option value...\fR?
.
Query or set the column properties of the \fIindex\fR column of the
geometry master, \fImaster\fR.
geometry container, \fIwindow\fR.
The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR
and \fB\-pad\fR.
If one or more options are provided, then \fIindex\fR may be given as
a list of column indices to which the configuration options will operate on.
Indices may be integers, window names or the keyword \fIall\fR. For \fIall\fR
the options apply to all columns currently occupied be slave windows. For
a window name, that window must be a slave of this master and the options
apply to all columns currently occupied be the slave.
the options apply to all columns currently occupied be content windows. For
a window name, that window must be a content of this container and the options
apply to all columns currently occupied be the content.
The \fB\-minsize\fR option sets the minimum size, in screen units,
that will be permitted for this column.
The \fB\-weight\fR option (an integer value)
@@ -80,170 +80,170 @@ added to the largest window contained completely in that column when the
grid geometry manager requests a size from the containing window.
If only an option is specified, with no value,
the current value of that option is returned.
If only the master window and index is specified, all the current settings
If only the container window and index is specified, all the current settings
are returned in a list of
.QW "\-option value"
pairs.
.TP
\fBgrid configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
\fBgrid configure \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR?
.
The arguments consist of the names of one or more slave windows
The arguments consist of the names of one or more content windows
followed by pairs of arguments that specify how
to manage the slaves.
to manage the content.
The characters \fB\-\fR, \fBx\fR and \fB^\fR,
can be specified instead of a window name to alter the default
location of a \fIslave\fR, as described in the \fBRELATIVE PLACEMENT\fR
location of a \fIwindow\fR, as described in the \fBRELATIVE PLACEMENT\fR
section, below.
The following options are supported:
.RS
.TP
\fB\-column \fIn\fR
.
Insert the slave so that it occupies the \fIn\fRth column in the grid.
Insert the window so that it occupies the \fIn\fRth column in the grid.
Column numbers start with 0. If this option is not supplied, then the
slave is arranged just to the right of previous slave specified on this
window is arranged just to the right of previous window specified on this
call to \fBgrid\fR, or column
.QW 0
if it is the first slave. For each
\fBx\fR that immediately precedes the \fIslave\fR, the column position
if it is the first window. For each
\fBx\fR that immediately precedes the \fIwindow\fR, the column position
is incremented by one. Thus the \fBx\fR represents a blank column
for this row in the grid.
.TP
\fB\-columnspan \fIn\fR
.
Insert the slave so that it occupies \fIn\fR columns in the grid.
Insert the window so that it occupies \fIn\fR columns in the grid.
The default is one column, unless the window name is followed by a
\fB\-\fR, in which case the columnspan is incremented once for each immediately
following \fB\-\fR.
.TP
\fB\-in \fIother\fR
\fB\-in \fIcontainer\fR
.
Insert the slave(s) in the master
window given by \fIother\fR. The default is the first slave's
Insert the window(s) in the container
window given by \fIcontainer\fR. The default is the first window's
parent window.
.TP
\fB\-ipadx \fIamount\fR
.
The \fIamount\fR specifies how much horizontal internal padding to
leave on each side of the slave(s). This is space is added
inside the slave(s) border.
leave on each side of the content. This is space is added
inside the content border.
The \fIamount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR.
It defaults to 0.
.TP
\fB\-ipady \fIamount\fR
.
The \fIamount\fR specifies how much vertical internal padding to
leave on the top and bottom of the slave(s).
This space is added inside the slave(s) border.
leave on the top and bottom of the content.
This space is added inside the content border.
The \fIamount\fR defaults to 0.
.TP
\fB\-padx \fIamount\fR
.
The \fIamount\fR specifies how much horizontal external padding to
leave on each side of the slave(s), in screen units.
leave on each side of the content, in screen units.
\fIAmount\fR may be a list
of two values to specify padding for left and right separately.
The \fIamount\fR defaults to 0.
This space is added outside the slave(s) border.
This space is added outside the content border.
.TP
\fB\-pady \fIamount\fR
.
The \fIamount\fR specifies how much vertical external padding to
leave on the top and bottom of the slave(s), in screen units.
leave on the top and bottom of the content, in screen units.
\fIAmount\fR may be a list
of two values to specify padding for top and bottom separately.
The \fIamount\fR defaults to 0.
This space is added outside the slave(s) border.
This space is added outside the content border.
.TP
\fB\-row \fIn\fR
.
Insert the slave so that it occupies the \fIn\fRth row in the grid.
Insert the content so that it occupies the \fIn\fRth row in the grid.
Row numbers start with 0. If this option is not supplied, then the
slave is arranged on the same row as the previous slave specified on this
content is arranged on the same row as the previous content specified on this
call to \fBgrid\fR, or the next row after the highest occupied row
if this is the first slave.
if this is the first content.
.TP
\fB\-rowspan \fIn\fR
.
Insert the slave so that it occupies \fIn\fR rows in the grid.
Insert the content so that it occupies \fIn\fR rows in the grid.
The default is one row. If the next \fBgrid\fR command contains
\fB^\fR characters instead of \fIslaves\fR that line up with the columns
of this \fIslave\fR, then the \fBrowspan\fR of this \fIslave\fR is
\fB^\fR characters instead of \fIcontent\fR that line up with the columns
of this \fIcontent\fR, then the \fBrowspan\fR of this \fIcontent\fR is
extended by one.
.TP
\fB\-sticky \fIstyle\fR
.
If a slave's cell is larger than its requested dimensions, this
option may be used to position (or stretch) the slave within its cell.
If a content's cell is larger than its requested dimensions, this
option may be used to position (or stretch) the content within its cell.
\fIStyle\fR is a string that contains zero or more of the characters
\fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR.
The string can optionally contains spaces or
commas, but they are ignored. Each letter refers to a side (north, south,
east, or west) that the slave will
east, or west) that the content will
.QW stick
to. If both \fBn\fR and \fBs\fR (or \fBe\fR and \fBw\fR) are
specified, the slave will be stretched to fill the entire
specified, the content will be stretched to fill the entire
height (or width) of its cavity. The \fB\-sticky\fR option subsumes the
combination of \fB\-anchor\fR and \fB\-fill\fR that is used by \fBpack\fR.
The default is
.QW "" ,
which causes the slave to be centered in its cavity, at its requested size.
which causes the content to be centered in its cavity, at its requested size.
.LP
If any of the slaves are already managed by the geometry manager
If any of the content is already managed by the geometry manager
then any unspecified options for them retain their previous values rather
than receiving default values.
.RE
.TP
\fBgrid forget \fIslave \fR?\fIslave ...\fR?
\fBgrid forget \fIwindow \fR?\fIwindow ...\fR?
.
Removes each of the \fIslave\fRs from grid for its
master and unmaps their windows.
The slaves will no longer be managed by the grid geometry manager.
Removes each of the \fIwindow\fRs from grid for its
container and unmaps their windows.
The content will no longer be managed by the grid geometry manager.
The configuration options for that window are forgotten, so that if the
slave is managed once more by the grid geometry manager, the initial
window is managed once more by the grid geometry manager, the initial
default settings are used.
.TP
\fBgrid info \fIslave\fR
\fBgrid info \fIwindow\fR
.
Returns a list whose elements are the current configuration state of
the slave given by \fIslave\fR in the same option-value form that
the content given by \fIwindow\fR in the same option-value form that
might be specified to \fBgrid configure\fR.
The first two elements of the list are
.QW "\fB\-in \fImaster\fR"
where \fImaster\fR is the slave's master.
.QW "\fB\-in \fIcontainer\fR"
where \fIcontainer\fR is the windows's container window.
.TP
\fBgrid location \fImaster x y\fR
\fBgrid location \fIwindow x y\fR
.
Given \fIx\fR and \fIy\fR values in screen units relative to the master window,
Given \fIx\fR and \fIy\fR values in screen units relative to the container window,
the column and row number at that \fIx\fR and \fIy\fR location is returned.
For locations that are above or to the left of the grid, \fB\-1\fR is
returned.
.TP
\fBgrid propagate \fImaster\fR ?\fIboolean\fR?
\fBgrid propagate \fIwindow\fR ?\fIboolean\fR?
.
If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
then propagation is enabled for \fImaster\fR, which must be a window
then propagation is enabled for \fIwindow\fR, which must be a window
name (see \fBGEOMETRY PROPAGATION\fR below).
If \fIboolean\fR has a false boolean value then propagation is
disabled for \fImaster\fR.
disabled for \fIwindow\fR.
In either of these cases an empty string is returned.
If \fIboolean\fR is omitted then the command returns \fB0\fR or
\fB1\fR to indicate whether propagation is currently enabled
for \fImaster\fR.
for \fIwindow\fR.
Propagation is enabled by default.
.TP
\fBgrid rowconfigure \fImaster index \fR?\fI\-option value...\fR?
\fBgrid rowconfigure \fIwindow index \fR?\fI\-option value...\fR?
.
Query or set the row properties of the \fIindex\fR row of the
geometry master, \fImaster\fR.
geometry window, \fIwindow\fR.
The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR
and \fB\-pad\fR.
If one or more options are provided, then \fIindex\fR may be given as
a list of row indices to which the configuration options will operate on.
Indices may be integers, window names or the keyword \fIall\fR. For \fIall\fR
the options apply to all rows currently occupied be slave windows. For
a window name, that window must be a slave of this master and the options
apply to all rows currently occupied be the slave.
the options apply to all rows currently occupied by content windows. For
a window name, that window must be a content window of this container and the options
apply to all rows currently occupied by the container window.
The \fB\-minsize\fR option sets the minimum size, in screen units,
that will be permitted for this row.
The \fB\-weight\fR option (an integer value)
@@ -264,91 +264,96 @@ added to the largest window contained completely in that row when the
grid geometry manager requests a size from the containing window.
If only an option is specified, with no value,
the current value of that option is returned.
If only the master window and index is specified, all the current settings
If only the container window and index is specified, all the current settings
are returned in a list of
.QW "-option value"
pairs.
.TP
\fBgrid remove \fIslave \fR?\fIslave ...\fR?
\fBgrid remove \fIwindow \fR?\fIwindow ...\fR?
.
Removes each of the \fIslave\fRs from grid for its
master and unmaps their windows.
The slaves will no longer be managed by the grid geometry manager.
Removes each of the \fIwindow\fRs from grid for its
container and unmaps their windows.
The content will no longer be managed by the grid geometry manager.
However, the configuration options for that window are remembered,
so that if the
slave is managed once more by the grid geometry manager, the previous
values are retained.
so that if the content window is managed once more by the grid
geometry manager, the previous values are retained.
.TP
\fBgrid size \fImaster\fR
\fBgrid size \fIcontainer\fR
.
Returns the size of the grid (in columns then rows) for \fImaster\fR.
The size is determined either by the \fIslave\fR occupying the largest
Returns the size of the grid (in columns then rows) for \fIcontainer\fR.
The size is determined either by the \fIcontent\fR occupying the largest
row or column, or the largest column or row with a \fB\-minsize\fR,
\fB\-weight\fR, or \fB\-pad\fR that is non-zero.
.TP
\fBgrid slaves \fImaster\fR ?\fI\-option value\fR?
\fBgrid slaves \fIwindow\fR ?\fI\-option value\fR?
.
If no options are supplied, a list of all of the slaves in \fImaster\fR
are returned, most recently manages first.
If no options are supplied, a list of all of the content in \fIwindow\fR
are returned, most recently managed first.
\fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which
causes only the slaves in the row (or column) specified by \fIvalue\fR
causes only the content in the row (or column) specified by \fIvalue\fR
to be returned.
.VS "TIP 581"
.TP
\fBgrid content \fIwindow\fR ?\fI\-option value\fR?
.
Synonym for \fBgrid slaves \fIwindow\fR ?\fI\-option value\fR?.
.VE "TIP 581"
.SH "RELATIVE PLACEMENT"
.PP
The \fBgrid\fR command contains a limited set of capabilities that
permit layouts to be created without specifying the row and column
information for each slave. This permits slaves to be rearranged,
information for each content. This permits content to be rearranged,
added, or removed without the need to explicitly specify row and
column information.
When no column or row information is specified for a \fIslave\fR,
When no column or row information is specified for a \fIcontent\fR,
default values are chosen for
\fB\-column\fR, \fB\-row\fR, \fB\-columnspan\fR and \fB\-rowspan\fR
at the time the \fIslave\fR is managed. The values are chosen
based upon the current layout of the grid, the position of the \fIslave\fR
relative to other \fIslave\fRs in the same grid command, and the presence
at the time the \fIcontent\fR is managed. The values are chosen
based upon the current layout of the grid, the position of the \fIcontent\fR
relative to other \fIcontent\fRs in the same grid command, and the presence
of the characters \fB\-\fR, \fBx\fR, and \fB^\fR in \fBgrid\fR
command where \fIslave\fR names are normally expected.
command where \fIcontent\fR names are normally expected.
.RS
.TP
\fB\-\fR
.
This increases the \fB\-columnspan\fR of the \fIslave\fR to the left. Several
This increases the \fB\-columnspan\fR of the \fIcontent\fR to the left. Several
\fB\-\fR's in a row will successively increase the number of columns spanned. A \fB\-\fR
may not follow a \fB^\fR or a \fBx\fR, nor may it be the first \fIslave\fR
may not follow a \fB^\fR or a \fBx\fR, nor may it be the first \fIcontent\fR
argument to \fBgrid configure\fR.
.TP
\fBx\fR
.
This leaves an empty column between the \fIslave\fR on the left and
the \fIslave\fR on the right.
This leaves an empty column between the \fIcontent\fR on the left and
the \fIcontent\fR on the right.
.TP
\fB^\fR
.
This extends the \fB\-rowspan\fR of the \fIslave\fR above the \fB^\fR's
This extends the \fB\-rowspan\fR of the \fIcontent\fR above the \fB^\fR's
in the grid. The number of \fB^\fR's in a row must match the number of
columns spanned by the \fIslave\fR above it.
columns spanned by the \fIcontent\fR above it.
.RE
.SH "THE GRID ALGORITHM"
.PP
The grid geometry manager lays out its slaves in three steps.
In the first step, the minimum size needed to fit all of the slaves
The grid geometry manager lays out its content in three steps.
In the first step, the minimum size needed to fit all of the content
is computed, then (if propagation is turned on), a request is made
of the master window to become that size.
of the container window to become that size.
In the second step, the requested size is compared against the actual size
of the master. If the sizes are different, then spaces is added to or taken
of the container. If the sizes are different, then spaces is added to or taken
away from the layout as needed.
For the final step, each slave is positioned in its row(s) and column(s)
For the final step, each content is positioned in its row(s) and column(s)
based on the setting of its \fIsticky\fR flag.
.PP
To compute the minimum size of a layout, the grid geometry manager
first looks at all slaves whose \fB\-columnspan\fR and \fB\-rowspan\fR values are one,
first looks at all content whose \fB\-columnspan\fR and \fB\-rowspan\fR values are one,
and computes the nominal size of each row or column to be either the
\fIminsize\fR for that row or column, or the sum of the \fIpad\fRding
plus the size of the largest slave, whichever is greater. After that
plus the size of the largest content, whichever is greater. After that
the rows or columns in each uniform group adapt to each other. Then
the slaves whose row-spans or column-spans are greater than one are
the content whose row-spans or column-spans are greater than one are
examined. If a group of rows or columns need to be increased in size
in order to accommodate these slaves, then extra space is added to each
in order to accommodate these content, then extra space is added to each
row or column in the group according to its \fIweight\fR. For each
group whose weights are all zero, the additional space is apportioned
equally.
@@ -369,11 +374,11 @@ minimum size. For example, if all rows or columns in a group have the
same weight, then each row or column will have the same size as the
largest row or column in the group.
.PP
For masters whose size is larger than the requested layout, the additional
For containers whose size is larger than the requested layout, the additional
space is apportioned according to the row and column weights. If all of
the weights are zero, the layout is placed within its master according to
the weights are zero, the layout is placed within its container according to
the \fIanchor\fR value.
For masters whose size is smaller than the requested layout, space is taken
For containers whose size is smaller than the requested layout, space is taken
away from columns and rows according to their weights. However, once a
column or row shrinks to its minsize, its weight is taken to be zero.
If more space needs to be removed from a layout than would be permitted, as
@@ -381,34 +386,34 @@ when all the rows or columns are at their minimum sizes, the layout is
placed and clipped according to the \fIanchor\fR value.
.SH "GEOMETRY PROPAGATION"
.PP
The grid geometry manager normally computes how large a master must be to
just exactly meet the needs of its slaves, and it sets the
requested width and height of the master to these dimensions.
The grid geometry manager normally computes how large a container must be to
just exactly meet the needs of its content, and it sets the
requested width and height of the container to these dimensions.
This causes geometry information to propagate up through a
window hierarchy to a top-level window so that the entire
sub-tree sizes itself to fit the needs of the leaf windows.
However, the \fBgrid propagate\fR command may be used to
turn off propagation for one or more masters.
turn off propagation for one or more containers.
If propagation is disabled then grid will not set
the requested width and height of the master window.
This may be useful if, for example, you wish for a master
the requested width and height of the container window.
This may be useful if, for example, you wish for a container
window to have a fixed size that you specify.
.SH "RESTRICTIONS ON MASTER WINDOWS"
.SH "RESTRICTIONS ON CONTAINER WINDOWS"
.PP
The master for each slave must either be the slave's parent
(the default) or a descendant of the slave's parent.
The container for each content must either be the content's parent
(the default) or a descendant of the content's parent.
This restriction is necessary to guarantee that the
slave can be placed over any part of its master that is
visible without danger of the slave being clipped by its parent.
In addition, all slaves in one call to \fBgrid\fR must have the same master.
content can be placed over any part of its container that is
visible without danger of the content being clipped by its parent.
In addition, all content in one call to \fBgrid\fR must have the same container.
.SH "STACKING ORDER"
.PP
If the master for a slave is not its parent then you must make sure
that the slave is higher in the stacking order than the master.
Otherwise the master will obscure the slave and it will appear as
if the slave has not been managed correctly.
The easiest way to make sure the slave is higher than the master is
to create the master window first: the most recently created window
If the container for a content is not its parent then you must make sure
that the content is higher in the stacking order than the container.
Otherwise the container will obscure the content and it will appear as
if the content has not been managed correctly.
The easiest way to make sure the content is higher than the container is
to create the container window first: the most recently created window
will be highest in the stacking order.
.SH CREDITS
.PP
@@ -441,7 +446,7 @@ widths:
.PP
.CS
button .b \-text "Foo"
entry .e \-variable foo
entry .e \-textvariable foo ; set foo "Hello World!"
label .l \-text "This is a fairly long piece of text"
\fBgrid\fR .b .e .l \-sticky ew

File diff suppressed because it is too large Load Diff

View File

@@ -108,7 +108,7 @@ by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBlabelframe\fR
command.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for

View File

@@ -11,7 +11,7 @@
.SH NAME
safe::loadTk \- Load Tk into a safe interpreter.
.SH SYNOPSIS
\fBsafe::loadTk \fIslave\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR?
\fBsafe::loadTk \fIchild\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR?
.BE
.SH DESCRIPTION
.PP
@@ -43,13 +43,13 @@ the \fBSECURITY ISSUES\fR section below for implementation details.
Please read the \fBsafe\fR manual page for Tcl to learn about the basic
security considerations for Safe Tcl.
.PP
\fBsafe::loadTk\fR adds the value of \fBtk_library\fR taken from the master
\fBsafe::loadTk\fR adds the value of \fBtk_library\fR taken from the parent
interpreter to the virtual access path of the safe interpreter so that
auto-loading will work in the safe interpreter.
.PP
Tk initialization is now safe with respect to not trusting the slave's state
for startup. \fBsafe::loadTk\fR registers the slave's name so when the Tk
initialization (\fBTk_SafeInit\fR) is called and in turn calls the master's
Tk initialization is now safe with respect to not trusting the child's state
for startup. \fBsafe::loadTk\fR registers the child's name so when the Tk
initialization (\fBTk_SafeInit\fR) is called and in turn calls the parent's
\fBsafe::InitTk\fR it will return the desired \fBargv\fR equivalent
(\fB\-use\fR \fIwindowId\fR, correct \fB\-display\fR, etc.)
.PP
@@ -62,8 +62,8 @@ fatal X error.
.SH "SEE ALSO"
safe(n), interp(n), library(n), load(n), package(n), source(n), unknown(n)
.SH KEYWORDS
alias, auto-loading, auto_mkindex, load, master interpreter, safe
interpreter, slave interpreter, source
alias, auto-loading, auto_mkindex, load, parent interpreter, safe
interpreter, child interpreter, source
'\" Local Variables:
'\" mode: nroff
'\" End:

View File

@@ -40,7 +40,7 @@ top. If so, it will exist as entry 0 of the menu and the other
entries will number starting at 1. The default
menu bindings arrange for the menu to be torn off when the tear-off
entry is invoked.
This option is ignored under Aqua/Mac OS X, where menus cannot
This option is ignored under Aqua/MacOS, where menus cannot
be torn off.
.OP \-tearoffcommand tearOffCommand TearOffCommand
If this option has a non-empty value, then it specifies a Tcl command
@@ -54,7 +54,7 @@ and menu \fB.x.y\fR is torn off to
create a new menu \fB.x.tearoff1\fR, then the command
.QW "\fBa b .x.y .x.tearoff1\fR"
will be invoked.
This option is ignored under Aqua/Mac OS X, where menus cannot
This option is ignored under Aqua/MacOS, where menus cannot
be torn off.
.OP \-title title Title
The string will be used to title the window created when this menu is
@@ -264,7 +264,10 @@ contents are inserted into the standard Window menu of the user's
menubar whenever the window's menubar is in front. The first items in
the menu are provided by Mac OS X, and the names of the current
toplevels are automatically appended after all the Tk-defined items and
a separator.
a separator. The Window menu on the Mac also allows toggling the
window into a fullscreen state, and managing a tabbed window interface
(multiple windows grouped into a single window) if supported by that
version of the operating system.
.PP
When Tk sees a .menubar.help menu on the Macintosh, the menu's contents
are appended to the standard Help menu of the user's menubar whenever
@@ -467,18 +470,19 @@ a menu entry does not automatically unpost the menu; the default
bindings normally take care of this before invoking the \fBinvoke\fR
widget command.
.TP
\fIpathName \fBpost \fIx y\fR
\fIpathName \fBpost \fIx y\fR ?\fIindex\fR?
.
Arrange for the menu to be displayed on the screen at the root-window
coordinates given by \fIx\fR and \fIy\fR. These coordinates are
adjusted if necessary to guarantee that the entire menu is visible on
the screen. This command normally returns an empty string.
If the \fB\-postcommand\fR option has been specified, then its value is
executed as a Tcl script before posting the menu and the result of
that script is returned as the result of the \fBpost\fR widget
command.
If an error returns while executing the command, then the error is
returned without posting the menu.
coordinates given by \fIx\fR and \fIy\fR. If an index is specified
the menu will be located so that the entry with that index is
displayed at the point. These coordinates are adjusted if necessary to
guarantee that the entire menu is visible on the screen. This command
normally returns an empty string. If the \fB\-postcommand\fR option
has been specified, then its value is executed as a Tcl script before
posting the menu and the result of that script is returned as the
result of the \fBpost\fR widget command. If an error returns while
executing the command, then the error is returned without posting the
menu.
.TP
\fIpathName \fBpostcascade \fIindex\fR
.
@@ -519,8 +523,8 @@ supported by all entry types.
\fB\-activebackground \fIvalue\fR
.
Specifies a background color to use for displaying this entry when it
is active.
If this option is specified as an empty string (the default), then the
is active. This option is ignored on Aqua/MacOS.
If it is specified as an empty string (the default), then the
\fB\-activebackground\fR option for the overall menu is used.
If the \fBtk_strictMotif\fR variable has been set to request strict
Motif compliance, then this option is ignored and the \fB\-background\fR
@@ -530,7 +534,7 @@ This option is not available for separator or tear-off entries.
\fB\-activeforeground \fIvalue\fR
.
Specifies a foreground color to use for displaying this entry when it
is active.
is active. This option is ignored on Aqua/macOS.
If this option is specified as an empty string (the default), then the
\fB\-activeforeground\fR option for the overall menu is used.
This option is not available for separator or tear-off entries.
@@ -548,7 +552,8 @@ for separator or tear-off entries.
.
Specifies a background color to use for displaying this entry when it
is in the normal state (neither active nor disabled).
If this option is specified as an empty string (the default), then the
This option is ignored on Aqua/macOS.
If it is specified as an empty string (the default), then the
\fB\-background\fR option for the overall menu is used.
This option is not available for separator or tear-off entries.
.TP
@@ -569,7 +574,7 @@ This option is not available for separator or tear-off entries.
When this option is zero, the entry appears below the previous entry. When
this option is one, the entry appears at the top of a new column in the
menu.
This option is ignored on Aqua/Mac OS X, where menus are always a single
This option is ignored on Aqua/macOS, where menus are always a single
column.
.TP
\fB\-command \fIvalue\fR
@@ -599,7 +604,8 @@ This option is not available for separator or tear-off entries.
.
Specifies a foreground color to use for displaying this entry when it
is in the normal state (neither active nor disabled).
If this option is specified as an empty string (the default), then the
This option is ignored on Aqua/macOS.
If it is specified as an empty string (the default), then the
\fB\-foreground\fR option for the overall menu is used.
This option is not available for separator or tear-off entries.
.TP

View File

@@ -22,16 +22,16 @@ packing them in order around the edges of the parent.
The \fBpack\fR command can have any of several forms, depending
on the \fIoption\fR argument:
.TP
\fBpack \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
\fBpack \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR?
If the first argument to \fBpack\fR is a window name (any value
starting with
.QW . ),
then the command is processed in the same way as \fBpack configure\fR.
.TP
\fBpack configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
The arguments consist of the names of one or more slave windows
\fBpack configure \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR?
The arguments consist of the names of one or more content windows
followed by pairs of arguments that specify how
to manage the slaves.
to manage the content.
See \fBTHE PACKER ALGORITHM\fR below for details on how the options
are used by the packer.
The following options are supported:
@@ -39,224 +39,230 @@ The following options are supported:
.TP
\fB\-after \fIother\fR
\fIOther\fR must the name of another window.
Use its master as the master for the slaves, and insert
the slaves just after \fIother\fR in the packing order.
Use its container as the container for the content, and insert
the content just after \fIother\fR in the packing order.
.TP
\fB\-anchor \fIanchor\fR
\fIAnchor\fR must be a valid anchor position such as \fBn\fR
or \fBsw\fR; it specifies where to position each slave in its
or \fBsw\fR; it specifies where to position each content in its
parcel.
Defaults to \fBcenter\fR.
.TP
\fB\-before \fIother\fR
\fIOther\fR must the name of another window.
Use its master as the master for the slaves, and insert
the slaves just before \fIother\fR in the packing order.
Use its container as the container for the content, and insert
the content just before \fIother\fR in the packing order.
.TP
\fB\-expand \fIboolean\fR
Specifies whether the slaves should be expanded to consume
extra space in their master.
Specifies whether the content should be expanded to consume
extra space in their container.
\fIBoolean\fR may have any proper boolean value, such as \fB1\fR
or \fBno\fR.
Defaults to 0.
.TP
\fB\-fill \fIstyle\fR
If a slave's parcel is larger than its requested dimensions, this
option may be used to stretch the slave.
If a content's parcel is larger than its requested dimensions, this
option may be used to stretch the content.
\fIStyle\fR must have one of the following values:
.RS
.TP
\fBnone\fR
Give the slave its requested dimensions plus any internal padding
Give the content its requested dimensions plus any internal padding
requested with \fB\-ipadx\fR or \fB\-ipady\fR. This is the default.
.TP
\fBx\fR
Stretch the slave horizontally to fill the entire width of its
Stretch the content horizontally to fill the entire width of its
parcel (except leave external padding as specified by \fB\-padx\fR).
.TP
\fBy\fR
Stretch the slave vertically to fill the entire height of its
Stretch the content vertically to fill the entire height of its
parcel (except leave external padding as specified by \fB\-pady\fR).
.TP
\fBboth\fR
Stretch the slave both horizontally and vertically.
Stretch the content both horizontally and vertically.
.RE
.TP
\fB\-in \fIother\fR
Insert the slave(s) at the end of the packing order for the master
window given by \fIother\fR.
\fB\-in \fIcontainer\fR
Insert the window at the end of the packing order for the container
window given by \fIcontainer\fR.
.TP
\fB\-ipadx \fIamount\fR
\fIAmount\fR specifies how much horizontal internal padding to
leave on each side of the slave(s).
leave on each side of the content.
\fIAmount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR.
It defaults to 0.
.TP
\fB\-ipady \fIamount\fR
\fIAmount\fR specifies how much vertical internal padding to
leave on each side of the slave(s).
leave on each side of the content.
\fIAmount\fR defaults to 0.
.TP
\fB\-padx \fIamount\fR
\fIAmount\fR specifies how much horizontal external padding to
leave on each side of the slave(s). \fIAmount\fR may be a list
leave on each side of the content. \fIAmount\fR may be a list
of two values to specify padding for left and right separately.
\fIAmount\fR defaults to 0.
.TP
\fB\-pady \fIamount\fR
\fIAmount\fR specifies how much vertical external padding to
leave on each side of the slave(s). \fIAmount\fR may be a list
leave on each side of the content. \fIAmount\fR may be a list
of two values to specify padding for top and bottom separately.
\fIAmount\fR defaults to 0.
.TP
\fB\-side \fIside\fR
Specifies which side of the master the slave(s) will be packed against.
Specifies which side of the container the content will be packed against.
Must be \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
Defaults to \fBtop\fR.
.LP
If no \fB\-in\fR, \fB\-after\fR or \fB\-before\fR option is specified
then each of the slaves will be inserted at the end of the packing list
then each of the content will be inserted at the end of the packing list
for its parent unless it is already managed by the packer (in which
case it will be left where it is).
If one of these options is specified then all the slaves will be
If one of these options is specified then all the content will be
inserted at the specified point.
If any of the slaves are already managed by the geometry manager
If any of the content are already managed by the geometry manager
then any unspecified options for them retain their previous values rather
than receiving default values.
.RE
.TP
\fBpack forget \fIslave \fR?\fIslave ...\fR?
Removes each of the \fIslave\fRs from the packing order for its
master and unmaps their windows.
The slaves will no longer be managed by the packer.
\fBpack forget \fIwindow \fR?\fIwindow ...\fR?
Removes each of the \fIwindow\fRs from the packing order for its
container and unmaps their windows.
The content will no longer be managed by the packer.
.TP
\fBpack info \fIslave\fR
\fBpack info \fIwindow\fR
Returns a list whose elements are the current configuration state of
the slave given by \fIslave\fR in the same option-value form that
the window given by \fIwindow\fR in the same option-value form that
might be specified to \fBpack configure\fR.
The first two elements of the list are
.QW "\fB\-in \fImaster\fR"
where \fImaster\fR is the slave's master.
.QW "\fB\-in \fIcontainer\fR"
where \fIcontainer\fR is the window's container.
.TP
\fBpack propagate \fImaster\fR ?\fIboolean\fR?
\fBpack propagate \fIcontainer\fR ?\fIboolean\fR?
If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
then propagation is enabled for \fImaster\fR, which must be a window
then propagation is enabled for \fIcontainer\fR, which must be a window
name (see \fBGEOMETRY PROPAGATION\fR below).
If \fIboolean\fR has a false boolean value then propagation is
disabled for \fImaster\fR.
disabled for \fIcontainer\fR.
In either of these cases an empty string is returned.
If \fIboolean\fR is omitted then the command returns \fB0\fR or
\fB1\fR to indicate whether propagation is currently enabled
for \fImaster\fR.
for \fIcontainer\fR.
Propagation is enabled by default.
.TP
\fBpack slaves \fImaster\fR
Returns a list of all of the slaves in the packing order for \fImaster\fR.
The order of the slaves in the list is the same as their order in
\fBpack slaves \fIwindow\fR
Returns a list of all of the content windows in the packing order for \fIwindow\fR.
The order of the content windows in the list is the same as their order in
the packing order.
If \fImaster\fR has no slaves then an empty string is returned.
If \fIwindow\fR has no content then an empty string is returned.
.VS "TIP 581"
.TP
\fBpack content \fIwindow\fR
.
Synonym for \fBpack slaves \fIwindow\fR.
.VE "TIP 581"
.SH "THE PACKER ALGORITHM"
.PP
For each master the packer maintains an ordered list of slaves
called the \fIpacking list\fR.
For each container the packer maintains an ordered list of content
windows called the \fIpacking list\fR.
The \fB\-in\fR, \fB\-after\fR, and \fB\-before\fR configuration
options are used to specify the master for each slave and the slave's
options are used to specify the container for each content and the content's
position in the packing list.
If none of these options is given for a slave then the slave
If none of these options is given for a content then the content
is added to the end of the packing list for its parent.
.PP
The packer arranges the slaves for a master by scanning the
The packer arranges the content windows for a container by scanning the
packing list in order.
At the time it processes each slave, a rectangular area within
the master is still unallocated.
This area is called the \fIcavity\fR; for the first slave it
is the entire area of the master.
At the time it processes each content, a rectangular area within
the container is still unallocated.
This area is called the \fIcavity\fR; for the first content it
is the entire area of the container.
.PP
For each slave the packer carries out the following steps:
For each content the packer carries out the following steps:
.IP [1]
The packer allocates a rectangular \fIparcel\fR for the slave
along the side of the cavity given by the slave's \fB\-side\fR option.
The packer allocates a rectangular \fIparcel\fR for the content
along the side of the cavity given by the content's \fB\-side\fR option.
If the side is top or bottom then the width of the parcel is
the width of the cavity and its height is the requested height
of the slave plus the \fB\-ipady\fR and \fB\-pady\fR options.
of the content plus the \fB\-ipady\fR and \fB\-pady\fR options.
For the left or right side the height of the parcel is
the height of the cavity and the width is the requested width
of the slave plus the \fB\-ipadx\fR and \fB\-padx\fR options.
of the content plus the \fB\-ipadx\fR and \fB\-padx\fR options.
The parcel may be enlarged further because of the \fB\-expand\fR
option (see \fBEXPANSION\fR below)
.IP [2]
The packer chooses the dimensions of the slave.
The width will normally be the slave's requested width plus
The packer chooses the dimensions of the content.
The width will normally be the content's requested width plus
twice its \fB\-ipadx\fR option and the height will normally be
the slave's requested height plus twice its \fB\-ipady\fR
the content's requested height plus twice its \fB\-ipady\fR
option.
However, if the \fB\-fill\fR option is \fBx\fR or \fBboth\fR
then the width of the slave is expanded to fill the width of the parcel,
then the width of the content is expanded to fill the width of the parcel,
minus twice the \fB\-padx\fR option.
If the \fB\-fill\fR option is \fBy\fR or \fBboth\fR
then the height of the slave is expanded to fill the width of the parcel,
then the height of the content is expanded to fill the width of the parcel,
minus twice the \fB\-pady\fR option.
.IP [3]
The packer positions the slave over its parcel.
If the slave is smaller than the parcel then the \fB\-anchor\fR
option determines where in the parcel the slave will be placed.
The packer positions the content over its parcel.
If the content is smaller than the parcel then the \fB\-anchor\fR
option determines where in the parcel the content will be placed.
If \fB\-padx\fR or \fB\-pady\fR is non-zero, then the given
amount of external padding will always be left between the
slave and the edges of the parcel.
content and the edges of the parcel.
.PP
Once a given slave has been packed, the area of its parcel
Once a given content has been packed, the area of its parcel
is subtracted from the cavity, leaving a smaller rectangular
cavity for the next slave.
If a slave does not use all of its parcel, the unused space
in the parcel will not be used by subsequent slaves.
cavity for the next content.
If a content does not use all of its parcel, the unused space
in the parcel will not be used by subsequent content.
If the cavity should become too small to meet the needs of
a slave then the slave will be given whatever space is
a content then the content will be given whatever space is
left in the cavity.
If the cavity shrinks to zero size, then all remaining slaves
If the cavity shrinks to zero size, then all remaining content
on the packing list will be unmapped from the screen until
the master window becomes large enough to hold them again.
the container window becomes large enough to hold them again.
.SS "EXPANSION"
.PP
If a master window is so large that there will be extra space
left over after all of its slaves have been packed, then the
extra space is distributed uniformly among all of the slaves
If a container window is so large that there will be extra space
left over after all of its content have been packed, then the
extra space is distributed uniformly among all of the content
for which the \fB\-expand\fR option is set.
Extra horizontal space is distributed among the expandable
slaves whose \fB\-side\fR is \fBleft\fR or \fBright\fR,
content whose \fB\-side\fR is \fBleft\fR or \fBright\fR,
and extra vertical space is distributed among the expandable
slaves whose \fB\-side\fR is \fBtop\fR or \fBbottom\fR.
content whose \fB\-side\fR is \fBtop\fR or \fBbottom\fR.
.SS "GEOMETRY PROPAGATION"
.PP
The packer normally computes how large a master must be to
just exactly meet the needs of its slaves, and it sets the
requested width and height of the master to these dimensions.
The packer normally computes how large a container must be to
just exactly meet the needs of its content, and it sets the
requested width and height of the container to these dimensions.
This causes geometry information to propagate up through a
window hierarchy to a top-level window so that the entire
sub-tree sizes itself to fit the needs of the leaf windows.
However, the \fBpack propagate\fR command may be used to
turn off propagation for one or more masters.
turn off propagation for one or more containers.
If propagation is disabled then the packer will not set
the requested width and height of the packer.
This may be useful if, for example, you wish for a master
This may be useful if, for example, you wish for a container
window to have a fixed size that you specify.
.SH "RESTRICTIONS ON MASTER WINDOWS"
.SH "RESTRICTIONS ON CONTAINER WINDOWS"
.PP
The master for each slave must either be the slave's parent
(the default) or a descendant of the slave's parent.
The container for each content must either be the content's parent
(the default) or a descendant of the content's parent.
This restriction is necessary to guarantee that the
slave can be placed over any part of its master that is
visible without danger of the slave being clipped by its parent.
content can be placed over any part of its container that is
visible without danger of the content being clipped by its parent.
.SH "PACKING ORDER"
.PP
If the master for a slave is not its parent then you must make sure
that the slave is higher in the stacking order than the master.
Otherwise the master will obscure the slave and it will appear as
if the slave has not been packed correctly.
The easiest way to make sure the slave is higher than the master is
to create the master window first: the most recently created window
If the container for a content is not its parent then you must make sure
that the content is higher in the stacking order than the container.
Otherwise the container will obscure the content and it will appear as
if the content has not been packed correctly.
The easiest way to make sure the content is higher than the container is
to create the container window first: the most recently created window
will be highest in the stacking order.
Or, you can use the \fBraise\fR and \fBlower\fR commands to change
the stacking order of either the master or the slave.
the stacking order of either the container or the content.
.SH EXAMPLE
.PP
.CS

View File

@@ -330,8 +330,8 @@ When a pane is resized from outside (e.g. it is packed to expand and
fill, and the containing toplevel is resized), space is added to the final
(rightmost or bottommost) pane in the window.
.PP
Unlike slave windows managed by e.g. pack or grid, the panes managed by a
panedwindow do not change width or height to accomodate changes in the
Unlike child windows managed by e.g. pack or grid, the panes managed by a
panedwindow do not change width or height to accommodate changes in the
requested widths or heights of the panes, once these have become mapped.
Therefore it may be advisable, particularly when creating layouts
interactively, to not add a pane to the panedwindow widget until after the

View File

@@ -18,26 +18,26 @@ place \- Geometry manager for fixed or rubber-sheet placement
.PP
The placer is a geometry manager for Tk.
It provides simple fixed placement of windows, where you specify
the exact size and location of one window, called the \fIslave\fR,
within another window, called the \fImaster\fR.
the exact size and location of one window, called the \fIcontent\fR,
within another window, called the \fIcontainer\fR.
The placer also provides rubber-sheet placement, where you specify the
size and location of the slave in terms of the dimensions of
the master, so that the slave changes size and location
in response to changes in the size of the master.
size and location of the content in terms of the dimensions of
the container, so that the content changes size and location
in response to changes in the size of the container.
Lastly, the placer allows you to mix these styles of placement so
that, for example, the slave has a fixed width and height but is
centered inside the master.
that, for example, the content has a fixed width and height but is
centered inside the container.
.PP
.TP
\fBplace \fIwindow option value \fR?\fIoption value ...\fR?
Arrange for the placer to manage the geometry of a slave whose
Arrange for the placer to manage the geometry of a content whose
pathName is \fIwindow\fR. The remaining arguments consist of one or
more \fIoption\-value\fR pairs that specify the way in which
\fIwindow\fR's geometry is managed. \fIOption\fR may have any of the
values accepted by the \fBplace configure\fR command.
.TP
\fBplace configure \fIwindow \fR?\fIoption\fR? ?\fIvalue option value ...\fR?
Query or modify the geometry options of the slave given by
Query or modify the geometry options of the content given by
\fIwindow\fR. If no \fIoption\fR is specified, this command returns a
list describing the available options (see \fBTk_ConfigureInfo\fR for
information on the format of this list). If \fIoption\fR is specified
@@ -59,27 +59,27 @@ The anchor point is in terms of the outer area of \fIwindow\fR
including its border, if any.
Thus if \fIwhere\fR is \fBse\fR then the lower-right corner of
\fIwindow\fR's border will appear at the given (x,y) location
in the master.
in the container.
The anchor position defaults to \fBnw\fR.
.TP
\fB\-bordermode \fImode\fR
\fIMode\fR determines the degree to which borders within the
master are used in determining the placement of the slave.
container are used in determining the placement of the content.
The default and most common value is \fBinside\fR.
In this case the placer considers the area of the master to
be the innermost area of the master, inside any border:
In this case the placer considers the area of the container to
be the innermost area of the container, inside any border:
an option of \fB\-x 0\fR corresponds to an x-coordinate just
inside the border and an option of \fB\-relwidth 1.0\fR
means \fIwindow\fR will fill the area inside the master's
means \fIwindow\fR will fill the area inside the container's
border.
.RS
.PP
If \fImode\fR is \fBoutside\fR then the placer considers
the area of the master to include its border;
the area of the container to include its border;
this mode is typically used when placing \fIwindow\fR
outside its master, as with the options \fB\-x 0 \-y 0 \-anchor ne\fR.
outside its container, as with the options \fB\-x 0 \-y 0 \-anchor ne\fR.
Lastly, \fImode\fR may be specified as \fBignore\fR, in which
case borders are ignored: the area of the master is considered
case borders are ignored: the area of the container is considered
to be its official X area, which includes any internal border but
no external border. A bordermode of \fBignore\fR is probably
not very useful.
@@ -94,61 +94,61 @@ If \fIsize\fR is an empty string, or if no \fB\-height\fR or
\fB\-relheight\fR option is specified, then the height requested
internally by the window will be used.
.TP
\fB\-in \fImaster\fR
\fIMaster\fR specifies the path name of the window relative
\fB\-in \fIcontainer\fR
\fIContainer\fR specifies the path name of the window relative
to which \fIwindow\fR is to be placed.
\fIMaster\fR must either be \fIwindow\fR's parent or a descendant
\fIContainer\fR must either be \fIwindow\fR's parent or a descendant
of \fIwindow\fR's parent.
In addition, \fImaster\fR and \fIwindow\fR must both be descendants
In addition, \fIcontainer\fR and \fIwindow\fR must both be descendants
of the same top-level window.
These restrictions are necessary to guarantee
that \fIwindow\fR is visible whenever \fImaster\fR is visible.
If this option is not specified then the master defaults to
that \fIwindow\fR is visible whenever \fIcontainer\fR is visible.
If this option is not specified then the other window defaults to
\fIwindow\fR's parent.
.TP
\fB\-relheight \fIsize\fR
\fISize\fR specifies the height for \fIwindow\fR.
In this case the height is specified as a floating-point number
relative to the height of the master: 0.5 means \fIwindow\fR will
be half as high as the master, 1.0 means \fIwindow\fR will have
the same height as the master, and so on.
If both \fB\-height\fR and \fB\-relheight\fR are specified for a slave,
relative to the height of the container: 0.5 means \fIwindow\fR will
be half as high as the container, 1.0 means \fIwindow\fR will have
the same height as the container, and so on.
If both \fB\-height\fR and \fB\-relheight\fR are specified for a content,
their values are summed. For example, \fB\-relheight 1.0 \-height \-2\fR
makes the slave 2 pixels shorter than the master.
makes the content 2 pixels shorter than the container.
.TP
\fB\-relwidth \fIsize\fR
\fISize\fR specifies the width for \fIwindow\fR.
In this case the width is specified as a floating-point number
relative to the width of the master: 0.5 means \fIwindow\fR will
be half as wide as the master, 1.0 means \fIwindow\fR will have
the same width as the master, and so on.
If both \fB\-width\fR and \fB\-relwidth\fR are specified for a slave,
relative to the width of the container: 0.5 means \fIwindow\fR will
be half as wide as the container, 1.0 means \fIwindow\fR will have
the same width as the container, and so on.
If both \fB\-width\fR and \fB\-relwidth\fR are specified for a content,
their values are summed. For example, \fB\-relwidth 1.0 \-width 5\fR
makes the slave 5 pixels wider than the master.
makes the content 5 pixels wider than the container.
.TP
\fB\-relx \fIlocation\fR
\fILocation\fR specifies the x-coordinate within the master window
\fILocation\fR specifies the x-coordinate within the container window
of the anchor point for \fIwindow\fR.
In this case the location is specified in a relative fashion
as a floating-point number: 0.0 corresponds to the left edge
of the master and 1.0 corresponds to the right edge of the master.
of the container and 1.0 corresponds to the right edge of the container.
\fILocation\fR need not be in the range 0.0\-1.0.
If both \fB\-x\fR and \fB\-relx\fR are specified for a slave
If both \fB\-x\fR and \fB\-relx\fR are specified for a content
then their values are summed. For example, \fB\-relx 0.5 \-x \-2\fR
positions the left edge of the slave 2 pixels to the left of the
center of its master.
positions the left edge of the content 2 pixels to the left of the
center of its container.
.TP
\fB\-rely \fIlocation\fR
\fILocation\fR specifies the y-coordinate within the master window
\fILocation\fR specifies the y-coordinate within the container window
of the anchor point for \fIwindow\fR.
In this case the value is specified in a relative fashion
as a floating-point number: 0.0 corresponds to the top edge
of the master and 1.0 corresponds to the bottom edge of the master.
of the container and 1.0 corresponds to the bottom edge of the container.
\fILocation\fR need not be in the range 0.0\-1.0.
If both \fB\-y\fR and \fB\-rely\fR are specified for a slave
If both \fB\-y\fR and \fB\-rely\fR are specified for a content
then their values are summed. For example, \fB\-rely 0.5 \-x 3\fR
positions the top edge of the slave 3 pixels below the
center of its master.
positions the top edge of the content 3 pixels below the
center of its container.
.TP
\fB\-width \fIsize\fR
\fISize\fR specifies the width for \fIwindow\fR in screen units
@@ -160,18 +160,18 @@ or \fB\-relwidth\fR option is specified, then the width requested
internally by the window will be used.
.TP
\fB\-x \fIlocation\fR
\fILocation\fR specifies the x-coordinate within the master window
\fILocation\fR specifies the x-coordinate within the container window
of the anchor point for \fIwindow\fR.
The location is specified in screen units (i.e. any of the forms
accepted by \fBTk_GetPixels\fR) and need not lie within the bounds
of the master window.
of the container window.
.TP
\fB\-y \fIlocation\fR
\fILocation\fR specifies the y-coordinate within the master window
\fILocation\fR specifies the y-coordinate within the container window
of the anchor point for \fIwindow\fR.
The location is specified in screen units (i.e. any of the forms
accepted by \fBTk_GetPixels\fR) and need not lie within the bounds
of the master window.
of the container window.
.PP
If the same value is specified separately with
two different options, such as \fB\-x\fR and \fB\-relx\fR, then
@@ -192,8 +192,14 @@ same form as might be specified to the \fBplace configure\fR
command.
.TP
\fBplace slaves \fIwindow\fR
Returns a list of all the slave windows for which \fIwindow\fR is the master.
If there are no slaves for \fIwindow\fR then an empty string is returned.
Returns a list of all the content windows for which \fIwindow\fR is the container.
If there is no content for \fIwindow\fR then an empty string is returned.
.VS "TIP 581"
.TP
\fBplace content \fIwindow\fR
.
Synonym for \fBplace slaves \fIwindow\fR.
.VE "TIP 581"
.PP
If the configuration of a window has been retrieved with
\fBplace info\fR, that configuration can be restored later by
@@ -202,8 +208,8 @@ for the window and then invoking \fBplace configure\fR with
the saved information.
.SH "FINE POINTS"
.PP
It is not necessary for the master window to be the parent
of the slave window.
It is not necessary for the container window to be the parent
of the content window.
This feature is useful in at least two situations.
First, for complex window layouts it means you can create a
hierarchy of subwindows whose only purpose
@@ -221,7 +227,7 @@ can specify options for the real children
without being aware of the structure of the geometry-management
hierarchy.
.PP
A second reason for having a master different than the slave's
A second reason for having a container different than the content's
parent is to tie two siblings together.
For example, the placer can be used to force a window always to
be positioned centered just below one of its
@@ -229,12 +235,12 @@ siblings by specifying the configuration
.CS
\fB\-in \fIsibling\fB \-relx 0.5 \-rely 1.0 \-anchor n \-bordermode outside\fR
.CE
Whenever the sibling is repositioned in the future, the slave
Whenever the sibling is repositioned in the future, the content
will be repositioned as well.
.PP
Unlike many other geometry managers (such as the packer)
the placer does not make any attempt to manipulate the geometry of
the master windows or the parents of slave windows (i.e. it does not
the container windows or the parents of content windows (i.e. it does not
set their requested sizes).
To control the sizes of these windows, make them windows like
frames and canvases that provide configuration options for this purpose.
@@ -249,7 +255,7 @@ label .l \-text "In the\enMiddle!" \-bg black \-fg white
.SH "SEE ALSO"
grid(n), pack(n)
.SH KEYWORDS
geometry manager, height, location, master, place, rubber sheet, slave, width
geometry manager, height, location, container, place, rubber sheet, content, width
'\" Local Variables:
'\" mode: nroff
'\" End:

View File

@@ -55,7 +55,7 @@ it is the scale's width.
.OP \-resolution resolution Resolution
A real value specifying the resolution for the scale.
If this value is greater than zero then the scale's value will always be
rounded to an even multiple of this value, as will tick marks and
rounded to an even multiple of this value, as will
the endpoints of the scale. If the value is less than zero then no
rounding occurs. Defaults to 1 (i.e., the value will be integral).
.OP \-showvalue showValue ShowValue
@@ -78,7 +78,7 @@ specified by the \fB\-activebackground\fR option.
.OP \-tickinterval tickInterval TickInterval
Must be a real value.
Determines the spacing between numerical
tick marks displayed below or to the left of the slider.
tick marks displayed below or to the left of the slider. The values will all be displayed with the same number of decimal places, which will be enough to ensure they are all accurate to within 20% of a tick interval.
If 0, no tick marks will be displayed.
.OP \-to to To
Specifies a real value corresponding

View File

@@ -150,7 +150,7 @@ A GUI event, for example \fB<<PasteSelection>>\fR, can copy the \fBPRIMARY\fR se
.PP
On X11, the \fBPRIMARY\fR selection is a system-wide feature of the X server, allowing communication between different processes that are X11 clients.
.PP
On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a master interpreter and its unsafe slave interpreters. It is not shared between interpreters in different processes or different threads. Each master interpreter has a separate \fBPRIMARY\fR selection that is shared only with its unsafe slaves.
On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a parent interpreter and its child interpreters. It is not shared between interpreters in different processes or different threads. Each parent interpreter has a separate \fBPRIMARY\fR selection that is shared only with its child interpreters which are not safe interpreters.
.PP
.SH SECURITY
.PP

View File

@@ -514,9 +514,10 @@ insertion cursor in the spinbox without affecting the selection.
If any normal printing characters are typed in a spinbox, they are
inserted at the point of the insertion cursor.
.IP [7]
The view in the spinbox can be adjusted by dragging with mouse button 2.
If mouse button 2 is clicked without moving the mouse, the selection
is copied into the spinbox at the position of the mouse cursor.
The view in the spinbox can be adjusted by dragging with the middle
mouse button (button 2, or button 3 in TkAqua). If the middle mouse
button is clicked without moving the mouse, the selection is copied
into the spinbox at the position of the mouse cursor.
.IP [8]
If the mouse is dragged out of the spinbox on the left or right sides
while button 1 is pressed, the spinbox will automatically scroll to

View File

@@ -1082,7 +1082,7 @@ satisfied and 0 if it is not. \fIOp\fR must be one of the operators <, <=, ==,
the same character, if \fIop\fR is < then 1 is returned if \fIindex1\fR refers
to an earlier character in the text than \fIindex2\fR, and so on.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
.
Query or modify the configuration options of the widget. If no \fIoption\fR is
specified, returns a list describing all of the available options for
@@ -1095,7 +1095,7 @@ command modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string. \fIOption\fR may have any of
the values accepted by the \fBtext\fR command.
.TP
\fIpathName \fBcount\fR \fI?options\fR? \fIindex1 index2\fR
\fIpathName \fBcount\fR ?\fIoptions\fR? \fIindex1 index2\fR
.
Counts the number of relevant things between the two indices. If \fIindex1\fR
is after \fIindex2\fR, the result will be a negative number (and this holds
@@ -1350,7 +1350,7 @@ are empty strings.
\fIpathName \fBimage \fIoption \fR?\fIarg arg ...\fR?
.
This command is used to manipulate embedded images. The behavior of the
command depends on the \fIoption\fR argument that follows the \fBtag\fR
command depends on the \fIoption\fR argument that follows the \fBimage\fR
argument. The following forms of the command are currently supported:
.RS
.TP
@@ -2025,12 +2025,13 @@ integer. This command used to be used for scrolling, but now it is obsolete.
.SH BINDINGS
.PP
Tk automatically creates class bindings for texts that give them the following
default behavior. In the descriptions below,
default behavior.
In the descriptions below,
.QW word
is dependent on the value of the \fBtcl_wordchars\fR variable. See
\fBtclvars\fR(n).
is dependent on the value of
the \fBtcl_wordchars\fR variable. See \fBtclvars\fR(n).
.IP [1]
Clicking mouse button 1 positions the insertion cursor just before the
Clicking mouse button 1 positions the insertion cursor at the closest edge of the
character underneath the mouse cursor, sets the input focus to this widget,
and clears any selection in the widget. Dragging with mouse button 1 strokes
out a selection between the insertion cursor and the character under the
@@ -2057,10 +2058,11 @@ insertion cursor without affecting the selection.
If any normal printing characters are typed, they are inserted at the point of
the insertion cursor.
.IP [7]
The view in the widget can be adjusted by dragging with mouse button 2. If
mouse button 2 is clicked without moving the mouse, the selection is copied
into the text at the position of the mouse cursor. The Insert key also inserts
the selection, but at the position of the insertion cursor.
The view in the widget can be adjusted by dragging with the middle mouse
button (button 2, or button 3 in TkAqua). If the middle mouse button is
clicked without moving the mouse, the selection is copied into the text at the
position of the mouse cursor. The Insert key also inserts the selection,
but at the position of the insertion cursor.
.IP [8]
If the mouse is dragged out of the widget while button 1 is pressed, the entry
will automatically scroll to make more text visible (if there is more text

View File

@@ -13,6 +13,8 @@
tk::mac \- Access Mac-Specific Functionality on OS X from Tk
.SH SYNOPSIS
.nf
\fB::tk::mac::DoScriptFile\fR
\fB::tk::mac::DoScriptText\fR
\fB::tk::mac::ShowPreferences\fR
\fB::tk::mac::OpenApplication\fR
\fB::tk::mac::ReopenApplication\fR
@@ -22,6 +24,9 @@ tk::mac \- Access Mac-Specific Functionality on OS X from Tk
\fB::tk::mac::OnHide\fR
\fB::tk::mac::OnShow\fR
\fB::tk::mac::ShowHelp\fR
\fB::tk::mac::PerformService\fR
\fB::tk::mac::LaunchURL \fIURL...\fR
\fB::tk::mac::GetAppPath\fR
\fB::tk::mac::standardAboutPanel\fR
@@ -30,6 +35,7 @@ tk::mac \- Access Mac-Specific Functionality on OS X from Tk
\fB::tk::mac::antialiasedtext \fInumber\fR
\fB::tk::mac::useThemedToplevel \fIboolean\fR
\fB::tk::mac::iconBitmap \fIname width height \-kind value\fR
.fi
.BE
@@ -40,6 +46,20 @@ events that applications should respond to. These events are mapped by Tk to
calls to commands in the \fB::tk::mac\fR namespace; unless otherwise noted, if
the command is absent, no action will be taken.
.TP
\fB::tk::mac::DoScriptFile\fR
.
The default Apple Event handler for AEDoScriptHandler. This command
executes a Tcl file when an AppleScript sends a
.QW "do script"
command to Wish with a file path as a parameter.
.TP
\fB::tk::mac::DoScriptText\fR
.
The default Apple Event handler for AEDoScriptHandler. This command
executes Tcl code when an AppleScript sends a
.QW "do script"
command to Wish with Tcl code or a Tcl procedure as a parameter.
.TP
\fB::tk::mac::ShowPreferences\fR
.
The default Apple Event handler for kAEShowPreferences,
@@ -61,7 +81,7 @@ proc ::tk::mac::ShowPreferences {} {
\fB::tk::mac::OpenApplication\fR
.
If a proc of this name is defined, this proc fill fire when your application
is intially opened. It is the default Apple Event handler for
is initially opened. It is the default Apple Event handler for
kAEOpenApplication,
.QW oapp .
.TP
@@ -110,9 +130,8 @@ proc ::tk::mac::OpenDocument {args} {
If a proc of this name is defined it is the default Apple Event handler for
kAEPrintDocuments,
.QW pdoc ,
the Apple Event sent when your application is asked to print one or more
documents (e.g., via the Print menu item in the Finder). It works the same
way as \fBtk::mac::OpenDocument\fR in terms of arguments.
the Apple Event sent when your application is asked to print a
document. It takes a single absolute file path as an argument.
.TP
\fB::tk::mac::Quit\fR
.
@@ -141,7 +160,57 @@ Customizes behavior of Apple Help menu; if this procedure is not defined, the
platform-specific standard Help menu item
.QW "YourApp Help"
performs the default Cocoa action of showing the Help Book configured in the
application's Info.plist (or displaying an alert if no Help Book is set).
application's Info.plist (or displaying an alert if no Help Book is
set).
.TP
\fB::tk::mac::PerformService\fR
.
Executes a Tcl procedure called from the macOS
.QW Services
menu in the Application menu item. The
.QW Services
menu item allows for inter-application communication; data from one
application, such as selected text, can be sent to another application
for processing, for example to Safari as a search item for Google, or
to TextEdit to be appended to a file. An example of the proc is below,
and should be rewritten in an application script for customization:
.RS
.PP
.CS
proc ::tk::mac::PerformService {} {
set data [clipboard get]
$w insert end $data
}
.CE
.RE
Note that the mechanism for retrieving the data is from the clipboard;
there is no other supported way to obtain the data. If the Services
process is not desired, the NSServices keys can be deleted from
the application's Info.plist file. The underlying code supporting this
command also allows the text, entry and ttk::entry widgets to access
services from other applications via the Services menu. The NSPortName
key in Wish's Info.plist file is currently set as
.QW "Wish"
; if a developer changes the name of the Wish executable to something
else, this key should be modified with the same name.
.TP
\fB::tk::mac::LaunchURL \fIURL...\fR
.
If defined, launches a URL within Tk. This would be used if a Tk
application wants to handle a URL itself, such as displaying data from
an RSS feed, rather than launching a default application to handle the
URL, although it can defined as such. Wish includes a stub URL scheme
of
.QW foo://
in the CFBundleURLSchemes key of its Info.plist file; this should be customized for the specific URL
scheme the developer wants to support.
.TP
\fB::tk::mac::GetAppPath\fR
.
Returns the current applications's file path.
.TP
.SH "ADDITIONAL DIALOGS"
.PP
The Aqua/Mac OS X defines additional dialogs that applications should
@@ -149,11 +218,17 @@ support.
.TP
\fB::tk::mac::standardAboutPanel\fR
.
Brings the standard Cocoa about panel to the front, with all its information
filled in from your application bundle files (standard about panel with no
options specified). See Apple Technote TN2179 and the AppKit documentation for
-[NSApplication orderFrontStandardAboutPanelWithOptions:] for details on the
Info.plist keys and app bundle files used by the about panel.
Brings the standard Cocoa about panel to the front with information filled in
from the application bundle files. The panel displays the application icon and
the values associated to the info.plist keys named CFBundleName,
CFBundleShortVersionString, NSAboutPanelOptionVersion and
NSHumanReadableCopyright. If a file named \fICredits.html\fR or
\fICredits.rtf\fR exists in the bundle's Resources directory then its contents
will be displayed in a scrolling text box at the bottom of the dialog. See the
documentation for -[NSApplication orderFrontStandardAboutPanelWithOptions:]
for more details. A hook is also provided for a custom About dialog. If a Tcl
proc named tkAboutDialog is defined in the main interpreter then that
procedure will be called instead of opening the standardAboutPanel.
.SH "SYSTEM CONFIGURATION"
.PP
There are a number of additional global configuration options that control the

View File

@@ -26,7 +26,7 @@ plus other files containing procedures that implement default behaviors
for widgets.
.RS
.PP
The initial value of \fBtcl_library\fR is set when Tk is added to
The initial value of \fBtk_library\fR is set when Tk is added to
an interpreter; this is done by searching several different directories
until one is found that contains an appropriate Tk startup script.
If the \fBTK_LIBRARY\fR environment variable exists, then

View File

@@ -29,7 +29,9 @@ and border.
Specifies a class for the window.
This class will be used when querying the option database for
the window's other options, and it will also be used later for
other purposes such as bindings.
other purposes such as bindings. Some window managers display the
class name for windows in their dock while some others display the
window title.
The \fB\-class\fR option may not be changed with the \fBconfigure\fR
widget command.
.OP \-colormap colormap Colormap
@@ -104,9 +106,9 @@ to configure aspects of the toplevel such as its background color
and relief. The \fBtoplevel\fR command returns the
path name of the new window.
.PP
A toplevel is similar to a frame except that it is created as a
A toplevel is similar to a \fBframe\fR except that it is created as a
top-level window: its X parent is the root window of a screen
rather than the logical parent from its path name. The primary
rather than the logical parent from its Tk path name. The primary
purpose of a toplevel is to serve as a container for dialog boxes
and other collections of widgets. The only visible features
of a toplevel are its background color and an optional 3-D border
@@ -117,21 +119,25 @@ The \fBtoplevel\fR command creates a new Tcl command whose
name is the same as the path name of the toplevel's window. This
command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
\fIpathName option \fR?\fIarg arg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
the toplevel widget's path name. \fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
commands are possible for toplevel widgets:
.TP
\fIpathName \fBcget \fIoption\fR
.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBtoplevel\fR
command.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
@@ -148,8 +154,10 @@ command.
.PP
When a new toplevel is created, it has no default event bindings:
toplevels are not intended to be interactive.
.PP
Be aware that bindings on toplevels may receive events from subwidgets.
.SH "SEE ALSO"
frame(n)
bind(n), bindtags(n), frame(n), wm(n)
.SH KEYWORDS
toplevel, widget
'\" Local Variables:

View File

@@ -66,8 +66,9 @@ Extra padding (in pixels) to add uniformly to each side of a region.
.AP short bottom in
Extra padding (in pixels) to add to the bottom of a region.
.AP Ttk_Box box in
.AP "Ttk_Box *" box_rtn out
Specifies a rectangular region.
.AP "Ttk_Box *" box_rtn out
A rectangular region.
.AP int height in
The height in pixels of a region.
.AP "Tcl_Interp *" interp in
@@ -79,13 +80,14 @@ String value contains a symbolic name
to be converted to an enumerated value or bitmask.
Internal rep may be be modified to cache corresponding value.
.AP Ttk_Padding padding in
.AP "Ttk_Padding *" padding_rtn out
Extra padding to add on the inside of a region.
.AP "Ttk_Padding *" padding_rtn out
Padding present in the inside of a region.
.AP Ttk_Box parcel in
A rectangular region, allocated from a cavity.
.AP int relief in
One of the standard Tk relief options
(TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, etc.).
(\fBTK_RELIEF_RAISED\fR, \fBTK_RELIEF_SUNKEN\fR, etc.).
See \fBTk_GetReliefFromObj\fR.
.AP short right in
Extra padding (in pixels) to add to the right side of a region.
@@ -95,13 +97,13 @@ One of \fBTTK_SIDE_LEFT\fR, \fBTTK_SIDE_TOP\fR,
.AP unsigned sticky in
A bitmask containing one or more of the bits
\fBTTK_STICK_W\fR (west, or left),
\fBTTK_STICK_E\fR (east, or right,
\fBTTK_STICK_E\fR (east, or right),
\fBTTK_STICK_N\fR (north, or top), and
\fBTTK_STICK_S\fR (south, or bottom).
\fBTTK_FILL_X\fR is defined as a synonym for (TTK_STICK_W|TTK_STICK_E),
\fBTTK_FILL_Y\fR is a synonym for (TTK_STICK_N|TTK_STICK_S),
and \fBTTK_FILL_BOTH\fR and \fBTTK_STICK_ALL\fR
are synonyms for (TTK_FILL_X|TTK_FILL_Y).
\fBTTK_FILL_X\fR is defined as a synonym for (\fBTTK_STICK_W\fR|\fBTTK_STICK_E\fR),
\fBTTK_FILL_Y\fR is a synonym for (\fBTTK_STICK_N\fR|\fBTTK_STICK_S\fR),
and \fBTTK_FILL_BOTH\fR
is a synonym for (\fBTTK_FILL_X\fR|\fBTTK_FILL_Y\fR).
See also: \fIgrid(n)\fR.
.AP Tk_Window tkwin in
Window whose screen geometry determines
@@ -212,7 +214,7 @@ See \fBTk_GetPixelsFromObj(3)\fR for the syntax of length specifications.
.PP
\fBTtk_GetBorderFromObj\fR is the same as \fBTtk_GetPaddingFromObj\fR
except that the lengths are specified as integers
(i.e., resolution-dependant values like \fI3m\fR are not allowed).
(i.e., resolution-dependent values like \fI3m\fR are not allowed).
.PP
\fBTtk_GetStickyFromObj\fR converts the string in \fIobjPtr\fR
to a \fIsticky\fR bitmask. The string contains zero or more

View File

@@ -72,6 +72,8 @@ are:
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-foreground\fP \fIcolor\fP

View File

@@ -80,6 +80,8 @@ are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-indicatorbackground\fP \fIcolor\fP

View File

@@ -67,7 +67,9 @@ The following subcommands are possible for combobox widgets:
.TP
\fIpathName \fBcurrent\fR ?\fInewIndex\fR?
If \fInewIndex\fR is supplied, sets the combobox value
to the element at position \fInewIndex\fR in the list of \fB\-values\fR.
to the element at position \fInewIndex\fR in the list of \fB\-values\fR
(in addition to integers, the \fBend\fR index is supported and indicates
the last element of the list).
Otherwise, returns the index of the current value in the list of
\fB\-values\fR or \fB\-1\fR if the current value does not appear in the list.
.TP
@@ -124,6 +126,8 @@ are:
.PP
\fB\-arrowcolor\fP \fIcolor\fP
.br
\fB\-arrowsize\fP \fIamount\fP
.br
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
@@ -138,6 +142,8 @@ are:
.RS
Can only be changed when using non-native and non-graphical themes.
.RE
\fB\-insertcolor\fP \fIcolor\fP
.br
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP

View File

@@ -23,7 +23,9 @@ with the \fB\-textvariable\fR option.
Entry widgets support horizontal scrolling with the
standard \fB\-xscrollcommand\fR option and \fBxview\fR widget command.
.SO ttk_widget
\-class \-cursor \-style
\-class \-cursor
\-font \-foreground
\-style
\-takefocus \-xscrollcommand
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
@@ -34,8 +36,6 @@ If the selection is exported, then selecting in the widget deselects
the current X selection, selecting outside the widget deselects any
widget selection, and the widget will respond to selection retrieval
requests when it has a selection.
.\" MAYBE: .OP \-font font Font
.\" MAYBE: .OP \-foreground foreground Foreground
.\" MAYBE: .OP \-insertbackground insertBackground Foreground
.\" MAYBE: .OP \-insertwidth insertWidth InsertWidth
.OP \-invalidcommand invalidCommand InvalidCommand
@@ -222,52 +222,13 @@ by the \fB\-validate\fR option.
Returns 0 if validation fails, 1 if it succeeds.
Sets or clears the \fBinvalid\fR state accordingly.
See \fBVALIDATION\fR below for more details.
.TP
\fIpathName \fBxview \fIargs\fR
This command is used to query and change the horizontal position of the
text in the widget's window. It can take any of the following
forms:
.RS
.TP
\fIpathName \fBxview\fR
Returns a list containing two elements.
Each element is a real fraction between 0 and 1; together they describe
the horizontal span that is visible in the window.
For example, if the first element is .2 and the second element is .6,
20% of the entry's text is off-screen to the left, the middle 40% is visible
in the window, and 40% of the text is off-screen to the right.
These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
option.
.TP
\fIpathName \fBxview\fR \fIindex\fR
Adjusts the view in the window so that the character given by \fIindex\fR
is displayed at the left edge of the window.
.TP
\fIpathName \fBxview moveto\fI fraction\fR
Adjusts the view in the window so that the character \fIfraction\fR of the
way through the text appears at the left edge of the window.
\fIFraction\fR must be a fraction between 0 and 1.
.TP
\fIpathName \fBxview scroll \fInumber what\fR
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
'\" or an abbreviation of one of these, but we don't document that.
If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
\fInumber\fR average-width characters on the display; if it is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then characters farther to the left
become visible; if it is positive then characters farther to the right
become visible.
.RE
.PP
The entry widget also supports the following generic \fBttk::widget\fR
widget subcommands (see \fIttk::widget(n)\fR for details):
.DS
.ta 5.5c 11c
\fBcget\fR \fBconfigure\fR \fBidentify\fR
\fBinstate\fR \fBstate\fR
\fBinstate\fR \fBstate\fR \fBxview\fR
.DE
.SH VALIDATION
.PP
@@ -392,9 +353,10 @@ insert cursor in the entry without affecting the selection.
If any normal printing characters are typed in an entry, they are
inserted at the point of the insert cursor.
.IP \0\(bu 4
The view in the entry can be adjusted by dragging with mouse button 2.
If mouse button 2 is clicked without moving the mouse, the selection
is copied into the entry at the position of the mouse cursor.
The view in the entry can be adjusted by dragging with the middle
mouse button (button 2, or button 3 in TkAqua). If the middle mouse
button is clicked without moving the mouse, the selection is copied
into the entry at the position of the mouse cursor.
.IP \0\(bu 4
If the mouse is dragged out of the entry on the left or right sides
while button 1 is pressed, the entry will automatically scroll to
@@ -472,7 +434,9 @@ are:
.PP
\fB\-background\fP \fIcolor\fP
.RS
When using the aqua theme (Mac OS X), changes the \fB\-fieldbackground\fP.
For backwards compatibility, when using the aqua theme (for macOS), this
option behaves as an alias for the \fB\-fieldbackground\fP provided that no
value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored.
.RE
\fB\-bordercolor\fP \fIcolor\fP
.br
@@ -480,12 +444,12 @@ When using the aqua theme (Mac OS X), changes the \fB\-fieldbackground\fP.
.br
\fB\-fieldbackground\fP \fIcolor\fP
.RS
Does not work with the aqua theme (Mac OS X).
.br
Some themes use a graphical background and their field background colors cannot be changed.
.RE
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-insertcolor\fP \fIcolor\fP
.br
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP

View File

@@ -23,6 +23,7 @@ together.
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-borderwidth borderWidth BorderWidth
The desired width of the widget border. Defaults to 0.
May be ignored depending on the theme used.
.OP \-relief relief Relief
One of the standard Tk border styles:
\fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR,
@@ -53,11 +54,17 @@ The class name for a \fBttk::frame\fP is \fBTFrame\fP.
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-relief\fP \fIrelief\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH BINDINGS
.PP
When a new \fBttk::frame\fR is created, it has no default event bindings;
\fBttk::frame\fRs are not intended to be interactive.
.SH "SEE ALSO"
ttk::widget(n), ttk::labelframe(n), frame(n)
.SH "KEYWORDS"

View File

@@ -13,7 +13,7 @@ ttk::intro \- Introduction to the Tk theme engine
.SH "OVERVIEW"
.PP
The Tk themed widget set is based on a revised and enhanced version
of TIP #48 (http://tip.tcl.tk/48) specified style engine.
of TIP #48 (https://tip.tcl-lang.org/48) specified style engine.
The main concepts are described below.
The basic idea is to separate, to the extent possible,
the code implementing a widget's behavior from
@@ -60,7 +60,7 @@ For example, the \fBtext\fR element
(which displays a text string) has
\fB\-text\fR, \fB\-font\fR, \fB\-foreground\fR, \fB\-background\fR,
\fB\-underline\fR, and \fB\-width\fR options.
The value of an element option is taken from:
The value of an element option is taken from (in precedence order):
.IP \(bu
an option of the same name and type in the widget containing the element;
.IP \(bu
@@ -86,7 +86,7 @@ ttk::\fBstyle layout\fR Horizontal.TScrollbar {
Scrollbar.trough \-children {
Scrollbar.leftarrow \-side left \-sticky w
Scrollbar.rightarrow \-side right \-sticky e
Scrollbar.thumb \-side left \-expand true \-sticky ew
Scrollbar.thumb \-sticky ew
}
}
.CE

View File

@@ -49,9 +49,6 @@ Specifies the 3-D effect desired for the widget border.
Valid values are
\fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR, \fBsolid\fR,
and \fBsunken\fR.
.OP \-text text Text
Specifies a text string to be displayed inside the widget
(unless overridden by \fB\-textvariable\fR).
.OP \-wraplength wrapLength WrapLength
Specifies the maximum line length (in pixels).
If this option is less than or equal to zero,
@@ -74,6 +71,8 @@ are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-font\fP \fIfont\fP

View File

@@ -30,6 +30,10 @@ another widget.
.\" XXX: \fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR,
.\" XXX: \fBsolid\fR, or \fBsunken\fR.
.\" XXX: Default is theme-dependent.
.OP \-height height Height
If specified, the widget's requested height in pixels.
(See \fIttk::frame(n)\fR for further notes on \fB\-width\fR and
\fB\-height\fR).
.OP \-labelanchor labelAnchor LabelAnchor
Specifies where to place the label.
Allowed values are (clockwise from the top upper left corner):
@@ -40,6 +44,12 @@ The default value is theme-dependent.
.\" and specifies which side the label should be placed on;
.\" the remaining characters specify how the label is aligned on that side.
.\" NOTE: Now allows other values as well; leave this undocumented for now
.OP \-labelwidget labelWidget LabelWidget
The name of a widget to use for the label.
If set, overrides the \fB\-text\fR option.
The \fB\-labelwidget\fR must be a child of the \fBlabelframe\fR widget
or one of the \fBlabelframe\fR's ancestors, and must belong to the
same top-level widget as the \fBlabelframe\fR.
.OP \-text text Text
Specifies the text of the label.
.OP \-underline underline Underline
@@ -48,18 +58,8 @@ underline in the text string.
The underlined character is used for mnemonic activation.
Mnemonic activation for a \fBttk::labelframe\fR
sets the keyboard focus to the first child of the \fBttk::labelframe\fR widget.
.OP \-labelwidget labelWidget LabelWidget
The name of a widget to use for the label.
If set, overrides the \fB\-text\fR option.
The \fB\-labelwidget\fR must be a child of the \fBlabelframe\fR widget
or one of the \fBlabelframe\fR's ancestors, and must belong to the
same top-level widget as the \fBlabelframe\fR.
.OP \-width width Width
If specified, the widget's requested width in pixels.
.OP \-height height Height
If specified, the widget's requested height in pixels.
(See \fIttk::frame(n)\fR for further notes on \fB\-width\fR and
\fB\-height\fR).
.SH "WIDGET COMMAND"
.PP
Supports the standard widget commands

View File

@@ -58,6 +58,8 @@ are:
.br
\fB\-background\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-font\fP \fIfont\fP

View File

@@ -20,7 +20,7 @@ ttk::notebook \- Multi-paned container widget
.SH DESCRIPTION
A \fBttk::notebook\fR widget manages a collection of windows
and displays a single one at a time.
Each slave window is associated with a \fItab\fR,
Each content window is associated with a \fItab\fR,
which the user may select to change the currently-displayed window.
.SO ttk_widget
\-class \-cursor \-takefocus
@@ -56,11 +56,11 @@ Either \fBnormal\fR, \fBdisabled\fR or \fBhidden\fR.
If \fBdisabled\fR, then the tab is not selectable.
If \fBhidden\fR, then the tab is not shown.
.OP \-sticky sticky Sticky
Specifies how the slave window is positioned within the pane area.
Specifies how the content window is positioned within the pane area.
Value is a string containing zero or more of the characters
\fBn, s, e,\fR or \fBw\fR.
Each letter refers to a side (north, south, east, or west)
that the slave window will
that the content window will
.QW stick
to, as per the \fBgrid\fR geometry manager.
.OP \-padding padding Padding
@@ -86,7 +86,7 @@ any of the following forms:
.IP \(bu
An integer between zero and the number of tabs;
.IP \(bu
The name of a slave window;
The name of a content window;
.IP \(bu
A positional specification of the form
.QW @\fIx\fR,\fIy\fR ,
@@ -156,7 +156,7 @@ See \fIttk::widget(n)\fR.
.TP
\fIpathname \fBselect\fR ?\fItabid\fR?
Selects the specified tab.
The associated slave window will be displayed,
The associated content window will be displayed,
and the previously-selected window (if different) is unmapped.
If \fItabid\fR is omitted, returns the widget name of the
currently selected pane.
@@ -242,6 +242,8 @@ are:
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-expand\fP \fIpadding\fP
.RS
Defines how much the tab grows in size. Usually used with the

View File

@@ -49,9 +49,11 @@ In \fIindeterminate\fR mode, it is interpreted modulo \fB\-maximum\fR;
that is, the progress bar completes one
.QW cycle
when the \fB\-value\fR increases by \fB\-maximum\fR.
If \fB\-variable\fR is set to an existing variable, specifying \fB\-value\fR
has no effect (the variable value takes precedence).
.OP \-variable variable Variable
The name of a global Tcl variable which is linked to the \fB\-value\fR.
If specified, the \fB\-value\fR of the progress bar is
If specified to an existing variable, the \fB\-value\fR of the progress bar is
automatically set to the value of the variable whenever
the latter is modified.
.SH "WIDGET COMMAND"

View File

@@ -77,6 +77,8 @@ are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-indicatorbackground\fP \fIcolor\fP

View File

@@ -42,6 +42,8 @@ Specifies a real value corresponding to the right or bottom end of the scale.
This value may be either less than or greater than the \fB\-from\fR option.
.OP \-value value Value
Specifies the current floating-point value of the variable.
If \fB\-variable\fR is set to an existing variable, specifying \fB\-value\fR
has no effect (the variable value takes precedence).
.OP \-variable variable Variable
Specifies the name of a global variable to link to the scale. Whenever the
value of the variable changes, the scale will update to reflect this value.
@@ -93,11 +95,11 @@ corresponding to the current value of the \fB\-value\fR option if \fIvalue\fR
is omitted.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::scale\fP is \fBTProgressbar\fP.
The class name for a \fBttk::scale\fP is \fBTScale\fP.
.PP
Dynamic states: \fBactive\fP.
.PP
\fBTProgressbar\fP styling options configurable with \fBttk::style\fP
\fBTScale\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP

View File

@@ -76,7 +76,7 @@ Modify or query the widget state; see \fIttk::widget(n)\fR.
.SH "INTERNAL COMMANDS"
.PP
The following widget commands are used internally
by the TScrollbar widget class bindings.
by the \fBTScrollbar\fP widget class bindings.
.TP
\fIpathName \fBdelta \fIdeltaX deltaY\fR
Returns a real number indicating the fractional change in
@@ -153,6 +153,7 @@ grid $f.vsb \-row 0 \-column 1 \-sticky nsew
grid $f.hsb \-row 1 \-column 0 \-sticky nsew
grid columnconfigure $f 0 \-weight 1
grid rowconfigure $f 0 \-weight 1
pack $f
.CE
.SH "STYLING OPTIONS"
.PP
@@ -160,20 +161,25 @@ The class name for a \fBttk::scrollbar\fP is \fBTScrollbar\fP.
.PP
Dynamic states: \fBactive\fP, \fBdisabled\fP.
.PP
\fBTScrollbar\fP styling options configurable with \fBttk::style\fP
are:
\fBTScrollbar\fP (or more specifically \fBVertical.TScrollbar\fP and
\fBHorizontal.TScrollbar\fP) styling options that are configurable with
\fBttk::style\fP are:
.PP
\fB\-arrowcolor\fP \fIcolor\fP
.br
\fB\-arrowsize\fP \fIamount\fP
.br
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
\fB\-darkcolor\fP \fIcolor\fP (color of the dark part of the 3D relief)
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
\fB\-gripcount\fP \fIcount\fP (number of lines on the thumb)
.br
\fB\-lightcolor\fP \fIcolor\fP (color of the light part of the 3D relief)
.br
\fB\-troughcolor\fP \fIcolor\fP
.PP

View File

@@ -95,18 +95,22 @@ are:
.br
\fB\-background\fP \fIcolor\fP
.RS
When using the aqua theme (Mac OS X), changes the \fB\-fieldbackground\fP.
For backwards compatibility, when using the aqua theme (for macOS), this
option behaves as an alias for the \fB\-fieldbackground\fP provided that no
value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored.
.RE
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-fieldbackground\fP \fIcolor\fP
.RS
Does not work with the aqua theme (Mac OS X).
.RE
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-insertcolor\fP \fIcolor\fP
.br
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP

View File

@@ -15,7 +15,7 @@ ttk::style \- Manipulate style database
.SH NOTES
.PP
See also the Tcl'2004 conference presentation,
available at http://tktable.sourceforge.net/tile/tile-tcl2004.pdf
available at https://tktable.sourceforge.net/tile/tile-tcl2004.pdf
.SH DEFINITIONS
.PP
Each widget is assigned a \fIstyle\fR,
@@ -34,28 +34,8 @@ The \fBttk::style\fR command takes the following arguments:
\fBttk::style configure \fIstyle\fR ?\fI\-option\fR ?\fIvalue option value...\fR? ?
Sets the default value of the specified option(s) in \fIstyle\fR.
.TP
\fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR?
Sets dynamic values of the specified option(s) in \fIstyle\fR.
Each \fIstatespec / value\fR pair is examined in order;
the value corresponding to the first matching \fIstatespec\fR
is used.
.TP
\fBttk::style lookup \fIstyle\fR \fI\-option \fR?\fIstate \fR?\fIdefault\fR??
Returns the value specified for \fI\-option\fR in style \fIstyle\fR
in state \fIstate\fR, using the standard lookup rules for element options.
\fIstate\fR is a list of state names; if omitted,
it defaults to all bits off (the
.QW normal
state).
If the \fIdefault\fR argument is present, it is used as a fallback
value in case no specification for \fI\-option\fR is found.
.\" Otherwise -- signal error? return empty string? Leave unspecified for now.
.TP
\fBttk::style layout \fIstyle\fR ?\fIlayoutSpec\fR?
Define the widget layout for style \fIstyle\fR.
See \fBLAYOUTS\fR below for the format of \fIlayoutSpec\fR.
If \fIlayoutSpec\fR is omitted, return the layout specification
for style \fIstyle\fR.
\fBttk::style element\fR \fIargs\fR
.RS
.TP
\fBttk::style element create\fR \fIelementName\fR \fItype\fR ?\fIargs...\fR?
Creates a new element in the current theme of type \fItype\fR.
@@ -70,6 +50,33 @@ Returns the list of elements defined in the current theme.
.TP
\fBttk::style element options \fIelement\fR
Returns the list of \fIelement\fR's options.
.RE
.TP
\fBttk::style layout \fIstyle\fR ?\fIlayoutSpec\fR?
Define the widget layout for style \fIstyle\fR.
See \fBLAYOUTS\fR below for the format of \fIlayoutSpec\fR.
If \fIlayoutSpec\fR is omitted, return the layout specification
for style \fIstyle\fR.
.TP
\fBttk::style lookup \fIstyle\fR \fI\-option \fR?\fIstate \fR?\fIdefault\fR??
Returns the value specified for \fI\-option\fR in style \fIstyle\fR
in state \fIstate\fR, using the standard lookup rules for element options.
\fIstate\fR is a list of state names; if omitted,
it defaults to all bits off (the
.QW normal
state).
If the \fIdefault\fR argument is present, it is used as a fallback
value in case no specification for \fI\-option\fR is found.
.\" Otherwise -- signal error? return empty string? Leave unspecified for now.
.TP
\fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR?
Sets dynamic values of the specified option(s) in \fIstyle\fR.
Each \fIstatespec / value\fR pair is examined in order;
the value corresponding to the first matching \fIstatespec\fR
is used.
.TP
\fBttk::style theme\fR \fIargs\fR
.RS
.TP
\fBttk::style theme create\fR \fIthemeName\fR ?\fB\-parent \fIbasedon\fR? ?\fB\-settings \fIscript...\fR ?
Creates a new theme. It is an error if \fIthemeName\fR already exists.
@@ -78,19 +85,20 @@ styles, elements, and layouts from the parent theme \fIbasedon\fR.
If \fB\-settings\fR is present, \fIscript\fR is evaluated in the
context of the new theme as per \fBttk::style theme settings\fR.
.TP
\fBttk::style theme names\fR
Returns a list of all known themes.
.TP
\fBttk::style theme settings \fIthemeName\fR \fIscript\fR
Temporarily sets the current theme to \fIthemeName\fR,
evaluate \fIscript\fR, then restore the previous theme.
Typically \fIscript\fR simply defines styles and elements,
though arbitrary Tcl code may appear.
.TP
\fBttk::style theme names\fR
Returns a list of all known themes.
.TP
\fBttk::style theme use\fR ?\fIthemeName\fR?
Without an argument the result is the name of the current theme.
Otherwise this command sets the current theme to \fIthemeName\fR,
and refreshes all widgets.
.RE
.SH LAYOUTS
.PP
A \fIlayout\fR specifies a list of elements, each followed
@@ -98,19 +106,40 @@ by one or more options specifying how to arrange the element.
The layout mechanism uses a simplified version of the \fBpack\fR
geometry manager: given an initial cavity,
each element is allocated a parcel.
Then the parcel actually used by the element is adjusted within
the allocated parcel.
Valid options are:
.\" -border should remain undocumented for now (dubious usefulness)
.\" .TP
.\" \fB\-border\fR \fIboolean\fR
.\" Specifies whether the element is drawn after its children. Defaults to 0.
.TP
\fB\-children { \fIsublayout...\fB }\fR
Specifies a list of elements to place inside the element.
.TP
\fB\-expand\fR \fIboolean\fR
Specifies whether the allocated parcel is the entire cavity. If so,
simultaneous specification of \fB\-side\fR is ignored.
Defaults to 0.
.TP
\fB\-side \fIside\fR
Specifies which side of the cavity to place the element;
one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
If omitted, the element occupies the entire cavity.
For instance, \fB\-side top\fR allocates the parcel along the top of
the cavity having width and height respectively the width of the cavity
and the height of the element.
If omitted, the allocated parcel is the entire cavity (same effect
as \fB\-expand\fR 1).
.TP
\fB\-sticky\fR \fB[\fInswe\fB]\fR
Specifies where the element is placed inside its allocated parcel.
.TP
\fB\-children { \fIsublayout... \fB}\fR
Specifies a list of elements to place inside the element.
.\" Also: -border, -unit, -expand: may go away.
Specifies the actual parcel position and size inside the allocated parcel.
If specified as an empty string then the actual parcel is centered in
the allocated parcel. Default is \fBnswe\fR.
.\" -unit should remain undocumented for now (dubious usefulness)
.\" .TP
.\" \fB\-unit\fR \fIboolean\fR
.\" Specifies whether the element propagates its state to its children.
.\" Defaults to 0.
.PP
For example:
.CS

View File

@@ -133,25 +133,29 @@ The column name. This is a read-only option.
For example, [\fI$pathname \fBcolumn #\fIn \fB\-id\fR]
returns the data column associated with display column #\fIn\fR.
.TP
\fB\-anchor\fR
\fB\-anchor \fIanchor\fR
Specifies how the text in this column should be aligned
with respect to the cell. One of
with respect to the cell. \fIAnchor\fR is one of
\fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR,
\fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR.
.TP
\fB\-minwidth\fR
\fB\-minwidth \fIminwidth\fR
The minimum width of the column in pixels.
The treeview widget will not make the column any smaller than
\fB\-minwidth\fR when the widget is resized or the user drags a
column separator. Default is 20 pixels.
.TP
\fB\-stretch \fIboolean\fR
Specifies whether or not the column width should be adjusted
when the widget is resized or the user drags a column separator.
\fIBoolean\fR may have any of the forms accepted by \fBTcl_GetBoolean\fR.
By default columns are stretchable.
.TP
\fB\-width \fIwidth\fR
The width of the column in pixels. Default is 200 pixels. The specified
column width may be changed by Tk in order to honor \fB\-stretch\fR
and/or \fB\-minwidth\fR, or when the widget is resized or the user drags a
column separator.
.TP
\fB\-stretch\fR
Specifies whether or not the column's width should be adjusted
when the widget is resized.
.TP
\fB\-width \fIw\fR
The width of the column in pixels. Default is something reasonable,
probably 200 or so.
.PP
Use \fIpathname column #0\fR to configure the tree column.
.RE
@@ -231,7 +235,7 @@ A data cell.
Returns the item ID of the item at position \fIy\fR.
.TP
\fIpathname \fBidentify column \fIx y\fR
Returns the data column identifier of the cell at position \fIx\fR.
Returns the display column identifier of the cell at position \fIx\fR.
The tree column has ID \fB#0\fR.
.TP
\fIpathname \fBidentify element \fIx y\fR
@@ -388,12 +392,13 @@ If \fIitems\fR is omitted, removes \fItag\fR from each item in the tree.
If \fItag\fR is not present for a particular item,
then the \fB\-tags\fR for that item are unchanged.
.RE
.TP
\fIpathName \fBxview \fIargs\fR
Standard command for horizontal scrolling; see \fIwidget(n)\fR.
.TP
\fIpathName \fByview \fIargs\fR
Standard command for vertical scrolling; see \fIttk::widget(n)\fR.
.PP
The treeview widget also supports the following generic \fBttk::widget\fR
widget subcommands (see \fIttk::widget(n)\fR for details):
.DS
.ta 5.5c 11c
\fBxview\fR \fByview\fR
.DE
.SH "ITEM OPTIONS"
.PP
The following item options may be specified for items
@@ -434,6 +439,9 @@ Specifies the font to use when drawing text.
Specifies the item image, in case the item's \fB\-image\fR option is empty.
.\" .PP
.\" \fI(@@@ TODO: sort out order of precedence for options)\fR
.PP
Tag priority is decided by the creation order: tags created first receive
higher priority.
.SH "COLUMN IDENTIFIERS"
.PP
Column identifiers take any of the following forms:

View File

@@ -74,6 +74,9 @@ and other button-like widgets:
.OP \-compound compound Compound
Specifies how to display the image relative to the text,
in the case both \fB\-text\fR and \fB\-image\fR are present.
If set to the empty string (the default), the rules described in the
"Elements" section of \fIttk::intro(n)\fR explain which value is actually
used.
Valid values are:
.RS
.IP text
@@ -88,8 +91,13 @@ Display text centered on top of image.
.IP right
Display image above, below, left of, or right of the text, respectively.
.IP none
The default; display the image if present, otherwise the text.
Display the image if present, otherwise the text.
.RE
.OP \-font font Font
Font to use for the text displayed by the widget.
.OP \-foreground textColor TextColor
The widget's foreground color.
If unspecified, the theme default is used.
.OP \-image image Image
Specifies an image to display.
This is a list of 1 or more elements.
@@ -192,6 +200,84 @@ will restore \fIpathName\fR to the original state.
If \fIstateSpec\fR is not specified,
returns a list of the currently-enabled state flags.
.RE
.TP
\fIpathName \fBxview \fIargs\fR
This command is used to query and change the horizontal position of the
content in the widget's window. It can take any of the following
forms:
.RS
.TP
\fIpathName \fBxview\fR
Returns a list containing two elements.
Each element is a real fraction between 0 and 1; together they describe
the horizontal span that is visible in the window.
For example, if the first element is .2 and the second element is .6,
20% of the widget's content is off-screen to the left, the middle 40% is visible
in the window, and 40% of the content is off-screen to the right.
These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
option.
.TP
\fIpathName \fBxview\fR \fIindex\fR
Adjusts the view in the window so that the content given by \fIindex\fR
is displayed at the left edge of the window.
.TP
\fIpathName \fBxview moveto\fI fraction\fR
Adjusts the view in the window so that the character \fIfraction\fR of the
way through the content appears at the left edge of the window.
\fIFraction\fR must be a fraction between 0 and 1.
.TP
\fIpathName \fBxview scroll \fInumber what\fR
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
'\" or an abbreviation of one of these, but we don't document that.
If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
\fInumber\fR average-width characters on the display; if it is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then characters farther to the left
become visible; if it is positive then characters farther to the right
become visible.
.RE
.TP
\fIpathName \fByview \fIargs\fR
This command is used to query and change the vertical position of the
content in the widget's window. It can take any of the following
forms:
.RS
.TP
\fIpathName \fByview\fR
Returns a list containing two elements.
Each element is a real fraction between 0 and 1; together they describe
the vertical span that is visible in the window.
For example, if the first element is .2 and the second element is .6,
20% of the widget's content is off-screen to the top, the middle 40% is visible
in the window, and 40% of the content is off-screen to the bottom.
These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR
option.
.TP
\fIpathName \fByview\fR \fIindex\fR
Adjusts the view in the window so that the content given by \fIindex\fR
is displayed at the top edge of the window.
.TP
\fIpathName \fByview moveto\fI fraction\fR
Adjusts the view in the window so that the item \fIfraction\fR of the
way through the content appears at the top edge of the window.
\fIFraction\fR must be a fraction between 0 and 1.
.TP
\fIpathName \fByview scroll \fInumber what\fR
This command shifts the view in the window up or down according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
'\" or an abbreviation of one of these, but we don't document that.
If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
\fInumber\fR average-width characters on the display; if it is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then items farther to the top
become visible; if it is positive then items farther to the bottom
become visible.
.RE
.SH "WIDGET STATES"
The widget state is a bitmap of independent state flags.
Widget state flags include:

View File

@@ -73,6 +73,9 @@ to the screen containing \fIwindow\fR; otherwise they refer to the
screen of the application's main window.
If no window in this application contains the point then an empty
string is returned.
An empty string is also returned if the point lies in the title bar
or border of its highest containing toplevel in this application.
(Note that with some window managers the borders may be invisible.)
In selecting the containing window, children are given higher priority
than parents and among siblings the highest one in the stacking order is
chosen.

View File

@@ -120,7 +120,7 @@ color with some alpha, e.g.
.PP
On X11, the following attributes may be set. These are not supported by all
window managers, and will have no effect under older WMs.
.\" See http://www.freedesktop.org/Standards/wm-spec
.\" See https://www.freedesktop.org/wiki/Specifications/wm-spec/
.TP
\fB\-type\fR
.VS 8.6
@@ -708,22 +708,23 @@ case the command returns an empty string. If \fIstring\fR is not
specified then the command returns the current title for the
\fIwindow\fR. The title for a window defaults to its name.
.TP
\fBwm transient \fIwindow\fR ?\fImaster\fR?
\fBwm transient \fIwindow\fR ?\fIcontainer\fR?
.
If \fImaster\fR is specified, then the window manager is informed
that \fIwindow\fR is a transient window (e.g. pull-down menu) working
on behalf of \fImaster\fR (where \fImaster\fR is the
path name for a top-level window). If \fImaster\fR
is specified as an empty string then \fIwindow\fR is marked as not
being a transient window any more. Otherwise the command
returns the path name of \fIwindow\fR's current master, or an
empty string if \fIwindow\fR is not currently a transient window.
A transient window will mirror state changes in the master and
inherit the state of the master when initially mapped. It is an
error to attempt to make a window a transient of itself.
The window manager may also decorate a transient window differently, removing
some features normally present (e.g., minimize and maximize buttons) though
this is entirely at the discretion of the window manager.
If \fIcontainer\fR is specified, then the window manager is informed that
\fIwindow\fR is a transient window (e.g. pull-down menu) working on
behalf of \fIcontainer\fR (where \fIcontainer\fR is the path name for a
top-level window). If \fIcontainer\fR is specified as an empty string
then \fIwindow\fR is marked as not being a transient window any more.
Otherwise the command returns the path name of \fIwindow\fR's current
container, or an empty string if \fIwindow\fR is not currently a
transient window. A transient window will mirror state changes in the
container and inherit the state of the container when initially mapped. The
directed graph with an edge from each transient to its container must be
acyclic. In particular, it is an error to attempt to make a window a
transient of itself. The window manager may also decorate a transient
window differently, removing some features normally present (e.g.,
minimize and maximize buttons) though this is entirely at the
discretion of the window manager.
.TP
\fBwm withdraw \fIwindow\fR
.

File diff suppressed because it is too large Load Diff

View File

@@ -472,7 +472,7 @@ declare 116 {
Tk_Window Tk_IdToWindow(Display *display, Window window)
}
declare 117 {
void Tk_ImageChanged(Tk_ImageMaster master, int x, int y,
void Tk_ImageChanged(Tk_ImageMaster model, int x, int y,
int width, int height, int imageWidth, int imageHeight)
}
declare 118 {
@@ -486,8 +486,8 @@ declare 120 {
int width, int height)
}
declare 121 {
void Tk_MaintainGeometry(Tk_Window slave,
Tk_Window master, int x, int y, int width, int height)
void Tk_MaintainGeometry(Tk_Window window,
Tk_Window container, int x, int y, int width, int height)
}
declare 122 {
Tk_Window Tk_MainWindow(Tcl_Interp *interp)
@@ -539,7 +539,7 @@ declare 136 {
CONST84_RETURN char *Tk_NameOfFont(Tk_Font font)
}
declare 137 {
CONST84_RETURN char *Tk_NameOfImage(Tk_ImageMaster imageMaster)
CONST84_RETURN char *Tk_NameOfImage(Tk_ImageMaster model)
}
declare 138 {
CONST84_RETURN char *Tk_NameOfJoinStyle(int join)
@@ -692,7 +692,7 @@ declare 180 {
void Tk_Ungrab(Tk_Window tkwin)
}
declare 181 {
void Tk_UnmaintainGeometry(Tk_Window slave, Tk_Window master)
void Tk_UnmaintainGeometry(Tk_Window window, Tk_Window container)
}
declare 182 {
void Tk_UnmapWindow(Tk_Window tkwin)
@@ -1068,6 +1068,9 @@ declare 272 {
declare 273 {
void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat *formatPtr)
}
declare 280 {
void TkUnusedStubEntry(void)
}
# Define the platform specific public Tk interface. These functions are
# only available on the designated platform.
@@ -1139,6 +1142,20 @@ declare 9 aqua {
declare 10 aqua {
int Tk_MacOSXIsAppInFront(void)
}
declare 11 aqua {
Tk_Window Tk_MacOSXGetTkWindow(void *w)
}
declare 12 aqua {
void *Tk_MacOSXGetCGContextForDrawable(Drawable drawable)
}
# Replaces TkMacOSXDrawable
declare 13 aqua {
void *Tk_MacOSXGetNSWindowForDrawable(Drawable drawable)
}
declare 16 aqua {
void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width,
int height, int flags)
}
##############################################################################

View File

@@ -75,10 +75,10 @@ extern "C" {
#define TK_MAJOR_VERSION 8
#define TK_MINOR_VERSION 6
#define TK_RELEASE_LEVEL TCL_FINAL_RELEASE
#define TK_RELEASE_SERIAL 9
#define TK_RELEASE_SERIAL 12
#define TK_VERSION "8.6"
#define TK_PATCH_LEVEL "8.6.9"
#define TK_PATCH_LEVEL "8.6.12"
/*
* A special definition used to allow this header file to be included from
@@ -92,13 +92,17 @@ extern "C" {
#ifndef RC_INVOKED
#ifndef _XLIB_H
#if !defined(_XLIB_H) && !defined(_X11_XLIB_H_)
#if defined(__GNUC__) && !defined(__cplusplus)
# pragma GCC diagnostic ignored "-Wc++-compat"
#endif
# include <X11/Xlib.h>
# ifdef MAC_OSX_TK
# include <X11/X.h>
# endif
#endif
#ifdef __STDC__
#if defined(STDC_HEADERS) || defined(__STDC__) || defined(__C99__FUNC__) \
|| defined(__cplusplus) || defined(_MSC_VER) || defined(__ICC)
# include <stddef.h>
#endif
@@ -121,6 +125,7 @@ extern "C" {
* Dummy types that are used by clients:
*/
#define Tk_ImageModel Tk_ImageMaster
typedef struct Tk_BindingTable_ *Tk_BindingTable;
typedef struct Tk_Canvas_ *Tk_Canvas;
typedef struct Tk_Cursor_ *Tk_Cursor;
@@ -266,10 +271,10 @@ typedef struct Tk_ObjCustomOption {
* Computes number of bytes from beginning of structure to a given field.
*/
#ifdef offsetof
#define Tk_Offset(type, field) ((int) offsetof(type, field))
#else
#define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field))
/* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */
#ifndef offsetof
# define offsetof(type, field) ((size_t) ((char *) &((type *) 0)->field))
#endif
/*
@@ -613,21 +618,22 @@ typedef struct Tk_ClassProcs {
* the geometry manager to carry out certain functions.
*/
#define Tk_GeomLostContentProc Tk_GeomLostSlaveProc
typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin);
typedef void (Tk_GeomLostSlaveProc) (ClientData clientData, Tk_Window tkwin);
typedef void (Tk_GeomLostContentProc) (ClientData clientData, Tk_Window tkwin);
typedef struct Tk_GeomMgr {
const char *name; /* Name of the geometry manager (command used
* to invoke it, or name of widget class that
* allows embedded widgets). */
Tk_GeomRequestProc *requestProc;
/* Procedure to invoke when a slave's
/* Procedure to invoke when a content's
* requested geometry changes. */
Tk_GeomLostSlaveProc *lostSlaveProc;
/* Procedure to invoke when a slave is taken
Tk_GeomLostContentProc *lostSlaveProc;
/* Procedure to invoke when content is taken
* away from one geometry manager by another.
* NULL means geometry manager doesn't care
* when slaves are lost. */
* when content lost. */
} Tk_GeomMgr;
/*
@@ -676,7 +682,7 @@ typedef struct {
* request. */
Display *display; /* Display the event was read from. */
Window event; /* Window on which event was requested. */
Window root; /* Root window that the event occured on. */
Window root; /* Root window that the event occurred on. */
Window subwindow; /* Child window. */
Time time; /* Milliseconds. */
int x, y; /* Pointer x, y coordinates in event
@@ -813,10 +819,11 @@ typedef struct Tk_FakeWin {
int internalBorderBottom;
int minReqWidth;
int minReqHeight;
char *dummy20; /* geometryMaster */
#ifdef TK_USE_INPUT_METHODS
int dummy21;
int dummy20;
#endif /* TK_USE_INPUT_METHODS */
char *dummy21; /* geomMgrName */
Tk_Window dummy22; /* maintainerPtr */
} Tk_FakeWin;
/*
@@ -882,6 +889,10 @@ typedef struct Tk_FakeWin {
* window.
* TK_WM_MANAGEABLE 1 marks a window as capable of being converted
* into a toplevel using [wm manage].
* TK_CAN_INPUT_TEXT 1 means that this window accepts text input.
* Used on macOS to indicate that key events can be
* processed with the NSTextInputClient protocol.
* Not currently accessible through the public API.
*/
#define TK_MAPPED 1
@@ -895,6 +906,7 @@ typedef struct Tk_FakeWin {
#define TK_EMBEDDED 0x100
#define TK_CONTAINER 0x200
#define TK_BOTH_HALVES 0x400
#define TK_WRAPPER 0x1000
#define TK_REPARENTED 0x2000
#define TK_ANONYMOUS_WINDOW 0x4000
@@ -903,6 +915,7 @@ typedef struct Tk_FakeWin {
#define TK_TOP_HIERARCHY 0x20000
#define TK_PROP_PROPCHANGE 0x40000
#define TK_WM_MANAGEABLE 0x80000
#define TK_CAN_INPUT_TEXT 0x100000
/*
*----------------------------------------------------------------------
@@ -1220,19 +1233,19 @@ typedef struct Tk_Outline {
typedef struct Tk_ImageType Tk_ImageType;
#ifdef USE_OLD_IMAGE
typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc,
char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master,
ClientData *masterDataPtr);
char **argv, Tk_ImageType *typePtr, Tk_ImageMaster model,
ClientData *clientDataPtr);
#else
typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, CONST86 char *name, int objc,
Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster master,
ClientData *masterDataPtr);
Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster model,
ClientData *clientDataPtr);
#endif /* USE_OLD_IMAGE */
typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData);
typedef void (Tk_ImageDisplayProc) (ClientData instanceData, Display *display,
typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData clientData);
typedef void (Tk_ImageDisplayProc) (ClientData clientData, Display *display,
Drawable drawable, int imageX, int imageY, int width, int height,
int drawableX, int drawableY);
typedef void (Tk_ImageFreeProc) (ClientData instanceData, Display *display);
typedef void (Tk_ImageDeleteProc) (ClientData masterData);
typedef void (Tk_ImageFreeProc) (ClientData clientData, Display *display);
typedef void (Tk_ImageDeleteProc) (ClientData clientData);
typedef void (Tk_ImageChangedProc) (ClientData clientData, int x, int y,
int width, int height, int imageWidth, int imageHeight);
typedef int (Tk_ImagePostscriptProc) (ClientData clientData,

View File

@@ -90,7 +90,7 @@ Tk_Alloc3DBorderFromObj(
if (objPtr->typePtr != &tkBorderObjType) {
InitBorderObj(objPtr);
}
borderPtr = objPtr->internalRep.twoPtrValue.ptr1;
borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1;
/*
* If the object currently points to a TkBorder, see if it's the one we
@@ -127,7 +127,7 @@ Tk_Alloc3DBorderFromObj(
*/
if (borderPtr != NULL) {
TkBorder *firstBorderPtr = Tcl_GetHashValue(borderPtr->hashPtr);
TkBorder *firstBorderPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr);
FreeBorderObj(objPtr);
for (borderPtr = firstBorderPtr ; borderPtr != NULL;
@@ -200,7 +200,7 @@ Tk_Get3DBorder(
hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &isNew);
if (!isNew) {
existingBorderPtr = Tcl_GetHashValue(hashPtr);
existingBorderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr);
for (borderPtr = existingBorderPtr; borderPtr != NULL;
borderPtr = borderPtr->nextPtr) {
if ((Tk_Screen(tkwin) == borderPtr->screen)
@@ -236,9 +236,9 @@ Tk_Get3DBorder(
borderPtr->darkColorPtr = NULL;
borderPtr->lightColorPtr = NULL;
borderPtr->shadow = None;
borderPtr->bgGC = None;
borderPtr->darkGC = None;
borderPtr->lightGC = None;
borderPtr->bgGC = NULL;
borderPtr->darkGC = NULL;
borderPtr->lightGC = NULL;
borderPtr->hashPtr = hashPtr;
borderPtr->nextPtr = existingBorderPtr;
Tcl_SetHashValue(hashPtr, borderPtr);
@@ -374,7 +374,7 @@ Tk_3DBorderGC(
{
TkBorder * borderPtr = (TkBorder *) border;
if ((borderPtr->lightGC == None) && (which != TK_3D_FLAT_GC)) {
if ((borderPtr->lightGC == NULL) && (which != TK_3D_FLAT_GC)) {
TkpGetShadows(borderPtr, tkwin);
}
if (which == TK_3D_FLAT_GC) {
@@ -391,7 +391,7 @@ Tk_3DBorderGC(
* compilers happy.
*/
return (GC) None;
return NULL;
}
/*
@@ -420,12 +420,11 @@ Tk_Free3DBorder(
Display *display = DisplayOfScreen(borderPtr->screen);
TkBorder *prevPtr;
borderPtr->resourceRefCount--;
if (borderPtr->resourceRefCount > 0) {
if (borderPtr->resourceRefCount-- > 1) {
return;
}
prevPtr = Tcl_GetHashValue(borderPtr->hashPtr);
prevPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr);
TkpFreeBorder(borderPtr);
if (borderPtr->bgColorPtr != NULL) {
Tk_FreeColor(borderPtr->bgColorPtr);
@@ -439,13 +438,13 @@ Tk_Free3DBorder(
if (borderPtr->shadow != None) {
Tk_FreeBitmap(display, borderPtr->shadow);
}
if (borderPtr->bgGC != None) {
if (borderPtr->bgGC != NULL) {
Tk_FreeGC(display, borderPtr->bgGC);
}
if (borderPtr->darkGC != None) {
if (borderPtr->darkGC != NULL) {
Tk_FreeGC(display, borderPtr->darkGC);
}
if (borderPtr->lightGC != None) {
if (borderPtr->lightGC != NULL) {
Tk_FreeGC(display, borderPtr->lightGC);
}
if (prevPtr == borderPtr) {
@@ -527,7 +526,7 @@ static void
FreeBorderObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
TkBorder *borderPtr = objPtr->internalRep.twoPtrValue.ptr1;
TkBorder *borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1;
if (borderPtr != NULL) {
borderPtr->objRefCount--;
@@ -562,7 +561,7 @@ DupBorderObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
TkBorder *borderPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
TkBorder *borderPtr = (TkBorder *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = borderPtr;
@@ -594,7 +593,7 @@ Tk_SetBackgroundFromBorder(
Tk_Window tkwin, /* Window whose background is to be set. */
Tk_3DBorder border) /* Token for border. */
{
register TkBorder *borderPtr = (TkBorder *) border;
TkBorder *borderPtr = (TkBorder *) border;
Tk_SetWindowBackground(tkwin, borderPtr->bgColorPtr->pixel);
}
@@ -759,13 +758,13 @@ Tk_Draw3DPolygon(
{
XPoint poly[4], b1, b2, newB1, newB2;
XPoint perp, c, shift1, shift2; /* Used for handling parallel lines. */
register XPoint *p1Ptr, *p2Ptr;
XPoint *p1Ptr, *p2Ptr;
TkBorder *borderPtr = (TkBorder *) border;
GC gc;
int i, lightOnLeft, dx, dy, parallel, pointsSeen;
Display *display = Tk_Display(tkwin);
if (borderPtr->lightGC == None) {
if (borderPtr->lightGC == NULL) {
TkpGetShadows(borderPtr, tkwin);
}
@@ -956,7 +955,7 @@ Tk_Fill3DRectangle(
int relief) /* Indicates 3D effect: TK_RELIEF_FLAT,
* TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */
{
register TkBorder *borderPtr = (TkBorder *) border;
TkBorder *borderPtr = (TkBorder *) border;
int doubleBorder;
/*
@@ -1027,7 +1026,7 @@ Tk_Fill3DPolygon(
* TK_RELIEF_FLAT, TK_RELIEF_RAISED, or
* TK_RELIEF_SUNKEN. */
{
register TkBorder *borderPtr = (TkBorder *) border;
TkBorder *borderPtr = (TkBorder *) border;
XFillPolygon(Tk_Display(tkwin), drawable, borderPtr->bgGC,
pointPtr, numPoints, Complex, CoordModeOrigin);
@@ -1253,7 +1252,7 @@ Tk_Get3DBorderFromObj(
* cached in the internal representation of the Tcl_Obj. Check it out...
*/
borderPtr = objPtr->internalRep.twoPtrValue.ptr1;
borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1;
if ((borderPtr != NULL)
&& (borderPtr->resourceRefCount > 0)
&& (Tk_Screen(tkwin) == borderPtr->screen)
@@ -1281,7 +1280,7 @@ Tk_Get3DBorderFromObj(
if (hashPtr == NULL) {
goto error;
}
for (borderPtr = Tcl_GetHashValue(hashPtr); borderPtr != NULL;
for (borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); borderPtr != NULL;
borderPtr = borderPtr->nextPtr) {
if ((Tk_Screen(tkwin) == borderPtr->screen)
&& (Tk_Colormap(tkwin) == borderPtr->colormap)) {
@@ -1315,7 +1314,7 @@ Tk_Get3DBorderFromObj(
*
* Side effects:
* If no error occurs, a blank internal format for a border value is
* intialized. The final form cannot be done without a Tk_Window.
* initialized. The final form cannot be done without a Tk_Window.
*
*----------------------------------------------------------------------
*/
@@ -1371,7 +1370,7 @@ TkDebugBorder(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, name);
if (hashPtr != NULL) {
TkBorder *borderPtr = Tcl_GetHashValue(hashPtr);
TkBorder *borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr);
if (borderPtr == NULL) {
Tcl_Panic("TkDebugBorder found empty hash table entry");

View File

@@ -54,10 +54,10 @@ typedef struct TkBorder {
GC bgGC; /* Used (if necessary) to draw areas in the
* background color. */
GC darkGC; /* Used to draw darker parts of the border.
* None means the shadow colors haven't been
* NULL means the shadow colors haven't been
* allocated yet.*/
GC lightGC; /* Used to draw lighter parts of the border.
* None means the shadow colors haven't been
* NULL means the shadow colors haven't been
* allocated yet. */
Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in order to
* delete structure). */

View File

@@ -67,12 +67,12 @@ Tk_ParseArgv(
int flags) /* Or'ed combination of various flag bits,
* such as TK_ARGV_NO_DEFAULTS. */
{
register const Tk_ArgvInfo *infoPtr;
const Tk_ArgvInfo *infoPtr;
/* Pointer to the current entry in the table
* of argument descriptions. */
const Tk_ArgvInfo *matchPtr;/* Descriptor that matches current argument. */
const char *curArg; /* Current argument */
register char c; /* Second character of current arg (used for
char c; /* Second character of current arg (used for
* quick check for matching; use 2nd char.
* because first char. will almost always be
* '-'). */
@@ -338,7 +338,7 @@ PrintUsage(
* this word, then don't generate information
* for default options. */
{
register const Tk_ArgvInfo *infoPtr;
const Tk_ArgvInfo *infoPtr;
size_t width, i, numSpaces;
Tcl_Obj *message;

610
generic/tkArray.h Normal file
View File

@@ -0,0 +1,610 @@
/*
* tkArray.h --
*
* An array is a sequence of items, stored in a contiguous memory region.
* Random access to any item is very fast. New items can be either appended
* or prepended. An array may be traversed in the forward or backward direction.
*
* Copyright (c) 2018-2019 by Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
/*
* Note that this file will not be included in header files, it is the purpose
* of this file to be included in source files only. Thus we are not using the
* prefix "Tk_" here for functions, because all the functions have private scope.
*/
/*
* -------------------------------------------------------------------------------
* Use the array in the following way:
* -------------------------------------------------------------------------------
* typedef struct { int key, value; } Pair;
* TK_PTR_ARRAY_DEFINE(MyArray, Pair);
* MyArray *arr = NULL;
* if (MyArray_IsEmpty(arr)) {
* MyArray_Append(&arr, MakePair(1, 2));
* MyArray_Append(&arr, MakePair(2, 3));
* for (i = 0; i < MyArray_Size(arr); ++i) {
* Pair *p = MyArray_Get(arr, i);
* printf("%d -> %d\n", p->key, p->value);
* ckfree(p);
* }
* MyArray_Free(&arr);
* assert(arr == NULL);
* }
* -------------------------------------------------------------------------------
* Or with aggregated elements:
* -------------------------------------------------------------------------------
* typedef struct { int key, value; } Pair;
* TK_ARRAY_DEFINE(MyArray, Pair);
* Pair p1 = { 1, 2 };
* Pair p2 = { 2, 3 };
* MyArray *arr = NULL;
* if (MyArray_IsEmpty(arr)) {
* MyArray_Append(&arr, p1);
* MyArray_Append(&arr, p2);
* for (i = 0; i < MyArray_Size(arr); ++i) {
* const Pair *p = MyArray_Get(arr, i);
* printf("%d -> %d\n", p->key, p->value);
* }
* MyArray_Free(&arr);
* assert(arr == NULL);
* }
* -------------------------------------------------------------------------------
*/
/*************************************************************************/
/*
* Two array types will be provided:
* Use TK_ARRAY_DEFINE if your array is aggregating the elements. Use
* TK_PTR_ARRAY_DEFINE if your array contains pointers to elements. But
* in latter case the array is not responsible for the lifetime of the
* elements.
*/
/*************************************************************************/
/*
* Array_ElemSize: Returns the memory size for one array element.
*/
/*************************************************************************/
/*
* Array_BufferSize: Returns the memory size for given number of elements.
*/
/*************************************************************************/
/*
* Array_IsEmpty: Array is empty?
*/
/*************************************************************************/
/*
* Array_Size: Number of elements in array.
*/
/*************************************************************************/
/*
* Array_Capacity: Capacity of given array. This is the maximal number of
* elements fitting into current array memory without resizing the buffer.
*/
/*************************************************************************/
/*
* Array_SetSize: Set array size, new size must not exceed the capacity of
* the array. This function has to be used with care when increasing the
* array size.
*/
/*************************************************************************/
/*
* Array_First: Returns position of first element in array. Given array
* may be NULL.
*/
/*************************************************************************/
/*
* Array_Last: Returns position after last element in array. Given array
* may be empty.
*/
/*************************************************************************/
/*
* Array_Front: Returns first element in array. Given array must not be
* empty.
*/
/*************************************************************************/
/*
* Array_Back: Returns last element in array. Given array must not be
* empty.
*/
/*************************************************************************/
/*
* Array_Resize: Resize buffer of array for given number of elements. The
* array may grow or shrink. Note that this function is not initializing
* the increased buffer.
*/
/*************************************************************************/
/*
* Array_ResizeAndClear: Resize buffer of array for given number of
* elements. The array may grow or shrink. The increased memory will be
* filled with zeroes.
*/
/*************************************************************************/
/*
* Array_Clear: Fill specified range with zeroes.
*/
/*************************************************************************/
/*
* Array_Free: Resize array to size zero. This function will release the
* array buffer.
*/
/*************************************************************************/
/*
* Array_Append: Insert given element after end of array.
*/
/*************************************************************************/
/*
* Array_PopBack: Shrink array by one element. Given array must not be
* empty.
*/
/*************************************************************************/
/*
* Array_Get: Random access to array element at given position. The given
* index must not exceed current array size.
*/
/*************************************************************************/
/*
* Array_Set: Replace array element at given position with new value. The
* given index must not exceed current array size.
*/
/*************************************************************************/
/*
* Array_Find: Return index position of element which matches given
* argument. If not found then -1 will be returned.
*/
/*************************************************************************/
#ifndef TK_ARRAY_DEFINED
#define TK_ARRAY_DEFINED
#include "tkInt.h"
#if defined(__GNUC__) || defined(__clang__)
# define __TK_ARRAY_UNUSED __attribute__((unused))
#else
# define __TK_ARRAY_UNUSED
#endif
#define TK_ARRAY_DEFINE(AT, ElemType) /* AT = type of array */ \
/* ------------------------------------------------------------------------- */ \
typedef struct AT { \
size_t size; \
size_t capacity; \
ElemType buf[1]; \
} AT; \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Init(AT *arr) \
{ \
assert(arr); \
arr->size = 0; \
arr->capacity = 0; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_ElemSize() \
{ \
return sizeof(ElemType); \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_BufferSize(size_t numElems) \
{ \
return numElems*sizeof(ElemType); \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_IsEmpty(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return !arr || arr->size == 0u; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_Size(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->size : 0u; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_Capacity(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->capacity : 0u; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_First(AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->buf : NULL; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Last(AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->buf + arr->size : NULL; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Front(AT *arr) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(!AT##_IsEmpty(arr)); \
return &arr->buf[0]; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Back(AT *arr) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(!AT##_IsEmpty(arr)); \
return &arr->buf[arr->size - 1]; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Resize(AT **arrp, size_t newSize) \
{ \
assert(arrp); \
assert(!*arrp || (*arrp)->size != 0xdeadbeef); \
if (newSize == 0) { \
assert(!*arrp || ((*arrp)->size = 0xdeadbeef)); \
ckfree(*arrp); \
*arrp = NULL; \
} else { \
int init = *arrp == NULL; \
size_t memSize = AT##_BufferSize(newSize - 1) + sizeof(AT); \
*arrp = ckrealloc(*arrp, memSize); \
if (init) { \
(*arrp)->size = 0; \
} else if (newSize < (*arrp)->size) { \
(*arrp)->size = newSize; \
} \
(*arrp)->capacity = newSize; \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Clear(AT *arr, size_t from, size_t to) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(to <= AT##_Capacity(arr)); \
assert(from <= to); \
memset(arr->buf + from, 0, AT##_BufferSize(to - from)); \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_ResizeAndClear(AT **arrp, size_t newSize) \
{ \
size_t oldCapacity; \
assert(arrp); \
oldCapacity = *arrp ? (*arrp)->capacity : 0; \
AT##_Resize(arrp, newSize); \
if (newSize > oldCapacity) { \
AT##_Clear(*arrp, oldCapacity, newSize); \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_SetSize(AT *arr, size_t newSize) \
{ \
assert(newSize <= AT##_Capacity(arr)); \
assert(!arr || arr->size != 0xdeadbeef); \
if (arr) { \
arr->size = newSize; \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Append(AT **arrp, ElemType *elem) \
{ \
assert(arrp); \
if (!*arrp) { \
AT##_Resize(arrp, 1); \
} else if ((*arrp)->size == (*arrp)->capacity) { \
AT##_Resize(arrp, (*arrp)->capacity + ((*arrp)->capacity + 1)/2); \
} \
(*arrp)->buf[(*arrp)->size++] = *elem; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_PopBack(AT *arr) \
{ \
assert(!AT##_IsEmpty(arr)); \
return arr->size -= 1; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Get(const AT *arr, size_t at) \
{ \
assert(arr); \
assert(at < AT##_Size(arr)); \
return (ElemType *) &arr->buf[at]; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Set(AT *arr, size_t at, ElemType *elem) \
{ \
assert(arr); \
assert(at < AT##_Size(arr)); \
arr->buf[at] = *elem; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Free(AT **arrp) \
{ \
AT##_Resize(arrp, 0); \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_Find(const AT *arr, const ElemType *elem) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
if (arr) { \
const ElemType *buf = arr->buf; \
size_t i; \
for (i = 0; i < arr->size; ++i) { \
if (memcmp(&buf[i], elem, sizeof(ElemType)) == 0) { \
return (int) i; \
} \
} \
} \
return -1; \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_Contains(const AT *arr, const ElemType *elem) \
{ \
return AT##_Find(arr, elem) != -1; \
} \
/* ------------------------------------------------------------------------- */
#define TK_PTR_ARRAY_DEFINE(AT, ElemType) /* AT = type of array */ \
/* ------------------------------------------------------------------------- */ \
typedef struct AT { \
size_t size; \
size_t capacity; \
ElemType *buf[1]; \
} AT; \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_ElemSize() \
{ \
return sizeof(ElemType); \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_BufferSize(size_t numElems) \
{ \
return numElems*sizeof(ElemType *); \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_IsEmpty(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return !arr || arr->size == 0; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType ** \
AT##_First(AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->buf : NULL; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType ** \
AT##_Last(AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->buf + arr->size : NULL; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Front(AT *arr) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(!AT##_IsEmpty(arr)); \
return arr->buf[0]; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Back(AT *arr) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(!AT##_IsEmpty(arr)); \
return arr->buf[arr->size - 1]; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_Size(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->size : 0; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_Capacity(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->capacity : 0; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Resize(AT **arrp, size_t newCapacity) \
{ \
assert(arrp); \
assert(!*arrp || (*arrp)->size != 0xdeadbeef); \
if (newCapacity == 0) { \
assert(!*arrp || ((*arrp)->size = 0xdeadbeef)); \
ckfree(*arrp); \
*arrp = NULL; \
} else { \
int init = *arrp == NULL; \
size_t memSize = AT##_BufferSize(newCapacity - 1) + sizeof(AT); \
*arrp = ckrealloc(*arrp, memSize); \
if (init) { \
(*arrp)->size = 0; \
} else if (newCapacity < (*arrp)->size) { \
(*arrp)->size = newCapacity; \
} \
(*arrp)->capacity = newCapacity; \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Clear(AT *arr, size_t from, size_t to) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(to <= AT##_Capacity(arr)); \
assert(from <= to); \
memset(arr->buf + from, 0, AT##_BufferSize(to - from)); \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_ResizeAndClear(AT **arrp, size_t newCapacity) \
{ \
size_t oldCapacity; \
assert(arrp); \
oldCapacity = *arrp ? (*arrp)->capacity : 0; \
AT##_Resize(arrp, newCapacity); \
if (newCapacity > oldCapacity) { \
AT##_Clear(*arrp, oldCapacity, newCapacity); \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_SetSize(AT *arr, size_t newSize) \
{ \
assert(arr); \
assert(newSize <= AT##_Capacity(arr)); \
arr->size = newSize; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Append(AT **arrp, ElemType *elem) \
{ \
assert(arrp); \
if (!*arrp) { \
AT##_Resize(arrp, 1); \
} else if ((*arrp)->size == (*arrp)->capacity) { \
AT##_Resize(arrp, (*arrp)->capacity + ((*arrp)->capacity + 1)/2); \
} \
(*arrp)->buf[(*arrp)->size++] = elem; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_PopBack(AT *arr) \
{ \
assert(!AT##_IsEmpty(arr)); \
return arr->size -= 1; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Get(const AT *arr, size_t at) \
{ \
assert(arr); \
assert(at < AT##_Size(arr)); \
return arr->buf[at]; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Set(AT *arr, size_t at, ElemType *elem) \
{ \
assert(arr); \
assert(at < AT##_Size(arr)); \
arr->buf[at] = elem; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Free(AT **arrp) \
{ \
AT##_Resize(arrp, 0); \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_Find(const AT *arr, const ElemType *elem) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
if (arr) { \
ElemType *const *buf = arr->buf; \
size_t i; \
for (i = 0; i < arr->size; ++i) { \
if (buf[i] == elem) { \
return (int) i; \
} \
} \
} \
return -1; \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_Contains(const AT *arr, const ElemType *elem) \
{ \
return AT##_Find(arr, elem) != -1; \
} \
/* ------------------------------------------------------------------------- */
#endif /* TK_ARRAY_DEFINED */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 105
* End:
* vi:set ts=8 sw=4:
*/

View File

@@ -154,11 +154,11 @@ Tk_GetAtomName(
if (mustFree) {
XFree(mustFree);
}
name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew);
Tcl_SetHashValue(hPtr, name);
}
return Tcl_GetHashValue(hPtr);
return (const char *)Tcl_GetHashValue(hPtr);
}
/*
@@ -200,7 +200,7 @@ AtomInit(
name = atomNameArray[atom - 1];
hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew);
Tcl_SetHashValue(hPtr, INT2PTR(atom));
name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew);
Tcl_SetHashValue(hPtr, name);
}

File diff suppressed because it is too large Load Diff

View File

@@ -88,7 +88,7 @@ typedef struct {
int width, height; /* Dimensions of bitmap. */
} DataKey;
typedef struct ThreadSpecificData {
typedef struct {
int initialized; /* 0 means table below needs initializing. */
Tcl_HashTable predefBitmapTable;
/* Hash table created by Tk_DefineBitmap to
@@ -167,7 +167,7 @@ Tk_AllocBitmapFromObj(
if (objPtr->typePtr != &tkBitmapObjType) {
InitBitmapObj(objPtr);
}
bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1;
bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1;
/*
* If the object currently points to a TkBitmap, see if it's the one we
@@ -197,7 +197,7 @@ Tk_AllocBitmapFromObj(
*/
if (bitmapPtr != NULL) {
TkBitmap *firstBitmapPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr);
TkBitmap *firstBitmapPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr);
FreeBitmapObj(objPtr);
for (bitmapPtr = firstBitmapPtr; bitmapPtr != NULL;
@@ -307,7 +307,7 @@ GetBitmap(
Pixmap bitmap;
int isNew, width = 0, height = 0, dummy2;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
ThreadSpecificData *tsdPtr =
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!dispPtr->bitmapInit) {
@@ -317,7 +317,7 @@ GetBitmap(
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string,
&isNew);
if (!isNew) {
existingBitmapPtr = Tcl_GetHashValue(nameHashPtr);
existingBitmapPtr = (TkBitmap *)Tcl_GetHashValue(nameHashPtr);
for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL;
bitmapPtr = bitmapPtr->nextPtr) {
if ((Tk_Display(tkwin) == bitmapPtr->display) &&
@@ -395,7 +395,7 @@ GetBitmap(
goto error;
}
} else {
predefPtr = Tcl_GetHashValue(predefHashPtr);
predefPtr = (TkPredefBitmap *)Tcl_GetHashValue(predefHashPtr);
width = predefPtr->width;
height = predefPtr->height;
if (predefPtr->native) {
@@ -407,7 +407,7 @@ GetBitmap(
} else {
bitmap = XCreateBitmapFromData(Tk_Display(tkwin),
RootWindowOfScreen(Tk_Screen(tkwin)),
predefPtr->source, (unsigned)width, (unsigned)height);
(const char *)predefPtr->source, (unsigned)width, (unsigned)height);
}
}
}
@@ -416,7 +416,7 @@ GetBitmap(
* Add information about this bitmap to our database.
*/
bitmapPtr = ckalloc(sizeof(TkBitmap));
bitmapPtr = (TkBitmap *)ckalloc(sizeof(TkBitmap));
bitmapPtr->bitmap = bitmap;
bitmapPtr->width = width;
bitmapPtr->height = height;
@@ -474,7 +474,7 @@ Tk_DefineBitmap(
int isNew;
Tcl_HashEntry *predefHashPtr;
TkPredefBitmap *predefPtr;
ThreadSpecificData *tsdPtr =
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -497,7 +497,7 @@ Tk_DefineBitmap(
Tcl_SetErrorCode(interp, "TK", "BITMAP", "EXISTS", NULL);
return TCL_ERROR;
}
predefPtr = ckalloc(sizeof(TkPredefBitmap));
predefPtr = (TkPredefBitmap *)ckalloc(sizeof(TkPredefBitmap));
predefPtr->source = source;
predefPtr->width = width;
predefPtr->height = height;
@@ -540,7 +540,7 @@ Tk_NameOfBitmap(
if (idHashPtr == NULL) {
goto unknown;
}
bitmapPtr = Tcl_GetHashValue(idHashPtr);
bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr);
return bitmapPtr->nameHashPtr->key.string;
}
@@ -582,7 +582,7 @@ Tk_SizeOfBitmap(
if (idHashPtr == NULL) {
goto unknownBitmap;
}
bitmapPtr = Tcl_GetHashValue(idHashPtr);
bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr);
*widthPtr = bitmapPtr->width;
*heightPtr = bitmapPtr->height;
}
@@ -612,14 +612,13 @@ FreeBitmap(
{
TkBitmap *prevPtr;
bitmapPtr->resourceRefCount--;
if (bitmapPtr->resourceRefCount > 0) {
if (bitmapPtr->resourceRefCount-- > 1) {
return;
}
Tk_FreePixmap(bitmapPtr->display, bitmapPtr->bitmap);
Tcl_DeleteHashEntry(bitmapPtr->idHashPtr);
prevPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr);
prevPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr);
if (prevPtr == bitmapPtr) {
if (bitmapPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(bitmapPtr->nameHashPtr);
@@ -671,7 +670,7 @@ Tk_FreeBitmap(
if (idHashPtr == NULL) {
Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument");
}
FreeBitmap(Tcl_GetHashValue(idHashPtr));
FreeBitmap((TkBitmap *)Tcl_GetHashValue(idHashPtr));
}
/*
@@ -735,7 +734,7 @@ static void
FreeBitmapObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
TkBitmap *bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1;
TkBitmap *bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1;
if (bitmapPtr != NULL) {
bitmapPtr->objRefCount--;
@@ -770,7 +769,7 @@ DupBitmapObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
TkBitmap *bitmapPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
TkBitmap *bitmapPtr = (TkBitmap *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr;
@@ -806,7 +805,6 @@ DupBitmapObjProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
Pixmap
Tk_GetBitmapFromData(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
@@ -820,20 +818,20 @@ Tk_GetBitmapFromData(
char string[16 + TCL_INTEGER_SPACE];
char *name;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
ThreadSpecificData *tsdPtr =
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
BitmapInit(dispPtr);
}
nameKey.source = source;
nameKey.source = (const char *)source;
nameKey.width = width;
nameKey.height = height;
dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable,
(char *) &nameKey, &isNew);
if (!isNew) {
name = Tcl_GetHashValue(dataHashPtr);
name = (char *)Tcl_GetHashValue(dataHashPtr);
} else {
dispPtr->bitmapAutoNumber++;
sprintf(string, "_tk%d", dispPtr->bitmapAutoNumber);
@@ -911,7 +909,7 @@ GetBitmapFromObj(
InitBitmapObj(objPtr);
}
bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1;
bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1;
if (bitmapPtr != NULL) {
if ((bitmapPtr->resourceRefCount > 0)
&& (Tk_Display(tkwin) == bitmapPtr->display)) {
@@ -932,7 +930,7 @@ GetBitmapFromObj(
* more TkBitmap structures. See if any of them will work.
*/
for (bitmapPtr = Tcl_GetHashValue(hashPtr); bitmapPtr != NULL;
for (bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); bitmapPtr != NULL;
bitmapPtr = bitmapPtr->nextPtr) {
if (Tk_Display(tkwin) == bitmapPtr->display) {
objPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr;
@@ -1012,7 +1010,7 @@ BitmapInit(
* or NULL if unavailable. */
{
Tcl_Interp *dummy;
ThreadSpecificData *tsdPtr =
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1150,7 +1148,7 @@ TkDebugBitmap(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->bitmapNameTable, name);
if (hashPtr != NULL) {
bitmapPtr = Tcl_GetHashValue(hashPtr);
bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr);
if (bitmapPtr == NULL) {
Tcl_Panic("TkDebugBitmap found empty hash table entry");
}
@@ -1190,7 +1188,7 @@ TkDebugBitmap(
Tcl_HashTable *
TkGetBitmapPredefTable(void)
{
ThreadSpecificData *tsdPtr =
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return &tsdPtr->predefBitmapTable;

View File

@@ -54,7 +54,7 @@ static void MakeTransparentWindowExist(Tk_Window tkwin,
Window parent);
static inline Tk_Window NextChild(Tk_Window tkwin);
static void RefWinEventProc(ClientData clientData,
register XEvent *eventPtr);
XEvent *eventPtr);
static inline void SetWindowInstanceData(Tk_Window tkwin,
ClientData instanceData);
@@ -122,13 +122,12 @@ SetWindowInstanceData(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
BusyCustodyProc(
ClientData clientData, /* Information about the busy window. */
Tk_Window tkwin) /* Not used. */
TCL_UNUSED(Tk_Window)) /* Not used. */
{
Busy *busyPtr = clientData;
Busy *busyPtr = (Busy *)clientData;
Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc,
busyPtr);
@@ -156,12 +155,11 @@ BusyCustodyProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
BusyGeometryProc(
ClientData clientData, /* Information about window that got new
TCL_UNUSED(void *), /* Information about window that got new
* preferred geometry. */
Tk_Window tkwin) /* Other Tk-related information about the
TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
/* Should never get here */
@@ -249,9 +247,9 @@ DoConfigureNotify(
static void
RefWinEventProc(
ClientData clientData, /* Busy window record */
register XEvent *eventPtr) /* Event which triggered call to routine */
XEvent *eventPtr) /* Event which triggered call to routine */
{
register Busy *busyPtr = clientData;
Busy *busyPtr = (Busy *)clientData;
switch (eventPtr->type) {
case ReparentNotify:
@@ -333,7 +331,7 @@ static void
DestroyBusy(
void *data) /* Busy window structure record */
{
register Busy *busyPtr = data;
Busy *busyPtr = (Busy *)data;
if (busyPtr->hashPtr != NULL) {
Tcl_DeleteHashEntry(busyPtr->hashPtr);
@@ -342,7 +340,7 @@ DestroyBusy(
RefWinEventProc, busyPtr);
if (busyPtr->tkBusy != NULL) {
Tk_FreeConfigOptions(data, busyPtr->optionTable, busyPtr->tkBusy);
Tk_FreeConfigOptions((char *)data, busyPtr->optionTable, busyPtr->tkBusy);
Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask,
BusyEventProc, busyPtr);
Tk_ManageGeometry(busyPtr->tkBusy, NULL, busyPtr);
@@ -377,7 +375,7 @@ BusyEventProc(
ClientData clientData, /* Busy window record */
XEvent *eventPtr) /* Event which triggered call to routine */
{
Busy *busyPtr = clientData;
Busy *busyPtr = (Busy *)clientData;
if (eventPtr->type == DestroyNotify) {
busyPtr->tkBusy = NULL;
@@ -519,17 +517,18 @@ CreateBusy(
Tk_Window tkRef) /* Window hosting the busy window */
{
Busy *busyPtr;
int length, x, y;
size_t length;
int x, y;
const char *fmt;
char *name;
Tk_Window tkBusy, tkChild, tkParent;
Window parent;
Tk_FakeWin *winPtr;
busyPtr = ckalloc(sizeof(Busy));
busyPtr = (Busy *)ckalloc(sizeof(Busy));
x = y = 0;
length = strlen(Tk_Name(tkRef));
name = ckalloc(length + 6);
name = (char *)ckalloc(length + 6);
if (Tk_IsTopLevel(tkRef)) {
fmt = "_Busy"; /* Child */
tkParent = tkRef;
@@ -568,7 +567,7 @@ CreateBusy(
busyPtr->height = Tk_Height(tkRef);
busyPtr->x = Tk_X(tkRef);
busyPtr->y = Tk_Y(tkRef);
busyPtr->cursor = None;
busyPtr->cursor = NULL;
Tk_SetClass(tkBusy, "Busy");
busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs);
if (Tk_InitOptions(interp, (char *) busyPtr, busyPtr->optionTable,
@@ -598,7 +597,7 @@ CreateBusy(
*/
Tk_ManageGeometry(tkBusy, &busyMgrInfo, busyPtr);
if (busyPtr->cursor != None) {
if (busyPtr->cursor != NULL) {
Tk_DefineCursor(tkBusy, busyPtr->cursor);
}
@@ -643,7 +642,7 @@ ConfigureBusy(
return TCL_ERROR;
}
if (busyPtr->cursor != oldCursor) {
if (busyPtr->cursor == None) {
if (busyPtr->cursor == NULL) {
Tk_UndefineCursor(busyPtr->tkBusy);
} else {
Tk_DefineCursor(busyPtr->tkBusy, busyPtr->cursor);
@@ -695,7 +694,7 @@ GetBusy(
Tcl_GetString(windowObj), NULL);
return NULL;
}
return Tcl_GetHashValue(hPtr);
return (Busy *)Tcl_GetHashValue(hPtr);
}
/*
@@ -745,7 +744,7 @@ HoldBusy(
Tcl_SetHashValue(hPtr, busyPtr);
busyPtr->hashPtr = hPtr;
} else {
busyPtr = Tcl_GetHashValue(hPtr);
busyPtr = (Busy *)Tcl_GetHashValue(hPtr);
}
busyPtr->tablePtr = busyTablePtr;
@@ -788,7 +787,7 @@ Tk_BusyObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
Tcl_HashTable *busyTablePtr = &((TkWindow *) tkwin)->mainPtr->busyTable;
Busy *busyPtr;
Tcl_Obj *objPtr;
@@ -854,7 +853,7 @@ Tk_BusyObjCmd(
}
Tcl_Preserve(busyPtr);
if (objc <= 4) {
objPtr = Tk_GetOptionInfo(interp, (char *) busyPtr,
objPtr = Tk_GetOptionInfo(interp, (char *)busyPtr,
busyPtr->optionTable, (objc == 4) ? objv[3] : NULL,
busyPtr->tkBusy);
if (objPtr == NULL) {
@@ -876,9 +875,9 @@ Tk_BusyObjCmd(
objPtr = Tcl_NewObj();
for (hPtr = Tcl_FirstHashEntry(busyTablePtr, &cursor); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&cursor)) {
busyPtr = Tcl_GetHashValue(hPtr);
busyPtr = (Busy *)Tcl_GetHashValue(hPtr);
if (pattern == NULL ||
Tcl_StringMatch(Tk_PathName(busyPtr->tkRef), pattern)) {
Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) {
Tcl_ListObjAppendElement(interp, objPtr,
TkNewWindowObj(busyPtr->tkRef));
}

View File

@@ -16,7 +16,7 @@
#include "tkButton.h"
#include "default.h"
typedef struct ThreadSpecificData {
typedef struct {
int defaultsInitialized;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -104,8 +104,13 @@ static const Tk_OptionSpec labelOptionSpecs[] = {
NULL, 0, -1, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
#ifdef DEF_LABEL_FG
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
DEF_LABEL_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0},
#else
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
DEF_BUTTON_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0},
#endif
{TK_OPTION_STRING, "-height", "height", "Height",
DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
@@ -710,12 +715,12 @@ ButtonCreate(
butPtr->normalFg = NULL;
butPtr->activeFg = NULL;
butPtr->disabledFg = NULL;
butPtr->normalTextGC = None;
butPtr->activeTextGC = None;
butPtr->disabledGC = None;
butPtr->stippleGC = None;
butPtr->normalTextGC = NULL;
butPtr->activeTextGC = NULL;
butPtr->disabledGC = NULL;
butPtr->stippleGC = NULL;
butPtr->gray = None;
butPtr->copyGC = None;
butPtr->copyGC = NULL;
butPtr->widthPtr = NULL;
butPtr->width = 0;
butPtr->heightPtr = NULL;
@@ -740,7 +745,7 @@ ButtonCreate(
butPtr->onValuePtr = NULL;
butPtr->offValuePtr = NULL;
butPtr->tristateValuePtr = NULL;
butPtr->cursor = None;
butPtr->cursor = NULL;
butPtr->takeFocusPtr = NULL;
butPtr->commandPtr = NULL;
butPtr->flags = 0;
@@ -878,7 +883,7 @@ ButtonWidgetObjCmd(
*/
Tcl_CancelIdleCall(TkpDisplayButton, butPtr);
XFlush(butPtr->display);
(void)XFlush(butPtr->display);
#ifndef MAC_OSX_TK
/*
* On the mac you can not sleep in a display proc, and the
@@ -981,22 +986,22 @@ DestroyButton(
if (butPtr->tristateImage != NULL) {
Tk_FreeImage(butPtr->tristateImage);
}
if (butPtr->normalTextGC != None) {
if (butPtr->normalTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->normalTextGC);
}
if (butPtr->activeTextGC != None) {
if (butPtr->activeTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->activeTextGC);
}
if (butPtr->disabledGC != None) {
if (butPtr->disabledGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->disabledGC);
}
if (butPtr->stippleGC != None) {
if (butPtr->stippleGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->stippleGC);
}
if (butPtr->gray != None) {
Tk_FreeBitmap(butPtr->display, butPtr->gray);
}
if (butPtr->copyGC != None) {
if (butPtr->copyGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->copyGC);
}
if (butPtr->textLayout != NULL) {
@@ -1036,7 +1041,7 @@ DestroyButton(
static int
ConfigureButton(
Tcl_Interp *interp, /* Used for error reporting. */
register TkButton *butPtr, /* Information about widget; may or may
TkButton *butPtr, /* Information about widget; may or may
* not already have values for some fields. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -1175,7 +1180,7 @@ ConfigureButton(
*/
if ((butPtr->type == TYPE_RADIO_BUTTON) &&
(*Tcl_GetString(butPtr->onValuePtr) == 0)) {
(*Tcl_GetString(butPtr->onValuePtr) == '\0')) {
butPtr->flags |= SELECTED;
}
}
@@ -1367,7 +1372,7 @@ TkButtonWorldChanged(
gcValues.graphics_exposures = False;
mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
if (butPtr->normalTextGC != None) {
if (butPtr->normalTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->normalTextGC);
}
butPtr->normalTextGC = newGC;
@@ -1377,7 +1382,7 @@ TkButtonWorldChanged(
gcValues.background = Tk_3DBorderColor(butPtr->activeBorder)->pixel;
mask = GCForeground | GCBackground | GCFont;
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
if (butPtr->activeTextGC != None) {
if (butPtr->activeTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->activeTextGC);
}
butPtr->activeTextGC = newGC;
@@ -1389,7 +1394,7 @@ TkButtonWorldChanged(
* Create the GC that can be used for stippling
*/
if (butPtr->stippleGC == None) {
if (butPtr->stippleGC == NULL) {
gcValues.foreground = gcValues.background;
mask = GCForeground;
if (butPtr->gray == None) {
@@ -1415,12 +1420,12 @@ TkButtonWorldChanged(
gcValues.foreground = gcValues.background;
}
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
if (butPtr->disabledGC != None) {
if (butPtr->disabledGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->disabledGC);
}
butPtr->disabledGC = newGC;
if (butPtr->copyGC == None) {
if (butPtr->copyGC == NULL) {
butPtr->copyGC = Tk_GetGC(butPtr->tkwin, 0, &gcValues);
}
@@ -1612,23 +1617,10 @@ ButtonVarProc(
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
register TkButton *butPtr = clientData;
TkButton *butPtr = clientData;
const char *value;
Tcl_Obj *valuePtr;
/*
* See ticket [5d991b82].
*/
if (butPtr->selVarNamePtr == NULL) {
if (!(flags & TCL_INTERP_DESTROYED)) {
Tcl_UntraceVar2(interp, name1, name2,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonVarProc, clientData);
}
return NULL;
}
/*
* If the variable is being unset, then just re-establish the trace unless
* the whole interpreter is going away.
@@ -1636,7 +1628,27 @@ ButtonVarProc(
if (flags & TCL_TRACE_UNSETS) {
butPtr->flags &= ~(SELECTED | TRISTATED);
if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
if (!Tcl_InterpDeleted(interp)) {
ClientData probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
Tcl_GetString(butPtr->selVarNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonVarProc, probe);
if (probe == (ClientData)butPtr) {
break;
}
} while (probe);
if (probe) {
/*
* We were able to fetch the unset trace for our
* selVarNamePtr, which means it is not unset and not
* the cause of this unset trace. Instead some outdated
* former variable must be, and we should ignore it.
*/
goto redisplay;
}
Tcl_TraceVar2(interp, Tcl_GetString(butPtr->selVarNamePtr),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonVarProc, clientData);
@@ -1711,8 +1723,8 @@ static char *
ButtonTextVarProc(
ClientData clientData, /* Information about button. */
Tcl_Interp *interp, /* Interpreter containing variable. */
const char *name1, /* Name of variable. */
const char *name2, /* Second part of variable name. */
const char *name1, /* Not used. */
const char *name2, /* Not used. */
int flags) /* Information about what happened. */
{
TkButton *butPtr = clientData;
@@ -1722,26 +1734,40 @@ ButtonTextVarProc(
return NULL;
}
/*
* See ticket [5d991b82].
*/
if (butPtr->textVarNamePtr == NULL) {
if (!(flags & TCL_INTERP_DESTROYED)) {
Tcl_UntraceVar2(interp, name1, name2,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonTextVarProc, clientData);
}
return NULL;
}
/*
* If the variable is unset, then immediately recreate it unless the whole
* interpreter is going away.
*/
if (flags & TCL_TRACE_UNSETS) {
if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
if (!Tcl_InterpDeleted(interp) && butPtr->textVarNamePtr != NULL) {
/*
* An unset trace on some variable brought us here, but is it
* the variable we have stored in butPtr->textVarNamePtr ?
*/
ClientData probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
Tcl_GetString(butPtr->textVarNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonTextVarProc, probe);
if (probe == (ClientData)butPtr) {
break;
}
} while (probe);
if (probe) {
/*
* We were able to fetch the unset trace for our
* textVarNamePtr, which means it is not unset and not
* the cause of this unset trace. Instead some outdated
* former textvariable must be, and we should ignore it.
*/
return NULL;
}
Tcl_ObjSetVar2(interp, butPtr->textVarNamePtr, NULL,
butPtr->textPtr, TCL_GLOBAL_ONLY);
Tcl_TraceVar2(interp, Tcl_GetString(butPtr->textVarNamePtr),
@@ -1796,7 +1822,7 @@ ButtonImageProc(
* <= 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
register TkButton *butPtr = clientData;
TkButton *butPtr = clientData;
if (butPtr->tkwin != NULL) {
TkpComputeButtonGeometry(butPtr);
@@ -1834,7 +1860,7 @@ ButtonSelectImageProc(
* <= 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
register TkButton *butPtr = clientData;
TkButton *butPtr = clientData;
#ifdef MAC_OSX_TK
if (butPtr->tkwin != NULL) {
@@ -1881,7 +1907,7 @@ ButtonTristateImageProc(
* <= 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
register TkButton *butPtr = clientData;
TkButton *butPtr = clientData;
#ifdef MAC_OSX_TK
if (butPtr->tkwin != NULL) {

View File

@@ -235,7 +235,7 @@ typedef struct {
* Miscellaneous information:
*/
Tk_Cursor cursor; /* Value of -cursor option: if not None,
Tk_Cursor cursor; /* Value of -cursor option: if not NULL,
* specifies current cursor for window. */
Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal
@@ -306,7 +306,7 @@ MODULE_SCOPE char tkDefLabelPady[TCL_INTEGER_SPACE];
*/
#ifndef TkpButtonSetDefaults
MODULE_SCOPE void TkpButtonSetDefaults();
MODULE_SCOPE void TkpButtonSetDefaults(void);
#endif
MODULE_SCOPE void TkButtonWorldChanged(ClientData instanceData);
MODULE_SCOPE void TkpComputeButtonGeometry(TkButton *butPtr);

View File

@@ -12,6 +12,7 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include "default.h"
/*
* The structure below defines the record for each arc item.
@@ -144,7 +145,7 @@ static const Tk_ConfigSpec configSpecs[] = {
"0,0", Tk_Offset(ArcItem, tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
{TK_CONFIG_COLOR, "-outline", NULL, NULL,
"black", Tk_Offset(ArcItem, outline.color), TK_CONFIG_NULL_OK, NULL},
DEF_CANVITEM_OUTLINE, Tk_Offset(ArcItem, outline.color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL,
"0,0", Tk_Offset(ArcItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
@@ -290,7 +291,7 @@ CreateArc(
arcPtr->activeFillStipple = None;
arcPtr->disabledFillStipple = None;
arcPtr->style = PIESLICE_STYLE;
arcPtr->fillGC = None;
arcPtr->fillGC = NULL;
/*
* Process the arguments to fill in the item record.
@@ -351,8 +352,8 @@ ArcCoords(
objs[2] = Tcl_NewDoubleObj(arcPtr->bbox[2]);
objs[3] = Tcl_NewDoubleObj(arcPtr->bbox[3]);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, objs));
} else if ((objc == 1)||(objc == 4)) {
if (objc==1) {
} else if ((objc == 1) || (objc == 4)) {
if (objc == 1) {
if (Tcl_ListObjGetElements(interp, objv[0], &objc,
(Tcl_Obj ***) &objv) != TCL_OK) {
return TCL_ERROR;
@@ -478,9 +479,9 @@ ConfigureArc(
mask |= GCCapStyle;
newGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
newGC = None;
newGC = NULL;
}
if (arcPtr->outline.gc != None) {
if (arcPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), arcPtr->outline.gc);
}
arcPtr->outline.gc = newGC;
@@ -512,9 +513,9 @@ ConfigureArc(
}
if (arcPtr->style == ARC_STYLE) {
newGC = None;
newGC = NULL;
} else if (color == NULL) {
newGC = None;
newGC = NULL;
} else {
gcValues.foreground = color->pixel;
if (arcPtr->style == CHORD_STYLE) {
@@ -530,7 +531,7 @@ ConfigureArc(
}
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
if (arcPtr->fillGC != None) {
if (arcPtr->fillGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), arcPtr->fillGC);
}
arcPtr->fillGC = newGC;
@@ -575,11 +576,11 @@ ConfigureArc(
static void
DeleteArc(
Tk_Canvas canvas, /* Info about overall canvas. */
TCL_UNUSED(Tk_Canvas), /* Info about overall canvas. */
Tk_Item *itemPtr, /* Item that is being deleted. */
Display *display) /* Display containing window for canvas. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
ArcItem *arcPtr = (ArcItem *)itemPtr;
Tk_DeleteOutline(display, &(arcPtr->outline));
if (arcPtr->numOutlinePoints != 0) {
@@ -603,7 +604,7 @@ DeleteArc(
if (arcPtr->disabledFillStipple != None) {
Tk_FreeBitmap(display, arcPtr->disabledFillStipple);
}
if (arcPtr->fillGC != None) {
if (arcPtr->fillGC != NULL) {
Tk_FreeGC(display, arcPtr->fillGC);
}
}
@@ -625,7 +626,6 @@ DeleteArc(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
ComputeArcBbox(
Tk_Canvas canvas, /* Canvas that contains item. */
@@ -662,13 +662,13 @@ ComputeArcBbox(
*/
if (arcPtr->bbox[1] > arcPtr->bbox[3]) {
double tmp = arcPtr->bbox[3];
tmp = arcPtr->bbox[3];
arcPtr->bbox[3] = arcPtr->bbox[1];
arcPtr->bbox[1] = tmp;
}
if (arcPtr->bbox[0] > arcPtr->bbox[2]) {
double tmp = arcPtr->bbox[2];
tmp = arcPtr->bbox[2];
arcPtr->bbox[2] = arcPtr->bbox[0];
arcPtr->bbox[0] = tmp;
@@ -677,7 +677,7 @@ ComputeArcBbox(
ComputeArcOutline(canvas,arcPtr);
/*
* To compute the bounding box, start with the the bbox formed by the two
* To compute the bounding box, start with the bbox formed by the two
* endpoints of the arc. Then add in the center of the arc's oval (if
* relevant) and the 3-o'clock, 6-o'clock, 9-o'clock, and 12-o'clock
* positions, if they are relevant.
@@ -734,7 +734,7 @@ ComputeArcBbox(
* drawn) and add one extra pixel just for safety.
*/
if (arcPtr->outline.gc == None) {
if (arcPtr->outline.gc == NULL) {
tmp = 1;
} else {
tmp = (int) ((width + 1.0)/2.0 + 1);
@@ -768,8 +768,10 @@ DisplayArc(
Tk_Item *itemPtr, /* Item to be displayed. */
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
int x, int y, /* Describes region of canvas that must be */
int width, int height) /* redisplayed (not used). */
TCL_UNUSED(int), /* Describes region of canvas that must be */
TCL_UNUSED(int), /* redisplayed (not used). */
TCL_UNUSED(int),
TCL_UNUSED(int))
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
short x1, y1, x2, y2;
@@ -833,7 +835,7 @@ DisplayArc(
* window servers to crash and should be a no-op anyway.
*/
if ((arcPtr->fillGC != None) && (extent != 0)) {
if ((arcPtr->fillGC != NULL) && (extent != 0)) {
if (stipple != None) {
int w = 0;
int h = 0;
@@ -867,7 +869,7 @@ DisplayArc(
XSetTSOrigin(display, arcPtr->fillGC, 0, 0);
}
}
if (arcPtr->outline.gc != None) {
if (arcPtr->outline.gc != NULL) {
Tk_ChangeOutlineGC(canvas, itemPtr, &(arcPtr->outline));
if (extent != 0) {
@@ -905,13 +907,13 @@ DisplayArc(
} else {
if (arcPtr->style == CHORD_STYLE) {
TkFillPolygon(canvas, arcPtr->outlinePtr, CHORD_OUTLINE_PTS,
display, drawable, arcPtr->outline.gc, None);
display, drawable, arcPtr->outline.gc, NULL);
} else if (arcPtr->style == PIESLICE_STYLE) {
TkFillPolygon(canvas, arcPtr->outlinePtr, PIE_OUTLINE1_PTS,
display, drawable, arcPtr->outline.gc, None);
display, drawable, arcPtr->outline.gc, NULL);
TkFillPolygon(canvas, arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
PIE_OUTLINE2_PTS, display, drawable,
arcPtr->outline.gc, None);
arcPtr->outline.gc, NULL);
}
}
@@ -941,7 +943,6 @@ DisplayArc(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static double
ArcToPoint(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1017,12 +1018,12 @@ ArcToPoint(
return dist;
}
if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) {
if ((arcPtr->fillGC != NULL) || (arcPtr->outline.gc == NULL)) {
filled = 1;
} else {
filled = 0;
}
if (arcPtr->outline.gc == None) {
if (arcPtr->outline.gc == NULL) {
width = 0.0;
}
@@ -1106,7 +1107,6 @@ ArcToPoint(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArcToArea(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1144,12 +1144,12 @@ ArcToArea(
}
}
if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) {
if ((arcPtr->fillGC != NULL) || (arcPtr->outline.gc == NULL)) {
filled = 1;
} else {
filled = 0;
}
if (arcPtr->outline.gc == None) {
if (arcPtr->outline.gc == NULL) {
width = 0.0;
}
@@ -1446,7 +1446,7 @@ ComputeArcOutline(
*/
if (arcPtr->numOutlinePoints == 0) {
arcPtr->outlinePtr = ckalloc(26 * sizeof(double));
arcPtr->outlinePtr = (double *)ckalloc(26 * sizeof(double));
arcPtr->numOutlinePoints = 22;
}
outlinePtr = arcPtr->outlinePtr;
@@ -1813,7 +1813,7 @@ ArcToPostscript(
Tcl_Interp *interp, /* Leave Postscript or error message here. */
Tk_Canvas canvas, /* Information about overall canvas. */
Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
int prepass) /* 1 means this is a prepass to collect font
TCL_UNUSED(int)) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{
@@ -1883,7 +1883,7 @@ ArcToPostscript(
* arc.
*/
if (arcPtr->fillGC != None) {
if (arcPtr->fillGC != NULL) {
Tcl_AppendPrintfToObj(psObj,
"matrix currentmatrix\n"
"%.15g %.15g translate %.15g %.15g scale\n",
@@ -1912,7 +1912,7 @@ ArcToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (arcPtr->outline.gc != None) {
if (arcPtr->outline.gc != NULL) {
Tcl_AppendToObj(psObj, "grestore gsave\n", -1);
}
} else {
@@ -1924,7 +1924,7 @@ ArcToPostscript(
* If there's an outline for the arc, draw it.
*/
if (arcPtr->outline.gc != None) {
if (arcPtr->outline.gc != NULL) {
Tcl_AppendPrintfToObj(psObj,
"matrix currentmatrix\n"
"%.15g %.15g translate %.15g %.15g scale\n",
@@ -2027,17 +2027,16 @@ ArcToPostscript(
static int
StyleParseProc(
ClientData clientData, /* some flags.*/
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item. */
{
int c;
size_t length;
register Style *stylePtr = (Style *) (widgRec + offset);
Style *stylePtr = (Style *) (widgRec + offset);
if (value == NULL || *value == 0) {
*stylePtr = PIESLICE_STYLE;
@@ -2091,15 +2090,15 @@ StyleParseProc(
static const char *
StylePrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Ignored. */
TCL_UNUSED(void *), /* Ignored. */
TCL_UNUSED(Tk_Window), /* Ignored. */
char *widgRec, /* Pointer to record for item. */
int offset, /* Offset into item. */
Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
register Style *stylePtr = (Style *) (widgRec + offset);
Style *stylePtr = (Style *) (widgRec + offset);
if (*stylePtr == ARC_STYLE) {
return "arc";

View File

@@ -12,6 +12,7 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include "default.h"
/*
* The structure below defines the record for each bitmap item.
@@ -70,7 +71,7 @@ static const Tk_ConfigSpec configSpecs[] = {
NULL, Tk_Offset(BitmapItem, disabledFgColor),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-foreground", NULL, NULL,
"black", Tk_Offset(BitmapItem, fgColor), 0, NULL},
DEF_CANVBMAP_FG, Tk_Offset(BitmapItem, fgColor), 0, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
&stateOption},
@@ -189,7 +190,7 @@ TkcCreateBitmap(
bmapPtr->bgColor = NULL;
bmapPtr->activeBgColor = NULL;
bmapPtr->disabledBgColor = NULL;
bmapPtr->gc = None;
bmapPtr->gc = NULL;
/*
* Process the arguments to fill in the item record. Only 1 (list) or 2 (x
@@ -372,7 +373,7 @@ ConfigureBitmap(
}
if (bitmap == None) {
newGC = None;
newGC = NULL;
} else {
gcValues.foreground = fgColor->pixel;
mask = GCForeground;
@@ -385,7 +386,7 @@ ConfigureBitmap(
}
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
if (bmapPtr->gc != None) {
if (bmapPtr->gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), bmapPtr->gc);
}
bmapPtr->gc = newGC;

View File

@@ -449,7 +449,7 @@ ComputeImageBbox(
x = (int) (imgPtr->x + ((imgPtr->x >= 0) ? 0.5 : - 0.5));
y = (int) (imgPtr->y + ((imgPtr->y >= 0) ? 0.5 : - 0.5));
if ((state == TK_STATE_HIDDEN) || (image == None)) {
if ((state == TK_STATE_HIDDEN) || (image == NULL)) {
imgPtr->header.x1 = imgPtr->header.x2 = x;
imgPtr->header.y1 = imgPtr->header.y2 = y;
return;

View File

@@ -13,6 +13,7 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include "default.h"
/*
* The structure below defines the record for each line item.
@@ -175,7 +176,7 @@ static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_CAP_STYLE, "-capstyle", NULL, NULL,
"butt", Tk_Offset(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
"black", Tk_Offset(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL},
DEF_CANVITEM_OUTLINE, Tk_Offset(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
NULL, Tk_Offset(LineItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
@@ -296,7 +297,7 @@ CreateLine(
linePtr->coordPtr = NULL;
linePtr->capStyle = CapButt;
linePtr->joinStyle = JoinRound;
linePtr->arrowGC = None;
linePtr->arrowGC = NULL;
linePtr->arrow = ARROWS_NONE;
linePtr->arrowShapeA = (float)8.0;
linePtr->arrowShapeB = (float)10.0;
@@ -405,7 +406,7 @@ LineCoords(
numPoints = objc/2;
if (linePtr->numPoints != numPoints) {
coordPtr = ckalloc(sizeof(double) * objc);
coordPtr = (double *)ckalloc(sizeof(double) * objc);
if (linePtr->coordPtr != NULL) {
ckfree(linePtr->coordPtr);
}
@@ -521,12 +522,12 @@ ConfigureLine(
#endif
arrowGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
newGC = arrowGC = None;
newGC = arrowGC = NULL;
}
if (linePtr->outline.gc != None) {
if (linePtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), linePtr->outline.gc);
}
if (linePtr->arrowGC != None) {
if (linePtr->arrowGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), linePtr->arrowGC);
}
linePtr->outline.gc = newGC;
@@ -601,7 +602,7 @@ ConfigureLine(
static void
DeleteLine(
Tk_Canvas canvas, /* Info about overall canvas widget. */
TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */
Tk_Item *itemPtr, /* Item that is being deleted. */
Display *display) /* Display containing window for canvas. */
{
@@ -611,7 +612,7 @@ DeleteLine(
if (linePtr->coordPtr != NULL) {
ckfree(linePtr->coordPtr);
}
if (linePtr->arrowGC != None) {
if (linePtr->arrowGC != NULL) {
Tk_FreeGC(display, linePtr->arrowGC);
}
if (linePtr->firstArrowPtr != NULL) {
@@ -705,7 +706,7 @@ ComputeLineBbox(
tsoffset = &linePtr->outline.tsoffset;
if (tsoffset->flags & TK_OFFSET_INDEX) {
double *coordPtr = linePtr->coordPtr
coordPtr = linePtr->coordPtr
+ (tsoffset->flags & ~TK_OFFSET_INDEX);
if (tsoffset->flags <= 0) {
@@ -829,9 +830,10 @@ DisplayLine(
Tk_Item *itemPtr, /* Item to be displayed. */
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
int x, int y, int width, int height)
/* Describes region of canvas that must be
* redisplayed (not used). */
TCL_UNUSED(int), /* Describes region of canvas that must be */
TCL_UNUSED(int), /* redisplayed (not used). */
TCL_UNUSED(int),
TCL_UNUSED(int))
{
LineItem *linePtr = (LineItem *) itemPtr;
XPoint staticPoints[MAX_STATIC_POINTS*3];
@@ -840,7 +842,7 @@ DisplayLine(
int numPoints;
Tk_State state = itemPtr->state;
if ((!linePtr->numPoints) || (linePtr->outline.gc == None)) {
if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) {
return;
}
@@ -874,7 +876,7 @@ DisplayLine(
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
pointPtr = ckalloc(numPoints * 3 * sizeof(XPoint));
pointPtr = (XPoint *)ckalloc(numPoints * 3 * sizeof(XPoint));
}
if ((linePtr->smooth) && (linePtr->numPoints > 2)) {
@@ -983,7 +985,7 @@ LineInsert(
linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1];
}
newCoordPtr = ckalloc(sizeof(double) * (length + objc));
newCoordPtr = (double *)ckalloc(sizeof(double) * (length + objc));
for (i=0; i<beforeThis; i++) {
newCoordPtr[i] = linePtr->coordPtr[i];
}
@@ -1318,7 +1320,6 @@ LineDeleteCoords(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static double
LineToPoint(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1364,7 +1365,7 @@ LineToPoint(
if (numPoints <= MAX_STATIC_POINTS) {
linePoints = staticSpace;
} else {
linePoints = ckalloc(2 * numPoints * sizeof(double));
linePoints = (double *)ckalloc(2 * numPoints * sizeof(double));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
@@ -1546,7 +1547,6 @@ LineToPoint(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
LineToArea(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1599,7 +1599,7 @@ LineToArea(
if (numPoints <= MAX_STATIC_POINTS) {
linePoints = staticSpace;
} else {
linePoints = ckalloc(2 * numPoints * sizeof(double));
linePoints = (double *)ckalloc(2 * numPoints * sizeof(double));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
@@ -1694,8 +1694,6 @@ ScaleLine(
linePtr->firstArrowPtr = NULL;
}
if (linePtr->lastArrowPtr != NULL) {
int i;
i = 2*(linePtr->numPoints-1);
linePtr->coordPtr[i] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[i+1] = linePtr->lastArrowPtr[1];
@@ -1872,12 +1870,11 @@ TranslateLine(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
ParseArrowShape(
ClientData clientData, /* Not used. */
TCL_UNUSED(void *), /* Not used. */
Tcl_Interp *interp, /* Used for error reporting. */
Tk_Window tkwin, /* Not used. */
TCL_UNUSED(Tk_Window), /* Not used. */
const char *value, /* Textual specification of arrow shape. */
char *recordPtr, /* Pointer to item record in which to store
* arrow information. */
@@ -1941,19 +1938,18 @@ ParseArrowShape(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static const char *
PrintArrowShape(
ClientData clientData, /* Not used. */
Tk_Window tkwin, /* Window associated with linePtr's widget. */
TCL_UNUSED(void *), /* Not used. */
TCL_UNUSED(Tk_Window), /* Window associated with linePtr's widget. */
char *recordPtr, /* Pointer to item record containing current
* shape information. */
int offset, /* Offset of arrow information in record. */
TCL_UNUSED(int), /* Offset of arrow information in record. */
Tcl_FreeProc **freeProcPtr) /* Store address of function to call to free
* string here. */
{
LineItem *linePtr = (LineItem *) recordPtr;
char *buffer = ckalloc(120);
char *buffer = (char *)ckalloc(120);
sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA,
linePtr->arrowShapeB, linePtr->arrowShapeC);
@@ -1981,17 +1977,16 @@ PrintArrowShape(
static int
ArrowParseProc(
ClientData clientData, /* some flags.*/
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item. */
{
int c;
size_t length;
register Arrows *arrowPtr = (Arrows *) (widgRec + offset);
Arrows *arrowPtr = (Arrows *) (widgRec + offset);
if (value == NULL || *value == 0) {
*arrowPtr = ARROWS_NONE;
@@ -2049,15 +2044,15 @@ ArrowParseProc(
static const char *
ArrowPrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
TCL_UNUSED(void *), /* Ignored. */
TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
int offset, /* Offset into item. */
Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
register Arrows *arrowPtr = (Arrows *) (widgRec + offset);
Arrows *arrowPtr = (Arrows *) (widgRec + offset);
switch (*arrowPtr) {
case ARROWS_FIRST:
@@ -2091,7 +2086,6 @@ ArrowPrintProc(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
ConfigureArrows(
Tk_Canvas canvas, /* Canvas in which arrows will be displayed
@@ -2152,7 +2146,7 @@ ConfigureArrows(
if (linePtr->arrow != ARROWS_LAST) {
poly = linePtr->firstArrowPtr;
if (poly == NULL) {
poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double));
poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double));
poly[0] = poly[10] = linePtr->coordPtr[0];
poly[1] = poly[11] = linePtr->coordPtr[1];
linePtr->firstArrowPtr = poly;
@@ -2196,7 +2190,7 @@ ConfigureArrows(
coordPtr = linePtr->coordPtr + 2*(linePtr->numPoints-2);
poly = linePtr->lastArrowPtr;
if (poly == NULL) {
poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double));
poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double));
poly[0] = poly[10] = coordPtr[2];
poly[1] = poly[11] = coordPtr[3];
linePtr->lastArrowPtr = poly;
@@ -2253,7 +2247,7 @@ LineToPostscript(
Tcl_Interp *interp, /* Leave Postscript or error message here. */
Tk_Canvas canvas, /* Information about overall canvas. */
Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
int prepass) /* 1 means this is a prepass to collect font
TCL_UNUSED(int)) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{
@@ -2365,7 +2359,7 @@ LineToPostscript(
linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
pointPtr = staticPoints;
if (numPoints > MAX_STATIC_POINTS) {
pointPtr = ckalloc(numPoints * 2 * sizeof(double));
pointPtr = (double *)ckalloc(numPoints * 2 * sizeof(double));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr);

View File

@@ -13,6 +13,7 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include "default.h"
/*
* The structure below defines the record for each polygon item.
@@ -112,8 +113,9 @@ static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL,
"0.0", Tk_Offset(PolygonItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
/* Remark: Default for -fill should be NULL, see [2860519]. Will be fixed in Tk 8.7 */
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
"black", Tk_Offset(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL},
DEF_CANVITEM_OUTLINE, Tk_Offset(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL,
"round", Tk_Offset(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
@@ -273,7 +275,7 @@ CreatePolygon(
polyPtr->fillStipple = None;
polyPtr->activeFillStipple = None;
polyPtr->disabledFillStipple = None;
polyPtr->fillGC = None;
polyPtr->fillGC = NULL;
polyPtr->smooth = NULL;
polyPtr->splineSteps = 12;
polyPtr->autoClosed = 0;
@@ -374,7 +376,7 @@ PolygonCoords(
* another point to close the polygon.
*/
polyPtr->coordPtr = ckalloc(sizeof(double) * (objc+2));
polyPtr->coordPtr = (double *)ckalloc(sizeof(double) * (objc+2));
polyPtr->pointsAllocated = numPoints+1;
}
for (i = objc-1; i >= 0; i--) {
@@ -478,9 +480,9 @@ ConfigurePolygon(
mask |= GCCapStyle|GCJoinStyle;
newGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
newGC = None;
newGC = NULL;
}
if (polyPtr->outline.gc != None) {
if (polyPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), polyPtr->outline.gc);
}
polyPtr->outline.gc = newGC;
@@ -504,7 +506,7 @@ ConfigurePolygon(
}
if (color == NULL) {
newGC = None;
newGC = NULL;
} else {
gcValues.foreground = color->pixel;
mask = GCForeground;
@@ -518,13 +520,13 @@ ConfigurePolygon(
* Mac OS X CG drawing needs access to the outline linewidth
* even for fills (as linewidth controls antialiasing).
*/
gcValues.line_width = polyPtr->outline.gc != None ?
gcValues.line_width = polyPtr->outline.gc != NULL ?
polyPtr->outline.gc->line_width : 0;
mask |= GCLineWidth;
#endif
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
if (polyPtr->fillGC != None) {
if (polyPtr->fillGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), polyPtr->fillGC);
}
polyPtr->fillGC = newGC;
@@ -562,7 +564,7 @@ ConfigurePolygon(
static void
DeletePolygon(
Tk_Canvas canvas, /* Info about overall canvas widget. */
TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */
Tk_Item *itemPtr, /* Item that is being deleted. */
Display *display) /* Display containing window for canvas. */
{
@@ -590,7 +592,7 @@ DeletePolygon(
if (polyPtr->disabledFillStipple != None) {
Tk_FreeBitmap(display, polyPtr->disabledFillStipple);
}
if (polyPtr->fillGC != None) {
if (polyPtr->fillGC != NULL) {
Tk_FreeGC(display, polyPtr->fillGC);
}
}
@@ -694,7 +696,7 @@ ComputePolygonBbox(
}
}
if (polyPtr->outline.gc != None) {
if (polyPtr->outline.gc != NULL) {
tsoffset = &polyPtr->outline.tsoffset;
if (tsoffset) {
if (tsoffset->flags & TK_OFFSET_INDEX) {
@@ -823,7 +825,7 @@ TkFillPolygon(
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
pointPtr = ckalloc(numPoints * sizeof(XPoint));
pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint));
}
for (i=0, pPtr=pointPtr ; i<numPoints; i+=1, coordPtr+=2, pPtr++) {
@@ -836,11 +838,11 @@ TkFillPolygon(
* allocated.
*/
if (gc != None && numPoints > 3) {
if (gc != NULL && numPoints > 3) {
XFillPolygon(display, drawable, gc, pointPtr, numPoints, Complex,
CoordModeOrigin);
}
if (outlineGC != None) {
if (outlineGC != NULL) {
XDrawLines(display, drawable, outlineGC, pointPtr, numPoints,
CoordModeOrigin);
}
@@ -872,18 +874,19 @@ DisplayPolygon(
Tk_Item *itemPtr, /* Item to be displayed. */
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
int x, int y, int width, int height)
/* Describes region of canvas that must be
* redisplayed (not used). */
TCL_UNUSED(int), /* Describes region of canvas that must be */
TCL_UNUSED(int), /* redisplayed (not used). */
TCL_UNUSED(int),
TCL_UNUSED(int))
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
Tk_State state = itemPtr->state;
Pixmap stipple = polyPtr->fillStipple;
double linewidth = polyPtr->outline.width;
if (((polyPtr->fillGC == None) && (polyPtr->outline.gc == None)) ||
if (((polyPtr->fillGC == NULL) && (polyPtr->outline.gc == NULL)) ||
(polyPtr->numPoints < 1) ||
(polyPtr->numPoints < 3 && polyPtr->outline.gc == None)) {
(polyPtr->numPoints < 3 && polyPtr->outline.gc == NULL)) {
return;
}
@@ -911,7 +914,7 @@ DisplayPolygon(
* reset the offset when done, since the GC is supposed to be read-only.
*/
if ((stipple != None) && (polyPtr->fillGC != None)) {
if ((stipple != None) && (polyPtr->fillGC != NULL)) {
Tk_TSOffset *tsoffset = &polyPtr->tsoffset;
int w = 0, h = 0;
int flags = tsoffset->flags;
@@ -969,15 +972,15 @@ DisplayPolygon(
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
pointPtr = ckalloc(numPoints * sizeof(XPoint));
pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL);
if (polyPtr->fillGC != None) {
if (polyPtr->fillGC != NULL) {
XFillPolygon(display, drawable, polyPtr->fillGC, pointPtr,
numPoints, Complex, CoordModeOrigin);
}
if (polyPtr->outline.gc != None) {
if (polyPtr->outline.gc != NULL) {
XDrawLines(display, drawable, polyPtr->outline.gc, pointPtr,
numPoints, CoordModeOrigin);
}
@@ -986,7 +989,7 @@ DisplayPolygon(
}
}
Tk_ResetOutlineGC(canvas, itemPtr, &polyPtr->outline);
if ((stipple != None) && (polyPtr->fillGC != None)) {
if ((stipple != None) && (polyPtr->fillGC != NULL)) {
XSetTSOrigin(display, polyPtr->fillGC, 0, 0);
}
}
@@ -996,7 +999,7 @@ DisplayPolygon(
*
* PolygonInsert --
*
* Insert coords into a polugon item at a given index.
* Insert coords into a polygon item at a given index.
*
* Results:
* None.
@@ -1036,7 +1039,7 @@ PolygonInsert(
while (beforeThis < 0) {
beforeThis += length;
}
newCoordPtr = ckalloc(sizeof(double) * (length + 2 + objc));
newCoordPtr = (double *)ckalloc(sizeof(double) * (length + 2 + objc));
for (i=0; i<beforeThis; i++) {
newCoordPtr[i] = polyPtr->coordPtr[i];
}
@@ -1238,7 +1241,6 @@ PolygonDeleteCoords(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static double
PolygonToPoint(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1286,7 +1288,7 @@ PolygonToPoint(
if (numPoints <= MAX_STATIC_POINTS) {
polyPoints = staticSpace;
} else {
polyPoints = ckalloc(2 * numPoints * sizeof(double));
polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints);
@@ -1299,7 +1301,7 @@ PolygonToPoint(
if (bestDist <= 0.0) {
goto donepoint;
}
if ((polyPtr->outline.gc != None) && (polyPtr->joinStyle == JoinRound)) {
if ((polyPtr->outline.gc != NULL) && (polyPtr->joinStyle == JoinRound)) {
dist = bestDist - radius;
if (dist <= 0.0) {
bestDist = 0.0;
@@ -1309,7 +1311,7 @@ PolygonToPoint(
}
}
if ((polyPtr->outline.gc == None) || (width <= 1)) {
if ((polyPtr->outline.gc == NULL) || (width <= 1)) {
goto donepoint;
}
@@ -1428,7 +1430,6 @@ PolygonToPoint(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
PolygonToArea(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1495,7 +1496,7 @@ PolygonToArea(
if (numPoints <= MAX_STATIC_POINTS) {
polyPoints = staticSpace;
} else {
polyPoints = ckalloc(2 * numPoints * sizeof(double));
polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints);
@@ -1515,7 +1516,7 @@ PolygonToArea(
goto donearea;
}
if (polyPtr->outline.gc == None) {
if (polyPtr->outline.gc == NULL) {
goto donearea;
}
@@ -1665,7 +1666,7 @@ ScalePolygon(
static int
GetPolygonIndex(
Tcl_Interp *interp, /* Used for error reporting. */
Tk_Canvas canvas, /* Canvas containing item. */
TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */
Tk_Item *itemPtr, /* Item for which the index is being
* specified. */
Tcl_Obj *obj, /* Specification of a particular coord in
@@ -1795,7 +1796,7 @@ PolygonToPostscript(
Tcl_Interp *interp, /* Leave Postscript or error message here. */
Tk_Canvas canvas, /* Information about overall canvas. */
Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
int prepass) /* 1 means this is a prepass to collect font
TCL_UNUSED(int)) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{

View File

@@ -193,7 +193,7 @@ TkCanvPostscriptCmd(
* such.
*/
result = Tcl_EvalEx(interp, "::tk::ensure_psenc_is_loaded", -1, 0);
result = Tcl_EvalEx(interp, "::tk::ensure_psenc_is_loaded", -1, TCL_EVAL_GLOBAL);
if (result != TCL_OK) {
return result;
}
@@ -381,7 +381,7 @@ TkCanvPostscriptCmd(
*/
psInfo.chan = Tcl_GetChannel(interp, psInfo.channelName, &mode);
if (psInfo.chan == (Tcl_Channel) NULL) {
if (psInfo.chan == NULL) {
result = TCL_ERROR;
goto cleanup;
}
@@ -572,7 +572,6 @@ TkCanvPostscriptCmd(
continue;
}
Tcl_ResetResult(interp);
result = itemPtr->typePtr->postscriptProc(interp,
(Tk_Canvas) canvasPtr, itemPtr, 0);
if (result != TCL_OK) {
@@ -585,6 +584,7 @@ TkCanvPostscriptCmd(
Tcl_AppendToObj(psObj, "gsave\n", -1);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
Tcl_AppendToObj(psObj, "grestore\n", -1);
Tcl_ResetResult(interp);
if (psInfo.chan != NULL) {
if (Tcl_WriteObj(psInfo.chan, psObj) == -1) {
@@ -1279,7 +1279,7 @@ TkPostscriptImage(
cdata.colors = ckalloc(sizeof(XColor) * ncolors);
cdata.ncolors = ncolors;
if (visual->class == DirectColor || visual->class == TrueColor) {
if (visual->c_class == DirectColor || visual->c_class == TrueColor) {
cdata.separated = 1;
cdata.red_mask = visual->red_mask;
cdata.green_mask = visual->green_mask;
@@ -1311,7 +1311,7 @@ TkPostscriptImage(
}
}
if (visual->class == StaticGray || visual->class == GrayScale) {
if (visual->c_class == StaticGray || visual->c_class == GrayScale) {
cdata.color = 0;
} else {
cdata.color = 1;
@@ -1601,7 +1601,7 @@ Tk_PostscriptPhoto(
/*
* Generate data for image in monochrome mode. No attempt at
* dithering is made--instead, just set a threshold. To handle
* transparecies we need to output two lines: one for the black
* transparencies we need to output two lines: one for the black
* pixels, one for the white ones.
*/

View File

@@ -107,7 +107,7 @@ static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
NULL, Tk_Offset(TextItem, disabledStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
"black", Tk_Offset(TextItem, color), TK_CONFIG_NULL_OK, NULL},
DEF_CANVITEM_OUTLINE, Tk_Offset(TextItem, color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_FONT, "-font", NULL, NULL,
DEF_CANVTEXT_FONT, Tk_Offset(TextItem, tkfont), 0, NULL},
{TK_CONFIG_JUSTIFY, "-justify", NULL, NULL,
@@ -269,9 +269,9 @@ CreateText(
textPtr->textLayout = NULL;
textPtr->actualWidth = 0;
textPtr->drawOrigin[0] = textPtr->drawOrigin[1] = 0.0;
textPtr->gc = None;
textPtr->selTextGC = None;
textPtr->cursorOffGC = None;
textPtr->gc = NULL;
textPtr->selTextGC = NULL;
textPtr->cursorOffGC = NULL;
textPtr->sine = 0.0;
textPtr->cosine = 1.0;
@@ -447,7 +447,7 @@ ConfigureText(
}
}
newGC = newSelGC = None;
newGC = newSelGC = NULL;
if (textPtr->tkfont != NULL) {
gcValues.font = Tk_FontId(textPtr->tkfont);
mask = GCFont;
@@ -472,11 +472,11 @@ ConfigureText(
}
newSelGC = Tk_GetGC(tkwin, mask|GCForeground, &gcValues);
}
if (textPtr->gc != None) {
if (textPtr->gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->gc);
}
textPtr->gc = newGC;
if (textPtr->selTextGC != None) {
if (textPtr->selTextGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->selTextGC);
}
textPtr->selTextGC = newSelGC;
@@ -491,9 +491,9 @@ ConfigureText(
}
newGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
} else {
newGC = None;
newGC = NULL;
}
if (textPtr->cursorOffGC != None) {
if (textPtr->cursorOffGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->cursorOffGC);
}
textPtr->cursorOffGC = newGC;
@@ -592,13 +592,13 @@ DeleteText(
}
Tk_FreeTextLayout(textPtr->textLayout);
if (textPtr->gc != None) {
if (textPtr->gc != NULL) {
Tk_FreeGC(display, textPtr->gc);
}
if (textPtr->selTextGC != None) {
if (textPtr->selTextGC != NULL) {
Tk_FreeGC(display, textPtr->selTextGC);
}
if (textPtr->cursorOffGC != None) {
if (textPtr->cursorOffGC != NULL) {
Tk_FreeGC(display, textPtr->cursorOffGC);
}
}
@@ -820,7 +820,7 @@ DisplayCanvText(
}
}
if (textPtr->gc == None) {
if (textPtr->gc == NULL) {
return;
}
@@ -932,7 +932,7 @@ DisplayCanvText(
Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable,
textInfoPtr->insertBorder, points, 4,
textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED);
} else if (textPtr->cursorOffGC != None) {
} else if (textPtr->cursorOffGC != NULL) {
/*
* Redraw the background over the area of the cursor, even
* though the cursor is turned off. This guarantees that the
@@ -957,19 +957,23 @@ DisplayCanvText(
*/
if ((selFirstChar >= 0) && (textPtr->selTextGC != textPtr->gc)) {
if (0 < selFirstChar) {
TkDrawAngledTextLayout(display, drawable, textPtr->gc,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
0, selFirstChar);
}
TkDrawAngledTextLayout(display, drawable, textPtr->selTextGC,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
selFirstChar, selLastChar + 1);
if (selLastChar + 1 < textPtr->numChars) {
TkDrawAngledTextLayout(display, drawable, textPtr->gc,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
selLastChar + 1, -1);
selLastChar + 1, textPtr->numChars);
}
} else {
TkDrawAngledTextLayout(display, drawable, textPtr->gc,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
0, -1);
0, textPtr->numChars);
}
TkUnderlineAngledTextLayout(display, drawable, textPtr->gc,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
@@ -1021,14 +1025,14 @@ TextInsert(
if (index > textPtr->numChars) {
index = textPtr->numChars;
}
byteIndex = Tcl_UtfAtIndex(text, index) - text;
byteIndex = TkUtfAtIndex(text, index) - text;
byteCount = strlen(string);
if (byteCount == 0) {
return;
}
newStr = ckalloc(textPtr->numBytes + byteCount + 1);
memcpy(newStr, text, (size_t) byteIndex);
newStr = (char *)ckalloc(textPtr->numBytes + byteCount + 1);
memcpy(newStr, text, byteIndex);
strcpy(newStr + byteIndex, string);
strcpy(newStr + byteIndex + byteCount, text + byteIndex);
@@ -1104,12 +1108,12 @@ TextDeleteChars(
}
charsRemoved = last + 1 - first;
byteIndex = Tcl_UtfAtIndex(text, first) - text;
byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved)
byteIndex = TkUtfAtIndex(text, first) - text;
byteCount = TkUtfAtIndex(text + byteIndex, charsRemoved)
- (text + byteIndex);
newStr = ckalloc(textPtr->numBytes + 1 - byteCount);
memcpy(newStr, text, (size_t) byteIndex);
newStr = (char *)ckalloc(textPtr->numBytes + 1 - byteCount);
memcpy(newStr, text, byteIndex);
strcpy(newStr + byteIndex, text + byteIndex + byteCount);
ckfree(text);
@@ -1263,7 +1267,6 @@ TextToArea(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
ScaleText(
Tk_Canvas canvas, /* Canvas containing rectangle. */
@@ -1334,7 +1337,7 @@ TranslateText(
static int
GetTextIndex(
Tcl_Interp *interp, /* Used for error reporting. */
Tk_Canvas canvas, /* Canvas containing item. */
TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */
Tk_Item *itemPtr, /* Item for which the index is being
* specified. */
Tcl_Obj *obj, /* Specification of a particular character in
@@ -1345,19 +1348,18 @@ GetTextIndex(
TextItem *textPtr = (TextItem *) itemPtr;
int length;
int c;
TkCanvas *canvasPtr = (TkCanvas *) canvas;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
const char *string = Tcl_GetStringFromObj(obj, &length);
c = string[0];
if ((c == 'e') && (strncmp(string, "end", (unsigned) length) == 0)) {
if ((c == 'e') && (strncmp(string, "end", length) == 0)) {
*indexPtr = textPtr->numChars;
} else if ((c == 'i')
&& (strncmp(string, "insert", (unsigned) length) == 0)) {
&& (strncmp(string, "insert", length) == 0)) {
*indexPtr = textPtr->insertPos;
} else if ((c == 's') && (length >= 5)
&& (strncmp(string, "sel.first", (unsigned) length) == 0)) {
&& (strncmp(string, "sel.first", length) == 0)) {
if (textInfoPtr->selItemPtr != itemPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"selection isn't in item", -1));
@@ -1366,7 +1368,7 @@ GetTextIndex(
}
*indexPtr = textInfoPtr->selectFirst;
} else if ((c == 's') && (length >= 5)
&& (strncmp(string, "sel.last", (unsigned) length) == 0)) {
&& (strncmp(string, "sel.last", length) == 0)) {
if (textInfoPtr->selItemPtr != itemPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"selection isn't in item", -1));
@@ -1376,7 +1378,7 @@ GetTextIndex(
*indexPtr = textInfoPtr->selectLast;
} else if (c == '@') {
int x, y;
double tmp, c = textPtr->cosine, s = textPtr->sine;
double tmp, cs = textPtr->cosine, s = textPtr->sine;
char *end;
const char *p;
@@ -1392,10 +1394,10 @@ GetTextIndex(
goto badIndex;
}
y = (int) ((tmp < 0) ? tmp - 0.5 : tmp + 0.5);
x += canvasPtr->scrollX1 - (int) textPtr->drawOrigin[0];
y += canvasPtr->scrollY1 - (int) textPtr->drawOrigin[1];
x -= (int) textPtr->drawOrigin[0];
y -= (int) textPtr->drawOrigin[1];
*indexPtr = Tk_PointToChar(textPtr->textLayout,
(int) (x*c - y*s), (int) (y*c + x*s));
(int) (x*cs - y*s), (int) (y*cs + x*s));
} else if (Tcl_GetIntFromObj(NULL, obj, indexPtr) == TCL_OK) {
if (*indexPtr < 0) {
*indexPtr = 0;
@@ -1432,10 +1434,9 @@ GetTextIndex(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
SetTextCursor(
Tk_Canvas canvas, /* Record describing canvas widget. */
TCL_UNUSED(Tk_Canvas), /* Record describing canvas widget. */
Tk_Item *itemPtr, /* Text item in which cursor position is to be
* set. */
int index) /* Character index of character just before
@@ -1474,7 +1475,7 @@ SetTextCursor(
static int
GetSelText(
Tk_Canvas canvas, /* Canvas containing selection. */
TCL_UNUSED(Tk_Canvas), /* Canvas containing selection. */
Tk_Item *itemPtr, /* Text item containing selection. */
int offset, /* Byte offset within selection of first
* character to be returned. */
@@ -1494,8 +1495,8 @@ GetSelText(
return 0;
}
text = textPtr->text;
selStart = Tcl_UtfAtIndex(text, textInfoPtr->selectFirst);
selEnd = Tcl_UtfAtIndex(selStart,
selStart = TkUtfAtIndex(text, textInfoPtr->selectFirst);
selEnd = TkUtfAtIndex(selStart,
textInfoPtr->selectLast + 1 - textInfoPtr->selectFirst);
byteCount = selEnd - selStart - offset;
if (byteCount > maxBytes) {
@@ -1605,7 +1606,7 @@ TextToPostscript(
Tcl_GetString(Tcl_GetObjResult(interp)));
}
x = 0; y = 0; justify = NULL; /* lint. */
x = 0; y = 0; justify = NULL;
switch (textPtr->anchor) {
case TK_ANCHOR_NW: x = 0; y = 0; break;
case TK_ANCHOR_N: x = 1; y = 0; break;

View File

@@ -12,7 +12,6 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include <assert.h>
/*
* Structures defined only in this file.
@@ -29,15 +28,16 @@ const Tk_SmoothMethod tkBezierSmoothMethod = {
"true",
TkMakeBezierCurve,
(void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr,
int numPoints, int numSteps)) TkMakeBezierPostscript,
int numPoints, int numSteps))(void *)TkMakeBezierPostscript,
};
static const Tk_SmoothMethod tkRawSmoothMethod = {
"raw",
TkMakeRawCurve,
(void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr,
int numPoints, int numSteps)) TkMakeRawCurvePostscript,
int numPoints, int numSteps))(void *)TkMakeRawCurvePostscript,
};
/*
* Function forward-declarations.
*/
@@ -332,7 +332,7 @@ Tk_CanvasSetOffset(
* redisplaying the canvas. */
Tk_TSOffset *offset) /* Offset (may be NULL pointer)*/
{
register TkCanvas *canvasPtr = Canvas(canvas);
TkCanvas *canvasPtr = Canvas(canvas);
int flags = 0;
int x = - canvasPtr->drawableXOrigin;
int y = - canvasPtr->drawableYOrigin;
@@ -406,7 +406,7 @@ Tk_CanvasTagsParseProc(
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item (ignored). */
{
register Tk_Item *itemPtr = (Tk_Item *) widgRec;
Tk_Item *itemPtr = (Tk_Item *) widgRec;
int argc, i;
const char **argv;
Tk_Uid *newPtr;
@@ -474,7 +474,7 @@ Tk_CanvasTagsPrintProc(
* information about how to reclaim storage
* for return string. */
{
register Tk_Item *itemPtr = (Tk_Item *) widgRec;
Tk_Item *itemPtr = (Tk_Item *) widgRec;
if (itemPtr->numTags == 0) {
*freeProcPtr = NULL;
@@ -733,7 +733,7 @@ TkSmoothParseProc(
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item. */
{
register const Tk_SmoothMethod **smoothPtr =
const Tk_SmoothMethod **smoothPtr =
(const Tk_SmoothMethod **) (widgRec + offset);
const Tk_SmoothMethod *smooth = NULL;
int b;
@@ -756,7 +756,7 @@ TkSmoothParseProc(
}
/*
* Backward compatability hack.
* Backward compatibility hack.
*/
if (strncmp(value, "bezier", length) == 0) {
@@ -826,7 +826,7 @@ TkSmoothPrintProc(
* information about how to reclaim storage
* for return string. */
{
register const Tk_SmoothMethod *smoothPtr =
const Tk_SmoothMethod *smoothPtr =
* (Tk_SmoothMethod **) (widgRec + offset);
return smoothPtr ? smoothPtr->name : "0";
@@ -961,7 +961,7 @@ void
Tk_CreateOutline(
Tk_Outline *outline) /* Outline structure to be filled in. */
{
outline->gc = None;
outline->gc = NULL;
outline->width = 1.0;
outline->activeWidth = 0.0;
outline->disabledWidth = 0.0;
@@ -1002,7 +1002,7 @@ Tk_DeleteOutline(
Display *display, /* Display containing window. */
Tk_Outline *outline)
{
if (outline->gc != None) {
if (outline->gc != NULL) {
Tk_FreeGC(display, outline->gc);
}
if ((unsigned) ABS(outline->dash.number) > sizeof(char *)) {

View File

@@ -85,7 +85,7 @@ static void TranslateWinItem(Tk_Canvas canvas,
static int WinItemCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
Tcl_Obj *const objv[]);
static void WinItemLostSlaveProc(ClientData clientData,
static void WinItemLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void WinItemRequestProc(ClientData clientData,
Tk_Window tkwin);
@@ -141,7 +141,7 @@ Tk_ItemType tkWindowType = {
static const Tk_GeomMgr canvasGeomType = {
"canvas", /* name */
WinItemRequestProc, /* requestProc */
WinItemLostSlaveProc, /* lostSlaveProc */
WinItemLostContentProc, /* lostSlaveProc */
};
/*
@@ -1053,26 +1053,26 @@ WinItemRequestProc(
/*
*--------------------------------------------------------------
*
* WinItemLostSlaveProc --
* WinItemLostContentProc --
*
* This function is invoked by Tk whenever some other geometry claims
* control over a slave that used to be managed by us.
* control over a content window that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
* Forgets all canvas-related information about the slave.
* Forgets all canvas-related information about the content window.
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static void
WinItemLostSlaveProc(
ClientData clientData, /* WindowItem structure for slave window that
WinItemLostContentProc(
ClientData clientData, /* WindowItem structure for content window that
* was stolen away. */
Tk_Window tkwin) /* Tk's handle for the slave window. */
Tk_Window tkwin) /* Tk's handle for the content window. */
{
WindowItem *winItemPtr = clientData;
Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas);

View File

@@ -517,7 +517,7 @@ ItemDisplay(
canvasPtr->display, pixmap, screenX1, screenY1, width, height);
}
static inline int
static int
ItemIndex(
TkCanvas *canvasPtr,
Tk_Item *itemPtr,
@@ -638,7 +638,7 @@ Tk_CanvasObjCmd(
int argc, /* Number of arguments. */
Tcl_Obj *const argv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
TkCanvas *canvasPtr;
Tk_Window newWin;
@@ -662,7 +662,7 @@ Tk_CanvasObjCmd(
* pointers).
*/
canvasPtr = ckalloc(sizeof(TkCanvas));
canvasPtr = (TkCanvas *)ckalloc(sizeof(TkCanvas));
canvasPtr->tkwin = newWin;
canvasPtr->display = Tk_Display(newWin);
canvasPtr->interp = interp;
@@ -678,7 +678,7 @@ Tk_CanvasObjCmd(
canvasPtr->highlightBgColorPtr = NULL;
canvasPtr->highlightColorPtr = NULL;
canvasPtr->inset = 0;
canvasPtr->pixmapGC = None;
canvasPtr->pixmapGC = NULL;
canvasPtr->width = None;
canvasPtr->height = None;
canvasPtr->confine = 0;
@@ -698,7 +698,7 @@ Tk_CanvasObjCmd(
canvasPtr->textInfo.cursorOn = 0;
canvasPtr->insertOnTime = 0;
canvasPtr->insertOffTime = 0;
canvasPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
canvasPtr->insertBlinkHandler = NULL;
canvasPtr->xOrigin = canvasPtr->yOrigin = 0;
canvasPtr->drawableXOrigin = canvasPtr->drawableYOrigin = 0;
canvasPtr->bindingTable = NULL;
@@ -724,7 +724,7 @@ Tk_CanvasObjCmd(
canvasPtr->scanYOrigin = 0;
canvasPtr->hotPtr = NULL;
canvasPtr->hotPrevPtr = NULL;
canvasPtr->cursor = None;
canvasPtr->cursor = NULL;
canvasPtr->takeFocus = NULL;
canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(newWin));
canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(newWin));
@@ -788,7 +788,7 @@ CanvasWidgetCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
TkCanvas *canvasPtr = clientData;
TkCanvas *canvasPtr = (TkCanvas *)clientData;
int c, result;
Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent
* compiler warning. */
@@ -835,7 +835,7 @@ CanvasWidgetCmd(
Tcl_Preserve(canvasPtr);
result = TCL_OK;
switch ((enum options) index) {
switch ((enum options)index) {
case CANV_ADDTAG:
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tag searchCommand ?arg ...?");
@@ -897,7 +897,7 @@ CanvasWidgetCmd(
break;
}
case CANV_BIND: {
ClientData object;
void *object;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?sequence? ?command?");
@@ -948,9 +948,9 @@ CanvasWidgetCmd(
Tcl_HashEntry *entryPtr;
entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable,
(char *) INT2PTR(searchPtr->id));
INT2PTR(searchPtr->id));
if (entryPtr != NULL) {
itemPtr = Tcl_GetHashValue(entryPtr);
itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr);
object = itemPtr;
}
@@ -977,7 +977,7 @@ CanvasWidgetCmd(
if (objc == 5) {
int append = 0;
unsigned long mask;
unsigned int mask;
const char *argv4 = Tcl_GetString(objv[4]);
if (argv4[0] == 0) {
@@ -1027,7 +1027,7 @@ CanvasWidgetCmd(
result = TCL_ERROR;
goto done;
}
if (mask & (unsigned) ~(ButtonMotionMask|Button1MotionMask
if (mask & ~(ButtonMotionMask|Button1MotionMask
|Button2MotionMask|Button3MotionMask|Button4MotionMask
|Button5MotionMask|ButtonPressMask|ButtonReleaseMask
|EnterWindowMask|LeaveWindowMask|KeyPressMask
@@ -1185,7 +1185,6 @@ CanvasWidgetCmd(
tmpObj = Tcl_NewListObj(2, objv+4);
FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) {
int index;
int x1, x2, y1, y2;
int dontRedraw1, dontRedraw2;
@@ -1238,7 +1237,6 @@ CanvasWidgetCmd(
case CANV_CREATE: {
Tk_ItemType *typePtr;
Tk_ItemType *matchPtr = NULL;
Tk_Item *itemPtr;
int isNew = 0;
Tcl_HashEntry *entryPtr;
const char *arg;
@@ -1297,9 +1295,8 @@ CanvasWidgetCmd(
}
typePtr = matchPtr;
itemPtr = ckalloc(typePtr->itemSize);
itemPtr->id = canvasPtr->nextId;
canvasPtr->nextId++;
itemPtr = (Tk_Item *)ckalloc(typePtr->itemSize);
itemPtr->id = canvasPtr->nextId++;
itemPtr->tagPtr = itemPtr->staticTagSpace;
itemPtr->tagSpace = TK_TAG_SPACE;
itemPtr->numTags = 0;
@@ -1315,7 +1312,7 @@ CanvasWidgetCmd(
itemPtr->nextPtr = NULL;
entryPtr = Tcl_CreateHashEntry(&canvasPtr->idTable,
(char *) INT2PTR(itemPtr->id), &isNew);
INT2PTR(itemPtr->id), &isNew);
Tcl_SetHashValue(entryPtr, itemPtr);
itemPtr->prevPtr = canvasPtr->lastItemPtr;
canvasPtr->hotPtr = itemPtr;
@@ -1394,7 +1391,7 @@ CanvasWidgetCmd(
ckfree(itemPtr->tagPtr);
}
entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable,
(char *) INT2PTR(itemPtr->id));
INT2PTR(itemPtr->id));
Tcl_DeleteHashEntry(entryPtr);
if (itemPtr->nextPtr != NULL) {
itemPtr->nextPtr->prevPtr = itemPtr->prevPtr;
@@ -1451,8 +1448,21 @@ CanvasWidgetCmd(
FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
for (i = itemPtr->numTags-1; i >= 0; i--) {
if (itemPtr->tagPtr[i] == tag) {
itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1];
/*
* Don't shuffle the tags sequence: memmove the tags.
*/
memmove((void *)(itemPtr->tagPtr + i),
itemPtr->tagPtr + i + 1,
(itemPtr->numTags - (i+1)) * sizeof(Tk_Uid));
itemPtr->numTags--;
/*
* There must be no break here: all tags with the same name must
* be deleted.
*/
}
}
}
@@ -1518,7 +1528,6 @@ CanvasWidgetCmd(
}
break;
case CANV_ICURSOR: {
int index;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId index");
@@ -1543,7 +1552,6 @@ CanvasWidgetCmd(
break;
}
case CANV_INDEX: {
int index;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId string");
@@ -1643,7 +1651,6 @@ CanvasWidgetCmd(
}
break;
case CANV_LOWER: {
Tk_Item *itemPtr;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?belowThis?");
@@ -1928,7 +1935,7 @@ CanvasWidgetCmd(
break;
}
case CANV_SELECT: {
int index, optionindex;
int optionindex;
static const char *const optionStrings[] = {
"adjust", "clear", "from", "item", "to", NULL
};
@@ -2189,7 +2196,7 @@ DestroyCanvas(
*/
Tcl_DeleteHashTable(&canvasPtr->idTable);
if (canvasPtr->pixmapGC != None) {
if (canvasPtr->pixmapGC != NULL) {
Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC);
}
#ifndef USE_OLD_TAG_SEARCH
@@ -2265,7 +2272,7 @@ ConfigureCanvas(
gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel;
newGC = Tk_GetGC(canvasPtr->tkwin,
GCFunction|GCGraphicsExposures|GCForeground, &gcValues);
if (canvasPtr->pixmapGC != None) {
if (canvasPtr->pixmapGC != NULL) {
Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC);
}
canvasPtr->pixmapGC = newGC;
@@ -2400,7 +2407,7 @@ static void
CanvasWorldChanged(
ClientData instanceData) /* Information about widget. */
{
TkCanvas *canvasPtr = instanceData;
TkCanvas *canvasPtr = (TkCanvas *)instanceData;
Tk_Item *itemPtr;
itemPtr = canvasPtr->firstItemPtr;
@@ -2438,11 +2445,15 @@ static void
DisplayCanvas(
ClientData clientData) /* Information about widget. */
{
TkCanvas *canvasPtr = clientData;
TkCanvas *canvasPtr = (TkCanvas *)clientData;
Tk_Window tkwin = canvasPtr->tkwin;
Tk_Item *itemPtr;
Pixmap pixmap;
int screenX1, screenX2, screenY1, screenY2, width, height;
#ifdef MAC_OSX_TK
TkWindow *winPtr;
MacDrawable *macWin;
#endif
if (canvasPtr->tkwin == NULL) {
return;
@@ -2457,8 +2468,8 @@ DisplayCanvas(
* If drawing is disabled, all we need to do is
* clear the REDRAW_PENDING flag.
*/
TkWindow *winPtr = (TkWindow *)(canvasPtr->tkwin);
MacDrawable *macWin = winPtr->privatePtr;
winPtr = (TkWindow *)(canvasPtr->tkwin);
macWin = winPtr->privatePtr;
if (macWin && (macWin->flags & TK_DO_NOT_DRAW)){
canvasPtr->flags &= ~REDRAW_PENDING;
return;
@@ -2692,7 +2703,7 @@ CanvasEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
TkCanvas *canvasPtr = clientData;
TkCanvas *canvasPtr = (TkCanvas *)clientData;
if (eventPtr->type == Expose) {
int x, y;
@@ -2782,7 +2793,7 @@ static void
CanvasCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
TkCanvas *canvasPtr = clientData;
TkCanvas *canvasPtr = (TkCanvas *)clientData;
Tk_Window tkwin = canvasPtr->tkwin;
/*
@@ -2889,7 +2900,7 @@ EventuallyRedrawItem(
Tk_Item *itemPtr) /* Item to be redrawn. May be NULL, in which
* case nothing happens. */
{
if (itemPtr == NULL) {
if (itemPtr == NULL || canvasPtr->tkwin == NULL) {
return;
}
if ((itemPtr->x1 >= itemPtr->x2) || (itemPtr->y1 >= itemPtr->y2) ||
@@ -3274,7 +3285,7 @@ NextItem(
static SearchUids *
GetStaticUids(void)
{
SearchUids *searchUids =
SearchUids *searchUids = (SearchUids *)
Tcl_GetThreadData(&dataKey, sizeof(SearchUids));
if (searchUids->allUid == NULL) {
@@ -3313,7 +3324,7 @@ TagSearchExprInit(
TagSearchExpr *expr = *exprPtrPtr;
if (expr == NULL) {
expr = ckalloc(sizeof(TagSearchExpr));
expr = (TagSearchExpr *)ckalloc(sizeof(TagSearchExpr));
expr->allocated = 0;
expr->uids = NULL;
expr->next = NULL;
@@ -3394,7 +3405,7 @@ TagSearchScan(
* Allocate primary search struct on first call.
*/
*searchPtrPtr = searchPtr = ckalloc(sizeof(TagSearch));
*searchPtrPtr = searchPtr = (TagSearch *)ckalloc(sizeof(TagSearch));
searchPtr->expr = NULL;
/*
@@ -3402,7 +3413,7 @@ TagSearchScan(
*/
searchPtr->rewritebufferAllocated = 100;
searchPtr->rewritebuffer = ckalloc(searchPtr->rewritebufferAllocated);
searchPtr->rewritebuffer = (char *)ckalloc(searchPtr->rewritebufferAllocated);
}
TagSearchExprInit(&searchPtr->expr);
@@ -3419,7 +3430,7 @@ TagSearchScan(
if ((unsigned) searchPtr->stringLength >=
searchPtr->rewritebufferAllocated) {
searchPtr->rewritebufferAllocated = searchPtr->stringLength + 100;
searchPtr->rewritebuffer =
searchPtr->rewritebuffer = (char *)
ckrealloc(searchPtr->rewritebuffer,
searchPtr->rewritebufferAllocated);
}
@@ -3602,10 +3613,10 @@ TagSearchScanExpr(
if (expr->index >= expr->allocated-1) {
expr->allocated += 15;
if (expr->uids) {
expr->uids = ckrealloc(expr->uids,
expr->uids = (Tk_Uid *)ckrealloc(expr->uids,
expr->allocated * sizeof(Tk_Uid));
} else {
expr->uids = ckalloc(expr->allocated * sizeof(Tk_Uid));
expr->uids = (Tk_Uid *)ckalloc(expr->allocated * sizeof(Tk_Uid));
}
}
@@ -4015,9 +4026,9 @@ TagSearchFirst(
if ((itemPtr == NULL) || (itemPtr->id != searchPtr->id)
|| (lastPtr == NULL) || (lastPtr->nextPtr != itemPtr)) {
entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable,
(char *) INT2PTR(searchPtr->id));
INT2PTR(searchPtr->id));
if (entryPtr != NULL) {
itemPtr = Tcl_GetHashValue(entryPtr);
itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr);
lastPtr = itemPtr->prevPtr;
} else {
lastPtr = itemPtr = NULL;
@@ -4236,7 +4247,7 @@ DoItem(
Tk_Uid *newTagPtr;
itemPtr->tagSpace += 5;
newTagPtr = ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
newTagPtr = (Tk_Uid *)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
memcpy((void *) newTagPtr, itemPtr->tagPtr,
itemPtr->numTags * sizeof(Tk_Uid));
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
@@ -4746,8 +4757,8 @@ CanvasBindProc(
ClientData clientData, /* Pointer to canvas structure. */
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkCanvas *canvasPtr = clientData;
int mask;
TkCanvas *canvasPtr = (TkCanvas *)clientData;
unsigned mask;
Tcl_Preserve(canvasPtr);
@@ -4760,26 +4771,7 @@ CanvasBindProc(
switch (eventPtr->type) {
case ButtonPress:
case ButtonRelease:
switch (eventPtr->xbutton.button) {
case Button1:
mask = Button1Mask;
break;
case Button2:
mask = Button2Mask;
break;
case Button3:
mask = Button3Mask;
break;
case Button4:
mask = Button4Mask;
break;
case Button5:
mask = Button5Mask;
break;
default:
mask = 0;
break;
}
mask = TkGetButtonMask(eventPtr->xbutton.button);
/*
* For button press events, repick the current item using the button
@@ -4862,7 +4854,7 @@ PickCurrentItem(
* ButtonRelease, or MotionNotify. */
{
double coords[2];
int buttonDown;
unsigned int buttonDown;
Tk_Item *prevItemPtr;
#ifndef USE_OLD_TAG_SEARCH
SearchUids *searchUids = GetStaticUids();
@@ -4875,8 +4867,7 @@ PickCurrentItem(
* for windows.
*/
buttonDown = canvasPtr->state
& (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask);
buttonDown = canvasPtr->state & ALL_BUTTONS;
/*
* Save information about this event in the canvas. The event in the
@@ -4995,7 +4986,9 @@ PickCurrentItem(
if (itemPtr->tagPtr[i] == searchUids->currentUid)
#endif /* USE_OLD_TAG_SEARCH */
/* then */ {
itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1];
memmove((void *)(itemPtr->tagPtr + i),
itemPtr->tagPtr + i + 1,
(itemPtr->numTags - (i+1)) * sizeof(Tk_Uid));
itemPtr->numTags--;
break;
}
@@ -5128,8 +5121,8 @@ CanvasDoEvent(
* processed. */
{
#define NUM_STATIC 3
ClientData staticObjects[NUM_STATIC];
ClientData *objectPtr;
void *staticObjects[NUM_STATIC];
void **objectPtr;
int numObjects, i;
Tk_Item *itemPtr;
#ifndef USE_OLD_TAG_SEARCH
@@ -5255,7 +5248,7 @@ static void
CanvasBlinkProc(
ClientData clientData) /* Pointer to record describing entry. */
{
TkCanvas *canvasPtr = clientData;
TkCanvas *canvasPtr = (TkCanvas *)clientData;
if (!canvasPtr->textInfo.gotFocus || (canvasPtr->insertOffTime == 0)) {
return;
@@ -5307,7 +5300,7 @@ CanvasFocusProc(
} else {
canvasPtr->textInfo.gotFocus = 0;
canvasPtr->textInfo.cursorOn = 0;
canvasPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
canvasPtr->insertBlinkHandler = NULL;
}
EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.focusItemPtr);
if (canvasPtr->highlightWidth > 0) {
@@ -5411,7 +5404,7 @@ CanvasFetchSelection(
* not including terminating NULL
* character. */
{
TkCanvas *canvasPtr = clientData;
TkCanvas *canvasPtr = (TkCanvas *)clientData;
return ItemSelection(canvasPtr, canvasPtr->textInfo.selItemPtr, offset,
buffer, maxBytes);
@@ -5439,7 +5432,7 @@ static void
CanvasLostSelection(
ClientData clientData) /* Information about entry widget. */
{
TkCanvas *canvasPtr = clientData;
TkCanvas *canvasPtr = (TkCanvas *)clientData;
EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.selItemPtr);
canvasPtr->textInfo.selItemPtr = NULL;
@@ -5561,8 +5554,8 @@ CanvasUpdateScrollbars(
Tcl_DString buf;
/*
* Save all the relevant values from the canvasPtr, because it might be
* deleted as part of either of the two calls to Tcl_VarEval below.
* Preserve the relevant values from the canvasPtr, because it might be
* deleted as part of either of the two calls to Tcl_EvalEx below.
*/
interp = canvasPtr->interp;
@@ -5593,7 +5586,7 @@ CanvasUpdateScrollbars(
Tcl_DStringAppend(&buf, xScrollCmd, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, Tcl_GetString(fractions), -1);
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
Tcl_DecrRefCount(fractions);
if (result != TCL_OK) {
@@ -5611,7 +5604,7 @@ CanvasUpdateScrollbars(
Tcl_DStringAppend(&buf, yScrollCmd, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, Tcl_GetString(fractions), -1);
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
Tcl_DecrRefCount(fractions);
if (result != TCL_OK) {
@@ -5768,19 +5761,18 @@ CanvasSetOrigin(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static const char **
TkGetStringsFromObjs(
int objc,
Tcl_Obj *const objv[])
{
register int i;
int i;
const char **argv;
if (objc <= 0) {
return NULL;
}
argv = ckalloc((objc+1) * sizeof(char *));
argv = (const char **)ckalloc((objc+1) * sizeof(char *));
for (i = 0; i < objc; i++) {
argv[i] = Tcl_GetString(objv[i]);
}

View File

@@ -206,7 +206,7 @@ typedef struct TkCanvas {
* Miscellaneous information:
*/
Tk_Cursor cursor; /* Current cursor for window, or None. */
Tk_Cursor cursor; /* Current cursor for window, or NULL. */
char *takeFocus; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal
* scripts. Malloc'ed, but may be NULL. */

View File

@@ -56,7 +56,7 @@ ClipboardHandler(
char *buffer, /* Place to store converted selection. */
int maxBytes) /* Maximum # of bytes to store at buffer. */
{
TkClipboardTarget *targetPtr = clientData;
TkClipboardTarget *targetPtr = (TkClipboardTarget *)clientData;
TkClipboardBuffer *cbPtr;
char *srcPtr, *destPtr;
size_t count = 0;
@@ -134,21 +134,22 @@ ClipboardAppHandler(
char *buffer, /* Place to store converted selection. */
int maxBytes) /* Maximum # of bytes to store at buffer. */
{
TkDisplay *dispPtr = clientData;
size_t length;
TkDisplay *dispPtr = (TkDisplay *)clientData;
int length;
const char *p;
p = dispPtr->clipboardAppPtr->winPtr->nameUid;
length = strlen(p);
length -= offset;
if (length <= 0) {
if (length <= offset) {
return 0;
}
if (length > (size_t) maxBytes) {
length -= offset;
if (length > maxBytes) {
length = maxBytes;
}
strncpy(buffer, p, length);
return (int)length;
memcpy(buffer, p, length);
buffer[length] = 0;
return length;
}
/*
@@ -172,11 +173,11 @@ ClipboardAppHandler(
static int
ClipboardWindowHandler(
ClientData clientData, /* Not used. */
int offset, /* Return selection bytes starting at this
TCL_UNUSED(void *), /* Not used. */
TCL_UNUSED(int), /* Return selection bytes starting at this
* offset. */
char *buffer, /* Place to store converted selection. */
int maxBytes) /* Maximum # of bytes to store at buffer. */
TCL_UNUSED(int)) /* Maximum # of bytes to store at buffer. */
{
buffer[0] = '.';
buffer[1] = 0;
@@ -205,7 +206,7 @@ static void
ClipboardLostSel(
ClientData clientData) /* Pointer to TkDisplay structure. */
{
TkDisplay *dispPtr = clientData;
TkDisplay *dispPtr = (TkDisplay *)clientData;
dispPtr->clipboardActive = 0;
}
@@ -358,7 +359,7 @@ Tk_ClipboardAppend(
}
}
if (targetPtr == NULL) {
targetPtr = ckalloc(sizeof(TkClipboardTarget));
targetPtr = (TkClipboardTarget *)ckalloc(sizeof(TkClipboardTarget));
targetPtr->type = type;
targetPtr->format = format;
targetPtr->firstBufferPtr = targetPtr->lastBufferPtr = NULL;
@@ -380,7 +381,7 @@ Tk_ClipboardAppend(
* Append a new buffer to the buffer chain.
*/
cbPtr = ckalloc(sizeof(TkClipboardBuffer));
cbPtr = (TkClipboardBuffer *)ckalloc(sizeof(TkClipboardBuffer));
cbPtr->nextPtr = NULL;
if (targetPtr->lastBufferPtr != NULL) {
targetPtr->lastBufferPtr->nextPtr = cbPtr;
@@ -390,7 +391,7 @@ Tk_ClipboardAppend(
targetPtr->lastBufferPtr = cbPtr;
cbPtr->length = strlen(buffer);
cbPtr->buffer = ckalloc(cbPtr->length + 1);
cbPtr->buffer = (char *)ckalloc(cbPtr->length + 1);
strcpy(cbPtr->buffer, buffer);
TkSelUpdateClipboard((TkWindow *) dispPtr->clipWindow, targetPtr);
@@ -422,7 +423,7 @@ Tk_ClipboardObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
Tk_Window tkwin = (Tk_Window) clientData;
Tk_Window tkwin = (Tk_Window)clientData;
const char *path = NULL;
Atom selection;
static const char *const optionStrings[] = { "append", "clear", "get", NULL };
@@ -635,8 +636,8 @@ Tk_ClipboardObjCmd(
int
TkClipInit(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
register TkDisplay *dispPtr)/* Display to initialize. */
TCL_UNUSED(Tcl_Interp *), /* Interpreter to use for error reporting. */
TkDisplay *dispPtr)/* Display to initialize. */
{
XSetWindowAttributes atts;
@@ -699,16 +700,21 @@ TkClipInit(
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
ClipboardGetProc(
ClientData clientData, /* Dynamic string holding partially assembled
* selection. */
Tcl_Interp *interp, /* Interpreter used for error reporting (not
TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not
* used). */
const char *portion) /* New information to be appended. */
{
Tcl_DStringAppend((Tcl_DString *) clientData, portion, -1);
Tcl_Encoding utf8 = Tcl_GetEncoding(NULL, "utf-8");
Tcl_DString ds;
Tcl_ExternalToUtfDString(utf8, portion, -1, &ds);
Tcl_DStringAppend((Tcl_DString *) clientData, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
Tcl_FreeEncoding(utf8);
return TCL_OK;
}

View File

@@ -99,7 +99,7 @@ Tk_BellObjCmd(
"-displayof", "-nice", NULL
};
enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE };
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
int i, index, nice = 0;
Tk_ErrorHandler handler;
@@ -134,7 +134,7 @@ Tk_BellObjCmd(
if (!nice) {
XForceScreenSaver(Tk_Display(tkwin), ScreenSaverReset);
}
XFlush(Tk_Display(tkwin));
(void)XFlush(Tk_Display(tkwin));
Tk_DeleteErrorHandler(handler);
return TCL_OK;
}
@@ -163,7 +163,7 @@ Tk_BindObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
TkWindow *winPtr;
ClientData object;
const char *string;
@@ -187,7 +187,7 @@ Tk_BindObjCmd(
}
object = (ClientData) winPtr->pathName;
} else {
winPtr = clientData;
winPtr = (TkWindow *)clientData;
object = (ClientData) Tk_GetUid(string);
}
@@ -285,10 +285,10 @@ TkBindEventProc(
*/
if (winPtr->numTags > MAX_OBJS) {
objPtr = ckalloc(winPtr->numTags * sizeof(ClientData));
objPtr = (void **)ckalloc(winPtr->numTags * sizeof(void *));
}
for (i = 0; i < winPtr->numTags; i++) {
p = winPtr->tagPtr[i];
p = (const char *)winPtr->tagPtr[i];
if (*p == '.') {
hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p);
if (hPtr != NULL) {
@@ -347,7 +347,7 @@ Tk_BindtagsObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
TkWindow *winPtr, *winPtr2;
int i, length;
const char *p;
@@ -399,7 +399,7 @@ Tk_BindtagsObjCmd(
}
winPtr->numTags = length;
winPtr->tagPtr = ckalloc(length * sizeof(ClientData));
winPtr->tagPtr = (void **)ckalloc(length * sizeof(void *));
for (i = 0; i < length; i++) {
p = Tcl_GetString(tags[i]);
if (p[0] == '.') {
@@ -412,7 +412,7 @@ Tk_BindtagsObjCmd(
* is one.
*/
copy = ckalloc(strlen(p) + 1);
copy = (char *)ckalloc(strlen(p) + 1);
strcpy(copy, p);
winPtr->tagPtr[i] = (ClientData) copy;
} else {
@@ -448,7 +448,7 @@ TkFreeBindingTags(
const char *p;
for (i = 0; i < winPtr->numTags; i++) {
p = winPtr->tagPtr[i];
p = (const char *)winPtr->tagPtr[i];
if (*p == '.') {
/*
* Names starting with "." are malloced rather than Uids, so they
@@ -488,7 +488,7 @@ Tk_DestroyObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window window;
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
int i;
for (i = 1; i < objc; i++) {
@@ -527,7 +527,6 @@ Tk_DestroyObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tk_LowerObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
@@ -535,7 +534,7 @@ Tk_LowerObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window mainwin = clientData;
Tk_Window mainwin = (Tk_Window)clientData;
Tk_Window tkwin, other;
if ((objc != 2) && (objc != 3)) {
@@ -587,7 +586,6 @@ Tk_LowerObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tk_RaiseObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
@@ -595,7 +593,7 @@ Tk_RaiseObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window mainwin = clientData;
Tk_Window mainwin = (Tk_Window)clientData;
Tk_Window tkwin, other;
if ((objc != 2) && (objc != 3)) {
@@ -683,7 +681,7 @@ AppnameCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
TkWindow *winPtr;
const char *string;
@@ -715,7 +713,7 @@ CaretCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
int index;
Tcl_Obj *objPtr;
TkCaret *caretPtr;
@@ -807,7 +805,7 @@ ScalingCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
Screen *screenPtr;
int skip, width, height;
double d;
@@ -858,7 +856,7 @@ UseinputmethodsCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
TkDisplay *dispPtr;
int skip;
@@ -906,7 +904,7 @@ UseinputmethodsCmd(
int
WindowingsystemCmd(
ClientData clientData, /* Main window associated with interpreter. */
TCL_UNUSED(void *), /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -935,7 +933,7 @@ InactiveCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
int skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
if (skip < 0) {
@@ -991,7 +989,6 @@ InactiveCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tk_TkwaitObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
@@ -999,7 +996,7 @@ Tk_TkwaitObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
int done, index;
int code = TCL_OK;
static const char *const optionStrings[] = {
@@ -1120,28 +1117,28 @@ Tk_TkwaitObjCmd(
return code;
}
/* ARGSUSED */
static char *
WaitVariableProc(
ClientData clientData, /* Pointer to integer to set to 1. */
Tcl_Interp *interp, /* Interpreter containing variable. */
const char *name1, /* Name of variable. */
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
TCL_UNUSED(const char *), /* Second part of variable name. */
TCL_UNUSED(int)) /* Information about what happened. */
{
int *donePtr = clientData;
int *donePtr = (int *)clientData;
*donePtr = 1;
Tcl_UntraceVar(interp, name1, TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
WaitVariableProc, clientData);
return NULL;
}
/*ARGSUSED*/
static void
WaitVisibilityProc(
ClientData clientData, /* Pointer to integer to set to 1. */
XEvent *eventPtr) /* Information about event (not used). */
{
int *donePtr = clientData;
int *donePtr = (int *)clientData;
if (eventPtr->type == VisibilityNotify) {
*donePtr = 1;
@@ -1155,7 +1152,7 @@ WaitWindowProc(
ClientData clientData, /* Pointer to integer to set to 1. */
XEvent *eventPtr) /* Information about event. */
{
int *donePtr = clientData;
int *donePtr = (int *)clientData;
if (eventPtr->type == DestroyNotify) {
*donePtr = 1;
@@ -1179,10 +1176,9 @@ WaitWindowProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tk_UpdateObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
TCL_UNUSED(void *), /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1285,10 +1281,10 @@ Tk_WinfoObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int index, x, y, width, height, useX, useY, class, skip;
int index, x, y, width, height, useX, useY, c_class, skip;
const char *string;
TkWindow *winPtr;
Tk_Window tkwin = clientData;
Tk_Window tkwin = (Tk_Window)clientData;
static const TkStateMap visualMap[] = {
{PseudoColor, "pseudocolor"},
@@ -1496,7 +1492,7 @@ Tk_WinfoObjCmd(
Tcl_NewIntObj(WidthMMOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENVISUAL:
class = DefaultVisualOfScreen(Tk_Screen(tkwin))->class;
c_class = DefaultVisualOfScreen(Tk_Screen(tkwin))->c_class;
goto visual;
case WIN_SERVER:
TkGetServerInfo(interp, tkwin);
@@ -1524,10 +1520,10 @@ Tk_WinfoObjCmd(
break;
}
case WIN_VISUAL:
class = Tk_Visual(tkwin)->class;
c_class = Tk_Visual(tkwin)->c_class;
visual:
string = TkFindStateString(visualMap, class);
string = TkFindStateString(visualMap, c_class);
if (string == NULL) {
string = "unknown";
}
@@ -1579,11 +1575,11 @@ Tk_WinfoObjCmd(
objv += skip;
string = Tcl_GetString(objv[2]);
Tcl_SetObjResult(interp,
Tcl_NewLongObj((long) Tk_InternAtom(tkwin, string)));
Tcl_NewWideIntObj(Tk_InternAtom(tkwin, string)));
break;
case WIN_ATOMNAME: {
const char *name;
long id;
Tcl_WideInt id;
skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
if (skip < 0) {
@@ -1594,7 +1590,7 @@ Tk_WinfoObjCmd(
return TCL_ERROR;
}
objv += skip;
if (Tcl_GetLongFromObj(interp, objv[2], &id) != TCL_OK) {
if (Tcl_GetWideIntFromObj(interp, objv[2], &id) != TCL_OK) {
return TCL_ERROR;
}
name = Tk_GetAtomName(tkwin, (Atom) id);
@@ -1748,7 +1744,23 @@ Tk_WinfoObjCmd(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin) != TCL_OK) {
return TCL_ERROR;
}
#ifdef TK_HAS_DYNAMIC_COLORS
/*
* Make sure that the TkColor used for the winfo rgb command is
* destroyed when we are through with it, so we do not get stale RGB
* values next time.
*/
{
Colormap temp = Tk_Colormap(tkwin);
Tk_Colormap(tkwin) = TK_DYNAMIC_COLORMAP;
colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3]));
Tk_Colormap(tkwin) = temp;
}
#else
colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3]));
#endif
if (colorPtr == NULL) {
return TCL_ERROR;
}
@@ -1758,7 +1770,7 @@ Tk_WinfoObjCmd(
break;
}
case WIN_VISUALSAVAILABLE: {
XVisualInfo template, *visInfoPtr;
XVisualInfo templ, *visInfoPtr;
int count, i;
int includeVisualId;
Tcl_Obj *strPtr, *resultPtr;
@@ -1779,9 +1791,9 @@ Tk_WinfoObjCmd(
return TCL_ERROR;
}
template.screen = Tk_ScreenNumber(tkwin);
templ.screen = Tk_ScreenNumber(tkwin);
visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualScreenMask,
&template, &count);
&templ, &count);
if (visInfoPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't find any visuals for screen", -1));
@@ -1790,15 +1802,15 @@ Tk_WinfoObjCmd(
}
resultPtr = Tcl_NewObj();
for (i = 0; i < count; i++) {
string = TkFindStateString(visualMap, visInfoPtr[i].class);
string = TkFindStateString(visualMap, visInfoPtr[i].c_class);
if (string == NULL) {
strcpy(buf, "unknown");
} else {
sprintf(buf, "%s %d", string, visInfoPtr[i].depth);
}
if (includeVisualId) {
sprintf(visualIdString, " 0x%x",
(unsigned) visInfoPtr[i].visualid);
sprintf(visualIdString, " 0x%lx",
(unsigned long) visInfoPtr[i].visualid);
strcat(buf, visualIdString);
}
strPtr = Tcl_NewStringObj(buf, -1);
@@ -2078,7 +2090,7 @@ TkGetDisplayOf(
}
string = Tcl_GetStringFromObj(objv[0], &length);
if ((length >= 2) &&
(strncmp(string, "-displayof", (unsigned) length) == 0)) {
(strncmp(string, "-displayof", length) == 0)) {
if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"value for \"-displayof\" missing", -1));
@@ -2112,12 +2124,11 @@ TkGetDisplayOf(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
TkDeadAppObjCmd(
ClientData clientData, /* Dummy. */
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
TCL_UNUSED(int), /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
Tcl_SetObjResult(interp, Tcl_ObjPrintf(

View File

@@ -31,7 +31,7 @@ typedef struct {
* The structure below is used to allocate thread-local data.
*/
typedef struct ThreadSpecificData {
typedef struct {
char rgbString[20]; /* */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -128,7 +128,7 @@ Tk_AllocColorFromObj(
*/
if (tkColPtr != NULL) {
TkColor *firstColorPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
TkColor *firstColorPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr);
FreeColorObj(objPtr);
for (tkColPtr = firstColorPtr; tkColPtr != NULL;
@@ -203,7 +203,7 @@ Tk_GetColor(
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew);
if (!isNew) {
existingColPtr = Tcl_GetHashValue(nameHashPtr);
existingColPtr = (TkColor *)Tcl_GetHashValue(nameHashPtr);
for (tkColPtr = existingColPtr; tkColPtr != NULL;
tkColPtr = tkColPtr->nextPtr) {
if ((tkColPtr->screen == Tk_Screen(tkwin))
@@ -245,7 +245,7 @@ Tk_GetColor(
*/
tkColPtr->magic = COLOR_MAGIC;
tkColPtr->gc = None;
tkColPtr->gc = NULL;
tkColPtr->screen = Tk_Screen(tkwin);
tkColPtr->colormap = Tk_Colormap(tkwin);
tkColPtr->visual = Tk_Visual(tkwin);
@@ -314,7 +314,7 @@ Tk_GetColorByValue(
valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable,
(char *) &valueKey, &isNew);
if (!isNew) {
tkColPtr = Tcl_GetHashValue(valueHashPtr);
tkColPtr = (TkColor *)Tcl_GetHashValue(valueHashPtr);
tkColPtr->resourceRefCount++;
return &tkColPtr->color;
}
@@ -326,7 +326,7 @@ Tk_GetColorByValue(
tkColPtr = TkpGetColorByValue(tkwin, colorPtr);
tkColPtr->magic = COLOR_MAGIC;
tkColPtr->gc = None;
tkColPtr->gc = NULL;
tkColPtr->screen = Tk_Screen(tkwin);
tkColPtr->colormap = valueKey.colormap;
tkColPtr->visual = Tk_Visual(tkwin);
@@ -363,12 +363,12 @@ const char *
Tk_NameOfColor(
XColor *colorPtr) /* Color whose name is desired. */
{
register TkColor *tkColPtr = (TkColor *) colorPtr;
TkColor *tkColPtr = (TkColor *) colorPtr;
if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) {
return tkColPtr->hashPtr->key.string;
} else {
ThreadSpecificData *tsdPtr =
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red,
@@ -436,7 +436,7 @@ Tk_GCForColor(
Tcl_Panic("Tk_GCForColor called with bogus color");
}
if (tkColPtr->gc == None) {
if (tkColPtr->gc == NULL) {
gcValues.foreground = tkColPtr->color.pixel;
tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen), drawable,
GCForeground, &gcValues);
@@ -480,8 +480,7 @@ Tk_FreeColor(
Tcl_Panic("Tk_FreeColor called with bogus color");
}
tkColPtr->resourceRefCount--;
if (tkColPtr->resourceRefCount > 0) {
if (tkColPtr->resourceRefCount-- > 1) {
return;
}
@@ -491,13 +490,13 @@ Tk_FreeColor(
* longer any objects referencing it.
*/
if (tkColPtr->gc != None) {
if (tkColPtr->gc != NULL) {
XFreeGC(DisplayOfScreen(screen), tkColPtr->gc);
tkColPtr->gc = None;
tkColPtr->gc = NULL;
}
TkpFreeColor(tkColPtr);
prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
prevPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr);
if (prevPtr == tkColPtr) {
if (tkColPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(tkColPtr->hashPtr);
@@ -584,11 +583,10 @@ static void
FreeColorObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1;
TkColor *tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1;
if (tkColPtr != NULL) {
tkColPtr->objRefCount--;
if ((tkColPtr->objRefCount == 0)
if ((tkColPtr->objRefCount-- <= 1)
&& (tkColPtr->resourceRefCount == 0)) {
ckfree(tkColPtr);
}
@@ -619,7 +617,7 @@ DupColorObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
TkColor *tkColPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
TkColor *tkColPtr = (TkColor *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = tkColPtr;
@@ -669,7 +667,7 @@ Tk_GetColorFromObj(
* map. If it is, we are done.
*/
tkColPtr = objPtr->internalRep.twoPtrValue.ptr1;
tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1;
if ((tkColPtr != NULL)
&& (tkColPtr->resourceRefCount > 0)
&& (Tk_Screen(tkwin) == tkColPtr->screen)
@@ -695,7 +693,7 @@ Tk_GetColorFromObj(
if (hashPtr == NULL) {
goto error;
}
for (tkColPtr = Tcl_GetHashValue(hashPtr);
for (tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr);
(tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) {
if ((Tk_Screen(tkwin) == tkColPtr->screen)
&& (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
@@ -811,7 +809,7 @@ TkDebugColor(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, name);
if (hashPtr != NULL) {
TkColor *tkColPtr = Tcl_GetHashValue(hashPtr);
TkColor *tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr);
if (tkColPtr == NULL) {
Tcl_Panic("TkDebugColor found empty hash table entry");

View File

@@ -32,7 +32,7 @@ typedef struct TkColor {
* COLOR_MAGIC. */
GC gc; /* Simple gc with this color as foreground
* color and all other fields defaulted. May
* be None. */
* be NULL. */
Screen *screen; /* Screen where this color is valid. Used to
* delete it, and to find its display. */
Colormap colormap; /* Colormap from which this entry was

View File

@@ -31,7 +31,7 @@
* the option tables that have been created for a thread.
*/
typedef struct ThreadSpecificData {
typedef struct {
int initialized; /* 0 means table below needs initializing. */
Tcl_HashTable hashTable;
} ThreadSpecificData;
@@ -67,7 +67,7 @@ typedef struct TkOption {
* monochrome displays. */
struct TkOption *synonymPtr;
/* For synonym options, this points to the
* master entry. */
* original entry. */
const struct Tk_ObjCustomOption *custom;
/* For TK_OPTION_CUSTOM. */
} extra;
@@ -178,7 +178,7 @@ Tk_CreateOptionTable(
const Tk_OptionSpec *specPtr, *specPtr2;
Option *optionPtr;
int numOptions, i;
ThreadSpecificData *tsdPtr =
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -202,7 +202,7 @@ Tk_CreateOptionTable(
hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->hashTable, (char *) templatePtr,
&newEntry);
if (!newEntry) {
tablePtr = Tcl_GetHashValue(hashEntryPtr);
tablePtr = (OptionTable *)Tcl_GetHashValue(hashEntryPtr);
tablePtr->refCount++;
return (Tk_OptionTable) tablePtr;
}
@@ -216,7 +216,7 @@ Tk_CreateOptionTable(
for (specPtr = templatePtr; specPtr->type != TK_OPTION_END; specPtr++) {
numOptions++;
}
tablePtr = ckalloc(sizeof(OptionTable) + (numOptions * sizeof(Option)));
tablePtr = (OptionTable *)ckalloc(sizeof(OptionTable) + (numOptions * sizeof(Option)));
tablePtr->refCount = 1;
tablePtr->hashEntryPtr = hashEntryPtr;
tablePtr->nextPtr = NULL;
@@ -237,8 +237,8 @@ Tk_CreateOptionTable(
if (specPtr->type == TK_OPTION_SYNONYM) {
/*
* This is a synonym option; find the master option that it refers
* to and create a pointer from the synonym to the master.
* This is a synonym option; find the original option that it refers
* to and create a pointer from the synonym to the origin.
*/
for (specPtr2 = templatePtr, i = 0; ; specPtr2++, i++) {
@@ -266,7 +266,7 @@ Tk_CreateOptionTable(
|| (specPtr->type == TK_OPTION_BORDER))
&& (specPtr->clientData != NULL)) {
optionPtr->extra.monoColorPtr =
Tcl_NewStringObj(specPtr->clientData, -1);
Tcl_NewStringObj((const char *)specPtr->clientData, -1);
Tcl_IncrRefCount(optionPtr->extra.monoColorPtr);
}
@@ -275,7 +275,7 @@ Tk_CreateOptionTable(
* Get the custom parsing, etc., functions.
*/
optionPtr->extra.custom = specPtr->clientData;
optionPtr->extra.custom = (const Tk_ObjCustomOption *)specPtr->clientData;
}
}
if (((specPtr->type == TK_OPTION_STRING)
@@ -300,7 +300,7 @@ Tk_CreateOptionTable(
if (specPtr->clientData != NULL) {
tablePtr->nextPtr = (OptionTable *)
Tk_CreateOptionTable(interp, specPtr->clientData);
Tk_CreateOptionTable(interp, (Tk_OptionSpec *)specPtr->clientData);
}
return (Tk_OptionTable) tablePtr;
@@ -332,8 +332,7 @@ Tk_DeleteOptionTable(
Option *optionPtr;
int count;
tablePtr->refCount--;
if (tablePtr->refCount > 0) {
if (tablePtr->refCount-- > 1) {
return;
}
@@ -665,7 +664,7 @@ DoObjConfig(
if (internalPtr != NULL) {
if (valuePtr != NULL) {
value = Tcl_GetStringFromObj(valuePtr, &length);
newStr = ckalloc(length + 1);
newStr = (char *)ckalloc(length + 1);
strcpy(newStr, value);
} else {
newStr = NULL;
@@ -678,11 +677,16 @@ DoObjConfig(
case TK_OPTION_STRING_TABLE: {
int newValue;
if (nullOK && ObjectIsEmpty(valuePtr)) {
valuePtr = NULL;
newValue = -1;
} else {
if (Tcl_GetIndexFromObjStruct(interp, valuePtr,
optionPtr->specPtr->clientData, sizeof(char *),
optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) {
return TCL_ERROR;
}
}
if (internalPtr != NULL) {
*((int *) oldInternalPtr) = *((int *) internalPtr);
*((int *) internalPtr) = newValue;
@@ -800,11 +804,11 @@ DoObjConfig(
Tk_Cursor newCursor;
if (nullOK && ObjectIsEmpty(valuePtr)) {
newCursor = None;
newCursor = NULL;
valuePtr = NULL;
} else {
newCursor = Tk_AllocCursorFromObj(interp, tkwin, valuePtr);
if (newCursor == None) {
if (newCursor == NULL) {
return TCL_ERROR;
}
}
@@ -862,7 +866,7 @@ DoObjConfig(
if (nullOK && ObjectIsEmpty(valuePtr)) {
valuePtr = NULL;
newWin = None;
newWin = NULL;
} else {
if (TkGetWindowFromObj(interp, tkwin, valuePtr,
&newWin) != TCL_OK) {
@@ -1161,9 +1165,9 @@ TkGetOptionSpec(
static void
FreeOptionInternalRep(
register Tcl_Obj *objPtr) /* Object whose internal rep to free. */
Tcl_Obj *objPtr) /* Object whose internal rep to free. */
{
register Tk_OptionTable tablePtr = (Tk_OptionTable) objPtr->internalRep.twoPtrValue.ptr1;
Tk_OptionTable tablePtr = (Tk_OptionTable) objPtr->internalRep.twoPtrValue.ptr1;
Tk_DeleteOptionTable(tablePtr);
objPtr->typePtr = NULL;
@@ -1187,7 +1191,7 @@ DupOptionInternalRep(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
register OptionTable *tablePtr = (OptionTable *) srcObjPtr->internalRep.twoPtrValue.ptr1;
OptionTable *tablePtr = (OptionTable *) srcObjPtr->internalRep.twoPtrValue.ptr1;
tablePtr->refCount++;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep = srcObjPtr->internalRep;
@@ -1284,7 +1288,7 @@ Tk_SetOptions(
* more space.
*/
newSavePtr = ckalloc(sizeof(Tk_SavedOptions));
newSavePtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions));
newSavePtr->recordPtr = recordPtr;
newSavePtr->tkwin = tkwin;
newSavePtr->numItems = 0;
@@ -1396,7 +1400,7 @@ Tk_RestoreSavedOptions(
= savePtr->items[i].valuePtr;
}
if (specPtr->internalOffset >= 0) {
register char *ptr = (char *) &savePtr->items[i].internalForm;
char *ptr = (char *) &savePtr->items[i].internalForm;
CLANG_ASSERT(internalPtr);
switch (specPtr->type) {
@@ -1495,9 +1499,8 @@ Tk_FreeSavedOptions(
Tk_FreeSavedOptions(savePtr->nextPtr);
ckfree(savePtr->nextPtr);
}
for (count = savePtr->numItems,
savedOptionPtr = &savePtr->items[savePtr->numItems-1];
count > 0; count--, savedOptionPtr--) {
for (count = savePtr->numItems; count > 0; count--) {
savedOptionPtr = &savePtr->items[count-1];
if (savedOptionPtr->optionPtr->flags & OPTION_NEEDS_FREEING) {
FreeResources(savedOptionPtr->optionPtr, savedOptionPtr->valuePtr,
(char *) &savedOptionPtr->internalForm, savePtr->tkwin);
@@ -1525,7 +1528,6 @@ Tk_FreeSavedOptions(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
void
Tk_FreeConfigOptions(
char *recordPtr, /* Record whose fields contain current values
@@ -1666,9 +1668,9 @@ FreeResources(
break;
case TK_OPTION_CURSOR:
if (internalFormExists) {
if (*((Tk_Cursor *) internalPtr) != None) {
if (*((Tk_Cursor *) internalPtr) != NULL) {
Tk_FreeCursor(Tk_Display(tkwin), *((Tk_Cursor *) internalPtr));
*((Tk_Cursor *) internalPtr) = None;
*((Tk_Cursor *) internalPtr) = NULL;
}
} else if (objPtr != NULL) {
Tk_FreeCursorFromObj(tkwin, objPtr);
@@ -1877,23 +1879,23 @@ GetObjectForOption(
objPtr = NULL;
switch (optionPtr->specPtr->type) {
case TK_OPTION_BOOLEAN:
objPtr = Tcl_NewIntObj(*((int *) internalPtr));
objPtr = Tcl_NewIntObj(*((int *)internalPtr));
break;
case TK_OPTION_INT:
objPtr = Tcl_NewIntObj(*((int *) internalPtr));
objPtr = Tcl_NewIntObj(*((int *)internalPtr));
break;
case TK_OPTION_DOUBLE:
objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
objPtr = Tcl_NewDoubleObj(*((double *)internalPtr));
break;
case TK_OPTION_STRING:
objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1);
objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1);
break;
case TK_OPTION_STRING_TABLE:
objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
*((int *) internalPtr)], -1);
break;
case TK_OPTION_COLOR: {
XColor *colorPtr = *((XColor **) internalPtr);
XColor *colorPtr = *((XColor **)internalPtr);
if (colorPtr != NULL) {
objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
@@ -1901,7 +1903,7 @@ GetObjectForOption(
break;
}
case TK_OPTION_FONT: {
Tk_Font tkfont = *((Tk_Font *) internalPtr);
Tk_Font tkfont = *((Tk_Font *)internalPtr);
if (tkfont != NULL) {
objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
@@ -1909,7 +1911,7 @@ GetObjectForOption(
break;
}
case TK_OPTION_STYLE: {
Tk_Style style = *((Tk_Style *) internalPtr);
Tk_Style style = *((Tk_Style *)internalPtr);
if (style != NULL) {
objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
@@ -1917,7 +1919,7 @@ GetObjectForOption(
break;
}
case TK_OPTION_BITMAP: {
Pixmap pixmap = *((Pixmap *) internalPtr);
Pixmap pixmap = *((Pixmap *)internalPtr);
if (pixmap != None) {
objPtr = Tcl_NewStringObj(
@@ -1926,7 +1928,7 @@ GetObjectForOption(
break;
}
case TK_OPTION_BORDER: {
Tk_3DBorder border = *((Tk_3DBorder *) internalPtr);
Tk_3DBorder border = *((Tk_3DBorder *)internalPtr);
if (border != NULL) {
objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
@@ -1934,12 +1936,12 @@ GetObjectForOption(
break;
}
case TK_OPTION_RELIEF:
objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *) internalPtr)), -1);
objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1);
break;
case TK_OPTION_CURSOR: {
Tk_Cursor cursor = *((Tk_Cursor *) internalPtr);
Tk_Cursor cursor = *((Tk_Cursor *)internalPtr);
if (cursor != None) {
if (cursor != NULL) {
objPtr = Tcl_NewStringObj(
Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
}
@@ -1947,17 +1949,17 @@ GetObjectForOption(
}
case TK_OPTION_JUSTIFY:
objPtr = Tcl_NewStringObj(Tk_NameOfJustify(
*((Tk_Justify *) internalPtr)), -1);
*((Tk_Justify *)internalPtr)), -1);
break;
case TK_OPTION_ANCHOR:
objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(
*((Tk_Anchor *) internalPtr)), -1);
break;
case TK_OPTION_PIXELS:
objPtr = Tcl_NewIntObj(*((int *) internalPtr));
objPtr = Tcl_NewIntObj(*((int *)internalPtr));
break;
case TK_OPTION_WINDOW: {
Tk_Window tkwin = *((Tk_Window *) internalPtr);
tkwin = *((Tk_Window *)internalPtr);
if (tkwin != NULL) {
objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
@@ -2064,7 +2066,7 @@ Tk_GetOptionValue(
Tcl_Obj *
TkDebugConfig(
Tcl_Interp *interp, /* Interpreter in which the table is
TCL_UNUSED(Tcl_Interp *), /* Interpreter in which the table is
* defined. */
Tk_OptionTable table) /* Table about which information is to be
* returned. May not necessarily exist in the
@@ -2074,7 +2076,7 @@ TkDebugConfig(
Tcl_HashEntry *hashEntryPtr;
Tcl_HashSearch search;
Tcl_Obj *objPtr;
ThreadSpecificData *tsdPtr =
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
objPtr = Tcl_NewObj();

View File

@@ -44,6 +44,7 @@ typedef struct ChannelData {
*/
static int ConsoleClose(ClientData instanceData, Tcl_Interp *interp);
static int Console2Close(ClientData instanceData, Tcl_Interp *interp, int flags);
static void ConsoleDeleteProc(ClientData clientData);
static void ConsoleEventProc(ClientData clientData, XEvent *eventPtr);
static int ConsoleHandle(ClientData instanceData, int direction,
@@ -66,7 +67,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp,
static const Tcl_ChannelType consoleChannelType = {
"console", /* Type name. */
TCL_CHANNEL_VERSION_4, /* v4 channel */
TCL_CHANNEL_VERSION_5, /* v5 channel */
ConsoleClose, /* Close proc. */
ConsoleInput, /* Input proc. */
ConsoleOutput, /* Output proc. */
@@ -75,7 +76,7 @@ static const Tcl_ChannelType consoleChannelType = {
NULL, /* Get option proc. */
ConsoleWatch, /* Watch for events on console. */
ConsoleHandle, /* Get a handle from the device. */
NULL, /* close2proc. */
Console2Close, /* close2proc. */
NULL, /* Always non-blocking.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
@@ -227,7 +228,7 @@ Tk_InitConsoleChannels(
return;
}
consoleInitPtr = Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int));
consoleInitPtr = (int *)Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int));
if (*consoleInitPtr) {
/*
* We've already initialized console channels in this thread.
@@ -255,13 +256,13 @@ Tk_InitConsoleChannels(
* interp for it to live in.
*/
info = ckalloc(sizeof(ConsoleInfo));
info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo));
info->consoleInterp = NULL;
info->interp = NULL;
info->refCount = 0;
if (doIn) {
ChannelData *data = ckalloc(sizeof(ChannelData));
ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData));
data->info = info;
data->info->refCount++;
@@ -278,7 +279,7 @@ Tk_InitConsoleChannels(
}
if (doOut) {
ChannelData *data = ckalloc(sizeof(ChannelData));
ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData));
data->info = info;
data->info->refCount++;
@@ -295,7 +296,7 @@ Tk_InitConsoleChannels(
}
if (doErr) {
ChannelData *data = ckalloc(sizeof(ChannelData));
ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData));
data->info = info;
data->info->refCount++;
@@ -377,7 +378,7 @@ Tk_CreateConsoleWindow(
* New ConsoleInfo for a new console window.
*/
info = ckalloc(sizeof(ConsoleInfo));
info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo));
info->refCount = 0;
/*
@@ -407,7 +408,7 @@ Tk_CreateConsoleWindow(
}
}
} else {
info = ckalloc(sizeof(ConsoleInfo));
info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo));
info->refCount = 0;
}
@@ -456,7 +457,7 @@ Tk_CreateConsoleWindow(
if (mainWindow) {
Tk_DeleteEventHandler(mainWindow, StructureNotifyMask,
ConsoleEventProc, info);
if (--info->refCount <= 0) {
if (info->refCount-- <= 1) {
ckfree(info);
}
}
@@ -497,7 +498,7 @@ ConsoleOutput(
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
{
ChannelData *data = instanceData;
ChannelData *data = (ChannelData *)instanceData;
ConsoleInfo *info = data->info;
*errorCode = 0;
@@ -558,14 +559,13 @@ ConsoleOutput(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ConsoleInput(
ClientData instanceData, /* Unused. */
char *buf, /* Where to store data read. */
int bufSize, /* How much space is available in the
TCL_UNUSED(void *),
TCL_UNUSED(char *), /* Where to store data read. */
TCL_UNUSED(int), /* How much space is available in the
* buffer? */
int *errorCode) /* Where to store error code. */
TCL_UNUSED(int *)) /* Where to store error code. */
{
return 0; /* Always return EOF. */
}
@@ -573,7 +573,7 @@ ConsoleInput(
/*
*----------------------------------------------------------------------
*
* ConsoleClose --
* ConsoleClose/Console2Close --
*
* Closes the IO channel.
*
@@ -586,17 +586,16 @@ ConsoleInput(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ConsoleClose(
ClientData instanceData, /* Unused. */
Tcl_Interp *interp) /* Unused. */
ClientData instanceData,
TCL_UNUSED(Tcl_Interp *))
{
ChannelData *data = instanceData;
ChannelData *data = (ChannelData *)instanceData;
ConsoleInfo *info = data->info;
if (info) {
if (--info->refCount <= 0) {
if (info->refCount-- <= 1) {
/*
* Assuming the Tcl_Interp * fields must already be NULL.
*/
@@ -607,6 +606,18 @@ ConsoleClose(
ckfree(data);
return 0;
}
static int
Console2Close(
ClientData instanceData, /* Unused. */
Tcl_Interp *interp, /* Unused. */
int flags)
{
if ((flags&(TCL_CLOSE_READ|TCL_CLOSE_WRITE))==0) {
return ConsoleClose(instanceData, interp);
}
return EINVAL;
}
/*
*----------------------------------------------------------------------
@@ -626,11 +637,10 @@ ConsoleClose(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
ConsoleWatch(
ClientData instanceData, /* Device ID for the channel. */
int mask) /* OR-ed combination of TCL_READABLE,
TCL_UNUSED(void *), /* Device ID for the channel. */
TCL_UNUSED(int)) /* OR-ed combination of TCL_READABLE,
* TCL_WRITABLE and TCL_EXCEPTION, for the
* events we are interested in. */
{
@@ -653,14 +663,13 @@ ConsoleWatch(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ConsoleHandle(
ClientData instanceData, /* Device ID for the channel. */
int direction, /* TCL_READABLE or TCL_WRITABLE to indicate
TCL_UNUSED(void *), /* Device ID for the channel. */
TCL_UNUSED(int), /* TCL_READABLE or TCL_WRITABLE to indicate
* which direction of the channel is being
* requested. */
ClientData *handlePtr) /* Where to store handle */
TCL_UNUSED(void **)) /* Where to store handle */
{
return TCL_ERROR;
}
@@ -694,7 +703,7 @@ ConsoleObjCmd(
"eval", "hide", "show", "title", NULL};
enum option {CON_EVAL, CON_HIDE, CON_SHOW, CON_TITLE};
Tcl_Obj *cmd = NULL;
ConsoleInfo *info = clientData;
ConsoleInfo *info = (ConsoleInfo *)clientData;
Tcl_Interp *consoleInterp = info->consoleInterp;
if (objc < 2) {
@@ -784,7 +793,7 @@ InterpreterObjCmd(
int index, result = TCL_OK;
static const char *const options[] = {"eval", "record", NULL};
enum option {OTHER_EVAL, OTHER_RECORD};
ConsoleInfo *info = clientData;
ConsoleInfo *info = (ConsoleInfo *)clientData;
Tcl_Interp *otherInterp = info->interp;
if (objc < 2) {
@@ -803,7 +812,7 @@ InterpreterObjCmd(
if ((otherInterp == NULL) || Tcl_InterpDeleted(otherInterp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"no active master interp", -1));
"no active parent interp", -1));
Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NO_INTERP", NULL);
return TCL_ERROR;
}
@@ -852,7 +861,7 @@ static void
DeleteConsoleInterp(
ClientData clientData)
{
Tcl_Interp *interp = clientData;
Tcl_Interp *interp = (Tcl_Interp *)clientData;
Tcl_DeleteInterp(interp);
}
@@ -879,13 +888,13 @@ InterpDeleteProc(
ClientData clientData,
Tcl_Interp *interp)
{
ConsoleInfo *info = clientData;
ConsoleInfo *info = (ConsoleInfo *)clientData;
if (info->consoleInterp == interp) {
Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp);
info->consoleInterp = NULL;
}
if (--info->refCount <= 0) {
if (info->refCount-- <= 1) {
ckfree(info);
}
}
@@ -911,12 +920,12 @@ static void
ConsoleDeleteProc(
ClientData clientData)
{
ConsoleInfo *info = clientData;
ConsoleInfo *info = (ConsoleInfo *)clientData;
if (info->consoleInterp) {
Tcl_DeleteInterp(info->consoleInterp);
}
if (--info->refCount <= 0) {
if (info->refCount-- <= 1) {
ckfree(info);
}
}
@@ -926,7 +935,7 @@ ConsoleDeleteProc(
*
* ConsoleEventProc --
*
* This event function is registered on the main window of the slave
* This event function is registered on the main window of the child
* interpreter. If the user or a running script causes the main window to
* be destroyed, then we need to inform the console interpreter by
* invoking "::tk::ConsoleExit".
@@ -946,14 +955,14 @@ ConsoleEventProc(
XEvent *eventPtr)
{
if (eventPtr->type == DestroyNotify) {
ConsoleInfo *info = clientData;
ConsoleInfo *info = (ConsoleInfo *)clientData;
Tcl_Interp *consoleInterp = info->consoleInterp;
if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) {
Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL);
}
if (--info->refCount <= 0) {
if (info->refCount-- <= 1) {
ckfree(info);
}
}

View File

@@ -100,7 +100,7 @@ Tk_AllocCursorFromObj(
if (objPtr->typePtr != &tkCursorObjType) {
InitCursorObj(objPtr);
}
cursorPtr = objPtr->internalRep.twoPtrValue.ptr1;
cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1;
/*
* If the object currently points to a TkCursor, see if it's the one we
@@ -129,7 +129,7 @@ Tk_AllocCursorFromObj(
*/
if (cursorPtr != NULL) {
TkCursor *firstCursorPtr = Tcl_GetHashValue(cursorPtr->hashPtr);
TkCursor *firstCursorPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr);
FreeCursorObj(objPtr);
for (cursorPtr = firstCursorPtr; cursorPtr != NULL;
@@ -150,7 +150,7 @@ Tk_AllocCursorFromObj(
cursorPtr = TkcGetCursor(interp, tkwin, Tcl_GetString(objPtr));
objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr;
if (cursorPtr == NULL) {
return None;
return NULL;
}
cursorPtr->objRefCount++;
return cursorPtr->cursor;
@@ -190,7 +190,7 @@ Tk_GetCursor(
TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string);
if (cursorPtr == NULL) {
return None;
return NULL;
}
return cursorPtr->cursor;
}
@@ -229,7 +229,7 @@ TkcGetCursor(
* details on legal syntax. */
{
Tcl_HashEntry *nameHashPtr;
register TkCursor *cursorPtr;
TkCursor *cursorPtr;
TkCursor *existingCursorPtr = NULL;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -241,7 +241,7 @@ TkcGetCursor(
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable,
string, &isNew);
if (!isNew) {
existingCursorPtr = Tcl_GetHashValue(nameHashPtr);
existingCursorPtr = (TkCursor *)Tcl_GetHashValue(nameHashPtr);
for (cursorPtr = existingCursorPtr; cursorPtr != NULL;
cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
@@ -320,7 +320,7 @@ Tk_GetCursorFromData(
{
DataKey dataKey;
Tcl_HashEntry *dataHashPtr;
register TkCursor *cursorPtr;
TkCursor *cursorPtr;
int isNew;
XColor fgColor, bgColor;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -341,7 +341,7 @@ Tk_GetCursorFromData(
dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable,
(char *) &dataKey, &isNew);
if (!isNew) {
cursorPtr = Tcl_GetHashValue(dataHashPtr);
cursorPtr = (TkCursor *)Tcl_GetHashValue(dataHashPtr);
cursorPtr->resourceRefCount++;
return cursorPtr->cursor;
}
@@ -388,7 +388,7 @@ Tk_GetCursorFromData(
error:
Tcl_DeleteHashEntry(dataHashPtr);
return None;
return NULL;
}
/*
@@ -425,14 +425,14 @@ Tk_NameOfCursor(
if (!dispPtr->cursorInit) {
printid:
sprintf(dispPtr->cursorString, "cursor id %p", cursor);
sprintf(dispPtr->cursorString, "cursor id 0x%" TCL_Z_MODIFIER "x", (size_t)cursor);
return dispPtr->cursorString;
}
idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor);
if (idHashPtr == NULL) {
goto printid;
}
cursorPtr = Tcl_GetHashValue(idHashPtr);
cursorPtr = (TkCursor *)Tcl_GetHashValue(idHashPtr);
if (cursorPtr->otherTable != &dispPtr->cursorNameTable) {
goto printid;
}
@@ -463,13 +463,12 @@ FreeCursor(
{
TkCursor *prevPtr;
cursorPtr->resourceRefCount--;
if (cursorPtr->resourceRefCount > 0) {
if (cursorPtr->resourceRefCount-- > 1) {
return;
}
Tcl_DeleteHashEntry(cursorPtr->idHashPtr);
prevPtr = Tcl_GetHashValue(cursorPtr->hashPtr);
prevPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr);
if (prevPtr == cursorPtr) {
if (cursorPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(cursorPtr->hashPtr);
@@ -522,7 +521,7 @@ Tk_FreeCursor(
if (idHashPtr == NULL) {
Tcl_Panic("Tk_FreeCursor received unknown cursor argument");
}
FreeCursor(Tcl_GetHashValue(idHashPtr));
FreeCursor((TkCursor *)Tcl_GetHashValue(idHashPtr));
}
/*
@@ -587,11 +586,10 @@ static void
FreeCursorObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1;
TkCursor *cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1;
if (cursorPtr != NULL) {
cursorPtr->objRefCount--;
if ((cursorPtr->objRefCount == 0)
if ((cursorPtr->objRefCount-- <= 1)
&& (cursorPtr->resourceRefCount == 0)) {
ckfree(cursorPtr);
}
@@ -622,7 +620,7 @@ DupCursorObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
TkCursor *cursorPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
TkCursor *cursorPtr = (TkCursor *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = cursorPtr;
@@ -707,7 +705,7 @@ GetCursorFromObj(
* cached is the one that is needed.
*/
cursorPtr = objPtr->internalRep.twoPtrValue.ptr1;
cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1;
if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) {
return cursorPtr;
}
@@ -722,7 +720,7 @@ GetCursorFromObj(
if (hashPtr == NULL) {
goto error;
}
for (cursorPtr = Tcl_GetHashValue(hashPtr);
for (cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr);
cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
FreeCursorObj(objPtr);
@@ -857,7 +855,7 @@ TkDebugCursor(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, name);
if (hashPtr != NULL) {
cursorPtr = Tcl_GetHashValue(hashPtr);
cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr);
if (cursorPtr == NULL) {
Tcl_Panic("TkDebugCursor found empty hash table entry");
}

546
generic/tkDList.h Normal file
View File

@@ -0,0 +1,546 @@
/*
* tkDList.h --
*
* A list is headed by pointers to first and last element. The elements
* are doubly linked so that an arbitrary element can be removed without
* a need to traverse the list. New elements can be added to the list
* before or after an existing element or at the head/tail of the list.
* A list may be traversed in the forward or backward direction.
*
* Copyright (c) 2018 by Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
/*
* Note that this file will not be included in header files, it is the purpose
* of this file to be included in source files only. Thus we are not using the
* prefix "Tk_" here for functions, because all the functions have private scope.
*/
/*
* -------------------------------------------------------------------------------
* Use the double linked list in the following way:
* -------------------------------------------------------------------------------
* typedef struct MyListEntry { TK_DLIST_LINKS(MyListEntry); int value; } MyListEntry;
* TK_DLIST_DEFINE(MyList, MyListEntry);
* MyList listHdr = TK_DLIST_LIST_INITIALIZER; // or MyList_Init(&listHdr)
* MyListEntry *p;
* int i = 0;
* MyList_Append(&listHdr, ckalloc(sizeof(MyListEntry)));
* MyList_Append(&listHdr, ckalloc(sizeof(MyListEntry)));
* TK_DLIST_FOREACH(p, &listHdr) { p->value = i++; }
* // ...
* MyList_RemoveHead(&listHdr);
* MyList_RemoveHead(&listHdr);
* MyList_Clear(MyListEntry, &listHdr); // invokes ckfree() for each element
* -------------------------------------------------------------------------------
* IMPORTANT NOTE: TK_DLIST_LINKS must be used at start of struct!
*/
#ifndef TK_DLIST_DEFINED
#define TK_DLIST_DEFINED
#include "tkInt.h"
/*
* List definitions.
*/
#define TK_DLIST_LINKS(ElemType) \
struct { \
struct ElemType *prev; /* previous element */ \
struct ElemType *next; /* next element */ \
} _dl_
#define TK_DLIST_LIST_INITIALIZER { NULL, NULL }
#define TK_DLIST_ELEM_INITIALIZER { NULL, NULL }
/*************************************************************************/
/*
* DList_Init: Initialize list header. This can also be used to clear the
* list.
*
* See also: DList_Clear()
*/
/*************************************************************************/
/*
* DList_ElemInit: Initialize a list element.
*/
/*************************************************************************/
/*
* DList_InsertAfter: Insert 'elem' after 'listElem'. 'elem' must not
* be linked, but 'listElem' must be linked.
*/
/*************************************************************************/
/*
* DList_InsertBefore: Insert 'elem' before 'listElem'. 'elem' must not
* be linked, but 'listElem' must be linked.
*/
/*************************************************************************/
/*
* DList_Prepend: Insert 'elem' at start of list. This element must not
* be linked.
*
* See also: DList_Append()
*/
/*************************************************************************/
/*
* DList_Append: Append 'elem' to end of list. This element must not
* be linked.
*
* See also: DList_Prepend()
*/
/*************************************************************************/
/*
* DList_Move: Append all list items of 'src' to end of 'dst'.
*/
/*************************************************************************/
/*
* DList_Remove: Remove 'elem' from list. This element must be linked.
*
* See also: DList_Free()
*/
/*************************************************************************/
/*
* DList_Free: Remove 'elem' from list and free it. This element must
* be linked.
*
* See also: DList_Remove()
*/
/*************************************************************************/
/*
* DList_RemoveHead: Remove first element from list. The list must
* not be empty.
*
* See also: DList_FreeHead()
*/
/*************************************************************************/
/*
* DList_RemoveTail: Remove last element from list. The list must
* not be empty.
*
* See also: DList_FreeTail()
*/
/*************************************************************************/
/*
* DList_FreeHead: Remove first element from list and free it.
* The list must not be empty.
*
* See also: DList_RemoveHead()
*/
/*************************************************************************/
/*
* DList_FreeTail: Remove last element from list and free it.
* The list must not be empty.
*
* See also: DList_RemoveTail()
*/
/*************************************************************************/
/*
* DList_SwapElems: Swap positions of given elements 'lhs' and 'rhs'.
* Both elements must be linked, and must belong to same list.
*/
/*************************************************************************/
/*
* DList_Clear: Clear whole list and free all elements.
*
* See also: DList_Init
*/
/*************************************************************************/
/*
* DList_Traverse: Iterate over all elements in list from first to last.
* Call given function func(head, elem) for each element. The function has
* to return the next element in list to traverse, normally this is
* DList_Next(elem).
*
* See also: TK_DLIST_FOREACH, TK_DLIST_FOREACH_REVERSE
*/
/*************************************************************************/
/*
* DList_First: Return pointer of first element in list, maybe it's NULL.
*/
/*************************************************************************/
/*
* DList_Last: Return pointer of last element in list, maybe it's NULL.
*/
/*************************************************************************/
/*
* DList_Next: Return pointer of next element after 'elem', maybe it's NULL.
*
* See also: DList_Prev()
*/
/*************************************************************************/
/*
* DList_Prev: Return pointer of previous element before 'elem', maybe it's
* NULL.
*
* See also: DList_Next()
*/
/*************************************************************************/
/*
* DList_IsEmpty: Test whether given list is empty.
*/
/*************************************************************************/
/*
* DList_IsLinked: Test whether given element is linked.
*/
/*************************************************************************/
/*
* DList_IsFirst: Test whether given element is first element in list.
* Note that 'elem' must be linked.
*
* See also: DList_IsLast(), DList_IsLinked()
*/
/*************************************************************************/
/*
* DList_IsLast: Test whether given element is last element in list.
* Note that 'elem' must be linked.
*
* See also: DList_IsFirst(), DList_IsLinked()
*/
/*************************************************************************/
/*
* DList_Size: Count number of elements in given list.
*/
/*************************************************************************/
/*
* TK_DLIST_FOREACH: Iterate over all elements in list from first to last.
* 'var' is the name of the variable which points to current element.
*
* See also: TK_DLIST_FOREACH_REVERSE, DList_Traverse()
*/
/*************************************************************************/
/*
* TK_DLIST_FOREACH_REVERSE: Iterate over all elements in list from last
* to first (backwards). 'var' is the name of the variable which points to
* current element.
*/
/*************************************************************************/
#if defined(__GNUC__) || defined(__clang__)
# define __TK_DLIST_UNUSED __attribute__((unused))
#else
# define __TK_DLIST_UNUSED
#endif
#define TK_DLIST_DEFINE(LT, ElemType) /* LT = type of head/list */ \
/* ------------------------------------------------------------------------- */ \
typedef struct LT { \
struct ElemType *first; /* first element */ \
struct ElemType *last; /* last element */ \
} LT; \
\
typedef struct ElemType *(LT##_Func)(LT *head, struct ElemType *elem); \
\
__TK_DLIST_UNUSED \
static void \
LT##_Init(LT *head) \
{ \
assert(head); \
head->first = NULL; \
head->last = NULL; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_ElemInit(struct ElemType *elem) \
{ \
assert(elem); \
elem->_dl_.next = NULL; \
elem->_dl_.prev = NULL; \
} \
\
__TK_DLIST_UNUSED \
static int \
LT##_IsEmpty(LT *head) \
{ \
assert(head); \
return head->first == NULL; \
} \
\
__TK_DLIST_UNUSED \
static int \
LT##_IsLinked(struct ElemType *elem) \
{ \
assert(elem); \
return elem->_dl_.next && elem->_dl_.prev; \
} \
\
__TK_DLIST_UNUSED \
static int \
LT##_IsFirst(struct ElemType *elem) \
{ \
assert(LT##_IsLinked(elem)); \
return elem->_dl_.prev->_dl_.prev == elem; \
} \
\
__TK_DLIST_UNUSED \
static int \
LT##_IsLast(struct ElemType *elem) \
{ \
assert(LT##_IsLinked(elem)); \
return elem->_dl_.next->_dl_.next == elem; \
} \
\
__TK_DLIST_UNUSED \
static struct ElemType * \
LT##_First(LT *head) \
{ \
assert(head); \
return head->first; \
} \
\
__TK_DLIST_UNUSED \
static struct ElemType * \
LT##_Last(LT *head) \
{ \
assert(head); \
return head->last; \
} \
\
__TK_DLIST_UNUSED \
static struct ElemType * \
LT##_Next(struct ElemType *elem) \
{ \
assert(elem); \
return LT##_IsLast(elem) ? NULL : elem->_dl_.next; \
} \
\
__TK_DLIST_UNUSED \
static struct ElemType * \
LT##_Prev(struct ElemType *elem) \
{ \
assert(elem); \
return LT##_IsFirst(elem) ? NULL : elem->_dl_.prev; \
} \
\
__TK_DLIST_UNUSED \
static unsigned \
LT##_Size(const LT *head) \
{ \
const struct ElemType *elem; \
unsigned size = 0; \
assert(head); \
if ((elem = head->first)) { \
for ( ; elem != (void *) head; elem = elem->_dl_.next) { \
++size; \
} \
} \
return size; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_InsertAfter(struct ElemType *listElem, struct ElemType *elem) \
{ \
assert(listElem); \
assert(elem); \
elem->_dl_.next = listElem->_dl_.next; \
elem->_dl_.prev = listElem; \
listElem->_dl_.next->_dl_.prev = elem; \
listElem->_dl_.next = elem; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_InsertBefore(struct ElemType *listElem, struct ElemType *elem) \
{ \
assert(listElem); \
assert(elem); \
elem->_dl_.next = listElem; \
elem->_dl_.prev = listElem->_dl_.prev;; \
listElem->_dl_.prev->_dl_.next = elem; \
listElem->_dl_.prev = elem; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Prepend(LT *head, struct ElemType *elem) \
{ \
assert(head); \
assert(elem); \
elem->_dl_.prev = (void *) head; \
if (!head->first) { \
elem->_dl_.next = (void *) head; \
head->last = elem; \
} else { \
elem->_dl_.next = head->first; \
head->first->_dl_.prev = elem; \
} \
head->first = elem; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Append(LT *head, struct ElemType *elem) \
{ \
assert(head); \
assert(elem); \
elem->_dl_.next = (void *) head; \
if (!head->first) { \
elem->_dl_.prev = (void *) head; \
head->first = elem; \
} else { \
elem->_dl_.prev = head->last; \
head->last->_dl_.next = elem; \
} \
head->last = elem; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Move(LT *dst, LT *src) \
{ \
assert(dst); \
assert(src); \
if (src->first) { \
if (dst->first) { \
dst->last->_dl_.next = src->first; \
src->first->_dl_.prev = dst->last; \
dst->last = src->last; \
} else { \
*dst = *src; \
dst->first->_dl_.prev = (void *) dst; \
} \
dst->last->_dl_.next = (void *) dst; \
LT##_Init(src); \
} \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Remove(struct ElemType *elem) \
{ \
int isFirst, isLast; \
assert(LT##_IsLinked(elem)); \
isFirst = LT##_IsFirst(elem); \
isLast = LT##_IsLast(elem); \
if (isFirst && isLast) { \
((LT *) elem->_dl_.prev)->first = NULL; \
((LT *) elem->_dl_.next)->last = NULL; \
} else { \
if (isFirst) { \
((LT *) elem->_dl_.prev)->first = elem->_dl_.next; \
} else { \
elem->_dl_.prev->_dl_.next = elem->_dl_.next; \
} \
if (isLast) { \
((LT *) elem->_dl_.next)->last = elem->_dl_.prev; \
} else { \
elem->_dl_.next->_dl_.prev = elem->_dl_.prev; \
} \
} \
LT##_ElemInit(elem); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Free(struct ElemType *elem) \
{ \
LT##_Remove(elem); \
ckfree((void *) elem); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_RemoveHead(LT *head) \
{ \
assert(!LT##_IsEmpty(head)); \
LT##_Remove(head->first); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_RemoveTail(LT *head) \
{ \
assert(!LT##_IsEmpty(head)); \
LT##_Remove(head->last); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_FreeHead(LT *head) \
{ \
assert(!LT##_IsEmpty(head)); \
LT##_Free(head->first); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_FreeTail(LT *head) \
{ \
assert(!LT##_IsEmpty(head)); \
LT##_Free(head->last); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_SwapElems(struct ElemType *lhs, struct ElemType *rhs) \
{ \
assert(lhs); \
assert(rhs); \
if (lhs != rhs) { \
struct ElemType tmp; \
if (LT##_IsFirst(lhs)) { \
((LT *) lhs->_dl_.prev)->first = rhs; \
} else if (LT##_IsFirst(rhs)) { \
((LT *) rhs->_dl_.prev)->first = lhs; \
} \
if (LT##_IsLast(lhs)) { \
((LT *) lhs->_dl_.next)->last = rhs; \
} else if (LT##_IsLast(rhs)) { \
((LT *) rhs->_dl_.next)->last = lhs; \
} \
tmp._dl_ = lhs->_dl_; \
lhs->_dl_ = rhs->_dl_; \
rhs->_dl_ = tmp._dl_; \
} \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Clear(LT *head) \
{ \
struct ElemType *p; \
struct ElemType *next; \
assert(head); \
for (p = head->first; p; p = next) { \
next = LT##_Next(p); \
ckfree((void *) p); \
} \
LT##_Init(head); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Traverse(LT *head, LT##_Func func) \
{ \
struct ElemType *next; \
struct ElemType *p; \
assert(head); \
for (p = head->first; p; p = next) { \
next = func(head, p); \
} \
} \
/* ------------------------------------------------------------------------- */
#define TK_DLIST_FOREACH(var, head) \
assert(head); \
for (var = head->first ? head->first : (void *) head; var != (void *) head; var = var->_dl_.next)
#define TK_DLIST_FOREACH_REVERSE(var, head) \
assert(head); \
for (var = head->last ? head->last : (void *) head; var != (void *) head; var = var->_dl_.prev)
#endif /* TK_DLIST_DEFINED */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 105
* End:
* vi:set ts=8 sw=4:
*/

Some files were not shown because too many files have changed in this diff Show More