diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..77a8d274
--- /dev/null
+++ b/.travis.yml
@@ -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
diff --git a/README.md b/README.md
index c9896379..2c27a642 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,13 @@
# README: Tk
-This is the **Tk 8.6.10** source distribution.
+This is the **Tk 8.6.11** source distribution.
You can get any source release of Tk from [our distribution
site](https://sourceforge.net/projects/tcl/files/Tcl/).
+[](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Acore-8-6-branch)
+[](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Acore-8-6-branch)
+[](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Acore-8-6-branch)
## 1. Introduction
@@ -18,13 +21,13 @@ 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 [core.tcl-lang.org](https://core.tcl-lang.org/).
+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
+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.
diff --git a/changes b/changes
index aea39f3b..f8163aac 100644
--- a/changes
+++ b/changes
@@ -7572,9 +7572,9 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2018-11-19 (bug)[0a9c91] crash in text-11a.22 (vogel)
-2018-11-20 (bug)[9705d1] crash activating "Alt" theme (culler)
+2018-11-20 (bug)[9705d1] crash activating "Alt" theme (culler)
-2018-11-24 (bug)[e3b954] cursor offset at full screen display (culler)
+2018-11-24 (bug)[e3b954] cursor offset at full screen display (culler)
2019-01-04 (bug)[18a4ba] cross-platform [winfo containing] (culler)
@@ -7698,3 +7698,147 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
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
diff --git a/compat/stdlib.h b/compat/stdlib.h
index 6900be33..2c648908 100644
--- a/compat/stdlib.h
+++ b/compat/stdlib.h
@@ -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
+#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);
diff --git a/compat/unistd.h b/compat/unistd.h
index a8f14f2d..be966cc1 100644
--- a/compat/unistd.h
+++ b/compat/unistd.h
@@ -15,6 +15,9 @@
#define _UNISTD
#include
+#ifndef _TCL
+# include
+#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 */
+
diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3
index cbbc11ec..ac8c9bb8 100644
--- a/doc/CrtImgType.3
+++ b/doc/CrtImgType.3
@@ -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 \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
diff --git a/doc/GetScroll.3 b/doc/GetScroll.3
index a71986df..2615301a 100644
--- a/doc/GetScroll.3
+++ b/doc/GetScroll.3
@@ -25,13 +25,13 @@ int
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.
diff --git a/doc/ImgChanged.3 b/doc/ImgChanged.3
index f4d2c043..6d8ae91f 100644
--- a/doc/ImgChanged.3
+++ b/doc/ImgChanged.3
@@ -14,10 +14,10 @@ Tk_ImageChanged \- notify widgets that image needs to be redrawn
.nf
\fB#include \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.
diff --git a/doc/MaintGeom.3 b/doc/MaintGeom.3
index d1c2d1ca..a509b0b1 100644
--- a/doc/MaintGeom.3
+++ b/doc/MaintGeom.3
@@ -14,67 +14,67 @@ Tk_MaintainGeometry, Tk_UnmaintainGeometry \- maintain geometry of one window re
.nf
\fB#include \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
diff --git a/doc/ManageGeom.3 b/doc/ManageGeom.3
index 520546fb..fd2fac9b 100644
--- a/doc/ManageGeom.3
+++ b/doc/ManageGeom.3
@@ -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
diff --git a/doc/NameOfImg.3 b/doc/NameOfImg.3
index 8c191ce9..484e4796 100644
--- a/doc/NameOfImg.3
+++ b/doc/NameOfImg.3
@@ -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
diff --git a/doc/SetOptions.3 b/doc/SetOptions.3
index b5f07825..2a37de71 100644
--- a/doc/SetOptions.3
+++ b/doc/SetOptions.3
@@ -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
diff --git a/doc/bind.n b/doc/bind.n
index 1ecae86e..6ba115c7 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -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
+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.
diff --git a/doc/canvas.n b/doc/canvas.n
index 7dbfd192..4641c1c6 100644
--- a/doc/canvas.n
+++ b/doc/canvas.n
@@ -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.
@@ -1523,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.
diff --git a/doc/colors.n b/doc/colors.n
index 7a7b5b36..3747ee8b 100644
--- a/doc/colors.n
+++ b/doc/colors.n
@@ -784,30 +784,23 @@ YellowGreen 154 205 50
.TP
\fBMac OS X\fR
.
-On macOS, the following additional system colors are available.
-This first group contains all colors available in the HIToolbox library.
-(Note that in some cases the actual color values may depend on the
-current Appearance.)
+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
@@ -827,15 +820,10 @@ systemButtonPressedDarkHighlight
systemButtonPressedDarkShadow
systemButtonPressedLightHighlight
systemButtonPressedLightShadow
-systemButtonText
systemChasingArrows
-systemDialogActiveText
systemDialogBackgroundActive
systemDialogBackgroundInactive
-systemDialogInactiveText
systemDocumentWindowBackground
-systemDocumentWindowTitleActiveText
-systemDocumentWindowTitleInactiveText
systemDragHilite
systemDrawerBackground
systemFinderWindowBackground
@@ -843,111 +831,75 @@ 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
.
-The second group of MacOS colors below are based on Apple's "semantic"
-NScolors. On OSX 10.14 (Mojave) and later these colors change value
-when Dark Mode is enabled. However, the change is only observable
-when the Apple window manager is drawing to the screen. So the
-\fBwinfo rgb\fR command will return the color coordinates used in the
-standard Aqua mode, even if Dark Mode has been selected in the system
-preferences. The numbered systemWindowBackgroundColors are used in
-the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets to provide a
-contrasting background. Each numbered color constrasts with its
-predecessor.
+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
-systemSelectedTextBackgroundColor
+systemLabelColor
+systemLinkColor
+systemPlaceholderTextColor
+systemSelectedTextBackgroundColor
systemSelectedTextColor
+systemSeparatorColor
systemTextBackgroundColor
-systemTextColor
+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
@@ -960,7 +912,6 @@ systemWindowBackgroundColor7
.RE
.TP
-
\fBWindows\fR
.
On Windows, the following additional system colors are available
diff --git a/doc/console.n b/doc/console.n
index 1313d3a8..86dbd465 100644
--- a/doc/console.n
+++ b/doc/console.n
@@ -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
diff --git a/doc/entry.n b/doc/entry.n
index ccfcd249..dc2f8965 100644
--- a/doc/entry.n
+++ b/doc/entry.n
@@ -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
diff --git a/doc/frame.n b/doc/frame.n
index f2fbd96f..48004611 100644
--- a/doc/frame.n
+++ b/doc/frame.n
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
+'\"
.TH frame n 8.4 Tk "Tk Built-In Commands"
.so man.macros
.BS
@@ -116,7 +116,7 @@ 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
diff --git a/doc/grid.n b/doc/grid.n
index eb658e7d..5a175c75 100644
--- a/doc/grid.n
+++ b/doc/grid.n
@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
+'\"
.TH grid n 8.5 Tk "Tk Built-In Commands"
.so man.macros
.BS
@@ -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
diff --git a/doc/labelframe.n b/doc/labelframe.n
index 857208ec..5ca5ad70 100644
--- a/doc/labelframe.n
+++ b/doc/labelframe.n
@@ -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
diff --git a/doc/loadTk.n b/doc/loadTk.n
index 3673e982..e1c93c80 100644
--- a/doc/loadTk.n
+++ b/doc/loadTk.n
@@ -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:
diff --git a/doc/menu.n b/doc/menu.n
index 338ce6a5..e08448af 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -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
@@ -523,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
@@ -534,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.
@@ -552,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
@@ -573,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
@@ -603,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
diff --git a/doc/pack.n b/doc/pack.n
index 538af627..3ee14dd9 100644
--- a/doc/pack.n
+++ b/doc/pack.n
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
+'\"
.TH pack n 4.0 Tk "Tk Built-In Commands"
.so man.macros
.BS
@@ -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
diff --git a/doc/panedwindow.n b/doc/panedwindow.n
index 9fc2b726..9fb89d01 100644
--- a/doc/panedwindow.n
+++ b/doc/panedwindow.n
@@ -330,7 +330,7 @@ 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
+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
diff --git a/doc/place.n b/doc/place.n
index 3a092c26..6a30c555 100644
--- a/doc/place.n
+++ b/doc/place.n
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
+'\"
.TH place n "" Tk "Tk Built-In Commands"
.so man.macros
.BS
@@ -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:
diff --git a/doc/selection.n b/doc/selection.n
index ec678fa4..a2c5ae56 100644
--- a/doc/selection.n
+++ b/doc/selection.n
@@ -150,7 +150,7 @@ A GUI event, for example \fB<>\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
diff --git a/doc/spinbox.n b/doc/spinbox.n
index acf06d63..ad7123bf 100644
--- a/doc/spinbox.n
+++ b/doc/spinbox.n
@@ -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
diff --git a/doc/text.n b/doc/text.n
index 2a161e6e..ca46ee2a 100644
--- a/doc/text.n
+++ b/doc/text.n
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
+'\"
.TH text n 8.5 Tk "Tk Built-In Commands"
.so man.macros
.BS
@@ -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
@@ -2025,10 +2025,11 @@ 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
character underneath the mouse cursor, sets the input focus to this widget,
@@ -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
diff --git a/doc/tk_mac.n b/doc/tk_mac.n
index 87c43aa0..f42fa660 100644
--- a/doc/tk_mac.n
+++ b/doc/tk_mac.n
@@ -218,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
diff --git a/doc/ttk_Geometry.3 b/doc/ttk_Geometry.3
index 09d59e0c..0f8a171f 100644
--- a/doc/ttk_Geometry.3
+++ b/doc/ttk_Geometry.3
@@ -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
diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n
index 9d0bcc6b..37b91aa2 100644
--- a/doc/ttk_combobox.n
+++ b/doc/ttk_combobox.n
@@ -142,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
diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n
index adc4f16b..da183f71 100644
--- a/doc/ttk_entry.n
+++ b/doc/ttk_entry.n
@@ -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
@@ -353,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
@@ -447,6 +448,8 @@ Some themes use a graphical background and their field background colors cannot
.RE
\fB\-foreground\fP \fIcolor\fP
.br
+\fB\-insertcolor\fP \fIcolor\fP
+.br
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n
index 07e071bf..f93cbe3c 100644
--- a/doc/ttk_intro.n
+++ b/doc/ttk_intro.n
@@ -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
diff --git a/doc/ttk_notebook.n b/doc/ttk_notebook.n
index ae32a44e..efbfe6c5 100644
--- a/doc/ttk_notebook.n
+++ b/doc/ttk_notebook.n
@@ -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.
diff --git a/doc/ttk_spinbox.n b/doc/ttk_spinbox.n
index 9ae9881c..d7b7657a 100644
--- a/doc/ttk_spinbox.n
+++ b/doc/ttk_spinbox.n
@@ -107,6 +107,10 @@ value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored.
.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
diff --git a/doc/ttk_style.n b/doc/ttk_style.n
index db80d95e..0de33111 100644
--- a/doc/ttk_style.n
+++ b/doc/ttk_style.n
@@ -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
diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n
index 281ce748..82a15200 100644
--- a/doc/ttk_widget.n
+++ b/doc/ttk_widget.n
@@ -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.
diff --git a/doc/wm.n b/doc/wm.n
index a137d061..9ab90f51 100644
--- a/doc/wm.n
+++ b/doc/wm.n
@@ -708,18 +708,18 @@ 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
+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 \fImaster\fR (where \fImaster\fR is the path name for a
-top-level window). If \fImaster\fR is specified as an empty string
+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
-master, or an empty string if \fIwindow\fR is not currently a
+container, 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. The
-directed graph with an edge from each transient to its master must be
+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.,
diff --git a/generic/tk.decls b/generic/tk.decls
index 9ceb3af8..e891dbb6 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -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)
+}
##############################################################################
diff --git a/generic/tk.h b/generic/tk.h
index ce5902d9..af8e5ca1 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -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 10
+#define TK_RELEASE_SERIAL 11
#define TK_VERSION "8.6"
-#define TK_PATCH_LEVEL "8.6.10"
+#define TK_PATCH_LEVEL "8.6.11"
/*
* A special definition used to allow this header file to be included from
@@ -122,6 +122,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;
@@ -614,21 +615,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;
/*
@@ -884,6 +886,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
@@ -897,6 +903,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
@@ -905,6 +912,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
/*
*----------------------------------------------------------------------
@@ -1222,19 +1230,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,
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 987bace8..f1cc8f1d 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -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)
@@ -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);
@@ -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,7 +758,7 @@ 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;
@@ -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)) {
@@ -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");
diff --git a/generic/tkBind.c b/generic/tkBind.c
index f65d2ee8..ad592992 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -59,7 +59,9 @@
/*
* In old implementation (the one that used an event ring), and <1><1> were
- * equivalent sequences. However it is logical to give higher precedence.
+ * equivalent sequences. However it is logical to give higher precedence
+ * since it is more specific. Indeed includes time and space requirements,
+ * which is not the case for <1><1>.
* This can be achieved by setting PREFER_MOST_SPECIALIZED_EVENT to 1.
*/
@@ -135,17 +137,10 @@ typedef struct {
* this count considers the detail (keySym or button). */
} Event;
-/*
- * We need a structure providing a list of pattern sequences.
- */
-
-typedef unsigned EventMask;
-typedef unsigned long ModMask;
-
struct PatSeq; /* forward declaration */
/* We need this array for bookkeeping the last matching modifier mask per pattern. */
-TK_ARRAY_DEFINE(PSModMaskArr, ModMask);
+TK_ARRAY_DEFINE(PSModMaskArr, unsigned);
typedef struct PSEntry {
TK_DLIST_LINKS(PSEntry); /* Makes this struct a double linked list; must be first entry. */
@@ -201,7 +196,7 @@ typedef struct Tk_BindingTable_ {
/* Containing the most recent event for every event type. */
PromArr *promArr; /* Contains the promoted pattern sequences. */
Event *curEvent; /* Pointing to most recent event. */
- ModMask curModMask; /* Containing the current modifier mask. */
+ unsigned curModMask; /* Containing the current modifier mask. */
LookupTables lookupTables; /* Containing hash tables for fast lookup. */
Tcl_HashTable objectTable; /* Used to map from an object to a list of patterns associated with
* that object. Keys are ClientData, values are (PatSeq *). */
@@ -263,7 +258,7 @@ typedef struct {
typedef struct {
unsigned eventType; /* Type of X event, e.g. ButtonPress. */
unsigned count; /* Multi-event count, e.g. double-clicks, triple-clicks, etc. */
- ModMask modMask; /* Mask of modifiers that must be present (zero means no modifiers
+ unsigned modMask; /* Mask of modifiers that must be present (zero means no modifiers
* are required). */
Info info; /* Additional information that must match event. Normally this is zero,
* meaning no additional information must match. For KeyPress and
@@ -343,14 +338,6 @@ typedef struct PatSeq {
#define NEARBY_PIXELS 5
#define NEARBY_MS 500
-/*
- * Needed as "no-number" constant for integers. The value of this constant is
- * outside of integer range (type "int"). (Unfortunatly current version of
- * Tcl/Tk does not provide C99 integer support.)
- */
-
-#define NO_NUMBER (((Tcl_WideInt) (~ (unsigned) 0)) + 1)
-
/*
* The following structure is used in the nameTable of a virtual event table
* to associate a virtual event with all the physical events that can trigger
@@ -422,7 +409,7 @@ static Tcl_HashTable nameTable; /* keyArray hashed by keysym name. */
typedef struct {
const char *name; /* Name of modifier. */
- ModMask mask; /* Button/modifier mask value, such as Button1Mask. */
+ unsigned mask; /* Button/modifier mask value, such as Button1Mask. */
unsigned flags; /* Various flags; see below for definitions. */
} ModInfo;
@@ -561,13 +548,32 @@ static int eventArrayIndex[TK_LASTEVENT];
#define COLORMAP (1<<16)
#define VIRTUAL (1<<17)
#define ACTIVATE (1<<18)
-#define MAPREQ (1<<19)
-#define CONFIGREQ (1<<20)
-#define RESIZEREQ (1<<21)
-#define CIRCREQ (1<<22)
+#define WHEEL (1<<19)
+#define MAPREQ (1<<20)
+#define CONFIGREQ (1<<21)
+#define RESIZEREQ (1<<22)
+#define CIRCREQ (1<<23)
-#define KEY_BUTTON_MOTION_VIRTUAL (KEY|BUTTON|MOTION|VIRTUAL)
-#define KEY_BUTTON_MOTION_CROSSING (KEY|BUTTON|MOTION|VIRTUAL|CROSSING)
+/*
+ * These structs agree with xkey for the fields type, serial, send_event, display,
+ * window, root, subwindow, time, x, y, x_root, and y_root. So when accessing
+ * these fields we may pretend that we are using a struct xkey.
+ */
+
+#define HAS_XKEY_HEAD (KEY|BUTTON|MOTION|VIRTUAL|CROSSING|WHEEL)
+
+/*
+ * The xcrossing struct puts the state field in a different location, but the other
+ * events above agree on where state is located.
+ */
+
+#define HAS_XKEY_HEAD_AND_STATE (KEY|BUTTON|MOTION|VIRTUAL|WHEEL)
+
+/*
+ * Event types which support -warp.
+ */
+
+#define CAN_WARP (KEY|BUTTON|MOTION|WHEEL)
static const int flagArray[TK_LASTEVENT] = {
/* Not used */ 0,
@@ -608,7 +614,7 @@ static const int flagArray[TK_LASTEVENT] = {
/* VirtualEvent */ VIRTUAL,
/* Activate */ ACTIVATE,
/* Deactivate */ ACTIVATE,
- /* MouseWheel */ KEY
+ /* MouseWheel */ WHEEL
};
/*
@@ -700,7 +706,7 @@ static void ExpandPercents(TkWindow *winPtr, const char *before, Event *eventPt
unsigned scriptCount, Tcl_DString *dsPtr);
static PatSeq * FindSequence(Tcl_Interp *interp, LookupTables *lookupTables,
ClientData object, const char *eventString, int create,
- int allowVirtual, EventMask *maskPtr);
+ int allowVirtual, unsigned *maskPtr);
static void GetAllVirtualEvents(Tcl_Interp *interp, VirtualEventTable *vetPtr);
static const char * GetField(const char *p, char *copy, unsigned size);
static Tcl_Obj * GetPatternObj(const PatSeq *psPtr);
@@ -716,7 +722,7 @@ static PatSeq * MatchPatterns(TkDisplay *dispPtr, Tk_BindingTable bindPtr, PSLi
static int NameToWindow(Tcl_Interp *interp, Tk_Window main,
Tcl_Obj *objPtr, Tk_Window *tkwinPtr);
static unsigned ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr,
- TkPattern *patPtr, EventMask *eventMaskPtr);
+ TkPattern *patPtr, unsigned *eventMaskPtr);
static void DoWarp(ClientData clientData);
static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr,
Tcl_Obj *object, int onlyConsiderDetailedEvents);
@@ -748,8 +754,8 @@ static int TestNearbyCoords(int lhs, int rhs) { return Abs(lhs - rhs) <= NEARBY_
static int
IsSubsetOf(
- ModMask lhsMask, /* this is a subset */
- ModMask rhsMask) /* of this bit field? */
+ unsigned lhsMask, /* this is a subset */
+ unsigned rhsMask) /* of this bit field? */
{
return (lhsMask & rhsMask) == lhsMask;
}
@@ -784,7 +790,7 @@ GetButtonNumber(
}
static Time
-CurrentTimeInMilliSecs()
+CurrentTimeInMilliSecs(void)
{
Tcl_Time now;
Tcl_GetTime(&now);
@@ -835,6 +841,20 @@ CountSpecialized(
return sndCount - fstCount;
}
+int
+IsKeyEventType(
+ unsigned eventType)
+{
+ return eventType == KeyPress || eventType == KeyRelease;
+}
+
+int
+IsButtonEventType(
+ unsigned eventType)
+{
+ return eventType == ButtonPress || eventType == ButtonRelease;
+}
+
static int
MatchEventNearby(
const XEvent *lhs, /* previous button event */
@@ -842,7 +862,7 @@ MatchEventNearby(
{
assert(lhs);
assert(rhs);
- assert(lhs->type == ButtonPress || lhs->type == ButtonRelease);
+ assert(IsButtonEventType(lhs->type));
assert(lhs->type == rhs->type);
/* assert: lhs->xbutton.time <= rhs->xbutton.time */
@@ -854,16 +874,16 @@ MatchEventNearby(
static int
MatchEventRepeat(
- const XEvent *lhs, /* previous key event */
- const XEvent *rhs) /* current key event */
+ const XKeyEvent *lhs, /* previous key event */
+ const XKeyEvent *rhs) /* current key event */
{
assert(lhs);
assert(rhs);
- assert(lhs->type == KeyPress || lhs->type == KeyRelease);
+ assert(IsKeyEventType(lhs->type));
assert(lhs->type == rhs->type);
- /* assert: lhs->xkey.time <= rhs->xkey.time */
- return TestNearbyTime(rhs->xkey.time, lhs->xkey.time);
+ /* assert: lhs->time <= rhs->time */
+ return lhs->keycode == rhs->keycode && TestNearbyTime(lhs->time, rhs->time);
}
static void
@@ -922,7 +942,7 @@ ClearList(
static PSEntry *
FreePatSeqEntry(
- PSList *pool,
+ TCL_UNUSED(PSList *),
PSEntry *entry)
{
PSEntry *next = PSList_Next(entry);
@@ -940,13 +960,13 @@ ResolveModifiers(
if (dispPtr->metaModMask) {
if (modMask & META_MASK) {
- modMask &= ~(ModMask)META_MASK;
+ modMask &= ~META_MASK;
modMask |= dispPtr->metaModMask;
}
}
if (dispPtr->altModMask) {
if (modMask & ALT_MASK) {
- modMask &= ~(ModMask)ALT_MASK;
+ modMask &= ~ALT_MASK;
modMask |= dispPtr->altModMask;
}
}
@@ -1023,7 +1043,7 @@ MakeListEntry(
assert(TEST_PSENTRY(psPtr));
if (PSList_IsEmpty(pool)) {
- newEntry = ckalloc(sizeof(PSEntry));
+ newEntry = (PSEntry *)ckalloc(sizeof(PSEntry));
newEntry->lastModMaskArr = NULL;
DEBUG(countEntryItems += 1;)
} else {
@@ -1100,7 +1120,7 @@ GetLookupForEvent(
key.object = object;
key.type = eventPtr->xev.type;
hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key);
- return hPtr ? Tcl_GetHashValue(hPtr) : NULL;
+ return hPtr ? (PSList *)Tcl_GetHashValue(hPtr) : NULL;
}
/*
@@ -1138,17 +1158,17 @@ ClearLookupTable(
nextPtr = Tcl_NextHashEntry(&search);
if (object) {
- const PatternTableKey *key = Tcl_GetHashKey(&lookupTables->listTable, hPtr);
+ const PatternTableKey *key = (const PatternTableKey *)Tcl_GetHashKey(&lookupTables->listTable, hPtr);
if (key->object != object) {
continue;
}
- Tcl_DeleteHashEntry(hPtr);
}
- psList = Tcl_GetHashValue(hPtr);
+ psList = (PSList *)Tcl_GetHashValue(hPtr);
PSList_Move(pool, psList);
ckfree(psList);
DEBUG(countListItems -= 1;)
+ Tcl_DeleteHashEntry(hPtr);
}
}
@@ -1234,10 +1254,6 @@ TkBindInit(
/* ensure that our matching algorithm is working (when testing detail) */
assert(sizeof(Detail) == sizeof(Tk_Uid));
- /* test that constant NO_NUMBER is indeed out of integer range */
- assert(sizeof(NO_NUMBER) > sizeof(int));
- assert(((int) NO_NUMBER) == 0 && NO_NUMBER != 0);
-
/* test expected indices of Button1..Button5, otherwise our button handling is not working */
assert(Button1 == 1 && Button2 == 2 && Button3 == 3 && Button4 == 4 && Button5 == 5);
assert(Button2Mask == (Button1Mask << 1));
@@ -1359,7 +1375,7 @@ TkBindInit(
mainPtr->bindingTable = Tk_CreateBindingTable(mainPtr->interp);
- bindInfoPtr = ckalloc(sizeof(BindInfo));
+ bindInfoPtr = (BindInfo *)ckalloc(sizeof(BindInfo));
InitVirtualEventTable(&bindInfoPtr->virtualEventTable);
bindInfoPtr->screenInfo.curDispPtr = NULL;
bindInfoPtr->screenInfo.curScreenIndex = -1;
@@ -1435,7 +1451,7 @@ Tk_CreateBindingTable(
Tcl_Interp *interp) /* Interpreter to associate with the binding table: commands are
* executed in this interpreter. */
{
- BindingTable *bindPtr = ckalloc(sizeof(BindingTable));
+ BindingTable *bindPtr = (BindingTable *)ckalloc(sizeof(BindingTable));
unsigned i;
assert(interp);
@@ -1494,7 +1510,7 @@ Tk_DeleteBindingTable(
PatSeq *nextPtr;
PatSeq *psPtr;
- for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
+ for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
assert(TEST_PSENTRY(psPtr));
nextPtr = psPtr->nextSeqPtr;
FreePatSeq(psPtr);
@@ -1561,12 +1577,12 @@ InsertPatSeq(
hPtr = Tcl_CreateHashEntry(&lookupTables->listTable, (char *) &key, &isNew);
if (isNew) {
- psList = ckalloc(sizeof(PSList));
+ psList = (PSList *)ckalloc(sizeof(PSList));
PSList_Init(psList);
Tcl_SetHashValue(hPtr, psList);
DEBUG(countListItems += 1;)
} else {
- psList = Tcl_GetHashValue(hPtr);
+ psList = (PSList *)Tcl_GetHashValue(hPtr);
}
psEntry = MakeListEntry(&lookupTables->entryPool, psPtr, 0);
@@ -1611,7 +1627,7 @@ Tk_CreateBinding(
* existing binding will always be replaced. */
{
PatSeq *psPtr;
- EventMask eventMask;
+ unsigned eventMask;
char *oldStr;
char *newStr;
@@ -1654,7 +1670,7 @@ Tk_CreateBinding(
*/
hPtr = Tcl_CreateHashEntry(&bindPtr->objectTable, (char *) object, &isNew);
- psPtr->ptr.nextObj = isNew ? NULL : Tcl_GetHashValue(hPtr);
+ psPtr->ptr.nextObj = isNew ? NULL : (PatSeq *)Tcl_GetHashValue(hPtr);
Tcl_SetHashValue(hPtr, psPtr);
InsertPatSeq(&bindPtr->lookupTables, psPtr);
}
@@ -1664,14 +1680,14 @@ Tk_CreateBinding(
size_t length1 = strlen(oldStr);
size_t length2 = strlen(script);
- newStr = ckalloc(length1 + length2 + 2);
+ newStr = (char *)ckalloc(length1 + length2 + 2);
memcpy(newStr, oldStr, length1);
newStr[length1] = '\n';
memcpy(newStr + length1 + 1, script, length2 + 1);
} else {
size_t length = strlen(script);
- newStr = ckalloc(length + 1);
+ newStr = (char *)ckalloc(length + 1);
memcpy(newStr, script, length + 1);
}
ckfree(oldStr);
@@ -1726,7 +1742,7 @@ Tk_DeleteBinding(
if (!(hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, (char *) object))) {
Tcl_Panic("Tk_DeleteBinding couldn't find object table entry");
}
- prevPtr = Tcl_GetHashValue(hPtr);
+ prevPtr = (PatSeq *)Tcl_GetHashValue(hPtr);
if (prevPtr == psPtr) {
Tcl_SetHashValue(hPtr, psPtr->ptr.nextObj);
} else {
@@ -1827,7 +1843,7 @@ Tk_GetAllBindings(
* For each binding, output information about each of the patterns in its sequence.
*/
- for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = psPtr->ptr.nextObj) {
+ for (psPtr = (const PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = psPtr->ptr.nextObj) {
assert(TEST_PSENTRY(psPtr));
Tcl_ListObjAppendElement(NULL, resultObj, GetPatternObj(psPtr));
}
@@ -1866,7 +1882,7 @@ RemovePatSeqFromLookup(
SetupPatternKey(&key, psPtr);
if ((hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key))) {
- PSList *psList = Tcl_GetHashValue(hPtr);
+ PSList *psList = (PSList *)Tcl_GetHashValue(hPtr);
PSEntry *psEntry;
TK_DLIST_FOREACH(psEntry, psList) {
@@ -1950,7 +1966,7 @@ DeletePatSeq(
assert(!psPtr->added);
assert(!psPtr->owned);
- prevPtr = Tcl_GetHashValue(psPtr->hPtr);
+ prevPtr = (PatSeq *)Tcl_GetHashValue(psPtr->hPtr);
nextPtr = psPtr->ptr.nextObj;
/*
@@ -2021,7 +2037,7 @@ Tk_DeleteAllBindings(
ClearLookupTable(&bindPtr->lookupTables, object);
ClearPromotionLists(bindPtr, object);
- for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
+ for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
assert(TEST_PSENTRY(psPtr));
DEBUG(psPtr->added = 0;)
nextPtr = DeletePatSeq(psPtr);
@@ -2136,7 +2152,7 @@ Tk_BindEvent(
TkDisplay *dispPtr;
TkDisplay *oldDispPtr;
Event *curEvent;
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
BindInfo *bindInfoPtr;
Tcl_InterpState interpState;
LookupTables *physTables;
@@ -2178,7 +2194,7 @@ Tk_BindEvent(
return;
}
- if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
+ if (flags & HAS_XKEY_HEAD_AND_STATE) {
bindPtr->curModMask = eventPtr->xkey.state;
} else if (flags & CROSSING) {
bindPtr->curModMask = eventPtr->xcrossing.state;
@@ -2192,7 +2208,7 @@ Tk_BindEvent(
* Ignore the event completely if it is an Enter, Leave, FocusIn, or
* FocusOut event with detail NotifyInferior. The reason for ignoring
* these events is that we don't want transitions between a window and its
- * children to visible to bindings on the parent: this would cause
+ * children to be visible to bindings on the parent: this would cause
* problems for mega-widgets, since the internal structure of a
* mega-widget isn't supposed to be visible to people watching the parent.
*
@@ -2276,7 +2292,7 @@ Tk_BindEvent(
switch (eventPtr->type) {
case KeyPress:
case KeyRelease:
- if (MatchEventRepeat(&curEvent->xev, eventPtr)) {
+ if (MatchEventRepeat(&curEvent->xev.xkey, &eventPtr->xkey)) {
if (curEvent->xev.xkey.keycode == eventPtr->xkey.keycode) {
++curEvent->countDetailed;
} else {
@@ -2346,7 +2362,7 @@ Tk_BindEvent(
if ((size_t) numObjects > SIZE_OF_ARRAY(matchPtrBuf)) {
/* it's unrealistic that the buffer size is too small, but who knows? */
- matchPtrArr = ckalloc(numObjects*sizeof(matchPtrArr[0]));
+ matchPtrArr = (PatSeq **)ckalloc(numObjects*sizeof(matchPtrArr[0]));
}
memset(matchPtrArr, 0, numObjects*sizeof(matchPtrArr[0]));
@@ -2387,8 +2403,8 @@ Tk_BindEvent(
PSList *psSuccList = PromArr_First(bindPtr->promArr);
PatSeq *bestPtr;
- psl[0] = GetLookupForEvent(physTables, curEvent, objArr[k], 1);
- psl[1] = GetLookupForEvent(physTables, curEvent, objArr[k], 0);
+ psl[0] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 1);
+ psl[1] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 0);
assert(psl[0] == NULL || psl[0] != psl[1]);
@@ -2426,7 +2442,6 @@ Tk_BindEvent(
LookupTables *virtTables = &bindInfoPtr->virtualEventTable.lookupTables;
PatSeq *matchPtr = matchPtrArr[k];
PatSeq *mPtr;
- PSList *psl[2];
/*
* Note that virtual events cannot promote.
@@ -2500,13 +2515,13 @@ Tk_BindEvent(
switch (patPtr->eventType) {
case ButtonPress:
case ButtonRelease:
- if (curEvent->xev.type == KeyPress || curEvent->xev.type == KeyRelease) {
+ if (IsKeyEventType(curEvent->xev.type)) {
RemoveListEntry(&bindPtr->lookupTables.entryPool, psEntry);
}
break;
case KeyPress:
case KeyRelease:
- if (curEvent->xev.type == ButtonPress || curEvent->xev.type == ButtonRelease) {
+ if (IsButtonEventType(curEvent->xev.type)) {
RemoveListEntry(&bindPtr->lookupTables.entryPool, psEntry);
}
break;
@@ -2704,8 +2719,8 @@ static int
CompareModMasks(
const PSModMaskArr *fstModMaskArr,
const PSModMaskArr *sndModMaskArr,
- ModMask fstModMask,
- ModMask sndModMask)
+ unsigned fstModMask,
+ unsigned sndModMask)
{
int fstCount = 0;
int sndCount = 0;
@@ -2729,11 +2744,11 @@ CompareModMasks(
assert(PSModMaskArr_Size(fstModMaskArr) == PSModMaskArr_Size(sndModMaskArr));
for (i = PSModMaskArr_Size(fstModMaskArr) - 1; i >= 0; --i) {
- ModMask fstModMask = *PSModMaskArr_Get(fstModMaskArr, i);
- ModMask sndModMask = *PSModMaskArr_Get(sndModMaskArr, i);
+ unsigned fstiModMask = *PSModMaskArr_Get(fstModMaskArr, i);
+ unsigned sndiModMask = *PSModMaskArr_Get(sndModMaskArr, i);
- if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; }
- if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; }
+ if (IsSubsetOf(fstiModMask, sndiModMask)) { ++sndCount; }
+ if (IsSubsetOf(sndiModMask, fstiModMask)) { ++fstCount; }
}
}
@@ -2763,8 +2778,9 @@ MatchPatterns(
PSEntry *psEntry;
PatSeq *bestPtr;
PatSeq *bestPhysPtr;
- ModMask bestModMask;
+ unsigned bestModMask;
const PSModMaskArr *bestModMaskArr = NULL;
+ int i, isModKeyOnly = 0;
assert(dispPtr);
assert(bindPtr);
@@ -2779,6 +2795,26 @@ MatchPatterns(
bestPhysPtr = NULL;
window = curEvent->xev.xany.window;
+ /*
+ * Modifier key events interlaced between patterns parts of a
+ * sequence shall not prevent a sequence from ultimately
+ * matching. Example: when trying to trigger
+ * from the keyboard, the sequence of events actually seen is
+ * then (possibly repeating if the key is hold
+ * down), and finally . At the time is
+ * seen, we shall keep the pattern sequence in
+ * the promotion list, otherwise it is impossible to trigger
+ * it from the keyboard. See bug [16ef161925].
+ */
+ if (IsKeyEventType(curEvent->xev.type)) {
+ for (i = 0; i < dispPtr->numModKeyCodes; ++i) {
+ if (dispPtr->modKeyCodes[i] == curEvent->xev.xkey.keycode) {
+ isModKeyOnly = 1;
+ break;
+ }
+ }
+ }
+
for (psEntry = PSList_First(psList); psEntry; psEntry = PSList_Next(psEntry)) {
if (patIndex == 0 || psEntry->window == window) {
PatSeq* psPtr = psEntry->psPtr;
@@ -2793,6 +2829,12 @@ MatchPatterns(
: VirtPatIsBound(bindPtr, psPtr, object, physPtrPtr)) {
TkPattern *patPtr = psPtr->pats + patIndex;
+ /* ignore modifier key events, and KeyRelease events if the current event
+ * is of a different type (e.g. a Button event)
+ */
+ psEntry->keepIt = isModKeyOnly || \
+ ((patPtr->eventType != (unsigned) curEvent->xev.type) && curEvent->xev.type == KeyRelease);
+
if (patPtr->eventType == (unsigned) curEvent->xev.type
&& (curEvent->xev.type != CreateNotify
|| curEvent->xev.xcreatewindow.parent == window)
@@ -2803,12 +2845,13 @@ MatchPatterns(
* cannot be done in ParseEventDescription, otherwise this function would
* be the better place.
*/
- ModMask modMask = ResolveModifiers(dispPtr, patPtr->modMask);
- ModMask curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask);
+ unsigned modMask = ResolveModifiers(dispPtr, patPtr->modMask);
+ unsigned curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask);
psEntry->expired = 1; /* remove it from promotion list */
+ psEntry->keepIt = 0; /* don't keep matching patterns */
- if ((modMask & ~curModMask) == 0) {
+ if (IsSubsetOf(modMask, curModMask)) {
unsigned count = patPtr->info ? curEvent->countDetailed : curEvent->countAny;
if (patIndex < PSModMaskArr_Size(psEntry->lastModMaskArr)) {
@@ -2924,10 +2967,21 @@ ExpandPercents(
evPtr = &eventPtr->xev;
flags = (evPtr->type < TK_LASTEVENT) ? flagArray[evPtr->type] : 0;
+#define SET_NUMBER(value) { number = (value); \
+ snprintf(numStorage, sizeof(numStorage), "%" TCL_LL_MODIFIER "d", number); \
+ string = numStorage; \
+ }
+
+#define SET_UNUMBER(value) { unumber = (value); \
+ snprintf(numStorage, sizeof(numStorage), "%" TCL_LL_MODIFIER "u", unumber); \
+ string = numStorage; \
+ }
+
while (1) {
char numStorage[TCL_INTEGER_SPACE];
const char *string;
- Tcl_WideInt number;
+ Tcl_WideInt number; /* signed */
+ Tcl_WideUInt unumber; /* unsigned */
/*
* Find everything up to the next % character and append it to the
@@ -2948,12 +3002,10 @@ ExpandPercents(
* There's a percent sequence here. Process it.
*/
- number = NO_NUMBER;
string = "??";
-
switch (before[1]) {
case '#':
- number = evPtr->xany.serial;
+ SET_UNUMBER(evPtr->xany.serial);
break;
case 'a':
if (flags & CONFIG) {
@@ -2963,12 +3015,12 @@ ExpandPercents(
break;
case 'b':
if (flags & BUTTON) {
- number = evPtr->xbutton.button;
+ SET_UNUMBER(evPtr->xbutton.button);
}
break;
case 'c':
if (flags & EXPOSE) {
- number = evPtr->xexpose.count;
+ SET_NUMBER(evPtr->xexpose.count);
}
break;
case 'd':
@@ -2988,20 +3040,20 @@ ExpandPercents(
break;
case 'f':
if (flags & CROSSING) {
- number = evPtr->xcrossing.focus;
+ SET_NUMBER(evPtr->xcrossing.focus != 0);
}
break;
case 'h':
if (flags & EXPOSE) {
- number = evPtr->xexpose.height;
+ SET_NUMBER(evPtr->xexpose.height);
} else if (flags & CONFIG) {
- number = evPtr->xconfigure.height;
+ SET_NUMBER(evPtr->xconfigure.height);
} else if (flags & CREATE) {
- number = evPtr->xcreatewindow.height;
+ SET_NUMBER(evPtr->xcreatewindow.height);
} else if (flags & CONFIGREQ) {
- number = evPtr->xconfigurerequest.height;
+ SET_NUMBER(evPtr->xconfigurerequest.height);
} else if (flags & RESIZEREQ) {
- number = evPtr->xresizerequest.height;
+ SET_NUMBER(evPtr->xresizerequest.height);
}
break;
case 'i':
@@ -3017,8 +3069,8 @@ ExpandPercents(
string = numStorage;
break;
case 'k':
- if ((flags & KEY) && evPtr->type != MouseWheelEvent) {
- number = evPtr->xkey.keycode;
+ if (flags & KEY) {
+ SET_UNUMBER(evPtr->xkey.keycode);
}
break;
case 'm':
@@ -3030,13 +3082,13 @@ ExpandPercents(
break;
case 'o':
if (flags & CREATE) {
- number = evPtr->xcreatewindow.override_redirect;
+ SET_NUMBER(evPtr->xcreatewindow.override_redirect != 0);
} else if (flags & MAP) {
- number = evPtr->xmap.override_redirect;
+ SET_NUMBER(evPtr->xmap.override_redirect != 0);
} else if (flags & REPARENT) {
- number = evPtr->xreparent.override_redirect;
+ SET_NUMBER(evPtr->xreparent.override_redirect != 0);
} else if (flags & CONFIG) {
- number = evPtr->xconfigure.override_redirect;
+ SET_NUMBER(evPtr->xconfigure.override_redirect != 0);
}
break;
case 'p':
@@ -3047,10 +3099,10 @@ ExpandPercents(
}
break;
case 's':
- if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
- number = evPtr->xkey.state;
+ if (flags & HAS_XKEY_HEAD_AND_STATE) {
+ SET_UNUMBER(evPtr->xkey.state);
} else if (flags & CROSSING) {
- number = evPtr->xcrossing.state;
+ SET_UNUMBER(evPtr->xcrossing.state);
} else if (flags & PROP) {
string = TkFindStateString(propNotify, evPtr->xproperty.state);
} else if (flags & VISIBILITY) {
@@ -3058,92 +3110,79 @@ ExpandPercents(
}
break;
case 't':
- if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
- number = (int) evPtr->xkey.time;
- } else if (flags & CROSSING) {
- number = (int) evPtr->xcrossing.time;
+ if (flags & HAS_XKEY_HEAD) {
+ SET_UNUMBER(evPtr->xkey.time);
} else if (flags & PROP) {
- number = (int) evPtr->xproperty.time;
+ SET_UNUMBER(evPtr->xproperty.time);
}
break;
case 'v':
- number = evPtr->xconfigurerequest.value_mask;
+ SET_UNUMBER(evPtr->xconfigurerequest.value_mask);
break;
case 'w':
if (flags & EXPOSE) {
- number = evPtr->xexpose.width;
+ SET_NUMBER(evPtr->xexpose.width);
} else if (flags & CONFIG) {
- number = evPtr->xconfigure.width;
+ SET_NUMBER(evPtr->xconfigure.width);
} else if (flags & CREATE) {
- number = evPtr->xcreatewindow.width;
+ SET_NUMBER(evPtr->xcreatewindow.width);
} else if (flags & CONFIGREQ) {
- number = evPtr->xconfigurerequest.width;
+ SET_NUMBER(evPtr->xconfigurerequest.width);
} else if (flags & RESIZEREQ) {
- number = evPtr->xresizerequest.width;
+ SET_NUMBER(evPtr->xresizerequest.width);
}
break;
case 'x':
- if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
- number = evPtr->xkey.x;
- } else if (flags & CROSSING) {
- number = evPtr->xcrossing.x;
+ if (flags & HAS_XKEY_HEAD) {
+ SET_NUMBER(evPtr->xkey.x);
} else if (flags & EXPOSE) {
- number = evPtr->xexpose.x;
+ SET_NUMBER(evPtr->xexpose.x);
} else if (flags & (CREATE|CONFIG|GRAVITY)) {
- number = evPtr->xcreatewindow.x;
+ SET_NUMBER(evPtr->xcreatewindow.x);
} else if (flags & REPARENT) {
- number = evPtr->xreparent.x;
- } else if (flags & CREATE) {
- number = evPtr->xcreatewindow.x;
+ SET_NUMBER(evPtr->xreparent.x);
} else if (flags & CONFIGREQ) {
- number = evPtr->xconfigurerequest.x;
+ SET_NUMBER(evPtr->xconfigurerequest.x);
}
break;
case 'y':
- if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
- number = evPtr->xkey.y;
+ if (flags & HAS_XKEY_HEAD) {
+ SET_NUMBER(evPtr->xkey.y);
} else if (flags & EXPOSE) {
- number = evPtr->xexpose.y;
+ SET_NUMBER(evPtr->xexpose.y);
} else if (flags & (CREATE|CONFIG|GRAVITY)) {
- number = evPtr->xcreatewindow.y;
+ SET_NUMBER(evPtr->xcreatewindow.y);
} else if (flags & REPARENT) {
- number = evPtr->xreparent.y;
- } else if (flags & CROSSING) {
- number = evPtr->xcrossing.y;
- } else if (flags & CREATE) {
- number = evPtr->xcreatewindow.y;
+ SET_NUMBER(evPtr->xreparent.y);
} else if (flags & CONFIGREQ) {
- number = evPtr->xconfigurerequest.y;
+ SET_NUMBER(evPtr->xconfigurerequest.y);
}
break;
case 'A':
- if ((flags & KEY) && evPtr->type != MouseWheelEvent) {
+ if (flags & KEY) {
Tcl_DStringFree(&buf);
string = TkpGetString(winPtr, evPtr, &buf);
}
break;
case 'B':
if (flags & CREATE) {
- number = evPtr->xcreatewindow.border_width;
+ SET_NUMBER(evPtr->xcreatewindow.border_width);
} else if (flags & CONFIGREQ) {
- number = evPtr->xconfigurerequest.border_width;
+ SET_NUMBER(evPtr->xconfigurerequest.border_width);
} else if (flags & CONFIG) {
- number = evPtr->xconfigure.border_width;
+ SET_NUMBER(evPtr->xconfigure.border_width);
}
break;
case 'D':
- /*
- * This is used only by the MouseWheel event.
- */
- if ((flags & KEY) && evPtr->type == MouseWheelEvent) {
- number = evPtr->xkey.keycode;
+ if (flags & WHEEL) {
+ SET_NUMBER((int)evPtr->xbutton.button); /* mis-use button field for this */
}
break;
case 'E':
- number = (int) evPtr->xany.send_event;
+ SET_NUMBER(evPtr->xany.send_event != 0);
break;
case 'K':
- if ((flags & KEY) && evPtr->type != MouseWheelEvent) {
+ if (flags & KEY) {
const char *name = TkKeysymToString(eventPtr->detail.info);
if (name) {
string = name;
@@ -3151,11 +3190,11 @@ ExpandPercents(
}
break;
case 'M':
- number = scriptCount;
+ SET_UNUMBER(scriptCount);
break;
case 'N':
- if ((flags & KEY) && evPtr->type != MouseWheelEvent) {
- number = (int) eventPtr->detail.info;
+ if (flags & KEY) {
+ SET_UNUMBER(eventPtr->detail.info);
}
break;
case 'P':
@@ -3164,19 +3203,19 @@ ExpandPercents(
}
break;
case 'R':
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
TkpPrintWindowId(numStorage, evPtr->xkey.root);
string = numStorage;
}
break;
case 'S':
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
TkpPrintWindowId(numStorage, evPtr->xkey.subwindow);
string = numStorage;
}
break;
case 'T':
- number = evPtr->type;
+ SET_NUMBER(evPtr->type);
break;
case 'W': {
Tk_Window tkwin = Tk_IdToWindow(evPtr->xany.display, evPtr->xany.window);
@@ -3186,13 +3225,13 @@ ExpandPercents(
break;
}
case 'X':
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
- number = evPtr->xkey.x_root;
+ if (flags & HAS_XKEY_HEAD) {
+ SET_NUMBER(evPtr->xkey.x_root);
}
break;
case 'Y':
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
- number = evPtr->xkey.y_root;
+ if (flags & HAS_XKEY_HEAD) {
+ SET_NUMBER(evPtr->xkey.y_root);
}
break;
default:
@@ -3201,11 +3240,6 @@ ExpandPercents(
string = numStorage;
break;
}
-
- if (number != NO_NUMBER) {
- snprintf(numStorage, sizeof(numStorage), "%d", (int) number);
- string = numStorage;
- }
{ /* local scope */
int cvtFlags;
unsigned spaceNeeded = Tcl_ScanElement(string, &cvtFlags);
@@ -3219,6 +3253,9 @@ ExpandPercents(
}
}
+#undef SET_NUMBER
+#undef SET_UNUMBER
+
Tcl_DStringFree(&buf);
}
@@ -3430,7 +3467,7 @@ DeleteVirtualEventTable(
PatSeq *nextPtr;
PatSeq *psPtr;
- for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
+ for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
assert(TEST_PSENTRY(psPtr));
nextPtr = psPtr->nextSeqPtr;
DEBUG(psPtr->owned = 0;)
@@ -3444,9 +3481,10 @@ DeleteVirtualEventTable(
ckfree(Tcl_GetHashValue(hPtr));
}
Tcl_DeleteHashTable(&vetPtr->nameTable);
- Tcl_DeleteHashTable(&vetPtr->lookupTables.listTable);
ClearLookupTable(&vetPtr->lookupTables, NULL);
+ Tcl_DeleteHashTable(&vetPtr->lookupTables.listTable);
+
DEBUG(countEntryItems -= PSList_Size(&vetPtr->lookupTables.entryPool);)
PSList_Traverse(&vetPtr->lookupTables.entryPool, FreePatSeqEntry);
}
@@ -3460,7 +3498,7 @@ DeleteVirtualEventTable(
* already defined, the new definition augments those that already exist.
*
* Results:
- * The return value is TCL_ERROR if an error occured while creating the
+ * The return value is TCL_ERROR if an error occurred while creating the
* virtual binding. In this case, an error message will be left in the
* interp's result. If all went well then the return value is TCL_OK.
*
@@ -3511,7 +3549,7 @@ CreateVirtualEvent(
* Make virtual event own the physical event.
*/
- owned = Tcl_GetHashValue(vhPtr);
+ owned = (PhysOwned *)Tcl_GetHashValue(vhPtr);
if (!PhysOwned_Contains(owned, psPtr)) {
PhysOwned_Append(&owned, psPtr);
@@ -3573,7 +3611,7 @@ DeleteVirtualEvent(
if (!(vhPtr = Tcl_FindHashEntry(&vetPtr->nameTable, virtUid))) {
return TCL_OK;
}
- owned = Tcl_GetHashValue(vhPtr);
+ owned = (PhysOwned *)Tcl_GetHashValue(vhPtr);
eventPSPtr = NULL;
if (eventString) {
@@ -3705,7 +3743,7 @@ GetVirtualEvent(
}
resultObj = Tcl_NewObj();
- owned = Tcl_GetHashValue(vhPtr);
+ owned = (const PhysOwned *)Tcl_GetHashValue(vhPtr);
for (iPhys = 0; iPhys < PhysOwned_Size(owned); ++iPhys) {
Tcl_ListObjAppendElement(NULL, resultObj, GetPatternObj(PhysOwned_Get(owned, iPhys)));
}
@@ -3794,7 +3832,7 @@ HandleEventGenerate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- union { XEvent general; XVirtualEvent virtual; } event;
+ union { XEvent general; XVirtualEvent virt; } event;
const char *p;
const char *name;
@@ -3804,7 +3842,7 @@ HandleEventGenerate(
Tk_Window tkwin;
Tk_Window tkwin2;
TkWindow *mainPtr;
- EventMask eventMask;
+ unsigned eventMask;
Tcl_Obj *userDataObj;
int synch;
int warp;
@@ -3890,21 +3928,21 @@ HandleEventGenerate(
Tk_DestroyWindow(tkwin);
return TCL_OK;
}
- if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
+ if (flags & HAS_XKEY_HEAD_AND_STATE) {
event.general.xkey.state = pat.modMask;
- if ((flags & KEY) && event.general.xany.type != MouseWheelEvent) {
+ if (flags & KEY) {
TkpSetKeycodeAndState(tkwin, pat.info, &event.general);
} else if (flags & BUTTON) {
event.general.xbutton.button = pat.info;
} else if (flags & VIRTUAL) {
- event.virtual.name = pat.name;
+ event.virt.name = pat.name;
}
}
if (flags & (CREATE|UNMAP|MAP|REPARENT|CONFIG|GRAVITY|CIRC)) {
event.general.xcreatewindow.window = event.general.xany.window;
}
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
event.general.xkey.x_root = -1;
event.general.xkey.y_root = -1;
}
@@ -3952,7 +3990,7 @@ HandleEventGenerate(
if (Tcl_GetBooleanFromObj(interp, valuePtr, &warp) != TCL_OK) {
return TCL_ERROR;
}
- if (!(flags & KEY_BUTTON_MOTION_VIRTUAL)) {
+ if (!(flags & CAN_WARP)) {
badOpt = 1;
}
break;
@@ -4019,8 +4057,8 @@ HandleEventGenerate(
if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- if ((flags & KEY) && event.general.xkey.type == MouseWheelEvent) {
- event.general.xkey.keycode = number;
+ if (flags & WHEEL) {
+ event.general.xbutton.button = (unsigned)number; /* mis-use button field for this */
} else {
badOpt = 1;
}
@@ -4064,7 +4102,7 @@ HandleEventGenerate(
if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- if ((flags & KEY) && event.general.xkey.type != MouseWheelEvent) {
+ if (flags & KEY) {
event.general.xkey.keycode = number;
} else {
badOpt = 1;
@@ -4088,7 +4126,7 @@ HandleEventGenerate(
Tcl_SetErrorCode(interp, "TK", "LOOKUP", "KEYCODE", value, NULL);
return TCL_ERROR;
}
- if (!(flags & KEY) || (event.general.xkey.type == MouseWheelEvent)) {
+ if (!(flags & KEY)) {
badOpt = 1;
}
break;
@@ -4135,7 +4173,7 @@ HandleEventGenerate(
if (!NameToWindow(interp, tkwin, valuePtr, &tkwin2)) {
return TCL_ERROR;
}
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
event.general.xkey.root = Tk_WindowId(tkwin2);
} else {
badOpt = 1;
@@ -4145,7 +4183,7 @@ HandleEventGenerate(
if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
event.general.xkey.x_root = number;
} else {
badOpt = 1;
@@ -4155,7 +4193,7 @@ HandleEventGenerate(
if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
event.general.xkey.y_root = number;
} else {
badOpt = 1;
@@ -4194,11 +4232,11 @@ HandleEventGenerate(
event.general.xany.serial = number;
break;
case EVENT_STATE:
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
+ if (flags & HAS_XKEY_HEAD_AND_STATE) {
event.general.xkey.state = number;
} else {
event.general.xcrossing.state = number;
@@ -4216,7 +4254,7 @@ HandleEventGenerate(
if (!NameToWindow(interp, tkwin, valuePtr, &tkwin2)) {
return TCL_ERROR;
}
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
event.general.xkey.subwindow = Tk_WindowId(tkwin2);
} else {
badOpt = 1;
@@ -4230,7 +4268,7 @@ HandleEventGenerate(
} else if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
event.general.xkey.time = number;
} else if (flags & PROP) {
event.general.xproperty.time = number;
@@ -4265,7 +4303,7 @@ HandleEventGenerate(
if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
event.general.xkey.x = number;
/*
@@ -4292,7 +4330,7 @@ HandleEventGenerate(
if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) {
return TCL_ERROR;
}
- if (flags & KEY_BUTTON_MOTION_CROSSING) {
+ if (flags & HAS_XKEY_HEAD) {
event.general.xkey.y = number;
/*
@@ -4337,21 +4375,10 @@ HandleEventGenerate(
* refcount before firing it into the low-level event subsystem; the
* refcount will be decremented once the event has been processed.
*/
- event.virtual.user_data = userDataObj;
+ event.virt.user_data = userDataObj;
Tcl_IncrRefCount(userDataObj);
}
- /*
- * Now we have constructed the event, inject it into the event handling
- * code.
- */
-
- if (synch) {
- Tk_HandleEvent(&event.general);
- } else {
- Tk_QueueWindowEvent(&event.general, pos);
- }
-
/*
* We only allow warping if the window is mapped.
*/
@@ -4361,11 +4388,6 @@ HandleEventGenerate(
Tk_Window warpWindow = Tk_IdToWindow(dispPtr->display, event.general.xmotion.window);
- if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) {
- Tcl_DoWhenIdle(DoWarp, dispPtr);
- dispPtr->flags |= TK_DISPLAY_IN_WARP;
- }
-
if (warpWindow != dispPtr->warpWindow) {
if (warpWindow) {
Tcl_Preserve(warpWindow);
@@ -4378,6 +4400,22 @@ HandleEventGenerate(
dispPtr->warpMainwin = mainWin;
dispPtr->warpX = event.general.xmotion.x;
dispPtr->warpY = event.general.xmotion.y;
+
+ if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) {
+ Tcl_DoWhenIdle(DoWarp, dispPtr);
+ dispPtr->flags |= TK_DISPLAY_IN_WARP;
+ }
+ }
+
+ /*
+ * Now we have constructed the event, inject it into the event handling
+ * code.
+ */
+
+ if (synch) {
+ Tk_HandleEvent(&event.general);
+ } else {
+ Tk_QueueWindowEvent(&event.general, pos);
}
}
@@ -4576,7 +4614,7 @@ FindSequence(
* 1 means create. */
int allowVirtual, /* 0 means that virtual events are not allowed in the sequence.
* 1 otherwise. */
- EventMask *maskPtr) /* *maskPtr is filled in with the event types on which this
+ unsigned *maskPtr) /* *maskPtr is filled in with the event types on which this
* pattern sequence depends. */
{
unsigned patsBufSize = 1;
@@ -4590,14 +4628,14 @@ FindSequence(
int isNew;
unsigned count;
unsigned maxCount = 0;
- EventMask eventMask = 0;
- ModMask modMask = 0;
+ unsigned eventMask = 0;
+ unsigned modMask = 0;
PatternTableKey key;
assert(lookupTables);
assert(eventString);
- psPtr = ckalloc(PATSEQ_MEMSIZE(patsBufSize));
+ psPtr = (PatSeq *)ckalloc(PATSEQ_MEMSIZE(patsBufSize));
/*
*------------------------------------------------------------------
@@ -4609,7 +4647,7 @@ FindSequence(
if (numPats >= patsBufSize) {
unsigned pos = patPtr - psPtr->pats;
patsBufSize += patsBufSize;
- psPtr = ckrealloc(psPtr, PATSEQ_MEMSIZE(patsBufSize));
+ psPtr = (PatSeq *)ckrealloc(psPtr, PATSEQ_MEMSIZE(patsBufSize));
patPtr = psPtr->pats + pos;
}
@@ -4658,18 +4696,18 @@ FindSequence(
return NULL;
}
if (patsBufSize > numPats) {
- psPtr = ckrealloc(psPtr, PATSEQ_MEMSIZE(numPats));
+ psPtr = (PatSeq *)ckrealloc(psPtr, PATSEQ_MEMSIZE(numPats));
}
patPtr = psPtr->pats;
- psPtr->object = object;
+ psPtr->object = (Tcl_Obj *)object;
SetupPatternKey(&key, psPtr);
hPtr = Tcl_CreateHashEntry(&lookupTables->patternTable, (char *) &key, &isNew);
if (!isNew) {
unsigned sequenceSize = numPats*sizeof(TkPattern);
PatSeq *psPtr2;
- for (psPtr2 = Tcl_GetHashValue(hPtr); psPtr2; psPtr2 = psPtr2->nextSeqPtr) {
+ for (psPtr2 = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr2; psPtr2 = psPtr2->nextSeqPtr) {
assert(TEST_PSENTRY(psPtr2));
if (numPats == psPtr2->numPats && memcmp(patPtr, psPtr2->pats, sequenceSize) == 0) {
ckfree(psPtr);
@@ -4705,7 +4743,7 @@ FindSequence(
psPtr->added = 0;
psPtr->modMaskUsed = (modMask != 0);
psPtr->script = NULL;
- psPtr->nextSeqPtr = Tcl_GetHashValue(hPtr);
+ psPtr->nextSeqPtr = (PatSeq *)Tcl_GetHashValue(hPtr);
psPtr->hPtr = hPtr;
psPtr->ptr.nextObj = NULL;
assert(psPtr->ptr.owners == NULL);
@@ -4765,10 +4803,10 @@ ParseEventDescription(
const char **eventStringPtr,/* On input, holds a pointer to start of event string. On exit,
* gets pointer to rest of string after parsed event. */
TkPattern *patPtr, /* Filled with the pattern parsed from the event string. */
- EventMask *eventMaskPtr) /* Filled with event mask of matched event. */
+ unsigned *eventMaskPtr) /* Filled with event mask of matched event. */
{
const char *p;
- EventMask eventMask = 0;
+ unsigned eventMask = 0;
unsigned count = 1;
assert(eventStringPtr);
@@ -4847,7 +4885,7 @@ ParseEventDescription(
size = p - field;
if (size >= sizeof(buf)) {
- bufPtr = ckalloc(size + 1);
+ bufPtr = (char *)ckalloc(size + 1);
}
strncpy(bufPtr, field, size);
bufPtr[size] = '\0';
@@ -4879,7 +4917,7 @@ ParseEventDescription(
if (!(hPtr = Tcl_FindHashEntry(&modTable, field))) {
break;
}
- modPtr = Tcl_GetHashValue(hPtr);
+ modPtr = (ModInfo *)Tcl_GetHashValue(hPtr);
patPtr->modMask |= modPtr->mask;
if (modPtr->flags & MULT_CLICKS) {
unsigned i = modPtr->flags & MULT_CLICKS;
@@ -4894,7 +4932,7 @@ ParseEventDescription(
eventFlags = 0;
if ((hPtr = Tcl_FindHashEntry(&eventTable, field))) {
- const EventInfo *eiPtr = Tcl_GetHashValue(hPtr);
+ const EventInfo *eiPtr = (const EventInfo *)Tcl_GetHashValue(hPtr);
patPtr->eventType = eiPtr->type;
eventFlags = flagArray[eiPtr->type];
@@ -5081,7 +5119,7 @@ GetPatternObj(
assert(patPtr->name);
Tcl_AppendPrintfToObj(patternObj, "<<%s>>", patPtr->name);
} else {
- ModMask modMask;
+ unsigned modMask;
const ModInfo *modPtr;
/*
@@ -5130,11 +5168,11 @@ GetPatternObj(
case ButtonPress:
case ButtonRelease:
assert(patPtr->info <= Button5);
- Tcl_AppendPrintfToObj(patternObj, "-%d", (int) patPtr->info);
+ Tcl_AppendPrintfToObj(patternObj, "-%u", (unsigned) patPtr->info);
break;
#if PRINT_SHORT_MOTION_SYNTAX
case MotionNotify: {
- ModMask mask = patPtr->modMask;
+ unsigned mask = patPtr->modMask;
while (mask & ALL_BUTTONS) {
unsigned button = ButtonNumberFromState(mask);
Tcl_AppendPrintfToObj(patternObj, "-%u", button);
@@ -5218,7 +5256,7 @@ TkKeysymToString(
Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym);
if (hPtr) {
- return Tcl_GetHashValue(hPtr);
+ return (const char *)Tcl_GetHashValue(hPtr);
}
#endif /* REDO_KEYSYM_LOOKUP */
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 7bd9a445..1e4e91f9 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -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);
@@ -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;
@@ -527,10 +525,10 @@ CreateBusy(
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;
@@ -696,7 +694,7 @@ GetBusy(
Tcl_GetString(windowObj), NULL);
return NULL;
}
- return Tcl_GetHashValue(hPtr);
+ return (Busy *)Tcl_GetHashValue(hPtr);
}
/*
@@ -746,7 +744,7 @@ HoldBusy(
Tcl_SetHashValue(hPtr, busyPtr);
busyPtr->hashPtr = hPtr;
} else {
- busyPtr = Tcl_GetHashValue(hPtr);
+ busyPtr = (Busy *)Tcl_GetHashValue(hPtr);
}
busyPtr->tablePtr = busyTablePtr;
@@ -789,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;
@@ -855,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) {
@@ -877,7 +875,7 @@ 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_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) {
Tcl_ListObjAppendElement(interp, objPtr,
diff --git a/generic/tkButton.h b/generic/tkButton.h
index 7e04fb93..edf7efe3 100644
--- a/generic/tkButton.h
+++ b/generic/tkButton.h
@@ -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);
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index c93b95a1..ccfe116e 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -352,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;
@@ -510,7 +510,7 @@ ConfigureArc(
if (arcPtr->disabledFillStipple!=None) {
stipple = arcPtr->disabledFillStipple;
}
- }
+ }
if (arcPtr->style == ARC_STYLE) {
newGC = NULL;
@@ -576,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) {
@@ -626,7 +626,6 @@ DeleteArc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
ComputeArcBbox(
Tk_Canvas canvas, /* Canvas that contains item. */
@@ -663,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;
@@ -678,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.
@@ -769,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;
@@ -942,7 +943,6 @@ DisplayArc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static double
ArcToPoint(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1107,7 +1107,6 @@ ArcToPoint(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ArcToArea(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1447,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;
@@ -1461,7 +1460,7 @@ ComputeArcOutline(
* curved arc segment, which are marked with X's in the figure below:
*
*
- * * * *
+ * * * *
* * *
* * * * *
* * * * *
@@ -1814,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. */
{
@@ -2028,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;
@@ -2092,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";
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 7e74942c..ba4cda1d 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -406,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);
}
@@ -602,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. */
{
@@ -706,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) {
@@ -830,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];
@@ -875,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)) {
@@ -984,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; icoordPtr[i];
}
@@ -1319,7 +1320,6 @@ LineDeleteCoords(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static double
LineToPoint(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1365,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);
@@ -1547,7 +1547,6 @@ LineToPoint(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
LineToArea(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1600,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);
@@ -1695,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];
@@ -1873,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. */
@@ -1942,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);
@@ -1982,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;
@@ -2050,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:
@@ -2092,7 +2086,6 @@ ArrowPrintProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ConfigureArrows(
Tk_Canvas canvas, /* Canvas in which arrows will be displayed
@@ -2153,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;
@@ -2197,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;
@@ -2254,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. */
{
@@ -2366,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);
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index a5378466..513613d6 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -376,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--) {
@@ -564,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. */
{
@@ -825,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 ; istate;
@@ -971,7 +972,7 @@ 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);
@@ -998,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.
@@ -1038,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; icoordPtr[i];
}
@@ -1240,7 +1241,6 @@ PolygonDeleteCoords(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static double
PolygonToPoint(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1288,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);
@@ -1430,7 +1430,6 @@ PolygonToPoint(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
PolygonToArea(
Tk_Canvas canvas, /* Canvas containing item. */
@@ -1497,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);
@@ -1667,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
@@ -1797,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. */
{
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 167f61f2..1a8b3d3c 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -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;
}
@@ -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) {
@@ -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.
*/
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 84b2a23f..0945857b 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -957,19 +957,23 @@ DisplayCanvText(
*/
if ((selFirstChar >= 0) && (textPtr->selTextGC != textPtr->gc)) {
- TkDrawAngledTextLayout(display, drawable, textPtr->gc,
- textPtr->textLayout, drawableX, drawableY, textPtr->angle,
- 0, selFirstChar);
+ 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);
- TkDrawAngledTextLayout(display, drawable, textPtr->gc,
- textPtr->textLayout, drawableX, drawableY, textPtr->angle,
- selLastChar + 1, -1);
+ if (selLastChar + 1 < textPtr->numChars) {
+ TkDrawAngledTextLayout(display, drawable, textPtr->gc,
+ textPtr->textLayout, drawableX, drawableY, textPtr->angle,
+ 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;
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index ca3af8f8..1feef73e 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -28,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.
*/
@@ -755,7 +756,7 @@ TkSmoothParseProc(
}
/*
- * Backward compatability hack.
+ * Backward compatibility hack.
*/
if (strncmp(value, "bezier", length) == 0) {
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index f73546fb..4047b0f9 100644
--- a/generic/tkCanvWind.c
+++ b/generic/tkCanvWind.c
@@ -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);
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index ce3dad16..2ce5e50c 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -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;
@@ -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 long)(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,9 +1448,22 @@ 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.
+ */
+
+ }
}
}
break;
@@ -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
};
@@ -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,7 +2445,7 @@ 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;
@@ -2692,7 +2699,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 +2789,7 @@ static void
CanvasCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkCanvas *canvasPtr = clientData;
+ TkCanvas *canvasPtr = (TkCanvas *)clientData;
Tk_Window tkwin = canvasPtr->tkwin;
/*
@@ -3274,7 +3281,7 @@ NextItem(
static SearchUids *
GetStaticUids(void)
{
- SearchUids *searchUids =
+ SearchUids *searchUids = (SearchUids *)
Tcl_GetThreadData(&dataKey, sizeof(SearchUids));
if (searchUids->allUid == NULL) {
@@ -3313,7 +3320,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 +3401,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 +3409,7 @@ TagSearchScan(
*/
searchPtr->rewritebufferAllocated = 100;
- searchPtr->rewritebuffer = ckalloc(searchPtr->rewritebufferAllocated);
+ searchPtr->rewritebuffer = (char *)ckalloc(searchPtr->rewritebufferAllocated);
}
TagSearchExprInit(&searchPtr->expr);
@@ -3419,7 +3426,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 +3609,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 +4022,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 +4243,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 +4753,8 @@ CanvasBindProc(
ClientData clientData, /* Pointer to canvas structure. */
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
- TkCanvas *canvasPtr = clientData;
- unsigned long mask;
+ TkCanvas *canvasPtr = (TkCanvas *)clientData;
+ unsigned mask;
Tcl_Preserve(canvasPtr);
@@ -4843,7 +4850,7 @@ PickCurrentItem(
* ButtonRelease, or MotionNotify. */
{
double coords[2];
- unsigned long buttonDown;
+ unsigned int buttonDown;
Tk_Item *prevItemPtr;
#ifndef USE_OLD_TAG_SEARCH
SearchUids *searchUids = GetStaticUids();
@@ -4975,7 +4982,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;
}
@@ -5108,8 +5117,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
@@ -5235,7 +5244,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;
@@ -5391,7 +5400,7 @@ CanvasFetchSelection(
* not including terminating NULL
* character. */
{
- TkCanvas *canvasPtr = clientData;
+ TkCanvas *canvasPtr = (TkCanvas *)clientData;
return ItemSelection(canvasPtr, canvasPtr->textInfo.selItemPtr, offset,
buffer, maxBytes);
@@ -5419,7 +5428,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;
@@ -5541,8 +5550,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;
@@ -5573,7 +5582,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) {
@@ -5591,7 +5600,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) {
@@ -5748,19 +5757,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]);
}
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index b902625c..703ef416 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -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;
@@ -147,7 +147,8 @@ ClipboardAppHandler(
if (length > (size_t) maxBytes) {
length = maxBytes;
}
- strncpy(buffer, p, length);
+ memcpy(buffer, p, length);
+ buffer[length] = 0;
return (int)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,12 +700,11 @@ 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. */
{
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 7f4c49b1..193c3d6f 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -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;
@@ -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,26 @@ 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(Tcl_Interp *), /* Interpreter containing variable. */
+ TCL_UNUSED(const char *), /* Name of variable. */
+ 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;
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 +1150,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 +1174,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. */
@@ -1288,7 +1282,7 @@ Tk_WinfoObjCmd(
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"},
@@ -1579,11 +1573,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 +1588,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 +1742,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 +1768,7 @@ Tk_WinfoObjCmd(
break;
}
case WIN_VISUALSAVAILABLE: {
- XVisualInfo template, *visInfoPtr;
+ XVisualInfo templ, *visInfoPtr;
int count, i;
int includeVisualId;
Tcl_Obj *strPtr, *resultPtr;
@@ -1779,9 +1789,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));
@@ -2078,7 +2088,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 +2122,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(
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index f1a51763..65e28a6b 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -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;
}
@@ -678,11 +677,16 @@ DoObjConfig(
case TK_OPTION_STRING_TABLE: {
int newValue;
- if (Tcl_GetIndexFromObjStruct(interp, valuePtr,
- optionPtr->specPtr->clientData, sizeof(char *),
- optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) {
- return TCL_ERROR;
- }
+ 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;
@@ -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;
@@ -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
@@ -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,10 +1936,10 @@ 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 != NULL) {
objPtr = Tcl_NewStringObj(
@@ -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();
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index a6a8cbfd..095d132f 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -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);
}
}
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index 64c32cd2..20729308 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -402,7 +402,7 @@ EXTERN void Tk_HandleEvent(XEvent *eventPtr);
/* 116 */
EXTERN Tk_Window Tk_IdToWindow(Display *display, Window window);
/* 117 */
-EXTERN void Tk_ImageChanged(Tk_ImageMaster master, int x, int y,
+EXTERN void Tk_ImageChanged(Tk_ImageMaster model, int x, int y,
int width, int height, int imageWidth,
int imageHeight);
/* 118 */
@@ -413,8 +413,8 @@ EXTERN Atom Tk_InternAtom(Tk_Window tkwin, const char *name);
EXTERN int Tk_IntersectTextLayout(Tk_TextLayout layout, int x,
int y, int width, int height);
/* 121 */
-EXTERN void Tk_MaintainGeometry(Tk_Window slave,
- Tk_Window master, int x, int y, int width,
+EXTERN void Tk_MaintainGeometry(Tk_Window window,
+ Tk_Window container, int x, int y, int width,
int height);
/* 122 */
EXTERN Tk_Window Tk_MainWindow(Tcl_Interp *interp);
@@ -453,7 +453,7 @@ EXTERN CONST84_RETURN char * Tk_NameOfCursor(Display *display,
/* 136 */
EXTERN CONST84_RETURN char * Tk_NameOfFont(Tk_Font font);
/* 137 */
-EXTERN CONST84_RETURN char * Tk_NameOfImage(Tk_ImageMaster imageMaster);
+EXTERN CONST84_RETURN char * Tk_NameOfImage(Tk_ImageMaster model);
/* 138 */
EXTERN CONST84_RETURN char * Tk_NameOfJoinStyle(int join);
/* 139 */
@@ -582,8 +582,8 @@ EXTERN void Tk_UnderlineTextLayout(Display *display,
/* 180 */
EXTERN void Tk_Ungrab(Tk_Window tkwin);
/* 181 */
-EXTERN void Tk_UnmaintainGeometry(Tk_Window slave,
- Tk_Window master);
+EXTERN void Tk_UnmaintainGeometry(Tk_Window window,
+ Tk_Window container);
/* 182 */
EXTERN void Tk_UnmapWindow(Tk_Window tkwin);
/* 183 */
@@ -864,6 +864,14 @@ EXTERN void Tk_CreateOldImageType(const Tk_ImageType *typePtr);
/* 273 */
EXTERN void Tk_CreateOldPhotoImageFormat(
const Tk_PhotoImageFormat *formatPtr);
+/* Slot 274 is reserved */
+/* Slot 275 is reserved */
+/* Slot 276 is reserved */
+/* Slot 277 is reserved */
+/* Slot 278 is reserved */
+/* Slot 279 is reserved */
+/* 280 */
+EXTERN void TkUnusedStubEntry(void);
typedef struct {
const struct TkPlatStubs *tkPlatStubs;
@@ -993,11 +1001,11 @@ typedef struct TkStubs {
int (*tk_Grab) (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal); /* 114 */
void (*tk_HandleEvent) (XEvent *eventPtr); /* 115 */
Tk_Window (*tk_IdToWindow) (Display *display, Window window); /* 116 */
- void (*tk_ImageChanged) (Tk_ImageMaster master, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */
+ void (*tk_ImageChanged) (Tk_ImageMaster model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */
int (*tk_Init) (Tcl_Interp *interp); /* 118 */
Atom (*tk_InternAtom) (Tk_Window tkwin, const char *name); /* 119 */
int (*tk_IntersectTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height); /* 120 */
- void (*tk_MaintainGeometry) (Tk_Window slave, Tk_Window master, int x, int y, int width, int height); /* 121 */
+ void (*tk_MaintainGeometry) (Tk_Window window, Tk_Window container, int x, int y, int width, int height); /* 121 */
Tk_Window (*tk_MainWindow) (Tcl_Interp *interp); /* 122 */
void (*tk_MakeWindowExist) (Tk_Window tkwin); /* 123 */
void (*tk_ManageGeometry) (Tk_Window tkwin, const Tk_GeomMgr *mgrPtr, ClientData clientData); /* 124 */
@@ -1013,7 +1021,7 @@ typedef struct TkStubs {
CONST84_RETURN char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */
CONST84_RETURN char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */
CONST84_RETURN char * (*tk_NameOfFont) (Tk_Font font); /* 136 */
- CONST84_RETURN char * (*tk_NameOfImage) (Tk_ImageMaster imageMaster); /* 137 */
+ CONST84_RETURN char * (*tk_NameOfImage) (Tk_ImageMaster model); /* 137 */
CONST84_RETURN char * (*tk_NameOfJoinStyle) (int join); /* 138 */
CONST84_RETURN char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */
CONST84_RETURN char * (*tk_NameOfRelief) (int relief); /* 140 */
@@ -1057,7 +1065,7 @@ typedef struct TkStubs {
void (*tk_UnderlineChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int x, int y, int firstByte, int lastByte); /* 178 */
void (*tk_UnderlineTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline); /* 179 */
void (*tk_Ungrab) (Tk_Window tkwin); /* 180 */
- void (*tk_UnmaintainGeometry) (Tk_Window slave, Tk_Window master); /* 181 */
+ void (*tk_UnmaintainGeometry) (Tk_Window window, Tk_Window container); /* 181 */
void (*tk_UnmapWindow) (Tk_Window tkwin); /* 182 */
void (*tk_UnsetGrid) (Tk_Window tkwin); /* 183 */
void (*tk_UpdatePointer) (Tk_Window tkwin, int x, int y, int state); /* 184 */
@@ -1150,6 +1158,13 @@ typedef struct TkStubs {
Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */
void (*tk_CreateOldImageType) (const Tk_ImageType *typePtr); /* 272 */
void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 273 */
+ void (*reserved274)(void);
+ void (*reserved275)(void);
+ void (*reserved276)(void);
+ void (*reserved277)(void);
+ void (*reserved278)(void);
+ void (*reserved279)(void);
+ void (*tkUnusedStubEntry) (void); /* 280 */
} TkStubs;
extern const TkStubs *tkStubsPtr;
@@ -1710,6 +1725,14 @@ extern const TkStubs *tkStubsPtr;
(tkStubsPtr->tk_CreateOldImageType) /* 272 */
#define Tk_CreateOldPhotoImageFormat \
(tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */
+/* Slot 274 is reserved */
+/* Slot 275 is reserved */
+/* Slot 276 is reserved */
+/* Slot 277 is reserved */
+/* Slot 278 is reserved */
+/* Slot 279 is reserved */
+#define TkUnusedStubEntry \
+ (tkStubsPtr->tkUnusedStubEntry) /* 280 */
#endif /* defined(USE_TK_STUBS) */
@@ -1720,6 +1743,7 @@ extern const TkStubs *tkStubsPtr;
#undef Tk_Init
#undef Tk_SafeInit
#undef Tk_CreateConsoleWindow
+#define Tk_GetImageModelData Tk_GetImageMasterData
#if defined(_WIN32) && defined(UNICODE)
# define Tk_MainEx Tk_MainExW
@@ -1730,4 +1754,6 @@ extern const TkStubs *tkStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+#undef TkUnusedStubEntry
+
#endif /* _TKDECLS */
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 0dfacd74..4ffb48b3 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -191,15 +191,15 @@ static const Tk_OptionSpec sbOptSpec[] = {
NULL, 0, -1, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0},
- {TK_OPTION_BORDER, "-buttonbackground", "Button.background", "Background",
+ {TK_OPTION_BORDER, "-buttonbackground", "buttonBackground", "Background",
DEF_BUTTON_BG_COLOR, -1, Tk_Offset(Spinbox, buttonBorder),
0, DEF_BUTTON_BG_MONO, 0},
- {TK_OPTION_CURSOR, "-buttoncursor", "Button.cursor", "Cursor",
+ {TK_OPTION_CURSOR, "-buttoncursor", "buttonCursor", "Cursor",
DEF_BUTTON_CURSOR, -1, Tk_Offset(Spinbox, bCursor),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_RELIEF, "-buttondownrelief", "Button.relief", "Relief",
+ {TK_OPTION_RELIEF, "-buttondownrelief", "buttonDownRelief", "Relief",
DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, bdRelief), 0, 0, 0},
- {TK_OPTION_RELIEF, "-buttonuprelief", "Button.relief", "Relief",
+ {TK_OPTION_RELIEF, "-buttonuprelief", "buttonUpRelief", "Relief",
DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, buRelief), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_SPINBOX_CMD, -1, Tk_Offset(Spinbox, command),
@@ -426,7 +426,7 @@ static int EntryWidgetObjCmd(ClientData clientData,
Tcl_Obj *const objv[]);
static void EntryWorldChanged(ClientData instanceData);
static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr,
- const char *string, int *indexPtr);
+ Tcl_Obj *indexObj, int *indexPtr);
static int InsertChars(Entry *entryPtr, int index, const char *string);
/*
@@ -618,7 +618,7 @@ EntryWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&index) != TCL_OK) {
goto error;
}
@@ -670,13 +670,13 @@ EntryWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&first) != TCL_OK) {
goto error;
}
if (objc == 3) {
last = first + 1;
- } else if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[3]),
+ } else if (GetEntryIndex(interp, entryPtr, objv[3],
&last) != TCL_OK) {
goto error;
}
@@ -702,7 +702,7 @@ EntryWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "pos");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&entryPtr->insertPos) != TCL_OK) {
goto error;
}
@@ -716,7 +716,7 @@ EntryWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "string");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&index) != TCL_OK) {
goto error;
}
@@ -731,7 +731,7 @@ EntryWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index text");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&index) != TCL_OK) {
goto error;
}
@@ -811,7 +811,7 @@ EntryWidgetObjCmd(
goto error;
}
if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ objv[3], &index) != TCL_OK) {
goto error;
}
if (entryPtr->selectFirst >= 0) {
@@ -851,7 +851,7 @@ EntryWidgetObjCmd(
goto error;
}
if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ objv[3], &index) != TCL_OK) {
goto error;
}
entryPtr->selectAnchor = index;
@@ -871,11 +871,11 @@ EntryWidgetObjCmd(
Tcl_WrongNumArgs(interp, 3, objv, "start end");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[3]),
+ if (GetEntryIndex(interp, entryPtr, objv[3],
&index) != TCL_OK) {
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[4]),
+ if (GetEntryIndex(interp, entryPtr, objv[4],
&index2) != TCL_OK) {
goto error;
}
@@ -902,7 +902,7 @@ EntryWidgetObjCmd(
goto error;
}
if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ objv[3], &index) != TCL_OK) {
goto error;
}
EntrySelectTo(entryPtr, index);
@@ -942,7 +942,7 @@ EntryWidgetObjCmd(
Tcl_SetObjResult(interp, Tcl_NewListObj(2, span));
goto done;
} else if (objc == 3) {
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&index) != TCL_OK) {
goto error;
}
@@ -1727,18 +1727,14 @@ DisplayEntry(
}
}
- /*
- * Draw the text in two pieces: first the unselected portion, then the
- * selected portion on top of it.
- */
-
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
- entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
- entryPtr->leftIndex, entryPtr->numChars);
-
if (showSelection && (entryPtr->state != STATE_DISABLED)
&& (entryPtr->selTextGC != entryPtr->textGC)
&& (entryPtr->selectFirst < entryPtr->selectLast)) {
+
+ /*
+ * Draw the selected and unselected portions separately.
+ */
+
int selFirst;
if (entryPtr->selectFirst < entryPtr->leftIndex) {
@@ -1746,9 +1742,28 @@ DisplayEntry(
} else {
selFirst = entryPtr->selectFirst;
}
+ if (entryPtr->leftIndex < selFirst) {
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->leftIndex, selFirst);
+ }
Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->selTextGC,
entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
selFirst, entryPtr->selectLast);
+ if (entryPtr->selectLast < entryPtr->numChars) {
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->selectLast, entryPtr->numChars);
+ }
+ } else {
+
+ /*
+ * Draw the entire visible text
+ */
+
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->leftIndex, entryPtr->numChars);
}
if (entryPtr->type == TK_SPINBOX) {
@@ -2049,7 +2064,7 @@ InsertChars(
char *newStr;
string = entryPtr->string;
- byteIndex = Tcl_UtfAtIndex(string, index) - string;
+ byteIndex = TkUtfAtIndex(string, index) - string;
byteCount = strlen(value);
if (byteCount == 0) {
return TCL_OK;
@@ -2073,6 +2088,8 @@ InsertChars(
entryPtr->string = newStr;
/*
+ * ??? Is this construction still needed with Tcl_NumUtfChars ???
+ *
* The following construction is used because inserting improperly formed
* UTF-8 sequences between other improperly formed UTF-8 sequences could
* result in actually forming valid UTF-8 sequences; the number of
@@ -2153,8 +2170,8 @@ DeleteChars(
}
string = entryPtr->string;
- byteIndex = Tcl_UtfAtIndex(string, index) - string;
- byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex);
+ byteIndex = TkUtfAtIndex(string, index) - string;
+ byteCount = TkUtfAtIndex(string + byteIndex, count) - (string+byteIndex);
newByteCount = entryPtr->numBytes + 1 - byteCount;
newStr = ckalloc(newByteCount);
@@ -2556,12 +2573,11 @@ GetEntryIndex(
Tcl_Interp *interp, /* For error messages. */
Entry *entryPtr, /* Entry for which the index is being
* specified. */
- const char *string, /* Specifies character in entryPtr. */
+ Tcl_Obj *indexObj, /* Specifies character in entryPtr. */
int *indexPtr) /* Where to store converted character index */
{
- size_t length;
-
- length = strlen(string);
+ const char *string = Tcl_GetString(indexObj);
+ size_t length = indexObj->length;
switch (string[0]) {
case 'a':
@@ -2636,7 +2652,7 @@ GetEntryIndex(
break;
}
default:
- if (Tcl_GetInt(NULL, string, indexPtr) != TCL_OK) {
+ if (Tcl_GetIntFromObj(NULL, indexObj, indexPtr) != TCL_OK) {
goto badIndex;
}
if (*indexPtr < 0){
@@ -2816,8 +2832,8 @@ EntryFetchSelection(
return -1;
}
string = entryPtr->displayString;
- selStart = Tcl_UtfAtIndex(string, entryPtr->selectFirst);
- selEnd = Tcl_UtfAtIndex(selStart,
+ selStart = TkUtfAtIndex(string, entryPtr->selectFirst);
+ selEnd = TkUtfAtIndex(selStart,
entryPtr->selectLast - entryPtr->selectFirst);
byteCount = selEnd - selStart - offset;
if (byteCount > maxBytes) {
@@ -3006,7 +3022,7 @@ EntryUpdateScrollbar(
Tcl_DStringAppend(&buf, firstStr, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, lastStr, -1);
- code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (code != TCL_OK) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
@@ -3223,7 +3239,7 @@ EntryValidate(
* string). */
{
register Tcl_Interp *interp = entryPtr->interp;
- int code, bool;
+ int code, isOK;
code = Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
@@ -3245,7 +3261,7 @@ EntryValidate(
*/
if (Tcl_GetBooleanFromObj(interp, Tcl_GetObjResult(interp),
- &bool) != TCL_OK) {
+ &isOK) != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (invalid boolean result from validation command)");
Tcl_BackgroundException(interp, TCL_ERROR);
@@ -3254,7 +3270,7 @@ EntryValidate(
}
Tcl_ResetResult(interp);
- return (bool ? TCL_OK : TCL_BREAK);
+ return (isOK ? TCL_OK : TCL_BREAK);
}
/*
@@ -3267,7 +3283,7 @@ EntryValidate(
*
* Results:
* TCL_OK if the validatecommand accepts the new string, TCL_ERROR if any
- * problems occured with validatecommand.
+ * problems occurred with validatecommand.
*
* Side effects:
* The insertion/deletion may be aborted, and the validatecommand might
@@ -3292,17 +3308,21 @@ EntryValidateChange(
if (entryPtr->validateCmd == NULL ||
entryPtr->validate == VALIDATE_NONE) {
+ if (entryPtr->flags & VALIDATING) {
+ entryPtr->flags |= VALIDATE_ABORT;
+ }
return (varValidate ? TCL_ERROR : TCL_OK);
}
/*
- * If we're already validating, then we're hitting a loop condition Return
- * and set validate to 0 to disallow further validations and prevent
- * current validation from finishing
+ * If we're already validating, then we're hitting a loop condition. Set
+ * validate to none to disallow further validations, arrange for flags
+ * to prevent current validation from finishing, and return.
*/
if (entryPtr->flags & VALIDATING) {
entryPtr->validate = VALIDATE_NONE;
+ entryPtr->flags |= VALIDATE_ABORT;
return (varValidate ? TCL_ERROR : TCL_OK);
}
@@ -3324,7 +3344,7 @@ EntryValidateChange(
/*
* If e->validate has become VALIDATE_NONE during the validation, or we
* now have VALIDATE_VAR set (from EntrySetValue) and didn't before, it
- * means that a loop condition almost occured. Do not allow this
+ * means that a loop condition almost occurred. Do not allow this
* validation result to finish.
*/
@@ -3749,7 +3769,7 @@ SpinboxWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&index) != TCL_OK) {
goto error;
}
@@ -3800,14 +3820,14 @@ SpinboxWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&first) != TCL_OK) {
goto error;
}
if (objc == 3) {
last = first + 1;
} else {
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[3]),
+ if (GetEntryIndex(interp, entryPtr, objv[3],
&last) != TCL_OK) {
goto error;
}
@@ -3834,7 +3854,7 @@ SpinboxWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "pos");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&entryPtr->insertPos) != TCL_OK) {
goto error;
}
@@ -3867,7 +3887,7 @@ SpinboxWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "string");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&index) != TCL_OK) {
goto error;
}
@@ -3882,7 +3902,7 @@ SpinboxWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index text");
goto error;
}
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&index) != TCL_OK) {
goto error;
}
@@ -3979,7 +3999,7 @@ SpinboxWidgetObjCmd(
goto error;
}
if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ objv[3], &index) != TCL_OK) {
goto error;
}
if (entryPtr->selectFirst >= 0) {
@@ -4019,7 +4039,7 @@ SpinboxWidgetObjCmd(
goto error;
}
if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ objv[3], &index) != TCL_OK) {
goto error;
}
entryPtr->selectAnchor = index;
@@ -4040,11 +4060,11 @@ SpinboxWidgetObjCmd(
goto error;
}
if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ objv[3], &index) != TCL_OK) {
goto error;
}
if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[4]),& index2) != TCL_OK) {
+ objv[4],& index2) != TCL_OK) {
goto error;
}
if (index >= index2) {
@@ -4070,7 +4090,7 @@ SpinboxWidgetObjCmd(
goto error;
}
if (GetEntryIndex(interp, entryPtr,
- Tcl_GetString(objv[3]), &index) != TCL_OK) {
+ objv[3], &index) != TCL_OK) {
goto error;
}
EntrySelectTo(entryPtr, index);
@@ -4150,7 +4170,7 @@ SpinboxWidgetObjCmd(
Tcl_SetObjResult(interp, Tcl_NewListObj(2, span));
goto done;
} else if (objc == 3) {
- if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]),
+ if (GetEntryIndex(interp, entryPtr, objv[2],
&index) != TCL_OK) {
goto error;
}
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 32b3ee15..456b86d6 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -73,7 +73,7 @@ typedef struct TkWindowEvent {
* Array of event masks corresponding to each X event:
*/
-static const unsigned long realEventMasks[MappingNotify+1] = {
+static const unsigned long eventMasks[TK_LASTEVENT] = {
0,
0,
KeyPressMask, /* KeyPress */
@@ -111,10 +111,7 @@ static const unsigned long realEventMasks[MappingNotify+1] = {
0, /* SelectionNotify */
ColormapChangeMask, /* ColormapNotify */
0, /* ClientMessage */
- 0 /* Mapping Notify */
-};
-
-static const unsigned long virtualEventMasks[TK_LASTEVENT-VirtualEvent] = {
+ 0, /* Mapping Notify */
VirtualEventMask, /* VirtualEvents */
ActivateMask, /* ActivateNotify */
ActivateMask, /* DeactivateNotify */
@@ -452,18 +449,8 @@ GetEventMaskFromXEvent(
{
unsigned long mask;
- /*
- * Get the event mask from the correct table. Note that there are two
- * tables here because that means we no longer need this code to rely on
- * the exact value of VirtualEvent, which has caused us problems in the
- * past when X11 changed the value of LASTEvent. [Bug ???]
- */
-
- if (eventPtr->xany.type <= MappingNotify) {
- mask = realEventMasks[eventPtr->xany.type];
- } else if (eventPtr->xany.type >= VirtualEvent
- && eventPtr->xany.typexany.type - VirtualEvent];
+ if (eventPtr->xany.type xany.type];
} else {
mask = 0;
}
@@ -535,13 +522,13 @@ RefreshKeyboardMappingIfNeeded(
*----------------------------------------------------------------------
*/
-static const unsigned long buttonMasks[] = {
+static const unsigned buttonMasks[] = {
0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask
};
-unsigned long
+unsigned
TkGetButtonMask(
- unsigned int button)
+ unsigned button)
{
return (button > Button5) ? 0 : buttonMasks[button];
}
@@ -698,8 +685,8 @@ Tk_CreateEventHandler(
Tk_EventProc *proc, /* Function to call for each selected event */
ClientData clientData) /* Arbitrary data to pass to proc. */
{
- register TkEventHandler *handlerPtr;
- register TkWindow *winPtr = (TkWindow *) token;
+ TkEventHandler *handlerPtr;
+ TkWindow *winPtr = (TkWindow *)token;
/*
* Skim through the list of existing handlers to (a) compute the overall
@@ -714,7 +701,7 @@ Tk_CreateEventHandler(
* No event handlers defined at all, so must create.
*/
- handlerPtr = ckalloc(sizeof(TkEventHandler));
+ handlerPtr = (TkEventHandler *)ckalloc(sizeof(TkEventHandler));
winPtr->handlerList = handlerPtr;
} else {
int found = 0;
@@ -745,7 +732,7 @@ Tk_CreateEventHandler(
* No event handler matched, so create a new one.
*/
- handlerPtr->nextPtr = ckalloc(sizeof(TkEventHandler));
+ handlerPtr->nextPtr = (TkEventHandler *)ckalloc(sizeof(TkEventHandler));
handlerPtr = handlerPtr->nextPtr;
}
@@ -788,11 +775,11 @@ Tk_DeleteEventHandler(
Tk_EventProc *proc,
ClientData clientData)
{
- register TkEventHandler *handlerPtr;
- register InProgress *ipPtr;
+ TkEventHandler *handlerPtr;
+ InProgress *ipPtr;
TkEventHandler *prevPtr;
- register TkWindow *winPtr = (TkWindow *) token;
- ThreadSpecificData *tsdPtr =
+ TkWindow *winPtr = (TkWindow *) token;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -864,10 +851,10 @@ Tk_CreateGenericHandler(
ClientData clientData) /* One-word value to pass to proc. */
{
GenericHandler *handlerPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- handlerPtr = ckalloc(sizeof(GenericHandler));
+ handlerPtr = (GenericHandler *)ckalloc(sizeof(GenericHandler));
handlerPtr->proc = proc;
handlerPtr->clientData = clientData;
@@ -905,7 +892,7 @@ Tk_DeleteGenericHandler(
ClientData clientData)
{
GenericHandler * handler;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (handler=tsdPtr->genericList ; handler ; handler=handler->nextPtr) {
@@ -938,7 +925,7 @@ Tk_CreateClientMessageHandler(
Tk_ClientMessageProc *proc) /* Function to call on event. */
{
GenericHandler *handlerPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -946,7 +933,7 @@ Tk_CreateClientMessageHandler(
* with an extra clientData field we'll never use.
*/
- handlerPtr = ckalloc(sizeof(GenericHandler));
+ handlerPtr = (GenericHandler *)ckalloc(sizeof(GenericHandler));
handlerPtr->proc = (Tk_GenericProc *) proc;
handlerPtr->clientData = NULL; /* never used */
@@ -984,7 +971,7 @@ Tk_DeleteClientMessageHandler(
Tk_ClientMessageProc *proc)
{
GenericHandler * handler;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (handler=tsdPtr->cmList ; handler!=NULL ; handler=handler->nextPtr) {
@@ -1015,7 +1002,7 @@ Tk_DeleteClientMessageHandler(
void
TkEventInit(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->handlersActive = 0;
@@ -1048,9 +1035,9 @@ TkEventInit(void)
static int
TkXErrorHandler(
ClientData clientData, /* Pointer to flag we set. */
- XErrorEvent *errEventPtr) /* X error info. */
+ TCL_UNUSED(XErrorEvent *)) /* X error info. */
{
- int *error = clientData;
+ int *error = (int *)clientData;
*error = 1;
return 0;
@@ -1137,12 +1124,12 @@ void
Tk_HandleEvent(
XEvent *eventPtr) /* Event to dispatch. */
{
- register TkEventHandler *handlerPtr;
+ TkEventHandler *handlerPtr;
TkWindow *winPtr;
unsigned long mask;
InProgress ip;
Tcl_Interp *interp = NULL;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
#if !defined(MAC_OSX_TK) && !defined(_WIN32)
@@ -1350,9 +1337,9 @@ TkEventDeadWindow(
TkWindow *winPtr) /* Information about the window that is being
* deleted. */
{
- register TkEventHandler *handlerPtr;
- register InProgress *ipPtr;
- ThreadSpecificData *tsdPtr =
+ TkEventHandler *handlerPtr;
+ InProgress *ipPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1400,8 +1387,8 @@ Time
TkCurrentTime(
TkDisplay *dispPtr) /* Display for which the time is desired. */
{
- register XEvent *eventPtr;
- ThreadSpecificData *tsdPtr =
+ XEvent *eventPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->pendingPtr == NULL) {
@@ -1455,7 +1442,7 @@ Tk_RestrictEvents(
* argument. */
{
Tk_RestrictProc *prev;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
prev = tsdPtr->restrictProc;
@@ -1548,7 +1535,7 @@ Tk_QueueWindowEvent(
*/
if (!(dispPtr->flags & TK_DISPLAY_COLLAPSE_MOTION_EVENTS)) {
- wevPtr = ckalloc(sizeof(TkWindowEvent));
+ wevPtr = (TkWindowEvent *)ckalloc(sizeof(TkWindowEvent));
wevPtr->header.proc = WindowEventProc;
wevPtr->event = *eventPtr;
Tcl_QueueEvent(&wevPtr->header, position);
@@ -1580,7 +1567,7 @@ Tk_QueueWindowEvent(
}
}
- wevPtr = ckalloc(sizeof(TkWindowEvent));
+ wevPtr = (TkWindowEvent *)ckalloc(sizeof(TkWindowEvent));
wevPtr->header.proc = WindowEventProc;
wevPtr->event = *eventPtr;
if ((eventPtr->type == MotionNotify) && (position == TCL_QUEUE_TAIL)) {
@@ -1640,6 +1627,47 @@ TkQueueEventForAllChildren(
}
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGenerateActivateEvents --
+ *
+ * This function is called by the Mac and Windows window manager routines
+ * when a toplevel window is activated or deactivated.
+ * Activate/Deactivate events will be sent to every subwindow of the
+ * toplevel followed by a FocusIn/FocusOut message.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Generates X events.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkGenerateActivateEvents(
+ TkWindow *winPtr, /* Toplevel to activate. */
+ int active) /* Non-zero if the window is being activated,
+ * else 0.*/
+{
+ XEvent event;
+
+ /*
+ * Generate Activate and Deactivate events. This event is sent to every
+ * subwindow in a toplevel window.
+ */
+
+ event.xany.serial = NextRequest(winPtr->display);
+ event.xany.send_event = False;
+ event.xany.display = winPtr->display;
+ event.xany.window = winPtr->window;
+
+ event.xany.type = active ? ActivateNotify : DeactivateNotify;
+ TkQueueEventForAllChildren(winPtr, &event);
+}
+
/*
*----------------------------------------------------------------------
*
@@ -1670,7 +1698,7 @@ WindowEventProc(
{
TkWindowEvent *wevPtr = (TkWindowEvent *) evPtr;
Tk_RestrictAction result;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(flags & TCL_WINDOW_EVENTS)) {
@@ -1723,13 +1751,15 @@ CleanUpTkEvent(
switch (eventPtr->type) {
case KeyPress:
case KeyRelease: {
- TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr;
+#if !defined(_WIN32) && !defined(MAC_OSX_TK)
+ TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr;
if (kePtr->charValuePtr != NULL) {
ckfree(kePtr->charValuePtr);
kePtr->charValuePtr = NULL;
kePtr->charValueLen = 0;
}
+#endif
break;
}
@@ -1769,7 +1799,7 @@ DelayedMotionProc(
ClientData clientData) /* Pointer to display containing a delayed
* motion event to be serviced. */
{
- TkDisplay *dispPtr = clientData;
+ TkDisplay *dispPtr = (TkDisplay *)clientData;
if (dispPtr->delayedMotionPtr == NULL) {
Tcl_Panic("DelayedMotionProc found no delayed mouse motion event");
@@ -1801,7 +1831,7 @@ TkCreateExitHandler(
{
ExitHandler *exitPtr;
- exitPtr = ckalloc(sizeof(ExitHandler));
+ exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
Tcl_MutexLock(&exitMutex);
@@ -1897,10 +1927,10 @@ TkCreateThreadExitHandler(
ClientData clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- exitPtr = ckalloc(sizeof(ExitHandler));
+ exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
@@ -1938,7 +1968,7 @@ TkDeleteThreadExitHandler(
ClientData clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr, *prevPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (prevPtr = NULL, exitPtr = tsdPtr->firstExitPtr; exitPtr != NULL;
@@ -1977,7 +2007,7 @@ TkDeleteThreadExitHandler(
void
TkFinalize(
- ClientData clientData) /* Arbitrary value to pass to proc. */
+ TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
@@ -2029,10 +2059,10 @@ TkFinalize(
void
TkFinalizeThread(
- ClientData clientData) /* Arbitrary value to pass to proc. */
+ TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DeleteThreadExitHandler(TkFinalizeThread, NULL);
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 7b5acfb8..4d46e4b1 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -603,7 +603,7 @@ TkSetFocusWin(
if (displayFocusPtr->focusOnMapPtr != NULL) {
Tk_DeleteEventHandler((Tk_Window) displayFocusPtr->focusOnMapPtr,
- StructureNotifyMask, FocusMapProc,
+ VisibilityChangeMask, FocusMapProc,
displayFocusPtr->focusOnMapPtr);
displayFocusPtr->focusOnMapPtr = NULL;
}
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 156ebf3e..3e4044f4 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -14,8 +14,9 @@
#include "tkInt.h"
#include "tkFont.h"
#if defined(MAC_OSX_TK)
-#include "tkMacOSXInt.h"
+#include "tkMacOSXInt.h" /* Defines TK_DRAW_IN_CONTEXT */
#endif
+
/*
* The following structure is used to keep track of all the fonts that exist
* in the current application. It must be stored in the TkMainInfo for the
@@ -95,7 +96,7 @@ typedef struct TextLayout {
* layout. */
int numChunks; /* Number of chunks actually used in following
* array. */
- LayoutChunk chunks[1]; /* Array of chunks. The actual size will be
+ LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be
* maxChunks. THIS FIELD MUST BE THE LAST IN
* THE STRUCTURE. */
} TextLayout;
@@ -379,7 +380,7 @@ void
TkFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- TkFontInfo *fiPtr = ckalloc(sizeof(TkFontInfo));
+ TkFontInfo *fiPtr = (TkFontInfo *)ckalloc(sizeof(TkFontInfo));
Tcl_InitHashTable(&fiPtr->fontCache, TCL_STRING_KEYS);
Tcl_InitHashTable(&fiPtr->namedTable, TCL_STRING_KEYS);
@@ -472,7 +473,7 @@ Tk_FontObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int index;
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr;
static const char *const optionStrings[] = {
"actual", "configure", "create", "delete",
@@ -616,9 +617,9 @@ Tk_FontObjCmd(
}
string = Tcl_GetString(objv[2]);
namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string);
- nfPtr = NULL; /* lint. */
+ nfPtr = NULL;
if (namedHashPtr != NULL) {
- nfPtr = Tcl_GetHashValue(namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
}
if ((namedHashPtr == NULL) || nfPtr->deletePending) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -739,7 +740,7 @@ Tk_FontObjCmd(
}
case FONT_METRICS: {
Tk_Font tkfont;
- int skip, index, i;
+ int skip, i;
const TkFontMetrics *fmPtr;
static const char *const switches[] = {
"-ascent", "-descent", "-linespace", "-fixed", NULL
@@ -796,10 +797,10 @@ Tk_FontObjCmd(
resultPtr = Tcl_NewObj();
namedHashPtr = Tcl_FirstHashEntry(&fiPtr->namedTable, &search);
while (namedHashPtr != NULL) {
- NamedFont *nfPtr = Tcl_GetHashValue(namedHashPtr);
+ NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
if (!nfPtr->deletePending) {
- char *string = Tcl_GetHashKey(&fiPtr->namedTable,
+ char *string = (char *)Tcl_GetHashKey(&fiPtr->namedTable,
namedHashPtr);
Tcl_ListObjAppendElement(NULL, resultPtr,
@@ -842,7 +843,7 @@ UpdateDependentFonts(
Tcl_HashEntry *cacheHashPtr;
Tcl_HashSearch search;
TkFont *fontPtr;
- NamedFont *nfPtr = Tcl_GetHashValue(namedHashPtr);
+ NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
if (nfPtr->refCount == 0) {
/*
@@ -855,7 +856,7 @@ UpdateDependentFonts(
cacheHashPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search);
while (cacheHashPtr != NULL) {
- for (fontPtr = Tcl_GetHashValue(cacheHashPtr);
+ for (fontPtr = (TkFont *)Tcl_GetHashValue(cacheHashPtr);
fontPtr != NULL; fontPtr = fontPtr->nextPtr) {
if (fontPtr->namedHashPtr == namedHashPtr) {
TkpGetFontFromAttributes(fontPtr, tkwin, &nfPtr->fa);
@@ -873,19 +874,19 @@ static void
TheWorldHasChanged(
ClientData clientData) /* Info about application's fonts. */
{
- TkFontInfo *fiPtr = clientData;
-#if defined(MAC_OSX_TK)
+ TkFontInfo *fiPtr = (TkFontInfo *)clientData;
/*
* On macOS it is catastrophic to recompute all widgets while the
* [NSView drawRect] method is drawing. The best that we can do in
* that situation is to abort the recomputation and hope for the best.
+ * This is ignored on other platforms.
*/
-
- if (TkpAppIsDrawing()) {
+
+ if (TkpWillDrawWidget(NULL)) {
return;
}
-#endif
+
fiPtr->updatePending = 0;
RecomputeWidgets(fiPtr->mainPtr->winPtr);
}
@@ -963,7 +964,7 @@ TkCreateNamedFont(
namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &isNew);
if (!isNew) {
- nfPtr = Tcl_GetHashValue(namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
if (!nfPtr->deletePending) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -985,7 +986,7 @@ TkCreateNamedFont(
return TCL_OK;
}
- nfPtr = ckalloc(sizeof(NamedFont));
+ nfPtr = (NamedFont *)ckalloc(sizeof(NamedFont));
nfPtr->deletePending = 0;
Tcl_SetHashValue(namedHashPtr, nfPtr);
nfPtr->fa = *faPtr;
@@ -1024,7 +1025,7 @@ TkDeleteNamedFont(
}
return TCL_ERROR;
}
- nfPtr = Tcl_GetHashValue(namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
if (nfPtr->refCount != 0) {
nfPtr->deletePending = 1;
} else {
@@ -1113,7 +1114,7 @@ Tk_AllocFontFromObj(
SetFontFromAny(interp, objPtr);
}
- oldFontPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ oldFontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1;
if (oldFontPtr != NULL) {
if (oldFontPtr->resourceRefCount == 0) {
/*
@@ -1142,7 +1143,7 @@ Tk_AllocFontFromObj(
cacheHashPtr = Tcl_CreateHashEntry(&fiPtr->fontCache,
Tcl_GetString(objPtr), &isNew);
}
- firstFontPtr = Tcl_GetHashValue(cacheHashPtr);
+ firstFontPtr = (TkFont *)Tcl_GetHashValue(cacheHashPtr);
for (fontPtr = firstFontPtr; (fontPtr != NULL);
fontPtr = fontPtr->nextPtr) {
if (Tk_Screen(tkwin) == fontPtr->screen) {
@@ -1165,7 +1166,7 @@ Tk_AllocFontFromObj(
* Construct a font based on a named font.
*/
- nfPtr = Tcl_GetHashValue(namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
nfPtr->refCount++;
fontPtr = TkpGetFontFromAttributes(NULL, tkwin, &nfPtr->fa);
@@ -1298,7 +1299,7 @@ Tk_GetFontFromObj(
SetFontFromAny(NULL, objPtr);
}
- fontPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1;
if (fontPtr != NULL) {
if (fontPtr->resourceRefCount == 0) {
/*
@@ -1325,7 +1326,7 @@ Tk_GetFontFromObj(
hashPtr = Tcl_FindHashEntry(&fiPtr->fontCache, Tcl_GetString(objPtr));
}
if (hashPtr != NULL) {
- for (fontPtr = Tcl_GetHashValue(hashPtr); fontPtr != NULL;
+ for (fontPtr = (TkFont *)Tcl_GetHashValue(hashPtr); fontPtr != NULL;
fontPtr = fontPtr->nextPtr) {
if (Tk_Screen(tkwin) == fontPtr->screen) {
fontPtr->objRefCount++;
@@ -1360,7 +1361,7 @@ Tk_GetFontFromObj(
static int
SetFontFromAny(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ TCL_UNUSED(Tcl_Interp *), /* Used for error reporting if not NULL. */
Tcl_Obj *objPtr) /* The object to convert. */
{
const Tcl_ObjType *typePtr;
@@ -1436,8 +1437,7 @@ Tk_FreeFont(
if (fontPtr == NULL) {
return;
}
- fontPtr->resourceRefCount--;
- if (fontPtr->resourceRefCount > 0) {
+ if (fontPtr->resourceRefCount-- > 1) {
return;
}
if (fontPtr->namedHashPtr != NULL) {
@@ -1446,7 +1446,7 @@ Tk_FreeFont(
* the named font and free it if no-one else is using it.
*/
- nfPtr = Tcl_GetHashValue(fontPtr->namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(fontPtr->namedHashPtr);
nfPtr->refCount--;
if ((nfPtr->refCount == 0) && nfPtr->deletePending) {
Tcl_DeleteHashEntry(fontPtr->namedHashPtr);
@@ -1454,7 +1454,7 @@ Tk_FreeFont(
}
}
- prevPtr = Tcl_GetHashValue(fontPtr->cacheHashPtr);
+ prevPtr = (TkFont *)Tcl_GetHashValue(fontPtr->cacheHashPtr);
if (prevPtr == fontPtr) {
if (fontPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(fontPtr->cacheHashPtr);
@@ -1532,7 +1532,7 @@ static void
FreeFontObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkFont *fontPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ TkFont *fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1;
if (fontPtr != NULL) {
fontPtr->objRefCount--;
@@ -1567,7 +1567,7 @@ DupFontObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkFont *fontPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkFont *fontPtr = (TkFont *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = fontPtr;
@@ -1973,7 +1973,7 @@ Tk_ComputeTextLayout(
int *heightPtr) /* Filled with height of string. */
{
TkFont *fontPtr = (TkFont *) tkfont;
- const char *start, *end, *special;
+ const char *start, *endp, *special;
int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight;
int baseline, height, curX, newX, maxWidth, *lineLengths;
TextLayout *layoutPtr;
@@ -2006,8 +2006,8 @@ Tk_ComputeTextLayout(
maxChunks = 1;
- layoutPtr = ckalloc(sizeof(TextLayout)
- + (maxChunks-1) * sizeof(LayoutChunk));
+ layoutPtr = (TextLayout *)ckalloc(Tk_Offset(TextLayout, chunks)
+ + maxChunks * sizeof(LayoutChunk));
layoutPtr->tkfont = tkfont;
layoutPtr->string = string;
layoutPtr->numChunks = 0;
@@ -2021,12 +2021,12 @@ Tk_ComputeTextLayout(
curX = 0;
- end = Tcl_UtfAtIndex(string, numChars);
+ endp = TkUtfAtIndex(string, numChars);
special = string;
flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES;
flags |= TK_WHOLE_WORDS | TK_AT_LEAST_ONE;
- for (start = string; start < end; ) {
+ for (start = string; start < endp; ) {
if (start >= special) {
/*
* Find the next special character in the string.
@@ -2037,7 +2037,7 @@ Tk_ComputeTextLayout(
* whitespace set.
*/
- for (special = start; special < end; special++) {
+ for (special = start; special < endp; special++) {
if (!(flags & TK_IGNORE_NEWLINES)) {
if ((*special == '\n') || (*special == '\r')) {
break;
@@ -2071,7 +2071,7 @@ Tk_ComputeTextLayout(
}
}
- if ((start == special) && (special < end)) {
+ if ((start == special) && (special < endp)) {
/*
* Handle the special character.
*
@@ -2088,7 +2088,7 @@ Tk_ComputeTextLayout(
start++;
curX = newX;
flags &= ~TK_AT_LEAST_ONE;
- if ((start < end) &&
+ if ((start < endp) &&
((wrapLength <= 0) || (newX <= wrapLength))) {
/*
* More chars can still fit on this line.
@@ -2110,7 +2110,7 @@ Tk_ComputeTextLayout(
* Consume all extra spaces at end of line.
*/
- while ((start < end) && isspace(UCHAR(*start))) { /* INTL: ISO space */
+ while ((start < endp) && isspace(UCHAR(*start))) { /* INTL: ISO space */
if (!(flags & TK_IGNORE_NEWLINES)) {
if ((*start == '\n') || (*start == '\r')) {
break;
@@ -2298,12 +2298,16 @@ Tk_DrawTextLayout(
int x, int y, /* Upper-left hand corner of rectangle in
* which to draw (pixels). */
int firstChar, /* The index of the first character to draw
- * from the given text item. 0 specfies the
+ * from the given text item. 0 specifies the
* beginning. */
int lastChar) /* The index just after the last character to
* draw from the given text item. A number < 0
* means to draw all characters. */
{
+#if 0
+ /* Use TkDrawAngledTextLayout() implementation - testing purposes at this point */
+ TkDrawAngledTextLayout(display, drawable, gc, layout, x, y, 0.0, firstChar, lastChar);
+#else
TextLayout *layoutPtr = (TextLayout *) layout;
int i, numDisplayChars, drawX;
const char *firstByte, *lastByte;
@@ -2325,16 +2329,23 @@ Tk_DrawTextLayout(
firstChar = 0;
firstByte = chunkPtr->start;
} else {
- firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar);
+ firstByte = TkUtfAtIndex(chunkPtr->start, firstChar);
Tk_MeasureChars(layoutPtr->tkfont, chunkPtr->start,
firstByte - chunkPtr->start, -1, 0, &drawX);
}
if (lastChar < numDisplayChars) {
numDisplayChars = lastChar;
}
- lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
+ lastByte = TkUtfAtIndex(chunkPtr->start, numDisplayChars);
+#if TK_DRAW_IN_CONTEXT
+ TkpDrawCharsInContext(display, drawable, gc, layoutPtr->tkfont,
+ chunkPtr->start, chunkPtr->numBytes,
+ firstByte - chunkPtr->start, lastByte - firstByte,
+ x+chunkPtr->x, y+chunkPtr->y);
+#else /* !TK_DRAW_IN_CONTEXT */
Tk_DrawChars(display, drawable, gc, layoutPtr->tkfont, firstByte,
lastByte - firstByte, x+chunkPtr->x+drawX, y+chunkPtr->y);
+#endif /* TK_DRAW_IN_CONTEXT */
}
firstChar -= chunkPtr->numChars;
lastChar -= chunkPtr->numChars;
@@ -2343,6 +2354,7 @@ Tk_DrawTextLayout(
}
chunkPtr++;
}
+#endif /* Use TkDrawAngledTextLayout() implementation */
}
void
@@ -2357,7 +2369,7 @@ TkDrawAngledTextLayout(
* which to draw (pixels). */
double angle,
int firstChar, /* The index of the first character to draw
- * from the given text item. 0 specfies the
+ * from the given text item. 0 specifies the
* beginning. */
int lastChar) /* The index just after the last character to
* draw from the given text item. A number < 0
@@ -2387,14 +2399,29 @@ TkDrawAngledTextLayout(
firstChar = 0;
firstByte = chunkPtr->start;
} else {
- firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar);
+ firstByte = TkUtfAtIndex(chunkPtr->start, firstChar);
Tk_MeasureChars(layoutPtr->tkfont, chunkPtr->start,
firstByte - chunkPtr->start, -1, 0, &drawX);
}
if (lastChar < numDisplayChars) {
numDisplayChars = lastChar;
}
- lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
+ lastByte = TkUtfAtIndex(chunkPtr->start, numDisplayChars);
+#if TK_DRAW_IN_CONTEXT
+ dx = cosA * (chunkPtr->x) + sinA * (chunkPtr->y);
+ dy = -sinA * (chunkPtr->x) + cosA * (chunkPtr->y);
+ if (angle == 0.0) {
+ TkpDrawCharsInContext(display, drawable, gc,
+ layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes,
+ firstByte - chunkPtr->start, lastByte - firstByte,
+ (int)(x + dx), (int)(y + dy));
+ } else {
+ TkpDrawAngledCharsInContext(display, drawable, gc,
+ layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes,
+ firstByte - chunkPtr->start, lastByte - firstByte,
+ x+dx, y+dy, angle);
+ }
+#else /* !TK_DRAW_IN_CONTEXT */
dx = cosA * (chunkPtr->x + drawX) + sinA * (chunkPtr->y);
dy = -sinA * (chunkPtr->x + drawX) + cosA * (chunkPtr->y);
if (angle == 0.0) {
@@ -2405,6 +2432,7 @@ TkDrawAngledTextLayout(
TkDrawAngledChars(display, drawable, gc, layoutPtr->tkfont,
firstByte, lastByte - firstByte, x+dx, y+dy, angle);
}
+#endif /* TK_DRAW_IN_CONTEXT */
}
firstChar -= chunkPtr->numChars;
lastChar -= chunkPtr->numChars;
@@ -2736,15 +2764,15 @@ Tk_CharBbox(
goto check;
}
} else if (index < chunkPtr->numChars) {
- end = Tcl_UtfAtIndex(chunkPtr->start, index);
+ end = TkUtfAtIndex(chunkPtr->start, index);
if (xPtr != NULL) {
Tk_MeasureChars(tkfont, chunkPtr->start,
end - chunkPtr->start, -1, 0, &x);
x += chunkPtr->x;
}
if (widthPtr != NULL) {
- Tk_MeasureChars(tkfont, end, Tcl_UtfNext(end) - end,
- -1, 0, &w);
+ int ch;
+ Tk_MeasureChars(tkfont, end, TkUtfToUniChar(end, &ch), -1, 0, &w);
}
goto check;
}
@@ -3376,7 +3404,7 @@ noMapping: ;
static int
ConfigAttributesObj(
Tcl_Interp *interp, /* Interp for error return. */
- Tk_Window tkwin, /* For display on which font will be used. */
+ TCL_UNUSED(Tk_Window), /* For display on which font will be used. */
int objc, /* Number of elements in argv. */
Tcl_Obj *const objv[], /* Command line options. */
TkFontAttributes *faPtr) /* Font attributes structure whose fields are
@@ -3583,7 +3611,7 @@ ParseFontNameObj(
* specified in font name are filled with
* default values. */
{
- char *dash;
+ const char *dash;
int objc, result, i, n;
Tcl_Obj **objv;
const char *string;
@@ -3751,7 +3779,7 @@ NewChunk(
maxChunks = *maxPtr;
if (layoutPtr->numChunks == maxChunks) {
maxChunks *= 2;
- s = sizeof(TextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk));
+ s = Tk_Offset(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk));
layoutPtr = ckrealloc(layoutPtr, s);
*layoutPtrPtr = layoutPtr;
@@ -4215,7 +4243,7 @@ TkDebugFont(
hashPtr = Tcl_FindHashEntry(
&((TkWindow *) tkwin)->mainPtr->fontInfoPtr->fontCache, name);
if (hashPtr != NULL) {
- fontPtr = Tcl_GetHashValue(hashPtr);
+ fontPtr = (TkFont *)Tcl_GetHashValue(hashPtr);
if (fontPtr == NULL) {
Tcl_Panic("TkDebugFont found empty hash table entry");
}
@@ -4268,7 +4296,7 @@ TkFontGetFirstTextLayout(
}
chunkPtr = layoutPtr->chunks;
numBytesInChunk = chunkPtr->numBytes;
- strncpy(dst, chunkPtr->start, (size_t) numBytesInChunk);
+ strncpy(dst, chunkPtr->start, numBytesInChunk);
*font = layoutPtr->tkfont;
return numBytesInChunk;
}
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index ce7dc8c3..54ba8e8d 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -314,7 +314,7 @@ static void DisplayFrame(ClientData clientData);
static void FrameCmdDeletedProc(ClientData clientData);
static void FrameEventProc(ClientData clientData,
XEvent *eventPtr);
-static void FrameLostSlaveProc(ClientData clientData,
+static void FrameLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void FrameRequestProc(ClientData clientData,
Tk_Window tkwin);
@@ -346,7 +346,7 @@ static const Tk_ClassProcs frameClass = {
static const Tk_GeomMgr frameGeomType = {
"labelframe", /* name */
FrameRequestProc, /* requestProc */
- FrameLostSlaveProc /* lostSlaveProc */
+ FrameLostContentProc /* lostSlaveProc */
};
/*
@@ -806,7 +806,7 @@ FrameWidgetObjCmd(
|| ((c == 'v')
&& (strncmp(arg, "-visual", (unsigned)length) == 0))) {
-#ifdef SUPPORT_CONFIG_EMBEDDED
+#ifdef _WIN32
if (c == 'u') {
const char *string = Tcl_GetString(objv[i+1]);
@@ -1914,25 +1914,25 @@ FrameRequestProc(
/*
*--------------------------------------------------------------
*
- * FrameLostSlaveProc --
+ * FrameLostContentProc --
*
* 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 frame-related information about the slave.
+ * Forgets all frame-related information about the content window.
*
*--------------------------------------------------------------
*/
static void
-FrameLostSlaveProc(
- ClientData clientData, /* Frame structure for slave window that was
+FrameLostContentProc(
+ ClientData clientData, /* Frame 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. */
{
Frame *framePtr = clientData;
Labelframe *labelframePtr = clientData;
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 870c1f3f..013347bb 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.c
@@ -15,29 +15,29 @@
/*
* Data structures of the following type are used by Tk_MaintainGeometry. For
- * each slave managed by Tk_MaintainGeometry, there is one of these structures
- * associated with its master.
+ * each content managed by Tk_MaintainGeometry, there is one of these structures
+ * associated with its container.
*/
-typedef struct MaintainSlave {
- Tk_Window slave; /* The slave window being positioned. */
- Tk_Window master; /* The master that determines slave's
+typedef struct MaintainContent {
+ Tk_Window content; /* The content window being positioned. */
+ Tk_Window container; /* The container that determines content's
* position; it must be a descendant of
- * slave's parent. */
- int x, y; /* Desired position of slave relative to
- * master. */
- int width, height; /* Desired dimensions of slave. */
- struct MaintainSlave *nextPtr;
+ * content's parent. */
+ int x, y; /* Desired position of content relative to
+ * container. */
+ int width, height; /* Desired dimensions of content. */
+ struct MaintainContent *nextPtr;
/* Next in list of Maintains associated with
- * master. */
-} MaintainSlave;
+ * container. */
+} MaintainContent;
/*
- * For each window that has been specified as a master to Tk_MaintainGeometry,
+ * For each window that has been specified as a content to Tk_MaintainGeometry,
* there is a structure of the following type:
*/
-typedef struct MaintainMaster {
+typedef struct MaintainContainer {
Tk_Window ancestor; /* The lowest ancestor of this window for
* which we have *not* created a
* StructureNotify handler. May be the same as
@@ -45,18 +45,18 @@ typedef struct MaintainMaster {
int checkScheduled; /* Non-zero means that there is already a call
* to MaintainCheckProc scheduled as an idle
* handler. */
- MaintainSlave *slavePtr; /* First in list of all slaves associated with
- * this master. */
-} MaintainMaster;
+ MaintainContent *contentPtr; /* First in list of all content associated with
+ * this container. */
+} MaintainContainer;
/*
* Prototypes for static procedures in this file:
*/
static void MaintainCheckProc(ClientData clientData);
-static void MaintainMasterProc(ClientData clientData,
+static void MaintainContainerProc(ClientData clientData,
XEvent *eventPtr);
-static void MaintainSlaveProc(ClientData clientData,
+static void MaintainContentProc(ClientData clientData,
XEvent *eventPtr);
/*
@@ -65,7 +65,7 @@ static void MaintainSlaveProc(ClientData clientData,
* Tk_ManageGeometry --
*
* Arrange for a particular procedure to manage the geometry of a given
- * slave window.
+ * content window.
*
* Results:
* None.
@@ -90,7 +90,7 @@ Tk_ManageGeometry(
ClientData clientData) /* Arbitrary one-word argument to pass to
* geometry manager procedures. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
if ((winPtr->geomMgrPtr != NULL) && (mgrPtr != NULL)
&& ((winPtr->geomMgrPtr != mgrPtr)
@@ -132,7 +132,7 @@ Tk_GeometryRequest(
int reqWidth, int reqHeight)/* Minimum desired dimensions for window, in
* pixels. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
/*
* X gets very upset if a window requests a width or height of zero, so
@@ -182,8 +182,8 @@ Tk_SetInternalBorderEx(
int left, int right, /* Width of internal border, in pixels. */
int top, int bottom)
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
- register int changed = 0;
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ int changed = 0;
if (left < 0) {
left = 0;
@@ -218,7 +218,7 @@ Tk_SetInternalBorderEx(
}
/*
- * All the slaves for which this is the master window must now be
+ * All the content for which this is the container window must now be
* repositioned to take account of the new internal border width. To
* signal all the geometry managers to do this, trigger a ConfigureNotify
* event. This will cause geometry managers to recompute everything.
@@ -279,7 +279,7 @@ Tk_SetMinimumRequestSize(
Tk_Window tkwin, /* Window that will have internal border. */
int minWidth, int minHeight)/* Minimum requested size, in pixels. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
if ((winPtr->minReqWidth == minWidth) &&
(winPtr->minReqHeight == minHeight)) {
@@ -303,31 +303,31 @@ Tk_SetMinimumRequestSize(
/*
*----------------------------------------------------------------------
*
- * TkSetGeometryMaster --
+ * TkSetGeometryContainer --
*
- * Set a geometry master for this window. Only one master may own
+ * Set a geometry container for this window. Only one container may own
* a window at any time.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * The geometry master is recorded for the window.
+ * The geometry container is recorded for the window.
*
*----------------------------------------------------------------------
*/
int
-TkSetGeometryMaster(
+TkSetGeometryContainer(
Tcl_Interp *interp, /* Current interpreter, for error. */
- Tk_Window tkwin, /* Window that will have geometry master
+ Tk_Window tkwin, /* Window that will have geometry container
* set. */
- const char *master) /* The master identity. */
+ const char *name) /* The name of the geometry manager. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->geomMgrName != NULL &&
- strcmp(winPtr->geomMgrName, master) == 0) {
+ strcmp(winPtr->geomMgrName, name) == 0) {
return TCL_OK;
}
if (winPtr->geomMgrName != NULL) {
@@ -335,46 +335,46 @@ TkSetGeometryMaster(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"cannot use geometry manager %s inside %s which already"
" has slaves managed by %s",
- master, Tk_PathName(tkwin), winPtr->geomMgrName));
+ name, Tk_PathName(tkwin), winPtr->geomMgrName));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "FIGHT", NULL);
}
return TCL_ERROR;
}
- winPtr->geomMgrName = ckalloc(strlen(master) + 1);
- strcpy(winPtr->geomMgrName, master);
+ winPtr->geomMgrName = (char *)ckalloc(strlen(name) + 1);
+ strcpy(winPtr->geomMgrName, name);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * TkFreeGeometryMaster --
+ * TkFreeGeometryContainer --
*
- * Remove a geometry master for this window. Only one master may own
+ * Remove a geometry container for this window. Only one container may own
* a window at any time.
*
* Results:
* None.
*
* Side effects:
- * The geometry master is cleared for the window.
+ * The geometry container is cleared for the window.
*
*----------------------------------------------------------------------
*/
void
-TkFreeGeometryMaster(
- Tk_Window tkwin, /* Window that will have geometry master
+TkFreeGeometryContainer(
+ Tk_Window tkwin, /* Window that will have geometry container
* cleared. */
- const char *master) /* The master identity. */
+ const char *name) /* The name of the geometry manager. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->geomMgrName != NULL &&
- strcmp(winPtr->geomMgrName, master) != 0) {
+ strcmp(winPtr->geomMgrName, name) != 0) {
Tcl_Panic("Trying to free %s from geometry manager %s",
- winPtr->geomMgrName, master);
+ winPtr->geomMgrName, name);
}
if (winPtr->geomMgrName != NULL) {
ckfree(winPtr->geomMgrName);
@@ -387,12 +387,12 @@ TkFreeGeometryMaster(
*
* Tk_MaintainGeometry --
*
- * This procedure is invoked by geometry managers to handle slaves whose
- * master's are not their parents. It translates the desired geometry for
- * the slave into the coordinate system of the parent and respositions
- * the slave if it isn't already at the right place. Furthermore, it sets
- * up event handlers so that if the master (or any of its ancestors up to
- * the slave's parent) is mapped, unmapped, or moved, then the slave will
+ * This procedure is invoked by geometry managers to handle content whose
+ * container's are not their parents. It translates the desired geometry for
+ * the content into the coordinate system of the parent and respositions
+ * the content if it isn't already at the right place. Furthermore, it sets
+ * up event handlers so that if the container (or any of its ancestors up to
+ * the content's parent) is mapped, unmapped, or moved, then the content will
* be adjusted to match.
*
* Results:
@@ -400,7 +400,7 @@ TkFreeGeometryMaster(
*
* Side effects:
* Event handlers are created and state is allocated to keep track of
- * slave. Note: if slave was already managed for master by
+ * content. Note: if content was already managed for container by
* Tk_MaintainGeometry, then the previous information is replaced with
* the new information. The caller must eventually call
* Tk_UnmaintainGeometry to eliminate the correspondence (or, the state
@@ -411,40 +411,39 @@ TkFreeGeometryMaster(
void
Tk_MaintainGeometry(
- Tk_Window slave, /* Slave for geometry management. */
- Tk_Window master, /* Master for slave; must be a descendant of
- * slave's parent. */
- int x, int y, /* Desired position of slave within master. */
- int width, int height) /* Desired dimensions for slave. */
+ Tk_Window window, /* Window for geometry management. */
+ Tk_Window container, /* Container for window; must be a descendant of
+ * window's parent. */
+ int x, int y, /* Desired position of window within container. */
+ int width, int height) /* Desired dimensions for window. */
{
Tcl_HashEntry *hPtr;
- MaintainMaster *masterPtr;
- register MaintainSlave *slavePtr;
+ MaintainContainer *containerPtr;
+ MaintainContent *contentPtr;
int isNew, map;
Tk_Window ancestor, parent;
- TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) container)->dispPtr;
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master;
+ ((TkWindow *)window)->maintainerPtr = (TkWindow *)container;
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master;
- if (master == Tk_Parent(slave)) {
+ if (container == Tk_Parent(window)) {
/*
- * If the slave is a direct descendant of the master, don't bother
+ * If the window is a direct descendant of the container, don't bother
* setting up the extra infrastructure for management, just make a
* call to Tk_MoveResizeWindow; the parent/child relationship will
* take care of the rest.
*/
- Tk_MoveResizeWindow(slave, x, y, width, height);
+ Tk_MoveResizeWindow(window, x, y, width, height);
/*
- * Map the slave if the master is already mapped; otherwise, wait
- * until the master is mapped later (in which case mapping the slave
+ * Map the window if the container is already mapped; otherwise, wait
+ * until the container is mapped later (in which case mapping the window
* is taken care of elsewhere).
*/
- if (Tk_IsMapped(master)) {
- Tk_MapWindow(slave);
+ if (Tk_IsMapped(container)) {
+ Tk_MapWindow(window);
}
return;
}
@@ -455,55 +454,55 @@ Tk_MaintainGeometry(
}
/*
- * See if there is already a MaintainMaster structure for the master; if
+ * See if there is already a MaintainContainer structure for the container; if
* not, then create one.
*/
- parent = Tk_Parent(slave);
+ parent = Tk_Parent(window);
hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable,
- (char *) master, &isNew);
+ (char *) container, &isNew);
if (!isNew) {
- masterPtr = Tcl_GetHashValue(hPtr);
+ containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr);
} else {
- masterPtr = ckalloc(sizeof(MaintainMaster));
- masterPtr->ancestor = master;
- masterPtr->checkScheduled = 0;
- masterPtr->slavePtr = NULL;
- Tcl_SetHashValue(hPtr, masterPtr);
+ containerPtr = (MaintainContainer *)ckalloc(sizeof(MaintainContainer));
+ containerPtr->ancestor = container;
+ containerPtr->checkScheduled = 0;
+ containerPtr->contentPtr = NULL;
+ Tcl_SetHashValue(hPtr, containerPtr);
}
/*
- * Create a MaintainSlave structure for the slave if there isn't already
+ * Create a MaintainContent structure for the window if there isn't already
* one.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if (slavePtr->slave == slave) {
- goto gotSlave;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if (contentPtr->content == window) {
+ goto gotContent;
}
}
- slavePtr = ckalloc(sizeof(MaintainSlave));
- slavePtr->slave = slave;
- slavePtr->master = master;
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
- Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainSlaveProc,
- slavePtr);
+ contentPtr = (MaintainContent *)ckalloc(sizeof(MaintainContent));
+ contentPtr->content = window;
+ contentPtr->container = container;
+ contentPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = contentPtr;
+ Tk_CreateEventHandler(window, StructureNotifyMask, MaintainContentProc,
+ contentPtr);
/*
* Make sure that there are event handlers registered for all the windows
- * between master and slave's parent (including master but not slave's
- * parent). There may already be handlers for master and some of its
- * ancestors (masterPtr->ancestor tells how many).
+ * between container and windows's parent (including container but not window's
+ * parent). There may already be handlers for container and some of its
+ * ancestors (containerPtr->ancestor tells how many).
*/
- for (ancestor = master; ancestor != parent;
+ for (ancestor = container; ancestor != parent;
ancestor = Tk_Parent(ancestor)) {
- if (ancestor == masterPtr->ancestor) {
+ if (ancestor == containerPtr->ancestor) {
Tk_CreateEventHandler(ancestor, StructureNotifyMask,
- MaintainMasterProc, masterPtr);
- masterPtr->ancestor = Tk_Parent(ancestor);
+ MaintainContainerProc, containerPtr);
+ containerPtr->ancestor = Tk_Parent(ancestor);
}
}
@@ -512,27 +511,27 @@ Tk_MaintainGeometry(
* if it's not currently in the right place or state.
*/
- gotSlave:
- slavePtr->x = x;
- slavePtr->y = y;
- slavePtr->width = width;
- slavePtr->height = height;
+ gotContent:
+ contentPtr->x = x;
+ contentPtr->y = y;
+ contentPtr->width = width;
+ contentPtr->height = height;
map = 1;
- for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) {
if (!Tk_IsMapped(ancestor) && (ancestor != parent)) {
map = 0;
}
if (ancestor == parent) {
- if ((x != Tk_X(slavePtr->slave))
- || (y != Tk_Y(slavePtr->slave))
- || (width != Tk_Width(slavePtr->slave))
- || (height != Tk_Height(slavePtr->slave))) {
- Tk_MoveResizeWindow(slavePtr->slave, x, y, width, height);
+ if ((x != Tk_X(contentPtr->content))
+ || (y != Tk_Y(contentPtr->content))
+ || (width != Tk_Width(contentPtr->content))
+ || (height != Tk_Height(contentPtr->content))) {
+ Tk_MoveResizeWindow(contentPtr->content, x, y, width, height);
}
if (map) {
- Tk_MapWindow(slavePtr->slave);
+ Tk_MapWindow(contentPtr->content);
} else {
- Tk_UnmapWindow(slavePtr->slave);
+ Tk_UnmapWindow(contentPtr->content);
}
break;
}
@@ -547,37 +546,36 @@ Tk_MaintainGeometry(
* Tk_UnmaintainGeometry --
*
* This procedure cancels a previous Tk_MaintainGeometry call, so that
- * the relationship between slave and master is no longer maintained.
+ * the relationship between window and container is no longer maintained.
*
* Results:
* None.
*
* Side effects:
- * The slave is unmapped and state is released, so that slave won't track
- * master any more. If we weren't previously managing slave relative to
- * master, then this procedure has no effect.
+ * The window is unmapped and state is released, so that window won't track
+ * container any more. If we weren't previously managing window relative to
+ * container, then this procedure has no effect.
*
*----------------------------------------------------------------------
*/
void
Tk_UnmaintainGeometry(
- Tk_Window slave, /* Slave for geometry management. */
- Tk_Window master) /* Master for slave; must be a descendant of
- * slave's parent. */
+ Tk_Window window, /* WIndow for geometry management. */
+ Tk_Window container) /* Container for window; must be a descendant of
+ * window's parent. */
{
Tcl_HashEntry *hPtr;
- MaintainMaster *masterPtr;
- register MaintainSlave *slavePtr, *prevPtr;
+ MaintainContainer *containerPtr;
+ MaintainContent *contentPtr, *prevPtr;
Tk_Window ancestor;
- TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) window)->dispPtr;
- ((TkWindow *)slave)->maintainerPtr = NULL;
+ ((TkWindow *)window)->maintainerPtr = NULL;
- ((TkWindow *)slave)->maintainerPtr = NULL;
- if (master == Tk_Parent(slave)) {
+ if (container == Tk_Parent(window)) {
/*
- * If the slave is a direct descendant of the master,
+ * If the window is a direct descendant of the container,
* Tk_MaintainGeometry will not have set up any of the extra
* infrastructure. Don't even bother to look for it, just return.
*/
@@ -589,57 +587,57 @@ Tk_UnmaintainGeometry(
Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS);
}
- if (!(((TkWindow *) slave)->flags & TK_ALREADY_DEAD)) {
- Tk_UnmapWindow(slave);
+ if (!(((TkWindow *) window)->flags & TK_ALREADY_DEAD)) {
+ Tk_UnmapWindow(window);
}
- hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, (char *) master);
+ hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, container);
if (hPtr == NULL) {
return;
}
- masterPtr = Tcl_GetHashValue(hPtr);
- slavePtr = masterPtr->slavePtr;
- if (slavePtr->slave == slave) {
- masterPtr->slavePtr = slavePtr->nextPtr;
+ containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr);
+ contentPtr = containerPtr->contentPtr;
+ if (contentPtr->content == window) {
+ containerPtr->contentPtr = contentPtr->nextPtr;
} else {
- for (prevPtr = slavePtr, slavePtr = slavePtr->nextPtr; ;
- prevPtr = slavePtr, slavePtr = slavePtr->nextPtr) {
- if (slavePtr == NULL) {
+ for (prevPtr = contentPtr, contentPtr = contentPtr->nextPtr; ;
+ prevPtr = contentPtr, contentPtr = contentPtr->nextPtr) {
+ if (contentPtr == NULL) {
return;
}
- if (slavePtr->slave == slave) {
- prevPtr->nextPtr = slavePtr->nextPtr;
+ if (contentPtr->content == window) {
+ prevPtr->nextPtr = contentPtr->nextPtr;
break;
}
}
}
- Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask,
- MaintainSlaveProc, slavePtr);
- ckfree(slavePtr);
- if (masterPtr->slavePtr == NULL) {
- if (masterPtr->ancestor != NULL) {
- for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) {
+ Tk_DeleteEventHandler(contentPtr->content, StructureNotifyMask,
+ MaintainContentProc, contentPtr);
+ ckfree(contentPtr);
+ if (containerPtr->contentPtr == NULL) {
+ if (containerPtr->ancestor != NULL) {
+ for (ancestor = container; ; ancestor = Tk_Parent(ancestor)) {
Tk_DeleteEventHandler(ancestor, StructureNotifyMask,
- MaintainMasterProc, masterPtr);
- if (ancestor == masterPtr->ancestor) {
+ MaintainContainerProc, containerPtr);
+ if (ancestor == containerPtr->ancestor) {
break;
}
}
}
- if (masterPtr->checkScheduled) {
- Tcl_CancelIdleCall(MaintainCheckProc, masterPtr);
+ if (containerPtr->checkScheduled) {
+ Tcl_CancelIdleCall(MaintainCheckProc, containerPtr);
}
Tcl_DeleteHashEntry(hPtr);
- ckfree(masterPtr);
+ ckfree(containerPtr);
}
}
/*
*----------------------------------------------------------------------
*
- * MaintainMasterProc --
+ * MaintainContainerProc --
*
* This procedure is invoked by the Tk event dispatcher in response to
- * StructureNotify events on the master or one of its ancestors, on
+ * StructureNotify events on the container or one of its ancestors, on
* behalf of Tk_MaintainGeometry.
*
* Results:
@@ -648,43 +646,43 @@ Tk_UnmaintainGeometry(
* Side effects:
* It schedules a call to MaintainCheckProc, which will eventually caused
* the postions and mapped states to be recalculated for all the
- * maintained slaves of the master. Or, if the master window is being
+ * maintained windows of the container. Or, if the container window is being
* deleted then state is cleaned up.
*
*----------------------------------------------------------------------
*/
static void
-MaintainMasterProc(
- ClientData clientData, /* Pointer to MaintainMaster structure for the
- * master window. */
+MaintainContainerProc(
+ ClientData clientData, /* Pointer to MaintainContainer structure for the
+ * container window. */
XEvent *eventPtr) /* Describes what just happened. */
{
- MaintainMaster *masterPtr = clientData;
- MaintainSlave *slavePtr;
+ MaintainContainer *containerPtr = (MaintainContainer *)clientData;
+ MaintainContent *contentPtr;
int done;
if ((eventPtr->type == ConfigureNotify)
|| (eventPtr->type == MapNotify)
|| (eventPtr->type == UnmapNotify)) {
- if (!masterPtr->checkScheduled) {
- masterPtr->checkScheduled = 1;
- Tcl_DoWhenIdle(MaintainCheckProc, masterPtr);
+ if (!containerPtr->checkScheduled) {
+ containerPtr->checkScheduled = 1;
+ Tcl_DoWhenIdle(MaintainCheckProc, containerPtr);
}
} else if (eventPtr->type == DestroyNotify) {
/*
- * Delete all of the state associated with this master, but be careful
- * not to use masterPtr after the last slave is deleted, since its
+ * Delete all of the state associated with this container, but be careful
+ * not to use containerPtr after the last window is deleted, since its
* memory will have been freed.
*/
done = 0;
do {
- slavePtr = masterPtr->slavePtr;
- if (slavePtr->nextPtr == NULL) {
+ contentPtr = containerPtr->contentPtr;
+ if (contentPtr->nextPtr == NULL) {
done = 1;
}
- Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master);
+ Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container);
} while (!done);
}
}
@@ -692,10 +690,10 @@ MaintainMasterProc(
/*
*----------------------------------------------------------------------
*
- * MaintainSlaveProc --
+ * MaintainContentProc --
*
* This procedure is invoked by the Tk event dispatcher in response to
- * StructureNotify events on a slave being managed by
+ * StructureNotify events on a window being managed by
* Tk_MaintainGeometry.
*
* Results:
@@ -703,21 +701,21 @@ MaintainMasterProc(
*
* Side effects:
* If the event is a DestroyNotify event then the Maintain state and
- * event handlers for this slave are deleted.
+ * event handlers for this window are deleted.
*
*----------------------------------------------------------------------
*/
static void
-MaintainSlaveProc(
- ClientData clientData, /* Pointer to MaintainSlave structure for
- * master-slave pair. */
+MaintainContentProc(
+ ClientData clientData, /* Pointer to MaintainContent structure for
+ * container-window pair. */
XEvent *eventPtr) /* Describes what just happened. */
{
- MaintainSlave *slavePtr = clientData;
+ MaintainContent *contentPtr = (MaintainContent *)clientData;
if (eventPtr->type == DestroyNotify) {
- Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master);
+ Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container);
}
}
@@ -727,50 +725,50 @@ MaintainSlaveProc(
* MaintainCheckProc --
*
* This procedure is invoked by the Tk event dispatcher as an idle
- * handler, when a master or one of its ancestors has been reconfigured,
- * mapped, or unmapped. Its job is to scan all of the slaves for the
- * master and reposition them, map them, or unmap them as needed to
- * maintain their geometry relative to the master.
+ * handler, when a container or one of its ancestors has been reconfigured,
+ * mapped, or unmapped. Its job is to scan all of the windows for the
+ * container and reposition them, map them, or unmap them as needed to
+ * maintain their geometry relative to the container.
*
* Results:
* None.
*
* Side effects:
- * Slaves can get repositioned, mapped, or unmapped.
+ * Windows can get repositioned, mapped, or unmapped.
*
*----------------------------------------------------------------------
*/
static void
MaintainCheckProc(
- ClientData clientData) /* Pointer to MaintainMaster structure for the
- * master window. */
+ ClientData clientData) /* Pointer to MaintainContainer structure for the
+ * container window. */
{
- MaintainMaster *masterPtr = clientData;
- MaintainSlave *slavePtr;
+ MaintainContainer *containerPtr = (MaintainContainer *)clientData;
+ MaintainContent *contentPtr;
Tk_Window ancestor, parent;
int x, y, map;
- masterPtr->checkScheduled = 0;
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- parent = Tk_Parent(slavePtr->slave);
- x = slavePtr->x;
- y = slavePtr->y;
+ containerPtr->checkScheduled = 0;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ parent = Tk_Parent(contentPtr->content);
+ x = contentPtr->x;
+ y = contentPtr->y;
map = 1;
- for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) {
if (!Tk_IsMapped(ancestor) && (ancestor != parent)) {
map = 0;
}
if (ancestor == parent) {
- if ((x != Tk_X(slavePtr->slave))
- || (y != Tk_Y(slavePtr->slave))) {
- Tk_MoveWindow(slavePtr->slave, x, y);
+ if ((x != Tk_X(contentPtr->content))
+ || (y != Tk_Y(contentPtr->content))) {
+ Tk_MoveWindow(contentPtr->content, x, y);
}
if (map) {
- Tk_MapWindow(slavePtr->slave);
+ Tk_MapWindow(contentPtr->content);
} else {
- Tk_UnmapWindow(slavePtr->slave);
+ Tk_UnmapWindow(contentPtr->content);
}
break;
}
diff --git a/generic/tkGet.c b/generic/tkGet.c
index 6eff3a3e..989584e0 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.c
@@ -493,10 +493,10 @@ Tk_NameOfJustify(
static void
FreeUidThreadExitProc(
- ClientData clientData) /* Not used. */
+ TCL_UNUSED(void *))
{
- ThreadSpecificData *tsdPtr =
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DeleteHashTable(&tsdPtr->uidTable);
tsdPtr->initialized = 0;
@@ -529,7 +529,7 @@ Tk_GetUid(
const char *string) /* String to convert. */
{
int dummy;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashTable *tablePtr = &tsdPtr->uidTable;
@@ -694,6 +694,11 @@ TkGetDoublePixels(
char *end;
double d;
+ if (!tkwin) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad screen"));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "FRACTIONAL_PIXELS", NULL);
+ return TCL_ERROR;
+ }
d = strtod((char *) string, &end);
if (end == string) {
goto error;
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 28556372..a1ff46c5 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -166,7 +166,6 @@ static void ReleaseButtonGrab(TkDisplay *dispPtr);
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tk_GrabObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
@@ -223,7 +222,7 @@ Tk_GrabObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "?-global? window");
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, arg, clientData);
+ tkwin = Tk_NameToWindow(interp, arg, (Tk_Window)clientData);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -239,7 +238,7 @@ Tk_GrabObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "?-global? window");
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData);
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), (Tk_Window)clientData);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -265,7 +264,7 @@ Tk_GrabObjCmd(
}
if (objc == 3) {
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- clientData);
+ (Tk_Window)clientData);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -294,7 +293,7 @@ Tk_GrabObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "release window");
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData);
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), (Tk_Window)clientData);
if (tkwin == NULL) {
Tcl_ResetResult(interp);
} else {
@@ -311,7 +310,7 @@ Tk_GrabObjCmd(
if (objc == 3) {
globalGrab = 0;
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- clientData);
+ (Tk_Window)clientData);
} else {
globalGrab = 1;
@@ -327,7 +326,7 @@ Tk_GrabObjCmd(
return TCL_ERROR;
}
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[3]),
- clientData);
+ (Tk_Window)clientData);
}
if (tkwin == NULL) {
return TCL_ERROR;
@@ -344,7 +343,7 @@ Tk_GrabObjCmd(
return TCL_ERROR;
}
winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- clientData);
+ (Tk_Window)clientData);
if (winPtr == NULL) {
return TCL_ERROR;
}
@@ -638,7 +637,7 @@ Tk_Ungrab(
static void
ReleaseButtonGrab(
- register TkDisplay *dispPtr)/* Display whose button grab is to be
+ TkDisplay *dispPtr)/* Display whose button grab is to be
* released. */
{
unsigned int serial;
@@ -684,11 +683,11 @@ ReleaseButtonGrab(
int
TkPointerEvent(
- register XEvent *eventPtr, /* Pointer to the event. */
+ XEvent *eventPtr, /* Pointer to the event. */
TkWindow *winPtr) /* Tk's information for window where event was
* reported. */
{
- register TkWindow *winPtr2;
+ TkWindow *winPtr2;
TkDisplay *dispPtr = winPtr->dispPtr;
unsigned int serial;
int outsideGrabTree = 0;
@@ -872,7 +871,7 @@ TkPointerEvent(
} else {
if (eventPtr->xbutton.button != AnyButton &&
((eventPtr->xbutton.state & ALL_BUTTONS)
- == (unsigned int)TkGetButtonMask(eventPtr->xbutton.button))) {
+ == TkGetButtonMask(eventPtr->xbutton.button))) {
ReleaseButtonGrab(dispPtr); /* Note 4. */
}
}
@@ -907,14 +906,14 @@ TkPointerEvent(
void
TkChangeEventWindow(
- register XEvent *eventPtr, /* Event to retarget. Must have type
+ XEvent *eventPtr, /* Event to retarget. Must have type
* ButtonPress, ButtonRelease, KeyPress,
* KeyRelease, MotionNotify, EnterNotify, or
* LeaveNotify. */
TkWindow *winPtr) /* New target window for event. */
{
int x, y, sameScreen, bd;
- register TkWindow *childPtr;
+ TkWindow *childPtr;
eventPtr->xmotion.window = Tk_WindowId(winPtr);
if (eventPtr->xmotion.root ==
@@ -995,7 +994,7 @@ TkInOutEvents(
Tcl_QueuePosition position) /* Position at which events are added to the
* system event queue. */
{
- register TkWindow *winPtr;
+ TkWindow *winPtr;
int upLevels, downLevels, i, j, focus;
/*
@@ -1188,7 +1187,7 @@ MovePointer2(
void
TkGrabDeadWindow(
- register TkWindow *winPtr) /* Window that is in the process of being
+ TkWindow *winPtr) /* Window that is in the process of being
* deleted. */
{
TkDisplay *dispPtr = winPtr->dispPtr;
@@ -1278,7 +1277,7 @@ GrabRestrictProc(
ClientData arg,
XEvent *eventPtr)
{
- GrabInfo *info = arg;
+ GrabInfo *info = (GrabInfo *)arg;
int mode, diff;
/*
@@ -1336,7 +1335,7 @@ QueueGrabWindowChange(
{
NewGrabWinEvent *grabEvPtr;
- grabEvPtr = ckalloc(sizeof(NewGrabWinEvent));
+ grabEvPtr = (NewGrabWinEvent *)ckalloc(sizeof(NewGrabWinEvent));
grabEvPtr->header.proc = GrabWinEventProc;
grabEvPtr->dispPtr = dispPtr;
if (grabWinPtr == NULL) {
@@ -1371,7 +1370,7 @@ QueueGrabWindowChange(
static int
GrabWinEventProc(
Tcl_Event *evPtr, /* Event of type NewGrabWinEvent. */
- int flags) /* Flags argument to Tcl_DoOneEvent: indicates
+ TCL_UNUSED(int)) /* Flags argument to Tcl_DoOneEvent: indicates
* what kinds of events are being processed
* right now. */
{
@@ -1416,7 +1415,7 @@ FindCommonAncestor(
int *countPtr2) /* Store nesting level of winPtr2 within
* common ancestor here. */
{
- register TkWindow *winPtr;
+ TkWindow *winPtr;
TkWindow *ancestorPtr;
int count1, count2, i;
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index be15c147..785bc7f3 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -66,7 +66,7 @@
#define GRID_DEFAULT_ANCHOR TK_ANCHOR_NW
/*
- * Structure to hold information for grid masters. A slot is either a row or
+ * Structure to hold information for grid containers. A slot is either a row or
* column.
*/
@@ -80,7 +80,7 @@ typedef struct SlotInfo {
* inproportion to their weights. */
int pad; /* Extra padding, in pixels, required for this
* slot. This amount is "added" to the largest
- * slave in the slot. */
+ * content in the slot. */
Tk_Uid uniform; /* Value of -uniform option. It is used to
* group slots that should have the same
* size. */
@@ -99,13 +99,13 @@ typedef struct SlotInfo {
*/
typedef struct GridLayout {
- struct Gridder *binNextPtr; /* The next slave window in this bin. Each bin
- * contains a list of all slaves whose spans
+ struct Gridder *binNextPtr; /* The next content window in this bin. Each bin
+ * contains a list of all content whose spans
* are >1 and whose right edges fall in this
* slot. */
int minSize; /* Minimum size needed for this slot, in
* pixels. This is the space required to hold
- * any slaves contained entirely in this slot,
+ * any content contained entirely in this slot,
* adjusted for any slot constrants, such as
* size or padding. */
int pad; /* Padding needed for this slot */
@@ -124,31 +124,31 @@ typedef struct GridLayout {
} GridLayout;
/*
- * Keep one of these for each geometry master.
+ * Keep one of these for each geometry container.
*/
typedef struct {
SlotInfo *columnPtr; /* Pointer to array of column constraints. */
SlotInfo *rowPtr; /* Pointer to array of row constraints. */
- int columnEnd; /* The last column occupied by any slave. */
+ int columnEnd; /* The last column occupied by any content. */
int columnMax; /* The number of columns with constraints. */
int columnSpace; /* The number of slots currently allocated for
* column constraints. */
- int rowEnd; /* The last row occupied by any slave. */
+ int rowEnd; /* The last row occupied by any content. */
int rowMax; /* The number of rows with constraints. */
int rowSpace; /* The number of slots currently allocated for
* row constraints. */
int startX; /* Pixel offset of this layout within its
- * master. */
+ * container. */
int startY; /* Pixel offset of this layout within its
- * master. */
+ * container. */
Tk_Anchor anchor; /* Value of anchor option: specifies where a
* grid without weight should be placed. */
-} GridMaster;
+} GridContainer;
/*
* For each window that the grid cares about (either because the window is
- * managed by the grid or because the window has slaves that are managed by
+ * managed by the grid or because the window has content that are managed by
* the grid), there is a structure of the following type:
*/
@@ -157,18 +157,18 @@ typedef struct Gridder {
* window has been deleted, but the gridder
* hasn't had a chance to clean up yet because
* the structure is still in use. */
- struct Gridder *masterPtr; /* Master window within which this window is
+ struct Gridder *containerPtr; /* Container window within which this window is
* managed (NULL means this window isn't
* managed by the gridder). */
- struct Gridder *nextPtr; /* Next window managed within same master.
+ struct Gridder *nextPtr; /* Next window managed within same container.
* List order doesn't matter. */
- struct Gridder *slavePtr; /* First in list of slaves managed inside this
- * window (NULL means no grid slaves). */
- GridMaster *masterDataPtr; /* Additional data for geometry master. */
- Tcl_Obj *in; /* Store master name when removed. */
+ struct Gridder *contentPtr; /* First in list of content managed inside this
+ * window (NULL means no grid content). */
+ GridContainer *containerDataPtr; /* Additional data for geometry container. */
+ Tcl_Obj *in; /* Store container name when removed. */
int column, row; /* Location in the grid (starting from
* zero). */
- int numCols, numRows; /* Number of columns or rows this slave spans.
+ int numCols, numRows; /* Number of columns or rows this content spans.
* Should be at least 1. */
int padX, padY; /* Total additional pixels to leave around the
* window. Some is of this space is on each
@@ -185,12 +185,12 @@ typedef struct Gridder {
* sticks to. See below for definitions */
int doubleBw; /* Twice the window's last known border width.
* If this changes, the window must be
- * re-arranged within its master. */
+ * re-arranged within its container. */
int *abortPtr; /* If non-NULL, it means that there is a
* nested call to ArrangeGrid already working
* on this window. *abortPtr may be set to 1
* to abort that nested call. This happens,
- * for example, if tkwin or any of its slaves
+ * for example, if tkwin or any of its content
* is deleted. */
int flags; /* Miscellaneous flags; see below for
* definitions. */
@@ -199,9 +199,9 @@ typedef struct Gridder {
* These fields are used temporarily for layout calculations only.
*/
- struct Gridder *binNextPtr; /* Link to next span>1 slave in this bin. */
+ struct Gridder *binNextPtr; /* Link to next span>1 content in this bin. */
int size; /* Nominal size (width or height) in pixels of
- * the slave. This includes the padding. */
+ * the content. This includes the padding. */
} Gridder;
/*
@@ -235,32 +235,32 @@ typedef struct UniformGroup {
* Flag values for Grid structures:
*
* REQUESTED_RELAYOUT 1 means a Tcl_DoWhenIdle request has already
- * been made to re-arrange all the slaves of this
+ * been made to re-arrange all the content of this
* window.
* DONT_PROPAGATE 1 means don't set this window's requested
- * size. 0 means if this window is a master then
+ * size. 0 means if this window is a container then
* Tk will set its requested size to fit the
- * needs of its slaves.
- * ALLOCED_MASTER 1 means that Grid has allocated itself as
- * geometry master for this window.
+ * needs of its content.
+ * ALLOCED_CONTAINER 1 means that Grid has allocated itself as
+ * geometry container for this window.
*/
#define REQUESTED_RELAYOUT 1
#define DONT_PROPAGATE 2
-#define ALLOCED_MASTER 4
+#define ALLOCED_CONTAINER 4
/*
* Prototypes for procedures used only in this file:
*/
-static void AdjustForSticky(Gridder *slavePtr, int *xPtr,
+static void AdjustForSticky(Gridder *contentPtr, int *xPtr,
int *yPtr, int *widthPtr, int *heightPtr);
static int AdjustOffsets(int width, int elements,
SlotInfo *slotPtr);
static void ArrangeGrid(ClientData clientData);
-static int CheckSlotData(Gridder *masterPtr, int slot,
+static int CheckSlotData(Gridder *containerPtr, int slot,
int slotType, int checkOnly);
-static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
+static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyGrid(void *memPtr);
static Gridder * GetGrid(Tk_Window tkwin);
@@ -284,22 +284,22 @@ static int GridRowColumnConfigureCommand(Tk_Window tkwin,
Tcl_Obj *const objv[]);
static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-static int GridSlavesCommand(Tk_Window tkwin, Tcl_Interp *interp,
+static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static void GridStructureProc(ClientData clientData,
XEvent *eventPtr);
-static void GridLostSlaveProc(ClientData clientData,
+static void GridLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void GridReqProc(ClientData clientData, Tk_Window tkwin);
-static void InitMasterData(Gridder *masterPtr);
+static void InitContainerData(Gridder *containerPtr);
static Tcl_Obj * NewPairObj(int, int);
static Tcl_Obj * NewQuadObj(int, int, int, int);
static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn,
int maxOffset);
static void SetGridSize(Gridder *gridPtr);
-static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr,
+static int SetContentColumn(Tcl_Interp *interp, Gridder *contentPtr,
int column, int numCols);
-static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr,
+static int SetContentRow(Tcl_Interp *interp, Gridder *contentPtr,
int row, int numRows);
static Tcl_Obj * StickyToObj(int flags);
static int StringToSticky(const char *string);
@@ -308,7 +308,7 @@ static void Unlink(Gridder *gridPtr);
static const Tk_GeomMgr gridMgrType = {
"grid", /* name */
GridReqProc, /* requestProc */
- GridLostSlaveProc, /* lostSlaveProc */
+ GridLostContentProc, /* lostSlaveProc */
};
/*
@@ -335,16 +335,16 @@ Tk_GridObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
static const char *const optionStrings[] = {
"anchor", "bbox", "columnconfigure", "configure",
- "forget", "info", "location", "propagate", "remove",
- "rowconfigure", "size", "slaves", NULL
+ "content", "forget", "info", "location", "propagate",
+ "remove", "rowconfigure", "size", "slaves", NULL
};
enum options {
GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE,
- GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, GRID_REMOVE,
- GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES
+ GRID_CONTENT, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE,
+ GRID_REMOVE, GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES
};
int index;
@@ -353,7 +353,7 @@ Tk_GridObjCmd(
if ((argv1[0] == '.') || (argv1[0] == REL_SKIP) ||
(argv1[0] == REL_VERT)) {
- return ConfigureSlaves(interp, tkwin, objc-1, objv+1);
+ return ConfigureContent(interp, tkwin, objc-1, objv+1);
}
}
if (objc < 3) {
@@ -372,7 +372,7 @@ Tk_GridObjCmd(
case GRID_BBOX:
return GridBboxCommand(tkwin, interp, objc, objv);
case GRID_CONFIGURE:
- return ConfigureSlaves(interp, tkwin, objc-2, objv+2);
+ return ConfigureContent(interp, tkwin, objc-2, objv+2);
case GRID_FORGET:
case GRID_REMOVE:
return GridForgetRemoveCommand(tkwin, interp, objc, objv);
@@ -385,15 +385,16 @@ Tk_GridObjCmd(
case GRID_SIZE:
return GridSizeCommand(tkwin, interp, objc, objv);
case GRID_SLAVES:
- return GridSlavesCommand(tkwin, interp, objc, objv);
+ case GRID_CONTENT:
+ return GridContentCommand(tkwin, interp, objc, objv);
/*
* Sample argument combinations:
- * grid columnconfigure -option
- * grid columnconfigure -option value -option value
- * grid rowconfigure
- * grid rowconfigure -option
- * grid rowconfigure -option value -option value.
+ * grid columnconfigure -option
+ * grid columnconfigure -option value -option value
+ * grid rowconfigure
+ * grid rowconfigure -option
+ * grid rowconfigure -option value -option value.
*/
case GRID_COLUMNCONFIGURE:
@@ -431,9 +432,9 @@ GridAnchorCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
- GridMaster *gridPtr;
+ Tk_Window container;
+ Gridder *containerPtr;
+ GridContainer *gridPtr;
Tk_Anchor old;
if (objc > 4) {
@@ -441,21 +442,21 @@ GridAnchorCommand(
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
if (objc == 3) {
- gridPtr = masterPtr->masterDataPtr;
+ gridPtr = containerPtr->containerDataPtr;
Tcl_SetObjResult(interp, Tcl_NewStringObj(
Tk_NameOfAnchor(gridPtr?gridPtr->anchor:GRID_DEFAULT_ANCHOR),
-1));
return TCL_OK;
}
- InitMasterData(masterPtr);
- gridPtr = masterPtr->masterDataPtr;
+ InitContainerData(containerPtr);
+ gridPtr = containerPtr->containerDataPtr;
old = gridPtr->anchor;
if (Tk_GetAnchorFromObj(interp, objv[3], &gridPtr->anchor) != TCL_OK) {
return TCL_ERROR;
@@ -466,12 +467,12 @@ GridAnchorCommand(
*/
if (old != gridPtr->anchor) {
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
}
return TCL_OK;
@@ -500,9 +501,9 @@ GridBboxCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr; /* master grid record */
- GridMaster *gridPtr; /* pointer to grid data */
+ Tk_Window container;
+ Gridder *containerPtr; /* container grid record */
+ GridContainer *gridPtr; /* pointer to grid data */
int row, column; /* origin for bounding box */
int row2, column2; /* end of bounding box */
int endX, endY; /* last column/row in the layout */
@@ -514,10 +515,10 @@ GridBboxCommand(
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
if (objc >= 5) {
if (Tcl_GetIntFromObj(interp, objv[3], &column) != TCL_OK) {
@@ -539,13 +540,13 @@ GridBboxCommand(
}
}
- gridPtr = masterPtr->masterDataPtr;
+ gridPtr = containerPtr->containerDataPtr;
if (gridPtr == NULL) {
Tcl_SetObjResult(interp, NewQuadObj(0, 0, 0, 0));
return TCL_OK;
}
- SetGridSize(masterPtr);
+ SetGridSize(containerPtr);
endX = MAX(gridPtr->columnEnd, gridPtr->columnMax);
endY = MAX(gridPtr->rowEnd, gridPtr->rowMax);
@@ -630,67 +631,67 @@ GridForgetRemoveCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window slave;
- Gridder *slavePtr;
+ Tk_Window content;
+ Gridder *contentPtr;
int i;
const char *string = Tcl_GetString(objv[1]);
char c = string[0];
for (i = 2; i < objc; i++) {
- if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr = GetGrid(slave);
- if (slavePtr->masterPtr != NULL) {
+ contentPtr = GetGrid(content);
+ if (contentPtr->containerPtr != NULL) {
/*
* For "forget", reset all the settings to their defaults
*/
if (c == 'f') {
- slavePtr->column = -1;
- slavePtr->row = -1;
- slavePtr->numCols = 1;
- slavePtr->numRows = 1;
- slavePtr->padX = 0;
- slavePtr->padY = 0;
- slavePtr->padLeft = 0;
- slavePtr->padTop = 0;
- slavePtr->iPadX = 0;
- slavePtr->iPadY = 0;
- if (slavePtr->in != NULL) {
- Tcl_DecrRefCount(slavePtr->in);
- slavePtr->in = NULL;
+ contentPtr->column = -1;
+ contentPtr->row = -1;
+ contentPtr->numCols = 1;
+ contentPtr->numRows = 1;
+ contentPtr->padX = 0;
+ contentPtr->padY = 0;
+ contentPtr->padLeft = 0;
+ contentPtr->padTop = 0;
+ contentPtr->iPadX = 0;
+ contentPtr->iPadY = 0;
+ if (contentPtr->in != NULL) {
+ Tcl_DecrRefCount(contentPtr->in);
+ contentPtr->in = NULL;
}
- slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
- if (slavePtr->flags & REQUESTED_RELAYOUT) {
- Tcl_CancelIdleCall(ArrangeGrid, slavePtr);
+ contentPtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
+ if (contentPtr->flags & REQUESTED_RELAYOUT) {
+ Tcl_CancelIdleCall(ArrangeGrid, contentPtr);
}
- slavePtr->flags = 0;
- slavePtr->sticky = 0;
+ contentPtr->flags = 0;
+ contentPtr->sticky = 0;
} else {
/*
- * When removing, store name of master to be able to
- * restore it later, even if the master is recreated.
+ * When removing, store name of container to be able to
+ * restore it later, even if the container is recreated.
*/
- if (slavePtr->in != NULL) {
- Tcl_DecrRefCount(slavePtr->in);
- slavePtr->in = NULL;
+ if (contentPtr->in != NULL) {
+ Tcl_DecrRefCount(contentPtr->in);
+ contentPtr->in = NULL;
}
- if (slavePtr->masterPtr != NULL) {
- slavePtr->in = Tcl_NewStringObj(
- Tk_PathName(slavePtr->masterPtr->tkwin), -1);
- Tcl_IncrRefCount(slavePtr->in);
+ if (contentPtr->containerPtr != NULL) {
+ contentPtr->in = Tcl_NewStringObj(
+ Tk_PathName(contentPtr->containerPtr->tkwin), -1);
+ Tcl_IncrRefCount(contentPtr->in);
}
}
- Tk_ManageGeometry(slave, NULL, NULL);
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
+ Tk_ManageGeometry(content, NULL, NULL);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin,
+ contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
}
return TCL_OK;
@@ -720,40 +721,40 @@ GridInfoCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register Gridder *slavePtr;
- Tk_Window slave;
+ Gridder *contentPtr;
+ Tk_Window content;
Tcl_Obj *infoObj;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr = GetGrid(slave);
- if (slavePtr->masterPtr == NULL) {
+ contentPtr = GetGrid(content);
+ if (contentPtr->containerPtr == NULL) {
Tcl_ResetResult(interp);
return TCL_OK;
}
infoObj = Tcl_NewObj();
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1),
- TkNewWindowObj(slavePtr->masterPtr->tkwin));
+ TkNewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1),
- Tcl_NewIntObj(slavePtr->column));
+ Tcl_NewIntObj(contentPtr->column));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1),
- Tcl_NewIntObj(slavePtr->row));
+ Tcl_NewIntObj(contentPtr->row));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1),
- Tcl_NewIntObj(slavePtr->numCols));
+ Tcl_NewIntObj(contentPtr->numCols));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1),
- Tcl_NewIntObj(slavePtr->numRows));
- TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
- TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY);
- TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft, slavePtr->padX);
- TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY);
+ Tcl_NewIntObj(contentPtr->numRows));
+ TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX);
+ TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY);
+ TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft, contentPtr->padX);
+ TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY);
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", -1),
- StickyToObj(slavePtr->sticky));
+ StickyToObj(contentPtr->sticky));
Tcl_SetObjResult(interp, infoObj);
return TCL_OK;
}
@@ -782,11 +783,11 @@ GridLocationCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr; /* Master grid record. */
- GridMaster *gridPtr; /* Pointer to grid data. */
- register SlotInfo *slotPtr;
- int x, y; /* Offset in pixels, from edge of master. */
+ Tk_Window container;
+ Gridder *containerPtr; /* Container grid record. */
+ GridContainer *gridPtr; /* Pointer to grid data. */
+ SlotInfo *slotPtr;
+ int x, y; /* Offset in pixels, from edge of container. */
int i, j; /* Corresponding column and row indeces. */
int endX, endY; /* End of grid. */
@@ -795,23 +796,23 @@ GridLocationCommand(
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_GetPixelsFromObj(interp, master, objv[3], &x) != TCL_OK) {
+ if (Tk_GetPixelsFromObj(interp, container, objv[3], &x) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_GetPixelsFromObj(interp, master, objv[4], &y) != TCL_OK) {
+ if (Tk_GetPixelsFromObj(interp, container, objv[4], &y) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
- if (masterPtr->masterDataPtr == NULL) {
+ containerPtr = GetGrid(container);
+ if (containerPtr->containerDataPtr == NULL) {
Tcl_SetObjResult(interp, NewPairObj(-1, -1));
return TCL_OK;
}
- gridPtr = masterPtr->masterDataPtr;
+ gridPtr = containerPtr->containerDataPtr;
/*
* Update any pending requests. This is not always the steady state value,
@@ -819,29 +820,29 @@ GridLocationCommand(
* its easy to get.
*/
- while (masterPtr->flags & REQUESTED_RELAYOUT) {
- Tcl_CancelIdleCall(ArrangeGrid, masterPtr);
- ArrangeGrid(masterPtr);
+ while (containerPtr->flags & REQUESTED_RELAYOUT) {
+ Tcl_CancelIdleCall(ArrangeGrid, containerPtr);
+ ArrangeGrid(containerPtr);
}
- SetGridSize(masterPtr);
+ SetGridSize(containerPtr);
endX = MAX(gridPtr->columnEnd, gridPtr->columnMax);
endY = MAX(gridPtr->rowEnd, gridPtr->rowMax);
- slotPtr = masterPtr->masterDataPtr->columnPtr;
- if (x < masterPtr->masterDataPtr->startX) {
+ slotPtr = containerPtr->containerDataPtr->columnPtr;
+ if (x < containerPtr->containerDataPtr->startX) {
i = -1;
} else {
- x -= masterPtr->masterDataPtr->startX;
+ x -= containerPtr->containerDataPtr->startX;
for (i = 0; slotPtr[i].offset < x && i < endX; i++) {
/* null body */
}
}
- slotPtr = masterPtr->masterDataPtr->rowPtr;
- if (y < masterPtr->masterDataPtr->startY) {
+ slotPtr = containerPtr->containerDataPtr->rowPtr;
+ if (y < containerPtr->containerDataPtr->startY) {
j = -1;
} else {
- y -= masterPtr->masterDataPtr->startY;
+ y -= containerPtr->containerDataPtr->startY;
for (j = 0; slotPtr[j].offset < y && j < endY; j++) {
/* null body */
}
@@ -875,8 +876,8 @@ GridPropagateCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
+ Tk_Window container;
+ Gridder *containerPtr;
int propagate, old;
if (objc > 4) {
@@ -884,13 +885,13 @@ GridPropagateCommand(
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
if (objc == 3) {
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE)));
+ Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE)));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) {
@@ -901,39 +902,39 @@ GridPropagateCommand(
* Only request a relayout if the propagation bit changes.
*/
- old = !(masterPtr->flags & DONT_PROPAGATE);
+ old = !(containerPtr->flags & DONT_PROPAGATE);
if (propagate != old) {
if (propagate) {
/*
- * If we have slaves, we need to register as geometry master.
+ * If we have content, we need to register as geometry container.
*/
- if (masterPtr->slavePtr != NULL) {
- if (TkSetGeometryMaster(interp, master, "grid") != TCL_OK) {
+ if (containerPtr->contentPtr != NULL) {
+ if (TkSetGeometryContainer(interp, container, "grid") != TCL_OK) {
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
- masterPtr->flags &= ~DONT_PROPAGATE;
+ containerPtr->flags &= ~DONT_PROPAGATE;
} else {
- if (masterPtr->flags & ALLOCED_MASTER) {
- TkFreeGeometryMaster(master, "grid");
- masterPtr->flags &= ~ALLOCED_MASTER;
+ if (containerPtr->flags & ALLOCED_CONTAINER) {
+ TkFreeGeometryContainer(container, "grid");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
}
- masterPtr->flags |= DONT_PROPAGATE;
+ containerPtr->flags |= DONT_PROPAGATE;
}
/*
- * Re-arrange the master to allow new geometry information to
- * propagate upwards to the master's master.
+ * Re-arrange the container to allow new geometry information to
+ * propagate upwards to the container's container.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
}
return TCL_OK;
@@ -963,8 +964,8 @@ GridRowColumnConfigureCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master, slave;
- Gridder *masterPtr, *slavePtr;
+ Tk_Window container, content;
+ Gridder *containerPtr, *contentPtr;
SlotInfo *slotPtr = NULL;
int slot; /* the column or row number */
int slotType; /* COLUMN or ROW */
@@ -988,7 +989,7 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
@@ -1009,9 +1010,9 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
- first = 0; /* lint */
- last = 0; /* lint */
+ containerPtr = GetGrid(container);
+ first = 0;
+ last = 0;
if ((objc == 4) || (objc == 5)) {
if (lObjc != 1) {
@@ -1029,11 +1030,11 @@ GridRowColumnConfigureCommand(
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
- ok = CheckSlotData(masterPtr, slot, slotType, /* checkOnly */ 1);
+ ok = CheckSlotData(containerPtr, slot, slotType, /* checkOnly */ 1);
if (ok == TCL_OK) {
slotPtr = (slotType == COLUMN) ?
- masterPtr->masterDataPtr->columnPtr :
- masterPtr->masterDataPtr->rowPtr;
+ containerPtr->containerDataPtr->columnPtr :
+ containerPtr->containerDataPtr->rowPtr;
}
/*
@@ -1101,32 +1102,32 @@ GridRowColumnConfigureCommand(
}
for (j = 0; j < lObjc; j++) {
- int allSlaves = 0;
+ int allContent = 0;
if (Tcl_GetIntFromObj(NULL, lObjv[j], &slot) == TCL_OK) {
first = slot;
last = slot;
- slavePtr = NULL;
+ contentPtr = NULL;
} else if (strcmp(Tcl_GetString(lObjv[j]), "all") == 0) {
/*
- * Make sure master is initialised.
+ * Make sure container is initialised.
*/
- InitMasterData(masterPtr);
+ InitContainerData(containerPtr);
- slavePtr = masterPtr->slavePtr;
- if (slavePtr == NULL) {
+ contentPtr = containerPtr->contentPtr;
+ if (contentPtr == NULL) {
continue;
}
- allSlaves = 1;
- } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &slave)
+ allContent = 1;
+ } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &content)
== TCL_OK) {
/*
- * Is it gridded in this master?
+ * Is it gridded in this container?
*/
- slavePtr = GetGrid(slave);
- if (slavePtr->masterPtr != masterPtr) {
+ contentPtr = GetGrid(content);
+ if (contentPtr->containerPtr != containerPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"the window \"%s\" is not managed by \"%s\"",
Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2])));
@@ -1147,15 +1148,15 @@ GridRowColumnConfigureCommand(
*/
do {
- if (slavePtr != NULL) {
+ if (contentPtr != NULL) {
first = (slotType == COLUMN) ?
- slavePtr->column : slavePtr->row;
+ contentPtr->column : contentPtr->row;
last = first - 1 + ((slotType == COLUMN) ?
- slavePtr->numCols : slavePtr->numRows);
+ contentPtr->numCols : contentPtr->numRows);
}
for (slot = first; slot <= last; slot++) {
- ok = CheckSlotData(masterPtr, slot, slotType, /*checkOnly*/ 0);
+ ok = CheckSlotData(containerPtr, slot, slotType, /*checkOnly*/ 0);
if (ok != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"%s\" is out of range",
@@ -1166,8 +1167,8 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
slotPtr = (slotType == COLUMN) ?
- masterPtr->masterDataPtr->columnPtr :
- masterPtr->masterDataPtr->rowPtr;
+ containerPtr->containerDataPtr->columnPtr :
+ containerPtr->containerDataPtr->rowPtr;
/*
* Loop through each option value pair, setting the values as
@@ -1181,7 +1182,7 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
if (index == ROWCOL_MINSIZE) {
- if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
+ if (Tk_GetPixelsFromObj(interp, container, objv[i+1],
&size) != TCL_OK) {
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
@@ -1208,7 +1209,7 @@ GridRowColumnConfigureCommand(
slotPtr[slot].uniform = NULL;
}
} else if (index == ROWCOL_PAD) {
- if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
+ if (Tk_GetPixelsFromObj(interp, container, objv[i+1],
&size) != TCL_OK) {
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
@@ -1221,10 +1222,10 @@ GridRowColumnConfigureCommand(
}
}
}
- if (slavePtr != NULL) {
- slavePtr = slavePtr->nextPtr;
+ if (contentPtr != NULL) {
+ contentPtr = contentPtr->nextPtr;
}
- } while ((allSlaves == 1) && (slavePtr != NULL));
+ } while ((allContent == 1) && (contentPtr != NULL));
}
Tcl_DecrRefCount(listCopy);
@@ -1235,32 +1236,32 @@ GridRowColumnConfigureCommand(
if (slotPtr != NULL) {
if (slotType == ROW) {
- int last = masterPtr->masterDataPtr->rowMax - 1;
+ last = containerPtr->containerDataPtr->rowMax - 1;
while ((last >= 0) && (slotPtr[last].weight == 0)
&& (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
&& (slotPtr[last].uniform == NULL)) {
last--;
}
- masterPtr->masterDataPtr->rowMax = last+1;
+ containerPtr->containerDataPtr->rowMax = last+1;
} else {
- int last = masterPtr->masterDataPtr->columnMax - 1;
+ last = containerPtr->containerDataPtr->columnMax - 1;
while ((last >= 0) && (slotPtr[last].weight == 0)
&& (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
&& (slotPtr[last].uniform == NULL)) {
last--;
}
- masterPtr->masterDataPtr->columnMax = last + 1;
+ containerPtr->containerDataPtr->columnMax = last + 1;
}
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
return TCL_OK;
@@ -1296,23 +1297,23 @@ GridSizeCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
- GridMaster *gridPtr; /* pointer to grid data */
+ Tk_Window container;
+ Gridder *containerPtr;
+ GridContainer *gridPtr; /* pointer to grid data */
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
- if (masterPtr->masterDataPtr != NULL) {
- SetGridSize(masterPtr);
- gridPtr = masterPtr->masterDataPtr;
+ if (containerPtr->containerDataPtr != NULL) {
+ SetGridSize(containerPtr);
+ gridPtr = containerPtr->containerDataPtr;
Tcl_SetObjResult(interp, NewPairObj(
MAX(gridPtr->columnEnd, gridPtr->columnMax),
MAX(gridPtr->rowEnd, gridPtr->rowMax)));
@@ -1325,37 +1326,37 @@ GridSizeCommand(
/*
*----------------------------------------------------------------------
*
- * GridSlavesCommand --
+ * GridContentCommand --
*
- * Implementation of the [grid slaves] subcommand. See the user
+ * Implementation of the [grid content] subcommand. See the user
* documentation for details on what it does.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Places a list of slaves of the specified window in the interpreter's
- * result field.
+ * Places a list of content windows of the specified window in the
+ * interpreter's result field.
*
*----------------------------------------------------------------------
*/
static int
-GridSlavesCommand(
+GridContentCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr; /* master grid record */
- Gridder *slavePtr;
+ Tk_Window container;
+ Gridder *containerPtr; /* container grid record */
+ Gridder *contentPtr;
int i, value, index;
int row = -1, column = -1;
static const char *const optionStrings[] = {
"-column", "-row", NULL
};
- enum options { SLAVES_COLUMN, SLAVES_ROW };
+ enum options { CONTENT_COLUMN, CONTENT_ROW };
Tcl_Obj *res;
if ((objc < 3) || ((objc % 2) == 0)) {
@@ -1377,30 +1378,30 @@ GridSlavesCommand(
Tcl_SetErrorCode(interp, "TK", "GRID", "NEG_INDEX", NULL);
return TCL_ERROR;
}
- if (index == SLAVES_COLUMN) {
+ if (index == CONTENT_COLUMN) {
column = value;
} else {
row = value;
}
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
res = Tcl_NewListObj(0, NULL);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if ((column >= 0) && (slavePtr->column > column
- || slavePtr->column+slavePtr->numCols-1 < column)) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if ((column >= 0) && (contentPtr->column > column
+ || contentPtr->column+contentPtr->numCols-1 < column)) {
continue;
}
- if ((row >= 0) && (slavePtr->row > row ||
- slavePtr->row+slavePtr->numRows-1 < row)) {
+ if ((row >= 0) && (contentPtr->row > row ||
+ contentPtr->row+contentPtr->numRows-1 < row)) {
continue;
}
- Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(slavePtr->tkwin));
+ Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, res);
return TCL_OK;
@@ -1428,12 +1429,12 @@ static void
GridReqProc(
ClientData clientData, /* Grid's 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. */
{
- register Gridder *gridPtr = clientData;
+ Gridder *gridPtr = (Gridder *)clientData;
- gridPtr = gridPtr->masterPtr;
+ gridPtr = gridPtr->containerPtr;
if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
@@ -1443,33 +1444,33 @@ GridReqProc(
/*
*----------------------------------------------------------------------
*
- * GridLostSlaveProc --
+ * GridLostContentProc --
*
* This procedure is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all grid-related information about the slave.
+ * Forgets all grid-related information about the content.
*
*----------------------------------------------------------------------
*/
static void
-GridLostSlaveProc(
- ClientData clientData, /* Grid structure for slave window that was
+GridLostContentProc(
+ ClientData clientData, /* Grid structure for content window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */
{
- register Gridder *slavePtr = clientData;
+ Gridder *contentPtr = (Gridder *)clientData;
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
/*
@@ -1496,9 +1497,9 @@ static int
AdjustOffsets(
int size, /* The total layout size (in pixels). */
int slots, /* Number of slots. */
- register SlotInfo *slotPtr) /* Pointer to slot array. */
+ SlotInfo *slotPtr) /* Pointer to slot array. */
{
- register int slot; /* Current slot. */
+ int slot; /* Current slot. */
int diff; /* Extra pixels needed to add to the layout. */
int totalWeight; /* Sum of the weights for all the slots. */
int weight; /* Sum of the weights so far. */
@@ -1643,12 +1644,12 @@ AdjustOffsets(
*
* AdjustForSticky --
*
- * This procedure adjusts the size of a slave in its cavity based on its
+ * This procedure adjusts the size of a content in its cavity based on its
* "sticky" flags.
*
* Results:
* The input x, y, width, and height are changed to represent the desired
- * coordinates of the slave.
+ * coordinates of the content.
*
* Side effects:
* None.
@@ -1658,29 +1659,29 @@ AdjustOffsets(
static void
AdjustForSticky(
- Gridder *slavePtr, /* Slave window to arrange in its cavity. */
+ Gridder *contentPtr, /* Content window to arrange in its cavity. */
int *xPtr, /* Pixel location of the left edge of the cavity. */
int *yPtr, /* Pixel location of the top edge of the cavity. */
int *widthPtr, /* Width of the cavity (in pixels). */
int *heightPtr) /* Height of the cavity (in pixels). */
{
- int diffx = 0; /* Cavity width - slave width. */
- int diffy = 0; /* Cavity hight - slave height. */
- int sticky = slavePtr->sticky;
+ int diffx = 0; /* Cavity width - content width. */
+ int diffy = 0; /* Cavity hight - content height. */
+ int sticky = contentPtr->sticky;
- *xPtr += slavePtr->padLeft;
- *widthPtr -= slavePtr->padX;
- *yPtr += slavePtr->padTop;
- *heightPtr -= slavePtr->padY;
+ *xPtr += contentPtr->padLeft;
+ *widthPtr -= contentPtr->padX;
+ *yPtr += contentPtr->padTop;
+ *heightPtr -= contentPtr->padY;
- if (*widthPtr > (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX)) {
- diffx = *widthPtr - (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX);
- *widthPtr = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX;
+ if (*widthPtr > (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX)) {
+ diffx = *widthPtr - (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX);
+ *widthPtr = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX;
}
- if (*heightPtr > (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY)) {
- diffy = *heightPtr - (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY);
- *heightPtr = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY;
+ if (*heightPtr > (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY)) {
+ diffy = *heightPtr - (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY);
+ *heightPtr = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY;
}
if (sticky&STICK_EAST && sticky&STICK_WEST) {
@@ -1711,38 +1712,37 @@ AdjustForSticky(
* None.
*
* Side effects:
- * The slaves of masterPtr may get resized or moved.
+ * The content of containerPtr may get resized or moved.
*
*----------------------------------------------------------------------
*/
static void
ArrangeGrid(
- ClientData clientData) /* Structure describing master whose slaves
+ ClientData clientData) /* Structure describing container whose content
* are to be re-layed out. */
{
- register Gridder *masterPtr = clientData;
- register Gridder *slavePtr;
- GridMaster *slotPtr = masterPtr->masterDataPtr;
+ Gridder *containerPtr = (Gridder *)clientData;
+ Gridder *contentPtr;
+ GridContainer *slotPtr = containerPtr->containerDataPtr;
int abort;
int width, height; /* Requested size of layout, in pixels. */
int realWidth, realHeight; /* Actual size layout should take-up. */
int usedX, usedY;
- masterPtr->flags &= ~REQUESTED_RELAYOUT;
+ containerPtr->flags &= ~REQUESTED_RELAYOUT;
/*
- * If the master has no slaves anymore, then don't do anything at all:
- * just leave the master's size as-is. Otherwise there is no way to
- * "relinquish" control over the master so another geometry manager can
- * take over.
+ * If the container has no content anymore, then don't change the container size.
+ * Otherwise there is no way to "relinquish" control over the container
+ * so another geometry manager can take over.
*/
- if (masterPtr->slavePtr == NULL) {
+ if (containerPtr->contentPtr == NULL) {
return;
}
- if (masterPtr->masterDataPtr == NULL) {
+ if (containerPtr->containerDataPtr == NULL) {
return;
}
@@ -1752,128 +1752,127 @@ ArrangeGrid(
* necessary.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- masterPtr->abortPtr = &abort;
+ containerPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(containerPtr);
/*
* Call the constraint engine to fill in the row and column offsets.
*/
- SetGridSize(masterPtr);
- width = ResolveConstraints(masterPtr, COLUMN, 0);
- height = ResolveConstraints(masterPtr, ROW, 0);
- width += Tk_InternalBorderLeft(masterPtr->tkwin) +
- Tk_InternalBorderRight(masterPtr->tkwin);
- height += Tk_InternalBorderTop(masterPtr->tkwin) +
- Tk_InternalBorderBottom(masterPtr->tkwin);
+ SetGridSize(containerPtr);
+ width = ResolveConstraints(containerPtr, COLUMN, 0);
+ height = ResolveConstraints(containerPtr, ROW, 0);
+ width += Tk_InternalBorderLeft(containerPtr->tkwin) +
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ height += Tk_InternalBorderTop(containerPtr->tkwin) +
+ Tk_InternalBorderBottom(containerPtr->tkwin);
- if (width < Tk_MinReqWidth(masterPtr->tkwin)) {
- width = Tk_MinReqWidth(masterPtr->tkwin);
+ if (width < Tk_MinReqWidth(containerPtr->tkwin)) {
+ width = Tk_MinReqWidth(containerPtr->tkwin);
}
- if (height < Tk_MinReqHeight(masterPtr->tkwin)) {
- height = Tk_MinReqHeight(masterPtr->tkwin);
+ if (height < Tk_MinReqHeight(containerPtr->tkwin)) {
+ height = Tk_MinReqHeight(containerPtr->tkwin);
}
- if (((width != Tk_ReqWidth(masterPtr->tkwin))
- || (height != Tk_ReqHeight(masterPtr->tkwin)))
- && !(masterPtr->flags & DONT_PROPAGATE)) {
- Tk_GeometryRequest(masterPtr->tkwin, width, height);
+ if (((width != Tk_ReqWidth(containerPtr->tkwin))
+ || (height != Tk_ReqHeight(containerPtr->tkwin)))
+ && !(containerPtr->flags & DONT_PROPAGATE)) {
+ Tk_GeometryRequest(containerPtr->tkwin, width, height);
if (width>1 && height>1) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
return;
}
/*
- * If the currently requested layout size doesn't match the master's
+ * If the currently requested layout size doesn't match the container's
* window size, then adjust the slot offsets according to the weights. If
* all of the weights are zero, place the layout according to the anchor
* value.
*/
- realWidth = Tk_Width(masterPtr->tkwin) -
- Tk_InternalBorderLeft(masterPtr->tkwin) -
- Tk_InternalBorderRight(masterPtr->tkwin);
- realHeight = Tk_Height(masterPtr->tkwin) -
- Tk_InternalBorderTop(masterPtr->tkwin) -
- Tk_InternalBorderBottom(masterPtr->tkwin);
+ realWidth = Tk_Width(containerPtr->tkwin) -
+ Tk_InternalBorderLeft(containerPtr->tkwin) -
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ realHeight = Tk_Height(containerPtr->tkwin) -
+ Tk_InternalBorderTop(containerPtr->tkwin) -
+ Tk_InternalBorderBottom(containerPtr->tkwin);
usedX = AdjustOffsets(realWidth,
MAX(slotPtr->columnEnd, slotPtr->columnMax), slotPtr->columnPtr);
usedY = AdjustOffsets(realHeight, MAX(slotPtr->rowEnd, slotPtr->rowMax),
slotPtr->rowPtr);
- TkComputeAnchor(masterPtr->masterDataPtr->anchor, masterPtr->tkwin,
+ TkComputeAnchor(containerPtr->containerDataPtr->anchor, containerPtr->tkwin,
0, 0, usedX, usedY, &slotPtr->startX, &slotPtr->startY);
/*
- * Now adjust the actual size of the slave to its cavity by computing the
+ * Now adjust the actual size of the content to its cavity by computing the
* cavity size, and adjusting the widget according to its stickyness.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort;
- slavePtr = slavePtr->nextPtr) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort;
+ contentPtr = contentPtr->nextPtr) {
int x, y; /* Top left coordinate */
- int width, height; /* Slot or slave size */
- int col = slavePtr->column;
- int row = slavePtr->row;
+ int col = contentPtr->column;
+ int row = contentPtr->row;
x = (col>0) ? slotPtr->columnPtr[col-1].offset : 0;
y = (row>0) ? slotPtr->rowPtr[row-1].offset : 0;
- width = slotPtr->columnPtr[slavePtr->numCols+col-1].offset - x;
- height = slotPtr->rowPtr[slavePtr->numRows+row-1].offset - y;
+ width = slotPtr->columnPtr[contentPtr->numCols+col-1].offset - x;
+ height = slotPtr->rowPtr[contentPtr->numRows+row-1].offset - y;
x += slotPtr->startX;
y += slotPtr->startY;
- AdjustForSticky(slavePtr, &x, &y, &width, &height);
+ AdjustForSticky(contentPtr, &x, &y, &width, &height);
/*
* Now put the window in the proper spot. (This was taken directly
- * from tkPack.c.) If the slave is a child of the master, then do this
+ * from tkPack.c.) If the content is a child of the container, then do this
* here. Otherwise let Tk_MaintainGeometry do the work.
*/
- if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
+ if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- if ((x != Tk_X(slavePtr->tkwin))
- || (y != Tk_Y(slavePtr->tkwin))
- || (width != Tk_Width(slavePtr->tkwin))
- || (height != Tk_Height(slavePtr->tkwin))) {
- Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height);
+ if ((x != Tk_X(contentPtr->tkwin))
+ || (y != Tk_Y(contentPtr->tkwin))
+ || (width != Tk_Width(contentPtr->tkwin))
+ || (height != Tk_Height(contentPtr->tkwin))) {
+ Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height);
}
if (abort) {
break;
}
/*
- * Don't map the slave if the master isn't mapped: wait until
- * the master gets mapped later.
+ * Don't map the content if the container isn't mapped: wait until
+ * the container gets mapped later.
*/
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
+ if (Tk_IsMapped(containerPtr->tkwin)) {
+ Tk_MapWindow(contentPtr->tkwin);
}
}
} else if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, x, y,
+ Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y,
width, height);
}
}
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
}
/*
@@ -1891,20 +1890,20 @@ ArrangeGrid(
*
* Side effects:
* The slot offsets are copied into the SlotInfo structure for the
- * geometry master.
+ * geometry container.
*
*----------------------------------------------------------------------
*/
static int
ResolveConstraints(
- Gridder *masterPtr, /* The geometry master for this grid. */
+ Gridder *containerPtr, /* The geometry container for this grid. */
int slotType, /* Either ROW or COLUMN. */
int maxOffset) /* The actual maximum size of this layout in
* pixels, or 0 (not currently used). */
{
- register SlotInfo *slotPtr; /* Pointer to row/col constraints. */
- register Gridder *slavePtr; /* List of slave windows in this grid. */
+ SlotInfo *slotPtr; /* Pointer to row/col constraints. */
+ Gridder *contentPtr; /* List of content windows in this grid. */
int constraintCount; /* Count of rows or columns that have
* constraints. */
int slotCount; /* Last occupied row or column. */
@@ -1913,7 +1912,7 @@ ResolveConstraints(
GridLayout *layoutPtr; /* Temporary layout structure. */
int requiredSize; /* The natural size of the grid (pixels).
* This is the minimum size needed to
- * accommodate all of the slaves at their
+ * accommodate all of the content at their
* requested sizes. */
int offset; /* The pixel offset of the right edge of the
* current slot from the beginning of the
@@ -1930,7 +1929,7 @@ ResolveConstraints(
int uniformGroups; /* Number of currently used uniform groups. */
int uniformGroupsAlloced; /* Size of allocated space for uniform
* groups. */
- int weight, minSize;
+ int minSize;
int prevGrow, accWeight, grow;
/*
@@ -1941,13 +1940,13 @@ ResolveConstraints(
GridLayout layoutData[TYPICAL_SIZE + 1];
if (slotType == COLUMN) {
- constraintCount = masterPtr->masterDataPtr->columnMax;
- slotCount = masterPtr->masterDataPtr->columnEnd;
- slotPtr = masterPtr->masterDataPtr->columnPtr;
+ constraintCount = containerPtr->containerDataPtr->columnMax;
+ slotCount = containerPtr->containerDataPtr->columnEnd;
+ slotPtr = containerPtr->containerDataPtr->columnPtr;
} else {
- constraintCount = masterPtr->masterDataPtr->rowMax;
- slotCount = masterPtr->masterDataPtr->rowEnd;
- slotPtr = masterPtr->masterDataPtr->rowPtr;
+ constraintCount = containerPtr->containerDataPtr->rowMax;
+ slotCount = containerPtr->containerDataPtr->rowEnd;
+ slotPtr = containerPtr->containerDataPtr->rowPtr;
}
/*
@@ -1956,7 +1955,7 @@ ResolveConstraints(
gridCount = MAX(constraintCount, slotCount);
if (gridCount >= TYPICAL_SIZE) {
- layoutPtr = ckalloc(sizeof(GridLayout) * (1+gridCount));
+ layoutPtr = (GridLayout *)ckalloc(sizeof(GridLayout) * (1+gridCount));
} else {
layoutPtr = layoutData;
}
@@ -1997,29 +1996,29 @@ ResolveConstraints(
/*
* Step 2.
- * Slaves with a span of 1 are used to determine the minimum size of each
- * slot. Slaves whose span is two or more slots don't contribute to the
+ * Content with a span of 1 are used to determine the minimum size of each
+ * slot. Content whose span is two or more slots don't contribute to the
* minimum size of each slot directly, but can cause slots to grow if
* their size exceeds the the sizes of the slots they span.
*
- * Bin all slaves whose spans are > 1 by their right edges. This allows
+ * Bin all content whose spans are > 1 by their right edges. This allows
* the computation on minimum and maximum possible layout sizes at each
- * slot boundary, without the need to re-sort the slaves.
+ * slot boundary, without the need to re-sort the content.
*/
switch (slotType) {
case COLUMN:
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- int rightEdge = slavePtr->column + slavePtr->numCols - 1;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ int rightEdge = contentPtr->column + contentPtr->numCols - 1;
- slavePtr->size = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->padX
- + slavePtr->iPadX + slavePtr->doubleBw;
- if (slavePtr->numCols > 1) {
- slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
- layoutPtr[rightEdge].binNextPtr = slavePtr;
+ contentPtr->size = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->padX
+ + contentPtr->iPadX + contentPtr->doubleBw;
+ if (contentPtr->numCols > 1) {
+ contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
+ layoutPtr[rightEdge].binNextPtr = contentPtr;
} else if (rightEdge >= 0) {
- int size = slavePtr->size + layoutPtr[rightEdge].pad;
+ int size = contentPtr->size + layoutPtr[rightEdge].pad;
if (size > layoutPtr[rightEdge].minSize) {
layoutPtr[rightEdge].minSize = size;
@@ -2028,17 +2027,17 @@ ResolveConstraints(
}
break;
case ROW:
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- int rightEdge = slavePtr->row + slavePtr->numRows - 1;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ int rightEdge = contentPtr->row + contentPtr->numRows - 1;
- slavePtr->size = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->padY
- + slavePtr->iPadY + slavePtr->doubleBw;
- if (slavePtr->numRows > 1) {
- slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
- layoutPtr[rightEdge].binNextPtr = slavePtr;
+ contentPtr->size = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->padY
+ + contentPtr->iPadY + contentPtr->doubleBw;
+ if (contentPtr->numRows > 1) {
+ contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
+ layoutPtr[rightEdge].binNextPtr = contentPtr;
} else if (rightEdge >= 0) {
- int size = slavePtr->size + layoutPtr[rightEdge].pad;
+ int size = contentPtr->size + layoutPtr[rightEdge].pad;
if (size > layoutPtr[rightEdge].minSize) {
layoutPtr[rightEdge].minSize = size;
@@ -2059,6 +2058,7 @@ ResolveConstraints(
for (slot = 0; slot < gridCount; slot++) {
if (layoutPtr[slot].uniform != NULL) {
+ int weight;
for (start = 0; start < uniformGroups; start++) {
if (uniformGroupPtr[start].group == layoutPtr[slot].uniform) {
break;
@@ -2078,7 +2078,7 @@ ResolveConstraints(
* sizeof(UniformGroup);
size_t newSize = (uniformGroupsAlloced + UNIFORM_PREALLOC)
* sizeof(UniformGroup);
- UniformGroup *newUG = ckalloc(newSize);
+ UniformGroup *newUG = (UniformGroup *)ckalloc(newSize);
UniformGroup *oldUG = uniformGroupPtr;
memcpy(newUG, oldUG, oldSize);
@@ -2111,7 +2111,7 @@ ResolveConstraints(
for (start = 0; start < uniformGroups; start++) {
if (uniformGroupPtr[start].group ==
layoutPtr[slot].uniform) {
- weight = layoutPtr[slot].weight;
+ int weight = layoutPtr[slot].weight;
weight = weight > 0 ? weight : 1;
layoutPtr[slot].minSize =
uniformGroupPtr[start].minSize * weight;
@@ -2129,16 +2129,16 @@ ResolveConstraints(
/*
* Step 3.
* Determine the minimum slot offsets going from left to right that would
- * fit all of the slaves. This determines the minimum
+ * fit all of the content. This determines the minimum
*/
for (offset=0,slot=0; slot < gridCount; slot++) {
layoutPtr[slot].minOffset = layoutPtr[slot].minSize + offset;
- for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL;
- slavePtr = slavePtr->binNextPtr) {
+ for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL;
+ contentPtr = contentPtr->binNextPtr) {
int span = (slotType == COLUMN) ?
- slavePtr->numCols : slavePtr->numRows;
- int required = slavePtr->size + layoutPtr[slot - span].minOffset;
+ contentPtr->numCols : contentPtr->numRows;
+ int required = contentPtr->size + layoutPtr[slot - span].minOffset;
if (required > layoutPtr[slot].minOffset) {
layoutPtr[slot].minOffset = required;
@@ -2149,7 +2149,7 @@ ResolveConstraints(
/*
* At this point, we know the minimum required size of the entire layout.
- * It might be prudent to stop here if our "master" will resize itself to
+ * It might be prudent to stop here if our "container" will resize itself to
* this size.
*/
@@ -2170,11 +2170,11 @@ ResolveConstraints(
layoutPtr[slot].maxOffset = offset;
}
for (slot=gridCount-1; slot > 0;) {
- for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL;
- slavePtr = slavePtr->binNextPtr) {
+ for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL;
+ contentPtr = contentPtr->binNextPtr) {
int span = (slotType == COLUMN) ?
- slavePtr->numCols : slavePtr->numRows;
- int require = offset - slavePtr->size;
+ contentPtr->numCols : contentPtr->numRows;
+ int require = offset - contentPtr->size;
int startSlot = slot - span;
if (startSlot >=0 && require < layoutPtr[startSlot].maxOffset) {
@@ -2384,7 +2384,7 @@ ResolveConstraints(
/*
* Step 6.
* All of the space has been apportioned; copy the layout information back
- * into the master.
+ * into the container.
*/
for (slot=0; slot < gridCount; slot++) {
@@ -2422,7 +2422,7 @@ GetGrid(
Tk_Window tkwin) /* Token for window for which grid structure
* is desired. */
{
- register Gridder *gridPtr;
+ Gridder *gridPtr;
Tcl_HashEntry *hPtr;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -2439,14 +2439,14 @@ GetGrid(
hPtr = Tcl_CreateHashEntry(&dispPtr->gridHashTable, (char*) tkwin, &isNew);
if (!isNew) {
- return Tcl_GetHashValue(hPtr);
+ return (Gridder *)Tcl_GetHashValue(hPtr);
}
- gridPtr = ckalloc(sizeof(Gridder));
+ gridPtr = (Gridder *)ckalloc(sizeof(Gridder));
gridPtr->tkwin = tkwin;
- gridPtr->masterPtr = NULL;
- gridPtr->masterDataPtr = NULL;
+ gridPtr->containerPtr = NULL;
+ gridPtr->containerDataPtr = NULL;
gridPtr->nextPtr = NULL;
- gridPtr->slavePtr = NULL;
+ gridPtr->contentPtr = NULL;
gridPtr->binNextPtr = NULL;
gridPtr->column = -1;
@@ -2466,7 +2466,7 @@ GetGrid(
gridPtr->sticky = 0;
gridPtr->size = 0;
gridPtr->in = NULL;
- gridPtr->masterDataPtr = NULL;
+ gridPtr->containerDataPtr = NULL;
Tcl_SetHashValue(hPtr, gridPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
GridStructureProc, gridPtr);
@@ -2478,13 +2478,13 @@ GetGrid(
*
* SetGridSize --
*
- * This internal procedure sets the size of the grid occupied by slaves.
+ * This internal procedure sets the size of the grid occupied by content.
*
* Results:
* None
*
* Side effects:
- * The width and height arguments are filled in the master data
+ * The width and height arguments are filled in the container data
* structure. Additional space is allocated for the constraints to
* accommodate the offsets.
*
@@ -2493,50 +2493,50 @@ GetGrid(
static void
SetGridSize(
- Gridder *masterPtr) /* The geometry master for this grid. */
+ Gridder *containerPtr) /* The geometry container for this grid. */
{
- register Gridder *slavePtr; /* Current slave window. */
+ Gridder *contentPtr; /* Current content window. */
int maxX = 0, maxY = 0;
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- maxX = MAX(maxX, slavePtr->numCols + slavePtr->column);
- maxY = MAX(maxY, slavePtr->numRows + slavePtr->row);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ maxX = MAX(maxX, contentPtr->numCols + contentPtr->column);
+ maxY = MAX(maxY, contentPtr->numRows + contentPtr->row);
}
- masterPtr->masterDataPtr->columnEnd = maxX;
- masterPtr->masterDataPtr->rowEnd = maxY;
- CheckSlotData(masterPtr, maxX, COLUMN, CHECK_SPACE);
- CheckSlotData(masterPtr, maxY, ROW, CHECK_SPACE);
+ containerPtr->containerDataPtr->columnEnd = maxX;
+ containerPtr->containerDataPtr->rowEnd = maxY;
+ CheckSlotData(containerPtr, maxX, COLUMN, CHECK_SPACE);
+ CheckSlotData(containerPtr, maxY, ROW, CHECK_SPACE);
}
/*
*----------------------------------------------------------------------
*
- * SetSlaveColumn --
+ * SetContentColumn --
*
- * Update column data for a slave, checking that MAX_ELEMENT bound
+ * Update column data for a content, checking that MAX_ELEMENT bound
* is not passed.
*
* Results:
* TCL_ERROR if out of bounds, TCL_OK otherwise
*
* Side effects:
- * Slave fields are updated.
+ * Content fields are updated.
*
*----------------------------------------------------------------------
*/
static int
-SetSlaveColumn(
+SetContentColumn(
Tcl_Interp *interp, /* Interp for error message. */
- Gridder *slavePtr, /* Slave to be updated. */
+ Gridder *contentPtr, /* Content to be updated. */
int column, /* New column or -1 to be unchanged. */
int numCols) /* New columnspan or -1 to be unchanged. */
{
int newColumn, newNumCols, lastCol;
- newColumn = (column >= 0) ? column : slavePtr->column;
- newNumCols = (numCols >= 1) ? numCols : slavePtr->numCols;
+ newColumn = (column >= 0) ? column : contentPtr->column;
+ newNumCols = (numCols >= 1) ? numCols : contentPtr->numCols;
lastCol = ((newColumn >= 0) ? newColumn : 0) + newNumCols;
if (lastCol >= MAX_ELEMENT) {
@@ -2545,39 +2545,39 @@ SetSlaveColumn(
return TCL_ERROR;
}
- slavePtr->column = newColumn;
- slavePtr->numCols = newNumCols;
+ contentPtr->column = newColumn;
+ contentPtr->numCols = newNumCols;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * SetSlaveRow --
+ * SetContentRow --
*
- * Update row data for a slave, checking that MAX_ELEMENT bound
+ * Update row data for a content, checking that MAX_ELEMENT bound
* is not passed.
*
* Results:
* TCL_ERROR if out of bounds, TCL_OK otherwise
*
* Side effects:
- * Slave fields are updated.
+ * Content fields are updated.
*
*----------------------------------------------------------------------
*/
static int
-SetSlaveRow(
+SetContentRow(
Tcl_Interp *interp, /* Interp for error message. */
- Gridder *slavePtr, /* Slave to be updated. */
+ Gridder *contentPtr, /* Content to be updated. */
int row, /* New row or -1 to be unchanged. */
int numRows) /* New rowspan or -1 to be unchanged. */
{
int newRow, newNumRows, lastRow;
- newRow = (row >= 0) ? row : slavePtr->row;
- newNumRows = (numRows >= 1) ? numRows : slavePtr->numRows;
+ newRow = (row >= 0) ? row : contentPtr->row;
+ newNumRows = (numRows >= 1) ? numRows : contentPtr->numRows;
lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows;
if (lastRow >= MAX_ELEMENT) {
@@ -2586,8 +2586,8 @@ SetSlaveRow(
return TCL_ERROR;
}
- slavePtr->row = newRow;
- slavePtr->numRows = newNumRows;
+ contentPtr->row = newRow;
+ contentPtr->numRows = newNumRows;
return TCL_OK;
}
@@ -2603,7 +2603,7 @@ SetSlaveRow(
* TRUE if the index is OK, False otherwise.
*
* Side effects:
- * A new master grid structure may be created. If so, then it is
+ * A new container grid structure may be created. If so, then it is
* initialized. In addition, additional storage for a row or column
* constraints may be allocated, and the constraint maximums are
* adjusted.
@@ -2613,7 +2613,7 @@ SetSlaveRow(
static int
CheckSlotData(
- Gridder *masterPtr, /* The geometry master for this grid. */
+ Gridder *containerPtr, /* The geometry container for this grid. */
int slot, /* Which slot to look at. */
int slotType, /* ROW or COLUMN. */
int checkOnly) /* Don't allocate new space if true. */
@@ -2629,7 +2629,7 @@ CheckSlotData(
return TCL_ERROR;
}
- if ((checkOnly == CHECK_ONLY) && (masterPtr->masterDataPtr == NULL)) {
+ if ((checkOnly == CHECK_ONLY) && (containerPtr->containerDataPtr == NULL)) {
return TCL_ERROR;
}
@@ -2639,39 +2639,39 @@ CheckSlotData(
* of the offsets as well.
*/
- InitMasterData(masterPtr);
- end = (slotType == ROW) ? masterPtr->masterDataPtr->rowMax :
- masterPtr->masterDataPtr->columnMax;
+ InitContainerData(containerPtr);
+ end = (slotType == ROW) ? containerPtr->containerDataPtr->rowMax :
+ containerPtr->containerDataPtr->columnMax;
if (checkOnly == CHECK_ONLY) {
return ((end < slot) ? TCL_ERROR : TCL_OK);
} else {
- numSlot = (slotType == ROW) ? masterPtr->masterDataPtr->rowSpace
- : masterPtr->masterDataPtr->columnSpace;
+ numSlot = (slotType == ROW) ? containerPtr->containerDataPtr->rowSpace
+ : containerPtr->containerDataPtr->columnSpace;
if (slot >= numSlot) {
int newNumSlot = slot + PREALLOC;
size_t oldSize = numSlot * sizeof(SlotInfo);
size_t newSize = newNumSlot * sizeof(SlotInfo);
- SlotInfo *newSI = ckalloc(newSize);
+ SlotInfo *newSI = (SlotInfo *)ckalloc(newSize);
SlotInfo *oldSI = (slotType == ROW)
- ? masterPtr->masterDataPtr->rowPtr
- : masterPtr->masterDataPtr->columnPtr;
+ ? containerPtr->containerDataPtr->rowPtr
+ : containerPtr->containerDataPtr->columnPtr;
memcpy(newSI, oldSI, oldSize);
memset(newSI+numSlot, 0, newSize - oldSize);
ckfree(oldSI);
if (slotType == ROW) {
- masterPtr->masterDataPtr->rowPtr = newSI;
- masterPtr->masterDataPtr->rowSpace = newNumSlot;
+ containerPtr->containerDataPtr->rowPtr = newSI;
+ containerPtr->containerDataPtr->rowSpace = newNumSlot;
} else {
- masterPtr->masterDataPtr->columnPtr = newSI;
- masterPtr->masterDataPtr->columnSpace = newNumSlot;
+ containerPtr->containerDataPtr->columnPtr = newSI;
+ containerPtr->containerDataPtr->columnSpace = newNumSlot;
}
}
if (slot >= end && checkOnly != CHECK_SPACE) {
if (slotType == ROW) {
- masterPtr->masterDataPtr->rowMax = slot+1;
+ containerPtr->containerDataPtr->rowMax = slot+1;
} else {
- masterPtr->masterDataPtr->columnMax = slot+1;
+ containerPtr->containerDataPtr->columnMax = slot+1;
}
}
return TCL_OK;
@@ -2681,37 +2681,37 @@ CheckSlotData(
/*
*----------------------------------------------------------------------
*
- * InitMasterData --
+ * InitContainerData --
*
* This internal procedure is used to allocate and initialize the data
- * for a geometry master, if the data doesn't exist already.
+ * for a geometry container, if the data doesn't exist already.
*
* Results:
* none
*
* Side effects:
- * A new master grid structure may be created. If so, then it is
+ * A new container grid structure may be created. If so, then it is
* initialized.
*
*----------------------------------------------------------------------
*/
static void
-InitMasterData(
- Gridder *masterPtr)
+InitContainerData(
+ Gridder *containerPtr)
{
- if (masterPtr->masterDataPtr == NULL) {
- GridMaster *gridPtr = masterPtr->masterDataPtr =
- ckalloc(sizeof(GridMaster));
+ if (containerPtr->containerDataPtr == NULL) {
+ GridContainer *gridPtr = containerPtr->containerDataPtr = (GridContainer *)
+ ckalloc(sizeof(GridContainer));
size_t size = sizeof(SlotInfo) * TYPICAL_SIZE;
gridPtr->columnEnd = 0;
gridPtr->columnMax = 0;
- gridPtr->columnPtr = ckalloc(size);
+ gridPtr->columnPtr = (SlotInfo *)ckalloc(size);
gridPtr->columnSpace = TYPICAL_SIZE;
gridPtr->rowEnd = 0;
gridPtr->rowMax = 0;
- gridPtr->rowPtr = ckalloc(size);
+ gridPtr->rowPtr = (SlotInfo *)ckalloc(size);
gridPtr->rowSpace = TYPICAL_SIZE;
gridPtr->startX = 0;
gridPtr->startY = 0;
@@ -2727,13 +2727,13 @@ InitMasterData(
*
* Unlink --
*
- * Remove a grid from its master's list of slaves.
+ * Remove a grid from its container's list of content.
*
* Results:
* None.
*
* Side effects:
- * The master will be scheduled for re-arranging, and the size of the
+ * The container will be scheduled for re-arranging, and the size of the
* grid will be adjusted accordingly
*
*----------------------------------------------------------------------
@@ -2741,47 +2741,47 @@ InitMasterData(
static void
Unlink(
- register Gridder *slavePtr) /* Window to unlink. */
+ Gridder *contentPtr) /* Window to unlink. */
{
- register Gridder *masterPtr, *slavePtr2;
+ Gridder *containerPtr, *contentPtr2;
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = contentPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (masterPtr->slavePtr == slavePtr) {
- masterPtr->slavePtr = slavePtr->nextPtr;
+ if (containerPtr->contentPtr == contentPtr) {
+ containerPtr->contentPtr = contentPtr->nextPtr;
} else {
- for (slavePtr2=masterPtr->slavePtr ; ; slavePtr2=slavePtr2->nextPtr) {
- if (slavePtr2 == NULL) {
+ for (contentPtr2=containerPtr->contentPtr ; ; contentPtr2=contentPtr2->nextPtr) {
+ if (contentPtr2 == NULL) {
Tcl_Panic("Unlink couldn't find previous window");
}
- if (slavePtr2->nextPtr == slavePtr) {
- slavePtr2->nextPtr = slavePtr->nextPtr;
+ if (contentPtr2->nextPtr == contentPtr) {
+ contentPtr2->nextPtr = contentPtr->nextPtr;
break;
}
}
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- SetGridSize(slavePtr->masterPtr);
- slavePtr->masterPtr = NULL;
+ SetGridSize(contentPtr->containerPtr);
+ contentPtr->containerPtr = NULL;
/*
- * If we have emptied this master from slaves it means we are no longer
+ * If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
*/
- if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) {
- TkFreeGeometryMaster(masterPtr->tkwin, "grid");
- masterPtr->flags &= ~ALLOCED_MASTER;
+ if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) {
+ TkFreeGeometryContainer(containerPtr->tkwin, "grid");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
}
}
@@ -2793,7 +2793,7 @@ Unlink(
* This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to
* clean up the internal structure of a grid at a safe time (when no-one
* is using it anymore). Cleaning up the grid involves freeing the main
- * structure for all windows and the master structure for geometry
+ * structure for all windows and the container structure for geometry
* managers.
*
* Results:
@@ -2809,16 +2809,16 @@ static void
DestroyGrid(
void *memPtr) /* Info about window that is now dead. */
{
- register Gridder *gridPtr = memPtr;
+ Gridder *gridPtr = (Gridder *)memPtr;
- if (gridPtr->masterDataPtr != NULL) {
- if (gridPtr->masterDataPtr->rowPtr != NULL) {
- ckfree(gridPtr->masterDataPtr -> rowPtr);
+ if (gridPtr->containerDataPtr != NULL) {
+ if (gridPtr->containerDataPtr->rowPtr != NULL) {
+ ckfree(gridPtr->containerDataPtr -> rowPtr);
}
- if (gridPtr->masterDataPtr->columnPtr != NULL) {
- ckfree(gridPtr->masterDataPtr -> columnPtr);
+ if (gridPtr->containerDataPtr->columnPtr != NULL) {
+ ckfree(gridPtr->containerDataPtr -> columnPtr);
}
- ckfree(gridPtr->masterDataPtr);
+ ckfree(gridPtr->containerDataPtr);
}
if (gridPtr->in != NULL) {
Tcl_DecrRefCount(gridPtr->in);
@@ -2839,7 +2839,7 @@ DestroyGrid(
*
* Side effects:
* If a window was just deleted, clean up all its grid-related
- * information. If it was just resized, re-configure its slaves, if any.
+ * information. If it was just resized, re-configure its content, if any.
*
*----------------------------------------------------------------------
*/
@@ -2850,56 +2850,56 @@ GridStructureProc(
* eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- register Gridder *gridPtr = clientData;
+ Gridder *gridPtr = (Gridder *)clientData;
TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr;
if (eventPtr->type == ConfigureNotify) {
- if ((gridPtr->slavePtr != NULL)
+ if ((gridPtr->contentPtr != NULL)
&& !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
}
- if ((gridPtr->masterPtr != NULL) &&
+ if ((gridPtr->containerPtr != NULL) &&
(gridPtr->doubleBw != 2*Tk_Changes(gridPtr->tkwin)->border_width)) {
- if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) {
+ if (!(gridPtr->containerPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width;
- gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, gridPtr->masterPtr);
+ gridPtr->containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, gridPtr->containerPtr);
}
}
} else if (eventPtr->type == DestroyNotify) {
- register Gridder *slavePtr, *nextPtr;
+ Gridder *contentPtr, *nextPtr;
- if (gridPtr->masterPtr != NULL) {
+ if (gridPtr->containerPtr != NULL) {
Unlink(gridPtr);
}
- for (slavePtr = gridPtr->slavePtr; slavePtr != NULL;
- slavePtr = nextPtr) {
- Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL);
- Tk_UnmapWindow(slavePtr->tkwin);
- slavePtr->masterPtr = NULL;
- nextPtr = slavePtr->nextPtr;
- slavePtr->nextPtr = NULL;
+ for (contentPtr = gridPtr->contentPtr; contentPtr != NULL;
+ contentPtr = nextPtr) {
+ Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL);
+ Tk_UnmapWindow(contentPtr->tkwin);
+ contentPtr->containerPtr = NULL;
+ nextPtr = contentPtr->nextPtr;
+ contentPtr->nextPtr = NULL;
}
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable,
- (char *) gridPtr->tkwin));
+ (char *)gridPtr->tkwin));
if (gridPtr->flags & REQUESTED_RELAYOUT) {
Tcl_CancelIdleCall(ArrangeGrid, gridPtr);
}
gridPtr->tkwin = NULL;
Tcl_EventuallyFree(gridPtr, (Tcl_FreeProc *)DestroyGrid);
} else if (eventPtr->type == MapNotify) {
- if ((gridPtr->slavePtr != NULL)
+ if ((gridPtr->contentPtr != NULL)
&& !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
}
} else if (eventPtr->type == UnmapNotify) {
- register Gridder *slavePtr;
+ Gridder *contentPtr;
- for (slavePtr = gridPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ for (contentPtr = gridPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ Tk_UnmapWindow(contentPtr->tkwin);
}
}
}
@@ -2907,11 +2907,11 @@ GridStructureProc(
/*
*----------------------------------------------------------------------
*
- * ConfigureSlaves --
+ * ConfigureContent --
*
* This implements the guts of the "grid configure" command. Given a list
- * of slaves and configuration options, it arranges for the grid to
- * manage the slaves and sets the specified options. Arguments consist
+ * of content and configuration options, it arranges for the grid to
+ * manage the content and sets the specified options. Arguments consist
* of windows or window shortcuts followed by "-option value" pairs.
*
* Results:
@@ -2919,26 +2919,26 @@ GridStructureProc(
* and the interp's result is set to contain an error message.
*
* Side effects:
- * Slave windows get taken over by the grid.
+ * Content windows get taken over by the grid.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(
+ConfigureContent(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Tk_Window tkwin, /* Any window in application containing
- * slaves. Used to look up slave names. */
+ * content. Used to look up content names. */
int objc, /* Number of elements in argv. */
Tcl_Obj *const objv[]) /* Argument objects: contains one or more
* window names followed by any number of
* "option value" pairs. Caller must make sure
* that there is at least one window name. */
{
- Gridder *masterPtr = NULL;
- Gridder *slavePtr;
- Tk_Window other, slave, parent, ancestor;
- TkWindow *master;
+ Gridder *containerPtr = NULL;
+ Gridder *contentPtr;
+ Tk_Window other, content, parent, ancestor;
+ TkWindow *container;
int i, j, tmp;
int numWindows;
int width;
@@ -2974,34 +2974,34 @@ ConfigureSlaves(
if (firstChar == '.') {
/*
- * Check that windows are valid, and locate the first slave's
+ * Check that windows are valid, and locate the first content's
* parent window (default for -in).
*/
- if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) {
return TCL_ERROR;
}
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
/*
- * Is there any saved -in from a removed slave?
+ * Is there any saved -in from a removed content?
* If there is, it becomes default for -in.
- * If the stored master does not exist, just ignore it.
+ * If the stored container does not exist, just ignore it.
*/
- struct Gridder *slavePtr = GetGrid(slave);
- if (slavePtr->in != NULL) {
- if (TkGetWindowFromObj(interp, slave, slavePtr->in, &parent)
+ contentPtr = GetGrid(content);
+ if (contentPtr->in != NULL) {
+ if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent)
== TCL_OK) {
- masterPtr = GetGrid(parent);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(parent);
+ InitContainerData(containerPtr);
}
}
}
- if (masterPtr == NULL) {
- parent = Tk_Parent(slave);
+ if (containerPtr == NULL) {
+ parent = Tk_Parent(content);
if (parent != NULL) {
- masterPtr = GetGrid(parent);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(parent);
+ InitContainerData(containerPtr);
}
}
numWindows++;
@@ -3069,8 +3069,8 @@ ConfigureSlaves(
TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(other);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(other);
+ InitContainerData(containerPtr);
} else if (index == CONF_ROW) {
if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK
|| tmp < 0) {
@@ -3086,23 +3086,23 @@ ConfigureSlaves(
/*
* If no -row is given, use the next row after the highest occupied row
- * of the master.
+ * of the container.
*/
if (defaultRow < 0) {
- if (masterPtr != NULL && masterPtr->masterDataPtr != NULL) {
- SetGridSize(masterPtr);
- defaultRow = masterPtr->masterDataPtr->rowEnd;
+ if (containerPtr != NULL && containerPtr->containerDataPtr != NULL) {
+ SetGridSize(containerPtr);
+ defaultRow = containerPtr->containerDataPtr->rowEnd;
} else {
defaultRow = 0;
}
}
/*
- * Iterate over all of the slave windows and short-cuts, parsing options
- * for each slave. It's a bit wasteful to re-parse the options for each
- * slave, but things get too messy if we try to parse the arguments just
- * once at the beginning. For example, if a slave already is managed we
+ * Iterate over all of the content windows and short-cuts, parsing options
+ * for each content. It's a bit wasteful to re-parse the options for each
+ * content, but things get too messy if we try to parse the arguments just
+ * once at the beginning. For example, if a content already is managed we
* want to just change a few existing values without resetting everything.
* If there are multiple windows, the -in option only gets processed for
* the first window.
@@ -3115,7 +3115,7 @@ ConfigureSlaves(
/*
* '^' and 'x' cause us to skip a column. '-' is processed as part of
- * its preceeding slave.
+ * its preceeding content.
*/
if ((firstChar == REL_VERT) || (firstChar == REL_SKIP)) {
@@ -3128,34 +3128,34 @@ ConfigureSlaves(
for (defaultColumnSpan = 1; j + defaultColumnSpan < numWindows;
defaultColumnSpan++) {
- const char *string = Tcl_GetString(objv[j + defaultColumnSpan]);
+ string = Tcl_GetString(objv[j + defaultColumnSpan]);
if (*string != REL_HORIZ) {
break;
}
}
- if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_TopWinHierarchy(slave)) {
+ if (Tk_TopWinHierarchy(content)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't manage \"%s\": it's a top-level window",
Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL);
return TCL_ERROR;
}
- slavePtr = GetGrid(slave);
+ contentPtr = GetGrid(content);
/*
* The following statement is taken from tkPack.c:
*
- * "If the slave isn't currently managed, reset all of its
+ * "If the content isn't currently managed, reset all of its
* configuration information to default values (there could be old
* values left from a previous packer)."
*
- * I [D.S.] disagree with this statement. If a slave is disabled
+ * I [D.S.] disagree with this statement. If a content is disabled
* (using "forget") and then re-enabled, I submit that 90% of the time
* the programmer will want it to retain its old configuration
* information. If the programmer doesn't want this behavior, then the
@@ -3176,7 +3176,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL);
return TCL_ERROR;
}
- if (SetSlaveColumn(interp, slavePtr, tmp, -1) != TCL_OK) {
+ if (SetContentColumn(interp, contentPtr, tmp, -1) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3189,7 +3189,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL);
return TCL_ERROR;
}
- if (SetSlaveColumn(interp, slavePtr, -1, tmp) != TCL_OK) {
+ if (SetContentColumn(interp, contentPtr, -1, tmp) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3198,15 +3198,15 @@ ConfigureSlaves(
&other) != TCL_OK) {
return TCL_ERROR;
}
- if (other == slave) {
+ if (other == content) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"window can't be managed in itself", -1));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL);
return TCL_ERROR;
}
positionGiven = 1;
- masterPtr = GetGrid(other);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(other);
+ InitContainerData(containerPtr);
break;
case CONF_STICKY: {
int sticky = StringToSticky(Tcl_GetString(objv[i+1]));
@@ -3219,11 +3219,11 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", NULL);
return TCL_ERROR;
}
- slavePtr->sticky = sticky;
+ contentPtr->sticky = sticky;
break;
}
case CONF_IPADX:
- if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1],
+ if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1],
&tmp) != TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipadx value \"%s\": must be positive screen distance",
@@ -3231,10 +3231,10 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadX = tmp * 2;
+ contentPtr->iPadX = tmp * 2;
break;
case CONF_IPADY:
- if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1],
+ if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1],
&tmp) != TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipady value \"%s\": must be positive screen distance",
@@ -3242,17 +3242,17 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadY = tmp * 2;
+ contentPtr->iPadY = tmp * 2;
break;
case CONF_PADX:
if (TkParsePadAmount(interp, tkwin, objv[i+1],
- &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) {
+ &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) {
return TCL_ERROR;
}
break;
case CONF_PADY:
if (TkParsePadAmount(interp, tkwin, objv[i+1],
- &slavePtr->padTop, &slavePtr->padY) != TCL_OK) {
+ &contentPtr->padTop, &contentPtr->padY) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3265,7 +3265,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL);
return TCL_ERROR;
}
- if (SetSlaveRow(interp, slavePtr, tmp, -1) != TCL_OK) {
+ if (SetContentRow(interp, contentPtr, tmp, -1) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3278,7 +3278,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL);
return TCL_ERROR;
}
- if (SetSlaveRow(interp, slavePtr, -1, tmp) != TCL_OK) {
+ if (SetContentRow(interp, contentPtr, -1, tmp) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3286,12 +3286,12 @@ ConfigureSlaves(
}
/*
- * If no position was specified via -in and the slave is already
+ * If no position was specified via -in and the content is already
* packed, then leave it in its current location.
*/
- if (!positionGiven && (slavePtr->masterPtr != NULL)) {
- masterPtr = slavePtr->masterPtr;
+ if (!positionGiven && (contentPtr->containerPtr != NULL)) {
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
@@ -3300,54 +3300,54 @@ ConfigureSlaves(
* its current location.
*/
- if (positionGiven && (masterPtr == slavePtr->masterPtr)) {
+ if (positionGiven && (containerPtr == contentPtr->containerPtr)) {
goto scheduleLayout;
}
/*
- * Make sure we have a geometry master. We look at:
+ * Make sure we have a geometry container. We look at:
* 1) the -in flag
- * 2) the parent of the first slave.
+ * 2) the parent of the first content.
*/
- parent = Tk_Parent(slave);
- if (masterPtr == NULL) {
- masterPtr = GetGrid(parent);
- InitMasterData(masterPtr);
+ parent = Tk_Parent(content);
+ if (containerPtr == NULL) {
+ containerPtr = GetGrid(parent);
+ InitContainerData(containerPtr);
}
- if (slavePtr->masterPtr != NULL && slavePtr->masterPtr != masterPtr) {
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr != NULL && contentPtr->containerPtr != containerPtr) {
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- slavePtr->masterPtr = NULL;
+ Unlink(contentPtr);
+ contentPtr->containerPtr = NULL;
}
- if (slavePtr->masterPtr == NULL) {
- Gridder *tempPtr = masterPtr->slavePtr;
+ if (contentPtr->containerPtr == NULL) {
+ Gridder *tempPtr = containerPtr->contentPtr;
- slavePtr->masterPtr = masterPtr;
- masterPtr->slavePtr = slavePtr;
- slavePtr->nextPtr = tempPtr;
+ contentPtr->containerPtr = containerPtr;
+ containerPtr->contentPtr = contentPtr;
+ contentPtr->nextPtr = tempPtr;
}
/*
- * Make sure that the slave's parent is either the master or an
- * ancestor of the master, and that the master and slave aren't the
+ * Make sure that the content's parent is either the container or an
+ * ancestor of the container, and that the container and content aren't the
* same.
*/
- for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't put %s inside %s", Tcl_GetString(objv[j]),
- Tk_PathName(masterPtr->tkwin)));
+ Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
- Unlink(slavePtr);
+ Unlink(contentPtr);
return TCL_ERROR;
}
}
@@ -3356,65 +3356,65 @@ ConfigureSlaves(
* Check for management loops.
*/
- for (master = (TkWindow *)masterPtr->tkwin; master != NULL;
- master = (TkWindow *)TkGetGeomMaster(master)) {
- if (master == (TkWindow *)slave) {
+ for (container = (TkWindow *)containerPtr->tkwin; container != NULL;
+ container = (TkWindow *)TkGetContainer(container)) {
+ if (container == (TkWindow *)content) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't put %s inside %s, would cause management loop",
- Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin)));
+ Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
- Unlink(slavePtr);
+ Unlink(contentPtr);
return TCL_ERROR;
}
}
- if (masterPtr->tkwin != Tk_Parent(slave)) {
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin;
+ if (containerPtr->tkwin != Tk_Parent(content)) {
+ ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin;
}
- Tk_ManageGeometry(slave, &gridMgrType, slavePtr);
+ Tk_ManageGeometry(content, &gridMgrType, contentPtr);
- if (!(masterPtr->flags & DONT_PROPAGATE)) {
- if (TkSetGeometryMaster(interp, masterPtr->tkwin, "grid")
+ if (!(containerPtr->flags & DONT_PROPAGATE)) {
+ if (TkSetGeometryContainer(interp, containerPtr->tkwin, "grid")
!= TCL_OK) {
- Tk_ManageGeometry(slave, NULL, NULL);
- Unlink(slavePtr);
+ Tk_ManageGeometry(content, NULL, NULL);
+ Unlink(contentPtr);
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
/*
* Assign default position information.
*/
- if (slavePtr->column == -1) {
- if (SetSlaveColumn(interp, slavePtr, defaultColumn,-1) != TCL_OK){
+ if (contentPtr->column == -1) {
+ if (SetContentColumn(interp, contentPtr, defaultColumn,-1) != TCL_OK){
return TCL_ERROR;
}
}
- if (SetSlaveColumn(interp, slavePtr, -1,
- slavePtr->numCols + defaultColumnSpan - 1) != TCL_OK) {
+ if (SetContentColumn(interp, contentPtr, -1,
+ contentPtr->numCols + defaultColumnSpan - 1) != TCL_OK) {
return TCL_ERROR;
}
- if (slavePtr->row == -1) {
- if (SetSlaveRow(interp, slavePtr, defaultRow, -1) != TCL_OK) {
+ if (contentPtr->row == -1) {
+ if (SetContentRow(interp, contentPtr, defaultRow, -1) != TCL_OK) {
return TCL_ERROR;
}
}
- defaultColumn += slavePtr->numCols;
+ defaultColumn += contentPtr->numCols;
defaultColumnSpan = 1;
/*
- * Arrange for the master to be re-arranged at the first idle moment.
+ * Arrange for the container to be re-arranged at the first idle moment.
*/
scheduleLayout:
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
}
@@ -3430,9 +3430,9 @@ ConfigureSlaves(
int lastRow, lastColumn; /* Implied end of table. */
string = Tcl_GetString(objv[j]);
- firstChar = string[0];
+ firstChar = string[0];
- if (firstChar == '.') {
+ if (firstChar == '.') {
lastWindow = string;
numSkip = 0;
}
@@ -3443,7 +3443,7 @@ ConfigureSlaves(
continue;
}
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't use '^', cant find master", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
@@ -3455,7 +3455,7 @@ ConfigureSlaves(
*/
for (width = 1; width + j < numWindows; width++) {
- const char *string = Tcl_GetString(objv[j+width]);
+ string = Tcl_GetString(objv[j+width]);
if (*string != REL_VERT) {
break;
@@ -3479,19 +3479,19 @@ ConfigureSlaves(
lastColumn += numSkip;
match = 0;
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
- if (slavePtr->column == lastColumn
- && slavePtr->row + slavePtr->numRows - 1 == lastRow) {
- if (slavePtr->numCols <= width) {
- if (SetSlaveRow(interp, slavePtr, -1,
- slavePtr->numRows + 1) != TCL_OK) {
+ if (contentPtr->column == lastColumn
+ && contentPtr->row + contentPtr->numRows - 1 == lastRow) {
+ if (contentPtr->numCols <= width) {
+ if (SetContentRow(interp, contentPtr, -1,
+ contentPtr->numRows + 1) != TCL_OK) {
return TCL_ERROR;
}
match++;
- j += slavePtr->numCols - 1;
- lastWindow = Tk_PathName(slavePtr->tkwin);
+ j += contentPtr->numCols - 1;
+ lastWindow = Tk_PathName(contentPtr->tkwin);
numSkip = 0;
break;
}
@@ -3505,22 +3505,22 @@ ConfigureSlaves(
}
}
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't determine master window", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
- SetGridSize(masterPtr);
+ SetGridSize(containerPtr);
/*
- * If we have emptied this master from slaves it means we are no longer
+ * If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
*/
- if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) {
- TkFreeGeometryMaster(masterPtr->tkwin, "grid");
- masterPtr->flags &= ~ALLOCED_MASTER;
+ if (containerPtr->contentPtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) {
+ TkFreeGeometryContainer(containerPtr->tkwin, "grid");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
}
return TCL_OK;
diff --git a/generic/tkImage.c b/generic/tkImage.c
index dc4e8e06..d42ed7db 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -26,8 +26,8 @@ typedef struct Image {
Display *display; /* Display for tkwin. Needed because when the
* image is eventually freed tkwin may not
* exist anymore. */
- struct ImageMaster *masterPtr;
- /* Master for this image (identifiers image
+ struct ImageModel *modelPtr;
+ /* Model for this image (identifiers image
* manager, for example). */
ClientData instanceData; /* One word argument to pass to image manager
* when dealing with this image instance. */
@@ -40,17 +40,17 @@ typedef struct Image {
} Image;
/*
- * For each image master there is one of the following structures, which
+ * For each image model there is one of the following structures, which
* represents a name in the image table and all of the images instantiated
* from it. Entries in mainPtr->imageTable point to these structures.
*/
-typedef struct ImageMaster {
+typedef struct ImageModel {
Tk_ImageType *typePtr; /* Information about image type. NULL means
* that no image manager owns this image: the
* image was deleted. */
- ClientData masterData; /* One-word argument to pass to image mgr when
- * dealing with the master, as opposed to
+ ClientData modelData; /* One-word argument to pass to image mgr when
+ * dealing with the model, as opposed to
* instances. */
int width, height; /* Last known dimensions for image. */
Tcl_HashTable *tablePtr; /* Pointer to hash table containing image (the
@@ -64,7 +64,7 @@ typedef struct ImageMaster {
int deleted; /* Flag set when image is being deleted. */
TkWindow *winPtr; /* Main window of interpreter (used to detect
* when the world is falling apart.) */
-} ImageMaster;
+} ImageModel;
typedef struct {
Tk_ImageType *imageTypeList;/* First in a list of all known image
@@ -82,8 +82,8 @@ static Tcl_ThreadDataKey dataKey;
*/
static void ImageTypeThreadExitProc(ClientData clientData);
-static void DeleteImage(ImageMaster *masterPtr);
-static void EventuallyDeleteImage(ImageMaster *masterPtr,
+static void DeleteImage(ImageModel *modelPtr);
+static void EventuallyDeleteImage(ImageModel *modelPtr,
int forgetImageHashNow);
/*
@@ -104,10 +104,10 @@ static void EventuallyDeleteImage(ImageMaster *masterPtr,
static void
ImageTypeThreadExitProc(
- ClientData clientData) /* not used */
+ TCL_UNUSED(void *))
{
Tk_ImageType *freePtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
while (tsdPtr->oldImageTypeList != NULL) {
@@ -149,14 +149,14 @@ Tk_CreateOldImageType(
* by caller. */
{
Tk_ImageType *copyPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);
}
- copyPtr = ckalloc(sizeof(Tk_ImageType));
+ copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType));
*copyPtr = *typePtr;
copyPtr->nextPtr = tsdPtr->oldImageTypeList;
tsdPtr->oldImageTypeList = copyPtr;
@@ -170,14 +170,14 @@ Tk_CreateImageType(
* by caller. */
{
Tk_ImageType *copyPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);
}
- copyPtr = ckalloc(sizeof(Tk_ImageType));
+ copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType));
*copyPtr = *typePtr;
copyPtr->nextPtr = tsdPtr->imageTypeList;
tsdPtr->imageTypeList = copyPtr;
@@ -215,10 +215,10 @@ Tk_ImageObjCmd(
IMAGE_CREATE, IMAGE_DELETE, IMAGE_HEIGHT, IMAGE_INUSE, IMAGE_NAMES,
IMAGE_TYPE, IMAGE_TYPES, IMAGE_WIDTH
};
- TkWindow *winPtr = clientData;
+ TkWindow *winPtr = (TkWindow *)clientData;
int i, isNew, firstOption, index;
Tk_ImageType *typePtr;
- ImageMaster *masterPtr;
+ ImageModel *modelPtr;
Image *imagePtr;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
@@ -226,7 +226,7 @@ Tk_ImageObjCmd(
TkDisplay *dispPtr = winPtr->dispPtr;
const char *arg, *name;
Tcl_Obj *resultObj;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (objc < 2) {
@@ -297,7 +297,7 @@ Tk_ImageObjCmd(
/*
* Need to check if the _command_ that we are about to create is
- * the name of the current master widget command (normally "." but
+ * the name of the current model widget command (normally "." but
* could have been renamed) and fail in that case before a really
* nasty and hard to stop crash happens.
*/
@@ -318,37 +318,37 @@ Tk_ImageObjCmd(
hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew);
if (isNew) {
- masterPtr = ckalloc(sizeof(ImageMaster));
- masterPtr->typePtr = NULL;
- masterPtr->masterData = NULL;
- masterPtr->width = masterPtr->height = 1;
- masterPtr->tablePtr = &winPtr->mainPtr->imageTable;
- masterPtr->hPtr = hPtr;
- masterPtr->instancePtr = NULL;
- masterPtr->deleted = 0;
- masterPtr->winPtr = winPtr->mainPtr->winPtr;
- Tcl_Preserve(masterPtr->winPtr);
- Tcl_SetHashValue(hPtr, masterPtr);
+ modelPtr = (ImageModel *)ckalloc(sizeof(ImageModel));
+ modelPtr->typePtr = NULL;
+ modelPtr->modelData = NULL;
+ modelPtr->width = modelPtr->height = 1;
+ modelPtr->tablePtr = &winPtr->mainPtr->imageTable;
+ modelPtr->hPtr = hPtr;
+ modelPtr->instancePtr = NULL;
+ modelPtr->deleted = 0;
+ modelPtr->winPtr = winPtr->mainPtr->winPtr;
+ Tcl_Preserve(modelPtr->winPtr);
+ Tcl_SetHashValue(hPtr, modelPtr);
} else {
/*
* An image already exists by this name. Disconnect the instances
- * from the master.
+ * from the model.
*/
- masterPtr = Tcl_GetHashValue(hPtr);
- if (masterPtr->typePtr != NULL) {
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->typePtr != NULL) {
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
- masterPtr->typePtr->freeProc(imagePtr->instanceData,
+ modelPtr->typePtr->freeProc(imagePtr->instanceData,
imagePtr->display);
imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
- masterPtr->width, masterPtr->height,
- masterPtr->width, masterPtr->height);
+ modelPtr->width, modelPtr->height,
+ modelPtr->width, modelPtr->height);
}
- masterPtr->typePtr->deleteProc(masterPtr->masterData);
- masterPtr->typePtr = NULL;
+ modelPtr->typePtr->deleteProc(modelPtr->modelData);
+ modelPtr->typePtr = NULL;
}
- masterPtr->deleted = 0;
+ modelPtr->deleted = 0;
}
/*
@@ -361,36 +361,34 @@ Tk_ImageObjCmd(
objc -= firstOption;
args = (Tcl_Obj **) objv;
if (oldimage) {
- int i;
-
- args = ckalloc((objc+1) * sizeof(char *));
+ args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *));
for (i = 0; i < objc; i++) {
args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]);
}
args[objc] = NULL;
}
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(modelPtr);
if (typePtr->createProc(interp, name, objc, args, typePtr,
- (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK){
- EventuallyDeleteImage(masterPtr, 0);
- Tcl_Release(masterPtr);
+ (Tk_ImageModel)modelPtr, &modelPtr->modelData) != TCL_OK){
+ EventuallyDeleteImage(modelPtr, 0);
+ Tcl_Release(modelPtr);
if (oldimage) {
ckfree(args);
}
return TCL_ERROR;
}
- Tcl_Release(masterPtr);
+ Tcl_Release(modelPtr);
if (oldimage) {
ckfree(args);
}
- masterPtr->typePtr = typePtr;
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ modelPtr->typePtr = typePtr;
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
imagePtr->instanceData = typePtr->getProc(imagePtr->tkwin,
- masterPtr->masterData);
+ modelPtr->modelData);
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1));
+ (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1));
break;
}
case IMAGE_DELETE:
@@ -400,11 +398,11 @@ Tk_ImageObjCmd(
if (hPtr == NULL) {
goto alreadyDeleted;
}
- masterPtr = Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
goto alreadyDeleted;
}
- DeleteImage(masterPtr);
+ DeleteImage(modelPtr);
}
break;
case IMAGE_NAMES:
@@ -415,12 +413,12 @@ Tk_ImageObjCmd(
hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search);
resultObj = Tcl_NewObj();
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- masterPtr = Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
continue;
}
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1));
+ (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1));
}
Tcl_SetObjResult(interp, resultObj);
break;
@@ -449,7 +447,7 @@ Tk_ImageObjCmd(
case IMAGE_WIDTH:
/*
* These operations all parse virtually identically. First check to
- * see if three args are given. Then get a non-deleted master from the
+ * see if three args are given. Then get a non-deleted model from the
* third arg.
*/
@@ -463,8 +461,8 @@ Tk_ImageObjCmd(
if (hPtr == NULL) {
goto alreadyDeleted;
}
- masterPtr = Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
goto alreadyDeleted;
}
@@ -474,20 +472,20 @@ Tk_ImageObjCmd(
switch ((enum options) index) {
case IMAGE_HEIGHT:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(masterPtr->height));
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(modelPtr->height));
break;
case IMAGE_INUSE:
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- masterPtr->typePtr && masterPtr->instancePtr));
+ modelPtr->typePtr && modelPtr->instancePtr));
break;
case IMAGE_TYPE:
- if (masterPtr->typePtr != NULL) {
+ if (modelPtr->typePtr != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(masterPtr->typePtr->name, -1));
+ Tcl_NewStringObj(modelPtr->typePtr->name, -1));
}
break;
case IMAGE_WIDTH:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(masterPtr->width));
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(modelPtr->width));
break;
default:
Tcl_Panic("can't happen");
@@ -523,7 +521,7 @@ Tk_ImageObjCmd(
void
Tk_ImageChanged(
- Tk_ImageMaster imageMaster, /* Image that needs redisplay. */
+ Tk_ImageModel imageModel, /* Image that needs redisplay. */
int x, int y, /* Coordinates of upper-left pixel of region
* of image that needs to be redrawn. */
int width, int height, /* Dimensions (in pixels) of region of image
@@ -534,12 +532,12 @@ Tk_ImageChanged(
int imageWidth, int imageHeight)
/* New dimensions of image. */
{
- ImageMaster *masterPtr = (ImageMaster *) imageMaster;
+ ImageModel *modelPtr = (ImageModel *) imageModel;
Image *imagePtr;
- masterPtr->width = imageWidth;
- masterPtr->height = imageHeight;
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ modelPtr->width = imageWidth;
+ modelPtr->height = imageHeight;
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
imagePtr->changeProc(imagePtr->widgetClientData, x, y, width, height,
imageWidth, imageHeight);
@@ -551,11 +549,11 @@ Tk_ImageChanged(
*
* Tk_NameOfImage --
*
- * Given a token for an image master, this function returns the name of
+ * Given a token for an image model, this function returns the name of
* the image.
*
* Results:
- * The return value is the string name for imageMaster.
+ * The return value is the string name for imageModel.
*
* Side effects:
* None.
@@ -565,14 +563,14 @@ Tk_ImageChanged(
const char *
Tk_NameOfImage(
- Tk_ImageMaster imageMaster) /* Token for image. */
+ Tk_ImageModel imageModel) /* Token for image. */
{
- ImageMaster *masterPtr = (ImageMaster *) imageMaster;
+ ImageModel *modelPtr = (ImageModel *) imageModel;
- if (masterPtr->hPtr == NULL) {
+ if (modelPtr->hPtr == NULL) {
return NULL;
}
- return Tcl_GetHashKey(masterPtr->tablePtr, masterPtr->hPtr);
+ return (const char *)Tcl_GetHashKey(modelPtr->tablePtr, modelPtr->hPtr);
}
/*
@@ -610,30 +608,30 @@ Tk_GetImage(
ClientData clientData) /* One-word argument to pass to damageProc. */
{
Tcl_HashEntry *hPtr;
- ImageMaster *masterPtr;
+ ImageModel *modelPtr;
Image *imagePtr;
hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->imageTable, name);
if (hPtr == NULL) {
goto noSuchImage;
}
- masterPtr = Tcl_GetHashValue(hPtr);
- if (masterPtr->typePtr == NULL) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->typePtr == NULL) {
goto noSuchImage;
}
- if (masterPtr->deleted) {
+ if (modelPtr->deleted) {
goto noSuchImage;
}
- imagePtr = ckalloc(sizeof(Image));
+ imagePtr = (Image *)ckalloc(sizeof(Image));
imagePtr->tkwin = tkwin;
imagePtr->display = Tk_Display(tkwin);
- imagePtr->masterPtr = masterPtr;
+ imagePtr->modelPtr = modelPtr;
imagePtr->instanceData =
- masterPtr->typePtr->getProc(tkwin, masterPtr->masterData);
+ modelPtr->typePtr->getProc(tkwin, modelPtr->modelData);
imagePtr->changeProc = changeProc;
imagePtr->widgetClientData = clientData;
- imagePtr->nextPtr = masterPtr->instancePtr;
- masterPtr->instancePtr = imagePtr;
+ imagePtr->nextPtr = modelPtr->instancePtr;
+ modelPtr->instancePtr = imagePtr;
return (Tk_Image) imagePtr;
noSuchImage:
@@ -669,20 +667,20 @@ Tk_FreeImage(
* a widget. */
{
Image *imagePtr = (Image *) image;
- ImageMaster *masterPtr = imagePtr->masterPtr;
+ ImageModel *modelPtr = imagePtr->modelPtr;
Image *prevPtr;
/*
* Clean up the particular instance.
*/
- if (masterPtr->typePtr != NULL) {
- masterPtr->typePtr->freeProc(imagePtr->instanceData,
+ if (modelPtr->typePtr != NULL) {
+ modelPtr->typePtr->freeProc(imagePtr->instanceData,
imagePtr->display);
}
- prevPtr = masterPtr->instancePtr;
+ prevPtr = modelPtr->instancePtr;
if (prevPtr == imagePtr) {
- masterPtr->instancePtr = imagePtr->nextPtr;
+ modelPtr->instancePtr = imagePtr->nextPtr;
} else {
while (prevPtr->nextPtr != imagePtr) {
prevPtr = prevPtr->nextPtr;
@@ -692,16 +690,16 @@ Tk_FreeImage(
ckfree(imagePtr);
/*
- * If there are no more instances left for the master, and if the master
- * image has been deleted, then delete the master too.
+ * If there are no more instances left for the model, and if the model
+ * image has been deleted, then delete the model too.
*/
- if ((masterPtr->typePtr == NULL) && (masterPtr->instancePtr == NULL)) {
- if (masterPtr->hPtr != NULL) {
- Tcl_DeleteHashEntry(masterPtr->hPtr);
+ if ((modelPtr->typePtr == NULL) && (modelPtr->instancePtr == NULL)) {
+ if (modelPtr->hPtr != NULL) {
+ Tcl_DeleteHashEntry(modelPtr->hPtr);
}
- Tcl_Release(masterPtr->winPtr);
- ckfree(masterPtr);
+ Tcl_Release(modelPtr->winPtr);
+ ckfree(modelPtr);
}
}
@@ -741,9 +739,9 @@ Tk_PostscriptImage(
GC newGC;
XGCValues gcValues;
- if (imagePtr->masterPtr->typePtr == NULL) {
+ if (imagePtr->modelPtr->typePtr == NULL) {
/*
- * No master for image, so nothing to display on postscript.
+ * No model for image, so nothing to display on postscript.
*/
return TCL_OK;
@@ -754,9 +752,9 @@ Tk_PostscriptImage(
* otherwise go on with generic code.
*/
- if (imagePtr->masterPtr->typePtr->postscriptProc != NULL) {
- return imagePtr->masterPtr->typePtr->postscriptProc(
- imagePtr->masterPtr->masterData, interp, tkwin, psinfo,
+ if (imagePtr->modelPtr->typePtr->postscriptProc != NULL) {
+ return imagePtr->modelPtr->typePtr->postscriptProc(
+ imagePtr->modelPtr->modelData, interp, tkwin, psinfo,
x, y, width, height, prepass);
}
@@ -837,9 +835,9 @@ Tk_RedrawImage(
{
Image *imagePtr = (Image *) image;
- if (imagePtr->masterPtr->typePtr == NULL) {
+ if (imagePtr->modelPtr->typePtr == NULL) {
/*
- * No master for image, so nothing to display.
+ * No model for image, so nothing to display.
*/
return;
@@ -859,13 +857,13 @@ Tk_RedrawImage(
drawableY -= imageY;
imageY = 0;
}
- if ((imageX + width) > imagePtr->masterPtr->width) {
- width = imagePtr->masterPtr->width - imageX;
+ if ((imageX + width) > imagePtr->modelPtr->width) {
+ width = imagePtr->modelPtr->width - imageX;
}
- if ((imageY + height) > imagePtr->masterPtr->height) {
- height = imagePtr->masterPtr->height - imageY;
+ if ((imageY + height) > imagePtr->modelPtr->height) {
+ height = imagePtr->modelPtr->height - imageY;
}
- imagePtr->masterPtr->typePtr->displayProc(imagePtr->instanceData,
+ imagePtr->modelPtr->typePtr->displayProc(imagePtr->instanceData,
imagePtr->display, drawable, imageX, imageY, width, height,
drawableX, drawableY);
}
@@ -895,8 +893,8 @@ Tk_SizeOfImage(
{
Image *imagePtr = (Image *) image;
- *widthPtr = imagePtr->masterPtr->width;
- *heightPtr = imagePtr->masterPtr->height;
+ *widthPtr = imagePtr->modelPtr->width;
+ *heightPtr = imagePtr->modelPtr->height;
}
/*
@@ -933,7 +931,7 @@ Tk_DeleteImage(
if (hPtr == NULL) {
return;
}
- DeleteImage(Tcl_GetHashValue(hPtr));
+ DeleteImage((ImageModel *)Tcl_GetHashValue(hPtr));
}
/*
@@ -948,7 +946,7 @@ Tk_DeleteImage(
*
* Side effects:
* The connection is dropped between instances of this image and an image
- * master. Image instances will redisplay themselves as empty areas, but
+ * model. Image instances will redisplay themselves as empty areas, but
* existing instances will not be deleted.
*
*----------------------------------------------------------------------
@@ -956,31 +954,31 @@ Tk_DeleteImage(
static void
DeleteImage(
- ImageMaster *masterPtr) /* Pointer to main data structure for image. */
+ ImageModel *modelPtr) /* Pointer to main data structure for image. */
{
Image *imagePtr;
Tk_ImageType *typePtr;
- typePtr = masterPtr->typePtr;
- masterPtr->typePtr = NULL;
+ typePtr = modelPtr->typePtr;
+ modelPtr->typePtr = NULL;
if (typePtr != NULL) {
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
typePtr->freeProc(imagePtr->instanceData, imagePtr->display);
imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
- masterPtr->width, masterPtr->height, masterPtr->width,
- masterPtr->height);
+ modelPtr->width, modelPtr->height, modelPtr->width,
+ modelPtr->height);
}
- typePtr->deleteProc(masterPtr->masterData);
+ typePtr->deleteProc(modelPtr->modelData);
}
- if (masterPtr->instancePtr == NULL) {
- if (masterPtr->hPtr != NULL) {
- Tcl_DeleteHashEntry(masterPtr->hPtr);
+ if (modelPtr->instancePtr == NULL) {
+ if (modelPtr->hPtr != NULL) {
+ Tcl_DeleteHashEntry(modelPtr->hPtr);
}
- Tcl_Release(masterPtr->winPtr);
- ckfree(masterPtr);
+ Tcl_Release(modelPtr->winPtr);
+ ckfree(modelPtr);
} else {
- masterPtr->deleted = 1;
+ modelPtr->deleted = 1;
}
}
@@ -1004,16 +1002,16 @@ DeleteImage(
static void
EventuallyDeleteImage(
- ImageMaster *masterPtr, /* Pointer to main data structure for image. */
+ ImageModel *modelPtr, /* Pointer to main data structure for image. */
int forgetImageHashNow) /* Flag to say whether the hash table is about
* to vanish. */
{
if (forgetImageHashNow) {
- masterPtr->hPtr = NULL;
+ modelPtr->hPtr = NULL;
}
- if (!masterPtr->deleted) {
- masterPtr->deleted = 1;
- Tcl_EventuallyFree(masterPtr, (Tcl_FreeProc *) DeleteImage);
+ if (!modelPtr->deleted) {
+ modelPtr->deleted = 1;
+ Tcl_EventuallyFree(modelPtr, (Tcl_FreeProc *) DeleteImage);
}
}
@@ -1045,7 +1043,7 @@ TkDeleteAllImages(
for (hPtr = Tcl_FirstHashEntry(&mainPtr->imageTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- EventuallyDeleteImage(Tcl_GetHashValue(hPtr), 1);
+ EventuallyDeleteImage((ImageModel *)Tcl_GetHashValue(hPtr), 1);
}
Tcl_DeleteHashTable(&mainPtr->imageTable);
}
@@ -1053,10 +1051,10 @@ TkDeleteAllImages(
/*
*----------------------------------------------------------------------
*
- * Tk_GetImageMasterData --
+ * Tk_GetImageModelData --
*
* Given the name of an image, this function returns the type of the
- * image and the clientData associated with its master.
+ * image and the clientData associated with its model.
*
* Results:
* If there is no image by the given name, then NULL is returned and a
@@ -1071,7 +1069,7 @@ TkDeleteAllImages(
*/
ClientData
-Tk_GetImageMasterData(
+Tk_GetImageModelData(
Tcl_Interp *interp, /* Interpreter in which the image was
* created. */
const char *name, /* Name of image. */
@@ -1081,20 +1079,20 @@ Tk_GetImageMasterData(
{
TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp);
Tcl_HashEntry *hPtr;
- ImageMaster *masterPtr;
+ ImageModel *modelPtr;
hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name);
if (hPtr == NULL) {
*typePtrPtr = NULL;
return NULL;
}
- masterPtr = Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
*typePtrPtr = NULL;
return NULL;
}
- *typePtrPtr = masterPtr->typePtr;
- return masterPtr->masterData;
+ *typePtrPtr = modelPtr->typePtr;
+ return modelPtr->modelData;
}
/*
@@ -1118,7 +1116,6 @@ Tk_GetImageMasterData(
*----------------------------------------------------------------------
*/
-/*ARGSUSED*/
void
Tk_SetTSOrigin(
Tk_Window tkwin,
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index f4ee4070..04027b0d 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -14,12 +14,12 @@
#include "tkInt.h"
/*
- * The following data structure represents the master for a bitmap
+ * The following data structure represents the model for a bitmap
* image:
*/
-typedef struct BitmapMaster {
- Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the
+typedef struct BitmapModel {
+ Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the
* image is being deleted. */
Tcl_Interp *interp; /* Interpreter for application that is using
* image. */
@@ -40,8 +40,8 @@ typedef struct BitmapMaster {
char *maskDataString; /* Value of -maskdata option (malloc'ed). */
struct BitmapInstance *instancePtr;
/* First in list of all instances associated
- * with this master. */
-} BitmapMaster;
+ * with this model. */
+} BitmapModel;
/*
* The following data structure represents all of the instances of an image
@@ -51,7 +51,7 @@ typedef struct BitmapMaster {
typedef struct BitmapInstance {
int refCount; /* Number of instances that share this data
* structure. */
- BitmapMaster *masterPtr; /* Pointer to master for image. */
+ BitmapModel *modelPtr; /* Pointer to model for image. */
Tk_Window tkwin; /* Window in which the instances will be
* displayed. */
XColor *fg; /* Foreground color for displaying image. */
@@ -65,7 +65,7 @@ typedef struct BitmapInstance {
* displayed. */
struct BitmapInstance *nextPtr;
/* Next in list of all instance structures
- * associated with masterPtr (NULL means end
+ * associated with modelPtr (NULL means end
* of list). */
} BitmapInstance;
@@ -76,7 +76,7 @@ typedef struct BitmapInstance {
static int GetByte(Tcl_Channel chan);
static int ImgBmapCreate(Tcl_Interp *interp,
const char *name, int argc, Tcl_Obj *const objv[],
- const Tk_ImageType *typePtr, Tk_ImageMaster master,
+ const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData);
static void ImgBmapDisplay(ClientData clientData,
@@ -108,17 +108,17 @@ Tk_ImageType tkBitmapImageType = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_UID, "-background", NULL, NULL,
- "", Tk_Offset(BitmapMaster, bgUid), 0, NULL},
+ "", Tk_Offset(BitmapModel, bgUid), 0, NULL},
{TK_CONFIG_STRING, "-data", NULL, NULL,
- NULL, Tk_Offset(BitmapMaster, dataString), TK_CONFIG_NULL_OK, NULL},
+ NULL, Tk_Offset(BitmapModel, dataString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_STRING, "-file", NULL, NULL,
- NULL, Tk_Offset(BitmapMaster, fileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, Tk_Offset(BitmapModel, fileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_UID, "-foreground", NULL, NULL,
- "#000000", Tk_Offset(BitmapMaster, fgUid), 0, NULL},
+ "#000000", Tk_Offset(BitmapModel, fgUid), 0, NULL},
{TK_CONFIG_STRING, "-maskdata", NULL, NULL,
- NULL, Tk_Offset(BitmapMaster, maskDataString), TK_CONFIG_NULL_OK, NULL},
+ NULL, Tk_Offset(BitmapModel, maskDataString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_STRING, "-maskfile", NULL, NULL,
- NULL, Tk_Offset(BitmapMaster, maskFileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, Tk_Offset(BitmapModel, maskFileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -149,7 +149,7 @@ static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp,
int argc, Tcl_Obj *const objv[]);
static void ImgBmapCmdDeletedProc(ClientData clientData);
static void ImgBmapConfigureInstance(BitmapInstance *instancePtr);
-static int ImgBmapConfigureMaster(BitmapMaster *masterPtr,
+static int ImgBmapConfigureModel(BitmapModel *modelPtr,
int argc, Tcl_Obj *const objv[], int flags);
static int NextBitmapWord(ParseInfo *parseInfoPtr);
@@ -179,39 +179,39 @@ ImgBmapCreate(
Tcl_Obj *const argv[], /* Argument objects for options (doesn't
* include image name or type). */
const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- BitmapMaster *masterPtr = ckalloc(sizeof(BitmapMaster));
+ BitmapModel *modelPtr = ckalloc(sizeof(BitmapModel));
- masterPtr->tkMaster = master;
- masterPtr->interp = interp;
- masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd,
- masterPtr, ImgBmapCmdDeletedProc);
- masterPtr->width = masterPtr->height = 0;
- masterPtr->data = NULL;
- masterPtr->maskData = NULL;
- masterPtr->fgUid = NULL;
- masterPtr->bgUid = NULL;
- masterPtr->fileString = NULL;
- masterPtr->dataString = NULL;
- masterPtr->maskFileString = NULL;
- masterPtr->maskDataString = NULL;
- masterPtr->instancePtr = NULL;
- if (ImgBmapConfigureMaster(masterPtr, argc, argv, 0) != TCL_OK) {
- ImgBmapDelete(masterPtr);
+ modelPtr->tkModel = model;
+ modelPtr->interp = interp;
+ modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd,
+ modelPtr, ImgBmapCmdDeletedProc);
+ modelPtr->width = modelPtr->height = 0;
+ modelPtr->data = NULL;
+ modelPtr->maskData = NULL;
+ modelPtr->fgUid = NULL;
+ modelPtr->bgUid = NULL;
+ modelPtr->fileString = NULL;
+ modelPtr->dataString = NULL;
+ modelPtr->maskFileString = NULL;
+ modelPtr->maskDataString = NULL;
+ modelPtr->instancePtr = NULL;
+ if (ImgBmapConfigureModel(modelPtr, argc, argv, 0) != TCL_OK) {
+ ImgBmapDelete(modelPtr);
return TCL_ERROR;
}
- *clientDataPtr = masterPtr;
+ *clientDataPtr = modelPtr;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * ImgBmapConfigureMaster --
+ * ImgBmapConfigureModel --
*
* This procedure is called when a bitmap image is created or
* reconfigured. It process configuration options and resets any
@@ -219,7 +219,7 @@ ImgBmapCreate(
*
* Results:
* A standard Tcl return value. If TCL_ERROR is returned then an error
- * message is left in the masterPtr->interp's result.
+ * message is left in the modelPtr->interp's result.
*
* Side effects:
* Existing instances of the image will be redisplayed to match the new
@@ -229,8 +229,8 @@ ImgBmapCreate(
*/
static int
-ImgBmapConfigureMaster(
- BitmapMaster *masterPtr, /* Pointer to data structure describing
+ImgBmapConfigureModel(
+ BitmapModel *modelPtr, /* Pointer to data structure describing
* overall bitmap image to (reconfigure). */
int objc, /* Number of entries in objv. */
Tcl_Obj *const objv[], /* Pairs of configuration options for image. */
@@ -246,8 +246,8 @@ ImgBmapConfigureMaster(
}
argv[objc] = NULL;
- if (Tk_ConfigureWidget(masterPtr->interp, Tk_MainWindow(masterPtr->interp),
- configSpecs, objc, argv, (char *) masterPtr, flags) != TCL_OK) {
+ if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp),
+ configSpecs, objc, argv, (char *) modelPtr, flags) != TCL_OK) {
ckfree(argv);
return TCL_ERROR;
}
@@ -258,44 +258,44 @@ ImgBmapConfigureMaster(
* bitmap and mask have the same dimensions.
*/
- if (masterPtr->data != NULL) {
- ckfree(masterPtr->data);
- masterPtr->data = NULL;
+ if (modelPtr->data != NULL) {
+ ckfree(modelPtr->data);
+ modelPtr->data = NULL;
}
- if ((masterPtr->fileString != NULL) || (masterPtr->dataString != NULL)) {
- masterPtr->data = TkGetBitmapData(masterPtr->interp,
- masterPtr->dataString, masterPtr->fileString,
- &masterPtr->width, &masterPtr->height, &dummy1, &dummy2);
- if (masterPtr->data == NULL) {
+ if ((modelPtr->fileString != NULL) || (modelPtr->dataString != NULL)) {
+ modelPtr->data = TkGetBitmapData(modelPtr->interp,
+ modelPtr->dataString, modelPtr->fileString,
+ &modelPtr->width, &modelPtr->height, &dummy1, &dummy2);
+ if (modelPtr->data == NULL) {
return TCL_ERROR;
}
}
- if (masterPtr->maskData != NULL) {
- ckfree(masterPtr->maskData);
- masterPtr->maskData = NULL;
+ if (modelPtr->maskData != NULL) {
+ ckfree(modelPtr->maskData);
+ modelPtr->maskData = NULL;
}
- if ((masterPtr->maskFileString != NULL)
- || (masterPtr->maskDataString != NULL)) {
- if (masterPtr->data == NULL) {
- Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj(
+ if ((modelPtr->maskFileString != NULL)
+ || (modelPtr->maskDataString != NULL)) {
+ if (modelPtr->data == NULL) {
+ Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj(
"can't have mask without bitmap", -1));
- Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP",
+ Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP",
"NO_BITMAP", NULL);
return TCL_ERROR;
}
- masterPtr->maskData = TkGetBitmapData(masterPtr->interp,
- masterPtr->maskDataString, masterPtr->maskFileString,
+ modelPtr->maskData = TkGetBitmapData(modelPtr->interp,
+ modelPtr->maskDataString, modelPtr->maskFileString,
&maskWidth, &maskHeight, &dummy1, &dummy2);
- if (masterPtr->maskData == NULL) {
+ if (modelPtr->maskData == NULL) {
return TCL_ERROR;
}
- if ((maskWidth != masterPtr->width)
- || (maskHeight != masterPtr->height)) {
- ckfree(masterPtr->maskData);
- masterPtr->maskData = NULL;
- Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj(
+ if ((maskWidth != modelPtr->width)
+ || (maskHeight != modelPtr->height)) {
+ ckfree(modelPtr->maskData);
+ modelPtr->maskData = NULL;
+ Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj(
"bitmap and mask have different sizes", -1));
- Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP",
+ Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP",
"MASK_SIZE", NULL);
return TCL_ERROR;
}
@@ -307,12 +307,12 @@ ImgBmapConfigureMaster(
* everywhere that it is used.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
ImgBmapConfigureInstance(instancePtr);
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
return TCL_OK;
}
@@ -322,8 +322,8 @@ ImgBmapConfigureMaster(
* ImgBmapConfigureInstance --
*
* This procedure is called to create displaying information for a bitmap
- * image instance based on the configuration information in the master.
- * It is invoked both when new instances are created and when the master
+ * image instance based on the configuration information in the model.
+ * It is invoked both when new instances are created and when the model
* is reconfigured.
*
* Results:
@@ -340,7 +340,7 @@ static void
ImgBmapConfigureInstance(
BitmapInstance *instancePtr)/* Instance to reconfigure. */
{
- BitmapMaster *masterPtr = instancePtr->masterPtr;
+ BitmapModel *modelPtr = instancePtr->modelPtr;
XColor *colorPtr;
XGCValues gcValues;
GC gc;
@@ -348,13 +348,13 @@ ImgBmapConfigureInstance(
Pixmap oldBitmap, oldMask;
/*
- * For each of the options in masterPtr, translate the string form into an
+ * For each of the options in modelPtr, translate the string form into an
* internal form appropriate for instancePtr.
*/
- if (*masterPtr->bgUid != 0) {
- colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin,
- masterPtr->bgUid);
+ if (*modelPtr->bgUid != 0) {
+ colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin,
+ modelPtr->bgUid);
if (colorPtr == NULL) {
goto error;
}
@@ -366,8 +366,8 @@ ImgBmapConfigureInstance(
}
instancePtr->bg = colorPtr;
- colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin,
- masterPtr->fgUid);
+ colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin,
+ modelPtr->fgUid);
if (colorPtr == NULL) {
goto error;
}
@@ -388,19 +388,19 @@ ImgBmapConfigureInstance(
oldMask = instancePtr->mask;
instancePtr->mask = None;
- if (masterPtr->data != NULL) {
+ if (modelPtr->data != NULL) {
instancePtr->bitmap = XCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
- masterPtr->data, (unsigned) masterPtr->width,
- (unsigned) masterPtr->height);
+ modelPtr->data, (unsigned) modelPtr->width,
+ (unsigned) modelPtr->height);
}
- if (masterPtr->maskData != NULL) {
+ if (modelPtr->maskData != NULL) {
instancePtr->mask = XCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
- masterPtr->maskData, (unsigned) masterPtr->width,
- (unsigned) masterPtr->height);
+ modelPtr->maskData, (unsigned) modelPtr->width,
+ (unsigned) modelPtr->height);
}
if (oldMask != None) {
@@ -410,7 +410,7 @@ ImgBmapConfigureInstance(
Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap);
}
- if (masterPtr->data != NULL) {
+ if (modelPtr->data != NULL) {
gcValues.foreground = instancePtr->fg->pixel;
gcValues.graphics_exposures = False;
mask = GCForeground|GCGraphicsExposures;
@@ -445,10 +445,10 @@ ImgBmapConfigureInstance(
Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc);
}
instancePtr->gc = NULL;
- Tcl_AppendObjToErrorInfo(masterPtr->interp, Tcl_ObjPrintf(
+ Tcl_AppendObjToErrorInfo(modelPtr->interp, Tcl_ObjPrintf(
"\n (while configuring image \"%s\")", Tk_NameOfImage(
- masterPtr->tkMaster)));
- Tcl_BackgroundException(masterPtr->interp, TCL_ERROR);
+ modelPtr->tkModel)));
+ Tcl_BackgroundException(modelPtr->interp, TCL_ERROR);
}
/*
@@ -751,13 +751,13 @@ NextBitmapWord(
static int
ImgBmapCmd(
- ClientData clientData, /* Information about the image master. */
+ ClientData clientData, /* Information about the image model. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *const bmapOptions[] = {"cget", "configure", NULL};
- BitmapMaster *masterPtr = clientData;
+ BitmapModel *modelPtr = clientData;
int index;
if (objc < 2) {
@@ -775,17 +775,17 @@ ImgBmapCmd(
return TCL_ERROR;
}
return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
- (char *) masterPtr, Tcl_GetString(objv[2]), 0);
+ (char *) modelPtr, Tcl_GetString(objv[2]), 0);
case 1: /* configure */
if (objc == 2) {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, NULL, 0);
+ configSpecs, (char *) modelPtr, NULL, 0);
} else if (objc == 3) {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr,
+ configSpecs, (char *) modelPtr,
Tcl_GetString(objv[2]), 0);
} else {
- return ImgBmapConfigureMaster(masterPtr, objc-2, objv+2,
+ return ImgBmapConfigureModel(modelPtr, objc-2, objv+2,
TK_CONFIG_ARGV_ONLY);
}
default:
@@ -816,10 +816,10 @@ static ClientData
ImgBmapGet(
Tk_Window tkwin, /* Window in which the instance will be
* used. */
- ClientData masterData) /* Pointer to our master structure for the
+ ClientData modelData) /* Pointer to our model structure for the
* image. */
{
- BitmapMaster *masterPtr = masterData;
+ BitmapModel *modelPtr = modelData;
BitmapInstance *instancePtr;
/*
@@ -827,7 +827,7 @@ ImgBmapGet(
* re-use it.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
if (instancePtr->tkwin == tkwin) {
instancePtr->refCount++;
@@ -842,15 +842,15 @@ ImgBmapGet(
instancePtr = ckalloc(sizeof(BitmapInstance));
instancePtr->refCount = 1;
- instancePtr->masterPtr = masterPtr;
+ instancePtr->modelPtr = modelPtr;
instancePtr->tkwin = tkwin;
instancePtr->fg = NULL;
instancePtr->bg = NULL;
instancePtr->bitmap = None;
instancePtr->mask = None;
instancePtr->gc = NULL;
- instancePtr->nextPtr = masterPtr->instancePtr;
- masterPtr->instancePtr = instancePtr;
+ instancePtr->nextPtr = modelPtr->instancePtr;
+ modelPtr->instancePtr = instancePtr;
ImgBmapConfigureInstance(instancePtr);
/*
@@ -858,8 +858,8 @@ ImgBmapGet(
*/
if (instancePtr->nextPtr == NULL) {
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width,
+ modelPtr->height);
}
return instancePtr;
@@ -976,10 +976,10 @@ ImgBmapFree(
if (instancePtr->gc != NULL) {
Tk_FreeGC(display, instancePtr->gc);
}
- if (instancePtr->masterPtr->instancePtr == instancePtr) {
- instancePtr->masterPtr->instancePtr = instancePtr->nextPtr;
+ if (instancePtr->modelPtr->instancePtr == instancePtr) {
+ instancePtr->modelPtr->instancePtr = instancePtr->nextPtr;
} else {
- for (prevPtr = instancePtr->masterPtr->instancePtr;
+ for (prevPtr = instancePtr->modelPtr->instancePtr;
prevPtr->nextPtr != instancePtr; prevPtr = prevPtr->nextPtr) {
/* Empty loop body */
}
@@ -993,7 +993,7 @@ ImgBmapFree(
*
* ImgBmapDelete --
*
- * This procedure is called by the image code to delete the master
+ * This procedure is called by the image code to delete the model
* structure for an image.
*
* Results:
@@ -1007,26 +1007,26 @@ ImgBmapFree(
static void
ImgBmapDelete(
- ClientData masterData) /* Pointer to BitmapMaster structure for
+ ClientData modelData) /* Pointer to BitmapModel structure for
* image. Must not have any more instances. */
{
- BitmapMaster *masterPtr = masterData;
+ BitmapModel *modelPtr = modelData;
- if (masterPtr->instancePtr != NULL) {
+ if (modelPtr->instancePtr != NULL) {
Tcl_Panic("tried to delete bitmap image when instances still exist");
}
- masterPtr->tkMaster = NULL;
- if (masterPtr->imageCmd != NULL) {
- Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd);
+ modelPtr->tkModel = NULL;
+ if (modelPtr->imageCmd != NULL) {
+ Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd);
}
- if (masterPtr->data != NULL) {
- ckfree(masterPtr->data);
+ if (modelPtr->data != NULL) {
+ ckfree(modelPtr->data);
}
- if (masterPtr->maskData != NULL) {
- ckfree(masterPtr->maskData);
+ if (modelPtr->maskData != NULL) {
+ ckfree(modelPtr->maskData);
}
- Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
- ckfree(masterPtr);
+ Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0);
+ ckfree(modelPtr);
}
/*
@@ -1048,14 +1048,14 @@ ImgBmapDelete(
static void
ImgBmapCmdDeletedProc(
- ClientData clientData) /* Pointer to BitmapMaster structure for
+ ClientData clientData) /* Pointer to BitmapModel structure for
* image. */
{
- BitmapMaster *masterPtr = clientData;
+ BitmapModel *modelPtr = clientData;
- masterPtr->imageCmd = NULL;
- if (masterPtr->tkMaster != NULL) {
- Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
+ modelPtr->imageCmd = NULL;
+ if (modelPtr->tkModel != NULL) {
+ Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel));
}
}
@@ -1083,7 +1083,7 @@ GetByte(
int size;
size = Tcl_Read(chan, &buffer, 1);
- if (size <= 0) {
+ if (size != 1) {
return EOF;
} else {
return buffer;
@@ -1198,7 +1198,7 @@ ImgBmapPostscript(
int x, int y, int width, int height,
int prepass)
{
- BitmapMaster *masterPtr = clientData;
+ BitmapModel *modelPtr = clientData;
Tcl_InterpState interpState;
Tcl_Obj *psObj;
@@ -1210,7 +1210,7 @@ ImgBmapPostscript(
* There is nothing to do for bitmaps with zero width or height.
*/
- if (width<=0 || height<=0 || masterPtr->width<=0 || masterPtr->height<=0){
+ if (width<=0 || height<=0 || modelPtr->width<=0 || modelPtr->height<=0){
return TCL_OK;
}
@@ -1220,7 +1220,7 @@ ImgBmapPostscript(
* we bail out.
*/
- if (masterPtr->width*masterPtr->height > 60000) {
+ if (modelPtr->width*modelPtr->height > 60000) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unable to generate postscript for bitmaps larger than 60000"
" pixels", -1));
@@ -1259,10 +1259,10 @@ ImgBmapPostscript(
* color to the bits specified by the mask.
*/
- if ((masterPtr->bgUid != NULL) && (masterPtr->bgUid[0] != '\000')) {
+ if ((modelPtr->bgUid != NULL) && (modelPtr->bgUid[0] != '\000')) {
XColor color;
- TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->bgUid,
+ TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->bgUid,
&color);
Tcl_ResetResult(interp);
if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) {
@@ -1270,13 +1270,13 @@ ImgBmapPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (masterPtr->maskData == NULL) {
+ if (modelPtr->maskData == NULL) {
Tcl_AppendToObj(psObj,
"0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto "
"closepath fill\n", -1);
} else {
- ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height,
- masterPtr->maskData);
+ ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height,
+ modelPtr->maskData);
}
}
@@ -1284,10 +1284,10 @@ ImgBmapPostscript(
* Draw the bitmap foreground, assuming there is one.
*/
- if ((masterPtr->fgUid != NULL) && (masterPtr->data != NULL)) {
+ if ((modelPtr->fgUid != NULL) && (modelPtr->data != NULL)) {
XColor color;
- TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->fgUid,
+ TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->fgUid,
&color);
Tcl_ResetResult(interp);
if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) {
@@ -1295,8 +1295,8 @@ ImgBmapPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height,
- masterPtr->data);
+ ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height,
+ modelPtr->data);
}
/*
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index c6f2dcbd..07b4f8ba 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -626,7 +626,7 @@ ReadData(
int blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
blockSz = Tcl_Read(pngPtr->channel, (char *)destPtr, blockSz);
- if (blockSz < 0) {
+ if (blockSz == -1) {
/* TODO: failure info... */
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"channel read failed: %s", Tcl_PosixError(interp)));
@@ -2884,7 +2884,7 @@ WriteData(
}
memcpy(destPtr+objSz, srcPtr, srcSz);
- } else if (Tcl_Write(pngPtr->channel, (const char *) srcPtr, srcSz) < 0) {
+ } else if (Tcl_Write(pngPtr->channel, (const char *) srcPtr, srcSz) == -1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write to channel failed: %s", Tcl_PosixError(interp)));
return TCL_ERROR;
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index 6f084f07..fed1ca7f 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -94,13 +94,13 @@ static int ReadPPMStringHeader(Tcl_Obj *dataObj, int *widthPtr,
static int
FileMatchPPM(
Tcl_Channel chan, /* The image file, open for reading. */
- const char *fileName, /* The name of the image file. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(const char *), /* The name of the image file. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
* here if the file is a valid raw PPM
* file. */
- Tcl_Interp *interp) /* unused */
+ TCL_UNUSED(Tcl_Interp *)) /* unused */
{
int dummy;
@@ -131,7 +131,7 @@ FileReadPPM(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
Tcl_Channel chan, /* The image file, open for reading. */
const char *fileName, /* The name of the image file. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
@@ -211,7 +211,7 @@ FileReadPPM(
nLines = 1;
}
nBytes = nLines * block.pitch;
- pixelPtr = ckalloc(nBytes);
+ pixelPtr = (unsigned char *)ckalloc(nBytes);
block.pixelPtr = pixelPtr + srcX * block.pixelSize;
for (h = height; h > 0; h -= nLines) {
@@ -281,7 +281,7 @@ static int
FileWritePPM(
Tcl_Interp *interp,
const char *fileName,
- Tcl_Obj *format,
+ TCL_UNUSED(Tcl_Obj *),
Tk_PhotoImageBlock *blockPtr)
{
Tcl_Channel chan;
@@ -323,8 +323,8 @@ FileWritePPM(
pixelPtr = pixLinePtr;
for (w = blockPtr->width; w > 0; w--) {
if ( Tcl_Write(chan,(char *)&pixelPtr[0], 1) == -1 ||
- Tcl_Write(chan,(char *)&pixelPtr[greenOffset],1)==-1 ||
- Tcl_Write(chan,(char *)&pixelPtr[blueOffset],1) ==-1) {
+ Tcl_Write(chan,(char *)&pixelPtr[greenOffset],1) == -1 ||
+ Tcl_Write(chan,(char *)&pixelPtr[blueOffset],1) == -1) {
goto writeerror;
}
pixelPtr += blockPtr->pixelSize;
@@ -368,7 +368,7 @@ FileWritePPM(
static int
StringWritePPM(
Tcl_Interp *interp,
- Tcl_Obj *format,
+ TCL_UNUSED(Tcl_Obj *),
Tk_PhotoImageBlock *blockPtr)
{
int w, h, size, greenOffset, blueOffset;
@@ -444,12 +444,12 @@ StringWritePPM(
static int
StringMatchPPM(
Tcl_Obj *dataObj, /* The image data. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
* here if the file is a valid raw PPM
* file. */
- Tcl_Interp *interp) /* unused */
+ TCL_UNUSED(Tcl_Interp *)) /* unused */
{
int dummy;
@@ -479,7 +479,7 @@ static int
StringReadPPM(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
Tcl_Obj *dataObj, /* The image data. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
@@ -578,7 +578,7 @@ StringReadPPM(
nLines = 1;
}
nBytes = nLines * block.pitch;
- pixelPtr = ckalloc(nBytes);
+ pixelPtr = (unsigned char *)ckalloc(nBytes);
block.pixelPtr = pixelPtr + srcX * block.pixelSize;
for (h = height; h > 0; h -= nLines) {
@@ -600,7 +600,6 @@ StringReadPPM(
*p = (((int) *dataBuffer) * 255)/maxIntensity;
}
} else {
- unsigned char *p;
unsigned int value;
for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2) {
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index c5000500..a40ee7f1 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -19,9 +19,7 @@
*/
#include "tkImgPhoto.h"
-#ifdef MAC_OSX_TK
-#define TKPUTIMAGE_CAN_BLEND
-#endif
+#include "tkPort.h"
/*
* Declaration for internal Xlib function used here:
@@ -61,8 +59,8 @@ static int imgPhotoColorHashInitialized;
* TkImgPhotoConfigureInstance --
*
* This function is called to create displaying information for a photo
- * image instance based on the configuration information in the master.
- * It is invoked both when new instances are created and when the master
+ * image instance based on the configuration information in the model.
+ * It is invoked both when new instances are created and when the model
* is reconfigured.
*
* Results:
@@ -79,25 +77,25 @@ void
TkImgPhotoConfigureInstance(
PhotoInstance *instancePtr) /* Instance to reconfigure. */
{
- PhotoMaster *masterPtr = instancePtr->masterPtr;
+ PhotoModel *modelPtr = instancePtr->masterPtr;
XImage *imagePtr;
int bitsPerPixel;
ColorTable *colorTablePtr;
XRectangle validBox;
/*
- * If the -palette configuration option has been set for the master, use
+ * If the -palette configuration option has been set for the model, use
* the value specified for our palette, but only if it is a valid palette
- * for our windows. Use the gamma value specified the master.
+ * for our windows. Use the gamma value specified the model.
*/
- if ((masterPtr->palette && masterPtr->palette[0])
- && IsValidPalette(instancePtr, masterPtr->palette)) {
- instancePtr->palette = masterPtr->palette;
+ if ((modelPtr->palette && modelPtr->palette[0])
+ && IsValidPalette(instancePtr, modelPtr->palette)) {
+ instancePtr->palette = modelPtr->palette;
} else {
instancePtr->palette = instancePtr->defaultPalette;
}
- instancePtr->gamma = masterPtr->gamma;
+ instancePtr->gamma = modelPtr->gamma;
/*
* If we don't currently have a color table, or if the one we have no
@@ -161,15 +159,15 @@ TkImgPhotoConfigureInstance(
}
/*
- * If the user has specified a width and/or height for the master which is
+ * If the user has specified a width and/or height for the model which is
* different from our current width/height, set the size to the values
* specified by the user. If we have no pixmap, we do this also, since it
* has the side effect of allocating a pixmap for us.
*/
if ((instancePtr->pixels == None) || (instancePtr->error == NULL)
- || (instancePtr->width != masterPtr->width)
- || (instancePtr->height != masterPtr->height)) {
+ || (instancePtr->width != modelPtr->width)
+ || (instancePtr->height != modelPtr->height)) {
TkImgPhotoInstanceSetSize(instancePtr);
}
@@ -177,9 +175,9 @@ TkImgPhotoConfigureInstance(
* Redither this instance if necessary.
*/
- if ((masterPtr->flags & IMAGE_CHANGED)
+ if ((modelPtr->flags & IMAGE_CHANGED)
|| (instancePtr->colorTablePtr != colorTablePtr)) {
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
if ((validBox.width > 0) && (validBox.height > 0)) {
TkImgDitherInstance(instancePtr, validBox.x, validBox.y,
validBox.width, validBox.height);
@@ -209,10 +207,10 @@ ClientData
TkImgPhotoGet(
Tk_Window tkwin, /* Window in which the instance will be
* used. */
- ClientData masterData) /* Pointer to our master structure for the
+ ClientData modelData) /* Pointer to our model structure for the
* image. */
{
- PhotoMaster *masterPtr = masterData;
+ PhotoModel *modelPtr = modelData;
PhotoInstance *instancePtr;
Colormap colormap;
int mono, nRed, nGreen, nBlue, numVisuals;
@@ -249,7 +247,7 @@ TkImgPhotoGet(
*/
colormap = Tk_Colormap(tkwin);
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
if ((colormap == instancePtr->colormap)
&& (Tk_Display(tkwin) == instancePtr->display)) {
@@ -279,7 +277,7 @@ TkImgPhotoGet(
*/
instancePtr = ckalloc(sizeof(PhotoInstance));
- instancePtr->masterPtr = masterPtr;
+ instancePtr->masterPtr = modelPtr;
instancePtr->display = Tk_Display(tkwin);
instancePtr->colormap = Tk_Colormap(tkwin);
Tk_PreserveColormap(instancePtr->display, instancePtr->colormap);
@@ -290,8 +288,8 @@ TkImgPhotoGet(
instancePtr->width = 0;
instancePtr->height = 0;
instancePtr->imagePtr = 0;
- instancePtr->nextPtr = masterPtr->instancePtr;
- masterPtr->instancePtr = instancePtr;
+ instancePtr->nextPtr = modelPtr->instancePtr;
+ modelPtr->instancePtr = instancePtr;
/*
* Obtain information about the visual and decide on the default palette.
@@ -351,8 +349,8 @@ TkImgPhotoGet(
* Make a GC with background = black and foreground = white.
*/
- white = Tk_GetColor(masterPtr->interp, tkwin, "white");
- black = Tk_GetColor(masterPtr->interp, tkwin, "black");
+ white = Tk_GetColor(modelPtr->interp, tkwin, "white");
+ black = Tk_GetColor(modelPtr->interp, tkwin, "black");
gcValues.foreground = (white != NULL)? white->pixel:
WhitePixelOfScreen(Tk_Screen(tkwin));
gcValues.background = (black != NULL)? black->pixel:
@@ -375,8 +373,8 @@ TkImgPhotoGet(
*/
if (instancePtr->nextPtr == NULL) {
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
}
return instancePtr;
@@ -409,9 +407,6 @@ TkImgPhotoGet(
*
* Note that Win32 pre-defines those operations that we really need.
*
- * Note that on MacOS, if the background comes from a Retina display
- * then it will be twice as wide and twice as high as the photoimage.
- *
*----------------------------------------------------------------------
*/
#ifndef TKPUTIMAGE_CAN_BLEND
@@ -439,7 +434,7 @@ BlendComplexAlpha(
{
int x, y, line;
unsigned long pixel;
- unsigned char r, g, b, alpha, unalpha, *masterPtr;
+ unsigned char r, g, b, alpha, unalpha, *modelPtr;
unsigned char *alphaAr = iPtr->masterPtr->pix32;
/*
@@ -499,8 +494,8 @@ BlendComplexAlpha(
for (y = 0; y < height; y++) {
line = (y + yOffset) * iPtr->masterPtr->width;
for (x = 0; x < width; x++) {
- masterPtr = alphaAr + ((line + x + xOffset) * 4);
- alpha = masterPtr[3];
+ modelPtr = alphaAr + ((line + x + xOffset) * 4);
+ alpha = modelPtr[3];
/*
* Ignore pixels that are fully transparent
@@ -512,9 +507,9 @@ BlendComplexAlpha(
* 24 and 32 bit displays, but this seems "fast enough".
*/
- r = masterPtr[0];
- g = masterPtr[1];
- b = masterPtr[2];
+ r = modelPtr[0];
+ g = modelPtr[1];
+ b = modelPtr[2];
if (alpha != 255) {
/*
* Only blend pixels that have some transparency
@@ -542,8 +537,8 @@ BlendComplexAlpha(
for (y = 0; y < height; y++) {
line = (y + yOffset) * iPtr->masterPtr->width;
for (x = 0; x < width; x++) {
- masterPtr = alphaAr + ((line + x + xOffset) * 4);
- alpha = masterPtr[3];
+ modelPtr = alphaAr + ((line + x + xOffset) * 4);
+ alpha = modelPtr[3];
/*
* Ignore pixels that are fully transparent
@@ -555,9 +550,9 @@ BlendComplexAlpha(
* and 32 bit displays, but this seems "fast enough".
*/
- r = masterPtr[0];
- g = masterPtr[1];
- b = masterPtr[2];
+ r = modelPtr[0];
+ g = modelPtr[1];
+ b = modelPtr[2];
if (alpha != 255) {
/*
* Only blend pixels that have some transparency
@@ -684,7 +679,7 @@ TkImgPhotoDisplay(
Tk_DeleteErrorHandler(handler);
} else {
/*
- * masterPtr->region describes which parts of the image contain valid
+ * modelPtr->region describes which parts of the image contain valid
* data. We set this region as the clip mask for the gc, setting its
* origin appropriately, and use it when drawing the image.
*/
@@ -773,23 +768,23 @@ void
TkImgPhotoInstanceSetSize(
PhotoInstance *instancePtr) /* Instance whose size is to be changed. */
{
- PhotoMaster *masterPtr;
+ PhotoModel *modelPtr;
schar *newError, *errSrcPtr, *errDestPtr;
int h, offset;
XRectangle validBox;
Pixmap newPixmap;
- masterPtr = instancePtr->masterPtr;
- TkClipBox(masterPtr->validRegion, &validBox);
+ modelPtr = instancePtr->masterPtr;
+ TkClipBox(modelPtr->validRegion, &validBox);
- if ((instancePtr->width != masterPtr->width)
- || (instancePtr->height != masterPtr->height)
+ if ((instancePtr->width != modelPtr->width)
+ || (instancePtr->height != modelPtr->height)
|| (instancePtr->pixels == None)) {
newPixmap = Tk_GetPixmap(instancePtr->display,
RootWindow(instancePtr->display,
instancePtr->visualInfo.screen),
- (masterPtr->width > 0) ? masterPtr->width: 1,
- (masterPtr->height > 0) ? masterPtr->height: 1,
+ (modelPtr->width > 0) ? modelPtr->width: 1,
+ (modelPtr->height > 0) ? modelPtr->height: 1,
instancePtr->visualInfo.depth);
if (!newPixmap) {
Tcl_Panic("Fail to create pixmap with Tk_GetPixmap in TkImgPhotoInstanceSetSize");
@@ -819,17 +814,17 @@ TkImgPhotoInstanceSetSize(
instancePtr->pixels = newPixmap;
}
- if ((instancePtr->width != masterPtr->width)
- || (instancePtr->height != masterPtr->height)
+ if ((instancePtr->width != modelPtr->width)
+ || (instancePtr->height != modelPtr->height)
|| (instancePtr->error == NULL)) {
- if (masterPtr->height > 0 && masterPtr->width > 0) {
+ if (modelPtr->height > 0 && modelPtr->width > 0) {
/*
* TODO: use attemptckalloc() here once there is a strategy that
* will allow us to recover from failure. Right now, there's no
* such possibility.
*/
- newError = ckalloc(masterPtr->height * masterPtr->width
+ newError = ckalloc(modelPtr->height * modelPtr->width
* 3 * sizeof(schar));
/*
@@ -838,21 +833,21 @@ TkImgPhotoInstanceSetSize(
*/
if ((instancePtr->error != NULL)
- && ((instancePtr->width == masterPtr->width)
- || (validBox.width == masterPtr->width))) {
+ && ((instancePtr->width == modelPtr->width)
+ || (validBox.width == modelPtr->width))) {
if (validBox.y > 0) {
memset(newError, 0, (size_t)
- validBox.y * masterPtr->width * 3 * sizeof(schar));
+ validBox.y * modelPtr->width * 3 * sizeof(schar));
}
h = validBox.y + validBox.height;
- if (h < masterPtr->height) {
- memset(newError + h*masterPtr->width*3, 0,
- (size_t) (masterPtr->height - h)
- * masterPtr->width * 3 * sizeof(schar));
+ if (h < modelPtr->height) {
+ memset(newError + h*modelPtr->width*3, 0,
+ (size_t) (modelPtr->height - h)
+ * modelPtr->width * 3 * sizeof(schar));
}
} else {
memset(newError, 0, (size_t)
- masterPtr->height * masterPtr->width *3*sizeof(schar));
+ modelPtr->height * modelPtr->width *3*sizeof(schar));
}
} else {
newError = NULL;
@@ -864,22 +859,22 @@ TkImgPhotoInstanceSetSize(
* array.
*/
- if (masterPtr->width == instancePtr->width) {
- offset = validBox.y * masterPtr->width * 3;
+ if (modelPtr->width == instancePtr->width) {
+ offset = validBox.y * modelPtr->width * 3;
memcpy(newError + offset, instancePtr->error + offset,
(size_t) (validBox.height
- * masterPtr->width * 3 * sizeof(schar)));
+ * modelPtr->width * 3 * sizeof(schar)));
} else if (validBox.width > 0 && validBox.height > 0) {
errDestPtr = newError +
- (validBox.y * masterPtr->width + validBox.x) * 3;
+ (validBox.y * modelPtr->width + validBox.x) * 3;
errSrcPtr = instancePtr->error +
(validBox.y * instancePtr->width + validBox.x) * 3;
for (h = validBox.height; h > 0; --h) {
memcpy(errDestPtr, errSrcPtr,
validBox.width * 3 * sizeof(schar));
- errDestPtr += masterPtr->width * 3;
+ errDestPtr += modelPtr->width * 3;
errSrcPtr += instancePtr->width * 3;
}
}
@@ -889,8 +884,8 @@ TkImgPhotoInstanceSetSize(
instancePtr->error = newError;
}
- instancePtr->width = masterPtr->width;
- instancePtr->height = masterPtr->height;
+ instancePtr->width = modelPtr->width;
+ instancePtr->height = modelPtr->height;
}
/*
@@ -1622,7 +1617,7 @@ TkImgDisposeInstance(
* TkImgDitherInstance --
*
* This function is called to update an area of an instance's pixmap by
- * dithering the corresponding area of the master.
+ * dithering the corresponding area of the model.
*
* Results:
* None.
@@ -1640,7 +1635,7 @@ TkImgDitherInstance(
* block to be dithered. */
int width, int height) /* Dimensions of the block to be dithered. */
{
- PhotoMaster *masterPtr = instancePtr->masterPtr;
+ PhotoModel *modelPtr = instancePtr->masterPtr;
ColorTable *colorPtr = instancePtr->colorTablePtr;
XImage *imagePtr;
int nLines, bigEndian, i, c, x, y, xEnd, doDithering = 1;
@@ -1698,8 +1693,8 @@ TkImgDitherInstance(
bigEndian = imagePtr->bitmap_bit_order == MSBFirst;
firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1;
- lineLength = masterPtr->width * 3;
- srcLinePtr = masterPtr->pix32 + (yStart * masterPtr->width + xStart) * 4;
+ lineLength = modelPtr->width * 3;
+ srcLinePtr = modelPtr->pix32 + (yStart * modelPtr->width + xStart) * 4;
errLinePtr = instancePtr->error + yStart * lineLength + xStart * 3;
xEnd = xStart + width;
@@ -1754,7 +1749,7 @@ TkImgDitherInstance(
c += errPtr[-lineLength-3];
}
c += errPtr[-lineLength] * 5;
- if ((x + 1) < masterPtr->width) {
+ if ((x + 1) < modelPtr->width) {
c += errPtr[-lineLength+3] * 3;
}
}
@@ -1825,7 +1820,7 @@ TkImgDitherInstance(
/*
* Multibit monochrome window. The operation here is similar
* to the color window case above, except that there is only
- * one component. If the master image is in color, use the
+ * one component. If the model image is in color, use the
* luminance computed as
* 0.344 * red + 0.5 * green + 0.156 * blue.
*/
@@ -1837,13 +1832,13 @@ TkImgDitherInstance(
c += errPtr[-lineLength-1];
}
c += errPtr[-lineLength] * 5;
- if (x + 1 < masterPtr->width) {
+ if (x + 1 < modelPtr->width) {
c += errPtr[-lineLength+1] * 3;
}
}
c = ((c + 2056) >> 4) - 128;
- if (masterPtr->flags & COLOR_IMAGE) {
+ if (modelPtr->flags & COLOR_IMAGE) {
c += (unsigned) (srcPtr[0] * 11 + srcPtr[1] * 16
+ srcPtr[2] * 5 + 16) >> 5;
} else {
@@ -1910,13 +1905,13 @@ TkImgDitherInstance(
c += errPtr[-lineLength-1];
}
c += errPtr[-lineLength] * 5;
- if (x + 1 < masterPtr->width) {
+ if (x + 1 < modelPtr->width) {
c += errPtr[-lineLength+1] * 3;
}
}
c = ((c + 2056) >> 4) - 128;
- if (masterPtr->flags & COLOR_IMAGE) {
+ if (modelPtr->flags & COLOR_IMAGE) {
c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16
+ srcPtr[2] * 5 + 16) >> 5;
} else {
@@ -1939,7 +1934,7 @@ TkImgDitherInstance(
}
*destLongPtr = word;
}
- srcLinePtr += masterPtr->width * 4;
+ srcLinePtr += modelPtr->width * 4;
errLinePtr += lineLength;
dstLinePtr += bytesPerLine;
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 03b37311..b91cacb1 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -101,7 +101,7 @@ static const char *const optionNames[] = {
static int ImgPhotoCreate(Tcl_Interp *interp, const char *name,
int objc, Tcl_Obj *const objv[],
- const Tk_ImageType *typePtr, Tk_ImageMaster master,
+ const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static void ImgPhotoDelete(ClientData clientData);
static int ImgPhotoPostscript(ClientData clientData,
@@ -152,15 +152,15 @@ static Tcl_ThreadDataKey dataKey;
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_STRING, "-file", NULL, NULL,
- NULL, Tk_Offset(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, Tk_Offset(PhotoModel, fileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_DOUBLE, "-gamma", NULL, NULL,
- DEF_PHOTO_GAMMA, Tk_Offset(PhotoMaster, gamma), 0, NULL},
+ DEF_PHOTO_GAMMA, Tk_Offset(PhotoModel, gamma), 0, NULL},
{TK_CONFIG_INT, "-height", NULL, NULL,
- DEF_PHOTO_HEIGHT, Tk_Offset(PhotoMaster, userHeight), 0, NULL},
+ DEF_PHOTO_HEIGHT, Tk_Offset(PhotoModel, userHeight), 0, NULL},
{TK_CONFIG_UID, "-palette", NULL, NULL,
- DEF_PHOTO_PALETTE, Tk_Offset(PhotoMaster, palette), 0, NULL},
+ DEF_PHOTO_PALETTE, Tk_Offset(PhotoModel, palette), 0, NULL},
{TK_CONFIG_INT, "-width", NULL, NULL,
- DEF_PHOTO_WIDTH, Tk_Offset(PhotoMaster, userWidth), 0, NULL},
+ DEF_PHOTO_WIDTH, Tk_Offset(PhotoModel, userWidth), 0, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -176,16 +176,16 @@ static int ParseSubcommandOptions(
Tcl_Interp *interp, int allowedOptions,
int *indexPtr, int objc, Tcl_Obj *const objv[]);
static void ImgPhotoCmdDeletedProc(ClientData clientData);
-static int ImgPhotoConfigureMaster(Tcl_Interp *interp,
- PhotoMaster *masterPtr, int objc,
+static int ImgPhotoConfigureModel(Tcl_Interp *interp,
+ PhotoModel *modelPtr, int objc,
Tcl_Obj *const objv[], int flags);
-static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr);
-static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width,
+static int ToggleComplexAlphaIfNeeded(PhotoModel *mPtr);
+static int ImgPhotoSetSize(PhotoModel *modelPtr, int width,
int height);
static int ImgStringWrite(Tcl_Interp *interp,
Tcl_Obj *formatString,
Tk_PhotoImageBlock *blockPtr);
-static char * ImgGetPhoto(PhotoMaster *masterPtr,
+static char * ImgGetPhoto(PhotoModel *modelPtr,
Tk_PhotoImageBlock *blockPtr,
struct SubcommandOptions *optPtr);
static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan,
@@ -216,10 +216,10 @@ static const char * GetExtension(const char *path);
static void
PhotoFormatThreadExitProc(
- ClientData clientData) /* not used */
+ TCL_UNUSED(void *)) /* not used */
{
Tk_PhotoImageFormat *freePtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
while (tsdPtr->oldFormatList != NULL) {
@@ -262,14 +262,14 @@ Tk_CreateOldPhotoImageFormat(
* by caller. */
{
Tk_PhotoImageFormat *copyPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL);
}
- copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat));
+ copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
@@ -283,21 +283,21 @@ Tk_CreatePhotoImageFormat(
* by caller. */
{
Tk_PhotoImageFormat *copyPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL);
}
- copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat));
+ copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
if (isupper((unsigned char) *formatPtr->name)) {
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
} else {
/* for compatibility with aMSN: make a copy of formatPtr->name */
- char *name = ckalloc(strlen(formatPtr->name) + 1);
+ char *name = (char *)ckalloc(strlen(formatPtr->name) + 1);
strcpy(name, formatPtr->name);
copyPtr->name = name;
copyPtr->nextPtr = tsdPtr->formatList;
@@ -330,39 +330,39 @@ ImgPhotoCreate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument objects for options (doesn't
* include image name or type). */
- const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- PhotoMaster *masterPtr;
+ PhotoModel *modelPtr;
/*
- * Allocate and initialize the photo image master record.
+ * Allocate and initialize the photo image model record.
*/
- masterPtr = ckalloc(sizeof(PhotoMaster));
- memset(masterPtr, 0, sizeof(PhotoMaster));
- masterPtr->tkMaster = master;
- masterPtr->interp = interp;
- masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
- masterPtr, ImgPhotoCmdDeletedProc);
- masterPtr->palette = NULL;
- masterPtr->pix32 = NULL;
- masterPtr->instancePtr = NULL;
- masterPtr->validRegion = TkCreateRegion();
+ modelPtr = (PhotoModel *)ckalloc(sizeof(PhotoModel));
+ memset(modelPtr, 0, sizeof(PhotoModel));
+ modelPtr->tkMaster = model;
+ modelPtr->interp = interp;
+ modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
+ modelPtr, ImgPhotoCmdDeletedProc);
+ modelPtr->palette = NULL;
+ modelPtr->pix32 = NULL;
+ modelPtr->instancePtr = NULL;
+ modelPtr->validRegion = TkCreateRegion();
/*
* Process configuration options given in the image create command.
*/
- if (ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, 0) != TCL_OK) {
- ImgPhotoDelete(masterPtr);
+ if (ImgPhotoConfigureModel(interp, modelPtr, objc, objv, 0) != TCL_OK) {
+ ImgPhotoDelete(modelPtr);
return TCL_ERROR;
}
- *clientDataPtr = masterPtr;
+ *clientDataPtr = modelPtr;
return TCL_OK;
}
@@ -386,7 +386,7 @@ ImgPhotoCreate(
static int
ImgPhotoCmd(
- ClientData clientData, /* Information about photo master. */
+ ClientData clientData, /* Information about photo model. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -401,7 +401,7 @@ ImgPhotoCmd(
PHOTO_WRITE
};
- PhotoMaster *masterPtr = clientData;
+ PhotoModel *modelPtr = clientData;
int result, index, x, y, width, height, dataWidth, dataHeight, listObjc;
struct SubcommandOptions options;
Tcl_Obj **listObjv, **srcObjv;
@@ -413,7 +413,7 @@ ImgPhotoCmd(
int imageWidth, imageHeight, matched, oldformat = 0;
Tcl_Channel chan;
Tk_PhotoHandle srcHandle;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (objc < 2) {
@@ -433,7 +433,7 @@ ImgPhotoCmd(
*/
if (objc == 2) {
- Tk_PhotoBlank(masterPtr);
+ Tk_PhotoBlank(modelPtr);
return TCL_OK;
} else {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
@@ -450,16 +450,16 @@ ImgPhotoCmd(
arg = Tcl_GetString(objv[2]);
length = objv[2]->length;
if (strncmp(arg,"-data", length) == 0) {
- if (masterPtr->dataString) {
- Tcl_SetObjResult(interp, masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_SetObjResult(interp, modelPtr->dataString);
}
} else if (strncmp(arg,"-format", length) == 0) {
- if (masterPtr->format) {
- Tcl_SetObjResult(interp, masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_SetObjResult(interp, modelPtr->format);
}
} else {
Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
- (char *) masterPtr, Tcl_GetString(objv[2]), 0);
+ (char *) modelPtr, Tcl_GetString(objv[2]), 0);
}
return TCL_OK;
}
@@ -473,21 +473,21 @@ ImgPhotoCmd(
Tcl_Obj *obj, *subobj;
result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, NULL, 0);
+ configSpecs, (char *) modelPtr, NULL, 0);
if (result != TCL_OK) {
return result;
}
obj = Tcl_NewObj();
subobj = Tcl_NewStringObj("-data {} {} {}", 14);
- if (masterPtr->dataString) {
- Tcl_ListObjAppendElement(NULL, subobj, masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->dataString);
} else {
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewStringObj("-format {} {} {}", 16);
- if (masterPtr->format) {
- Tcl_ListObjAppendElement(NULL, subobj, masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format);
} else {
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
@@ -502,13 +502,13 @@ ImgPhotoCmd(
length = objv[2]->length;
if (length > 1 && !strncmp(arg, "-data", length)) {
Tcl_AppendResult(interp, "-data {} {} {}", NULL);
- if (masterPtr->dataString) {
+ if (modelPtr->dataString) {
/*
* TODO: Modifying result is bad!
*/
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- masterPtr->dataString);
+ modelPtr->dataString);
} else {
Tcl_AppendResult(interp, " {}", NULL);
}
@@ -516,23 +516,23 @@ ImgPhotoCmd(
} else if (length > 1 &&
!strncmp(arg, "-format", length)) {
Tcl_AppendResult(interp, "-format {} {} {}", NULL);
- if (masterPtr->format) {
+ if (modelPtr->format) {
/*
* TODO: Modifying result is bad!
*/
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- masterPtr->format);
+ modelPtr->format);
} else {
Tcl_AppendResult(interp, " {}", NULL);
}
return TCL_OK;
} else {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, arg, 0);
+ configSpecs, (char *) modelPtr, arg, 0);
}
} else {
- return ImgPhotoConfigureMaster(interp, masterPtr, objc-2, objv+2,
+ return ImgPhotoConfigureModel(interp, modelPtr, objc-2, objv+2,
TK_CONFIG_ARGV_ONLY);
}
@@ -591,7 +591,7 @@ ImgPhotoCmd(
* has a simple alpha channel.
*/
- if (!(((PhotoMaster *) srcHandle)->flags & COMPLEX_ALPHA)) {
+ if (!(((PhotoModel *) srcHandle)->flags & COMPLEX_ALPHA)) {
options.compositingRule |= SOURCE_IS_SIMPLE_ALPHA_PHOTO;
}
@@ -635,7 +635,7 @@ ImgPhotoCmd(
+ options.fromY * block.pitch;
block.width = options.fromX2 - options.fromX;
block.height = options.fromY2 - options.fromY;
- result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr,
+ result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) modelPtr,
&block, options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY, options.zoomX, options.zoomY,
options.subsampleX, options.subsampleY,
@@ -649,7 +649,7 @@ ImgPhotoCmd(
*/
if (options.options & OPT_SHRINK) {
- if (ImgPhotoSetSize(masterPtr, options.toX2,
+ if (ImgPhotoSetSize(modelPtr, options.toX2,
options.toY2) != TCL_OK) {
if (options.background) {
Tk_FreeColor(options.background);
@@ -660,8 +660,8 @@ ImgPhotoCmd(
return TCL_ERROR;
}
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
if (options.background) {
Tk_FreeColor(options.background);
}
@@ -691,10 +691,10 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?");
return TCL_ERROR;
}
- if ((options.fromX > masterPtr->width)
- || (options.fromY > masterPtr->height)
- || (options.fromX2 > masterPtr->width)
- || (options.fromY2 > masterPtr->height)) {
+ if ((options.fromX > modelPtr->width)
+ || (options.fromY > modelPtr->height)
+ || (options.fromX2 > modelPtr->width)
+ || (options.fromY2 > modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"coordinates for -from option extend outside image", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);
@@ -706,8 +706,8 @@ ImgPhotoCmd(
*/
if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) {
- options.fromX2 = masterPtr->width;
- options.fromY2 = masterPtr->height;
+ options.fromX2 = modelPtr->width;
+ options.fromY2 = modelPtr->height;
}
/*
@@ -759,7 +759,7 @@ ImgPhotoCmd(
* Call the handler's string write function to write out the image.
*/
- data = ImgGetPhoto(masterPtr, &block, &options);
+ data = ImgGetPhoto(modelPtr, &block, &options);
if (oldformat) {
Tcl_DString buffer;
@@ -768,7 +768,7 @@ ImgPhotoCmd(
Tk_PhotoImageBlock *blockPtr);
Tcl_DStringInit(&buffer);
- result = ((OldStringWriteProc) stringWriteProc)(interp, &buffer,
+ result = ((OldStringWriteProc)(void *)stringWriteProc)(interp, &buffer,
Tcl_GetString(options.format), &block);
if (result == TCL_OK) {
Tcl_DStringResult(interp, &buffer);
@@ -780,7 +780,7 @@ ImgPhotoCmd(
Tcl_Obj *formatString, Tk_PhotoImageBlock *blockPtr,
void *dummy);
- result = ((NewStringWriteProc) stringWriteProc)(interp,
+ result = ((NewStringWriteProc)(void *)stringWriteProc)(interp,
options.format, &block, NULL);
}
if (options.background) {
@@ -807,8 +807,8 @@ ImgPhotoCmd(
|| (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
return TCL_ERROR;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s get: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -818,10 +818,10 @@ ImgPhotoCmd(
}
/*
- * Extract the value of the desired pixel and format it as a string.
+ * Extract the value of the desired pixel and format it as a list.
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
channels[0] = Tcl_NewIntObj(pixelPtr[0]);
channels[1] = Tcl_NewIntObj(pixelPtr[1]);
channels[2] = Tcl_NewIntObj(pixelPtr[2]);
@@ -870,11 +870,11 @@ ImgPhotoCmd(
data = (Tcl_Obj *) Tcl_GetString(data);
}
if (imageFormat->stringReadProc(interp, data, format,
- (Tk_PhotoHandle) masterPtr, options.toX, options.toY,
+ (Tk_PhotoHandle) modelPtr, options.toX, options.toY,
imageWidth, imageHeight, 0, 0) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
return TCL_OK;
}
if (options.options & OPT_FORMAT) {
@@ -1007,7 +1007,7 @@ ImgPhotoCmd(
block.offset[1] = 1;
block.offset[2] = 2;
block.offset[3] = 0;
- result = Tk_PhotoPutBlock(interp, masterPtr, &block,
+ result = Tk_PhotoPutBlock(interp, modelPtr, &block,
options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY,
TK_PHOTO_COMPOSITE_SET);
@@ -1100,12 +1100,13 @@ ImgPhotoCmd(
*/
if (options.options & OPT_SHRINK) {
- if (ImgPhotoSetSize(masterPtr, options.toX + width,
+ if (ImgPhotoSetSize(modelPtr, options.toX + width,
options.toY + height) != TCL_OK) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
+ Tcl_Close(NULL, chan);
return TCL_ERROR;
}
}
@@ -1121,7 +1122,7 @@ ImgPhotoCmd(
}
result = imageFormat->fileReadProc(interp, chan,
Tcl_GetString(options.name),
- format, (Tk_PhotoHandle) masterPtr, options.toX,
+ format, (Tk_PhotoHandle) modelPtr, options.toX,
options.toY, width, height, options.fromX, options.fromY);
if (chan != NULL) {
Tcl_Close(NULL, chan);
@@ -1140,27 +1141,27 @@ ImgPhotoCmd(
* present.
*/
- x = masterPtr->ditherX;
- y = masterPtr->ditherY;
- if (masterPtr->ditherX != 0) {
- Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y,
- masterPtr->width - x, 1);
+ x = modelPtr->ditherX;
+ y = modelPtr->ditherY;
+ if (modelPtr->ditherX != 0) {
+ Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y,
+ modelPtr->width - x, 1);
}
- if (masterPtr->ditherY < masterPtr->height) {
+ if (modelPtr->ditherY < modelPtr->height) {
x = 0;
- Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, 0,
- masterPtr->ditherY, masterPtr->width,
- masterPtr->height - masterPtr->ditherY);
+ Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, 0,
+ modelPtr->ditherY, modelPtr->width,
+ modelPtr->height - modelPtr->ditherY);
}
- if (y < masterPtr->height) {
+ if (y < modelPtr->height) {
/*
* Tell the core image code that part of the image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y,
- (masterPtr->width - x), (masterPtr->height - y),
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, x, y,
+ (modelPtr->width - x), (modelPtr->height - y),
+ modelPtr->width, modelPtr->height);
}
return TCL_OK;
@@ -1194,8 +1195,8 @@ ImgPhotoCmd(
|| (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)) {
return TCL_ERROR;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s transparency get: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -1211,7 +1212,7 @@ ImgPhotoCmd(
/* What a way to do a test! */
testRegion = TkCreateRegion();
TkUnionRectWithRegion(&testBox, testRegion, testRegion);
- TkIntersectRegion(testRegion, masterPtr->validRegion, testRegion);
+ TkIntersectRegion(testRegion, modelPtr->validRegion, testRegion);
TkClipBox(testRegion, &testBox);
TkDestroyRegion(testRegion);
@@ -1234,8 +1235,8 @@ ImgPhotoCmd(
&transFlag) != TCL_OK)) {
return TCL_ERROR;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s transparency set: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -1248,7 +1249,7 @@ ImgPhotoCmd(
setBox.y = y;
setBox.width = 1;
setBox.height = 1;
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
if (transFlag) {
/*
@@ -1258,8 +1259,8 @@ ImgPhotoCmd(
TkRegion clearRegion = TkCreateRegion();
TkUnionRectWithRegion(&setBox, clearRegion, clearRegion);
- TkSubtractRegion(masterPtr->validRegion, clearRegion,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, clearRegion,
+ modelPtr->validRegion);
TkDestroyRegion(clearRegion);
/*
@@ -1272,8 +1273,8 @@ ImgPhotoCmd(
* Make pixel opaque.
*/
- TkUnionRectWithRegion(&setBox, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&setBox, modelPtr->validRegion,
+ modelPtr->validRegion);
pixelPtr[3] = 255;
}
@@ -1282,9 +1283,9 @@ ImgPhotoCmd(
* has (potentially) changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, 1, 1,
- masterPtr->width, masterPtr->height);
- masterPtr->flags &= ~IMAGE_CHANGED;
+ Tk_ImageChanged(modelPtr->tkMaster, x, y, 1, 1,
+ modelPtr->width, modelPtr->height);
+ modelPtr->flags &= ~IMAGE_CHANGED;
return TCL_OK;
}
@@ -1326,10 +1327,10 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?");
return TCL_ERROR;
}
- if ((options.fromX > masterPtr->width)
- || (options.fromY > masterPtr->height)
- || (options.fromX2 > masterPtr->width)
- || (options.fromY2 > masterPtr->height)) {
+ if ((options.fromX > modelPtr->width)
+ || (options.fromY > modelPtr->height)
+ || (options.fromX2 > modelPtr->width)
+ || (options.fromY2 > modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"coordinates for -from option extend outside image", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);
@@ -1343,8 +1344,8 @@ ImgPhotoCmd(
*/
if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) {
- options.fromX2 = masterPtr->width;
- options.fromY2 = masterPtr->height;
+ options.fromX2 = modelPtr->width;
+ options.fromY2 = modelPtr->height;
}
if (options.format == NULL) {
fmtString = GetExtension(Tcl_GetString(options.name));
@@ -1419,7 +1420,7 @@ ImgPhotoCmd(
* Call the handler's file write function to write out the image.
*/
- data = ImgGetPhoto(masterPtr, &block, &options);
+ data = ImgGetPhoto(modelPtr, &block, &options);
format = options.format;
if (oldformat && format) {
format = (Tcl_Obj *) Tcl_GetString(options.format);
@@ -1758,7 +1759,7 @@ ParseSubcommandOptions(
/*
*----------------------------------------------------------------------
*
- * ImgPhotoConfigureMaster --
+ * ImgPhotoConfigureModel --
*
* This function is called when a photo image is created or reconfigured.
* It processes configuration options and resets any instances of the
@@ -1766,7 +1767,7 @@ ParseSubcommandOptions(
*
* Results:
* A standard Tcl return value. If TCL_ERROR is returned then an error
- * message is left in the masterPtr->interp's result.
+ * message is left in the modelPtr->interp's result.
*
* Side effects:
* Existing instances of the image will be redisplayed to match the new
@@ -1776,9 +1777,9 @@ ParseSubcommandOptions(
*/
static int
-ImgPhotoConfigureMaster(
+ImgPhotoConfigureModel(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
- PhotoMaster *masterPtr, /* Pointer to data structure describing
+ PhotoModel *modelPtr, /* Pointer to data structure describing
* overall photo image to (re)configure. */
int objc, /* Number of entries in objv. */
Tcl_Obj *const objv[], /* Pairs of configuration options for image. */
@@ -1796,7 +1797,7 @@ ImgPhotoConfigureMaster(
Tk_PhotoImageFormat *imageFormat;
const char **args;
- args = ckalloc((objc + 1) * sizeof(char *));
+ args = (const char **)ckalloc((objc + 1) * sizeof(char *));
for (i = 0, j = 0; i < objc; i++,j++) {
args[j] = Tcl_GetString(objv[i]);
length = objv[i]->length;
@@ -1838,28 +1839,28 @@ ImgPhotoConfigureMaster(
* the format string influences how "-data" or "-file" is interpreted.
*/
- oldFileString = masterPtr->fileString;
+ oldFileString = modelPtr->fileString;
if (oldFileString == NULL) {
- oldData = masterPtr->dataString;
+ oldData = modelPtr->dataString;
if (oldData != NULL) {
Tcl_IncrRefCount(oldData);
}
} else {
oldData = NULL;
}
- oldFormat = masterPtr->format;
+ oldFormat = modelPtr->format;
if (oldFormat != NULL) {
Tcl_IncrRefCount(oldFormat);
}
- oldPaletteString = masterPtr->palette;
- oldGamma = masterPtr->gamma;
+ oldPaletteString = modelPtr->palette;
+ oldGamma = modelPtr->gamma;
/*
* Process the configuration options specified.
*/
if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs,
- j, args, (char *) masterPtr, flags) != TCL_OK) {
+ j, args, (char *) modelPtr, flags) != TCL_OK) {
ckfree(args);
goto errorExit;
}
@@ -1869,9 +1870,9 @@ ImgPhotoConfigureMaster(
* Regard the empty string for -file, -data or -format as the null value.
*/
- if ((masterPtr->fileString != NULL) && (masterPtr->fileString[0] == 0)) {
- ckfree(masterPtr->fileString);
- masterPtr->fileString = NULL;
+ if ((modelPtr->fileString != NULL) && (modelPtr->fileString[0] == 0)) {
+ ckfree(modelPtr->fileString);
+ modelPtr->fileString = NULL;
}
if (data) {
/*
@@ -1886,10 +1887,10 @@ ImgPhotoConfigureMaster(
} else {
data = NULL;
}
- if (masterPtr->dataString) {
- Tcl_DecrRefCount(masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_DecrRefCount(modelPtr->dataString);
}
- masterPtr->dataString = data;
+ modelPtr->dataString = data;
}
if (format) {
/*
@@ -1903,18 +1904,18 @@ ImgPhotoConfigureMaster(
} else {
format = NULL;
}
- if (masterPtr->format) {
- Tcl_DecrRefCount(masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_DecrRefCount(modelPtr->format);
}
- masterPtr->format = format;
+ modelPtr->format = format;
}
/*
* Set the image to the user-requested size, if any, and make sure storage
* is correctly allocated for this image.
*/
- if (ImgPhotoSetSize(masterPtr, masterPtr->width,
- masterPtr->height) != TCL_OK) {
+ if (ImgPhotoSetSize(modelPtr, modelPtr->width,
+ modelPtr->height) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
@@ -1926,9 +1927,9 @@ ImgPhotoConfigureMaster(
* -file or -data option.
*/
- if ((masterPtr->fileString != NULL)
- && ((masterPtr->fileString != oldFileString)
- || (masterPtr->format != oldFormat))) {
+ if ((modelPtr->fileString != NULL)
+ && ((modelPtr->fileString != oldFileString)
+ || (modelPtr->format != oldFormat))) {
/*
* Prevent file system access in a safe interpreter.
*/
@@ -1942,7 +1943,7 @@ ImgPhotoConfigureMaster(
goto errorExit;
}
- chan = Tcl_OpenFileChannel(interp, masterPtr->fileString, "r", 0);
+ chan = Tcl_OpenFileChannel(interp, modelPtr->fileString, "r", 0);
if (chan == NULL) {
goto errorExit;
}
@@ -1953,13 +1954,13 @@ ImgPhotoConfigureMaster(
if ((Tcl_SetChannelOption(interp, chan,
"-translation", "binary") != TCL_OK) ||
- (MatchFileFormat(interp, chan, masterPtr->fileString,
- masterPtr->format, &imageFormat, &imageWidth,
+ (MatchFileFormat(interp, chan, modelPtr->fileString,
+ modelPtr->format, &imageFormat, &imageWidth,
&imageHeight, &oldformat) != TCL_OK)) {
Tcl_Close(NULL, chan);
goto errorExit;
}
- result = ImgPhotoSetSize(masterPtr, imageWidth, imageHeight);
+ result = ImgPhotoSetSize(modelPtr, imageWidth, imageHeight);
if (result != TCL_OK) {
Tcl_Close(NULL, chan);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -1967,12 +1968,12 @@ ImgPhotoConfigureMaster(
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
goto errorExit;
}
- tempformat = masterPtr->format;
+ tempformat = modelPtr->format;
if (oldformat && tempformat) {
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
}
result = imageFormat->fileReadProc(interp, chan,
- masterPtr->fileString, tempformat, (Tk_PhotoHandle) masterPtr,
+ modelPtr->fileString, tempformat, (Tk_PhotoHandle) modelPtr,
0, 0, imageWidth, imageHeight, 0, 0);
Tcl_Close(NULL, chan);
if (result != TCL_OK) {
@@ -1980,26 +1981,26 @@ ImgPhotoConfigureMaster(
}
Tcl_ResetResult(interp);
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
}
- if ((masterPtr->fileString == NULL) && (masterPtr->dataString != NULL)
- && ((masterPtr->dataString != oldData)
- || (masterPtr->format != oldFormat))) {
+ if ((modelPtr->fileString == NULL) && (modelPtr->dataString != NULL)
+ && ((modelPtr->dataString != oldData)
+ || (modelPtr->format != oldFormat))) {
- if (MatchStringFormat(interp, masterPtr->dataString,
- masterPtr->format, &imageFormat, &imageWidth,
+ if (MatchStringFormat(interp, modelPtr->dataString,
+ modelPtr->format, &imageFormat, &imageWidth,
&imageHeight, &oldformat) != TCL_OK) {
goto errorExit;
}
- if (ImgPhotoSetSize(masterPtr, imageWidth, imageHeight) != TCL_OK) {
+ if (ImgPhotoSetSize(modelPtr, imageWidth, imageHeight) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
goto errorExit;
}
- tempformat = masterPtr->format;
- tempdata = masterPtr->dataString;
+ tempformat = modelPtr->format;
+ tempdata = modelPtr->dataString;
if (oldformat) {
if (tempformat) {
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
@@ -2007,26 +2008,26 @@ ImgPhotoConfigureMaster(
tempdata = (Tcl_Obj *) Tcl_GetString(tempdata);
}
if (imageFormat->stringReadProc(interp, tempdata, tempformat,
- (Tk_PhotoHandle) masterPtr, 0, 0, imageWidth, imageHeight,
+ (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight,
0, 0) != TCL_OK) {
goto errorExit;
}
Tcl_ResetResult(interp);
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
}
/*
* Enforce a reasonable value for gamma.
*/
- if (masterPtr->gamma <= 0) {
- masterPtr->gamma = 1.0;
+ if (modelPtr->gamma <= 0) {
+ modelPtr->gamma = 1.0;
}
- if ((masterPtr->gamma != oldGamma)
- || (masterPtr->palette != oldPaletteString)) {
- masterPtr->flags |= IMAGE_CHANGED;
+ if ((modelPtr->gamma != oldGamma)
+ || (modelPtr->palette != oldPaletteString)) {
+ modelPtr->flags |= IMAGE_CHANGED;
}
/*
@@ -2035,7 +2036,7 @@ ImgPhotoConfigureMaster(
* everywhere that it is used.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgPhotoConfigureInstance(instancePtr);
}
@@ -2044,9 +2045,9 @@ ImgPhotoConfigureMaster(
* Inform the generic image code that the image has (potentially) changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
- masterPtr->flags &= ~IMAGE_CHANGED;
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
+ modelPtr->flags &= ~IMAGE_CHANGED;
if (oldData != NULL) {
Tcl_DecrRefCount(oldData);
@@ -2055,7 +2056,7 @@ ImgPhotoConfigureMaster(
Tcl_DecrRefCount(oldFormat);
}
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
return TCL_OK;
@@ -2082,14 +2083,14 @@ ImgPhotoConfigureMaster(
* None.
*
* Side effects:
- * (Re)sets COMPLEX_ALPHA flag of master.
+ * (Re)sets COMPLEX_ALPHA flag of model.
*
*----------------------------------------------------------------------
*/
static int
ToggleComplexAlphaIfNeeded(
- PhotoMaster *mPtr)
+ PhotoModel *mPtr)
{
size_t len = (size_t)MAX(mPtr->userWidth, mPtr->width) *
(size_t)MAX(mPtr->userHeight, mPtr->height) * 4;
@@ -2120,7 +2121,7 @@ ToggleComplexAlphaIfNeeded(
*
* ImgPhotoDelete --
*
- * This function is called by the image code to delete the master
+ * This function is called by the image code to delete the model
* structure for an image.
*
* Results:
@@ -2134,37 +2135,37 @@ ToggleComplexAlphaIfNeeded(
static void
ImgPhotoDelete(
- ClientData masterData) /* Pointer to PhotoMaster structure for image.
+ ClientData modelData) /* Pointer to PhotoModel structure for image.
* Must not have any more instances. */
{
- PhotoMaster *masterPtr = masterData;
+ PhotoModel *modelPtr = (PhotoModel *)modelData;
PhotoInstance *instancePtr;
- while ((instancePtr = masterPtr->instancePtr) != NULL) {
+ while ((instancePtr = modelPtr->instancePtr) != NULL) {
if (instancePtr->refCount > 0) {
Tcl_Panic("tried to delete photo image when instances still exist");
}
Tcl_CancelIdleCall(TkImgDisposeInstance, instancePtr);
TkImgDisposeInstance(instancePtr);
}
- masterPtr->tkMaster = NULL;
- if (masterPtr->imageCmd != NULL) {
- Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd);
+ modelPtr->tkMaster = NULL;
+ if (modelPtr->imageCmd != NULL) {
+ Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd);
}
- if (masterPtr->pix32 != NULL) {
- ckfree(masterPtr->pix32);
+ if (modelPtr->pix32 != NULL) {
+ ckfree(modelPtr->pix32);
}
- if (masterPtr->validRegion != NULL) {
- TkDestroyRegion(masterPtr->validRegion);
+ if (modelPtr->validRegion != NULL) {
+ TkDestroyRegion(modelPtr->validRegion);
}
- if (masterPtr->dataString != NULL) {
- Tcl_DecrRefCount(masterPtr->dataString);
+ if (modelPtr->dataString != NULL) {
+ Tcl_DecrRefCount(modelPtr->dataString);
}
- if (masterPtr->format != NULL) {
- Tcl_DecrRefCount(masterPtr->format);
+ if (modelPtr->format != NULL) {
+ Tcl_DecrRefCount(modelPtr->format);
}
- Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
- ckfree(masterPtr);
+ Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0);
+ ckfree(modelPtr);
}
/*
@@ -2186,14 +2187,14 @@ ImgPhotoDelete(
static void
ImgPhotoCmdDeletedProc(
- ClientData clientData) /* Pointer to PhotoMaster structure for
+ ClientData clientData) /* Pointer to PhotoModel structure for
* image. */
{
- PhotoMaster *masterPtr = clientData;
+ PhotoModel *modelPtr = (PhotoModel *)clientData;
- masterPtr->imageCmd = NULL;
- if (masterPtr->tkMaster != NULL) {
- Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
+ modelPtr->imageCmd = NULL;
+ if (modelPtr->tkMaster != NULL) {
+ Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkMaster));
}
}
@@ -2211,14 +2212,14 @@ ImgPhotoCmdDeletedProc(
* with memory allocation.)
*
* Side effects:
- * Storage gets reallocated, for the master and all its instances.
+ * Storage gets reallocated, for the model and all its instances.
*
*----------------------------------------------------------------------
*/
static int
ImgPhotoSetSize(
- PhotoMaster *masterPtr,
+ PhotoModel *modelPtr,
int width, int height)
{
unsigned char *newPix32 = NULL;
@@ -2228,11 +2229,11 @@ ImgPhotoSetSize(
TkRegion clipRegion;
PhotoInstance *instancePtr;
- if (masterPtr->userWidth > 0) {
- width = masterPtr->userWidth;
+ if (modelPtr->userWidth > 0) {
+ width = modelPtr->userWidth;
}
- if (masterPtr->userHeight > 0) {
- height = masterPtr->userHeight;
+ if (modelPtr->userHeight > 0) {
+ height = modelPtr->userHeight;
}
if (width > INT_MAX / 4) {
@@ -2246,8 +2247,8 @@ ImgPhotoSetSize(
* failures will leave the photo unchanged.
*/
- if ((width != masterPtr->width) || (height != masterPtr->height)
- || (masterPtr->pix32 == NULL)) {
+ if ((width != modelPtr->width) || (height != modelPtr->height)
+ || (modelPtr->pix32 == NULL)) {
unsigned newPixSize;
if (pitch && height > (int)(UINT_MAX / pitch)) {
@@ -2262,7 +2263,7 @@ ImgPhotoSetSize(
if (newPixSize == 0) {
newPix32 = NULL;
} else {
- newPix32 = attemptckalloc(newPixSize);
+ newPix32 = (unsigned char *)attemptckalloc(newPixSize);
if (newPix32 == NULL) {
return TCL_ERROR;
}
@@ -2274,7 +2275,7 @@ ImgPhotoSetSize(
* image size.
*/
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
if ((validBox.x + validBox.width > width)
|| (validBox.y + validBox.height > height)) {
clipBox.x = 0;
@@ -2283,10 +2284,10 @@ ImgPhotoSetSize(
clipBox.height = height;
clipRegion = TkCreateRegion();
TkUnionRectWithRegion(&clipBox, clipRegion, clipRegion);
- TkIntersectRegion(masterPtr->validRegion, clipRegion,
- masterPtr->validRegion);
+ TkIntersectRegion(modelPtr->validRegion, clipRegion,
+ modelPtr->validRegion);
TkDestroyRegion(clipRegion);
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
}
/*
@@ -2302,8 +2303,8 @@ ImgPhotoSetSize(
* or written to a file.
*/
- if ((masterPtr->pix32 != NULL)
- && ((width == masterPtr->width) || (width == validBox.width))) {
+ if ((modelPtr->pix32 != NULL)
+ && ((width == modelPtr->width) || (width == validBox.width))) {
if (validBox.y > 0) {
memset(newPix32, 0, ((size_t) validBox.y * pitch));
}
@@ -2315,20 +2316,20 @@ ImgPhotoSetSize(
memset(newPix32, 0, ((size_t)height * pitch));
}
- if (masterPtr->pix32 != NULL) {
+ if (modelPtr->pix32 != NULL) {
/*
* Copy the common area over to the new array array and free the
* old array.
*/
- if (width == masterPtr->width) {
+ if (width == modelPtr->width) {
/*
* The region to be copied is contiguous.
*/
offset = validBox.y * pitch;
- memcpy(newPix32 + offset, masterPtr->pix32 + offset,
+ memcpy(newPix32 + offset, modelPtr->pix32 + offset,
((size_t)validBox.height * pitch));
} else if ((validBox.width > 0) && (validBox.height > 0)) {
@@ -2337,21 +2338,21 @@ ImgPhotoSetSize(
*/
destPtr = newPix32 + (validBox.y * width + validBox.x) * 4;
- srcPtr = masterPtr->pix32 + (validBox.y * masterPtr->width
+ srcPtr = modelPtr->pix32 + (validBox.y * modelPtr->width
+ validBox.x) * 4;
for (h = validBox.height; h > 0; h--) {
memcpy(destPtr, srcPtr, ((size_t)validBox.width * 4));
destPtr += width * 4;
- srcPtr += masterPtr->width * 4;
+ srcPtr += modelPtr->width * 4;
}
}
- ckfree(masterPtr->pix32);
+ ckfree(modelPtr->pix32);
}
- masterPtr->pix32 = newPix32;
- masterPtr->width = width;
- masterPtr->height = height;
+ modelPtr->pix32 = newPix32;
+ modelPtr->width = width;
+ modelPtr->height = height;
/*
* Dithering will be correct up to the end of the last pre-existing
@@ -2359,27 +2360,27 @@ ImgPhotoSetSize(
*/
if ((validBox.x > 0) || (validBox.y > 0)) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY = 0;
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = 0;
} else if (validBox.width == width) {
- if ((int) validBox.height < masterPtr->ditherY) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY = validBox.height;
+ if ((int) validBox.height < modelPtr->ditherY) {
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = validBox.height;
}
- } else if ((masterPtr->ditherY > 0)
- || ((int) validBox.width < masterPtr->ditherX)) {
- masterPtr->ditherX = validBox.width;
- masterPtr->ditherY = 0;
+ } else if ((modelPtr->ditherY > 0)
+ || ((int) validBox.width < modelPtr->ditherX)) {
+ modelPtr->ditherX = validBox.width;
+ modelPtr->ditherY = 0;
}
}
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
/*
* Now adjust the sizes of the pixmaps for all of the instances.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgPhotoInstanceSetSize(instancePtr);
}
@@ -2425,7 +2426,7 @@ MatchFileFormat(
{
int matched = 0, useoldformat = 0;
Tk_PhotoImageFormat *formatPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
const char *formatString = NULL;
@@ -2565,7 +2566,7 @@ MatchStringFormat(
{
int matched = 0, useoldformat = 0;
Tk_PhotoImageFormat *formatPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
const char *formatString = NULL;
@@ -2658,7 +2659,7 @@ MatchStringFormat(
* Tk_FindPhoto --
*
* This function is called to get an opaque handle (actually a
- * PhotoMaster *) for a given image, which can be used in subsequent
+ * PhotoModel *) for a given image, which can be used in subsequent
* calls to Tk_PhotoPutBlock, etc. The `name' parameter is the name of
* the image.
*
@@ -2723,7 +2724,7 @@ Tk_PhotoPutBlock(
int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- register PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
Tk_PhotoImageBlock sourceBlock;
unsigned char *memToFree;
int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
@@ -2742,12 +2743,12 @@ Tk_PhotoPutBlock(
compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO;
- if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
- width = masterPtr->userWidth - x;
+ if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) {
+ width = modelPtr->userWidth - x;
}
- if ((masterPtr->userHeight != 0)
- && ((y + height) > masterPtr->userHeight)) {
- height = masterPtr->userHeight - y;
+ if ((modelPtr->userHeight != 0)
+ && ((y + height) > modelPtr->userHeight)) {
+ height = modelPtr->userHeight - y;
}
if ((width <= 0) || (height <= 0)) {
return TCL_OK;
@@ -2768,11 +2769,24 @@ Tk_PhotoPutBlock(
*/
sourceBlock = *blockPtr;
memToFree = NULL;
- if (sourceBlock.pixelPtr >= masterPtr->pix32
- && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width
- * masterPtr->height * 4) {
- sourceBlock.pixelPtr = attemptckalloc(sourceBlock.height
- * sourceBlock.pitch);
+ if (sourceBlock.pixelPtr >= modelPtr->pix32
+ && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width
+ * modelPtr->height * 4) {
+ /*
+ * Fix 5c51be6411: avoid reading
+ *
+ * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize)
+ *
+ * bytes past the end of modelPtr->pix32[] when
+ *
+ * blockPtr->pixelPtr > (modelPtr->pix32 +
+ * 4 * modelPtr->width * modelPtr->height -
+ * sourceBlock.height * sourceBlock.pitch)
+ */
+ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch +
+ sourceBlock.width * sourceBlock.pixelSize;
+
+ sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen);
if (sourceBlock.pixelPtr == NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -2782,16 +2796,15 @@ Tk_PhotoPutBlock(
return TCL_ERROR;
}
memToFree = sourceBlock.pixelPtr;
- memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, sourceBlock.height
- * sourceBlock.pitch);
+ memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, cpyLen);
}
xEnd = x + width;
yEnd = y + height;
- if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
- MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
+ if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width),
+ MAX(yEnd, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -2801,14 +2814,14 @@ Tk_PhotoPutBlock(
}
}
- if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
- && (x < masterPtr->ditherX))) {
+ if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY)
+ && (x < modelPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
- masterPtr->ditherX = x;
- masterPtr->ditherY = y;
+ modelPtr->ditherX = x;
+ modelPtr->ditherY = y;
}
/*
@@ -2826,7 +2839,7 @@ Tk_PhotoPutBlock(
alphaOffset -= sourceBlock.offset[0];
}
if ((greenOffset != 0) || (blueOffset != 0)) {
- masterPtr->flags |= COLOR_IMAGE;
+ modelPtr->flags |= COLOR_IMAGE;
}
/*
@@ -2834,8 +2847,8 @@ Tk_PhotoPutBlock(
* single memmove, we do.
*/
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
- pitch = masterPtr->width * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
+ pitch = modelPtr->width * 4;
/*
* Test to see if we can do the whole write in a single copy. This test is
@@ -2846,7 +2859,7 @@ Tk_PhotoPutBlock(
if ((sourceBlock.pixelSize == 4)
&& (greenOffset == 1) && (blueOffset == 2) && (alphaOffset == 3)
&& (width <= sourceBlock.width) && (height <= sourceBlock.height)
- && ((height == 1) || ((x == 0) && (width == masterPtr->width)
+ && ((height == 1) || ((x == 0) && (width == modelPtr->width)
&& (sourceBlock.pitch == pitch)))
&& (compRule == TK_PHOTO_COMPOSITE_SET)) {
memmove(destLinePtr, sourceBlock.pixelPtr + sourceBlock.offset[0],
@@ -3028,8 +3041,8 @@ Tk_PhotoPutBlock(
rect.width = width;
rect.height = height;
TkUnionRectWithRegion(&rect, workRgn, workRgn);
- TkSubtractRegion(masterPtr->validRegion, workRgn,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, workRgn,
+ modelPtr->validRegion);
TkDestroyRegion(workRgn);
}
@@ -3038,17 +3051,17 @@ Tk_PhotoPutBlock(
* allow for more efficient per-platform implementations. [Bug 919066]
*/
- TkpBuildRegionFromAlphaData(masterPtr->validRegion, (unsigned) x,
+ TkpBuildRegionFromAlphaData(modelPtr->validRegion, (unsigned) x,
(unsigned) y, (unsigned) width, (unsigned) height,
- masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3,
- 4, (unsigned) masterPtr->width * 4);
+ modelPtr->pix32 + (y * modelPtr->width + x) * 4 + 3,
+ 4, (unsigned) modelPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&rect, modelPtr->validRegion,
+ modelPtr->validRegion);
}
/*
@@ -3063,21 +3076,21 @@ Tk_PhotoPutBlock(
* [Patch 1539990]
*/
- if (!(masterPtr->flags & COMPLEX_ALPHA)) {
- register int x1;
+ if (!(modelPtr->flags & COMPLEX_ALPHA)) {
+ int x1;
for (x1=x ; x1pix32 + (y*masterPtr->width + x1)*4;
+ destLinePtr = modelPtr->pix32 + (y*modelPtr->width + x1)*4;
newAlpha = destLinePtr[3];
if (newAlpha && newAlpha != 255) {
- masterPtr->flags |= COMPLEX_ALPHA;
+ modelPtr->flags |= COMPLEX_ALPHA;
break;
}
}
}
- } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
+ } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
* rescan if we already knew such pixels existed. To restrict this
@@ -3085,21 +3098,21 @@ Tk_PhotoPutBlock(
* the alpha pixels are.
*/
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
}
/*
* Update each instance.
*/
- Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, x, y, width, height);
+ Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, x, y, width, height);
/*
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height,
+ modelPtr->width, modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3149,8 +3162,8 @@ Tk_PhotoPutZoomedBlock(
int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- register PhotoMaster *masterPtr = (PhotoMaster *) handle;
- register Tk_PhotoImageBlock sourceBlock;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
+ Tk_PhotoImageBlock sourceBlock;
unsigned char *memToFree;
int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
int wLeft, hLeft, wCopy, hCopy, blockWid, blockHt;
@@ -3177,12 +3190,12 @@ Tk_PhotoPutZoomedBlock(
if (zoomX <= 0 || zoomY <= 0) {
return TCL_OK;
}
- if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
- width = masterPtr->userWidth - x;
+ if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) {
+ width = modelPtr->userWidth - x;
}
- if ((masterPtr->userHeight != 0)
- && ((y + height) > masterPtr->userHeight)) {
- height = masterPtr->userHeight - y;
+ if ((modelPtr->userHeight != 0)
+ && ((y + height) > modelPtr->userHeight)) {
+ height = modelPtr->userHeight - y;
}
if (width <= 0 || height <= 0) {
return TCL_OK;
@@ -3202,11 +3215,24 @@ Tk_PhotoPutZoomedBlock(
*/
sourceBlock = *blockPtr;
memToFree = NULL;
- if (sourceBlock.pixelPtr >= masterPtr->pix32
- && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width
- * masterPtr->height * 4) {
- sourceBlock.pixelPtr = attemptckalloc(sourceBlock.height
- * sourceBlock.pitch);
+ if (sourceBlock.pixelPtr >= modelPtr->pix32
+ && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width
+ * modelPtr->height * 4) {
+ /*
+ * Fix 5c51be6411: avoid reading
+ *
+ * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize)
+ *
+ * bytes past the end of modelPtr->pix32[] when
+ *
+ * blockPtr->pixelPtr > (modelPtr->pix32 +
+ * 4 * modelPtr->width * modelPtr->height -
+ * sourceBlock.height * sourceBlock.pitch)
+ */
+ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch +
+ sourceBlock.width * sourceBlock.pixelSize;
+
+ sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen);
if (sourceBlock.pixelPtr == NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -3216,15 +3242,14 @@ Tk_PhotoPutZoomedBlock(
return TCL_ERROR;
}
memToFree = sourceBlock.pixelPtr;
- memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, sourceBlock.height
- * sourceBlock.pitch);
+ memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, cpyLen);
}
xEnd = x + width;
yEnd = y + height;
- if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
- MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
+ if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width),
+ MAX(yEnd, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3234,14 +3259,14 @@ Tk_PhotoPutZoomedBlock(
}
}
- if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
- && (x < masterPtr->ditherX))) {
+ if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY)
+ && (x < modelPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
- masterPtr->ditherX = x;
- masterPtr->ditherY = y;
+ modelPtr->ditherX = x;
+ modelPtr->ditherY = y;
}
/*
@@ -3259,7 +3284,7 @@ Tk_PhotoPutZoomedBlock(
alphaOffset -= sourceBlock.offset[0];
}
if ((greenOffset != 0) || (blueOffset != 0)) {
- masterPtr->flags |= COLOR_IMAGE;
+ modelPtr->flags |= COLOR_IMAGE;
}
/*
@@ -3288,7 +3313,7 @@ Tk_PhotoPutZoomedBlock(
* Copy the data into our local 32-bit/pixel array.
*/
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
srcOrigPtr = sourceBlock.pixelPtr + sourceBlock.offset[0];
if (subsampleX < 0) {
srcOrigPtr += (sourceBlock.width - 1) * sourceBlock.pixelSize;
@@ -3297,7 +3322,7 @@ Tk_PhotoPutZoomedBlock(
srcOrigPtr += (sourceBlock.height - 1) * sourceBlock.pitch;
}
- pitch = masterPtr->width * 4;
+ pitch = modelPtr->width * 4;
for (hLeft = height; hLeft > 0; ) {
hCopy = MIN(hLeft, blockHt);
hLeft -= hCopy;
@@ -3384,22 +3409,22 @@ Tk_PhotoPutZoomedBlock(
rect.width = width;
rect.height = 1;
TkUnionRectWithRegion(&rect, workRgn, workRgn);
- TkSubtractRegion(masterPtr->validRegion, workRgn,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, workRgn,
+ modelPtr->validRegion);
TkDestroyRegion(workRgn);
}
- TkpBuildRegionFromAlphaData(masterPtr->validRegion,
+ TkpBuildRegionFromAlphaData(modelPtr->validRegion,
(unsigned)x, (unsigned)y, (unsigned)width, (unsigned)height,
- &masterPtr->pix32[(y * masterPtr->width + x) * 4 + 3], 4,
- (unsigned) masterPtr->width * 4);
+ &modelPtr->pix32[(y * modelPtr->width + x) * 4 + 3], 4,
+ (unsigned) modelPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&rect, modelPtr->validRegion,
+ modelPtr->validRegion);
}
/*
@@ -3412,38 +3437,38 @@ Tk_PhotoPutZoomedBlock(
* builds up large simple-alpha images by single pixels. We don't
* negate COMPLEX_ALPHA in this case. [Bug 1409140]
*/
- if (!(masterPtr->flags & COMPLEX_ALPHA)) {
+ if (!(modelPtr->flags & COMPLEX_ALPHA)) {
unsigned char newAlpha;
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
newAlpha = destLinePtr[3];
if (newAlpha && newAlpha != 255) {
- masterPtr->flags |= COMPLEX_ALPHA;
+ modelPtr->flags |= COMPLEX_ALPHA;
}
}
- } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
+ } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
* rescan if we already knew such pixels existed. To restrict this
* Toggle to only checking the changed pixels requires knowing where
* the alpha pixels are.
*/
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
}
/*
* Update each instance.
*/
- Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y, width, height);
+ Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y, width, height);
/*
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height, modelPtr->width,
+ modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3461,14 +3486,14 @@ Tk_PhotoPutZoomedBlock(
* Tk_DitherPhoto --
*
* This function is called to update an area of each instance's pixmap by
- * dithering the corresponding area of the image master.
+ * dithering the corresponding area of the image model.
*
* Results:
* None.
*
* Side effects:
* The pixmap of each instance of this image gets updated. The fields in
- * *masterPtr indicating which area of the image is correctly dithered
+ * *modelPtr indicating which area of the image is correctly dithered
* get updated.
*
*----------------------------------------------------------------------
@@ -3476,20 +3501,20 @@ Tk_PhotoPutZoomedBlock(
void
Tk_DitherPhoto(
- Tk_PhotoHandle photo, /* Image master whose instances are to be
+ Tk_PhotoHandle photo, /* Image model whose instances are to be
* updated. */
int x, int y, /* Coordinates of the top-left pixel in the
* area to be dithered. */
int width, int height) /* Dimensions of the area to be dithered. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) photo;
+ PhotoModel *modelPtr = (PhotoModel *) photo;
PhotoInstance *instancePtr;
if ((width <= 0) || (height <= 0)) {
return;
}
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgDitherInstance(instancePtr, x, y, width, height);
}
@@ -3499,23 +3524,23 @@ Tk_DitherPhoto(
* will extend the correctly dithered region.
*/
- if (((y < masterPtr->ditherY)
- || ((y == masterPtr->ditherY) && (x <= masterPtr->ditherX)))
- && ((y + height) > (masterPtr->ditherY))) {
+ if (((y < modelPtr->ditherY)
+ || ((y == modelPtr->ditherY) && (x <= modelPtr->ditherX)))
+ && ((y + height) > (modelPtr->ditherY))) {
/*
* This block starts inside (or immediately after) the correctly
* dithered region, so the first scan line at least will be right.
- * Furthermore this block extends into scanline masterPtr->ditherY.
+ * Furthermore this block extends into scanline modelPtr->ditherY.
*/
- if ((x == 0) && (width == masterPtr->width)) {
+ if ((x == 0) && (width == modelPtr->width)) {
/*
* We are doing the full width, therefore the dithering will be
* correct to the end.
*/
- masterPtr->ditherX = 0;
- masterPtr->ditherY = y + height;
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = y + height;
} else {
/*
* We are doing partial scanlines, therefore the
@@ -3523,11 +3548,11 @@ Tk_DitherPhoto(
* line.
*/
- if (x <= masterPtr->ditherX) {
- masterPtr->ditherX = x + width;
- if (masterPtr->ditherX >= masterPtr->width) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY++;
+ if (x <= modelPtr->ditherX) {
+ modelPtr->ditherX = x + width;
+ if (modelPtr->ditherX >= modelPtr->width) {
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY++;
}
}
}
@@ -3555,29 +3580,29 @@ void
Tk_PhotoBlank(
Tk_PhotoHandle handle) /* Handle for the image to be blanked. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
PhotoInstance *instancePtr;
- masterPtr->ditherX = masterPtr->ditherY = 0;
- masterPtr->flags = 0;
+ modelPtr->ditherX = modelPtr->ditherY = 0;
+ modelPtr->flags = 0;
/*
* The image has valid data nowhere.
*/
- if (masterPtr->validRegion != NULL) {
- TkDestroyRegion(masterPtr->validRegion);
+ if (modelPtr->validRegion != NULL) {
+ TkDestroyRegion(modelPtr->validRegion);
}
- masterPtr->validRegion = TkCreateRegion();
+ modelPtr->validRegion = TkCreateRegion();
/*
* Clear out the 32-bit pixel storage array. Clear out the dithering error
* arrays for each instance.
*/
- memset(masterPtr->pix32, 0,
- ((size_t)masterPtr->width * masterPtr->height * 4));
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ memset(modelPtr->pix32, 0,
+ ((size_t)modelPtr->width * modelPtr->height * 4));
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgResetDither(instancePtr);
}
@@ -3586,8 +3611,8 @@ Tk_PhotoBlank(
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
}
/*
@@ -3617,17 +3642,17 @@ Tk_PhotoExpand(
Tk_PhotoHandle handle, /* Handle for the image to be expanded. */
int width, int height) /* Desired minimum dimensions of the image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- if (width <= masterPtr->width) {
- width = masterPtr->width;
+ if (width <= modelPtr->width) {
+ width = modelPtr->width;
}
- if (height <= masterPtr->height) {
- height = masterPtr->height;
+ if (height <= modelPtr->height) {
+ height = modelPtr->height;
}
- if ((width != masterPtr->width) || (height != masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(width, masterPtr->width),
- MAX(height, masterPtr->height)) == TCL_ERROR) {
+ if ((width != modelPtr->width) || (height != modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(width, modelPtr->width),
+ MAX(height, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3635,8 +3660,8 @@ Tk_PhotoExpand(
}
return TCL_ERROR;
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, modelPtr->width,
+ modelPtr->height);
}
return TCL_OK;
}
@@ -3665,10 +3690,10 @@ Tk_PhotoGetSize(
/* The dimensions of the image are returned
* here. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- *widthPtr = masterPtr->width;
- *heightPtr = masterPtr->height;
+ *widthPtr = modelPtr->width;
+ *heightPtr = modelPtr->height;
}
/*
@@ -3697,12 +3722,12 @@ Tk_PhotoSetSize(
* set. */
int width, int height) /* New dimensions for the image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- masterPtr->userWidth = width;
- masterPtr->userHeight = height;
- if (ImgPhotoSetSize(masterPtr, ((width > 0) ? width: masterPtr->width),
- ((height > 0) ? height: masterPtr->height)) == TCL_ERROR) {
+ modelPtr->userWidth = width;
+ modelPtr->userHeight = height;
+ if (ImgPhotoSetSize(modelPtr, ((width > 0) ? width: modelPtr->width),
+ ((height > 0) ? height: modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3710,8 +3735,8 @@ Tk_PhotoSetSize(
}
return TCL_ERROR;
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
return TCL_OK;
}
@@ -3740,9 +3765,9 @@ TkPhotoGetValidRegion(
Tk_PhotoHandle handle) /* Handle for the image whose valid region is
* to obtained. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- return masterPtr->validRegion;
+ return modelPtr->validRegion;
}
/*
@@ -3768,7 +3793,7 @@ TkPhotoGetValidRegion(
static char *
ImgGetPhoto(
- PhotoMaster *masterPtr, /* Handle for the photo image from which image
+ PhotoModel *modelPtr, /* Handle for the photo image from which image
* data is desired. */
Tk_PhotoImageBlock *blockPtr,
/* Information about the address and layout of
@@ -3778,13 +3803,13 @@ ImgGetPhoto(
unsigned char *pixelPtr;
int x, y, greenOffset, blueOffset, alphaOffset;
- Tk_PhotoGetImage((Tk_PhotoHandle) masterPtr, blockPtr);
+ Tk_PhotoGetImage((Tk_PhotoHandle) modelPtr, blockPtr);
blockPtr->pixelPtr += optPtr->fromY * blockPtr->pitch
+ optPtr->fromX * blockPtr->pixelSize;
blockPtr->width = optPtr->fromX2 - optPtr->fromX;
blockPtr->height = optPtr->fromY2 - optPtr->fromY;
- if (!(masterPtr->flags & COLOR_IMAGE) &&
+ if (!(modelPtr->flags & COLOR_IMAGE) &&
(!(optPtr->options & OPT_BACKGROUND)
|| ((optPtr->background->red == optPtr->background->green)
&& (optPtr->background->red == optPtr->background->blue)))) {
@@ -3812,7 +3837,7 @@ ImgGetPhoto(
blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
if (((optPtr->options & OPT_BACKGROUND) && alphaOffset) ||
((optPtr->options & OPT_GRAYSCALE) && (greenOffset||blueOffset))) {
- int newPixelSize,x,y;
+ int newPixelSize;
unsigned char *srcPtr, *destPtr;
char *data;
@@ -3825,7 +3850,7 @@ ImgGetPhoto(
if (blockPtr->height > (int)((UINT_MAX/newPixelSize)/blockPtr->width)) {
return NULL;
}
- data = attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height);
+ data = (char *)attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height);
if (data == NULL) {
return NULL;
}
@@ -4016,12 +4041,12 @@ Tk_PhotoGetImage(
/* Information about the address and layout of
* the image data is returned here. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- blockPtr->pixelPtr = masterPtr->pix32;
- blockPtr->width = masterPtr->width;
- blockPtr->height = masterPtr->height;
- blockPtr->pitch = masterPtr->width * 4;
+ blockPtr->pixelPtr = modelPtr->pix32;
+ blockPtr->width = modelPtr->width;
+ blockPtr->height = modelPtr->height;
+ blockPtr->pitch = modelPtr->width * 4;
blockPtr->pixelSize = 4;
blockPtr->offset[0] = 0;
blockPtr->offset[1] = 1;
@@ -4033,7 +4058,7 @@ Tk_PhotoGetImage(
/*
*--------------------------------------------------------------
*
- * TkPostscriptPhoto --
+ * ImgPostscriptPhoto --
*
* This function is called to output the contents of a photo image in
* Postscript by calling the Tk_PostscriptPhoto function.
@@ -4051,11 +4076,11 @@ static int
ImgPhotoPostscript(
ClientData clientData, /* Handle for the photo image. */
Tcl_Interp *interp, /* Interpreter. */
- Tk_Window tkwin, /* (unused) */
+ TCL_UNUSED(Tk_Window), /* (unused) */
Tk_PostscriptInfo psInfo, /* Postscript info. */
int x, int y, /* First pixel to output. */
int width, int height, /* Width and height of area. */
- int prepass) /* (unused) */
+ TCL_UNUSED(int)) /* (unused) */
{
Tk_PhotoImageBlock block;
@@ -4070,7 +4095,7 @@ ImgPhotoPostscript(
*
* Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite --
*
- * These backward-compatability functions just exist to fill slots in stubs
+ * These backward-compatibility functions just exist to fill slots in stubs
* table. For the behaviour of *_NoComposite, refer to the corresponding
* function without the extra suffix, except that the compositing rule is
* always "overlay" and the function always panics on memory-allocation
@@ -4111,7 +4136,7 @@ Tk_PhotoPutZoomedBlock_NoComposite(
* Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic,
* Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic
*
- * Backward compatability functions for preserving the old behaviour (i.e.
+ * Backward compatibility functions for preserving the old behaviour (i.e.
* panic on memory allocation failure) so that extensions do not need to be
* significantly updated to take account of TIP #116. These call the new
* interface (i.e. the interface without the extra suffix), but panic if an
@@ -4170,5 +4195,6 @@ Tk_PhotoSetSize_Panic(
* mode: c
* c-basic-offset: 4
* fill-column: 78
+ * tab-width: 8
* End:
*/
diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h
index 36bc6cba..994fa402 100644
--- a/generic/tkImgPhoto.h
+++ b/generic/tkImgPhoto.h
@@ -27,6 +27,7 @@
* Forward declarations of the structures we define.
*/
+#define PhotoModel PhotoMaster
typedef struct ColorTableId ColorTableId;
typedef struct ColorTable ColorTable;
typedef struct PhotoInstance PhotoInstance;
@@ -137,11 +138,11 @@ struct ColorTable {
#define MAP_COLORS 8
/*
- * Definition of the data associated with each photo image master.
+ * Definition of the data associated with each photo image model.
*/
struct PhotoMaster {
- Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the
+ Tk_ImageMaster tkMaster; /* Tk's token for image model. NULL means the
* image is being deleted. */
Tcl_Interp *interp; /* Interpreter associated with the application
* using this image. */
@@ -164,7 +165,7 @@ struct PhotoMaster {
TkRegion validRegion; /* Tk region indicating which parts of the
* image have valid image data. */
PhotoInstance *instancePtr; /* First in the list of instances associated
- * with this master. */
+ * with this model. */
};
/*
@@ -195,17 +196,17 @@ struct PhotoMaster {
*/
struct PhotoInstance {
- PhotoMaster *masterPtr; /* Pointer to master for image. */
+ PhotoMaster *masterPtr; /* Pointer to model for image. */
Display *display; /* Display for windows using this instance. */
Colormap colormap; /* The image may only be used in windows with
* this particular colormap. */
PhotoInstance *nextPtr; /* Pointer to the next instance in the list of
- * instances associated with this master. */
+ * instances associated with this model. */
int refCount; /* Number of instances using this structure. */
Tk_Uid palette; /* Palette for these particular instances. */
double gamma; /* Gamma value for these instances. */
Tk_Uid defaultPalette; /* Default palette to use if a palette is not
- * specified for the master. */
+ * specified for the model. */
ColorTable *colorTablePtr; /* Pointer to information about colors
* allocated for image display in windows like
* this one. */
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 4c8ce38b..2faf4102 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -634,6 +634,15 @@ declare 184 {
Tk_Font tkfont, const char *source, int numBytes, double x,
double y, double angle)
}
+
+# Support for aqua's inability to draw outside [NSView drawRect:]
+declare 185 macosx {
+ void TkpRedrawWidget(Tk_Window tkwin)
+}
+declare 186 macosx {
+ int TkpWillDrawWidget(Tk_Window tkwin)
+}
+
##############################################################################
@@ -648,10 +657,9 @@ interface tkIntPlat
declare 0 x11 {
void TkCreateXEventSource(void)
}
-#
-# Slot 1 unused (WAS: TkFreeWindowId)
-# Slot 2 unused (WAS: TkInitXId)
-#
+declare 2 x11 {
+ void TkGenerateActivateEvents(TkWindow *winPtr, int active)
+}
declare 3 x11 {
int TkpCmapStressed(Tk_Window tkwin, Colormap colormap)
}
@@ -676,9 +684,6 @@ declare 9 x11 {
declare 10 x11 {
void TkSendCleanup(TkDisplay *dispPtr)
}
-#
-# Slot 11 unused (WAS: TkFreeXId)
-#
declare 12 x11 {
int TkpWmSetState(TkWindow *winPtr, int state)
}
@@ -687,6 +692,32 @@ declare 13 x11 {
int TkpTestsendCmd(ClientData clientData, Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[])
}
+declare 38 x11 {
+ int TkpCmapStressed_(Tk_Window tkwin, Colormap colormap)
+}
+declare 39 x11 {
+ void TkpSync_(Display *display)
+}
+declare 40 x11 {
+ Window TkUnixContainerId_(TkWindow *winPtr)
+}
+declare 41 x11 {
+ int TkUnixDoOneXEvent_(Tcl_Time *timePtr)
+}
+declare 42 x11 {
+ void TkUnixSetMenubar_(Tk_Window tkwin, Tk_Window menubar)
+}
+declare 43 x11 {
+ void TkWmCleanup_(TkDisplay *dispPtr)
+}
+declare 44 x11 {
+ void TkSendCleanup_(TkDisplay *dispPtr)
+}
+# only needed by tktest:
+declare 45 x11 {
+ int TkpTestsendCmd_(ClientData clientData, Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[])
+}
################################
# Windows specific functions
@@ -854,16 +885,9 @@ declare 47 win {
declare 0 aqua {
void TkGenerateActivateEvents(TkWindow *winPtr, int active)
}
-
-# removed duplicates from tkInt table
-#declare 1 aqua {
-# Pixmap TkpCreateNativeBitmap(Display *display, const void *source)
-#}
-#
-#declare 2 aqua {
-# void TkpDefineNativeBitmaps(void)
-#}
-
+declare 2 aqua {
+ void TkGenerateActivateEvents_(TkWindow *winPtr, int active)
+}
declare 3 aqua {
void TkPointerDeadWindow(TkWindow *winPtr)
}
@@ -894,21 +918,9 @@ declare 11 aqua {
declare 12 aqua {
void TkMacOSXHandleTearoffMenu(void)
}
-
-# removed duplicate from tkPlat table(tk.decls)
-#declare 13 aqua {
-# void TkMacOSXInvalClipRgns(TkWindow *winPtr)
-#}
-
declare 14 aqua {
int TkMacOSXDoHLEvent(void *theEvent)
}
-
-# removed duplicate from tkPlat table(tk.decls)
-#declare 15 aqua {
-# void *TkMacOSXGetDrawablePort(Drawable drawable)
-#}
-
declare 16 aqua {
Window TkMacOSXGetXWindow(void *macWinPtr)
}
@@ -944,9 +956,10 @@ declare 24 aqua {
declare 25 aqua {
void TkMacOSXMenuClick(void)
}
-declare 26 aqua {
- void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr)
-}
+# The corresponding Unregister was not a stub, and this should be static.
+#declare 26 aqua {
+# void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr)
+#}
declare 27 aqua {
int TkMacOSXResizable(TkWindow *winPtr)
}
@@ -965,9 +978,10 @@ declare 31 aqua {
declare 32 aqua {
void TkMacOSXUpdateClipRgn(TkWindow *winPtr)
}
-declare 33 aqua {
- void TkMacOSXUnregisterMacWindow(void *portPtr)
-}
+# This was not implemented. Perhaps meant to be OffScreen ?
+#declare 33 aqua {
+# void TkMacOSXUnregisterMacWindow(void *portPtr)
+#}
declare 34 aqua {
int TkMacOSXUseMenuID(short macID)
}
@@ -986,9 +1000,6 @@ declare 38 aqua {
declare 39 aqua {
void TkSetWMName(TkWindow *winPtr, Tk_Uid titleUid)
}
-#
-# Slot 40 unused (WAS: TkSuspendClipboard)
-#
declare 41 aqua {
int TkMacOSXZoomToplevel(void *whichWindow, short zoomPart)
}
@@ -1023,17 +1034,9 @@ declare 51 aqua {
declare 52 aqua {
void TkMacOSXSetDrawingEnabled(TkWindow *winPtr, int flag)
}
-
-# removed duplicate from tkPlat table (tk.decls)
-#declare 52 aqua {
-# void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
-# int width, int height, int flags)
-#}
-
declare 53 aqua {
unsigned long TkpGetMS(void)
}
-
# For Canvas3d, requested by Sean Woods
declare 54 aqua {
void *TkMacOSXDrawable(Drawable drawable)
@@ -1496,6 +1499,9 @@ declare 137 win {
int sx, int sy, int dx, int dy,
unsigned int w, unsigned int h)
}
+declare 158 win {
+ void TkUnusedStubEntry(void)
+}
################################
# X functions for Aqua
@@ -1819,6 +1825,11 @@ declare 90 aqua {
declare 91 aqua {
int XSync(Display *display, Bool discard)
}
+declare 106 aqua {
+ int XSetClipRectangles(Display *display, GC gc, int clip_x_origin,
+ int clip_y_origin, XRectangle rectangles[], int n, int ordering)
+}
+
declare 107 aqua {
int XFlush(Display *display)
}
@@ -1840,11 +1851,35 @@ declare 112 aqua {
declare 114 aqua {
VisualID XVisualIDFromVisual(Visual *visual)
}
+declare 120 aqua {
+ int XOffsetRegion(void *rgn, int dx, int dy)
+}
+declare 129 aqua {
+ int XLowerWindow(Display *d, Window w)
+}
declare 137 aqua {
int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
int sx, int sy, int dx, int dy,
unsigned int w, unsigned int h)
}
+declare 144 aqua {
+ void XDestroyIC(XIC xic)
+}
+declare 145 aqua {
+ Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2,
+ XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2)
+}
+declare 146 aqua {
+ Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2,
+ unsigned int ui1, unsigned int ui2, XColor _Xconst *x1,
+ XColor _Xconst *x2)
+}
+declare 157 aqua {
+ KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i)
+}
+declare 158 aqua {
+ void TkUnusedStubEntry(void)
+}
# Local Variables:
# mode: tcl
diff --git a/generic/tkInt.h b/generic/tkInt.h
index c1bd562d..a98b6d68 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -59,6 +59,41 @@
# endif
#endif
+#ifndef JOIN
+# define JOIN(a,b) JOIN1(a,b)
+# define JOIN1(a,b) a##b
+#endif
+
+#ifndef TCL_UNUSED
+# if defined(__cplusplus)
+# define TCL_UNUSED(T) T
+# elif defined(__GNUC__) && (__GNUC__ > 2)
+# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused))
+# else
+# define TCL_UNUSED(T) T JOIN(dummy, __LINE__)
+# endif
+#endif
+
+#if defined(_WIN32) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7)
+# if TCL_UTF_MAX > 3
+# define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf((TCHAR *)(a),(b)*sizeof(WCHAR),c)
+# define Tcl_UtfToWCharDString(a,b,c) (WCHAR *)Tcl_WinUtfToTChar(a,b,c)
+# else
+# define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString)
+# define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString)
+# endif
+#endif
+
+#if defined(__GNUC__) && (__GNUC__ > 2)
+# define TKFLEXARRAY 0
+#else
+# define TKFLEXARRAY 1
+#endif
+
+#ifndef Tcl_GetParent
+# define Tcl_GetParent Tcl_GetMaster
+#endif
+
/*
* Macros used to cast between pointers and integers (e.g. when storing an int
* in ClientData), on 64-bit architectures they avoid gcc warning about "cast
@@ -328,12 +363,12 @@ typedef struct TkDisplay {
*/
Tcl_HashTable maintainHashTable;
- /* Hash table that maps from a master's
- * Tk_Window token to a list of slaves managed
- * by that master. */
+ /* Hash table that maps from a container's
+ * Tk_Window token to a list of windows managed
+ * by that container. */
int geomInit;
-#define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
+#define TkGetContainer(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr)
/*
@@ -635,7 +670,7 @@ typedef struct TkMainInfo {
/* Top level of option hierarchy for this main
* window. NULL means uninitialized. Managed
* by tkOption.c. */
- Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageMaster
+ Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageModel
* structures. Managed by tkImage.c. */
int strictMotif; /* This is linked to the tk_strictMotif global
* variable. */
@@ -682,7 +717,7 @@ typedef struct TkWindow {
Visual *visual; /* Visual to use for window. If not default,
* MUST be set before X window is created. */
int depth; /* Number of bits/pixel. */
- Window window; /* X's id for window. NULL means window hasn't
+ Window window; /* X's id for window. None means window hasn't
* actually been created yet, or it's been
* deleted. */
struct TkWindow *childList; /* First in list of child windows, or NULL if
@@ -830,9 +865,9 @@ typedef struct TkWindow {
#endif /* TK_USE_INPUT_METHODS */
char *geomMgrName; /* Records the name of the geometry manager. */
struct TkWindow *maintainerPtr;
- /* The geometry master for this window. The
- * value is NULL if the window has no master or
- * if its master is its parent. */
+ /* The geometry container for this window. The
+ * value is NULL if the window has no container or
+ * if its container is its parent. */
} TkWindow;
/*
@@ -842,6 +877,11 @@ typedef struct TkWindow {
typedef struct {
XKeyEvent keyEvent; /* The real event from X11. */
+#ifdef _WIN32
+ char trans_chars[XMaxTransChars];
+ /* translated characters */
+ unsigned char nbytes;
+#elif !defined(MAC_OSX_TK)
char *charValuePtr; /* A pointer to a string that holds the key's
* %A substitution text (before backslash
* adding), or NULL if that has not been
@@ -851,6 +891,7 @@ typedef struct {
* is non-NULL. */
KeySym keysym; /* Key symbol computed after input methods
* have been invoked */
+#endif
} TkKeyEvent;
/*
@@ -950,7 +991,7 @@ typedef struct TkpClipMask {
(Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
-MODULE_SCOPE unsigned long TkGetButtonMask(unsigned int);
+MODULE_SCOPE unsigned TkGetButtonMask(unsigned);
/*
* Object types not declared in tkObj.c need to be mentioned here so they can
@@ -1025,6 +1066,10 @@ void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn));
#include "tkIntDecls.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* Themed widget set init function:
*/
@@ -1180,10 +1225,12 @@ MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp,
MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
Tk_Window tkwin, Tcl_Obj *objPtr,
double *doublePtr);
-MODULE_SCOPE int TkSetGeometryMaster(Tcl_Interp *interp,
- Tk_Window tkwin, const char *master);
-MODULE_SCOPE void TkFreeGeometryMaster(Tk_Window tkwin,
- const char *master);
+#define TkSetGeometryContainer TkSetGeometryMaster
+MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp,
+ Tk_Window tkwin, const char *name);
+#define TkFreeGeometryContainer TkFreeGeometryMaster
+MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin,
+ const char *name);
MODULE_SCOPE void TkEventInit(void);
MODULE_SCOPE void TkRegisterObjTypes(void);
@@ -1221,6 +1268,10 @@ MODULE_SCOPE void TkpDrawCharsInContext(Display * display,
Drawable drawable, GC gc, Tk_Font tkfont,
const char *source, int numBytes, int rangeStart,
int rangeLength, int x, int y);
+MODULE_SCOPE void TkpDrawAngledCharsInContext(Display * display,
+ Drawable drawable, GC gc, Tk_Font tkfont,
+ const char *source, int numBytes, int rangeStart,
+ int rangeLength, double x, double y, double angle);
MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont,
const char *source, int numBytes, int rangeStart,
int rangeLength, int maxLength, int flags,
@@ -1274,9 +1325,13 @@ MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
#if TCL_UTF_MAX > 4
# define TkUtfToUniChar Tcl_UtfToUniChar
# define TkUniCharToUtf Tcl_UniCharToUtf
+# define TkUtfPrev Tcl_UtfPrev
+# define TkUtfAtIndex Tcl_UtfAtIndex
#else
MODULE_SCOPE int TkUtfToUniChar(const char *, int *);
MODULE_SCOPE int TkUniCharToUtf(int, char *);
+ MODULE_SCOPE const char *TkUtfPrev(const char *, const char *);
+ MODULE_SCOPE const char *TkUtfAtIndex(const char *src, int index);
#endif
/*
@@ -1300,6 +1355,10 @@ MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp);
MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp);
#endif
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _TKINT */
/*
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index eb32c007..70574111 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -550,6 +550,14 @@ EXTERN void TkDrawAngledChars(Display *display,
Drawable drawable, GC gc, Tk_Font tkfont,
const char *source, int numBytes, double x,
double y, double angle);
+#ifdef MAC_OSX_TCL /* MACOSX */
+/* 185 */
+EXTERN void TkpRedrawWidget(Tk_Window tkwin);
+#endif /* MACOSX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+/* 186 */
+EXTERN int TkpWillDrawWidget(Tk_Window tkwin);
+#endif /* MACOSX */
typedef struct TkIntStubs {
int magic;
@@ -767,6 +775,24 @@ typedef struct TkIntStubs {
void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */
int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */
void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 184 */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ void (*reserved185)(void);
+#endif /* UNIX */
+#if defined(_WIN32) /* WIN */
+ void (*reserved185)(void);
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ void (*tkpRedrawWidget) (Tk_Window tkwin); /* 185 */
+#endif /* MACOSX */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ void (*reserved186)(void);
+#endif /* UNIX */
+#if defined(_WIN32) /* WIN */
+ void (*reserved186)(void);
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 186 */
+#endif /* MACOSX */
} TkIntStubs;
extern const TkIntStubs *tkIntStubsPtr;
@@ -1139,6 +1165,14 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */
#define TkDrawAngledChars \
(tkIntStubsPtr->tkDrawAngledChars) /* 184 */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#define TkpRedrawWidget \
+ (tkIntStubsPtr->tkpRedrawWidget) /* 185 */
+#endif /* MACOSX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#define TkpWillDrawWidget \
+ (tkIntStubsPtr->tkpWillDrawWidget) /* 186 */
+#endif /* MACOSX */
#endif /* defined(USE_TK_STUBS) */
@@ -1160,6 +1194,14 @@ extern const TkIntStubs *tkIntStubsPtr;
#undef TkSetRegion
#undef TkSubtractRegion
#undef TkUnionRectWithRegion
+#undef TkpCmapStressed_
+#undef TkpSync_
+#undef TkUnixContainerId_
+#undef TkUnixDoOneXEvent_
+#undef TkUnixSetMenubar_
+#undef TkWmCleanup_
+#undef TkSendCleanup_
+#undef TkpTestsendCmd_
#define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
#define TkCreateRegion() (TkRegion) XCreateRegion()
@@ -1175,5 +1217,12 @@ extern const TkIntStubs *tkIntStubsPtr;
#endif /* UNIX */
+#if !defined(MAC_OSX_TK)
+# undef TkpWillDrawWidget
+# undef TkpRedrawWidget
+# define TkpWillDrawWidget(w) 0
+# define TkpRedrawWidget(w)
+#endif
+
#endif /* _TKINTDECLS */
diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h
index f496e559..e9b3a654 100644
--- a/generic/tkIntPlatDecls.h
+++ b/generic/tkIntPlatDecls.h
@@ -151,7 +151,9 @@ EXTERN Tk_Window TkpGetCapture(void);
EXTERN void TkGenerateActivateEvents(TkWindow *winPtr,
int active);
/* Slot 1 is reserved */
-/* Slot 2 is reserved */
+/* 2 */
+EXTERN void TkGenerateActivateEvents_(TkWindow *winPtr,
+ int active);
/* 3 */
EXTERN void TkPointerDeadWindow(TkWindow *winPtr);
/* 4 */
@@ -197,9 +199,7 @@ EXTERN void TkMacOSXMakeRealWindowExist(TkWindow *winPtr);
EXTERN void * TkMacOSXMakeStippleMap(Drawable d1, Drawable d2);
/* 25 */
EXTERN void TkMacOSXMenuClick(void);
-/* 26 */
-EXTERN void TkMacOSXRegisterOffScreenWindow(Window window,
- void *portPtr);
+/* Slot 26 is reserved */
/* 27 */
EXTERN int TkMacOSXResizable(TkWindow *winPtr);
/* 28 */
@@ -212,8 +212,7 @@ EXTERN void TkMacOSXSetUpClippingRgn(Drawable drawable);
EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, void *destPort);
/* 32 */
EXTERN void TkMacOSXUpdateClipRgn(TkWindow *winPtr);
-/* 33 */
-EXTERN void TkMacOSXUnregisterMacWindow(void *portPtr);
+/* Slot 33 is reserved */
/* 34 */
EXTERN int TkMacOSXUseMenuID(short macID);
/* 35 */
@@ -266,7 +265,9 @@ EXTERN int TkpScanWindowId(Tcl_Interp *interp,
/* 0 */
EXTERN void TkCreateXEventSource(void);
/* Slot 1 is reserved */
-/* Slot 2 is reserved */
+/* 2 */
+EXTERN void TkGenerateActivateEvents(TkWindow *winPtr,
+ int active);
/* 3 */
EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap);
/* 4 */
@@ -291,6 +292,48 @@ EXTERN int TkpWmSetState(TkWindow *winPtr, int state);
EXTERN int TkpTestsendCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
+/* Slot 14 is reserved */
+/* Slot 15 is reserved */
+/* Slot 16 is reserved */
+/* Slot 17 is reserved */
+/* Slot 18 is reserved */
+/* Slot 19 is reserved */
+/* Slot 20 is reserved */
+/* Slot 21 is reserved */
+/* Slot 22 is reserved */
+/* Slot 23 is reserved */
+/* Slot 24 is reserved */
+/* Slot 25 is reserved */
+/* Slot 26 is reserved */
+/* Slot 27 is reserved */
+/* Slot 28 is reserved */
+/* Slot 29 is reserved */
+/* Slot 30 is reserved */
+/* Slot 31 is reserved */
+/* Slot 32 is reserved */
+/* Slot 33 is reserved */
+/* Slot 34 is reserved */
+/* Slot 35 is reserved */
+/* Slot 36 is reserved */
+/* Slot 37 is reserved */
+/* 38 */
+EXTERN int TkpCmapStressed_(Tk_Window tkwin, Colormap colormap);
+/* 39 */
+EXTERN void TkpSync_(Display *display);
+/* 40 */
+EXTERN Window TkUnixContainerId_(TkWindow *winPtr);
+/* 41 */
+EXTERN int TkUnixDoOneXEvent_(Tcl_Time *timePtr);
+/* 42 */
+EXTERN void TkUnixSetMenubar_(Tk_Window tkwin, Tk_Window menubar);
+/* 43 */
+EXTERN void TkWmCleanup_(TkDisplay *dispPtr);
+/* 44 */
+EXTERN void TkSendCleanup_(TkDisplay *dispPtr);
+/* 45 */
+EXTERN int TkpTestsendCmd_(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
#endif /* X11 */
typedef struct TkIntPlatStubs {
@@ -350,7 +393,7 @@ typedef struct TkIntPlatStubs {
#ifdef MAC_OSX_TK /* AQUA */
void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 0 */
void (*reserved1)(void);
- void (*reserved2)(void);
+ void (*tkGenerateActivateEvents_) (TkWindow *winPtr, int active); /* 2 */
void (*tkPointerDeadWindow) (TkWindow *winPtr); /* 3 */
void (*tkpSetCapture) (TkWindow *winPtr); /* 4 */
void (*tkpSetCursor) (TkpCursor cursor); /* 5 */
@@ -374,14 +417,14 @@ typedef struct TkIntPlatStubs {
void (*tkMacOSXMakeRealWindowExist) (TkWindow *winPtr); /* 23 */
void * (*tkMacOSXMakeStippleMap) (Drawable d1, Drawable d2); /* 24 */
void (*tkMacOSXMenuClick) (void); /* 25 */
- void (*tkMacOSXRegisterOffScreenWindow) (Window window, void *portPtr); /* 26 */
+ void (*reserved26)(void);
int (*tkMacOSXResizable) (TkWindow *winPtr); /* 27 */
void (*tkMacOSXSetHelpMenuItemCount) (void); /* 28 */
void (*tkMacOSXSetScrollbarGrow) (TkWindow *winPtr, int flag); /* 29 */
void (*tkMacOSXSetUpClippingRgn) (Drawable drawable); /* 30 */
void (*tkMacOSXSetUpGraphicsPort) (GC gc, void *destPort); /* 31 */
void (*tkMacOSXUpdateClipRgn) (TkWindow *winPtr); /* 32 */
- void (*tkMacOSXUnregisterMacWindow) (void *portPtr); /* 33 */
+ void (*reserved33)(void);
int (*tkMacOSXUseMenuID) (short macID); /* 34 */
TkRegion (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */
void (*tkMacOSXWinBounds) (TkWindow *winPtr, void *geometry); /* 36 */
@@ -408,7 +451,7 @@ typedef struct TkIntPlatStubs {
#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */
void (*tkCreateXEventSource) (void); /* 0 */
void (*reserved1)(void);
- void (*reserved2)(void);
+ void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */
int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 3 */
void (*tkpSync) (Display *display); /* 4 */
Window (*tkUnixContainerId) (TkWindow *winPtr); /* 5 */
@@ -420,6 +463,38 @@ typedef struct TkIntPlatStubs {
void (*reserved11)(void);
int (*tkpWmSetState) (TkWindow *winPtr, int state); /* 12 */
int (*tkpTestsendCmd) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 13 */
+ void (*reserved14)(void);
+ void (*reserved15)(void);
+ void (*reserved16)(void);
+ void (*reserved17)(void);
+ void (*reserved18)(void);
+ void (*reserved19)(void);
+ void (*reserved20)(void);
+ void (*reserved21)(void);
+ void (*reserved22)(void);
+ void (*reserved23)(void);
+ void (*reserved24)(void);
+ void (*reserved25)(void);
+ void (*reserved26)(void);
+ void (*reserved27)(void);
+ void (*reserved28)(void);
+ void (*reserved29)(void);
+ void (*reserved30)(void);
+ void (*reserved31)(void);
+ void (*reserved32)(void);
+ void (*reserved33)(void);
+ void (*reserved34)(void);
+ void (*reserved35)(void);
+ void (*reserved36)(void);
+ void (*reserved37)(void);
+ int (*tkpCmapStressed_) (Tk_Window tkwin, Colormap colormap); /* 38 */
+ void (*tkpSync_) (Display *display); /* 39 */
+ Window (*tkUnixContainerId_) (TkWindow *winPtr); /* 40 */
+ int (*tkUnixDoOneXEvent_) (Tcl_Time *timePtr); /* 41 */
+ void (*tkUnixSetMenubar_) (Tk_Window tkwin, Tk_Window menubar); /* 42 */
+ void (*tkWmCleanup_) (TkDisplay *dispPtr); /* 43 */
+ void (*tkSendCleanup_) (TkDisplay *dispPtr); /* 44 */
+ int (*tkpTestsendCmd_) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 45 */
#endif /* X11 */
} TkIntPlatStubs;
@@ -535,7 +610,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkGenerateActivateEvents \
(tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 0 */
/* Slot 1 is reserved */
-/* Slot 2 is reserved */
+#define TkGenerateActivateEvents_ \
+ (tkIntPlatStubsPtr->tkGenerateActivateEvents_) /* 2 */
#define TkPointerDeadWindow \
(tkIntPlatStubsPtr->tkPointerDeadWindow) /* 3 */
#define TkpSetCapture \
@@ -578,8 +654,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXMakeStippleMap) /* 24 */
#define TkMacOSXMenuClick \
(tkIntPlatStubsPtr->tkMacOSXMenuClick) /* 25 */
-#define TkMacOSXRegisterOffScreenWindow \
- (tkIntPlatStubsPtr->tkMacOSXRegisterOffScreenWindow) /* 26 */
+/* Slot 26 is reserved */
#define TkMacOSXResizable \
(tkIntPlatStubsPtr->tkMacOSXResizable) /* 27 */
#define TkMacOSXSetHelpMenuItemCount \
@@ -592,8 +667,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXSetUpGraphicsPort) /* 31 */
#define TkMacOSXUpdateClipRgn \
(tkIntPlatStubsPtr->tkMacOSXUpdateClipRgn) /* 32 */
-#define TkMacOSXUnregisterMacWindow \
- (tkIntPlatStubsPtr->tkMacOSXUnregisterMacWindow) /* 33 */
+/* Slot 33 is reserved */
#define TkMacOSXUseMenuID \
(tkIntPlatStubsPtr->tkMacOSXUseMenuID) /* 34 */
#define TkMacOSXVisableClipRgn \
@@ -641,7 +715,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkCreateXEventSource \
(tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */
/* Slot 1 is reserved */
-/* Slot 2 is reserved */
+#define TkGenerateActivateEvents \
+ (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 2 */
#define TkpCmapStressed \
(tkIntPlatStubsPtr->tkpCmapStressed) /* 3 */
#define TkpSync \
@@ -663,12 +738,64 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkpWmSetState) /* 12 */
#define TkpTestsendCmd \
(tkIntPlatStubsPtr->tkpTestsendCmd) /* 13 */
+/* Slot 14 is reserved */
+/* Slot 15 is reserved */
+/* Slot 16 is reserved */
+/* Slot 17 is reserved */
+/* Slot 18 is reserved */
+/* Slot 19 is reserved */
+/* Slot 20 is reserved */
+/* Slot 21 is reserved */
+/* Slot 22 is reserved */
+/* Slot 23 is reserved */
+/* Slot 24 is reserved */
+/* Slot 25 is reserved */
+/* Slot 26 is reserved */
+/* Slot 27 is reserved */
+/* Slot 28 is reserved */
+/* Slot 29 is reserved */
+/* Slot 30 is reserved */
+/* Slot 31 is reserved */
+/* Slot 32 is reserved */
+/* Slot 33 is reserved */
+/* Slot 34 is reserved */
+/* Slot 35 is reserved */
+/* Slot 36 is reserved */
+/* Slot 37 is reserved */
+#define TkpCmapStressed_ \
+ (tkIntPlatStubsPtr->tkpCmapStressed_) /* 38 */
+#define TkpSync_ \
+ (tkIntPlatStubsPtr->tkpSync_) /* 39 */
+#define TkUnixContainerId_ \
+ (tkIntPlatStubsPtr->tkUnixContainerId_) /* 40 */
+#define TkUnixDoOneXEvent_ \
+ (tkIntPlatStubsPtr->tkUnixDoOneXEvent_) /* 41 */
+#define TkUnixSetMenubar_ \
+ (tkIntPlatStubsPtr->tkUnixSetMenubar_) /* 42 */
+#define TkWmCleanup_ \
+ (tkIntPlatStubsPtr->tkWmCleanup_) /* 43 */
+#define TkSendCleanup_ \
+ (tkIntPlatStubsPtr->tkSendCleanup_) /* 44 */
+#define TkpTestsendCmd_ \
+ (tkIntPlatStubsPtr->tkpTestsendCmd_) /* 45 */
#endif /* X11 */
#endif /* defined(USE_TK_STUBS) */
/* !END!: Do not edit above this line. */
+#undef TkpCmapStressed_
+#undef TkpSync_
+#undef TkUnixContainerId_
+#undef TkUnixDoOneXEvent_
+#undef TkUnixSetMenubar_
+#undef TkWmCleanup_
+#undef TkSendCleanup_
+#undef TkpTestsendCmd_
+#undef TkGenerateActivateEvents_
+
+#define TkMacOSXGetContainer TkGetTransientMaster
+
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 4b914409..9d4200a8 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -413,6 +413,28 @@ EXTERN int XReparentWindow(Display *d, Window w, Window p,
EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
int sx, int sy, int dx, int dy,
unsigned int w, unsigned int h);
+/* Slot 138 is reserved */
+/* Slot 139 is reserved */
+/* Slot 140 is reserved */
+/* Slot 141 is reserved */
+/* Slot 142 is reserved */
+/* Slot 143 is reserved */
+/* Slot 144 is reserved */
+/* Slot 145 is reserved */
+/* Slot 146 is reserved */
+/* Slot 147 is reserved */
+/* Slot 148 is reserved */
+/* Slot 149 is reserved */
+/* Slot 150 is reserved */
+/* Slot 151 is reserved */
+/* Slot 152 is reserved */
+/* Slot 153 is reserved */
+/* Slot 154 is reserved */
+/* Slot 155 is reserved */
+/* Slot 156 is reserved */
+/* Slot 157 is reserved */
+/* 158 */
+EXTERN void TkUnusedStubEntry(void);
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
/* 0 */
@@ -691,7 +713,10 @@ EXTERN int XSync(Display *display, Bool discard);
/* Slot 103 is reserved */
/* Slot 104 is reserved */
/* Slot 105 is reserved */
-/* Slot 106 is reserved */
+/* 106 */
+EXTERN int XSetClipRectangles(Display *display, GC gc,
+ int clip_x_origin, int clip_y_origin,
+ XRectangle rectangles[], int n, int ordering);
/* 107 */
EXTERN int XFlush(Display *display);
/* 108 */
@@ -712,7 +737,8 @@ EXTERN VisualID XVisualIDFromVisual(Visual *visual);
/* Slot 117 is reserved */
/* Slot 118 is reserved */
/* Slot 119 is reserved */
-/* Slot 120 is reserved */
+/* 120 */
+EXTERN int XOffsetRegion(void *rgn, int dx, int dy);
/* Slot 121 is reserved */
/* Slot 122 is reserved */
/* Slot 123 is reserved */
@@ -721,7 +747,8 @@ EXTERN VisualID XVisualIDFromVisual(Visual *visual);
/* Slot 126 is reserved */
/* Slot 127 is reserved */
/* Slot 128 is reserved */
-/* Slot 129 is reserved */
+/* 129 */
+EXTERN int XLowerWindow(Display *d, Window w);
/* Slot 130 is reserved */
/* Slot 131 is reserved */
/* Slot 132 is reserved */
@@ -733,6 +760,37 @@ EXTERN VisualID XVisualIDFromVisual(Visual *visual);
EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
int sx, int sy, int dx, int dy,
unsigned int w, unsigned int h);
+/* Slot 138 is reserved */
+/* Slot 139 is reserved */
+/* Slot 140 is reserved */
+/* Slot 141 is reserved */
+/* Slot 142 is reserved */
+/* Slot 143 is reserved */
+/* 144 */
+EXTERN void XDestroyIC(XIC xic);
+/* 145 */
+EXTERN Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2,
+ XColor *x1, XColor *x2, unsigned int ui1,
+ unsigned int ui2);
+/* 146 */
+EXTERN Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2,
+ unsigned int ui1, unsigned int ui2,
+ XColor _Xconst *x1, XColor _Xconst *x2);
+/* Slot 147 is reserved */
+/* Slot 148 is reserved */
+/* Slot 149 is reserved */
+/* Slot 150 is reserved */
+/* Slot 151 is reserved */
+/* Slot 152 is reserved */
+/* Slot 153 is reserved */
+/* Slot 154 is reserved */
+/* Slot 155 is reserved */
+/* Slot 156 is reserved */
+/* 157 */
+EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g,
+ int i);
+/* 158 */
+EXTERN void TkUnusedStubEntry(void);
#endif /* AQUA */
typedef struct TkIntXlibStubs {
@@ -878,6 +936,27 @@ typedef struct TkIntXlibStubs {
int (*xDrawPoints) (Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 135 */
int (*xReparentWindow) (Display *d, Window w, Window p, int x, int y); /* 136 */
int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */
+ void (*reserved138)(void);
+ void (*reserved139)(void);
+ void (*reserved140)(void);
+ void (*reserved141)(void);
+ void (*reserved142)(void);
+ void (*reserved143)(void);
+ void (*reserved144)(void);
+ void (*reserved145)(void);
+ void (*reserved146)(void);
+ void (*reserved147)(void);
+ void (*reserved148)(void);
+ void (*reserved149)(void);
+ void (*reserved150)(void);
+ void (*reserved151)(void);
+ void (*reserved152)(void);
+ void (*reserved153)(void);
+ void (*reserved154)(void);
+ void (*reserved155)(void);
+ void (*reserved156)(void);
+ void (*reserved157)(void);
+ void (*tkUnusedStubEntry) (void); /* 158 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
@@ -986,7 +1065,7 @@ typedef struct TkIntXlibStubs {
void (*reserved103)(void);
void (*reserved104)(void);
void (*reserved105)(void);
- void (*reserved106)(void);
+ int (*xSetClipRectangles) (Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 106 */
int (*xFlush) (Display *display); /* 107 */
int (*xGrabServer) (Display *display); /* 108 */
int (*xUngrabServer) (Display *display); /* 109 */
@@ -1000,7 +1079,7 @@ typedef struct TkIntXlibStubs {
void (*reserved117)(void);
void (*reserved118)(void);
void (*reserved119)(void);
- void (*reserved120)(void);
+ int (*xOffsetRegion) (void *rgn, int dx, int dy); /* 120 */
void (*reserved121)(void);
void (*reserved122)(void);
void (*reserved123)(void);
@@ -1009,7 +1088,7 @@ typedef struct TkIntXlibStubs {
void (*reserved126)(void);
void (*reserved127)(void);
void (*reserved128)(void);
- void (*reserved129)(void);
+ int (*xLowerWindow) (Display *d, Window w); /* 129 */
void (*reserved130)(void);
void (*reserved131)(void);
void (*reserved132)(void);
@@ -1018,6 +1097,27 @@ typedef struct TkIntXlibStubs {
void (*reserved135)(void);
void (*reserved136)(void);
int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */
+ void (*reserved138)(void);
+ void (*reserved139)(void);
+ void (*reserved140)(void);
+ void (*reserved141)(void);
+ void (*reserved142)(void);
+ void (*reserved143)(void);
+ void (*xDestroyIC) (XIC xic); /* 144 */
+ Cursor (*xCreatePixmapCursor) (Display *d, Pixmap p1, Pixmap p2, XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2); /* 145 */
+ Cursor (*xCreateGlyphCursor) (Display *d, Font f1, Font f2, unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, XColor _Xconst *x2); /* 146 */
+ void (*reserved147)(void);
+ void (*reserved148)(void);
+ void (*reserved149)(void);
+ void (*reserved150)(void);
+ void (*reserved151)(void);
+ void (*reserved152)(void);
+ void (*reserved153)(void);
+ void (*reserved154)(void);
+ void (*reserved155)(void);
+ void (*reserved156)(void);
+ KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */
+ void (*tkUnusedStubEntry) (void); /* 158 */
#endif /* AQUA */
} TkIntXlibStubs;
@@ -1298,6 +1398,28 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xReparentWindow) /* 136 */
#define XPutImage \
(tkIntXlibStubsPtr->xPutImage) /* 137 */
+/* Slot 138 is reserved */
+/* Slot 139 is reserved */
+/* Slot 140 is reserved */
+/* Slot 141 is reserved */
+/* Slot 142 is reserved */
+/* Slot 143 is reserved */
+/* Slot 144 is reserved */
+/* Slot 145 is reserved */
+/* Slot 146 is reserved */
+/* Slot 147 is reserved */
+/* Slot 148 is reserved */
+/* Slot 149 is reserved */
+/* Slot 150 is reserved */
+/* Slot 151 is reserved */
+/* Slot 152 is reserved */
+/* Slot 153 is reserved */
+/* Slot 154 is reserved */
+/* Slot 155 is reserved */
+/* Slot 156 is reserved */
+/* Slot 157 is reserved */
+#define TkUnusedStubEntry \
+ (tkIntXlibStubsPtr->tkUnusedStubEntry) /* 158 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
#define XSetDashes \
@@ -1498,7 +1620,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
/* Slot 103 is reserved */
/* Slot 104 is reserved */
/* Slot 105 is reserved */
-/* Slot 106 is reserved */
+#define XSetClipRectangles \
+ (tkIntXlibStubsPtr->xSetClipRectangles) /* 106 */
#define XFlush \
(tkIntXlibStubsPtr->xFlush) /* 107 */
#define XGrabServer \
@@ -1519,7 +1642,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
/* Slot 117 is reserved */
/* Slot 118 is reserved */
/* Slot 119 is reserved */
-/* Slot 120 is reserved */
+#define XOffsetRegion \
+ (tkIntXlibStubsPtr->xOffsetRegion) /* 120 */
/* Slot 121 is reserved */
/* Slot 122 is reserved */
/* Slot 123 is reserved */
@@ -1528,7 +1652,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
/* Slot 126 is reserved */
/* Slot 127 is reserved */
/* Slot 128 is reserved */
-/* Slot 129 is reserved */
+#define XLowerWindow \
+ (tkIntXlibStubsPtr->xLowerWindow) /* 129 */
/* Slot 130 is reserved */
/* Slot 131 is reserved */
/* Slot 132 is reserved */
@@ -1538,6 +1663,32 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
/* Slot 136 is reserved */
#define XPutImage \
(tkIntXlibStubsPtr->xPutImage) /* 137 */
+/* Slot 138 is reserved */
+/* Slot 139 is reserved */
+/* Slot 140 is reserved */
+/* Slot 141 is reserved */
+/* Slot 142 is reserved */
+/* Slot 143 is reserved */
+#define XDestroyIC \
+ (tkIntXlibStubsPtr->xDestroyIC) /* 144 */
+#define XCreatePixmapCursor \
+ (tkIntXlibStubsPtr->xCreatePixmapCursor) /* 145 */
+#define XCreateGlyphCursor \
+ (tkIntXlibStubsPtr->xCreateGlyphCursor) /* 146 */
+/* Slot 147 is reserved */
+/* Slot 148 is reserved */
+/* Slot 149 is reserved */
+/* Slot 150 is reserved */
+/* Slot 151 is reserved */
+/* Slot 152 is reserved */
+/* Slot 153 is reserved */
+/* Slot 154 is reserved */
+/* Slot 155 is reserved */
+/* Slot 156 is reserved */
+#define XkbKeycodeToKeysym \
+ (tkIntXlibStubsPtr->xkbKeycodeToKeysym) /* 157 */
+#define TkUnusedStubEntry \
+ (tkIntXlibStubsPtr->tkUnusedStubEntry) /* 158 */
#endif /* AQUA */
#endif /* defined(USE_TK_STUBS) */
@@ -1547,4 +1698,6 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+#undef TkUnusedStubEntry
+
#endif /* _TKINTXLIBDECLS */
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index d92325fc..514b349b 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -3318,7 +3318,7 @@ ListboxUpdateVScrollbar(
/*
* We must hold onto the interpreter from the listPtr because the data at
- * listPtr might be freed as a result of the Tcl_VarEval.
+ * listPtr might be freed as a result of the Tcl_EvalEx.
*/
interp = listPtr->interp;
@@ -3329,7 +3329,7 @@ ListboxUpdateVScrollbar(
Tcl_DStringAppend(&buf, firstStr, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, lastStr, -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp,
@@ -3390,7 +3390,7 @@ ListboxUpdateHScrollbar(
/*
* We must hold onto the interpreter because the data referred to at
- * listPtr might be freed as a result of the call to Tcl_VarEval.
+ * listPtr might be freed as a result of the call to Tcl_EvalEx.
*/
interp = listPtr->interp;
@@ -3401,7 +3401,7 @@ ListboxUpdateHScrollbar(
Tcl_DStringAppend(&buf, firstStr, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, lastStr, -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp,
diff --git a/generic/tkMain.c b/generic/tkMain.c
index f0b7b3e0..953a54f3 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -14,30 +14,7 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-/**
- * On Windows, this file needs to be compiled twice, once with
- * TK_ASCII_MAIN defined. This way both Tk_MainEx and Tk_MainExW
- * can be implemented, sharing the same source code.
- */
-#if defined(TK_ASCII_MAIN)
-# ifdef UNICODE
-# undef UNICODE
-# undef _UNICODE
-# else
-# define UNICODE
-# define _UNICODE
-# endif
-#endif
-
#include "tkInt.h"
-#include
-#include
-#include
-#ifdef NO_STDLIB_H
-# include "../compat/stdlib.h"
-#else
-# include
-#endif
extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *);
@@ -55,6 +32,9 @@ static const char DEFAULT_PRIMARY_PROMPT[] = "% ";
* to strcmp here.
*/
#ifdef _WIN32
+#ifdef __cplusplus
+extern "C" {
+#endif
/* Little hack to eliminate the need for "tclInt.h" here:
Just copy a small portion of TclIntPlatStubs, just
enough to make it work. See [600b72bfbc] */
@@ -65,6 +45,9 @@ typedef struct {
int (*tclpIsAtty) (int fd); /* 16 */
} TclIntPlatStubs;
extern const TclIntPlatStubs *tclIntPlatStubsPtr;
+#ifdef __cplusplus
+}
+#endif
# include "tkWinInt.h"
#else
# define TCHAR char
@@ -78,12 +61,6 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#include "tkMacOSXInt.h"
#endif
-/*
- * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise
- * NewNativeObj is needed (which provides proper conversion from native
- * encoding to UTF-8).
- */
-
static inline Tcl_Obj *
NewNativeObj(
TCHAR *string)
@@ -91,8 +68,9 @@ NewNativeObj(
Tcl_Obj *obj;
Tcl_DString ds;
-#ifdef UNICODE
- Tcl_WinTCharToUtf(string, -1, &ds);
+#if defined(_WIN32) && defined(UNICODE)
+ Tcl_DStringInit(&ds);
+ Tcl_WCharToUtfDString(string, wcslen(string), &ds);
#else
Tcl_ExternalToUtfDString(NULL, (char *) string, -1, &ds);
#endif
@@ -422,21 +400,22 @@ Tk_MainEx(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static void
StdinProc(
ClientData clientData, /* The state of interactive cmd line */
int mask) /* Not used. */
{
char *cmd;
- int code, count;
- InteractiveState *isPtr = clientData;
+ int code;
+ int count;
+ InteractiveState *isPtr = (InteractiveState *)clientData;
Tcl_Channel chan = isPtr->input;
Tcl_Interp *interp = isPtr->interp;
+ (void)mask;
count = Tcl_Gets(chan, &isPtr->line);
- if (count == -1 && !isPtr->gotPartial) {
+ if ((count == -1) && !isPtr->gotPartial) {
if (isPtr->tty) {
Tcl_Exit(0);
} else {
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index d51febbc..1cd7a168 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -39,12 +39,12 @@
* right; they have a Tk window and pathname associated with them; they have a
* TkMenu structure and array of entries. However, they are linked with the
* original menu that they were cloned from. The reflect the attributes of the
- * original, or "master", menu. So if an item is added to a menu, and that
+ * original, or "main", menu. So if an item is added to a menu, and that
* menu has clones, then the item must be added to all of its clones also.
* Menus are cloned when a menu is torn-off or when a menu is assigned as a
* menubar using the "-menu" option of the toplevel's pathname configure
* subcommand. When a clone is destroyed, only the clone is destroyed, but
- * when the master menu is destroyed, all clones are also destroyed. This
+ * when the main menu is destroyed, all clones are also destroyed. This
* allows the developer to just deal with one set of menus when creating and
* destroying.
*
@@ -513,7 +513,7 @@ Tk_MenuObjCmd(
nextCascadePtr = cascadeListPtr->nextCascadePtr;
/*
- * If we have a new master menu, and an existing cloned menu
+ * If we have a new main menu, and an existing cloned menu
* points to this menu in a cascade entry, we have to clone the
* new menu and point the entry to the clone instead of the menu
* we are creating. Otherwise, ConfigureMenuEntry will hook up the
@@ -1019,7 +1019,7 @@ TkInvokeMenu(
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds, "tk::TearOffMenu ", -1);
Tcl_DStringAppend(&ds, Tk_PathName(menuPtr->tkwin), -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&ds), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&ds), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&ds);
} else if ((mePtr->type == CHECK_BUTTON_ENTRY)
&& (mePtr->namePtr != NULL)) {
@@ -1100,8 +1100,8 @@ DestroyMenuInstance(
TkMenu *menuInstancePtr;
TkMenuEntry *cascadePtr, *nextCascadePtr;
Tcl_Obj *newObjv[2];
- TkMenu *parentMasterMenuPtr;
- TkMenuEntry *parentMasterEntryPtr;
+ TkMenu *parentMainMenuPtr;
+ TkMenuEntry *parentMainEntryPtr;
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -1110,11 +1110,11 @@ DestroyMenuInstance(
* entries need to be told that the menu is going away. We need to clear
* the menu ptr field in the menu reference at this point in the code so
* that everything else can forget about this menu properly. We also need
- * to reset -menu field of all entries that are not master menus back to
- * this entry name if this is a master menu pointed to by another master
+ * to reset -menu field of all entries that are not main menus back to
+ * this entry name if this is a main menu pointed to by another main
* menu. If there is a clone menu that points to this menu, then this menu
* is itself a clone, so when this menu goes away, the -menu field of the
- * pointing entry must be set back to this menu's master menu name so that
+ * pointing entry must be set back to this menu's main menu name so that
* later if another menu is created the cascade hierarchy can be
* maintained.
*/
@@ -1135,11 +1135,11 @@ DestroyMenuInstance(
if (menuPtr->masterMenuPtr != menuPtr) {
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
- parentMasterMenuPtr = cascadePtr->menuPtr->masterMenuPtr;
- parentMasterEntryPtr =
- parentMasterMenuPtr->entries[cascadePtr->index];
+ parentMainMenuPtr = cascadePtr->menuPtr->masterMenuPtr;
+ parentMainEntryPtr =
+ parentMainMenuPtr->entries[cascadePtr->index];
newObjv[0] = menuNamePtr;
- newObjv[1] = parentMasterEntryPtr->namePtr;
+ newObjv[1] = parentMainEntryPtr->namePtr;
/*
* It is possible that the menu info is out of sync, and these
@@ -1169,7 +1169,7 @@ DestroyMenuInstance(
}
}
} else if (menuPtr->nextInstancePtr != NULL) {
- Tcl_Panic("Attempting to delete master menu when there are still clones");
+ Tcl_Panic("Attempting to delete main menu when there are still clones");
}
/*
@@ -1209,8 +1209,8 @@ DestroyMenuInstance(
*
* This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
* up the internal structure of a menu at a safe time (when no-one is
- * using it anymore). If called on a master instance, destroys all of the
- * slave instances. If called on a non-master instance, just destroys
+ * using it anymore). If called on a main instance, destroys all of the
+ * instances. If called on a non-main instance, just destroys
* that instance.
*
* Results:
@@ -1571,7 +1571,7 @@ ConfigureMenu(
* menuTypeName field to tell that this is a menu bar.
*/
- if (menuListPtr->menuType == MASTER_MENU) {
+ if (menuListPtr->menuType == MAIN_MENU) {
int typeFlag = TK_MAKE_MENU_POPUP;
Tk_Window tkwin = menuPtr->tkwin;
@@ -1623,7 +1623,6 @@ ConfigureMenu(
}
} else if ((menuListPtr->numEntries > 0)
&& (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) {
- int i;
Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry);
@@ -1819,7 +1818,6 @@ PostProcessEntry(
if ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
Tcl_Obj *valuePtr;
- const char *name;
if (mePtr->namePtr == NULL) {
if (mePtr->labelPtr == NULL) {
@@ -1982,7 +1980,7 @@ ConfigureMenuCloneEntries(
/*
* Cascades are kind of tricky here. This is special case #3 in the
- * comment at the top of this file. Basically, if a menu is the master
+ * comment at the top of this file. Basically, if a menu is the main
* menu of a clone chain, and has an entry with a cascade menu, the clones
* of the menu will point to clones of the cascade menu. We have to
* destroy the clones of the cascades, clone the new cascade menu, and
@@ -2144,7 +2142,7 @@ TkGetMenuIndex(
}
if (isdigit(UCHAR(string[0]))) {
- if (Tcl_GetInt(interp, string, &i) == TCL_OK) {
+ if (Tcl_GetIntFromObj(interp, objPtr, &i) == TCL_OK) {
if (i >= menuPtr->numEntries) {
if (lastOK) {
i = menuPtr->numEntries;
@@ -2416,7 +2414,7 @@ MenuAddOrInsert(
* If a menu has cascades, then every instance of the menu has to have
* its own parallel cascade structure. So adding an entry to a menu
* with clones means that the menu that the entry points to has to be
- * cloned for every clone the master menu has. This is special case #2
+ * cloned for every clone the main menu has. This is special case #2
* in the comment at the top of this file.
*/
@@ -2697,7 +2695,7 @@ CloneMenu(
Tcl_Obj *menuDupCommandArray[4];
if (newMenuTypePtr == NULL) {
- menuType = MASTER_MENU;
+ menuType = MAIN_MENU;
} else {
if (Tcl_GetIndexFromObjStruct(menuPtr->interp, newMenuTypePtr,
menuTypeStrings, sizeof(char *), "menu type", 0, &menuType) != TCL_OK) {
@@ -2732,7 +2730,7 @@ CloneMenu(
&& (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) {
TkMenu *newMenuPtr = menuRefPtr->menuPtr;
Tcl_Obj *newObjv[3];
- int i, numElements;
+ int numElements;
/*
* Now put this newly created menu into the parent menu's instance
@@ -2752,7 +2750,7 @@ CloneMenu(
}
/*
- * Add the master menu's window to the bind tags for this window after
+ * Add the main menu's window to the bind tags for this window after
* this window's tag. This is so the user can bind to either this
* clone (which may not be easy to do) or the entire menu clone
* structure.
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index ae69d96e..386b2044 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -13,10 +13,6 @@
#ifndef _TKMENU
#define _TKMENU
-#ifndef _TK
-#include "tk.h"
-#endif
-
#ifndef _TKINT
#include "tkInt.h"
#endif
@@ -189,7 +185,7 @@ typedef struct TkMenuEntry {
* the menu. */
/*
- * Bookeeping for master menus and cascade menus.
+ * Bookeeping for main menus and cascade menus.
*/
struct TkMenuReferences *childMenuRefPtr;
@@ -270,7 +266,7 @@ typedef struct TkMenu {
int numEntries; /* Number of elements in entries. */
int active; /* Index of active entry. -1 means nothing
* active. */
- int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR. See
+ int menuType; /* MAIN_MENU, TEAROFF_MENU, or MENUBAR. See
* below for definitions. */
Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin is a
* toplevel or not. "normal", "menubar", or
@@ -358,7 +354,7 @@ typedef struct TkMenu {
struct TkMenu *masterMenuPtr;
/* A pointer to the original menu for this
* clone chain. Points back to this structure
- * if this menu is a master menu. */
+ * if this menu is a main menu. */
void *reserved1; /* not used any more. */
Tk_Window parentTopLevelPtr;/* If this menu is a menubar, this is the
* toplevel that owns the menu. Only
@@ -437,7 +433,7 @@ typedef struct TkMenuReferences {
* MENU_DELETION_PENDING Non-zero means that we are currently
* destroying this menu's internal structures.
* This is useful when we are in the middle of
- * cleaning this master menu's chain of menus up
+ * cleaning this main menu's chain of menus up
* when TkDestroyMenu was called again on this
* menu (via a destroy binding or somesuch).
* MENU_WIN_DESTRUCTION_PENDING Non-zero means we are in the middle of
@@ -455,15 +451,16 @@ typedef struct TkMenuReferences {
#define MENU_PLATFORM_FLAG3 (1 << 28)
/*
- * Each menu created by the user is a MASTER_MENU. When a menu is torn off, a
+ * Each menu created by the user is a MAIN_MENU. When a menu is torn off, a
* TEAROFF_MENU instance is created. When a menu is assigned to a toplevel as
* a menu bar, a MENUBAR instance is created. All instances have the same
- * configuration information. If the master instance is deleted, all instances
+ * configuration information. If the main instance is deleted, all instances
* are deleted. If one of the other instances is deleted, only that instance
* is deleted.
*/
#define UNKNOWN_TYPE -1
+#define MAIN_MENU 0
#define MASTER_MENU 0
#define TEAROFF_MENU 1
#define MENUBAR 2
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index d91bc11b..89f4a2b8 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -668,8 +668,27 @@ DisplayMenu(
TkpDrawMenuEntry(mePtr, Tk_WindowId(menuPtr->tkwin), tkfont,
&menuMetrics, mePtr->x, mePtr->y, mePtr->width,
mePtr->height, strictMotif, 1);
+
+ if (mePtr->entryFlags & ENTRY_LAST_COLUMN) {
+
+ /*
+ * Paint the area at the right of an entry in the last column.
+ * This has zero width except after menu resizing.
+ */
+
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border,
+ mePtr->x + mePtr->width, mePtr->y,
+ Tk_Width(tkwin) - mePtr->x - mePtr->width - borderWidth,
+ mePtr->height, 0, TK_RELIEF_FLAT);
+ }
+
if ((index > 0) && (menuPtr->menuType != MENUBAR)
&& mePtr->columnBreak) {
+
+ /*
+ * Paint the area under the last entry in a column.
+ */
+
mePtr = menuPtr->entries[index - 1];
Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border,
mePtr->x, mePtr->y + mePtr->height, mePtr->width,
@@ -687,6 +706,11 @@ DisplayMenu(
height = Tk_Height(tkwin) - 2 * borderWidth;
} else {
mePtr = menuPtr->entries[menuPtr->numEntries - 1];
+
+ /*
+ * Paint the area under the last entry of the menu.
+ */
+
Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
border, mePtr->x, mePtr->y + mePtr->height, mePtr->width,
Tk_Height(tkwin) - mePtr->y - mePtr->height - borderWidth,
@@ -696,6 +720,12 @@ DisplayMenu(
width = Tk_Width(tkwin) - x - borderWidth;
height = Tk_Height(tkwin) - y - borderWidth;
}
+
+ /*
+ * Paint the area at the bottom right of the last entry.
+ * This has zero width except after menu resizing.
+ */
+
Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, x, y,
width, height, 0, TK_RELIEF_FLAT);
}
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 559f0e2e..716c7e17 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -149,7 +149,7 @@ static const Tcl_ObjType windowObjType = {
static ThreadSpecificData *
GetTypeCache(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->doubleTypePtr == NULL) {
@@ -408,8 +408,8 @@ FreePixelInternalRep(
static void
DupPixelInternalRep(
- register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
- register Tcl_Obj *copyPtr) /* Object with internal rep to set. */
+ Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
+ Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
copyPtr->typePtr = srcPtr->typePtr;
@@ -419,7 +419,7 @@ DupPixelInternalRep(
PixelRep *oldPtr, *newPtr;
oldPtr = GET_COMPLEXPIXEL(srcPtr);
- newPtr = ckalloc(sizeof(PixelRep));
+ newPtr = (PixelRep *)ckalloc(sizeof(PixelRep));
newPtr->value = oldPtr->value;
newPtr->units = oldPtr->units;
newPtr->tkwin = oldPtr->tkwin;
@@ -503,7 +503,7 @@ SetPixelFromAny(
if ((units < 0) && (i == d)) {
SET_SIMPLEPIXEL(objPtr, i);
} else {
- PixelRep *pixelPtr = ckalloc(sizeof(PixelRep));
+ PixelRep *pixelPtr = (PixelRep *)ckalloc(sizeof(PixelRep));
pixelPtr->value = d;
pixelPtr->units = units;
@@ -564,7 +564,7 @@ Tk_GetMMFromObj(
}
}
- mmPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1;
if (mmPtr->tkwin != tkwin) {
d = mmPtr->value;
if (mmPtr->units == -1) {
@@ -628,14 +628,14 @@ FreeMMInternalRep(
static void
DupMMInternalRep(
- register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
- register Tcl_Obj *copyPtr) /* Object with internal rep to set. */
+ Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
+ Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
MMRep *oldPtr, *newPtr;
copyPtr->typePtr = srcPtr->typePtr;
- oldPtr = srcPtr->internalRep.twoPtrValue.ptr1;
- newPtr = ckalloc(sizeof(MMRep));
+ oldPtr = (MMRep *)srcPtr->internalRep.twoPtrValue.ptr1;
+ newPtr = (MMRep *)ckalloc(sizeof(MMRep));
newPtr->value = oldPtr->value;
newPtr->units = oldPtr->units;
newPtr->tkwin = oldPtr->tkwin;
@@ -664,13 +664,13 @@ DupMMInternalRep(
static void
UpdateStringOfMM(
- register Tcl_Obj *objPtr) /* pixel obj with string rep to update. */
+ Tcl_Obj *objPtr) /* pixel obj with string rep to update. */
{
MMRep *mmPtr;
char buffer[TCL_DOUBLE_SPACE];
size_t len;
- mmPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1;
/* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */
if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) {
Tcl_Panic("UpdateStringOfMM: false precondition");
@@ -679,7 +679,7 @@ UpdateStringOfMM(
Tcl_PrintDouble(NULL, mmPtr->value, buffer);
len = strlen(buffer);
- objPtr->bytes = ckalloc(len + 1);
+ objPtr->bytes = (char *)ckalloc(len + 1);
strcpy(objPtr->bytes, buffer);
objPtr->length = len;
}
@@ -787,7 +787,7 @@ SetMMFromAny(
objPtr->typePtr = &mmObjType;
- mmPtr = ckalloc(sizeof(MMRep));
+ mmPtr = (MMRep *)ckalloc(sizeof(MMRep));
mmPtr->value = d;
mmPtr->units = units;
mmPtr->tkwin = NULL;
@@ -827,7 +827,7 @@ TkGetWindowFromObj(
Tk_Window *windowPtr) /* Place to store resulting window. */
{
TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr;
- register WindowRep *winPtr;
+ WindowRep *winPtr;
if (objPtr->typePtr != &windowObjType) {
int result = SetWindowFromAny(interp, objPtr);
@@ -836,7 +836,7 @@ TkGetWindowFromObj(
}
}
- winPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1;
if (winPtr->tkwin == NULL
|| winPtr->mainPtr == NULL
|| winPtr->mainPtr != mainPtr
@@ -882,8 +882,8 @@ TkGetWindowFromObj(
static int
SetWindowFromAny(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- register Tcl_Obj *objPtr) /* The object to convert. */
+ TCL_UNUSED(Tcl_Interp *),
+ Tcl_Obj *objPtr) /* The object to convert. */
{
const Tcl_ObjType *typePtr;
WindowRep *winPtr;
@@ -898,7 +898,7 @@ SetWindowFromAny(
typePtr->freeIntRepProc(objPtr);
}
- winPtr = ckalloc(sizeof(WindowRep));
+ winPtr = (WindowRep *)ckalloc(sizeof(WindowRep));
winPtr->tkwin = NULL;
winPtr->mainPtr = NULL;
winPtr->epoch = 0;
@@ -993,7 +993,7 @@ TkNewWindowObj(
{
Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr;
- register WindowRep *winPtr;
+ WindowRep *winPtr;
SetWindowFromAny(NULL, objPtr);
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index f20f38f2..7bb02b44 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -82,7 +82,7 @@ Tk_ConfigureWidget(
* considered. Also, may have
* TK_CONFIG_ARGV_ONLY set. */
{
- register Tk_ConfigSpec *specPtr, *staticSpecs;
+ Tk_ConfigSpec *specPtr, *staticSpecs;
Tk_Uid value; /* Value of option from database. */
int needFlags; /* Specs must contain this set of flags or
* else they are not considered. */
@@ -245,8 +245,8 @@ FindConfigSpec(
int hateFlags) /* Flags that must NOT be present in matching
* entry. */
{
- register Tk_ConfigSpec *specPtr;
- register char c; /* First character of current argument. */
+ Tk_ConfigSpec *specPtr;
+ char c; /* First character of current argument. */
Tk_ConfigSpec *matchPtr; /* Matching spec, or NULL. */
size_t length;
@@ -376,7 +376,7 @@ DoConfig(
if (nullValue) {
newStr = NULL;
} else {
- newStr = ckalloc(strlen(value) + 1);
+ newStr = (char *)ckalloc(strlen(value) + 1);
strcpy(newStr, value);
}
oldStr = *((char **) ptr);
@@ -603,7 +603,7 @@ Tk_ConfigureInfo(
* be present in config specs for them to be
* considered. */
{
- register Tk_ConfigSpec *specPtr, *staticSpecs;
+ Tk_ConfigSpec *specPtr, *staticSpecs;
int needFlags, hateFlags;
char *list;
const char *leader = "{";
@@ -686,7 +686,7 @@ FormatConfigInfo(
Tcl_Interp *interp, /* Interpreter to use for things like
* floating-point precision. */
Tk_Window tkwin, /* Window corresponding to widget. */
- register const Tk_ConfigSpec *specPtr,
+ const Tk_ConfigSpec *specPtr,
/* Pointer to information describing
* option. */
char *widgRec) /* Pointer to record holding current values of
@@ -863,8 +863,6 @@ FormatConfigValue(
result = buffer;
break;
case TK_CONFIG_WINDOW: {
- Tk_Window tkwin;
-
tkwin = *((Tk_Window *) ptr);
if (tkwin != NULL) {
result = Tk_PathName(tkwin);
@@ -971,7 +969,6 @@ Tk_ConfigureValue(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
void
Tk_FreeOptions(
const Tk_ConfigSpec *specs, /* Describes legal options. */
@@ -983,7 +980,7 @@ Tk_FreeOptions(
* be present in config specs for them to be
* considered. */
{
- register const Tk_ConfigSpec *specPtr;
+ const Tk_ConfigSpec *specPtr;
char *ptr;
for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) {
@@ -1071,10 +1068,10 @@ GetCachedSpecs(
* self-initializing code.
*/
- specCacheTablePtr =
+ specCacheTablePtr = (Tcl_HashTable *)
Tcl_GetAssocData(interp, "tkConfigSpec.threadTable", NULL);
if (specCacheTablePtr == NULL) {
- specCacheTablePtr = ckalloc(sizeof(Tcl_HashTable));
+ specCacheTablePtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(specCacheTablePtr, TCL_ONE_WORD_KEYS);
Tcl_SetAssocData(interp, "tkConfigSpec.threadTable",
DeleteSpecCacheTable, specCacheTablePtr);
@@ -1088,7 +1085,7 @@ GetCachedSpecs(
entryPtr = Tcl_CreateHashEntry(specCacheTablePtr, (char *) staticSpecs,
&isNew);
if (isNew) {
- unsigned int entrySpace = sizeof(Tk_ConfigSpec);
+ size_t entrySpace = sizeof(Tk_ConfigSpec);
const Tk_ConfigSpec *staticSpecPtr;
Tk_ConfigSpec *specPtr;
@@ -1104,10 +1101,10 @@ GetCachedSpecs(
/*
* Now allocate our working copy's space and copy over the contents
- * from the master copy.
+ * from the origin.
*/
- cachedSpecs = ckalloc(entrySpace);
+ cachedSpecs = (Tk_ConfigSpec *)ckalloc(entrySpace);
memcpy(cachedSpecs, staticSpecs, entrySpace);
Tcl_SetHashValue(entryPtr, cachedSpecs);
@@ -1131,7 +1128,7 @@ GetCachedSpecs(
}
}
} else {
- cachedSpecs = Tcl_GetHashValue(entryPtr);
+ cachedSpecs = (Tk_ConfigSpec *)Tcl_GetHashValue(entryPtr);
}
return cachedSpecs;
@@ -1157,9 +1154,9 @@ GetCachedSpecs(
static void
DeleteSpecCacheTable(
ClientData clientData,
- Tcl_Interp *interp)
+ TCL_UNUSED(Tcl_Interp *))
{
- Tcl_HashTable *tablePtr = clientData;
+ Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData;
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
index 948883d7..8996f31c 100644
--- a/generic/tkOldTest.c
+++ b/generic/tkOldTest.c
@@ -25,17 +25,17 @@
#include "tkInt.h"
/*
- * The following data structure represents the master for a test image:
+ * The following data structure represents the model for a test image:
*/
-typedef struct TImageMaster {
- Tk_ImageMaster master; /* Tk's token for image master. */
+typedef struct TImageModel {
+ Tk_ImageModel model; /* Tk's token for image model. */
Tcl_Interp *interp; /* Interpreter for application. */
int width, height; /* Dimensions of image. */
char *imageName; /* Name of image (malloc-ed). */
char *varName; /* Name of variable in which to log events for
* image (malloc-ed). */
-} TImageMaster;
+} TImageModel;
/*
* The following data structure represents a particular use of a particular
@@ -43,7 +43,7 @@ typedef struct TImageMaster {
*/
typedef struct TImageInstance {
- TImageMaster *masterPtr; /* Pointer to master for image. */
+ TImageModel *modelPtr; /* Pointer to model for image. */
XColor *fg; /* Foreground color for drawing in image. */
GC gc; /* Graphics context for drawing in image. */
} TImageInstance;
@@ -54,7 +54,7 @@ typedef struct TImageInstance {
static int ImageCreate(Tcl_Interp *interp,
char *name, int argc, char **argv,
- Tk_ImageType *typePtr, Tk_ImageMaster master,
+ Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
static void ImageDisplay(ClientData clientData,
@@ -143,12 +143,12 @@ ImageCreate(
char **argv, /* Argument strings for options (doesn't
* include image name or type). */
Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- TImageMaster *timPtr;
+ TImageModel *timPtr;
const char *varName;
int i;
@@ -167,8 +167,8 @@ ImageCreate(
varName = argv[i+1];
}
- timPtr = ckalloc(sizeof(TImageMaster));
- timPtr->master = master;
+ timPtr = ckalloc(sizeof(TImageModel));
+ timPtr->model = model;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
@@ -178,7 +178,7 @@ ImageCreate(
strcpy(timPtr->varName, varName);
Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL);
*clientDataPtr = timPtr;
- Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15);
+ Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15);
return TCL_OK;
}
@@ -207,7 +207,7 @@ ImageObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TImageMaster *timPtr = clientData;
+ TImageModel *timPtr = clientData;
int x, y, width, height;
if (objc < 2) {
@@ -228,7 +228,7 @@ ImageObjCmd(
|| (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) {
return TCL_ERROR;
}
- Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width,
+ Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width,
timPtr->height);
} else {
Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]),
@@ -260,9 +260,9 @@ static ClientData
ImageGet(
Tk_Window tkwin, /* Token for window in which image will be
* used. */
- ClientData clientData) /* Pointer to TImageMaster for image. */
+ ClientData clientData) /* Pointer to TImageModel for image. */
{
- TImageMaster *timPtr = clientData;
+ TImageModel *timPtr = clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -272,7 +272,7 @@ ImageGet(
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
instPtr = ckalloc(sizeof(TImageInstance));
- instPtr->masterPtr = timPtr;
+ instPtr->modelPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
@@ -313,15 +313,15 @@ ImageDisplay(
char buffer[200 + TCL_INTEGER_SPACE * 6];
sprintf(buffer, "%s display %d %d %d %d %d %d",
- instPtr->masterPtr->imageName, imageX, imageY, width, height,
+ instPtr->modelPtr->imageName, imageX, imageY, width, height,
drawableX, drawableY);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL,
buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
- if (width > (instPtr->masterPtr->width - imageX)) {
- width = instPtr->masterPtr->width - imageX;
+ if (width > (instPtr->modelPtr->width - imageX)) {
+ width = instPtr->modelPtr->width - imageX;
}
- if (height > (instPtr->masterPtr->height - imageY)) {
- height = instPtr->masterPtr->height - imageY;
+ if (height > (instPtr->modelPtr->height - imageY)) {
+ height = instPtr->modelPtr->height - imageY;
}
XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY,
(unsigned) (width-1), (unsigned) (height-1));
@@ -357,8 +357,8 @@ ImageFree(
TImageInstance *instPtr = clientData;
char buffer[200];
- sprintf(buffer, "%s free", instPtr->masterPtr->imageName);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
+ sprintf(buffer, "%s free", instPtr->modelPtr->imageName);
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL,
buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
Tk_FreeColor(instPtr->fg);
Tk_FreeGC(display, instPtr->gc);
@@ -384,11 +384,11 @@ ImageFree(
static void
ImageDelete(
- ClientData clientData) /* Pointer to TImageMaster for image. When
+ ClientData clientData) /* Pointer to TImageModel for image. When
* this function is called, no more instances
* exist. */
{
- TImageMaster *timPtr = clientData;
+ TImageModel *timPtr = clientData;
char buffer[100];
sprintf(buffer, "%s delete", timPtr->imageName);
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 713a6d5a..15fc4059 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -254,16 +254,16 @@ Tk_AddOption(
* TK_MAX_PRIO. */
{
TkWindow *winPtr = ((TkWindow *) tkwin)->mainPtr->winPtr;
- register ElArray **arrayPtrPtr;
- register Element *elPtr;
+ ElArray **arrayPtrPtr;
+ Element *elPtr;
Element newEl;
- register const char *p;
+ const char *p;
const char *field;
int count, firstField;
- ptrdiff_t length;
+ size_t length;
#define TMP_SIZE 100
char tmp[TMP_SIZE+1];
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->mainPtr->optionRootPtr == NULL) {
@@ -311,7 +311,7 @@ Tk_AddOption(
if (length > TMP_SIZE) {
length = TMP_SIZE;
}
- strncpy(tmp, field, (size_t) length);
+ strncpy(tmp, field, length);
tmp[length] = 0;
newEl.nameUid = Tk_GetUid(tmp);
if (isupper(UCHAR(*field))) {
@@ -406,12 +406,12 @@ Tk_GetOption(
* name. */
{
Tk_Uid nameId, classId = NULL;
- char *masqName;
- register Element *elPtr, *bestPtr;
- register int count;
+ const char *masqName;
+ Element *elPtr, *bestPtr;
+ int count;
StackLevel *levelPtr;
int stackDepth[NUM_STACKS];
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -521,8 +521,8 @@ Tk_GetOption(
if (masqName != NULL) {
char *masqClass;
Tk_Uid nodeId, winClassId, winNameId;
- unsigned int classNameLength;
- register Element *nodePtr, *leafPtr;
+ size_t classNameLength;
+ Element *nodePtr, *leafPtr;
static const int searchOrder[] = {
EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS,
WILDCARD_NODE_CLASS, -1
@@ -534,8 +534,8 @@ Tk_GetOption(
* Extract the masquerade class name from the name field.
*/
- classNameLength = (unsigned) (masqName - name);
- masqClass = ckalloc(classNameLength + 1);
+ classNameLength = (size_t) (masqName - name);
+ masqClass = (char *)ckalloc(classNameLength + 1);
strncpy(masqClass, name, classNameLength);
masqClass[classNameLength] = '\0';
@@ -615,9 +615,9 @@ Tk_OptionObjCmd(
int objc, /* Number of Tcl_Obj arguments. */
Tcl_Obj *const objv[]) /* Tcl_Obj arguments. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
int index, result;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
static const char *const optionCmds[] = {
"add", "clear", "get", "readfile", NULL
@@ -738,9 +738,9 @@ Tk_OptionObjCmd(
void
TkOptionDeadWindow(
- register TkWindow *winPtr) /* Window to be cleaned up. */
+ TkWindow *winPtr) /* Window to be cleaned up. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -796,7 +796,7 @@ TkOptionClassChanged(
{
int i, j, *basePtr;
ElArray *arrayPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->optionLevel == -1) {
@@ -922,7 +922,7 @@ AddFromString(
* TK_INTERACTIVE_PRIO. Must be between 0 and
* TK_MAX_PRIO. */
{
- register char *src, *dst;
+ char *src, *dst;
char *name, *value;
int lineNum;
@@ -1115,7 +1115,7 @@ ReadOptionFile(
Tcl_IncrRefCount(buffer);
Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8");
bufferSize = Tcl_ReadChars(chan, buffer, -1, 0);
- if (bufferSize < 0) {
+ if (bufferSize == -1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"error reading file \"%s\": %s",
fileName, Tcl_PosixError(interp)));
@@ -1149,7 +1149,7 @@ static ElArray *
NewArray(
int numEls) /* How many elements of space to allocate. */
{
- register ElArray *arrayPtr = ckalloc(EL_ARRAY_SIZE(numEls));
+ ElArray *arrayPtr = (ElArray *)ckalloc(EL_ARRAY_SIZE(numEls));
arrayPtr->arraySize = numEls;
arrayPtr->numUsed = 0;
@@ -1176,17 +1176,17 @@ NewArray(
static ElArray *
ExtendArray(
- register ElArray *arrayPtr, /* Array to be extended. */
- register Element *elPtr) /* Element to be copied into array. */
+ ElArray *arrayPtr, /* Array to be extended. */
+ Element *elPtr) /* Element to be copied into array. */
{
/*
* If the current array has filled up, make it bigger.
*/
if (arrayPtr->numUsed >= arrayPtr->arraySize) {
- register int newSize = 2*arrayPtr->arraySize;
+ int newSize = 2*arrayPtr->arraySize;
- arrayPtr = ckrealloc(arrayPtr, EL_ARRAY_SIZE(newSize));
+ arrayPtr = (ElArray *)ckrealloc(arrayPtr, EL_ARRAY_SIZE(newSize));
arrayPtr->arraySize = newSize;
arrayPtr->nextToUse = &arrayPtr->els[arrayPtr->numUsed];
}
@@ -1225,9 +1225,9 @@ SetupStacks(
{
int level, i;
const int *iPtr;
- register StackLevel *levelPtr;
- register ElArray *arrayPtr;
- ThreadSpecificData *tsdPtr =
+ StackLevel *levelPtr;
+ ElArray *arrayPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1304,7 +1304,7 @@ SetupStacks(
*/
if (tsdPtr->curLevel >= tsdPtr->numLevels) {
- StackLevel *newLevels =
+ StackLevel *newLevels = (StackLevel *)
ckalloc(tsdPtr->numLevels * 2 * sizeof(StackLevel));
memcpy(newLevels, tsdPtr->levels,
@@ -1331,7 +1331,7 @@ SetupStacks(
*/
for (iPtr = searchOrder; *iPtr != -1; iPtr++) {
- register Element *elPtr;
+ Element *elPtr;
int count;
Tk_Uid id;
@@ -1386,9 +1386,9 @@ ExtendStacks(
int leaf) /* If zero, then don't copy exact leaf
* elements. */
{
- register int count;
- register Element *elPtr;
- ThreadSpecificData *tsdPtr =
+ int count;
+ Element *elPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (elPtr = arrayPtr->els, count = arrayPtr->numUsed;
@@ -1419,9 +1419,9 @@ ExtendStacks(
static void
OptionThreadExitProc(
- ClientData clientData) /* not used */
+ TCL_UNUSED(void *))
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->initialized) {
@@ -1453,13 +1453,13 @@ OptionThreadExitProc(
static void
OptionInit(
- register TkMainInfo *mainPtr)
+ TkMainInfo *mainPtr)
/* Top-level information about window that
* isn't initialized yet. */
{
int i;
Tcl_Interp *interp;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Element *defaultMatchPtr = &tsdPtr->defaultMatch;
@@ -1474,7 +1474,7 @@ OptionInit(
tsdPtr->curLevel = -1;
tsdPtr->serial = 0;
- tsdPtr->levels = ckalloc(5 * sizeof(StackLevel));
+ tsdPtr->levels = (StackLevel *)ckalloc(5 * sizeof(StackLevel));
for (i = 0; i < NUM_STACKS; i++) {
tsdPtr->stacks[i] = NewArray(10);
tsdPtr->levels[0].bases[i] = 0;
@@ -1521,7 +1521,7 @@ ClearOptionTree(
ElArray *arrayPtr) /* Array of options; delete everything
* referred to recursively by this. */
{
- register Element *elPtr;
+ Element *elPtr;
int count;
for (count = arrayPtr->numUsed, elPtr = arrayPtr->els; count > 0;
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 9005d7f2..67267e74 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -20,7 +20,7 @@ static const char *const sideNames[] = {
/*
* For each window that the packer cares about (either because the window is
- * managed by the packer or because the window has slaves that are managed by
+ * managed by the packer or because the window has content managed by
* the packer), there is a structure of the following type:
*/
@@ -29,15 +29,15 @@ typedef struct Packer {
* window has been deleted, but the packet
* hasn't had a chance to clean up yet because
* the structure is still in use. */
- struct Packer *masterPtr; /* Master window within which this window is
+ struct Packer *containerPtr; /* Container window within which this window is
* packed (NULL means this window isn't
* managed by the packer). */
- struct Packer *nextPtr; /* Next window packed within same master. List
+ struct Packer *nextPtr; /* Next window packed within same container. List
* is priority-ordered: first on list gets
* packed first. */
- struct Packer *slavePtr; /* First in list of slaves packed inside this
- * window (NULL means no packed slaves). */
- Side side; /* Side of master against which this window is
+ struct Packer *contentPtr; /* First in list of content packed inside this
+ * window (NULL means no packed content). */
+ Side side; /* Side of container against which this window is
* packed. */
Tk_Anchor anchor; /* If frame allocated for window is larger
* than window needs, this indicates how where
@@ -55,13 +55,13 @@ typedef struct Packer {
* each side). */
int doubleBw; /* Twice the window's last known border width.
* If this changes, the window must be
- * repacked within its master. */
+ * repacked within its container. */
int *abortPtr; /* If non-NULL, it means that there is a
* nested call to ArrangePacking already
* working on this window. *abortPtr may be
* set to 1 to abort that nested call. This
* happens, for example, if tkwin or any of
- * its slaves is deleted. */
+ * its content is deleted. */
int flags; /* Miscellaneous flags; see below for
* definitions. */
} Packer;
@@ -70,7 +70,7 @@ typedef struct Packer {
* Flag values for Packer structures:
*
* REQUESTED_REPACK: 1 means a Tcl_DoWhenIdle request has already
- * been made to repack all the slaves of this
+ * been made to repack all the content of this
* window.
* FILLX: 1 means if frame allocated for window is wider
* than window needs, expand window to fill
@@ -78,17 +78,17 @@ typedef struct Packer {
* than needed.
* FILLY: Same as FILLX, except for height.
* EXPAND: 1 means this window's frame will absorb any
- * extra space in the master window.
+ * extra space in the container window.
* OLD_STYLE: 1 means this window is being managed with the
* old-style packer algorithms (before Tk version
* 3.3). The main difference is that padding and
* filling are done differently.
* DONT_PROPAGATE: 1 means don't set this window's requested
- * size. 0 means if this window is a master then
+ * size. 0 means if this window is a container then
* Tk will set its requested size to fit the
- * needs of its slaves.
- * ALLOCED_MASTER 1 means that Pack has allocated itself as
- * geometry master for this window.
+ * needs of its content.
+ * ALLOCED_CONTAINER 1 means that Pack has allocated itself as
+ * geometry container for this window.
*/
#define REQUESTED_REPACK 1
@@ -97,20 +97,20 @@ typedef struct Packer {
#define EXPAND 8
#define OLD_STYLE 16
#define DONT_PROPAGATE 32
-#define ALLOCED_MASTER 64
+#define ALLOCED_CONTAINER 64
/*
* The following structure is the official type record for the packer:
*/
static void PackReqProc(ClientData clientData, Tk_Window tkwin);
-static void PackLostSlaveProc(ClientData clientData,
+static void PackLostContentProc(ClientData clientData,
Tk_Window tkwin);
static const Tk_GeomMgr packerType = {
"pack", /* name */
PackReqProc, /* requestProc */
- PackLostSlaveProc, /* lostSlaveProc */
+ PackLostContentProc, /* lostContentProc */
};
/*
@@ -118,17 +118,17 @@ static const Tk_GeomMgr packerType = {
*/
static void ArrangePacking(ClientData clientData);
-static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
+static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyPacker(void *memPtr);
static Packer * GetPacker(Tk_Window tkwin);
static int PackAfter(Tcl_Interp *interp, Packer *prevPtr,
- Packer *masterPtr, int objc,Tcl_Obj *const objv[]);
+ Packer *containerPtr, int objc,Tcl_Obj *const objv[]);
static void PackStructureProc(ClientData clientData,
XEvent *eventPtr);
static void Unlink(Packer *packPtr);
-static int XExpansion(Packer *slavePtr, int cavityWidth);
-static int YExpansion(Packer *slavePtr, int cavityHeight);
+static int XExpansion(Packer *contentPtr, int cavityWidth);
+static int YExpansion(Packer *contentPtr, int cavityHeight);
/*
*------------------------------------------------------------------------
@@ -194,22 +194,22 @@ Tk_PackObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
const char *argv2;
static const char *const optionStrings[] = {
/* after, append, before and unpack are deprecated */
- "after", "append", "before", "unpack",
- "configure", "forget", "info", "propagate", "slaves", NULL };
+ "after", "append", "before", "unpack", "configure",
+ "content", "forget", "info", "propagate", "slaves", NULL };
enum options {
- PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK,
- PACK_CONFIGURE, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
+ PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, PACK_CONFIGURE,
+ PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
int index;
if (objc >= 2) {
const char *string = Tcl_GetString(objv[1]);
if (string[0] == '.') {
- return ConfigureSlaves(interp, tkwin, objc-1, objv+1);
+ return ConfigureContent(interp, tkwin, objc-1, objv+1);
}
}
if (objc < 3) {
@@ -241,48 +241,48 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
prevPtr = GetPacker(tkwin2);
- if (prevPtr->masterPtr == NULL) {
+ if (prevPtr->containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed", argv2));
Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL);
return TCL_ERROR;
}
- return PackAfter(interp, prevPtr, prevPtr->masterPtr, objc-3, objv+3);
+ return PackAfter(interp, prevPtr, prevPtr->containerPtr, objc-3, objv+3);
}
case PACK_APPEND: {
- Packer *masterPtr;
- register Packer *prevPtr;
+ Packer *containerPtr;
+ Packer *prevPtr;
Tk_Window tkwin2;
if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetPacker(tkwin2);
- prevPtr = masterPtr->slavePtr;
+ containerPtr = GetPacker(tkwin2);
+ prevPtr = containerPtr->contentPtr;
if (prevPtr != NULL) {
while (prevPtr->nextPtr != NULL) {
prevPtr = prevPtr->nextPtr;
}
}
- return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3);
+ return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3);
}
case PACK_BEFORE: {
- Packer *packPtr, *masterPtr;
- register Packer *prevPtr;
+ Packer *packPtr, *containerPtr;
+ Packer *prevPtr;
Tk_Window tkwin2;
if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) {
return TCL_ERROR;
}
packPtr = GetPacker(tkwin2);
- if (packPtr->masterPtr == NULL) {
+ if (packPtr->containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed", argv2));
Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL);
return TCL_ERROR;
}
- masterPtr = packPtr->masterPtr;
- prevPtr = masterPtr->slavePtr;
+ containerPtr = packPtr->containerPtr;
+ prevPtr = containerPtr->contentPtr;
if (prevPtr == packPtr) {
prevPtr = NULL;
} else {
@@ -295,7 +295,7 @@ Tk_PackObjCmd(
}
}
}
- return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3);
+ return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3);
}
case PACK_CONFIGURE:
if (argv2[0] != '.') {
@@ -304,43 +304,43 @@ Tk_PackObjCmd(
Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL);
return TCL_ERROR;
}
- return ConfigureSlaves(interp, tkwin, objc-2, objv+2);
+ return ConfigureContent(interp, tkwin, objc-2, objv+2);
case PACK_FORGET: {
- Tk_Window slave;
- Packer *slavePtr;
+ Tk_Window content;
+ Packer *contentPtr;
int i;
for (i = 2; i < objc; i++) {
- if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) {
continue;
}
- slavePtr = GetPacker(slave);
- if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
- Tk_ManageGeometry(slave, NULL, NULL);
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
+ contentPtr = GetPacker(content);
+ if ((contentPtr != NULL) && (contentPtr->containerPtr != NULL)) {
+ Tk_ManageGeometry(content, NULL, NULL);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin,
+ contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
}
break;
}
case PACK_INFO: {
- register Packer *slavePtr;
- Tk_Window slave;
+ Packer *contentPtr;
+ Tk_Window content;
Tcl_Obj *infoObj;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr = GetPacker(slave);
- if (slavePtr->masterPtr == NULL) {
+ contentPtr = GetPacker(content);
+ if (contentPtr->containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed", argv2));
Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL);
@@ -349,12 +349,12 @@ Tk_PackObjCmd(
infoObj = Tcl_NewObj();
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1),
- TkNewWindowObj(slavePtr->masterPtr->tkwin));
+ TkNewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1),
- Tcl_NewStringObj(Tk_NameOfAnchor(slavePtr->anchor), -1));
+ Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), -1));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1),
- Tcl_NewBooleanObj(slavePtr->flags & EXPAND));
- switch (slavePtr->flags & (FILLX|FILLY)) {
+ Tcl_NewBooleanObj(contentPtr->flags & EXPAND));
+ switch (contentPtr->flags & (FILLX|FILLY)) {
case 0:
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1),
Tcl_NewStringObj("none", -1));
@@ -372,31 +372,31 @@ Tk_PackObjCmd(
Tcl_NewStringObj("both", -1));
break;
}
- TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
- TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY);
- TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft,slavePtr->padX);
- TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY);
+ TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX);
+ TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY);
+ TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft,contentPtr->padX);
+ TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY);
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-side", -1),
- Tcl_NewStringObj(sideNames[slavePtr->side], -1));
+ Tcl_NewStringObj(sideNames[contentPtr->side], -1));
Tcl_SetObjResult(interp, infoObj);
break;
}
case PACK_PROPAGATE: {
- Tk_Window master;
- Packer *masterPtr;
+ Tk_Window container;
+ Packer *containerPtr;
int propagate;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetPacker(master);
+ containerPtr = GetPacker(container);
if (objc == 3) {
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE)));
+ Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE)));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) {
@@ -404,56 +404,57 @@ Tk_PackObjCmd(
}
if (propagate) {
/*
- * If we have slaves, we need to register as geometry master.
+ * If we have content windows, we need to register as geometry container.
*/
- if (masterPtr->slavePtr != NULL) {
- if (TkSetGeometryMaster(interp, master, "pack") != TCL_OK) {
+ if (containerPtr->contentPtr != NULL) {
+ if (TkSetGeometryContainer(interp, container, "pack") != TCL_OK) {
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
- masterPtr->flags &= ~DONT_PROPAGATE;
+ containerPtr->flags &= ~DONT_PROPAGATE;
/*
- * Repack the master to allow new geometry information to
- * propagate upwards to the master's master.
+ * Repack the container to allow new geometry information to
+ * propagate upwards to the container's container.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
} else {
- if (masterPtr->flags & ALLOCED_MASTER) {
- TkFreeGeometryMaster(master, "pack");
- masterPtr->flags &= ~ALLOCED_MASTER;
+ if (containerPtr->flags & ALLOCED_CONTAINER) {
+ TkFreeGeometryContainer(container, "pack");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
}
- masterPtr->flags |= DONT_PROPAGATE;
+ containerPtr->flags |= DONT_PROPAGATE;
}
break;
}
+ case PACK_CONTENT:
case PACK_SLAVES: {
- Tk_Window master;
- Packer *masterPtr, *slavePtr;
+ Tk_Window container;
+ Packer *containerPtr, *contentPtr;
Tcl_Obj *resultObj;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
resultObj = Tcl_NewObj();
- masterPtr = GetPacker(master);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
+ containerPtr = GetPacker(container);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj(slavePtr->tkwin));
+ TkNewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, resultObj);
break;
@@ -470,11 +471,11 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
packPtr = GetPacker(tkwin2);
- if ((packPtr != NULL) && (packPtr->masterPtr != NULL)) {
+ if ((packPtr != NULL) && (packPtr->containerPtr != NULL)) {
Tk_ManageGeometry(tkwin2, NULL, NULL);
- if (packPtr->masterPtr->tkwin != Tk_Parent(packPtr->tkwin)) {
+ if (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin)) {
Tk_UnmaintainGeometry(packPtr->tkwin,
- packPtr->masterPtr->tkwin);
+ packPtr->containerPtr->tkwin);
}
Unlink(packPtr);
Tk_UnmapWindow(packPtr->tkwin);
@@ -504,17 +505,16 @@ Tk_PackObjCmd(
*------------------------------------------------------------------------
*/
- /* ARGSUSED */
static void
PackReqProc(
ClientData clientData, /* Packer's 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. */
{
- register Packer *packPtr = clientData;
+ Packer *packPtr = (Packer *)clientData;
- packPtr = packPtr->masterPtr;
+ packPtr = packPtr->containerPtr;
if (!(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, packPtr);
@@ -524,34 +524,33 @@ PackReqProc(
/*
*------------------------------------------------------------------------
*
- * PackLostSlaveProc --
+ * PackLostContentProc --
*
* 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 packer-related information about the slave.
+ * Forgets all packer-related information about the content.
*
*------------------------------------------------------------------------
*/
- /* ARGSUSED */
static void
-PackLostSlaveProc(
- ClientData clientData, /* Packer structure for slave window that was
+PackLostContentProc(
+ void *clientData, /* Packer structure for content window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */
{
- register Packer *slavePtr = clientData;
+ Packer *contentPtr = (Packer *)clientData;
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
/*
@@ -568,22 +567,22 @@ PackLostSlaveProc(
* None.
*
* Side effects:
- * The packed slaves of masterPtr may get resized or moved.
+ * The packed content of containerPtr may get resized or moved.
*
*------------------------------------------------------------------------
*/
static void
ArrangePacking(
- ClientData clientData) /* Structure describing master whose slaves
+ ClientData clientData) /* Structure describing container whose content
* are to be re-layed out. */
{
- register Packer *masterPtr = clientData;
- register Packer *slavePtr;
+ Packer *containerPtr = (Packer *)clientData;
+ Packer *contentPtr;
int cavityX, cavityY, cavityWidth, cavityHeight;
/* These variables keep track of the
* as-yet-unallocated space remaining in the
- * middle of the master window. */
+ * middle of the container window. */
int frameX, frameY, frameWidth, frameHeight;
/* These variables keep track of the frame
* allocated to the current window. */
@@ -596,14 +595,15 @@ ArrangePacking(
int borderLeft, borderRight;
int maxWidth, maxHeight, tmp;
- masterPtr->flags &= ~REQUESTED_REPACK;
+ containerPtr->flags &= ~REQUESTED_REPACK;
/*
- * If the master has no slaves anymore, then don't do anything at all:
- * just leave the master's size as-is.
+ * If the container has no content anymore, then leave the container size as-is.
+ * Otherwise there is no way to "relinquish" control over the container
+ * so another geometry manager can take over.
*/
- if (masterPtr->slavePtr == NULL) {
+ if (containerPtr->contentPtr == NULL) {
return;
}
@@ -613,52 +613,52 @@ ArrangePacking(
* necessary.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- masterPtr->abortPtr = &abort;
+ containerPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(containerPtr);
/*
- * Pass #1: scan all the slaves to figure out the total amount of space
+ * Pass #1: scan all the content to figure out the total amount of space
* needed. Two separate width and height values are computed:
*
* width - Holds the sum of the widths (plus padding) of all the
- * slaves seen so far that were packed LEFT or RIGHT.
+ * content seen so far that were packed LEFT or RIGHT.
* height - Holds the sum of the heights (plus padding) of all the
- * slaves seen so far that were packed TOP or BOTTOM.
+ * content seen so far that were packed TOP or BOTTOM.
*
- * maxWidth - Gradually builds up the width needed by the master to
- * just barely satisfy all the slave's needs. For each
- * slave, the code computes the width needed for all the
- * slaves so far and updates maxWidth if the new value is
+ * maxWidth - Gradually builds up the width needed by the container to
+ * just barely satisfy all the content's needs. For each
+ * content, the code computes the width needed for all the
+ * content so far and updates maxWidth if the new value is
* greater.
* maxHeight - Same as maxWidth, except keeps height info.
*/
- width = maxWidth = Tk_InternalBorderLeft(masterPtr->tkwin) +
- Tk_InternalBorderRight(masterPtr->tkwin);
- height = maxHeight = Tk_InternalBorderTop(masterPtr->tkwin) +
- Tk_InternalBorderBottom(masterPtr->tkwin);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
- tmp = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX + width;
+ width = maxWidth = Tk_InternalBorderLeft(containerPtr->tkwin) +
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ height = maxHeight = Tk_InternalBorderTop(containerPtr->tkwin) +
+ Tk_InternalBorderBottom(containerPtr->tkwin);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) {
+ tmp = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX + width;
if (tmp > maxWidth) {
maxWidth = tmp;
}
- height += Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY;
+ height += Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY;
} else {
- tmp = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY + height;
+ tmp = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY + height;
if (tmp > maxHeight) {
maxHeight = tmp;
}
- width += Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX;
+ width += Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX;
}
}
if (width > maxWidth) {
@@ -668,31 +668,31 @@ ArrangePacking(
maxHeight = height;
}
- if (maxWidth < Tk_MinReqWidth(masterPtr->tkwin)) {
- maxWidth = Tk_MinReqWidth(masterPtr->tkwin);
+ if (maxWidth < Tk_MinReqWidth(containerPtr->tkwin)) {
+ maxWidth = Tk_MinReqWidth(containerPtr->tkwin);
}
- if (maxHeight < Tk_MinReqHeight(masterPtr->tkwin)) {
- maxHeight = Tk_MinReqHeight(masterPtr->tkwin);
+ if (maxHeight < Tk_MinReqHeight(containerPtr->tkwin)) {
+ maxHeight = Tk_MinReqHeight(containerPtr->tkwin);
}
/*
- * If the total amount of space needed in the master window has changed,
+ * If the total amount of space needed in the container window has changed,
* and if we're propagating geometry information, then notify the next
* geometry manager up and requeue ourselves to start again after the
- * master has had a chance to resize us.
+ * container has had a chance to resize us.
*/
- if (((maxWidth != Tk_ReqWidth(masterPtr->tkwin))
- || (maxHeight != Tk_ReqHeight(masterPtr->tkwin)))
- && !(masterPtr->flags & DONT_PROPAGATE)) {
- Tk_GeometryRequest(masterPtr->tkwin, maxWidth, maxHeight);
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (((maxWidth != Tk_ReqWidth(containerPtr->tkwin))
+ || (maxHeight != Tk_ReqHeight(containerPtr->tkwin)))
+ && !(containerPtr->flags & DONT_PROPAGATE)) {
+ Tk_GeometryRequest(containerPtr->tkwin, maxWidth, maxHeight);
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
goto done;
}
/*
- * Pass #2: scan the slaves a second time assigning new sizes. The
+ * Pass #2: scan the content a second time assigning new sizes. The
* "cavity" variables keep track of the unclaimed space in the cavity of
* the window; this shrinks inward as we allocate windows around the
* edges. The "frame" variables keep track of the space allocated to the
@@ -700,22 +700,22 @@ ArrangePacking(
* somewhere inside the frame, depending on anchor.
*/
- cavityX = x = Tk_InternalBorderLeft(masterPtr->tkwin);
- cavityY = y = Tk_InternalBorderTop(masterPtr->tkwin);
- cavityWidth = Tk_Width(masterPtr->tkwin) -
- Tk_InternalBorderLeft(masterPtr->tkwin) -
- Tk_InternalBorderRight(masterPtr->tkwin);
- cavityHeight = Tk_Height(masterPtr->tkwin) -
- Tk_InternalBorderTop(masterPtr->tkwin) -
- Tk_InternalBorderBottom(masterPtr->tkwin);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
+ cavityX = x = Tk_InternalBorderLeft(containerPtr->tkwin);
+ cavityY = y = Tk_InternalBorderTop(containerPtr->tkwin);
+ cavityWidth = Tk_Width(containerPtr->tkwin) -
+ Tk_InternalBorderLeft(containerPtr->tkwin) -
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ cavityHeight = Tk_Height(containerPtr->tkwin) -
+ Tk_InternalBorderTop(containerPtr->tkwin) -
+ Tk_InternalBorderBottom(containerPtr->tkwin);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) {
frameWidth = cavityWidth;
- frameHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY;
- if (slavePtr->flags & EXPAND) {
- frameHeight += YExpansion(slavePtr, cavityHeight);
+ frameHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY;
+ if (contentPtr->flags & EXPAND) {
+ frameHeight += YExpansion(contentPtr, cavityHeight);
}
cavityHeight -= frameHeight;
if (cavityHeight < 0) {
@@ -723,7 +723,7 @@ ArrangePacking(
cavityHeight = 0;
}
frameX = cavityX;
- if (slavePtr->side == TOP) {
+ if (contentPtr->side == TOP) {
frameY = cavityY;
cavityY += frameHeight;
} else {
@@ -731,10 +731,10 @@ ArrangePacking(
}
} else {
frameHeight = cavityHeight;
- frameWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX;
- if (slavePtr->flags & EXPAND) {
- frameWidth += XExpansion(slavePtr, cavityWidth);
+ frameWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX;
+ if (contentPtr->flags & EXPAND) {
+ frameWidth += XExpansion(contentPtr, cavityWidth);
}
cavityWidth -= frameWidth;
if (cavityWidth < 0) {
@@ -742,7 +742,7 @@ ArrangePacking(
cavityWidth = 0;
}
frameY = cavityY;
- if (slavePtr->side == LEFT) {
+ if (contentPtr->side == LEFT) {
frameX = cavityX;
cavityX += frameWidth;
} else {
@@ -759,31 +759,31 @@ ArrangePacking(
* completely ignored except when computing frame size).
*/
- if (slavePtr->flags & OLD_STYLE) {
+ if (contentPtr->flags & OLD_STYLE) {
borderX = borderY = 0;
borderTop = borderBtm = 0;
borderLeft = borderRight = 0;
} else {
- borderX = slavePtr->padX;
- borderY = slavePtr->padY;
- borderLeft = slavePtr->padLeft;
+ borderX = contentPtr->padX;
+ borderY = contentPtr->padY;
+ borderLeft = contentPtr->padLeft;
borderRight = borderX - borderLeft;
- borderTop = slavePtr->padTop;
+ borderTop = contentPtr->padTop;
borderBtm = borderY - borderTop;
}
- width = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->iPadX;
- if ((slavePtr->flags & FILLX)
+ width = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->iPadX;
+ if ((contentPtr->flags & FILLX)
|| (width > (frameWidth - borderX))) {
width = frameWidth - borderX;
}
- height = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->iPadY;
- if ((slavePtr->flags & FILLY)
+ height = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->iPadY;
+ if ((contentPtr->flags & FILLY)
|| (height > (frameHeight - borderY))) {
height = frameHeight - borderY;
}
- switch (slavePtr->anchor) {
+ switch (contentPtr->anchor) {
case TK_ANCHOR_N:
x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
y = frameY + borderTop;
@@ -823,44 +823,44 @@ ArrangePacking(
default:
Tcl_Panic("bad frame factor in ArrangePacking");
}
- width -= slavePtr->doubleBw;
- height -= slavePtr->doubleBw;
+ width -= contentPtr->doubleBw;
+ height -= contentPtr->doubleBw;
/*
* The final step is to set the position, size, and mapped/unmapped
- * state of the slave. If the slave is a child of the master, then do
+ * state of the content. If the content is a child of the container, then do
* this here. Otherwise let Tk_MaintainGeometry do the work.
*/
- if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
+ if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- if ((x != Tk_X(slavePtr->tkwin))
- || (y != Tk_Y(slavePtr->tkwin))
- || (width != Tk_Width(slavePtr->tkwin))
- || (height != Tk_Height(slavePtr->tkwin))) {
- Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height);
+ if ((x != Tk_X(contentPtr->tkwin))
+ || (y != Tk_Y(contentPtr->tkwin))
+ || (width != Tk_Width(contentPtr->tkwin))
+ || (height != Tk_Height(contentPtr->tkwin))) {
+ Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height);
}
if (abort) {
goto done;
}
/*
- * Don't map the slave if the master isn't mapped: wait until
- * the master gets mapped later.
+ * Don't map the content if the container isn't mapped: wait until
+ * the container gets mapped later.
*/
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
+ if (Tk_IsMapped(containerPtr->tkwin)) {
+ Tk_MapWindow(contentPtr->tkwin);
}
}
} else {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin,
+ Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin,
x, y, width, height);
}
}
@@ -877,8 +877,8 @@ ArrangePacking(
}
done:
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
}
/*
@@ -886,7 +886,7 @@ ArrangePacking(
*
* XExpansion --
*
- * Given a list of packed slaves, the first of which is packed on the
+ * Given a list of packed content, the first of which is packed on the
* left or right and is expandable, compute how much to expand the child.
*
* Results:
@@ -901,9 +901,9 @@ ArrangePacking(
static int
XExpansion(
- register Packer *slavePtr, /* First in list of remaining slaves. */
+ Packer *contentPtr, /* First in list of remaining content. */
int cavityWidth) /* Horizontal space left for all remaining
- * slaves. */
+ * content. */
{
int numExpand, minExpand, curExpand;
int childWidth;
@@ -921,10 +921,10 @@ XExpansion(
minExpand = cavityWidth;
numExpand = 0;
- for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) {
- childWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX;
- if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
+ for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) {
+ childWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX;
+ if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) {
if (numExpand) {
curExpand = (cavityWidth - childWidth)/numExpand;
if (curExpand < minExpand) {
@@ -933,7 +933,7 @@ XExpansion(
}
} else {
cavityWidth -= childWidth;
- if (slavePtr->flags & EXPAND) {
+ if (contentPtr->flags & EXPAND) {
numExpand++;
}
}
@@ -952,7 +952,7 @@ XExpansion(
*
* YExpansion --
*
- * Given a list of packed slaves, the first of which is packed on the top
+ * Given a list of packed content, the first of which is packed on the top
* or bottom and is expandable, compute how much to expand the child.
*
* Results:
@@ -967,9 +967,9 @@ XExpansion(
static int
YExpansion(
- register Packer *slavePtr, /* First in list of remaining slaves. */
+ Packer *contentPtr, /* First in list of remaining content. */
int cavityHeight) /* Vertical space left for all remaining
- * slaves. */
+ * content. */
{
int numExpand, minExpand, curExpand;
int childHeight;
@@ -980,10 +980,10 @@ YExpansion(
minExpand = cavityHeight;
numExpand = 0;
- for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) {
- childHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY;
- if ((slavePtr->side == LEFT) || (slavePtr->side == RIGHT)) {
+ for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) {
+ childHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY;
+ if ((contentPtr->side == LEFT) || (contentPtr->side == RIGHT)) {
if (numExpand) {
curExpand = (cavityHeight - childHeight)/numExpand;
if (curExpand < minExpand) {
@@ -992,7 +992,7 @@ YExpansion(
}
} else {
cavityHeight -= childHeight;
- if (slavePtr->flags & EXPAND) {
+ if (contentPtr->flags & EXPAND) {
numExpand++;
}
}
@@ -1030,7 +1030,7 @@ GetPacker(
Tk_Window tkwin) /* Token for window for which packer structure
* is desired. */
{
- register Packer *packPtr;
+ Packer *packPtr;
Tcl_HashEntry *hPtr;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -1048,13 +1048,13 @@ GetPacker(
hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin,
&isNew);
if (!isNew) {
- return Tcl_GetHashValue(hPtr);
+ return (Packer *)Tcl_GetHashValue(hPtr);
}
- packPtr = ckalloc(sizeof(Packer));
+ packPtr = (Packer *)ckalloc(sizeof(Packer));
packPtr->tkwin = tkwin;
- packPtr->masterPtr = NULL;
+ packPtr->containerPtr = NULL;
packPtr->nextPtr = NULL;
- packPtr->slavePtr = NULL;
+ packPtr->contentPtr = NULL;
packPtr->side = TOP;
packPtr->anchor = TK_ANCHOR_CENTER;
packPtr->padX = packPtr->padY = 0;
@@ -1075,7 +1075,7 @@ GetPacker(
* PackAfter --
*
* This function does most of the real work of adding one or more windows
- * into the packing order for its master.
+ * into the packing order for its container.
*
* Results:
* A standard Tcl return value.
@@ -1092,14 +1092,14 @@ PackAfter(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Packer *prevPtr, /* Pack windows in argv just after this
* window; NULL means pack as first child of
- * masterPtr. */
- Packer *masterPtr, /* Master in which to pack windows. */
+ * containerPtr. */
+ Packer *containerPtr, /* Container in which to pack windows. */
int objc, /* Number of elements in objv. */
Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements:
* window name and side against which to
* pack. */
{
- register Packer *packPtr;
+ Packer *packPtr;
Tk_Window tkwin, ancestor, parent;
Tcl_Obj **options;
int index, optionCount, c;
@@ -1125,13 +1125,13 @@ PackAfter(
* its parent.
*/
- if (TkGetWindowFromObj(interp, masterPtr->tkwin, objv[0], &tkwin)
+ if (TkGetWindowFromObj(interp, containerPtr->tkwin, objv[0], &tkwin)
!= TCL_OK) {
return TCL_ERROR;
}
parent = Tk_Parent(tkwin);
- for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
@@ -1139,7 +1139,7 @@ PackAfter(
badWindow:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't pack %s inside %s", Tcl_GetString(objv[0]),
- Tk_PathName(masterPtr->tkwin)));
+ Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
return TCL_ERROR;
}
@@ -1147,7 +1147,7 @@ PackAfter(
if (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) {
goto badWindow;
}
- if (tkwin == masterPtr->tkwin) {
+ if (tkwin == containerPtr->tkwin) {
goto badWindow;
}
packPtr = GetPacker(tkwin);
@@ -1169,8 +1169,8 @@ PackAfter(
packPtr->flags |= OLD_STYLE;
for (index = 0 ; index < optionCount; index++) {
Tcl_Obj *curOptPtr = options[index];
- const char *curOpt = Tcl_GetString(curOptPtr);
- size_t length = curOptPtr->length;
+ int length;
+ const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length);
c = curOpt[0];
@@ -1227,7 +1227,7 @@ PackAfter(
packPtr->iPadY = 0;
index++;
} else if ((c == 'f') && (length > 1)
- && (strncmp(curOpt, "frame", (size_t) length) == 0)) {
+ && (strncmp(curOpt, "frame", length) == 0)) {
if (optionCount < (index+2)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"wrong # args: \"frame\""
@@ -1257,53 +1257,53 @@ PackAfter(
* Unpack this window if it's currently packed.
*/
- if (packPtr->masterPtr != NULL) {
- if ((packPtr->masterPtr != masterPtr) &&
- (packPtr->masterPtr->tkwin
+ if (packPtr->containerPtr != NULL) {
+ if ((packPtr->containerPtr != containerPtr) &&
+ (packPtr->containerPtr->tkwin
!= Tk_Parent(packPtr->tkwin))) {
Tk_UnmaintainGeometry(packPtr->tkwin,
- packPtr->masterPtr->tkwin);
+ packPtr->containerPtr->tkwin);
}
Unlink(packPtr);
}
/*
- * Add the window in the correct place in its master's packing
+ * Add the window in the correct place in its container's packing
* order, then make sure that the window is managed by us.
*/
- packPtr->masterPtr = masterPtr;
+ packPtr->containerPtr = containerPtr;
if (prevPtr == NULL) {
- packPtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = packPtr;
+ packPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = packPtr;
} else {
packPtr->nextPtr = prevPtr->nextPtr;
prevPtr->nextPtr = packPtr;
}
Tk_ManageGeometry(tkwin, &packerType, packPtr);
- if (!(masterPtr->flags & DONT_PROPAGATE)) {
- if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack")
+ if (!(containerPtr->flags & DONT_PROPAGATE)) {
+ if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack")
!= TCL_OK) {
Tk_ManageGeometry(tkwin, NULL, NULL);
Unlink(packPtr);
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
}
}
/*
- * Arrange for the master to be re-packed at the first idle moment.
+ * Arrange for the container to be re-packed at the first idle moment.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
return TCL_OK;
}
@@ -1313,31 +1313,31 @@ PackAfter(
*
* Unlink --
*
- * Remove a packer from its master's list of slaves.
+ * Remove a packer from its container's list of content.
*
* Results:
* None.
*
* Side effects:
- * The master will be scheduled for repacking.
+ * The container will be scheduled for repacking.
*
*----------------------------------------------------------------------
*/
static void
Unlink(
- register Packer *packPtr) /* Window to unlink. */
+ Packer *packPtr) /* Window to unlink. */
{
- register Packer *masterPtr, *packPtr2;
+ Packer *containerPtr, *packPtr2;
- masterPtr = packPtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = packPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (masterPtr->slavePtr == packPtr) {
- masterPtr->slavePtr = packPtr->nextPtr;
+ if (containerPtr->contentPtr == packPtr) {
+ containerPtr->contentPtr = packPtr->nextPtr;
} else {
- for (packPtr2 = masterPtr->slavePtr; ; packPtr2 = packPtr2->nextPtr) {
+ for (packPtr2 = containerPtr->contentPtr; ; packPtr2 = packPtr2->nextPtr) {
if (packPtr2 == NULL) {
Tcl_Panic("Unlink couldn't find previous window");
}
@@ -1347,24 +1347,24 @@ Unlink(
}
}
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- packPtr->masterPtr = NULL;
+ packPtr->containerPtr = NULL;
/*
- * If we have emptied this master from slaves it means we are no longer
+ * If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
*/
- if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) {
- TkFreeGeometryMaster(masterPtr->tkwin, "pack");
- masterPtr->flags &= ~ALLOCED_MASTER;
+ if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) {
+ TkFreeGeometryContainer(containerPtr->tkwin, "pack");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
}
}
@@ -1392,7 +1392,7 @@ DestroyPacker(
void *memPtr) /* Info about packed window that is now
* dead. */
{
- register Packer *packPtr = memPtr;
+ Packer *packPtr = (Packer *)memPtr;
ckfree(packPtr);
}
@@ -1410,7 +1410,7 @@ DestroyPacker(
*
* Side effects:
* If a window was just deleted, clean up all its packer-related
- * information. If it was just resized, repack its slaves, if any.
+ * information. If it was just resized, repack its content, if any.
*
*----------------------------------------------------------------------
*/
@@ -1421,42 +1421,42 @@ PackStructureProc(
* eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- register Packer *packPtr = clientData;
+ Packer *packPtr = (Packer *)clientData;
if (eventPtr->type == ConfigureNotify) {
- if ((packPtr->slavePtr != NULL)
+ if ((packPtr->contentPtr != NULL)
&& !(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, packPtr);
}
- if ((packPtr->masterPtr != NULL)
+ if ((packPtr->containerPtr != NULL)
&& (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) {
- if (!(packPtr->masterPtr->flags & REQUESTED_REPACK)) {
+ if (!(packPtr->containerPtr->flags & REQUESTED_REPACK)) {
packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width;
- packPtr->masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, packPtr->masterPtr);
+ packPtr->containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, packPtr->containerPtr);
}
}
} else if (eventPtr->type == DestroyNotify) {
- register Packer *slavePtr, *nextPtr;
+ Packer *contentPtr, *nextPtr;
- if (packPtr->masterPtr != NULL) {
+ if (packPtr->containerPtr != NULL) {
Unlink(packPtr);
}
- for (slavePtr = packPtr->slavePtr; slavePtr != NULL;
- slavePtr = nextPtr) {
- Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL);
- Tk_UnmapWindow(slavePtr->tkwin);
- slavePtr->masterPtr = NULL;
- nextPtr = slavePtr->nextPtr;
- slavePtr->nextPtr = NULL;
+ for (contentPtr = packPtr->contentPtr; contentPtr != NULL;
+ contentPtr = nextPtr) {
+ Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL);
+ Tk_UnmapWindow(contentPtr->tkwin);
+ contentPtr->containerPtr = NULL;
+ nextPtr = contentPtr->nextPtr;
+ contentPtr->nextPtr = NULL;
}
if (packPtr->tkwin != NULL) {
TkDisplay *dispPtr = ((TkWindow *) packPtr->tkwin)->dispPtr;
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable,
- (char *) packPtr->tkwin));
+ (void *)packPtr->tkwin));
}
if (packPtr->flags & REQUESTED_REPACK) {
@@ -1466,24 +1466,24 @@ PackStructureProc(
Tcl_EventuallyFree(packPtr, (Tcl_FreeProc *) DestroyPacker);
} else if (eventPtr->type == MapNotify) {
/*
- * When a master gets mapped, must redo the geometry computation so
- * that all of its slaves get remapped.
+ * When a container gets mapped, must redo the geometry computation so
+ * that all of its content get remapped.
*/
- if ((packPtr->slavePtr != NULL)
+ if ((packPtr->contentPtr != NULL)
&& !(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, packPtr);
}
} else if (eventPtr->type == UnmapNotify) {
- register Packer *packPtr2;
+ Packer *packPtr2;
/*
- * Unmap all of the slaves when the master gets unmapped, so that they
+ * Unmap all of the content when the container gets unmapped, so that they
* don't bother to keep redisplaying themselves.
*/
- for (packPtr2 = packPtr->slavePtr; packPtr2 != NULL;
+ for (packPtr2 = packPtr->contentPtr; packPtr2 != NULL;
packPtr2 = packPtr2->nextPtr) {
Tk_UnmapWindow(packPtr2->tkwin);
}
@@ -1493,36 +1493,36 @@ PackStructureProc(
/*
*----------------------------------------------------------------------
*
- * ConfigureSlaves --
+ * ConfigureContent --
*
* This implements the guts of the "pack configure" command. Given a list
- * of slaves and configuration options, it arranges for the packer to
- * manage the slaves and sets the specified options.
+ * of content and configuration options, it arranges for the packer to
+ * manage the content and sets the specified options.
*
* Results:
* TCL_OK is returned if all went well. Otherwise, TCL_ERROR is returned
* and the interp's result is set to contain an error message.
*
* Side effects:
- * Slave windows get taken over by the packer.
+ * Content windows get taken over by the packer.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(
+ConfigureContent(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Tk_Window tkwin, /* Any window in application containing
- * slaves. Used to look up slave names. */
+ * content. Used to look up content names. */
int objc, /* Number of elements in argv. */
Tcl_Obj *const objv[]) /* Argument objects: contains one or more
* window names followed by any number of
* "option value" pairs. Caller must make sure
* that there is at least one window name. */
{
- Packer *masterPtr, *slavePtr, *prevPtr, *otherPtr;
- Tk_Window other, slave, parent, ancestor;
- TkWindow *master;
+ Packer *containerPtr, *contentPtr, *prevPtr, *otherPtr;
+ Tk_Window other, content, parent, ancestor;
+ TkWindow *container;
int i, j, numWindows, tmp, positionGiven;
const char *string;
static const char *const optionStrings[] = {
@@ -1545,45 +1545,45 @@ ConfigureSlaves(
}
/*
- * Iterate over all of the slave windows, parsing the configuration
- * options for each slave. It's a bit wasteful to re-parse the options for
- * each slave, but things get too messy if we try to parse the arguments
- * just once at the beginning. For example, if a slave already is packed
+ * Iterate over all of the content windows, parsing the configuration
+ * options for each content. It's a bit wasteful to re-parse the options for
+ * each content, but things get too messy if we try to parse the arguments
+ * just once at the beginning. For example, if a content already is packed
* we want to just change a few existing values without resetting
* everything. If there are multiple windows, the -after, -before, and -in
* options only get processed for the first window.
*/
- masterPtr = NULL;
+ containerPtr = NULL;
prevPtr = NULL;
positionGiven = 0;
for (j = 0; j < numWindows; j++) {
- if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_TopWinHierarchy(slave)) {
+ if (Tk_TopWinHierarchy(content)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't pack \"%s\": it's a top-level window",
Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL);
return TCL_ERROR;
}
- slavePtr = GetPacker(slave);
- slavePtr->flags &= ~OLD_STYLE;
+ contentPtr = GetPacker(content);
+ contentPtr->flags &= ~OLD_STYLE;
/*
- * If the slave isn't currently packed, reset all of its configuration
+ * If the content isn't currently packed, reset all of its configuration
* information to default values (there could be old values left from
* a previous packing).
*/
- if (slavePtr->masterPtr == NULL) {
- slavePtr->side = TOP;
- slavePtr->anchor = TK_ANCHOR_CENTER;
- slavePtr->padX = slavePtr->padY = 0;
- slavePtr->padLeft = slavePtr->padTop = 0;
- slavePtr->iPadX = slavePtr->iPadY = 0;
- slavePtr->flags &= ~(FILLX|FILLY|EXPAND);
+ if (contentPtr->containerPtr == NULL) {
+ contentPtr->side = TOP;
+ contentPtr->anchor = TK_ANCHOR_CENTER;
+ contentPtr->padX = contentPtr->padY = 0;
+ contentPtr->padLeft = contentPtr->padTop = 0;
+ contentPtr->iPadX = contentPtr->iPadY = 0;
+ contentPtr->flags &= ~(FILLX|FILLY|EXPAND);
}
for (i = numWindows; i < objc; i+=2) {
@@ -1607,7 +1607,7 @@ ConfigureSlaves(
return TCL_ERROR;
}
prevPtr = GetPacker(other);
- if (prevPtr->masterPtr == NULL) {
+ if (prevPtr->containerPtr == NULL) {
notPacked:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed",
@@ -1616,12 +1616,12 @@ ConfigureSlaves(
NULL);
return TCL_ERROR;
}
- masterPtr = prevPtr->masterPtr;
+ containerPtr = prevPtr->containerPtr;
positionGiven = 1;
}
break;
case CONF_ANCHOR:
- if (Tk_GetAnchorFromObj(interp, objv[i+1], &slavePtr->anchor)
+ if (Tk_GetAnchorFromObj(interp, objv[i+1], &contentPtr->anchor)
!= TCL_OK) {
return TCL_ERROR;
}
@@ -1633,11 +1633,11 @@ ConfigureSlaves(
return TCL_ERROR;
}
otherPtr = GetPacker(other);
- if (otherPtr->masterPtr == NULL) {
+ if (otherPtr->containerPtr == NULL) {
goto notPacked;
}
- masterPtr = otherPtr->masterPtr;
- prevPtr = masterPtr->slavePtr;
+ containerPtr = otherPtr->containerPtr;
+ prevPtr = containerPtr->contentPtr;
if (prevPtr == otherPtr) {
prevPtr = NULL;
} else {
@@ -1652,21 +1652,21 @@ ConfigureSlaves(
if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr->flags &= ~EXPAND;
+ contentPtr->flags &= ~EXPAND;
if (tmp) {
- slavePtr->flags |= EXPAND;
+ contentPtr->flags |= EXPAND;
}
break;
case CONF_FILL:
string = Tcl_GetString(objv[i+1]);
if (strcmp(string, "none") == 0) {
- slavePtr->flags &= ~(FILLX|FILLY);
+ contentPtr->flags &= ~(FILLX|FILLY);
} else if (strcmp(string, "x") == 0) {
- slavePtr->flags = (slavePtr->flags & ~FILLY) | FILLX;
+ contentPtr->flags = (contentPtr->flags & ~FILLY) | FILLX;
} else if (strcmp(string, "y") == 0) {
- slavePtr->flags = (slavePtr->flags & ~FILLX) | FILLY;
+ contentPtr->flags = (contentPtr->flags & ~FILLX) | FILLY;
} else if (strcmp(string, "both") == 0) {
- slavePtr->flags |= FILLX|FILLY;
+ contentPtr->flags |= FILLX|FILLY;
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad fill style \"%s\": must be "
@@ -1681,8 +1681,8 @@ ConfigureSlaves(
!= TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetPacker(other);
- prevPtr = masterPtr->slavePtr;
+ containerPtr = GetPacker(other);
+ prevPtr = containerPtr->contentPtr;
if (prevPtr != NULL) {
while (prevPtr->nextPtr != NULL) {
prevPtr = prevPtr->nextPtr;
@@ -1692,7 +1692,7 @@ ConfigureSlaves(
}
break;
case CONF_IPADX:
- if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
+ if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp)
!= TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipadx value \"%s\": must be positive screen"
@@ -1700,10 +1700,10 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadX = tmp * 2;
+ contentPtr->iPadX = tmp * 2;
break;
case CONF_IPADY:
- if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
+ if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp)
!= TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipady value \"%s\": must be positive screen"
@@ -1711,17 +1711,17 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadY = tmp * 2;
+ contentPtr->iPadY = tmp * 2;
break;
case CONF_PADX:
- if (TkParsePadAmount(interp, slave, objv[i+1],
- &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) {
+ if (TkParsePadAmount(interp, content, objv[i+1],
+ &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) {
return TCL_ERROR;
}
break;
case CONF_PADY:
- if (TkParsePadAmount(interp, slave, objv[i+1],
- &slavePtr->padTop, &slavePtr->padY) != TCL_OK) {
+ if (TkParsePadAmount(interp, content, objv[i+1],
+ &contentPtr->padTop, &contentPtr->padY) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -1730,42 +1730,42 @@ ConfigureSlaves(
sizeof(char *), "side", TCL_EXACT, &side) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr->side = (Side) side;
+ contentPtr->side = (Side) side;
break;
}
}
/*
- * If no position in a packing list was specified and the slave is
+ * If no position in a packing list was specified and the content is
* already packed, then leave it in its current location in its
* current packing list.
*/
- if (!positionGiven && (slavePtr->masterPtr != NULL)) {
- masterPtr = slavePtr->masterPtr;
+ if (!positionGiven && (contentPtr->containerPtr != NULL)) {
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
/*
- * If the slave is going to be put back after itself or the same -in
+ * If the content is going to be put back after itself or the same -in
* window is passed in again, then just skip the whole operation,
* since it won't work anyway.
*/
- if (prevPtr == slavePtr) {
- masterPtr = slavePtr->masterPtr;
+ if (prevPtr == contentPtr) {
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
/*
* If none of the "-in", "-before", or "-after" options has been
- * specified, arrange for the slave to go at the end of the order for
+ * specified, arrange for the content to go at the end of the order for
* its parent.
*/
if (!positionGiven) {
- masterPtr = GetPacker(Tk_Parent(slave));
- prevPtr = masterPtr->slavePtr;
+ containerPtr = GetPacker(Tk_Parent(content));
+ prevPtr = containerPtr->contentPtr;
if (prevPtr != NULL) {
while (prevPtr->nextPtr != NULL) {
prevPtr = prevPtr->nextPtr;
@@ -1774,25 +1774,25 @@ ConfigureSlaves(
}
/*
- * Make sure that the slave's parent is either the master or an
- * ancestor of the master, and that the master and slave aren't the
+ * Make sure that the content's parent is either the container or an
+ * ancestor of the container, and that the container and content aren't the
* same.
*/
- parent = Tk_Parent(slave);
- for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ parent = Tk_Parent(content);
+ for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't pack %s inside %s", Tcl_GetString(objv[j]),
- Tk_PathName(masterPtr->tkwin)));
+ Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
return TCL_ERROR;
}
}
- if (slave == masterPtr->tkwin) {
+ if (content == containerPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't pack %s inside itself", Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL);
@@ -1803,67 +1803,67 @@ ConfigureSlaves(
* Check for management loops.
*/
- for (master = (TkWindow *)masterPtr->tkwin; master != NULL;
- master = (TkWindow *)TkGetGeomMaster(master)) {
- if (master == (TkWindow *)slave) {
+ for (container = (TkWindow *)containerPtr->tkwin; container != NULL;
+ container = (TkWindow *)TkGetContainer(container)) {
+ if (container == (TkWindow *)content) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't put %s inside %s, would cause management loop",
- Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin)));
+ Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
return TCL_ERROR;
}
}
- if (masterPtr->tkwin != Tk_Parent(slave)) {
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin;
+ if (containerPtr->tkwin != Tk_Parent(content)) {
+ ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin;
}
/*
- * Unpack the slave if it's currently packed, then position it after
+ * Unpack the content if it's currently packed, then position it after
* prevPtr.
*/
- if (slavePtr->masterPtr != NULL) {
- if ((slavePtr->masterPtr != masterPtr) &&
- (slavePtr->masterPtr->tkwin
- != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr != NULL) {
+ if ((contentPtr->containerPtr != containerPtr) &&
+ (contentPtr->containerPtr->tkwin
+ != Tk_Parent(contentPtr->tkwin))) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin,
+ contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
+ Unlink(contentPtr);
}
- slavePtr->masterPtr = masterPtr;
+ contentPtr->containerPtr = containerPtr;
if (prevPtr == NULL) {
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
+ contentPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = contentPtr;
} else {
- slavePtr->nextPtr = prevPtr->nextPtr;
- prevPtr->nextPtr = slavePtr;
+ contentPtr->nextPtr = prevPtr->nextPtr;
+ prevPtr->nextPtr = contentPtr;
}
- Tk_ManageGeometry(slave, &packerType, slavePtr);
- prevPtr = slavePtr;
+ Tk_ManageGeometry(content, &packerType, contentPtr);
+ prevPtr = contentPtr;
- if (!(masterPtr->flags & DONT_PROPAGATE)) {
- if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack")
+ if (!(containerPtr->flags & DONT_PROPAGATE)) {
+ if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack")
!= TCL_OK) {
- Tk_ManageGeometry(slave, NULL, NULL);
- Unlink(slavePtr);
+ Tk_ManageGeometry(content, NULL, NULL);
+ Unlink(contentPtr);
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
/*
- * Arrange for the master to be re-packed at the first idle moment.
+ * Arrange for the container to be re-packed at the first idle moment.
*/
scheduleLayout:
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
}
return TCL_OK;
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index ac61ba88..06a42d47 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -13,8 +13,8 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
+#include "default.h"
/*
* Flag values for "sticky"ness. The 16 combinations subsume the packer's
@@ -70,7 +70,7 @@ enum stretch {
typedef struct {
Tk_OptionTable pwOptions; /* Token for paned window option table. */
- Tk_OptionTable slaveOpts; /* Token for slave cget option table. */
+ Tk_OptionTable paneOpts; /* Token for pane cget option table. */
} OptionTables;
/*
@@ -78,35 +78,35 @@ typedef struct {
* managed by a paned window widget.
*/
-typedef struct Slave {
+typedef struct Pane {
Tk_Window tkwin; /* Window being managed. */
int minSize; /* Minimum size of this pane, on the relevant
* axis, in pixels. */
- int padx; /* Additional padding requested for slave, in
+ int padx; /* Additional padding requested for pane, in
* the x dimension. */
- int pady; /* Additional padding requested for slave, in
+ int pady; /* Additional padding requested for pane, in
* the y dimension. */
Tcl_Obj *widthPtr, *heightPtr;
- /* Tcl_Obj rep's of slave width/height, to
+ /* Tcl_Obj rep's of pane width/height, to
* allow for null values. */
- int width; /* Slave width. */
- int height; /* Slave height. */
+ int width; /* Pane width. */
+ int height; /* Pane height. */
int sticky; /* Sticky string. */
int x, y; /* Coordinates of the widget. */
int paneWidth, paneHeight; /* Pane dimensions (may be different from
- * slave width/height). */
+ * pane width/height). */
int sashx, sashy; /* Coordinates of the sash of the right or
* bottom of this pane. */
int markx, marky; /* Coordinates of the last mark set for the
* sash. */
int handlex, handley; /* Coordinates of the sash handle. */
- enum stretch stretch; /* Controls how slave grows/shrinks */
+ enum stretch stretch; /* Controls how pane grows/shrinks */
int hide; /* Controls visibility of pane */
- struct PanedWindow *masterPtr;
+ struct PanedWindow *containerPtr;
/* Paned window managing the window. */
Tk_Window after; /* Placeholder for parsing options. */
Tk_Window before; /* Placeholder for parsing options. */
-} Slave;
+} Pane;
/*
* A data structure of the following type is kept for each paned window widget
@@ -121,7 +121,7 @@ typedef struct PanedWindow {
Tcl_Command widgetCmd; /* Token for square's widget command. */
Tk_OptionTable optionTable; /* Token representing the configuration
* specifications. */
- Tk_OptionTable slaveOpts; /* Token for slave cget table. */
+ Tk_OptionTable paneOpts; /* Token for pane cget table. */
Tk_3DBorder background; /* Background color. */
int borderWidth; /* Value of -borderwidth option. */
int relief; /* 3D border effect (TK_RELIEF_RAISED, etc) */
@@ -151,9 +151,9 @@ typedef struct PanedWindow {
Tcl_Obj *proxyBorderWidthPtr; /* Tcl_Obj rep for proxyBorderWidth */
int proxyBorderWidth; /* Borderwidth used to draw proxy. */
int proxyRelief; /* Relief used to draw proxy, if TK_RELIEF_NULL then use relief. */
- Slave **slaves; /* Pointer to array of Slaves. */
- int numSlaves; /* Number of slaves. */
- int sizeofSlaves; /* Number of elements in the slaves array. */
+ Pane **panes; /* Pointer to array of Panes. */
+ int numPanes; /* Number of panes. */
+ int sizeofPanes; /* Number of elements in the panes array. */
int flags; /* Flags for widget; see below. */
} PanedWindow;
@@ -200,16 +200,16 @@ static void DisplayProxyWindow(ClientData clientData);
static void PanedWindowWorldChanged(ClientData instanceData);
static int PanedWindowWidgetObjCmd(ClientData clientData,
Tcl_Interp *, int objc, Tcl_Obj * const objv[]);
-static void PanedWindowLostSlaveProc(ClientData clientData,
+static void PanedWindowLostPaneProc(ClientData clientData,
Tk_Window tkwin);
static void PanedWindowReqProc(ClientData clientData,
Tk_Window tkwin);
static void ArrangePanes(ClientData clientData);
-static void Unlink(Slave *slavePtr);
-static Slave * GetPane(PanedWindow *pwPtr, Tk_Window tkwin);
+static void Unlink(Pane *panePtr);
+static Pane * GetPane(PanedWindow *pwPtr, Tk_Window tkwin);
static void GetFirstLastVisiblePane(PanedWindow *pwPtr,
int *firstPtr, int *lastPtr);
-static void SlaveStructureProc(ClientData clientData,
+static void PaneStructureProc(ClientData clientData,
XEvent *eventPtr);
static int PanedWindowSashCommand(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
@@ -218,7 +218,7 @@ static int PanedWindowProxyCommand(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
static void ComputeGeometry(PanedWindow *pwPtr);
-static int ConfigureSlaves(PanedWindow *pwPtr,
+static int ConfigurePanes(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
static void DestroyOptionTables(ClientData clientData,
@@ -233,7 +233,7 @@ static void RestoreSticky(ClientData clientData, Tk_Window tkwin,
char *internalPtr, char *oldInternalPtr);
static void AdjustForSticky(int sticky, int cavityWidth,
int cavityHeight, int *xPtr, int *yPtr,
- int *slaveWidthPtr, int *slaveHeightPtr);
+ int *paneWidthPtr, int *paneHeightPtr);
static void MoveSash(PanedWindow *pwPtr, int sash, int diff);
static int ObjectIsEmpty(Tcl_Obj *objPtr);
static char * ComputeSlotAddress(char *recordPtr, int offset);
@@ -241,16 +241,16 @@ static int PanedWindowIdentifyCoords(PanedWindow *pwPtr,
Tcl_Interp *interp, int x, int y);
/*
- * Sashes are between panes only, so there is one less sash than slaves
+ * Sashes are between panes only, so there is one less sash than panes
*/
#define ValidSashIndex(pwPtr, sash) \
- (((sash) >= 0) && ((sash) < ((pwPtr)->numSlaves-1)))
+ (((sash) >= 0) && ((sash) < ((pwPtr)->numPanes-1)))
static const Tk_GeomMgr panedWindowMgrType = {
"panedwindow", /* name */
PanedWindowReqProc, /* requestProc */
- PanedWindowLostSlaveProc, /* lostSlaveProc */
+ PanedWindowLostPaneProc, /* lostPaneProc */
};
/*
@@ -261,7 +261,7 @@ static const Tk_GeomMgr panedWindowMgrType = {
/*
* The following structure contains pointers to functions used for processing
- * the custom "-sticky" option for slave windows.
+ * the custom "-sticky" option for panes.
*/
static const Tk_ObjCustomOption stickyOption = {
@@ -334,33 +334,33 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
-static const Tk_OptionSpec slaveOptionSpecs[] = {
+static const Tk_OptionSpec paneOptionSpecs[] = {
{TK_OPTION_WINDOW, "-after", NULL, NULL,
- DEF_PANEDWINDOW_PANE_AFTER, -1, Tk_Offset(Slave, after),
+ DEF_PANEDWINDOW_PANE_AFTER, -1, Tk_Offset(Pane, after),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_WINDOW, "-before", NULL, NULL,
- DEF_PANEDWINDOW_PANE_BEFORE, -1, Tk_Offset(Slave, before),
+ DEF_PANEDWINDOW_PANE_BEFORE, -1, Tk_Offset(Pane, before),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-height", NULL, NULL,
- DEF_PANEDWINDOW_PANE_HEIGHT, Tk_Offset(Slave, heightPtr),
- Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_HEIGHT, Tk_Offset(Pane, heightPtr),
+ Tk_Offset(Pane, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
- DEF_PANEDWINDOW_PANE_HIDE, -1, Tk_Offset(Slave, hide), 0,0,GEOMETRY},
+ DEF_PANEDWINDOW_PANE_HIDE, -1, Tk_Offset(Pane, hide), 0,0,GEOMETRY},
{TK_OPTION_PIXELS, "-minsize", NULL, NULL,
- DEF_PANEDWINDOW_PANE_MINSIZE, -1, Tk_Offset(Slave, minSize), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_MINSIZE, -1, Tk_Offset(Pane, minSize), 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADX, -1, Tk_Offset(Slave, padx), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADX, -1, Tk_Offset(Pane, padx), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADY, -1, Tk_Offset(Slave, pady), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADY, -1, Tk_Offset(Pane, pady), 0, 0, 0},
{TK_OPTION_CUSTOM, "-sticky", NULL, NULL,
- DEF_PANEDWINDOW_PANE_STICKY, -1, Tk_Offset(Slave, sticky), 0,
+ DEF_PANEDWINDOW_PANE_STICKY, -1, Tk_Offset(Pane, sticky), 0,
&stickyOption, 0},
{TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch",
- DEF_PANEDWINDOW_PANE_STRETCH, -1, Tk_Offset(Slave, stretch), 0,
+ DEF_PANEDWINDOW_PANE_STRETCH, -1, Tk_Offset(Pane, stretch), 0,
(ClientData) stretchStrings, 0},
{TK_OPTION_PIXELS, "-width", NULL, NULL,
- DEF_PANEDWINDOW_PANE_WIDTH, Tk_Offset(Slave, widthPtr),
- Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_WIDTH, Tk_Offset(Pane, widthPtr),
+ Tk_Offset(Pane, width), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -383,7 +383,7 @@ static const Tk_OptionSpec slaveOptionSpecs[] = {
int
Tk_PanedWindowObjCmd(
- ClientData clientData, /* NULL. */
+ TCL_UNUSED(ClientData), /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj * const objv[]) /* Argument objects. */
@@ -428,7 +428,7 @@ Tk_PanedWindowObjCmd(
*/
pwOpts->pwOptions = Tk_CreateOptionTable(interp, optionSpecs);
- pwOpts->slaveOpts = Tk_CreateOptionTable(interp, slaveOptionSpecs);
+ pwOpts->paneOpts = Tk_CreateOptionTable(interp, paneOptionSpecs);
}
Tk_SetClass(tkwin, "Panedwindow");
@@ -437,7 +437,7 @@ Tk_PanedWindowObjCmd(
* Allocate and initialize the widget record.
*/
- pwPtr = ckalloc(sizeof(PanedWindow));
+ pwPtr = (PanedWindow *)ckalloc(sizeof(PanedWindow));
memset((void *)pwPtr, 0, (sizeof(PanedWindow)));
pwPtr->tkwin = tkwin;
pwPtr->display = Tk_Display(tkwin);
@@ -446,7 +446,7 @@ Tk_PanedWindowObjCmd(
Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd, pwPtr,
PanedWindowCmdDeletedProc);
pwPtr->optionTable = pwOpts->pwOptions;
- pwPtr->slaveOpts = pwOpts->slaveOpts;
+ pwPtr->paneOpts = pwOpts->paneOpts;
pwPtr->relief = TK_RELIEF_RAISED;
pwPtr->gc = NULL;
pwPtr->cursor = NULL;
@@ -471,7 +471,7 @@ Tk_PanedWindowObjCmd(
/*
* Find the toplevel ancestor of the panedwindow, and make a proxy win as
* a child of that window; this way the proxy can always float above
- * slaves in the panedwindow.
+ * panes in the panedwindow.
*/
parent = Tk_Parent(pwPtr->tkwin);
@@ -535,7 +535,7 @@ PanedWindowWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj * const objv[]) /* Argument objects. */
{
- PanedWindow *pwPtr = clientData;
+ PanedWindow *pwPtr = (PanedWindow *)clientData;
int result = TCL_OK;
static const char *const optionStrings[] = {
"add", "cget", "configure", "forget", "identify", "panecget",
@@ -548,7 +548,7 @@ PanedWindowWidgetObjCmd(
Tcl_Obj *resultObj;
int index, count, i, x, y;
Tk_Window tkwin;
- Slave *slavePtr;
+ Pane *panePtr;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
@@ -569,7 +569,7 @@ PanedWindowWidgetObjCmd(
result = TCL_ERROR;
break;
}
- result = ConfigureSlaves(pwPtr, interp, objc, objv);
+ result = ConfigurePanes(pwPtr, interp, objc, objv);
break;
case PW_CGET:
@@ -604,7 +604,6 @@ PanedWindowWidgetObjCmd(
break;
case PW_FORGET: {
- int i;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?");
@@ -616,21 +615,21 @@ PanedWindowWidgetObjCmd(
* Clean up each window named in the arg list.
*/
for (count = 0, i = 2; i < objc; i++) {
- Tk_Window slave = Tk_NameToWindow(interp, Tcl_GetString(objv[i]),
+ Tk_Window pane = Tk_NameToWindow(interp, Tcl_GetString(objv[i]),
pwPtr->tkwin);
- if (slave == NULL) {
+ if (pane == NULL) {
continue;
}
- slavePtr = GetPane(pwPtr, slave);
- if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
+ panePtr = GetPane(pwPtr, pane);
+ if ((panePtr != NULL) && (panePtr->containerPtr != NULL)) {
count++;
- Tk_ManageGeometry(slave, NULL, NULL);
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
- Unlink(slavePtr);
+ Tk_ManageGeometry(pane, NULL, NULL);
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ Tk_DeleteEventHandler(panePtr->tkwin, StructureNotifyMask,
+ PaneStructureProc, panePtr);
+ Tk_UnmapWindow(panePtr->tkwin);
+ Unlink(panePtr);
}
if (count != 0) {
ComputeGeometry(pwPtr);
@@ -666,15 +665,15 @@ PanedWindowWidgetObjCmd(
break;
}
resultObj = NULL;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->tkwin == tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionValue(interp,
- (char *) pwPtr->slaves[i], pwPtr->slaveOpts,
+ (char *) pwPtr->panes[i], pwPtr->paneOpts,
objv[3], tkwin);
}
}
if (resultObj == NULL) {
- if (i == pwPtr->numSlaves) {
+ if (i == pwPtr->numPanes) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"not managed by this window", -1));
Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED",
@@ -706,10 +705,10 @@ PanedWindowWidgetObjCmd(
result = TCL_ERROR;
break;
}
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->tkwin == tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionInfo(interp,
- (char *) pwPtr->slaves[i], pwPtr->slaveOpts,
+ (char *) pwPtr->panes[i], pwPtr->paneOpts,
(objc == 4) ? objv[3] : NULL,
pwPtr->tkwin);
if (resultObj == NULL) {
@@ -721,15 +720,15 @@ PanedWindowWidgetObjCmd(
}
}
} else {
- result = ConfigureSlaves(pwPtr, interp, objc, objv);
+ result = ConfigurePanes(pwPtr, interp, objc, objv);
}
break;
case PW_PANES:
resultObj = Tcl_NewObj();
- for (i = 0; i < pwPtr->numSlaves; i++) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj(pwPtr->slaves[i]->tkwin));
+ TkNewWindowObj(pwPtr->panes[i]->tkwin));
}
Tcl_SetObjResult(interp, resultObj);
break;
@@ -749,37 +748,37 @@ PanedWindowWidgetObjCmd(
/*
*----------------------------------------------------------------------
*
- * ConfigureSlaves --
+ * ConfigurePanes --
*
- * Add or alter the configuration options of a slave in a paned window.
+ * Add or alter the configuration options of a pane in a paned window.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Depends on options; may add a slave to the paned window, may alter the
- * geometry management options of a slave.
+ * Depends on options; may add a pane to the paned window, may alter the
+ * geometry management options of a pane.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(
+ConfigurePanes(
PanedWindow *pwPtr, /* Information about paned window. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int i, firstOptionArg, j, found, doubleBw, index, numNewSlaves, haveLoc;
+ int i, firstOptionArg, j, found, doubleBw, index, numNewPanes, haveLoc;
int insertIndex;
Tk_Window tkwin = NULL, ancestor, parent;
- Slave *slavePtr, **inserts, **newSlaves;
- Slave options;
+ Pane *panePtr, **inserts, **newPanes;
+ Pane options;
const char *arg;
/*
* Find the non-window name arguments; these are the configure options for
- * the slaves. Also validate that the window names given are legitimate
+ * the panes. Also validate that the window names given are legitimate
* (ie, they are real windows, they are not the panedwindow itself, etc.).
*/
@@ -817,8 +816,8 @@ ConfigureSlaves(
return TCL_ERROR;
} else {
/*
- * Make sure the panedwindow is the parent of the slave,
- * or a descendant of the slave's parent.
+ * Make sure the panedwindow is the parent of the pane,
+ * or a descendant of the pane's parent.
*/
parent = Tk_Parent(tkwin);
@@ -847,8 +846,8 @@ ConfigureSlaves(
* extra testing in the for loop below.
*/
- memset((void *)&options, 0, sizeof(Slave));
- if (Tk_SetOptions(interp, (char *) &options, pwPtr->slaveOpts,
+ memset((void *)&options, 0, sizeof(Pane));
+ if (Tk_SetOptions(interp, (char *) &options, pwPtr->paneOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
@@ -865,8 +864,8 @@ ConfigureSlaves(
if (options.after != NULL) {
tkwin = options.after;
haveLoc = 1;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (options.after == pwPtr->slaves[i]->tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (options.after == pwPtr->panes[i]->tkwin) {
index = i + 1;
break;
}
@@ -874,8 +873,8 @@ ConfigureSlaves(
} else if (options.before != NULL) {
tkwin = options.before;
haveLoc = 1;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (options.before == pwPtr->slaves[i]->tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (options.before == pwPtr->panes[i]->tkwin) {
index = i;
break;
}
@@ -892,28 +891,28 @@ ConfigureSlaves(
"window \"%s\" is not managed by %s",
Tk_PathName(tkwin), Tk_PathName(pwPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", NULL);
- Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts,
+ Tk_FreeConfigOptions((char *) &options, pwPtr->paneOpts,
pwPtr->tkwin);
return TCL_ERROR;
}
/*
- * Allocate an array to hold, in order, the pointers to the slave
+ * Allocate an array to hold, in order, the pointers to the pane
* structures corresponding to the windows specified. Some of those
* structures may already have existed, some may be new.
*/
- inserts = ckalloc(sizeof(Slave *) * (firstOptionArg - 2));
+ inserts = (Pane **)ckalloc(sizeof(Pane *) * (firstOptionArg - 2));
insertIndex = 0;
/*
- * Populate the inserts array, creating new slave structures as necessary,
+ * Populate the inserts array, creating new pane structures as necessary,
* applying the options to each structure as we go, and, if necessary,
- * marking the spot in the original slaves array as empty (for
- * pre-existing slave structures).
+ * marking the spot in the original panes array as empty (for
+ * pre-existing pane structures).
*/
- for (i = 0, numNewSlaves = 0; i < firstOptionArg - 2; i++) {
+ for (i = 0, numNewPanes = 0; i < firstOptionArg - 2; i++) {
/*
* We don't check that tkwin is NULL here, because the pre-pass above
* guarantees that the input at this stage is good.
@@ -923,24 +922,24 @@ ConfigureSlaves(
pwPtr->tkwin);
found = 0;
- for (j = 0; j < pwPtr->numSlaves; j++) {
- if (pwPtr->slaves[j] != NULL && pwPtr->slaves[j]->tkwin == tkwin) {
- Tk_SetOptions(interp, (char *) pwPtr->slaves[j],
- pwPtr->slaveOpts, objc - firstOptionArg,
+ for (j = 0; j < pwPtr->numPanes; j++) {
+ if (pwPtr->panes[j] != NULL && pwPtr->panes[j]->tkwin == tkwin) {
+ Tk_SetOptions(interp, (char *) pwPtr->panes[j],
+ pwPtr->paneOpts, objc - firstOptionArg,
objv + firstOptionArg, pwPtr->tkwin, NULL, NULL);
- if (pwPtr->slaves[j]->minSize < 0) {
- pwPtr->slaves[j]->minSize = 0;
+ if (pwPtr->panes[j]->minSize < 0) {
+ pwPtr->panes[j]->minSize = 0;
}
found = 1;
/*
- * If the slave is supposed to move, add it to the inserts
+ * If the pane is supposed to move, add it to the inserts
* array now; otherwise, leave it where it is.
*/
if (index != -1) {
- inserts[insertIndex++] = pwPtr->slaves[j];
- pwPtr->slaves[j] = NULL;
+ inserts[insertIndex++] = pwPtr->panes[j];
+ pwPtr->panes[j] = NULL;
}
break;
}
@@ -951,7 +950,7 @@ ConfigureSlaves(
}
/*
- * Make sure this slave wasn't already put into the inserts array,
+ * Make sure this pane wasn't already put into the inserts array,
* i.e., when the user specifies the same window multiple times in a
* single add commaned.
*/
@@ -966,104 +965,104 @@ ConfigureSlaves(
}
/*
- * Create a new slave structure and initialize it. All slaves start
+ * Create a new pane structure and initialize it. All panes start
* out with their "natural" dimensions.
*/
- slavePtr = ckalloc(sizeof(Slave));
- memset(slavePtr, 0, sizeof(Slave));
- Tk_InitOptions(interp, (char *)slavePtr, pwPtr->slaveOpts,
+ panePtr = (Pane *)ckalloc(sizeof(Pane));
+ memset(panePtr, 0, sizeof(Pane));
+ Tk_InitOptions(interp, (char *)panePtr, pwPtr->paneOpts,
pwPtr->tkwin);
- Tk_SetOptions(interp, (char *)slavePtr, pwPtr->slaveOpts,
+ Tk_SetOptions(interp, (char *)panePtr, pwPtr->paneOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL);
- slavePtr->tkwin = tkwin;
- slavePtr->masterPtr = pwPtr;
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- if (slavePtr->width > 0) {
- slavePtr->paneWidth = slavePtr->width;
+ panePtr->tkwin = tkwin;
+ panePtr->containerPtr = pwPtr;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ if (panePtr->width > 0) {
+ panePtr->paneWidth = panePtr->width;
} else {
- slavePtr->paneWidth = Tk_ReqWidth(tkwin) + doubleBw;
+ panePtr->paneWidth = Tk_ReqWidth(tkwin) + doubleBw;
}
- if (slavePtr->height > 0) {
- slavePtr->paneHeight = slavePtr->height;
+ if (panePtr->height > 0) {
+ panePtr->paneHeight = panePtr->height;
} else {
- slavePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw;
+ panePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw;
}
- if (slavePtr->minSize < 0) {
- slavePtr->minSize = 0;
+ if (panePtr->minSize < 0) {
+ panePtr->minSize = 0;
}
/*
- * Set up the geometry management callbacks for this slave.
+ * Set up the geometry management callbacks for this pane.
*/
- Tk_CreateEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, slavePtr);
- Tk_ManageGeometry(slavePtr->tkwin, &panedWindowMgrType, slavePtr);
- inserts[insertIndex++] = slavePtr;
- numNewSlaves++;
+ Tk_CreateEventHandler(panePtr->tkwin, StructureNotifyMask,
+ PaneStructureProc, panePtr);
+ Tk_ManageGeometry(panePtr->tkwin, &panedWindowMgrType, panePtr);
+ inserts[insertIndex++] = panePtr;
+ numNewPanes++;
}
/*
- * Allocate the new slaves array, then copy the slaves into it, in order.
+ * Allocate the new panes array, then copy the panes into it, in order.
*/
- i = sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves);
- newSlaves = ckalloc(i);
- memset(newSlaves, 0, (size_t) i);
+ i = sizeof(Pane *) * (pwPtr->numPanes + numNewPanes);
+ newPanes = (Pane **)ckalloc(i);
+ memset(newPanes, 0, i);
if (index == -1) {
/*
- * If none of the existing slaves have to be moved, just copy the old
+ * If none of the existing panes have to be moved, just copy the old
* and append the new.
*/
- memcpy((void *)&(newSlaves[0]), pwPtr->slaves,
- sizeof(Slave *) * pwPtr->numSlaves);
- memcpy((void *)&(newSlaves[pwPtr->numSlaves]), inserts,
- sizeof(Slave *) * numNewSlaves);
+ memcpy((void *)&(newPanes[0]), pwPtr->panes,
+ sizeof(Pane *) * pwPtr->numPanes);
+ memcpy((void *)&(newPanes[pwPtr->numPanes]), inserts,
+ sizeof(Pane *) * numNewPanes);
} else {
/*
- * If some of the existing slaves were moved, the old slaves array
+ * If some of the existing panes were moved, the old panes array
* will be partially populated, with some valid and some invalid
- * entries. Walk through it, copying valid entries to the new slaves
+ * entries. Walk through it, copying valid entries to the new panes
* array as we go; when we get to the insert location for the new
- * slaves, copy the inserts array over, then finish off the old slaves
+ * panes, copy the inserts array over, then finish off the old panes
* array.
*/
for (i = 0, j = 0; i < index; i++) {
- if (pwPtr->slaves[i] != NULL) {
- newSlaves[j] = pwPtr->slaves[i];
+ if (pwPtr->panes[i] != NULL) {
+ newPanes[j] = pwPtr->panes[i];
j++;
}
}
- memcpy((void *)&(newSlaves[j]), inserts, sizeof(Slave *)*insertIndex);
+ memcpy((void *)&(newPanes[j]), inserts, sizeof(Pane *)*insertIndex);
j += firstOptionArg - 2;
- for (i = index; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i] != NULL) {
- newSlaves[j] = pwPtr->slaves[i];
+ for (i = index; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i] != NULL) {
+ newPanes[j] = pwPtr->panes[i];
j++;
}
}
}
/*
- * Make the new slaves array the paned window's slave array, and clean up.
+ * Make the new panes array the paned window's pane array, and clean up.
*/
- ckfree(pwPtr->slaves);
+ ckfree(pwPtr->panes);
ckfree(inserts);
- pwPtr->slaves = newSlaves;
+ pwPtr->panes = newPanes;
/*
- * Set the paned window's slave count to the new value.
+ * Set the paned window's pane count to the new value.
*/
- pwPtr->numSlaves += numNewSlaves;
+ pwPtr->numPanes += numNewPanes;
- Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts, pwPtr->tkwin);
+ Tk_FreeConfigOptions((char *) &options, pwPtr->paneOpts, pwPtr->tkwin);
ComputeGeometry(pwPtr);
return TCL_OK;
@@ -1101,7 +1100,7 @@ PanedWindowSashCommand(
};
int index, sash, x, y, diff;
Tcl_Obj *coords[2];
- Slave *slavePtr;
+ Pane *panePtr;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?");
@@ -1130,10 +1129,10 @@ PanedWindowSashCommand(
Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL);
return TCL_ERROR;
}
- slavePtr = pwPtr->slaves[sash];
+ panePtr = pwPtr->panes[sash];
- coords[0] = Tcl_NewIntObj(slavePtr->sashx);
- coords[1] = Tcl_NewIntObj(slavePtr->sashy);
+ coords[0] = Tcl_NewIntObj(panePtr->sashx);
+ coords[1] = Tcl_NewIntObj(panePtr->sashy);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
break;
@@ -1163,11 +1162,11 @@ PanedWindowSashCommand(
return TCL_ERROR;
}
- pwPtr->slaves[sash]->markx = x;
- pwPtr->slaves[sash]->marky = y;
+ pwPtr->panes[sash]->markx = x;
+ pwPtr->panes[sash]->marky = y;
} else {
- coords[0] = Tcl_NewIntObj(pwPtr->slaves[sash]->markx);
- coords[1] = Tcl_NewIntObj(pwPtr->slaves[sash]->marky);
+ coords[0] = Tcl_NewIntObj(pwPtr->panes[sash]->markx);
+ coords[1] = Tcl_NewIntObj(pwPtr->panes[sash]->marky);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
}
break;
@@ -1198,18 +1197,18 @@ PanedWindowSashCommand(
return TCL_ERROR;
}
- slavePtr = pwPtr->slaves[sash];
+ panePtr = pwPtr->panes[sash];
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (index == SASH_PLACE) {
- diff = x - pwPtr->slaves[sash]->sashx;
+ diff = x - pwPtr->panes[sash]->sashx;
} else {
- diff = x - pwPtr->slaves[sash]->markx;
+ diff = x - pwPtr->panes[sash]->markx;
}
} else {
if (index == SASH_PLACE) {
- diff = y - pwPtr->slaves[sash]->sashy;
+ diff = y - pwPtr->panes[sash]->sashy;
} else {
- diff = y - pwPtr->slaves[sash]->marky;
+ diff = y - pwPtr->panes[sash]->marky;
}
}
@@ -1249,7 +1248,7 @@ ConfigurePanedWindow(
Tk_SavedOptions savedOptions;
int typemask = 0;
- if (Tk_SetOptions(interp, (char *) pwPtr, pwPtr->optionTable, objc, objv,
+ if (Tk_SetOptions(interp, (char *)pwPtr, pwPtr->optionTable, objc, objv,
pwPtr->tkwin, &savedOptions, &typemask) != TCL_OK) {
Tk_RestoreSavedOptions(&savedOptions);
return TCL_ERROR;
@@ -1295,7 +1294,7 @@ PanedWindowWorldChanged(
{
XGCValues gcValues;
GC newGC;
- PanedWindow *pwPtr = instanceData;
+ PanedWindow *pwPtr = (PanedWindow *)instanceData;
/*
* Allocated a graphics context for drawing the paned window widget
@@ -1352,7 +1351,7 @@ PanedWindowEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- PanedWindow *pwPtr = clientData;
+ PanedWindow *pwPtr = (PanedWindow *)clientData;
int i;
if (eventPtr->type == Expose) {
@@ -1369,15 +1368,15 @@ PanedWindowEventProc(
} else if (eventPtr->type == DestroyNotify) {
DestroyPanedWindow(pwPtr);
} else if (eventPtr->type == UnmapNotify) {
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (!pwPtr->slaves[i]->hide) {
- Tk_UnmapWindow(pwPtr->slaves[i]->tkwin);
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (!pwPtr->panes[i]->hide) {
+ Tk_UnmapWindow(pwPtr->panes[i]->tkwin);
}
}
} else if (eventPtr->type == MapNotify) {
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (!pwPtr->slaves[i]->hide) {
- Tk_MapWindow(pwPtr->slaves[i]->tkwin);
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (!pwPtr->panes[i]->hide) {
+ Tk_MapWindow(pwPtr->panes[i]->tkwin);
}
}
}
@@ -1405,7 +1404,7 @@ static void
PanedWindowCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- PanedWindow *pwPtr = clientData;
+ PanedWindow *pwPtr = (PanedWindow *)clientData;
/*
* This function could be invoked either because the window was destroyed
@@ -1442,8 +1441,8 @@ static void
DisplayPanedWindow(
ClientData clientData) /* Information about window. */
{
- PanedWindow *pwPtr = clientData;
- Slave *slavePtr;
+ PanedWindow *pwPtr = (PanedWindow *)clientData;
+ Pane *panePtr;
Pixmap pixmap;
Tk_Window tkwin = pwPtr->tkwin;
int i, sashWidth, sashHeight;
@@ -1484,10 +1483,10 @@ DisplayPanedWindow(
*/
if (horizontal) {
- sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderWidth(tkwin));
+ sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderLeft(tkwin));
sashWidth = pwPtr->sashWidth;
} else {
- sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderWidth(tkwin));
+ sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderLeft(tkwin));
sashHeight = pwPtr->sashWidth;
}
@@ -1496,19 +1495,19 @@ DisplayPanedWindow(
*/
GetFirstLastVisiblePane(pwPtr, &first, &last);
- for (i = 0; i < pwPtr->numSlaves - 1; i++) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide || i == last) {
+ for (i = 0; i < pwPtr->numPanes - 1; i++) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide || i == last) {
continue;
}
if (sashWidth > 0 && sashHeight > 0) {
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
- slavePtr->sashx, slavePtr->sashy, sashWidth, sashHeight,
+ panePtr->sashx, panePtr->sashy, sashWidth, sashHeight,
1, pwPtr->sashRelief);
}
if (pwPtr->showHandle) {
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
- slavePtr->handlex, slavePtr->handley,
+ panePtr->handlex, panePtr->handley,
pwPtr->handleSize, pwPtr->handleSize, 1,
TK_RELIEF_RAISED);
}
@@ -1569,23 +1568,23 @@ DestroyPanedWindow(
}
/*
- * Clean up the slave list; foreach slave:
- * o Cancel the slave's structure notification callback
- * o Cancel geometry management for the slave.
- * o Free memory for the slave
+ * Clean up the pane list; foreach pane:
+ * o Cancel the pane's structure notification callback
+ * o Cancel geometry management for the pane.
+ * o Free memory for the pane
*/
- for (i = 0; i < pwPtr->numSlaves; i++) {
- Tk_DeleteEventHandler(pwPtr->slaves[i]->tkwin, StructureNotifyMask,
- SlaveStructureProc, pwPtr->slaves[i]);
- Tk_ManageGeometry(pwPtr->slaves[i]->tkwin, NULL, NULL);
- Tk_FreeConfigOptions((char *) pwPtr->slaves[i], pwPtr->slaveOpts,
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ Tk_DeleteEventHandler(pwPtr->panes[i]->tkwin, StructureNotifyMask,
+ PaneStructureProc, pwPtr->panes[i]);
+ Tk_ManageGeometry(pwPtr->panes[i]->tkwin, NULL, NULL);
+ Tk_FreeConfigOptions((char *) pwPtr->panes[i], pwPtr->paneOpts,
pwPtr->tkwin);
- ckfree(pwPtr->slaves[i]);
- pwPtr->slaves[i] = NULL;
+ ckfree(pwPtr->panes[i]);
+ pwPtr->panes[i] = NULL;
}
- if (pwPtr->slaves) {
- ckfree(pwPtr->slaves);
+ if (pwPtr->panes) {
+ ckfree(pwPtr->panes);
}
/*
@@ -1627,11 +1626,11 @@ static void
PanedWindowReqProc(
ClientData clientData, /* Paned window's 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. */
{
- Slave *slavePtr = clientData;
- PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr;
+ Pane *panePtr = (Pane *)clientData;
+ PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr;
if (Tk_IsMapped(pwPtr->tkwin)) {
if (!(pwPtr->flags & RESIZE_PENDING)) {
@@ -1639,13 +1638,13 @@ PanedWindowReqProc(
Tcl_DoWhenIdle(ArrangePanes, pwPtr);
}
} else {
- int doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
+ int doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
- if (slavePtr->width <= 0) {
- slavePtr->paneWidth = Tk_ReqWidth(slavePtr->tkwin) + doubleBw;
+ if (panePtr->width <= 0) {
+ panePtr->paneWidth = Tk_ReqWidth(panePtr->tkwin) + doubleBw;
}
- if (slavePtr->height <= 0) {
- slavePtr->paneHeight = Tk_ReqHeight(slavePtr->tkwin) + doubleBw;
+ if (panePtr->height <= 0) {
+ panePtr->paneHeight = Tk_ReqHeight(panePtr->tkwin) + doubleBw;
}
ComputeGeometry(pwPtr);
}
@@ -1654,39 +1653,39 @@ PanedWindowReqProc(
/*
*--------------------------------------------------------------
*
- * PanedWindowLostSlaveProc --
+ * PanedWindowLostPaneProc --
*
* 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 pane that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all information about the slave. Causes geometry to be
+ * Forgets all information about the pane. Causes geometry to be
* recomputed for the panedwindow.
*
*--------------------------------------------------------------
*/
static void
-PanedWindowLostSlaveProc(
- ClientData clientData, /* Grid structure for slave window that was
+PanedWindowLostPaneProc(
+ ClientData clientData, /* Grid structure for the pane that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ TCL_UNUSED(Tk_Window)) /* Tk's handle for the pane. */
{
- register Slave *slavePtr = clientData;
- PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr;
+ Pane *panePtr = (Pane *)clientData;
+ PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr;
- if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
+ if (pwPtr->tkwin != Tk_Parent(panePtr->tkwin)) {
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
- slavePtr->tkwin = NULL;
- ckfree(slavePtr);
+ Unlink(panePtr);
+ Tk_DeleteEventHandler(panePtr->tkwin, StructureNotifyMask,
+ PaneStructureProc, panePtr);
+ Tk_UnmapWindow(panePtr->tkwin);
+ panePtr->tkwin = NULL;
+ ckfree(panePtr);
ComputeGeometry(pwPtr);
}
@@ -1704,19 +1703,19 @@ PanedWindowLostSlaveProc(
* None.
*
* Side effects:
- * The slaves of masterPtr may get resized or moved.
+ * The panes of containerPtr may get resized or moved.
*
*--------------------------------------------------------------
*/
static void
ArrangePanes(
- ClientData clientData) /* Structure describing parent whose slaves
+ ClientData clientData) /* Structure describing parent whose panes
* are to be re-layed out. */
{
- register PanedWindow *pwPtr = clientData;
- register Slave *slavePtr;
- int i, slaveWidth, slaveHeight, slaveX, slaveY;
+ PanedWindow *pwPtr = (PanedWindow *)clientData;
+ Pane *panePtr;
+ int i, newPaneWidth, newPaneHeight, paneX, paneY;
int paneWidth, paneHeight, paneSize, paneMinSize;
int doubleBw;
int x, y;
@@ -1731,13 +1730,13 @@ ArrangePanes(
pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING);
/*
- * If the parent has no slaves anymore, then don't do anything at all:
+ * If the parent has no panes anymore, then don't do anything at all:
* just leave the parent's size as-is. Otherwise there is no way to
* "relinquish" control over the parent so another geometry manager can
* take over.
*/
- if (pwPtr->numSlaves == 0) {
+ if (pwPtr->numPanes == 0) {
return;
}
@@ -1754,7 +1753,7 @@ ArrangePanes(
*/
paneDynSize = paneDynMinSize = 0;
- internalBW = Tk_InternalBorderWidth(pwPtr->tkwin);
+ internalBW = Tk_InternalBorderLeft(pwPtr->tkwin);
pwHeight = Tk_Height(pwPtr->tkwin) - (2 * internalBW);
pwWidth = Tk_Width(pwPtr->tkwin) - (2 * internalBW);
x = y = internalBW;
@@ -1776,37 +1775,37 @@ ArrangePanes(
+ pwPtr->sashPad;
}
- for (i = sashCount = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
+ for (i = sashCount = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
- if (slavePtr->hide) {
+ if (panePtr->hide) {
continue;
}
/*
- * Compute the total size needed by all the slaves and the left-over,
+ * Compute the total size needed by all the panes and the left-over,
* or shortage of space available.
*/
if (horizontal) {
- if (slavePtr->width > 0) {
- paneSize = slavePtr->width;
+ if (panePtr->width > 0) {
+ paneSize = panePtr->width;
} else {
- paneSize = slavePtr->paneWidth;
+ paneSize = panePtr->paneWidth;
}
- stretchReserve -= paneSize + (2 * slavePtr->padx);
+ stretchReserve -= paneSize + (2 * panePtr->padx);
} else {
- if (slavePtr->height > 0) {
- paneSize = slavePtr->height;
+ if (panePtr->height > 0) {
+ paneSize = panePtr->height;
} else {
- paneSize = slavePtr->paneHeight;
+ paneSize = panePtr->paneHeight;
}
- stretchReserve -= paneSize + (2 * slavePtr->pady);
+ stretchReserve -= paneSize + (2 * panePtr->pady);
}
- if (IsStretchable(slavePtr->stretch,i,first,last)
+ if (IsStretchable(panePtr->stretch,i,first,last)
&& Tk_IsMapped(pwPtr->tkwin)) {
paneDynSize += paneSize;
- paneDynMinSize += slavePtr->minSize;
+ paneDynMinSize += panePtr->minSize;
}
if (i != last) {
stretchReserve -= sashWidth;
@@ -1818,53 +1817,53 @@ ArrangePanes(
* Second pass; adjust/arrange panes.
*/
- for (i = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
- if (slavePtr->hide) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ if (panePtr->hide) {
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ Tk_UnmapWindow(panePtr->tkwin);
continue;
}
/*
- * Compute the size of this slave. The algorithm (assuming a
+ * Compute the size of this pane. The algorithm (assuming a
* horizontal paned window) is:
*
* 1. Get "base" dimensions. If a width or height is specified for
- * this slave, use those values; else use the ReqWidth/ReqHeight.
+ * this pane, use those values; else use the ReqWidth/ReqHeight.
* 2. Using base dimensions, pane dimensions, and sticky values,
* determine the x and y, and actual width and height of the
* widget.
*/
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- slaveWidth = (slavePtr->width > 0 ? slavePtr->width :
- Tk_ReqWidth(slavePtr->tkwin) + doubleBw);
- slaveHeight = (slavePtr->height > 0 ? slavePtr->height :
- Tk_ReqHeight(slavePtr->tkwin) + doubleBw);
- paneMinSize = slavePtr->minSize;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ newPaneWidth = (panePtr->width > 0 ? panePtr->width :
+ Tk_ReqWidth(panePtr->tkwin) + doubleBw);
+ newPaneHeight = (panePtr->height > 0 ? panePtr->height :
+ Tk_ReqHeight(panePtr->tkwin) + doubleBw);
+ paneMinSize = panePtr->minSize;
/*
* Calculate pane width and height.
*/
if (horizontal) {
- if (slavePtr->width > 0) {
- paneSize = slavePtr->width;
+ if (panePtr->width > 0) {
+ paneSize = panePtr->width;
} else {
- paneSize = slavePtr->paneWidth;
+ paneSize = panePtr->paneWidth;
}
pwSize = pwWidth;
} else {
- if (slavePtr->height > 0) {
- paneSize = slavePtr->height;
+ if (panePtr->height > 0) {
+ paneSize = panePtr->height;
} else {
- paneSize = slavePtr->paneHeight;
+ paneSize = panePtr->paneHeight;
}
pwSize = pwHeight;
}
- if (IsStretchable(slavePtr->stretch, i, first, last)) {
+ if (IsStretchable(panePtr->stretch, i, first, last)) {
double frac;
if (paneDynSize > 0) {
@@ -1874,7 +1873,7 @@ ArrangePanes(
}
paneDynSize -= paneSize;
- paneDynMinSize -= slavePtr->minSize;
+ paneDynMinSize -= panePtr->minSize;
stretchAmount = (int) (frac * stretchReserve);
if (paneSize + stretchAmount >= paneMinSize) {
stretchReserve -= stretchAmount;
@@ -1899,9 +1898,9 @@ ArrangePanes(
}
if (horizontal) {
paneWidth = paneSize;
- paneHeight = pwHeight - (2 * slavePtr->pady);
+ paneHeight = pwHeight - (2 * panePtr->pady);
} else {
- paneWidth = pwWidth - (2 * slavePtr->padx);
+ paneWidth = pwWidth - (2 * panePtr->padx);
paneHeight = paneSize;
}
@@ -1929,15 +1928,15 @@ ArrangePanes(
paneHeight = pwHeight - syReserve - y + internalBW;
}
- if (slaveWidth > paneWidth) {
- slaveWidth = paneWidth;
+ if (newPaneWidth > paneWidth) {
+ newPaneWidth = paneWidth;
}
- if (slaveHeight > paneHeight) {
- slaveHeight = paneHeight;
+ if (newPaneHeight > paneHeight) {
+ newPaneHeight = paneHeight;
}
- slavePtr->x = x;
- slavePtr->y = y;
+ panePtr->x = x;
+ panePtr->y = y;
/*
* Compute the location of the sash at the right or bottom of the
@@ -1945,51 +1944,51 @@ ArrangePanes(
*/
if (horizontal) {
- x += paneWidth + (2 * slavePtr->padx);
+ x += paneWidth + (2 * panePtr->padx);
if (x < internalBW) {
x = internalBW;
}
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
- slavePtr->handlex = x + handleOffset;
- slavePtr->handley = y + pwPtr->handlePad;
+ panePtr->sashx = x + sashOffset;
+ panePtr->sashy = y;
+ panePtr->handlex = x + handleOffset;
+ panePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
- y += paneHeight + (2 * slavePtr->pady);
+ y += paneHeight + (2 * panePtr->pady);
if (y < internalBW) {
y = internalBW;
}
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
- slavePtr->handlex = x + pwPtr->handlePad;
- slavePtr->handley = y + handleOffset;
+ panePtr->sashx = x;
+ panePtr->sashy = y + sashOffset;
+ panePtr->handlex = x + pwPtr->handlePad;
+ panePtr->handley = y + handleOffset;
y += sashWidth;
}
/*
- * Compute the actual dimensions of the slave in the pane.
+ * Compute the actual dimensions of the pane in the pane.
*/
- slaveX = slavePtr->x;
- slaveY = slavePtr->y;
- AdjustForSticky(slavePtr->sticky, paneWidth, paneHeight,
- &slaveX, &slaveY, &slaveWidth, &slaveHeight);
+ paneX = panePtr->x;
+ paneY = panePtr->y;
+ AdjustForSticky(panePtr->sticky, paneWidth, paneHeight,
+ &paneX, &paneY, &newPaneWidth, &newPaneHeight);
- slaveX += slavePtr->padx;
- slaveY += slavePtr->pady;
+ paneX += panePtr->padx;
+ paneY += panePtr->pady;
/*
* Now put the window in the proper spot.
*/
- if (slaveWidth <= 0 || slaveHeight <= 0 ||
- (horizontal ? slaveX - internalBW > pwWidth :
- slaveY - internalBW > pwHeight)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ if (newPaneWidth <= 0 || newPaneHeight <= 0 ||
+ (horizontal ? paneX - internalBW > pwWidth :
+ paneY - internalBW > pwHeight)) {
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ Tk_UnmapWindow(panePtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, pwPtr->tkwin,
- slaveX, slaveY, slaveWidth, slaveHeight);
+ Tk_MaintainGeometry(panePtr->tkwin, pwPtr->tkwin,
+ paneX, paneY, newPaneWidth, newPaneHeight);
}
sashCount--;
}
@@ -2001,7 +2000,7 @@ ArrangePanes(
*
* Unlink --
*
- * Remove a slave from a paned window.
+ * Remove a pane from a paned window.
*
* Results:
* None.
@@ -2014,57 +2013,57 @@ ArrangePanes(
static void
Unlink(
- register Slave *slavePtr) /* Window to unlink. */
+ Pane *panePtr) /* Window to unlink. */
{
- register PanedWindow *masterPtr;
+ PanedWindow *containerPtr;
int i, j;
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = panePtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
/*
- * Find the specified slave in the panedwindow's list of slaves, then
+ * Find the specified pane in the panedwindow's list of panes, then
* remove it from that list.
*/
- for (i = 0; i < masterPtr->numSlaves; i++) {
- if (masterPtr->slaves[i] == slavePtr) {
- for (j = i; j < masterPtr->numSlaves - 1; j++) {
- masterPtr->slaves[j] = masterPtr->slaves[j + 1];
+ for (i = 0; i < containerPtr->numPanes; i++) {
+ if (containerPtr->panes[i] == panePtr) {
+ for (j = i; j < containerPtr->numPanes - 1; j++) {
+ containerPtr->panes[j] = containerPtr->panes[j + 1];
}
break;
}
}
/*
- * Clean out any -after or -before references to this slave
+ * Clean out any -after or -before references to this pane
*/
- for (i = 0; i < masterPtr->numSlaves; i++) {
- if (masterPtr->slaves[i]->before == slavePtr->tkwin) {
- masterPtr->slaves[i]->before = NULL;
+ for (i = 0; i < containerPtr->numPanes; i++) {
+ if (containerPtr->panes[i]->before == panePtr->tkwin) {
+ containerPtr->panes[i]->before = NULL;
}
- if (masterPtr->slaves[i]->after == slavePtr->tkwin) {
- masterPtr->slaves[i]->after = NULL;
+ if (containerPtr->panes[i]->after == panePtr->tkwin) {
+ containerPtr->panes[i]->after = NULL;
}
}
- masterPtr->flags |= REQUESTED_RELAYOUT;
- if (!(masterPtr->flags & REDRAW_PENDING)) {
- masterPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayPanedWindow, masterPtr);
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ if (!(containerPtr->flags & REDRAW_PENDING)) {
+ containerPtr->flags |= REDRAW_PENDING;
+ Tcl_DoWhenIdle(DisplayPanedWindow, containerPtr);
}
/*
- * Set the slave's masterPtr to NULL, so that we can tell that the slave
+ * Set the pane's containerPtr to NULL, so that we can tell that the pane
* is no longer attached to any panedwindow.
*/
- slavePtr->masterPtr = NULL;
+ panePtr->containerPtr = NULL;
- masterPtr->numSlaves--;
+ containerPtr->numPanes--;
}
/*
@@ -2076,7 +2075,7 @@ Unlink(
* token in a given paned window.
*
* Results:
- * Pointer to the slave structure, or NULL if the window is not managed
+ * Pointer to the pane structure, or NULL if the window is not managed
* by this paned window.
*
* Side effects:
@@ -2085,16 +2084,16 @@ Unlink(
*----------------------------------------------------------------------
*/
-static Slave *
+static Pane *
GetPane(
PanedWindow *pwPtr, /* Pointer to the paned window info. */
Tk_Window tkwin) /* Window to search for. */
{
int i;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->tkwin == tkwin) {
- return pwPtr->slaves[i];
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->tkwin == tkwin) {
+ return pwPtr->panes[i];
}
}
return NULL;
@@ -2125,8 +2124,8 @@ GetFirstLastVisiblePane(
{
int i;
- for (i = 0, *lastPtr = 0, *firstPtr = -1; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->hide == 0) {
+ for (i = 0, *lastPtr = 0, *firstPtr = -1; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->hide == 0) {
if (*firstPtr < 0) {
*firstPtr = i;
}
@@ -2138,7 +2137,7 @@ GetFirstLastVisiblePane(
/*
*--------------------------------------------------------------
*
- * SlaveStructureProc --
+ * PaneStructureProc --
*
* This function is invoked whenever StructureNotify events occur for a
* window that's managed by a paned window. This function's only purpose
@@ -2148,25 +2147,25 @@ GetFirstLastVisiblePane(
* None.
*
* Side effects:
- * The paned window slave structure associated with the window
- * is freed, and the slave is disassociated from the paned
+ * The paned window pane structure associated with the window
+ * is freed, and the pane is disassociated from the paned
* window which managed it.
*
*--------------------------------------------------------------
*/
static void
-SlaveStructureProc(
+PaneStructureProc(
ClientData clientData, /* Pointer to record describing window item. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Slave *slavePtr = clientData;
- PanedWindow *pwPtr = slavePtr->masterPtr;
+ Pane *panePtr = (Pane *)clientData;
+ PanedWindow *pwPtr = panePtr->containerPtr;
if (eventPtr->type == DestroyNotify) {
- Unlink(slavePtr);
- slavePtr->tkwin = NULL;
- ckfree(slavePtr);
+ Unlink(panePtr);
+ panePtr->tkwin = NULL;
+ ckfree(panePtr);
ComputeGeometry(pwPtr);
}
}
@@ -2177,7 +2176,7 @@ SlaveStructureProc(
* ComputeGeometry --
*
* Compute geometry for the paned window, including coordinates of all
- * slave windows and each sash.
+ * panes and each sash.
*
* Results:
* None.
@@ -2195,12 +2194,12 @@ ComputeGeometry(
int i, x, y, doubleBw, internalBw;
int sashWidth, sashOffset, handleOffset;
int reqWidth, reqHeight, dim;
- Slave *slavePtr;
+ Pane *panePtr;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
pwPtr->flags |= REQUESTED_RELAYOUT;
- x = y = internalBw = Tk_InternalBorderWidth(pwPtr->tkwin);
+ x = y = internalBw = Tk_InternalBorderLeft(pwPtr->tkwin);
reqWidth = reqHeight = 0;
/*
@@ -2221,20 +2220,20 @@ ComputeGeometry(
+ pwPtr->sashPad;
}
- for (i = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
- if (slavePtr->hide) {
+ if (panePtr->hide) {
continue;
}
/*
- * First set the coordinates for the top left corner of the slave's
+ * First set the coordinates for the top left corner of the pane's
* parcel.
*/
- slavePtr->x = x;
- slavePtr->y = y;
+ panePtr->x = x;
+ panePtr->y = y;
/*
* Make sure the pane's paned dimension is at least minsize. This
@@ -2243,12 +2242,12 @@ ComputeGeometry(
*/
if (horizontal) {
- if (slavePtr->paneWidth < slavePtr->minSize) {
- slavePtr->paneWidth = slavePtr->minSize;
+ if (panePtr->paneWidth < panePtr->minSize) {
+ panePtr->paneWidth = panePtr->minSize;
}
} else {
- if (slavePtr->paneHeight < slavePtr->minSize) {
- slavePtr->paneHeight = slavePtr->minSize;
+ if (panePtr->paneHeight < panePtr->minSize) {
+ panePtr->paneHeight = panePtr->minSize;
}
}
@@ -2258,55 +2257,55 @@ ComputeGeometry(
*/
if (horizontal) {
- x += slavePtr->paneWidth + (2 * slavePtr->padx);
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
- slavePtr->handlex = x + handleOffset;
- slavePtr->handley = y + pwPtr->handlePad;
+ x += panePtr->paneWidth + (2 * panePtr->padx);
+ panePtr->sashx = x + sashOffset;
+ panePtr->sashy = y;
+ panePtr->handlex = x + handleOffset;
+ panePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
- y += slavePtr->paneHeight + (2 * slavePtr->pady);
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
- slavePtr->handlex = x + pwPtr->handlePad;
- slavePtr->handley = y + handleOffset;
+ y += panePtr->paneHeight + (2 * panePtr->pady);
+ panePtr->sashx = x;
+ panePtr->sashy = y + sashOffset;
+ panePtr->handlex = x + pwPtr->handlePad;
+ panePtr->handley = y + handleOffset;
y += sashWidth;
}
/*
- * Find the maximum height/width of the slaves, for computing the
+ * Find the maximum height/width of the panes, for computing the
* requested height/width of the paned window.
*/
if (horizontal) {
/*
- * If the slave has an explicit height set, use that; otherwise,
- * use the slave's requested height.
+ * If the pane has an explicit height set, use that; otherwise,
+ * use the pane's requested height.
*/
- if (slavePtr->height > 0) {
- dim = slavePtr->height;
+ if (panePtr->height > 0) {
+ dim = panePtr->height;
} else {
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- dim = Tk_ReqHeight(slavePtr->tkwin) + doubleBw;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ dim = Tk_ReqHeight(panePtr->tkwin) + doubleBw;
}
- dim += 2 * slavePtr->pady;
+ dim += 2 * panePtr->pady;
if (dim > reqHeight) {
reqHeight = dim;
}
} else {
/*
- * If the slave has an explicit width set use that; otherwise, use
- * the slave's requested width.
+ * If the pane has an explicit width set use that; otherwise, use
+ * the pane's requested width.
*/
- if (slavePtr->width > 0) {
- dim = slavePtr->width;
+ if (panePtr->width > 0) {
+ dim = panePtr->width;
} else {
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- dim = Tk_ReqWidth(slavePtr->tkwin) + doubleBw;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ dim = Tk_ReqWidth(panePtr->tkwin) + doubleBw;
}
- dim += 2 * slavePtr->padx;
+ dim += 2 * panePtr->padx;
if (dim > reqWidth) {
reqWidth = dim;
}
@@ -2324,7 +2323,7 @@ ComputeGeometry(
* the paned window.
*
* The height (or width) is equal to the maximum height (or width) of the
- * slaves, plus the width of the border of the top and bottom (or left and
+ * panes, plus the width of the border of the top and bottom (or left and
* right) of the paned window.
*
* If the panedwindow has an explicit width/height set use that;
@@ -2370,7 +2369,7 @@ ComputeGeometry(
static void
DestroyOptionTables(
ClientData clientData, /* Pointer to the OptionTables struct */
- Tcl_Interp *interp) /* Pointer to the calling interp */
+ TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */
{
ckfree(clientData);
}
@@ -2394,8 +2393,8 @@ DestroyOptionTables(
static Tcl_Obj *
GetSticky(
- ClientData clientData,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr, /* Pointer to widget record. */
int internalOffset) /* Offset within *recordPtr containing the
* sticky value. */
@@ -2442,9 +2441,9 @@ GetSticky(
static int
SetSticky(
- ClientData clientData,
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interp; may be used for errors. */
- Tk_Window tkwin, /* Window for which option is being set. */
+ TCL_UNUSED(Tk_Window), /* Window for which option is being set. */
Tcl_Obj **value, /* Pointer to the pointer to the value object.
* We use a pointer to the pointer because we
* may need to return a value (NULL). */
@@ -2521,8 +2520,8 @@ SetSticky(
static void
RestoreSticky(
- ClientData clientData,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *internalPtr, /* Pointer to storage for value. */
char *oldInternalPtr) /* Pointer to old value. */
{
@@ -2535,11 +2534,11 @@ RestoreSticky(
* AdjustForSticky --
*
* Given the x,y coords of the top-left corner of a pane, the dimensions
- * of that pane, and the dimensions of a slave, compute the x,y coords
- * and actual dimensions of the slave based on the slave's sticky value.
+ * of that pane, and the dimensions of a pane, compute the x,y coords
+ * and actual dimensions of the pane based on the pane's sticky value.
*
* Results:
- * No direct return; sets the x, y, slaveWidth and slaveHeight to correct
+ * No direct return; sets the x, y, paneWidth and paneHeight to correct
* values.
*
* Side effects:
@@ -2556,26 +2555,26 @@ AdjustForSticky(
int cavityHeight, /* Height of the cavity. */
int *xPtr, int *yPtr, /* Initially, coordinates of the top-left
* corner of cavity; also return values for
- * actual x, y coords of slave. */
- int *slaveWidthPtr, /* Slave width. */
- int *slaveHeightPtr) /* Slave height. */
+ * actual x, y coords of pane. */
+ int *paneWidthPtr, /* Pane width. */
+ int *paneHeightPtr) /* Pane height. */
{
- int diffx = 0; /* Cavity width - slave width. */
- int diffy = 0; /* Cavity hight - slave height. */
+ int diffx = 0; /* Cavity width - pane width. */
+ int diffy = 0; /* Cavity hight - pane height. */
- if (cavityWidth > *slaveWidthPtr) {
- diffx = cavityWidth - *slaveWidthPtr;
+ if (cavityWidth > *paneWidthPtr) {
+ diffx = cavityWidth - *paneWidthPtr;
}
- if (cavityHeight > *slaveHeightPtr) {
- diffy = cavityHeight - *slaveHeightPtr;
+ if (cavityHeight > *paneHeightPtr) {
+ diffy = cavityHeight - *paneHeightPtr;
}
if ((sticky & STICK_EAST) && (sticky & STICK_WEST)) {
- *slaveWidthPtr += diffx;
+ *paneWidthPtr += diffx;
}
if ((sticky & STICK_NORTH) && (sticky & STICK_SOUTH)) {
- *slaveHeightPtr += diffy;
+ *paneHeightPtr += diffy;
}
if (!(sticky & STICK_WEST)) {
*xPtr += (sticky & STICK_EAST) ? diffx : diffx/2;
@@ -2608,8 +2607,8 @@ MoveSash(
int diff)
{
int i;
- int expandPane, reduceFirst, reduceLast, reduceIncr, slaveSize, sashOffset;
- Slave *slavePtr;
+ int expandPane, reduceFirst, reduceLast, reduceIncr, paneSize, sashOffset;
+ Pane *panePtr;
int stretchReserve = 0;
int nextSash = sash + 1;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
@@ -2618,7 +2617,7 @@ MoveSash(
return;
/*
- * Update the slave sizes with their real sizes.
+ * Update the pane sizes with their real sizes.
*/
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
@@ -2627,17 +2626,17 @@ MoveSash(
} else {
sashOffset = pwPtr->sashPad;
}
- for (i = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide) {
continue;
}
if (horizontal) {
- slavePtr->paneWidth = slavePtr->width = slavePtr->sashx
- - sashOffset - slavePtr->x - (2 * slavePtr->padx);
+ panePtr->paneWidth = panePtr->width = panePtr->sashx
+ - sashOffset - panePtr->x - (2 * panePtr->padx);
} else {
- slavePtr->paneHeight = slavePtr->height = slavePtr->sashy
- - sashOffset - slavePtr->y - (2 * slavePtr->pady);
+ panePtr->paneHeight = panePtr->height = panePtr->sashy
+ - sashOffset - panePtr->y - (2 * panePtr->pady);
}
}
@@ -2647,7 +2646,7 @@ MoveSash(
* pane to either side of the sash.
*/
- while (nextSash < pwPtr->numSlaves-1 && pwPtr->slaves[nextSash]->hide) {
+ while (nextSash < pwPtr->numPanes-1 && pwPtr->panes[nextSash]->hide) {
nextSash++;
}
@@ -2658,7 +2657,7 @@ MoveSash(
if (diff > 0) {
expandPane = sash;
reduceFirst = nextSash;
- reduceLast = pwPtr->numSlaves;
+ reduceLast = pwPtr->numPanes;
reduceIncr = 1;
} else {
diff = abs(diff);
@@ -2674,14 +2673,14 @@ MoveSash(
*/
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide) {
continue;
}
if (horizontal) {
- stretchReserve += slavePtr->width - slavePtr->minSize;
+ stretchReserve += panePtr->width - panePtr->minSize;
} else {
- stretchReserve += slavePtr->height - slavePtr->minSize;
+ stretchReserve += panePtr->height - panePtr->minSize;
}
}
if (stretchReserve <= 0) {
@@ -2695,11 +2694,11 @@ MoveSash(
* Expand pane by diff amount.
*/
- slavePtr = pwPtr->slaves[expandPane];
+ panePtr = pwPtr->panes[expandPane];
if (horizontal) {
- slavePtr->paneWidth = slavePtr->width += diff;
+ panePtr->paneWidth = panePtr->width += diff;
} else {
- slavePtr->paneHeight = slavePtr->height += diff;
+ panePtr->paneHeight = panePtr->height += diff;
}
/*
@@ -2707,26 +2706,26 @@ MoveSash(
*/
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide) {
continue;
}
if (horizontal) {
- slaveSize = slavePtr->width;
+ paneSize = panePtr->width;
} else {
- slaveSize = slavePtr->height;
+ paneSize = panePtr->height;
}
- if (diff > (slaveSize - slavePtr->minSize)) {
- diff -= slaveSize - slavePtr->minSize;
- slaveSize = slavePtr->minSize;
+ if (diff > (paneSize - panePtr->minSize)) {
+ diff -= paneSize - panePtr->minSize;
+ paneSize = panePtr->minSize;
} else {
- slaveSize -= diff;
+ paneSize -= diff;
i = reduceLast - reduceIncr;
}
if (horizontal) {
- slavePtr->paneWidth = slavePtr->width = slaveSize;
+ panePtr->paneWidth = panePtr->width = paneSize;
} else {
- slavePtr->paneHeight = slavePtr->height = slaveSize;
+ panePtr->paneHeight = panePtr->height = paneSize;
}
}
}
@@ -2754,7 +2753,7 @@ ProxyWindowEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- PanedWindow *pwPtr = clientData;
+ PanedWindow *pwPtr = (PanedWindow *)clientData;
if (eventPtr->type == Expose) {
if (pwPtr->proxywin != NULL &&!(pwPtr->flags & PROXY_REDRAW_PENDING)) {
@@ -2786,7 +2785,7 @@ static void
DisplayProxyWindow(
ClientData clientData) /* Information about window. */
{
- PanedWindow *pwPtr = clientData;
+ PanedWindow *pwPtr = (PanedWindow *)clientData;
Pixmap pixmap;
Tk_Window tkwin = pwPtr->proxywin;
pwPtr->flags &= ~PROXY_REDRAW_PENDING;
@@ -2906,7 +2905,7 @@ PanedWindowProxyCommand(
return TCL_ERROR;
}
- internalBW = Tk_InternalBorderWidth(pwPtr->tkwin);
+ internalBW = Tk_InternalBorderLeft(pwPtr->tkwin);
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (x < 0) {
x = 0;
@@ -2915,10 +2914,10 @@ PanedWindowProxyCommand(
if (x > pwWidth) {
x = pwWidth;
}
- y = Tk_InternalBorderWidth(pwPtr->tkwin);
+ y = Tk_InternalBorderLeft(pwPtr->tkwin);
sashWidth = pwPtr->sashWidth;
sashHeight = Tk_Height(pwPtr->tkwin) -
- (2 * Tk_InternalBorderWidth(pwPtr->tkwin));
+ (2 * Tk_InternalBorderLeft(pwPtr->tkwin));
} else {
if (y < 0) {
y = 0;
@@ -2927,10 +2926,10 @@ PanedWindowProxyCommand(
if (y > pwHeight) {
y = pwHeight;
}
- x = Tk_InternalBorderWidth(pwPtr->tkwin);
+ x = Tk_InternalBorderLeft(pwPtr->tkwin);
sashHeight = pwPtr->sashWidth;
sashWidth = Tk_Width(pwPtr->tkwin) -
- (2 * Tk_InternalBorderWidth(pwPtr->tkwin));
+ (2 * Tk_InternalBorderLeft(pwPtr->tkwin));
}
if (sashWidth < 1) {
@@ -2949,9 +2948,9 @@ PanedWindowProxyCommand(
/*
* Make sure the proxy window is higher in the stacking order than the
- * slaves, so that it will be visible when drawn. It would be more
+ * panes, so that it will be visible when drawn. It would be more
* correct to push the proxy window just high enough to appear above
- * the highest slave, but it's much easier to just force it all the
+ * the highest pane, but it's much easier to just force it all the
* way to the top of the stacking order.
*/
@@ -3066,7 +3065,7 @@ PanedWindowIdentifyCoords(
} else {
sashHeight = Tk_ReqHeight(pwPtr->tkwin);
}
- sashHeight -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin);
+ sashHeight -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin);
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
sashWidth = pwPtr->handleSize;
lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
@@ -3094,19 +3093,19 @@ PanedWindowIdentifyCoords(
} else {
sashWidth = Tk_ReqWidth(pwPtr->tkwin);
}
- sashWidth -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin);
+ sashWidth -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin);
lpad = rpad = 0;
}
GetFirstLastVisiblePane(pwPtr, &first, &last);
isHandle = 0;
found = -1;
- for (i = 0; i < pwPtr->numSlaves - 1; i++) {
- if (pwPtr->slaves[i]->hide || i == last) {
+ for (i = 0; i < pwPtr->numPanes - 1; i++) {
+ if (pwPtr->panes[i]->hide || i == last) {
continue;
}
- thisx = pwPtr->slaves[i]->sashx;
- thisy = pwPtr->slaves[i]->sashy;
+ thisx = pwPtr->panes[i]->sashx;
+ thisy = pwPtr->panes[i]->sashy;
if (((thisx - lpad) <= x && x <= (thisx + rpad + sashWidth)) &&
((thisy - tpad) <= y && y <= (thisy + bpad + sashHeight))) {
@@ -3117,8 +3116,8 @@ PanedWindowIdentifyCoords(
*/
if (pwPtr->showHandle) {
- thisx = pwPtr->slaves[i]->handlex;
- thisy = pwPtr->slaves[i]->handley;
+ thisx = pwPtr->panes[i]->handlex;
+ thisy = pwPtr->panes[i]->handley;
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (thisy <= y && y <= (thisy + pwPtr->handleSize)) {
isHandle = 1;
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 59b8a2b9..47ceee2b 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -17,10 +17,10 @@
* Border modes for relative placement:
*
* BM_INSIDE: relative distances computed using area inside all
- * borders of master window.
+ * borders of container window.
* BM_OUTSIDE: relative distances computed using outside area that
- * includes all borders of master.
- * BM_IGNORE: border issues are ignored: place relative to master's
+ * includes all borders of container.
+ * BM_IGNORE: border issues are ignored: place relative to container's
* actual window size.
*/
@@ -35,16 +35,16 @@ typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode;
* structure of the following type:
*/
-typedef struct Slave {
+typedef struct Content {
Tk_Window tkwin; /* Tk's token for window. */
Tk_Window inTkwin; /* Token for the -in window. */
- struct Master *masterPtr; /* Pointer to information for window relative
+ struct Container *containerPtr; /* Pointer to information for window relative
* to which tkwin is placed. This isn't
* necessarily the logical parent of tkwin.
- * NULL means the master was deleted or never
+ * NULL means the container was deleted or never
* assigned. */
- struct Slave *nextPtr; /* Next in list of windows placed relative to
- * same master (NULL for end of list). */
+ struct Content *nextPtr; /* Next in list of windows placed relative to
+ * same container (NULL for end of list). */
Tk_OptionTable optionTable; /* Table that defines configuration options
* available for this command. */
/*
@@ -57,22 +57,22 @@ typedef struct Slave {
Tcl_Obj *xPtr, *yPtr; /* Tcl_Obj rep's of x, y coords, to keep pixel
* spec. information. */
double relX, relY; /* X and Y coordinates relative to size of
- * master. */
+ * container. */
int width, height; /* Absolute dimensions for tkwin. */
Tcl_Obj *widthPtr; /* Tcl_Obj rep of width, to keep pixel
* spec. */
Tcl_Obj *heightPtr; /* Tcl_Obj rep of height, to keep pixel
* spec. */
double relWidth, relHeight; /* Dimensions for tkwin relative to size of
- * master. */
+ * container. */
Tcl_Obj *relWidthPtr;
Tcl_Obj *relHeightPtr;
Tk_Anchor anchor; /* Which point on tkwin is placed at the given
* position. */
- BorderMode borderMode; /* How to treat borders of master window. */
+ BorderMode borderMode; /* How to treat borders of container window. */
int flags; /* Various flags; see below for bit
* definitions. */
-} Slave;
+} Content;
/*
* Type masks for options:
@@ -82,34 +82,34 @@ typedef struct Slave {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", -1,
- Tk_Offset(Slave, anchor), 0, 0, 0},
+ Tk_Offset(Content, anchor), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", -1,
- Tk_Offset(Slave, borderMode), 0, borderModeStrings, 0},
- {TK_OPTION_PIXELS, "-height", NULL, NULL, "", Tk_Offset(Slave, heightPtr),
- Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, Tk_Offset(Slave, inTkwin),
+ Tk_Offset(Content, borderMode), 0, borderModeStrings, 0},
+ {TK_OPTION_PIXELS, "-height", NULL, NULL, "", Tk_Offset(Content, heightPtr),
+ Tk_Offset(Content, height), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, Tk_Offset(Content, inTkwin),
0, 0, IN_MASK},
{TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "",
- Tk_Offset(Slave, relHeightPtr), Tk_Offset(Slave, relHeight),
+ Tk_Offset(Content, relHeightPtr), Tk_Offset(Content, relHeight),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "",
- Tk_Offset(Slave, relWidthPtr), Tk_Offset(Slave, relWidth),
+ Tk_Offset(Content, relWidthPtr), Tk_Offset(Content, relWidth),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", -1,
- Tk_Offset(Slave, relX), 0, 0, 0},
+ Tk_Offset(Content, relX), 0, 0, 0},
{TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", -1,
- Tk_Offset(Slave, relY), 0, 0, 0},
- {TK_OPTION_PIXELS, "-width", NULL, NULL, "", Tk_Offset(Slave, widthPtr),
- Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", Tk_Offset(Slave, xPtr),
- Tk_Offset(Slave, x), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", Tk_Offset(Slave, yPtr),
- Tk_Offset(Slave, y), TK_OPTION_NULL_OK, 0, 0},
+ Tk_Offset(Content, relY), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-width", NULL, NULL, "", Tk_Offset(Content, widthPtr),
+ Tk_Offset(Content, width), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", Tk_Offset(Content, xPtr),
+ Tk_Offset(Content, x), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", Tk_Offset(Content, yPtr),
+ Tk_Offset(Content, y), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
/*
- * Flag definitions for Slave structures:
+ * Flag definitions for Content structures:
*
* CHILD_WIDTH - 1 means -width was specified;
* CHILD_REL_WIDTH - 1 means -relwidth was specified.
@@ -123,25 +123,25 @@ static const Tk_OptionSpec optionSpecs[] = {
#define CHILD_REL_HEIGHT 8
/*
- * For each master window that has a slave managed by the placer there is a
+ * For each container window that has a content managed by the placer there is a
* structure of the following form:
*/
-typedef struct Master {
- Tk_Window tkwin; /* Tk's token for master window. */
- struct Slave *slavePtr; /* First in linked list of slaves placed
- * relative to this master. */
+typedef struct Container {
+ Tk_Window tkwin; /* Tk's token for container window. */
+ struct Content *contentPtr; /* First in linked list of content placed
+ * relative to this container. */
int *abortPtr; /* If non-NULL, it means that there is a nested
* call to RecomputePlacement already working on
* this window. *abortPtr may be set to 1 to
* abort that nested call. This happens, for
- * example, if tkwin or any of its slaves
+ * example, if tkwin or any of its content
* is deleted. */
int flags; /* See below for bit definitions. */
-} Master;
+} Container;
/*
- * Flag definitions for masters:
+ * Flag definitions for containers:
*
* PARENT_RECONFIG_PENDING - 1 means that a call to RecomputePlacement is
* already pending via a Do_When_Idle handler.
@@ -155,34 +155,34 @@ typedef struct Master {
static void PlaceRequestProc(ClientData clientData,
Tk_Window tkwin);
-static void PlaceLostSlaveProc(ClientData clientData,
+static void PlaceLostContentProc(ClientData clientData,
Tk_Window tkwin);
static const Tk_GeomMgr placerType = {
"place", /* name */
PlaceRequestProc, /* requestProc */
- PlaceLostSlaveProc, /* lostSlaveProc */
+ PlaceLostContentProc, /* lostContentProc */
};
/*
* Forward declarations for functions defined later in this file:
*/
-static void SlaveStructureProc(ClientData clientData,
+static void ContentStructureProc(ClientData clientData,
XEvent *eventPtr);
-static int ConfigureSlave(Tcl_Interp *interp, Tk_Window tkwin,
+static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
Tk_OptionTable table, int objc,
Tcl_Obj *const objv[]);
static int PlaceInfoCommand(Tcl_Interp *interp, Tk_Window tkwin);
-static Slave * CreateSlave(Tk_Window tkwin, Tk_OptionTable table);
-static void FreeSlave(Slave *slavePtr);
-static Slave * FindSlave(Tk_Window tkwin);
-static Master * CreateMaster(Tk_Window tkwin);
-static Master * FindMaster(Tk_Window tkwin);
-static void MasterStructureProc(ClientData clientData,
+static Content * CreateContent(Tk_Window tkwin, Tk_OptionTable table);
+static void FreeContent(Content *contentPtr);
+static Content * FindContent(Tk_Window tkwin);
+static Container * CreateContainer(Tk_Window tkwin);
+static Container * FindContainer(Tk_Window tkwin);
+static void PlaceStructureProc(ClientData clientData,
XEvent *eventPtr);
static void RecomputePlacement(ClientData clientData);
-static void UnlinkSlave(Slave *slavePtr);
+static void UnlinkContent(Content *contentPtr);
/*
*--------------------------------------------------------------
@@ -208,15 +208,15 @@ Tk_PlaceObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window main_win = clientData;
+ Tk_Window main_win = (Tk_Window)clientData;
Tk_Window tkwin;
- Slave *slavePtr;
+ Content *contentPtr;
TkDisplay *dispPtr;
Tk_OptionTable optionTable;
static const char *const optionStrings[] = {
- "configure", "forget", "info", "slaves", NULL
+ "configure", "content", "forget", "info", "slaves", NULL
};
- enum options { PLACE_CONFIGURE, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
+ enum options { PLACE_CONFIGURE, PLACE_CONTENT, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
int index;
if (objc < 3) {
@@ -252,7 +252,7 @@ Tk_PlaceObjCmd(
dispPtr->placeInit = 1;
}
- return ConfigureSlave(interp, tkwin, optionTable, objc-2, objv+2);
+ return ConfigureContent(interp, tkwin, optionTable, objc-2, objv+2);
}
/*
@@ -286,11 +286,11 @@ Tk_PlaceObjCmd(
if (objc == 3 || objc == 4) {
Tcl_Obj *objPtr;
- slavePtr = FindSlave(tkwin);
- if (slavePtr == NULL) {
+ contentPtr = FindContent(tkwin);
+ if (contentPtr == NULL) {
return TCL_OK;
}
- objPtr = Tk_GetOptionInfo(interp, (char *) slavePtr, optionTable,
+ objPtr = Tk_GetOptionInfo(interp, (char *)contentPtr, optionTable,
(objc == 4) ? objv[3] : NULL, tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -298,29 +298,29 @@ Tk_PlaceObjCmd(
Tcl_SetObjResult(interp, objPtr);
return TCL_OK;
}
- return ConfigureSlave(interp, tkwin, optionTable, objc-3, objv+3);
+ return ConfigureContent(interp, tkwin, optionTable, objc-3, objv+3);
case PLACE_FORGET:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "pathName");
return TCL_ERROR;
}
- slavePtr = FindSlave(tkwin);
- if (slavePtr == NULL) {
+ contentPtr = FindContent(tkwin);
+ if (contentPtr == NULL) {
return TCL_OK;
}
- if ((slavePtr->masterPtr != NULL) &&
- (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if ((contentPtr->containerPtr != NULL) &&
+ (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- UnlinkSlave(slavePtr);
+ UnlinkContent(contentPtr);
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
- (char *) tkwin));
- Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- slavePtr);
+ (void *)tkwin));
+ Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
+ contentPtr);
Tk_ManageGeometry(tkwin, NULL, NULL);
Tk_UnmapWindow(tkwin);
- FreeSlave(slavePtr);
+ FreeContent(contentPtr);
break;
case PLACE_INFO:
@@ -330,21 +330,22 @@ Tk_PlaceObjCmd(
}
return PlaceInfoCommand(interp, tkwin);
+ case PLACE_CONTENT:
case PLACE_SLAVES: {
- Master *masterPtr;
+ Container *containerPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "pathName");
return TCL_ERROR;
}
- masterPtr = FindMaster(tkwin);
- if (masterPtr != NULL) {
+ containerPtr = FindContainer(tkwin);
+ if (containerPtr != NULL) {
Tcl_Obj *listPtr = Tcl_NewObj();
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, listPtr,
- TkNewWindowObj(slavePtr->tkwin));
+ TkNewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, listPtr);
}
@@ -358,59 +359,59 @@ Tk_PlaceObjCmd(
/*
*----------------------------------------------------------------------
*
- * CreateSlave --
+ * CreateContent --
*
- * Given a Tk_Window token, find the Slave structure corresponding to
+ * Given a Tk_Window token, find the Content structure corresponding to
* that token, creating a new one if necessary.
*
* Results:
- * Pointer to the Slave structure.
+ * Pointer to the Content structure.
*
* Side effects:
- * A new Slave structure may be created.
+ * A new Content structure may be created.
*
*----------------------------------------------------------------------
*/
-static Slave *
-CreateSlave(
- Tk_Window tkwin, /* Token for desired slave. */
+static Content *
+CreateContent(
+ Tk_Window tkwin, /* Token for desired content. */
Tk_OptionTable table)
{
Tcl_HashEntry *hPtr;
- register Slave *slavePtr;
+ Content *contentPtr;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew);
if (!isNew) {
- return Tcl_GetHashValue(hPtr);
+ return (Content *)Tcl_GetHashValue(hPtr);
}
/*
- * No preexisting slave structure for that window, so make a new one and
+ * No preexisting content structure for that window, so make a new one and
* populate it with some default values.
*/
- slavePtr = ckalloc(sizeof(Slave));
- memset(slavePtr, 0, sizeof(Slave));
- slavePtr->tkwin = tkwin;
- slavePtr->inTkwin = NULL;
- slavePtr->anchor = TK_ANCHOR_NW;
- slavePtr->borderMode = BM_INSIDE;
- slavePtr->optionTable = table;
- Tcl_SetHashValue(hPtr, slavePtr);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- slavePtr);
- return slavePtr;
+ contentPtr = (Content *)ckalloc(sizeof(Content));
+ memset(contentPtr, 0, sizeof(Content));
+ contentPtr->tkwin = tkwin;
+ contentPtr->inTkwin = NULL;
+ contentPtr->anchor = TK_ANCHOR_NW;
+ contentPtr->borderMode = BM_INSIDE;
+ contentPtr->optionTable = table;
+ Tcl_SetHashValue(hPtr, contentPtr);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
+ contentPtr);
+ return contentPtr;
}
/*
*----------------------------------------------------------------------
*
- * FreeSlave --
+ * FreeContent --
*
- * Frees the resources held by a Slave structure.
+ * Frees the resources held by a Content structure.
*
* Results:
* None
@@ -422,25 +423,25 @@ CreateSlave(
*/
static void
-FreeSlave(
- Slave *slavePtr)
+FreeContent(
+ Content *contentPtr)
{
- Tk_FreeConfigOptions((char *) slavePtr, slavePtr->optionTable,
- slavePtr->tkwin);
- ckfree(slavePtr);
+ Tk_FreeConfigOptions((char *) contentPtr, contentPtr->optionTable,
+ contentPtr->tkwin);
+ ckfree(contentPtr);
}
/*
*----------------------------------------------------------------------
*
- * FindSlave --
+ * FindContent --
*
- * Given a Tk_Window token, find the Slave structure corresponding to
+ * Given a Tk_Window token, find the Content structure corresponding to
* that token. This is purely a lookup function; it will not create a
* record if one does not yet exist.
*
* Results:
- * Pointer to Slave structure; NULL if none exists.
+ * Pointer to Content structure; NULL if none exists.
*
* Side effects:
* None.
@@ -448,121 +449,121 @@ FreeSlave(
*----------------------------------------------------------------------
*/
-static Slave *
-FindSlave(
- Tk_Window tkwin) /* Token for desired slave. */
+static Content *
+FindContent(
+ Tk_Window tkwin) /* Token for desired content. */
{
- register Tcl_HashEntry *hPtr;
+ Tcl_HashEntry *hPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin);
if (hPtr == NULL) {
return NULL;
}
- return Tcl_GetHashValue(hPtr);
+ return (Content *)Tcl_GetHashValue(hPtr);
}
/*
*----------------------------------------------------------------------
*
- * UnlinkSlave --
+ * UnlinkContent --
*
- * This function removes a slave window from the chain of slaves in its
- * master.
+ * This function removes a content window from the chain of content in its
+ * container.
*
* Results:
* None.
*
* Side effects:
- * The slave list of slavePtr's master changes.
+ * The content list of contentPtr's container changes.
*
*----------------------------------------------------------------------
*/
static void
-UnlinkSlave(
- Slave *slavePtr) /* Slave structure to be unlinked. */
+UnlinkContent(
+ Content *contentPtr) /* Content structure to be unlinked. */
{
- register Master *masterPtr;
- register Slave *prevPtr;
+ Container *containerPtr;
+ Content *prevPtr;
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = contentPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (masterPtr->slavePtr == slavePtr) {
- masterPtr->slavePtr = slavePtr->nextPtr;
+ if (containerPtr->contentPtr == contentPtr) {
+ containerPtr->contentPtr = contentPtr->nextPtr;
} else {
- for (prevPtr = masterPtr->slavePtr; ; prevPtr = prevPtr->nextPtr) {
+ for (prevPtr = containerPtr->contentPtr; ; prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
- Tcl_Panic("UnlinkSlave couldn't find slave to unlink");
+ Tcl_Panic("UnlinkContent couldn't find slave to unlink");
}
- if (prevPtr->nextPtr == slavePtr) {
- prevPtr->nextPtr = slavePtr->nextPtr;
+ if (prevPtr->nextPtr == contentPtr) {
+ prevPtr->nextPtr = contentPtr->nextPtr;
break;
}
}
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- slavePtr->masterPtr = NULL;
+ contentPtr->containerPtr = NULL;
}
/*
*----------------------------------------------------------------------
*
- * CreateMaster --
+ * CreateContainer --
*
- * Given a Tk_Window token, find the Master structure corresponding to
+ * Given a Tk_Window token, find the Container structure corresponding to
* that token, creating a new one if necessary.
*
* Results:
- * Pointer to the Master structure.
+ * Pointer to the Container structure.
*
* Side effects:
- * A new Master structure may be created.
+ * A new Container structure may be created.
*
*----------------------------------------------------------------------
*/
-static Master *
-CreateMaster(
- Tk_Window tkwin) /* Token for desired master. */
+static Container *
+CreateContainer(
+ Tk_Window tkwin) /* Token for desired container. */
{
Tcl_HashEntry *hPtr;
- register Master *masterPtr;
+ Container *containerPtr;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *)tkwin, &isNew);
if (isNew) {
- masterPtr = ckalloc(sizeof(Master));
- masterPtr->tkwin = tkwin;
- masterPtr->slavePtr = NULL;
- masterPtr->abortPtr = NULL;
- masterPtr->flags = 0;
- Tcl_SetHashValue(hPtr, masterPtr);
- Tk_CreateEventHandler(masterPtr->tkwin, StructureNotifyMask,
- MasterStructureProc, masterPtr);
+ containerPtr = (Container *)ckalloc(sizeof(Container));
+ containerPtr->tkwin = tkwin;
+ containerPtr->contentPtr = NULL;
+ containerPtr->abortPtr = NULL;
+ containerPtr->flags = 0;
+ Tcl_SetHashValue(hPtr, containerPtr);
+ Tk_CreateEventHandler(containerPtr->tkwin, StructureNotifyMask,
+ PlaceStructureProc, containerPtr);
} else {
- masterPtr = Tcl_GetHashValue(hPtr);
+ containerPtr = (Container *)Tcl_GetHashValue(hPtr);
}
- return masterPtr;
+ return containerPtr;
}
/*
*----------------------------------------------------------------------
*
- * FindMaster --
+ * FindContainer --
*
- * Given a Tk_Window token, find the Master structure corresponding to
+ * Given a Tk_Window token, find the Container structure corresponding to
* that token. This is simply a lookup function; a new record will not be
* created if one does not already exist.
*
* Results:
- * Pointer to the Master structure; NULL if one does not exist for the
+ * Pointer to the Container structure; NULL if one does not exist for the
* given Tk_Window token.
*
* Side effects:
@@ -571,24 +572,24 @@ CreateMaster(
*----------------------------------------------------------------------
*/
-static Master *
-FindMaster(
- Tk_Window tkwin) /* Token for desired master. */
+static Container *
+FindContainer(
+ Tk_Window tkwin) /* Token for desired container. */
{
- register Tcl_HashEntry *hPtr;
+ Tcl_HashEntry *hPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, (char *) tkwin);
if (hPtr == NULL) {
return NULL;
}
- return Tcl_GetHashValue(hPtr);
+ return (Container *)Tcl_GetHashValue(hPtr);
}
/*
*----------------------------------------------------------------------
*
- * ConfigureSlave --
+ * ConfigureContent --
*
* This function is called to process an argv/argc list to reconfigure
* the placement of a window.
@@ -598,26 +599,26 @@ FindMaster(
* the interp's result.
*
* Side effects:
- * Information in slavePtr may change, and slavePtr's master is scheduled
+ * Information in contentPtr may change, and contentPtr's container is scheduled
* for reconfiguration.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlave(
+ConfigureContent(
Tcl_Interp *interp, /* Used for error reporting. */
Tk_Window tkwin, /* Token for the window to manipulate. */
Tk_OptionTable table, /* Token for option table. */
int objc, /* Number of config arguments. */
Tcl_Obj *const objv[]) /* Object values for arguments. */
{
- register Master *masterPtr;
+ Container *containerPtr;
Tk_SavedOptions savedOptions;
int mask;
- Slave *slavePtr;
- Tk_Window masterWin = NULL;
- TkWindow *master;
+ Content *contentPtr;
+ Tk_Window containerWin = NULL;
+ TkWindow *container;
if (Tk_TopWinHierarchy(tkwin)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -627,71 +628,71 @@ ConfigureSlave(
return TCL_ERROR;
}
- slavePtr = CreateSlave(tkwin, table);
+ contentPtr = CreateContent(tkwin, table);
- if (Tk_SetOptions(interp, (char *) slavePtr, table, objc, objv,
- slavePtr->tkwin, &savedOptions, &mask) != TCL_OK) {
+ if (Tk_SetOptions(interp, (char *)contentPtr, table, objc, objv,
+ contentPtr->tkwin, &savedOptions, &mask) != TCL_OK) {
goto error;
}
/*
- * Set slave flags. First clear the field, then add bits as needed.
+ * Set content flags. First clear the field, then add bits as needed.
*/
- slavePtr->flags = 0;
- if (slavePtr->heightPtr) {
- slavePtr->flags |= CHILD_HEIGHT;
+ contentPtr->flags = 0;
+ if (contentPtr->heightPtr) {
+ contentPtr->flags |= CHILD_HEIGHT;
}
- if (slavePtr->relHeightPtr) {
- slavePtr->flags |= CHILD_REL_HEIGHT;
+ if (contentPtr->relHeightPtr) {
+ contentPtr->flags |= CHILD_REL_HEIGHT;
}
- if (slavePtr->relWidthPtr) {
- slavePtr->flags |= CHILD_REL_WIDTH;
+ if (contentPtr->relWidthPtr) {
+ contentPtr->flags |= CHILD_REL_WIDTH;
}
- if (slavePtr->widthPtr) {
- slavePtr->flags |= CHILD_WIDTH;
+ if (contentPtr->widthPtr) {
+ contentPtr->flags |= CHILD_WIDTH;
}
- if (!(mask & IN_MASK) && (slavePtr->masterPtr != NULL)) {
+ if (!(mask & IN_MASK) && (contentPtr->containerPtr != NULL)) {
/*
- * If no -in option was passed and the slave is already placed then
+ * If no -in option was passed and the content is already placed then
* just recompute the placement.
*/
- masterPtr = slavePtr->masterPtr;
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
} else if (mask & IN_MASK) {
/* -in changed */
- Tk_Window tkwin;
+ Tk_Window win;
Tk_Window ancestor;
- tkwin = slavePtr->inTkwin;
+ win = contentPtr->inTkwin;
/*
- * Make sure that the new master is either the logical parent of the
- * slave or a descendant of that window, and that the master and slave
+ * Make sure that the new container is either the logical parent of the
+ * content or a descendant of that window, and that the container and content
* aren't the same.
*/
- for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) {
- if (ancestor == Tk_Parent(slavePtr->tkwin)) {
+ for (ancestor = win; ; ancestor = Tk_Parent(ancestor)) {
+ if (ancestor == Tk_Parent(contentPtr->tkwin)) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't place %s relative to %s",
- Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin)));
+ Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
goto error;
}
}
- if (slavePtr->tkwin == tkwin) {
+ if (contentPtr->tkwin == win) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't place %s relative to itself",
- Tk_PathName(slavePtr->tkwin)));
+ Tk_PathName(contentPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
}
@@ -700,66 +701,66 @@ ConfigureSlave(
* Check for management loops.
*/
- for (master = (TkWindow *)tkwin; master != NULL;
- master = (TkWindow *)TkGetGeomMaster(master)) {
- if (master == (TkWindow *)slavePtr->tkwin) {
+ for (container = (TkWindow *)win; container != NULL;
+ container = (TkWindow *)TkGetContainer(container)) {
+ if (container == (TkWindow *)contentPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't put %s inside %s, would cause management loop",
- Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin)));
+ Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
}
}
- if (tkwin != Tk_Parent(slavePtr->tkwin)) {
- ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin;
+ if (win != Tk_Parent(contentPtr->tkwin)) {
+ ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)win;
}
- if ((slavePtr->masterPtr != NULL)
- && (slavePtr->masterPtr->tkwin == tkwin)) {
+ if ((contentPtr->containerPtr != NULL)
+ && (contentPtr->containerPtr->tkwin == win)) {
/*
- * Re-using same old master. Nothing to do.
+ * Re-using same old container. Nothing to do.
*/
- masterPtr = slavePtr->masterPtr;
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
- if ((slavePtr->masterPtr != NULL) &&
- (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if ((contentPtr->containerPtr != NULL) &&
+ (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- UnlinkSlave(slavePtr);
- masterWin = tkwin;
+ UnlinkContent(contentPtr);
+ containerWin = win;
}
/*
- * If there's no master specified for this slave, use its Tk_Parent.
+ * If there's no container specified for this content, use its Tk_Parent.
*/
- if (masterWin == NULL) {
- masterWin = Tk_Parent(slavePtr->tkwin);
- slavePtr->inTkwin = masterWin;
+ if (containerWin == NULL) {
+ containerWin = Tk_Parent(contentPtr->tkwin);
+ contentPtr->inTkwin = containerWin;
}
/*
- * Manage the slave window in this master.
+ * Manage the content window in this container.
*/
- masterPtr = CreateMaster(masterWin);
- slavePtr->masterPtr = masterPtr;
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
- Tk_ManageGeometry(slavePtr->tkwin, &placerType, slavePtr);
+ containerPtr = CreateContainer(containerWin);
+ contentPtr->containerPtr = containerPtr;
+ contentPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = contentPtr;
+ Tk_ManageGeometry(contentPtr->tkwin, &placerType, contentPtr);
/*
- * Arrange for the master to be re-arranged at the first idle moment.
+ * Arrange for the container to be re-arranged at the first idle moment.
*/
scheduleLayout:
Tk_FreeSavedOptions(&savedOptions);
- if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
return TCL_OK;
@@ -795,49 +796,49 @@ PlaceInfoCommand(
Tcl_Interp *interp, /* Interp into which to place result. */
Tk_Window tkwin) /* Token for the window to get info on. */
{
- Slave *slavePtr;
+ Content *contentPtr;
Tcl_Obj *infoObj;
- slavePtr = FindSlave(tkwin);
- if (slavePtr == NULL) {
+ contentPtr = FindContent(tkwin);
+ if (contentPtr == NULL) {
return TCL_OK;
}
infoObj = Tcl_NewObj();
- if (slavePtr->masterPtr != NULL) {
+ if (contentPtr->containerPtr != NULL) {
Tcl_AppendToObj(infoObj, "-in", -1);
Tcl_ListObjAppendElement(NULL, infoObj,
- TkNewWindowObj(slavePtr->masterPtr->tkwin));
+ TkNewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_AppendToObj(infoObj, " ", -1);
}
Tcl_AppendPrintfToObj(infoObj,
"-x %d -relx %.4g -y %d -rely %.4g",
- slavePtr->x, slavePtr->relX, slavePtr->y, slavePtr->relY);
- if (slavePtr->flags & CHILD_WIDTH) {
- Tcl_AppendPrintfToObj(infoObj, " -width %d", slavePtr->width);
+ contentPtr->x, contentPtr->relX, contentPtr->y, contentPtr->relY);
+ if (contentPtr->flags & CHILD_WIDTH) {
+ Tcl_AppendPrintfToObj(infoObj, " -width %d", contentPtr->width);
} else {
Tcl_AppendToObj(infoObj, " -width {}", -1);
}
- if (slavePtr->flags & CHILD_REL_WIDTH) {
+ if (contentPtr->flags & CHILD_REL_WIDTH) {
Tcl_AppendPrintfToObj(infoObj,
- " -relwidth %.4g", slavePtr->relWidth);
+ " -relwidth %.4g", contentPtr->relWidth);
} else {
Tcl_AppendToObj(infoObj, " -relwidth {}", -1);
}
- if (slavePtr->flags & CHILD_HEIGHT) {
- Tcl_AppendPrintfToObj(infoObj, " -height %d", slavePtr->height);
+ if (contentPtr->flags & CHILD_HEIGHT) {
+ Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height);
} else {
Tcl_AppendToObj(infoObj, " -height {}", -1);
}
- if (slavePtr->flags & CHILD_REL_HEIGHT) {
+ if (contentPtr->flags & CHILD_REL_HEIGHT) {
Tcl_AppendPrintfToObj(infoObj,
- " -relheight %.4g", slavePtr->relHeight);
+ " -relheight %.4g", contentPtr->relHeight);
} else {
Tcl_AppendToObj(infoObj, " -relheight {}", -1);
}
Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s",
- Tk_NameOfAnchor(slavePtr->anchor),
- borderModeStrings[slavePtr->borderMode]);
+ Tk_NameOfAnchor(contentPtr->anchor),
+ borderModeStrings[contentPtr->borderMode]);
Tcl_SetObjResult(interp, infoObj);
return TCL_OK;
}
@@ -848,7 +849,7 @@ PlaceInfoCommand(
* RecomputePlacement --
*
* This function is called as a when-idle handler. It recomputes the
- * geometries of all the slaves of a given master.
+ * geometries of all the content of a given container.
*
* Results:
* None.
@@ -861,17 +862,17 @@ PlaceInfoCommand(
static void
RecomputePlacement(
- ClientData clientData) /* Pointer to Master record. */
+ ClientData clientData) /* Pointer to Container record. */
{
- register Master *masterPtr = clientData;
- register Slave *slavePtr;
+ Container *containerPtr = (Container *)clientData;
+ Content *contentPtr;
int x, y, width, height, tmp;
- int masterWidth, masterHeight, masterX, masterY;
+ int containerWidth, containerHeight, containerX, containerY;
double x1, y1, x2, y2;
int abort; /* May get set to non-zero to abort this
* placement operation. */
- masterPtr->flags &= ~PARENT_RECONFIG_PENDING;
+ containerPtr->flags &= ~PARENT_RECONFIG_PENDING;
/*
* Abort any nested call to RecomputePlacement for this window, since
@@ -879,57 +880,57 @@ RecomputePlacement(
* aborted if necessary.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- masterPtr->abortPtr = &abort;
+ containerPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(containerPtr);
/*
- * Iterate over all the slaves for the master. Each slave's geometry can
- * be computed independently of the other slaves. Changes to the window's
+ * Iterate over all the content for the container. Each content's geometry can
+ * be computed independently of the other content. Changes to the window's
* structure could cause almost anything to happen, including deleting the
* parent or child. If this happens, we'll be told to abort.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort;
- slavePtr = slavePtr->nextPtr) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort;
+ contentPtr = contentPtr->nextPtr) {
/*
- * Step 1: compute size and borderwidth of master, taking into account
+ * Step 1: compute size and borderwidth of container, taking into account
* desired border mode.
*/
- masterX = masterY = 0;
- masterWidth = Tk_Width(masterPtr->tkwin);
- masterHeight = Tk_Height(masterPtr->tkwin);
- if (slavePtr->borderMode == BM_INSIDE) {
- masterX = Tk_InternalBorderLeft(masterPtr->tkwin);
- masterY = Tk_InternalBorderTop(masterPtr->tkwin);
- masterWidth -= masterX + Tk_InternalBorderRight(masterPtr->tkwin);
- masterHeight -= masterY +
- Tk_InternalBorderBottom(masterPtr->tkwin);
- } else if (slavePtr->borderMode == BM_OUTSIDE) {
- masterX = masterY = -Tk_Changes(masterPtr->tkwin)->border_width;
- masterWidth -= 2 * masterX;
- masterHeight -= 2 * masterY;
+ containerX = containerY = 0;
+ containerWidth = Tk_Width(containerPtr->tkwin);
+ containerHeight = Tk_Height(containerPtr->tkwin);
+ if (contentPtr->borderMode == BM_INSIDE) {
+ containerX = Tk_InternalBorderLeft(containerPtr->tkwin);
+ containerY = Tk_InternalBorderTop(containerPtr->tkwin);
+ containerWidth -= containerX + Tk_InternalBorderRight(containerPtr->tkwin);
+ containerHeight -= containerY +
+ Tk_InternalBorderBottom(containerPtr->tkwin);
+ } else if (contentPtr->borderMode == BM_OUTSIDE) {
+ containerX = containerY = -Tk_Changes(containerPtr->tkwin)->border_width;
+ containerWidth -= 2 * containerX;
+ containerHeight -= 2 * containerY;
}
/*
- * Step 2: compute size of slave (outside dimensions including border)
- * and location of anchor point within master.
+ * Step 2: compute size of content (outside dimensions including border)
+ * and location of anchor point within container.
*/
- x1 = slavePtr->x + masterX + (slavePtr->relX*masterWidth);
+ x1 = contentPtr->x + containerX + (contentPtr->relX*containerWidth);
x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5));
- y1 = slavePtr->y + masterY + (slavePtr->relY*masterHeight);
+ y1 = contentPtr->y + containerY + (contentPtr->relY*containerHeight);
y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5));
- if (slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) {
+ if (contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) {
width = 0;
- if (slavePtr->flags & CHILD_WIDTH) {
- width += slavePtr->width;
+ if (contentPtr->flags & CHILD_WIDTH) {
+ width += contentPtr->width;
}
- if (slavePtr->flags & CHILD_REL_WIDTH) {
+ if (contentPtr->flags & CHILD_REL_WIDTH) {
/*
* The code below is a bit tricky. In order to round correctly
* when both relX and relWidth are specified, compute the
@@ -938,40 +939,40 @@ RecomputePlacement(
* errors in relX and relWidth accumulate.
*/
- x2 = x1 + (slavePtr->relWidth*masterWidth);
+ x2 = x1 + (contentPtr->relWidth*containerWidth);
tmp = (int) (x2 + ((x2 > 0) ? 0.5 : -0.5));
width += tmp - x;
}
} else {
- width = Tk_ReqWidth(slavePtr->tkwin)
- + 2*Tk_Changes(slavePtr->tkwin)->border_width;
+ width = Tk_ReqWidth(contentPtr->tkwin)
+ + 2*Tk_Changes(contentPtr->tkwin)->border_width;
}
- if (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) {
+ if (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) {
height = 0;
- if (slavePtr->flags & CHILD_HEIGHT) {
- height += slavePtr->height;
+ if (contentPtr->flags & CHILD_HEIGHT) {
+ height += contentPtr->height;
}
- if (slavePtr->flags & CHILD_REL_HEIGHT) {
+ if (contentPtr->flags & CHILD_REL_HEIGHT) {
/*
* See note above for rounding errors in width computation.
*/
- y2 = y1 + (slavePtr->relHeight*masterHeight);
+ y2 = y1 + (contentPtr->relHeight*containerHeight);
tmp = (int) (y2 + ((y2 > 0) ? 0.5 : -0.5));
height += tmp - y;
}
} else {
- height = Tk_ReqHeight(slavePtr->tkwin)
- + 2*Tk_Changes(slavePtr->tkwin)->border_width;
+ height = Tk_ReqHeight(contentPtr->tkwin)
+ + 2*Tk_Changes(contentPtr->tkwin)->border_width;
}
/*
* Step 3: adjust the x and y positions so that the desired anchor
- * point on the slave appears at that position. Also adjust for the
- * border mode and master's border.
+ * point on the content appears at that position. Also adjust for the
+ * border mode and container's border.
*/
- switch (slavePtr->anchor) {
+ switch (contentPtr->anchor) {
case TK_ANCHOR_N:
x -= width/2;
break;
@@ -1010,8 +1011,8 @@ RecomputePlacement(
* height aren't zero.
*/
- width -= 2*Tk_Changes(slavePtr->tkwin)->border_width;
- height -= 2*Tk_Changes(slavePtr->tkwin)->border_width;
+ width -= 2*Tk_Changes(contentPtr->tkwin)->border_width;
+ height -= 2*Tk_Changes(contentPtr->tkwin)->border_width;
if (width <= 0) {
width = 1;
}
@@ -1020,121 +1021,121 @@ RecomputePlacement(
}
/*
- * Step 5: reconfigure the window and map it if needed. If the slave
- * is a child of the master, we do this ourselves. If the slave isn't
- * a child of the master, let Tk_MaintainGeometry do the work (it will
+ * Step 5: reconfigure the window and map it if needed. If the content
+ * is a child of the container, we do this ourselves. If the content isn't
+ * a child of the container, let Tk_MaintainGeometry do the work (it will
* re-adjust things as relevant windows map, unmap, and move).
*/
- if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
- if ((x != Tk_X(slavePtr->tkwin))
- || (y != Tk_Y(slavePtr->tkwin))
- || (width != Tk_Width(slavePtr->tkwin))
- || (height != Tk_Height(slavePtr->tkwin))) {
- Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height);
+ if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) {
+ if ((x != Tk_X(contentPtr->tkwin))
+ || (y != Tk_Y(contentPtr->tkwin))
+ || (width != Tk_Width(contentPtr->tkwin))
+ || (height != Tk_Height(contentPtr->tkwin))) {
+ Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height);
}
if (abort) {
break;
}
/*
- * Don't map the slave unless the master is mapped: the slave will
- * get mapped later, when the master is mapped.
+ * Don't map the content unless the container is mapped: the content will
+ * get mapped later, when the container is mapped.
*/
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
+ if (Tk_IsMapped(containerPtr->tkwin)) {
+ Tk_MapWindow(contentPtr->tkwin);
}
} else {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin,
+ Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin,
x, y, width, height);
}
}
}
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
}
/*
*----------------------------------------------------------------------
*
- * MasterStructureProc --
+ * PlaceStructureProc --
*
* This function is invoked by the Tk event handler when StructureNotify
- * events occur for a master window.
+ * events occur for a container window.
*
* Results:
* None.
*
* Side effects:
* Structures get cleaned up if the window was deleted. If the window was
- * resized then slave geometries get recomputed.
+ * resized then content geometries get recomputed.
*
*----------------------------------------------------------------------
*/
static void
-MasterStructureProc(
- ClientData clientData, /* Pointer to Master structure for window
+PlaceStructureProc(
+ ClientData clientData, /* Pointer to Container structure for window
* referred to by eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- register Master *masterPtr = clientData;
- register Slave *slavePtr, *nextPtr;
- TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr;
+ Container *containerPtr = (Container *)clientData;
+ Content *contentPtr, *nextPtr;
+ TkDisplay *dispPtr = ((TkWindow *) containerPtr->tkwin)->dispPtr;
switch (eventPtr->type) {
case ConfigureNotify:
- if ((masterPtr->slavePtr != NULL)
- && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if ((containerPtr->contentPtr != NULL)
+ && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
return;
case DestroyNotify:
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = nextPtr) {
- slavePtr->masterPtr = NULL;
- nextPtr = slavePtr->nextPtr;
- slavePtr->nextPtr = NULL;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = nextPtr) {
+ contentPtr->containerPtr = NULL;
+ nextPtr = contentPtr->nextPtr;
+ contentPtr->nextPtr = NULL;
}
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable,
- (char *) masterPtr->tkwin));
- if (masterPtr->flags & PARENT_RECONFIG_PENDING) {
- Tcl_CancelIdleCall(RecomputePlacement, masterPtr);
+ (char *) containerPtr->tkwin));
+ if (containerPtr->flags & PARENT_RECONFIG_PENDING) {
+ Tcl_CancelIdleCall(RecomputePlacement, containerPtr);
}
- masterPtr->tkwin = NULL;
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ containerPtr->tkwin = NULL;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- Tcl_EventuallyFree(masterPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(containerPtr, TCL_DYNAMIC);
return;
case MapNotify:
/*
- * When a master gets mapped, must redo the geometry computation so
- * that all of its slaves get remapped.
+ * When a container gets mapped, must redo the geometry computation so
+ * that all of its content get remapped.
*/
- if ((masterPtr->slavePtr != NULL)
- && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if ((containerPtr->contentPtr != NULL)
+ && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
return;
case UnmapNotify:
/*
- * Unmap all of the slaves when the master gets unmapped, so that they
+ * Unmap all of the content when the container gets unmapped, so that they
* don't keep redisplaying themselves.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ Tk_UnmapWindow(contentPtr->tkwin);
}
return;
}
@@ -1143,10 +1144,10 @@ MasterStructureProc(
/*
*----------------------------------------------------------------------
*
- * SlaveStructureProc --
+ * ContentStructureProc --
*
* This function is invoked by the Tk event handler when StructureNotify
- * events occur for a slave window.
+ * events occur for a content window.
*
* Results:
* None.
@@ -1158,21 +1159,21 @@ MasterStructureProc(
*/
static void
-SlaveStructureProc(
- ClientData clientData, /* Pointer to Slave structure for window
+ContentStructureProc(
+ ClientData clientData, /* Pointer to Content structure for window
* referred to by eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- register Slave *slavePtr = clientData;
- TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
+ Content *contentPtr = (Content *)clientData;
+ TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr;
if (eventPtr->type == DestroyNotify) {
- if (slavePtr->masterPtr != NULL) {
- UnlinkSlave(slavePtr);
+ if (contentPtr->containerPtr != NULL) {
+ UnlinkContent(contentPtr);
}
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
- (char *) slavePtr->tkwin));
- FreeSlave(slavePtr);
+ (char *) contentPtr->tkwin));
+ FreeContent(contentPtr);
}
}
@@ -1181,7 +1182,7 @@ SlaveStructureProc(
*
* PlaceRequestProc --
*
- * This function is invoked by Tk whenever a slave managed by us changes
+ * This function is invoked by Tk whenever a content managed by us changes
* its requested geometry.
*
* Results:
@@ -1194,72 +1195,70 @@ SlaveStructureProc(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static void
PlaceRequestProc(
- ClientData clientData, /* Pointer to our record for slave. */
- Tk_Window tkwin) /* Window that changed its desired size. */
+ ClientData clientData, /* Pointer to our record for content. */
+ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */
{
- Slave *slavePtr = clientData;
- Master *masterPtr;
+ Content *contentPtr = (Content *)clientData;
+ Container *containerPtr;
- if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH))
- && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) {
+ if ((contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH))
+ && (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) {
/*
* Send a ConfigureNotify to indicate that the size change
* request was rejected.
*/
- TkDoConfigureNotify((TkWindow *)(slavePtr->tkwin));
+ TkDoConfigureNotify((TkWindow *)(contentPtr->tkwin));
return;
}
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = contentPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
}
/*
*--------------------------------------------------------------
*
- * PlaceLostSlaveProc --
+ * PlaceLostContentProc --
*
* 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 placer-related information about the slave.
+ * Forgets all placer-related information about the content window.
*
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
-PlaceLostSlaveProc(
- ClientData clientData, /* Slave structure for slave window that was
+PlaceLostContentProc(
+ ClientData clientData, /* Content 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. */
{
- register Slave *slavePtr = clientData;
- TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
+ Content *contentPtr = (Content *)clientData;
+ TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr;
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
Tk_UnmapWindow(tkwin);
- UnlinkSlave(slavePtr);
+ UnlinkContent(contentPtr);
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
(char *) tkwin));
- Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- slavePtr);
- FreeSlave(slavePtr);
+ Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
+ contentPtr);
+ FreeContent(contentPtr);
}
/*
diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h
index 1e69c883..bad633f2 100644
--- a/generic/tkPlatDecls.h
+++ b/generic/tkPlatDecls.h
@@ -82,6 +82,17 @@ EXTERN void * TkMacOSXGetRootControl(Drawable drawable);
EXTERN void Tk_MacOSXSetupTkNotifier(void);
/* 10 */
EXTERN int Tk_MacOSXIsAppInFront(void);
+/* 11 */
+EXTERN Tk_Window Tk_MacOSXGetTkWindow(void *w);
+/* 12 */
+EXTERN void * Tk_MacOSXGetCGContextForDrawable(Drawable drawable);
+/* 13 */
+EXTERN void * Tk_MacOSXGetNSWindowForDrawable(Drawable drawable);
+/* Slot 14 is reserved */
+/* Slot 15 is reserved */
+/* 16 */
+EXTERN void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y,
+ int width, int height, int flags);
#endif /* AQUA */
typedef struct TkPlatStubs {
@@ -108,6 +119,12 @@ typedef struct TkPlatStubs {
void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */
void (*tk_MacOSXSetupTkNotifier) (void); /* 9 */
int (*tk_MacOSXIsAppInFront) (void); /* 10 */
+ Tk_Window (*tk_MacOSXGetTkWindow) (void *w); /* 11 */
+ void * (*tk_MacOSXGetCGContextForDrawable) (Drawable drawable); /* 12 */
+ void * (*tk_MacOSXGetNSWindowForDrawable) (Drawable drawable); /* 13 */
+ void (*reserved14)(void);
+ void (*reserved15)(void);
+ void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 16 */
#endif /* AQUA */
} TkPlatStubs;
@@ -160,6 +177,16 @@ extern const TkPlatStubs *tkPlatStubsPtr;
(tkPlatStubsPtr->tk_MacOSXSetupTkNotifier) /* 9 */
#define Tk_MacOSXIsAppInFront \
(tkPlatStubsPtr->tk_MacOSXIsAppInFront) /* 10 */
+#define Tk_MacOSXGetTkWindow \
+ (tkPlatStubsPtr->tk_MacOSXGetTkWindow) /* 11 */
+#define Tk_MacOSXGetCGContextForDrawable \
+ (tkPlatStubsPtr->tk_MacOSXGetCGContextForDrawable) /* 12 */
+#define Tk_MacOSXGetNSWindowForDrawable \
+ (tkPlatStubsPtr->tk_MacOSXGetNSWindowForDrawable) /* 13 */
+/* Slot 14 is reserved */
+/* Slot 15 is reserved */
+#define TkGenWMConfigureEvent_ \
+ (tkPlatStubsPtr->tkGenWMConfigureEvent_) /* 16 */
#endif /* AQUA */
#endif /* defined(USE_TK_STUBS) */
@@ -173,4 +200,7 @@ extern const TkPlatStubs *tkPlatStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+#undef TkGenWMConfigureEvent_
+#define Tk_MacOSXGetNSViewForDrawable TkMacOSXGetRootControl
+
#endif /* _TKPLATDECLS */
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index f764904b..cc674016 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.c
@@ -26,7 +26,7 @@
typedef struct {
TkWindow *grabWinPtr; /* Window that defines the top of the grab
* tree in a global grab. */
- int lastState; /* Last known state flags. */
+ unsigned lastState; /* Last known state flags. */
XPoint lastPos; /* Last reported mouse position. */
TkWindow *lastWinPtr; /* Last reported mouse window. */
TkWindow *restrictWinPtr; /* Window to which all mouse events will be
@@ -225,8 +225,9 @@ Tk_UpdatePointer(
TkWindow *targetWinPtr;
XPoint pos;
XEvent event;
- int changes = (state ^ tsdPtr->lastState) & ALL_BUTTONS;
- int type, b, mask;
+ unsigned changes = (state ^ tsdPtr->lastState) & ALL_BUTTONS;
+ int type, b;
+ unsigned mask;
pos.x = x;
pos.y = y;
@@ -593,47 +594,6 @@ XDefineCursor(
return Success;
}
-/*
- *----------------------------------------------------------------------
- *
- * TkGenerateActivateEvents --
- *
- * This function is called by the Mac and Windows window manager routines
- * when a toplevel window is activated or deactivated.
- * Activate/Deactivate events will be sent to every subwindow of the
- * toplevel followed by a FocusIn/FocusOut message.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Generates X events.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkGenerateActivateEvents(
- TkWindow *winPtr, /* Toplevel to activate. */
- int active) /* Non-zero if the window is being activated,
- * else 0.*/
-{
- XEvent event;
-
- /*
- * Generate Activate and Deactivate events. This event is sent to every
- * subwindow in a toplevel window.
- */
-
- event.xany.serial = winPtr->display->request++;
- event.xany.send_event = False;
- event.xany.display = winPtr->display;
- event.xany.window = winPtr->window;
-
- event.xany.type = active ? ActivateNotify : DeactivateNotify;
- TkQueueEventForAllChildren(winPtr, &event);
-}
-
/*
* Local Variables:
* mode: c
diff --git a/generic/tkScale.c b/generic/tkScale.c
index 5957b002..825f6616 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -658,13 +658,11 @@ ConfigureScale(
}
}
- /*
- * Several options need special processing, such as parsing the
- * orientation and creating GCs.
- */
+ /*
+ * The fromValue shall not be rounded to the resolution, but the
+ * toValue and tickInterval do.
+ */
- scalePtr->fromValue = TkRoundValueToResolution(scalePtr,
- scalePtr->fromValue);
scalePtr->toValue = TkRoundValueToResolution(scalePtr, scalePtr->toValue);
scalePtr->tickInterval = TkRoundIntervalToResolution(scalePtr,
scalePtr->tickInterval);
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 9a855325..8c80846a 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -127,8 +127,8 @@ Tk_ScrollbarObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- Tk_Window tkwin = clientData;
- register TkScrollbar *scrollPtr;
+ Tk_Window tkwin = (Tk_Window)clientData;
+ TkScrollbar *scrollPtr;
Tk_Window newWin;
if (objc < 2) {
@@ -223,7 +223,7 @@ ScrollbarWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- register TkScrollbar *scrollPtr = clientData;
+ TkScrollbar *scrollPtr = (TkScrollbar *)clientData;
int result = TCL_OK;
int length, cmdIndex;
static const char *const commandNames[] = {
@@ -308,7 +308,7 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_DELTA: {
- int xDelta, yDelta, pixels, length;
+ int xDelta, yDelta, pixels;
double fraction;
if (objc != 4) {
@@ -337,7 +337,7 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_FRACTION: {
- int x, y, pos, length;
+ int x, y, pos;
double fraction;
if (objc != 4) {
@@ -521,7 +521,7 @@ ScrollbarWidgetObjCmd(
static int
ConfigureScrollbar(
Tcl_Interp *interp, /* Used for error reporting. */
- register TkScrollbar *scrollPtr,
+ TkScrollbar *scrollPtr,
/* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in argv. */
@@ -584,7 +584,7 @@ TkScrollbarEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkScrollbar *scrollPtr = clientData;
+ TkScrollbar *scrollPtr = (TkScrollbar *)clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
TkScrollbarEventuallyRedraw(scrollPtr);
@@ -649,7 +649,7 @@ static void
ScrollbarCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkScrollbar *scrollPtr = clientData;
+ TkScrollbar *scrollPtr = (TkScrollbar *)clientData;
Tk_Window tkwin = scrollPtr->tkwin;
/*
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index c64c93f6..9584be41 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -28,7 +28,7 @@ typedef struct {
* chunk. */
char buffer[4]; /* A buffer to hold part of a UTF character
* that is split across chunks. */
- char command[1]; /* Command to invoke. Actual space is
+ char command[TKFLEXARRAY]; /* Command to invoke. Actual space is
* allocated as large as necessary. This must
* be the last entry in the structure. */
} CommandInfo;
@@ -125,7 +125,7 @@ Tk_CreateSelHandler(
* listed in the ICCCM will be tolerated
* (blech). */
{
- register TkSelHandler *selPtr;
+ TkSelHandler *selPtr;
TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->dispPtr->multipleAtom == None) {
@@ -139,7 +139,7 @@ Tk_CreateSelHandler(
for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) {
if (selPtr == NULL) {
- selPtr = ckalloc(sizeof(TkSelHandler));
+ selPtr = (TkSelHandler *)ckalloc(sizeof(TkSelHandler));
selPtr->nextPtr = winPtr->selHandlerList;
winPtr->selHandlerList = selPtr;
break;
@@ -177,7 +177,7 @@ Tk_CreateSelHandler(
target = winPtr->dispPtr->utf8Atom;
for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) {
if (selPtr == NULL) {
- selPtr = ckalloc(sizeof(TkSelHandler));
+ selPtr = (TkSelHandler *)ckalloc(sizeof(TkSelHandler));
selPtr->nextPtr = winPtr->selHandlerList;
winPtr->selHandlerList = selPtr;
selPtr->selection = selection;
@@ -239,9 +239,9 @@ Tk_DeleteSelHandler(
* removed. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
- register TkSelHandler *selPtr, *prevPtr;
- register TkSelInProgress *ipPtr;
- ThreadSpecificData *tsdPtr =
+ TkSelHandler *selPtr, *prevPtr;
+ TkSelInProgress *ipPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -353,7 +353,7 @@ Tk_OwnSelection(
ClientData clientData) /* Arbitrary one-word argument to pass to
* proc. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
Tk_LostSelProc *clearProc = NULL;
@@ -382,7 +382,7 @@ Tk_OwnSelection(
}
}
if (infoPtr == NULL) {
- infoPtr = ckalloc(sizeof(TkSelectionInfo));
+ infoPtr = (TkSelectionInfo *)ckalloc(sizeof(TkSelectionInfo));
infoPtr->selection = selection;
infoPtr->nextPtr = dispPtr->selectionInfoPtr;
dispPtr->selectionInfoPtr = infoPtr;
@@ -460,7 +460,7 @@ Tk_ClearSelection(
Tk_Window tkwin, /* Window that selects a display. */
Atom selection) /* Selection to be cancelled. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
TkSelectionInfo *prevPtr;
@@ -556,7 +556,7 @@ Tk_GetSelection(
TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (dispPtr->multipleAtom == None) {
@@ -577,7 +577,7 @@ Tk_GetSelection(
}
}
if (infoPtr != NULL) {
- register TkSelHandler *selPtr;
+ TkSelHandler *selPtr;
int offset, result, count;
char buffer[TK_SEL_BYTES_AT_ONCE+1];
TkSelInProgress ip;
@@ -670,7 +670,7 @@ Tk_SelectionObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
const char *path = NULL;
Atom selection;
const char *selName = NULL;
@@ -830,7 +830,7 @@ Tk_SelectionObjCmd(
Atom target, format;
const char *targetName = NULL;
const char *formatName = NULL;
- register CommandInfo *cmdInfoPtr;
+ CommandInfo *cmdInfoPtr;
int cmdLength;
static const char *const handleOptionStrings[] = {
"-format", "-selection", "-type", NULL
@@ -904,7 +904,7 @@ Tk_SelectionObjCmd(
if (cmdLength == 0) {
Tk_DeleteSelHandler(tkwin, selection, target);
} else {
- cmdInfoPtr = ckalloc(Tk_Offset(CommandInfo, command)
+ cmdInfoPtr = (CommandInfo *)ckalloc(Tk_Offset(CommandInfo, command)
+ 1 + cmdLength);
cmdInfoPtr->interp = interp;
cmdInfoPtr->charOffset = 0;
@@ -919,7 +919,7 @@ Tk_SelectionObjCmd(
}
case SELECTION_OWN: {
- register LostCommand *lostPtr;
+ LostCommand *lostPtr;
Tcl_Obj *commandObj = NULL;
static const char *const ownOptionStrings[] = {
"-command", "-displayof", "-selection", NULL
@@ -1008,7 +1008,7 @@ Tk_SelectionObjCmd(
Tk_OwnSelection(tkwin, selection, NULL, NULL);
return TCL_OK;
}
- lostPtr = ckalloc(sizeof(LostCommand));
+ lostPtr = (LostCommand *)ckalloc(sizeof(LostCommand));
lostPtr->interp = interp;
lostPtr->cmdObj = commandObj;
Tcl_IncrRefCount(commandObj);
@@ -1040,7 +1040,7 @@ Tk_SelectionObjCmd(
TkSelInProgress *
TkSelGetInProgress(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->pendingPtr;
@@ -1067,7 +1067,7 @@ void
TkSelSetInProgress(
TkSelInProgress *pendingPtr)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->pendingPtr = pendingPtr;
@@ -1092,12 +1092,12 @@ TkSelSetInProgress(
void
TkSelDeadWindow(
- register TkWindow *winPtr) /* Window that's being deleted. */
+ TkWindow *winPtr) /* Window that's being deleted. */
{
- register TkSelHandler *selPtr;
- register TkSelInProgress *ipPtr;
+ TkSelHandler *selPtr;
+ TkSelInProgress *ipPtr;
TkSelectionInfo *infoPtr, *prevPtr, *nextPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1170,7 +1170,7 @@ TkSelInit(
Tk_Window tkwin) /* Window token (used to find display to
* initialize). */
{
- register TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
/*
* Fetch commonly-used atoms.
@@ -1221,9 +1221,9 @@ TkSelInit(
void
TkSelClearSelection(
Tk_Window tkwin, /* Window for which event was targeted. */
- register XEvent *eventPtr) /* X SelectionClear event. */
+ XEvent *eventPtr) /* X SelectionClear event. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
TkSelectionInfo *prevPtr;
@@ -1285,16 +1285,15 @@ TkSelClearSelection(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
SelGetProc(
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(clientData, portion, -1);
+ Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1);
return TCL_OK;
}
@@ -1400,17 +1399,18 @@ HandleTclCommand(
cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, -1);
cmdInfoPtr->buffer[0] = '\0';
} else {
+ int ch;
p = string;
string += count;
numChars = 0;
while (p < string) {
- p = Tcl_UtfNext(p);
+ p += TkUtfToUniChar(p, &ch);
numChars++;
}
cmdInfoPtr->charOffset += numChars;
length = p - string;
if (length > 0) {
- strncpy(cmdInfoPtr->buffer, string, (size_t) length);
+ strncpy(cmdInfoPtr->buffer, string, length);
}
cmdInfoPtr->buffer[length] = '\0';
}
@@ -1469,7 +1469,7 @@ TkSelDefaultSelection(
Atom *typePtr) /* Store here the type of the selection, for
* use in converting to proper X format. */
{
- register TkWindow *winPtr = (TkWindow *) infoPtr->owner;
+ TkWindow *winPtr = (TkWindow *) infoPtr->owner;
TkDisplay *dispPtr = winPtr->dispPtr;
if (target == dispPtr->timestampAtom) {
@@ -1482,7 +1482,7 @@ TkSelDefaultSelection(
}
if (target == dispPtr->targetsAtom) {
- register TkSelHandler *selPtr;
+ TkSelHandler *selPtr;
int length;
Tcl_DString ds;
@@ -1508,7 +1508,7 @@ TkSelDefaultSelection(
Tcl_DStringFree(&ds);
return -1;
}
- memcpy(buffer, Tcl_DStringValue(&ds), (unsigned) (1+length));
+ memcpy(buffer, Tcl_DStringValue(&ds), length + 1);
Tcl_DStringFree(&ds);
*typePtr = XA_ATOM;
return length;
@@ -1565,7 +1565,7 @@ static void
LostSelection(
ClientData clientData) /* Pointer to LostCommand structure. */
{
- LostCommand *lostPtr = clientData;
+ LostCommand *lostPtr = (LostCommand *)clientData;
Tcl_Interp *interp = lostPtr->interp;
Tcl_InterpState savedState;
int code;
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 288dfc86..e637f8ee 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -24,6 +24,7 @@
#if defined(MAC_OSX_TK)
/* we could have used _TKMACINT */
#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#endif
/* TODO: These ought to come in some other way */
@@ -45,6 +46,39 @@ MODULE_SCOPE const TkStubs tkStubs;
#undef XGrabServer
#undef XFree
#undef XFlush
+#define TkUnusedStubEntry 0
+
+#define TkpCmapStressed_ TkpCmapStressed
+#define TkpSync_ TkpSync
+#define TkUnixContainerId_ TkUnixContainerId
+#define TkUnixDoOneXEvent_ TkUnixDoOneXEvent
+#define TkUnixSetMenubar_ TkUnixSetMenubar
+#define TkWmCleanup_ TkWmCleanup
+#define TkSendCleanup_ TkSendCleanup
+#define TkpTestsendCmd_ TkpTestsendCmd
+#define TkGenWMConfigureEvent_ TkGenWMConfigureEvent
+#define TkGenerateActivateEvents_ TkGenerateActivateEvents
+
+#if !defined(MAC_OSX_TK) && defined(MAC_OSX_TCL)
+# undef TkpWillDrawWidget
+# undef TkpRedrawWidget
+static int
+doNothing(void)
+{
+ /* dummy implementation, no need to do anything */
+ return 0;
+}
+# define TkpWillDrawWidget ((int (*)(Tk_Window))(void *)doNothing)
+# define TkpRedrawWidget ((void (*)(Tk_Window))(void *)doNothing)
+#endif
+
+#if defined(MAC_OSX_TK)
+# define Tk_MacOSXGetNSWindowForDrawable TkMacOSXDrawable
+# define Tk_MacOSXGetCGContextForDrawable GetCGContextForDrawable
+static void *GetCGContextForDrawable(Drawable d) {
+ return TkMacOSXGetCGContextForDrawable(d);
+}
+#endif
#ifdef _WIN32
@@ -183,7 +217,6 @@ int TkSubtractRegion (TkRegion a, TkRegion b, TkRegion c)
# define Tk_PointerEvent 0
# define Tk_TranslateWinEvent 0
# define TkAlignImageData 0
-# define TkGenerateActivateEvents 0
# define TkpGetMS 0
# define TkpGetCapture 0
# define TkPointerDeadWindow 0
@@ -244,6 +277,14 @@ int TkSubtractRegion (TkRegion a, TkRegion b, TkRegion c)
* below should be made in the generic/tk.decls script.
*/
+#ifdef __GNUC__
+/*
+ * The rest of this file shouldn't warn about deprecated functions; they're
+ * there because we intend them to be so and know that this file is OK to
+ * touch those fields.
+ */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
/* !BEGIN!: Do not edit below this line. */
static const TkIntStubs tkIntStubs = {
@@ -461,6 +502,24 @@ static const TkIntStubs tkIntStubs = {
TkUnderlineAngledTextLayout, /* 182 */
TkIntersectAngledTextLayout, /* 183 */
TkDrawAngledChars, /* 184 */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ 0, /* 185 */
+#endif /* UNIX */
+#if defined(_WIN32) /* WIN */
+ 0, /* 185 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ TkpRedrawWidget, /* 185 */
+#endif /* MACOSX */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ 0, /* 186 */
+#endif /* UNIX */
+#if defined(_WIN32) /* WIN */
+ 0, /* 186 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ TkpWillDrawWidget, /* 186 */
+#endif /* MACOSX */
};
static const TkIntPlatStubs tkIntPlatStubs = {
@@ -519,7 +578,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
#ifdef MAC_OSX_TK /* AQUA */
TkGenerateActivateEvents, /* 0 */
0, /* 1 */
- 0, /* 2 */
+ TkGenerateActivateEvents_, /* 2 */
TkPointerDeadWindow, /* 3 */
TkpSetCapture, /* 4 */
TkpSetCursor, /* 5 */
@@ -543,14 +602,14 @@ static const TkIntPlatStubs tkIntPlatStubs = {
TkMacOSXMakeRealWindowExist, /* 23 */
TkMacOSXMakeStippleMap, /* 24 */
TkMacOSXMenuClick, /* 25 */
- TkMacOSXRegisterOffScreenWindow, /* 26 */
+ 0, /* 26 */
TkMacOSXResizable, /* 27 */
TkMacOSXSetHelpMenuItemCount, /* 28 */
TkMacOSXSetScrollbarGrow, /* 29 */
TkMacOSXSetUpClippingRgn, /* 30 */
TkMacOSXSetUpGraphicsPort, /* 31 */
TkMacOSXUpdateClipRgn, /* 32 */
- TkMacOSXUnregisterMacWindow, /* 33 */
+ 0, /* 33 */
TkMacOSXUseMenuID, /* 34 */
TkMacOSXVisableClipRgn, /* 35 */
TkMacOSXWinBounds, /* 36 */
@@ -577,7 +636,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */
TkCreateXEventSource, /* 0 */
0, /* 1 */
- 0, /* 2 */
+ TkGenerateActivateEvents, /* 2 */
TkpCmapStressed, /* 3 */
TkpSync, /* 4 */
TkUnixContainerId, /* 5 */
@@ -589,6 +648,38 @@ static const TkIntPlatStubs tkIntPlatStubs = {
0, /* 11 */
TkpWmSetState, /* 12 */
TkpTestsendCmd, /* 13 */
+ 0, /* 14 */
+ 0, /* 15 */
+ 0, /* 16 */
+ 0, /* 17 */
+ 0, /* 18 */
+ 0, /* 19 */
+ 0, /* 20 */
+ 0, /* 21 */
+ 0, /* 22 */
+ 0, /* 23 */
+ 0, /* 24 */
+ 0, /* 25 */
+ 0, /* 26 */
+ 0, /* 27 */
+ 0, /* 28 */
+ 0, /* 29 */
+ 0, /* 30 */
+ 0, /* 31 */
+ 0, /* 32 */
+ 0, /* 33 */
+ 0, /* 34 */
+ 0, /* 35 */
+ 0, /* 36 */
+ 0, /* 37 */
+ TkpCmapStressed_, /* 38 */
+ TkpSync_, /* 39 */
+ TkUnixContainerId_, /* 40 */
+ TkUnixDoOneXEvent_, /* 41 */
+ TkUnixSetMenubar_, /* 42 */
+ TkWmCleanup_, /* 43 */
+ TkSendCleanup_, /* 44 */
+ TkpTestsendCmd_, /* 45 */
#endif /* X11 */
};
@@ -734,6 +825,27 @@ static const TkIntXlibStubs tkIntXlibStubs = {
XDrawPoints, /* 135 */
XReparentWindow, /* 136 */
XPutImage, /* 137 */
+ 0, /* 138 */
+ 0, /* 139 */
+ 0, /* 140 */
+ 0, /* 141 */
+ 0, /* 142 */
+ 0, /* 143 */
+ 0, /* 144 */
+ 0, /* 145 */
+ 0, /* 146 */
+ 0, /* 147 */
+ 0, /* 148 */
+ 0, /* 149 */
+ 0, /* 150 */
+ 0, /* 151 */
+ 0, /* 152 */
+ 0, /* 153 */
+ 0, /* 154 */
+ 0, /* 155 */
+ 0, /* 156 */
+ 0, /* 157 */
+ TkUnusedStubEntry, /* 158 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
XSetDashes, /* 0 */
@@ -842,7 +954,7 @@ static const TkIntXlibStubs tkIntXlibStubs = {
0, /* 103 */
0, /* 104 */
0, /* 105 */
- 0, /* 106 */
+ XSetClipRectangles, /* 106 */
XFlush, /* 107 */
XGrabServer, /* 108 */
XUngrabServer, /* 109 */
@@ -856,7 +968,7 @@ static const TkIntXlibStubs tkIntXlibStubs = {
0, /* 117 */
0, /* 118 */
0, /* 119 */
- 0, /* 120 */
+ XOffsetRegion, /* 120 */
0, /* 121 */
0, /* 122 */
0, /* 123 */
@@ -865,7 +977,7 @@ static const TkIntXlibStubs tkIntXlibStubs = {
0, /* 126 */
0, /* 127 */
0, /* 128 */
- 0, /* 129 */
+ XLowerWindow, /* 129 */
0, /* 130 */
0, /* 131 */
0, /* 132 */
@@ -874,6 +986,27 @@ static const TkIntXlibStubs tkIntXlibStubs = {
0, /* 135 */
0, /* 136 */
XPutImage, /* 137 */
+ 0, /* 138 */
+ 0, /* 139 */
+ 0, /* 140 */
+ 0, /* 141 */
+ 0, /* 142 */
+ 0, /* 143 */
+ XDestroyIC, /* 144 */
+ XCreatePixmapCursor, /* 145 */
+ XCreateGlyphCursor, /* 146 */
+ 0, /* 147 */
+ 0, /* 148 */
+ 0, /* 149 */
+ 0, /* 150 */
+ 0, /* 151 */
+ 0, /* 152 */
+ 0, /* 153 */
+ 0, /* 154 */
+ 0, /* 155 */
+ 0, /* 156 */
+ XkbKeycodeToKeysym, /* 157 */
+ TkUnusedStubEntry, /* 158 */
#endif /* AQUA */
};
@@ -900,6 +1033,12 @@ static const TkPlatStubs tkPlatStubs = {
TkMacOSXGetRootControl, /* 8 */
Tk_MacOSXSetupTkNotifier, /* 9 */
Tk_MacOSXIsAppInFront, /* 10 */
+ Tk_MacOSXGetTkWindow, /* 11 */
+ Tk_MacOSXGetCGContextForDrawable, /* 12 */
+ Tk_MacOSXGetNSWindowForDrawable, /* 13 */
+ 0, /* 14 */
+ 0, /* 15 */
+ TkGenWMConfigureEvent_, /* 16 */
#endif /* AQUA */
};
@@ -1187,6 +1326,13 @@ const TkStubs tkStubs = {
Tk_Interp, /* 271 */
Tk_CreateOldImageType, /* 272 */
Tk_CreateOldPhotoImageFormat, /* 273 */
+ 0, /* 274 */
+ 0, /* 275 */
+ 0, /* 276 */
+ 0, /* 277 */
+ 0, /* 278 */
+ 0, /* 279 */
+ TkUnusedStubEntry, /* 280 */
};
/* !END!: Do not edit above this line. */
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index 5c0f204d..1289f14b 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -178,9 +178,9 @@ static const Tcl_ObjType styleObjType = {
void
TkStylePkgInit(
- TkMainInfo *mainPtr) /* The application being created. */
+ TCL_UNUSED(TkMainInfo *)) /* The application being created. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->nbInit != 0) {
@@ -233,9 +233,9 @@ TkStylePkgInit(
void
TkStylePkgFree(
- TkMainInfo *mainPtr) /* The application being deleted. */
+ TCL_UNUSED(TkMainInfo *)) /* The application being deleted. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr;
@@ -264,7 +264,7 @@ TkStylePkgFree(
entryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search);
while (entryPtr != NULL) {
- enginePtr = Tcl_GetHashValue(entryPtr);
+ enginePtr = (StyleEngine *)Tcl_GetHashValue(entryPtr);
FreeStyleEngine(enginePtr);
ckfree(enginePtr);
entryPtr = Tcl_NextHashEntry(&search);
@@ -307,7 +307,7 @@ Tk_RegisterStyleEngine(
Tk_StyleEngine parent) /* The engine's parent. NULL means the default
* system engine. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int newEntry;
@@ -331,8 +331,8 @@ Tk_RegisterStyleEngine(
* Allocate and intitialize a new engine.
*/
- enginePtr = ckalloc(sizeof(StyleEngine));
- InitStyleEngine(enginePtr, Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr),
+ enginePtr = (StyleEngine *)ckalloc(sizeof(StyleEngine));
+ InitStyleEngine(enginePtr, (const char *)Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr),
(StyleEngine *) parent);
Tcl_SetHashValue(entryPtr, enginePtr);
@@ -364,7 +364,7 @@ InitStyleEngine(
StyleEngine *parentPtr) /* The engine's parent. NULL means the default
* system engine. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int elementId;
@@ -389,7 +389,7 @@ InitStyleEngine(
*/
if (tsdPtr->nbElements > 0) {
- enginePtr->elements = ckalloc(
+ enginePtr->elements = (StyledElement *)ckalloc(
sizeof(StyledElement) * tsdPtr->nbElements);
for (elementId = 0; elementId < tsdPtr->nbElements; elementId++) {
InitStyledElement(enginePtr->elements+elementId);
@@ -419,7 +419,7 @@ static void
FreeStyleEngine(
StyleEngine *enginePtr) /* The style engine to free. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int elementId;
@@ -454,7 +454,7 @@ Tk_GetStyleEngine(
const char *name) /* Name of the engine to retrieve. NULL or
* empty means the default system engine. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
@@ -467,7 +467,7 @@ Tk_GetStyleEngine(
return NULL;
}
- return Tcl_GetHashValue(entryPtr);
+ return (Tk_StyleEngine)Tcl_GetHashValue(entryPtr);
}
/*
@@ -521,7 +521,7 @@ InitElement(
static void
FreeElement(
- Element *elementPtr) /* The element to free. */
+ TCL_UNUSED(Element *)) /* The element to free. */
{
/* Nothing to do. */
}
@@ -604,12 +604,12 @@ CreateElement(
* created explicitly (being registered) or
* implicitly (by a derived element). */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr, *engineEntryPtr;
Tcl_HashSearch search;
int newEntry, elementId, genericId = -1;
- char *dot;
+ const char *dot;
StyleEngine *enginePtr;
/*
@@ -642,10 +642,10 @@ CreateElement(
* Reallocate element table.
*/
- tsdPtr->elements = ckrealloc(tsdPtr->elements,
+ tsdPtr->elements = (Element *)ckrealloc(tsdPtr->elements,
sizeof(Element) * tsdPtr->nbElements);
InitElement(tsdPtr->elements+elementId,
- Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId,
+ (const char *)Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId,
genericId, create);
/*
@@ -654,9 +654,9 @@ CreateElement(
engineEntryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search);
while (engineEntryPtr != NULL) {
- enginePtr = Tcl_GetHashValue(engineEntryPtr);
+ enginePtr = (StyleEngine *)Tcl_GetHashValue(engineEntryPtr);
- enginePtr->elements = ckrealloc(enginePtr->elements,
+ enginePtr->elements = (StyledElement *)ckrealloc(enginePtr->elements,
sizeof(StyledElement) * tsdPtr->nbElements);
InitStyledElement(enginePtr->elements+elementId);
@@ -686,11 +686,11 @@ int
Tk_GetElementId(
const char *name) /* Name of the element. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int genericId = -1;
- char *dot;
+ const char *dot;
/*
* Find the element Id.
@@ -759,7 +759,7 @@ Tk_RegisterStyledElement(
StyledElement *elementPtr;
Tk_ElementSpec *specPtr;
int nbOptions;
- register Tk_ElementOptionSpec *srcOptions, *dstOptions;
+ Tk_ElementOptionSpec *srcOptions, *dstOptions;
if (templatePtr->version != TK_STYLE_VERSION_1) {
/*
@@ -786,16 +786,16 @@ Tk_RegisterStyledElement(
elementPtr = ((StyleEngine *) engine)->elements+elementId;
- specPtr = ckalloc(sizeof(Tk_ElementSpec));
+ specPtr = (Tk_ElementSpec *)ckalloc(sizeof(Tk_ElementSpec));
specPtr->version = templatePtr->version;
- specPtr->name = ckalloc(strlen(templatePtr->name)+1);
+ specPtr->name = (char *)ckalloc(strlen(templatePtr->name)+1);
strcpy(specPtr->name, templatePtr->name);
nbOptions = 0;
for (nbOptions = 0, srcOptions = templatePtr->options;
srcOptions->name != NULL; nbOptions++, srcOptions++) {
/* empty body */
}
- specPtr->options =
+ specPtr->options = (Tk_ElementOptionSpec *)
ckalloc(sizeof(Tk_ElementOptionSpec) * (nbOptions+1));
for (srcOptions = templatePtr->options, dstOptions = specPtr->options;
/* End condition within loop */; srcOptions++, dstOptions++) {
@@ -804,7 +804,7 @@ Tk_RegisterStyledElement(
break;
}
- dstOptions->name = ckalloc(strlen(srcOptions->name)+1);
+ dstOptions->name = (char *)ckalloc(strlen(srcOptions->name)+1);
strcpy(dstOptions->name, srcOptions->name);
dstOptions->type = srcOptions->type;
}
@@ -844,7 +844,7 @@ GetStyledElement(
int elementId) /* Unique element ID */
{
StyledElement *elementPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
StyleEngine *enginePtr2;
@@ -924,7 +924,7 @@ InitWidgetSpec(
*/
widgetSpecPtr->optionsPtr =
- ckalloc(sizeof(Tk_OptionSpec *) * nbOptions);
+ (const Tk_OptionSpec **)ckalloc(sizeof(Tk_OptionSpec *) * nbOptions);
for (i = 0, elementOptionPtr = elementPtr->specPtr->options;
i < nbOptions; i++, elementOptionPtr++) {
widgetOptionPtr = TkGetOptionSpec(elementOptionPtr->name, optionTable);
@@ -1008,7 +1008,7 @@ GetWidgetSpec(
*/
i = elementPtr->nbWidgetSpecs++;
- elementPtr->widgetSpecs = ckrealloc(elementPtr->widgetSpecs,
+ elementPtr->widgetSpecs = (StyledWidgetSpec *)ckrealloc(elementPtr->widgetSpecs,
sizeof(StyledWidgetSpec) * elementPtr->nbWidgetSpecs);
widgetSpecPtr = elementPtr->widgetSpecs+i;
InitWidgetSpec(widgetSpecPtr, elementPtr, optionTable);
@@ -1229,7 +1229,7 @@ Tk_CreateStyle(
Tk_StyleEngine engine, /* The style engine. */
ClientData clientData) /* Private data passed as is to engine code. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int newEntry;
@@ -1253,8 +1253,8 @@ Tk_CreateStyle(
* Allocate and intitialize a new style.
*/
- stylePtr = ckalloc(sizeof(Style));
- InitStyle(stylePtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr),
+ stylePtr = (Style *)ckalloc(sizeof(Style));
+ InitStyle(stylePtr, (const char *)Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr),
(engine!=NULL ? (StyleEngine*) engine : tsdPtr->defaultEnginePtr),
clientData);
Tcl_SetHashValue(entryPtr, stylePtr);
@@ -1344,10 +1344,9 @@ Tk_GetStyle(
const char *name) /* Name of the style to retrieve. NULL or empty
* means the default system style. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
- Style *stylePtr;
/*
* Search for a corresponding entry in the style table.
@@ -1362,9 +1361,7 @@ Tk_GetStyle(
}
return NULL;
}
- stylePtr = Tcl_GetHashValue(entryPtr);
-
- return (Tk_Style) stylePtr;
+ return (Tk_Style)Tcl_GetHashValue(entryPtr);
}
/*
@@ -1379,7 +1376,7 @@ Tk_GetStyle(
void
Tk_FreeStyle(
- Tk_Style style)
+ TCL_UNUSED(Tk_Style))
{
}
@@ -1456,7 +1453,7 @@ Tk_GetStyleFromObj(
*/
void
Tk_FreeStyleFromObj(
- Tcl_Obj *objPtr)
+ TCL_UNUSED(Tcl_Obj *))
{
}
diff --git a/generic/tkTest.c b/generic/tkTest.c
index a8929b92..1fa821c0 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -31,9 +31,9 @@
#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
-#define LOG_DISPLAY TkTestLogDisplay()
+#define LOG_DISPLAY(drawable) TkTestLogDisplay(drawable)
#else
-#define LOG_DISPLAY 1
+#define LOG_DISPLAY(drawable) 1
#endif
#ifdef __UNIX__
@@ -50,17 +50,17 @@
#define TCL_STORAGE_CLASS DLLEXPORT
EXTERN int Tktest_Init(Tcl_Interp *interp);
/*
- * The following data structure represents the master for a test image:
+ * The following data structure represents the model for a test image:
*/
-typedef struct TImageMaster {
- Tk_ImageMaster master; /* Tk's token for image master. */
+typedef struct TImageModel {
+ Tk_ImageModel model; /* Tk's token for image model. */
Tcl_Interp *interp; /* Interpreter for application. */
int width, height; /* Dimensions of image. */
char *imageName; /* Name of image (malloc-ed). */
char *varName; /* Name of variable in which to log events for
* image (malloc-ed). */
-} TImageMaster;
+} TImageModel;
/*
* The following data structure represents a particular use of a particular
@@ -68,9 +68,11 @@ typedef struct TImageMaster {
*/
typedef struct TImageInstance {
- TImageMaster *masterPtr; /* Pointer to master for image. */
+ TImageModel *modelPtr; /* Pointer to model for image. */
XColor *fg; /* Foreground color for drawing in image. */
GC gc; /* Graphics context for drawing in image. */
+ Bool displayFailed; /* macOS display attempted out of drawRect. */
+ char buffer[200 + TCL_INTEGER_SPACE * 6]; /* message to log on display. */
} TImageInstance;
/*
@@ -79,7 +81,7 @@ typedef struct TImageInstance {
static int ImageCreate(Tcl_Interp *interp,
const char *name, int argc, Tcl_Obj *const objv[],
- const Tk_ImageType *typePtr, Tk_ImageMaster master,
+ const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
static void ImageDisplay(ClientData clientData,
@@ -242,7 +244,7 @@ Tktest_Init(
*/
if (Tcl_PkgProvideEx(interp, "Tktest", TK_PATCH_LEVEL, NULL) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
Tcl_CreateObjCommand(interp, "square", SquareObjCmd, NULL, NULL);
@@ -322,10 +324,9 @@ Tktest_Init(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestbitmapObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -357,10 +358,9 @@ TestbitmapObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestborderObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(ClientData), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -392,10 +392,9 @@ TestborderObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestcolorObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -426,10 +425,9 @@ TestcolorObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestcursorObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -455,19 +453,18 @@ TestcursorObjCmd(
* A standard Tcl result.
*
* Side effects:
- * All the intepreters created by previous calls to "testnewapp" get
+ * All the interpreters created by previous calls to "testnewapp" get
* deleted.
*
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestdeleteappsObjCmd(
- ClientData clientData, /* Main window for application. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[]) /* Argument strings. */
+ TCL_UNUSED(void *), /* Main window for application. */
+ TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */
+ TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Argument strings. */
{
NewApp *nextPtr;
@@ -498,7 +495,6 @@ TestdeleteappsObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestobjconfigObjCmd(
ClientData clientData, /* Main window for application. */
@@ -637,7 +633,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
- Tk_Window tkwin;
optionTable = Tk_CreateOptionTable(interp, typesSpecs);
tables[index] = optionTable;
@@ -648,7 +643,7 @@ TestobjconfigObjCmd(
}
Tk_SetClass(tkwin, "Test");
- recordPtr = ckalloc(sizeof(TypesRecord));
+ recordPtr = (TypesRecord *)ckalloc(sizeof(TypesRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -693,7 +688,6 @@ TestobjconfigObjCmd(
case CHAIN1: {
ExtensionWidgetRecord *recordPtr;
- Tk_Window tkwin;
Tk_OptionTable optionTable;
tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
@@ -705,7 +699,7 @@ TestobjconfigObjCmd(
optionTable = Tk_CreateOptionTable(interp, baseSpecs);
tables[index] = optionTable;
- recordPtr = ckalloc(sizeof(ExtensionWidgetRecord));
+ recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -746,7 +740,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0,
(ClientData) baseSpecs, 0}
};
- Tk_Window tkwin;
Tk_OptionTable optionTable;
tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData,
@@ -758,7 +751,7 @@ TestobjconfigObjCmd(
optionTable = Tk_CreateOptionTable(interp, extensionSpecs);
tables[index] = optionTable;
- recordPtr = ckalloc(sizeof(ExtensionWidgetRecord));
+ recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -915,7 +908,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
- Tk_Window tkwin;
optionTable = Tk_CreateOptionTable(interp, internalSpecs);
tables[index] = optionTable;
@@ -1060,17 +1052,17 @@ TestobjconfigObjCmd(
}
case TWO_WINDOWS: {
- typedef struct SlaveRecord {
+ typedef struct ContentRecord {
TrivialCommandHeader header;
Tcl_Obj *windowPtr;
- } SlaveRecord;
- SlaveRecord *recordPtr;
- static const Tk_OptionSpec slaveSpecs[] = {
+ } ContentRecord;
+ ContentRecord *recordPtr;
+ static const Tk_OptionSpec contentSpecs[] = {
{TK_OPTION_WINDOW, "-window", "window", "Window", ".bar",
- Tk_Offset(SlaveRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0},
+ Tk_Offset(ContentRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
- Tk_Window tkwin = Tk_CreateWindowFromPath(interp,
+ tkwin = Tk_CreateWindowFromPath(interp,
(Tk_Window) clientData, Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
@@ -1078,10 +1070,10 @@ TestobjconfigObjCmd(
}
Tk_SetClass(tkwin, "Test");
- recordPtr = ckalloc(sizeof(SlaveRecord));
+ recordPtr = (ContentRecord *)ckalloc(sizeof(ContentRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
- slaveSpecs);
+ contentSpecs);
tables[index] = recordPtr->header.optionTable;
recordPtr->header.tkwin = tkwin;
recordPtr->windowPtr = NULL;
@@ -1131,7 +1123,6 @@ TestobjconfigObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TrivialConfigObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1243,7 +1234,7 @@ static void
TrivialCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData;
+ TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData;
Tk_Window tkwin = headerPtr->tkwin;
if (tkwin != NULL) {
@@ -1255,8 +1246,8 @@ TrivialCmdDeletedProc(
* here.
*/
- Tk_FreeConfigOptions((char *) clientData,
- headerPtr->optionTable, (Tk_Window) NULL);
+ Tk_FreeConfigOptions((char *)clientData,
+ headerPtr->optionTable, NULL);
Tcl_EventuallyFree(clientData, TCL_DYNAMIC);
}
}
@@ -1282,11 +1273,11 @@ TrivialEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData;
+ TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData;
if (eventPtr->type == DestroyNotify) {
if (headerPtr->tkwin != NULL) {
- Tk_FreeConfigOptions((char *) clientData,
+ Tk_FreeConfigOptions((char *)clientData,
headerPtr->optionTable, headerPtr->tkwin);
headerPtr->optionTable = NULL;
headerPtr->tkwin = NULL;
@@ -1314,7 +1305,6 @@ TrivialEventProc(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestfontObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1328,7 +1318,7 @@ TestfontObjCmd(
Tk_Window tkwin;
Tk_Font tkfont;
- tkwin = (Tk_Window) clientData;
+ tkwin = (Tk_Window)clientData;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "option fontName");
@@ -1374,7 +1364,6 @@ TestfontObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ImageCreate(
Tcl_Interp *interp, /* Interpreter for application containing
@@ -1383,13 +1372,13 @@ ImageCreate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument strings for options (doesn't
* include image name or type). */
- const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ TCL_UNUSED(const Tk_ImageType *), /* Pointer to our type record (not used). */
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- TImageMaster *timPtr;
+ TImageModel *timPtr;
const char *varName;
int i;
@@ -1408,18 +1397,18 @@ ImageCreate(
varName = Tcl_GetString(objv[i+1]);
}
- timPtr = ckalloc(sizeof(TImageMaster));
- timPtr->master = master;
+ timPtr = (TImageModel *)ckalloc(sizeof(TImageModel));
+ timPtr->model = model;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
- timPtr->imageName = ckalloc(strlen(name) + 1);
+ timPtr->imageName = (char *)ckalloc(strlen(name) + 1);
strcpy(timPtr->imageName, name);
- timPtr->varName = ckalloc(strlen(varName) + 1);
+ timPtr->varName = (char *)ckalloc(strlen(varName) + 1);
strcpy(timPtr->varName, varName);
Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL);
*clientDataPtr = timPtr;
- Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15);
+ Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15);
return TCL_OK;
}
@@ -1440,7 +1429,6 @@ ImageCreate(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ImageObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1448,7 +1436,7 @@ ImageObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TImageMaster *timPtr = (TImageMaster *) clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
int x, y, width, height;
if (objc < 2) {
@@ -1469,7 +1457,7 @@ ImageObjCmd(
|| (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) {
return TCL_ERROR;
}
- Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width,
+ Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width,
timPtr->height);
} else {
Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]),
@@ -1501,9 +1489,9 @@ static ClientData
ImageGet(
Tk_Window tkwin, /* Token for window in which image will be
* used. */
- ClientData clientData) /* Pointer to TImageMaster for image. */
+ ClientData clientData) /* Pointer to TImageModel for image. */
{
- TImageMaster *timPtr = (TImageMaster *) clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -1512,11 +1500,12 @@ ImageGet(
Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer,
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
- instPtr = ckalloc(sizeof(TImageInstance));
- instPtr->masterPtr = timPtr;
+ instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance));
+ instPtr->modelPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
+ instPtr->displayFailed = False;
return instPtr;
}
@@ -1550,48 +1539,57 @@ ImageDisplay(
/* Coordinates in drawable corresponding to
* imageX and imageY. */
{
- TImageInstance *instPtr = (TImageInstance *) clientData;
- char buffer[200 + TCL_INTEGER_SPACE * 6];
+ TImageInstance *instPtr = (TImageInstance *)clientData;
/*
* The purpose of the test image type is to track the calls to an image
- * display proc and record the parameters passed in each call. On macOS
- * a display proc must be run inside of the drawRect method of an NSView
- * in order for the graphics operations to have any effect. To deal with
+ * display proc and record the parameters passed in each call. On macOS a
+ * display proc must be run inside of the drawRect method of an NSView in
+ * order for the graphics operations to have any effect. To deal with
* this, whenever a display proc is called outside of any drawRect method
- * it schedules a redraw of the NSView by calling [view setNeedsDisplay:YES].
- * This will trigger a later call to the view's drawRect method which will
- * run the display proc a second time.
+ * it schedules a redraw of the NSView.
*
- * This complicates testing, since it can result in more calls to the display
- * proc than are expected by the test. It can also result in an inconsistent
- * number of calls unless the test waits until the call to drawRect actually
- * occurs before validating its results.
- *
- * In an attempt to work around this, this display proc only logs those
- * calls which occur within a drawRect method. This means that tests must
- * be written so as to ensure that the drawRect method is run before
- * results are validated. In practice it usually suffices to run update
- * idletasks (to run the display proc the first time) followed by update
- * (to run the display proc in drawRect).
- *
- * This also has the consequence that the image changed command will log
- * different results on Aqua than on other systems, because when the image
- * is redisplayed in the drawRect method the entire image will be drawn,
- * not just the changed portion. Tests must account for this.
+ * In an attempt to work around this, each image instance maintains it own
+ * copy of the log message which gets written on the first call to the
+ * display proc. This usually means that the message created on macOS is
+ * the same as that created on other platforms. However it is possible
+ * for the messages to differ for other reasons, namely differences in
+ * how damage regions are computed.
*/
- if (LOG_DISPLAY) {
- sprintf(buffer, "%s display %d %d %d %d",
- instPtr->masterPtr->imageName, imageX, imageY, width, height);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
- NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ if (LOG_DISPLAY(drawable)) {
+ if (instPtr->displayFailed == False) {
+
+ /*
+ * Drawing is possible on the first call to DisplayImage.
+ * Log the message.
+ */
+
+ sprintf(instPtr->buffer, "%s display %d %d %d %d",
+ instPtr->modelPtr->imageName, imageX, imageY, width, height);
+ }
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName,
+ NULL, instPtr->buffer,
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ instPtr->displayFailed = False;
+ } else {
+
+ /*
+ * Drawing is not possible on the first call to DisplayImage.
+ * Save the message, but do not log it until the actual display.
+ */
+
+ if (instPtr->displayFailed == False) {
+ sprintf(instPtr->buffer, "%s display %d %d %d %d",
+ instPtr->modelPtr->imageName, imageX, imageY, width, height);
+ }
+ instPtr->displayFailed = True;
}
- if (width > (instPtr->masterPtr->width - imageX)) {
- width = instPtr->masterPtr->width - imageX;
+ if (width > (instPtr->modelPtr->width - imageX)) {
+ width = instPtr->modelPtr->width - imageX;
}
- if (height > (instPtr->masterPtr->height - imageY)) {
- height = instPtr->masterPtr->height - imageY;
+ if (height > (instPtr->modelPtr->height - imageY)) {
+ height = instPtr->modelPtr->height - imageY;
}
XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY,
@@ -1625,11 +1623,11 @@ ImageFree(
ClientData clientData, /* Pointer to TImageInstance for instance. */
Display *display) /* Display where image was to be drawn. */
{
- TImageInstance *instPtr = (TImageInstance *) clientData;
+ TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200];
- sprintf(buffer, "%s free", instPtr->masterPtr->imageName);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
+ sprintf(buffer, "%s free", instPtr->modelPtr->imageName);
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL,
buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
Tk_FreeColor(instPtr->fg);
Tk_FreeGC(display, instPtr->gc);
@@ -1655,11 +1653,11 @@ ImageFree(
static void
ImageDelete(
- ClientData clientData) /* Pointer to TImageMaster for image. When
+ ClientData clientData) /* Pointer to TImageModel for image. When
* this function is called, no more instances
* exist. */
{
- TImageMaster *timPtr = (TImageMaster *) clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
char buffer[100];
sprintf(buffer, "%s delete", timPtr->imageName);
@@ -1690,7 +1688,6 @@ ImageDelete(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestmakeexistObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1698,7 +1695,7 @@ TestmakeexistObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- Tk_Window mainWin = (Tk_Window) clientData;
+ Tk_Window mainWin = (Tk_Window)clientData;
int i;
Tk_Window tkwin;
@@ -1731,7 +1728,6 @@ TestmakeexistObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
#if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__))
static int
TestmenubarObjCmd(
@@ -1741,7 +1737,7 @@ TestmenubarObjCmd(
Tcl_Obj *const objv[]) /* Argument strings. */
{
#ifdef __UNIX__
- Tk_Window mainWin = (Tk_Window) clientData;
+ Tk_Window mainWin = (Tk_Window)clientData;
Tk_Window tkwin, menubar;
if (objc < 2) {
@@ -1801,7 +1797,7 @@ TestmenubarObjCmd(
#if defined(_WIN32)
static int
TestmetricsObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
@@ -1846,7 +1842,6 @@ TestmetricsObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestpropObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1854,7 +1849,7 @@ TestpropObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- Tk_Window mainWin = (Tk_Window) clientData;
+ Tk_Window mainWin = (Tk_Window)clientData;
int result, actualFormat;
unsigned long bytesAfter, length, value;
Atom actualType, propName;
@@ -1925,7 +1920,6 @@ TestpropObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestwrapperObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1941,7 +1935,7 @@ TestwrapperObjCmd(
return TCL_ERROR;
}
- tkwin = (Tk_Window) clientData;
+ tkwin = (Tk_Window)clientData;
winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[1]), tkwin);
if (winPtr == NULL) {
return TCL_ERROR;
@@ -1978,17 +1972,16 @@ TestwrapperObjCmd(
* CustomOptionSet Sets option value to new setting.
* CustomOptionGet Creates a new Tcl_Obj.
* CustomOptionRestore Resets option value to original value.
- * CustomOptionFree Free storage for internal rep of
- * option.
+ * CustomOptionFree Free storage for internal rep of option.
*
*----------------------------------------------------------------------
*/
static int
CustomOptionSet(
- ClientData clientData,
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
- Tk_Window tkwin,
+ TCL_UNUSED(Tk_Window),
Tcl_Obj **value,
char *recordPtr,
int internalOffset,
@@ -2033,7 +2026,7 @@ CustomOptionSet(
if (internalPtr != NULL) {
if (*value != NULL) {
string = Tcl_GetString(*value);
- newStr = ckalloc((*value)->length + 1);
+ newStr = (char *)ckalloc((*value)->length + 1);
strcpy(newStr, string);
} else {
newStr = NULL;
@@ -2047,8 +2040,8 @@ CustomOptionSet(
static Tcl_Obj *
CustomOptionGet(
- ClientData clientData,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr,
int internalOffset)
{
diff --git a/generic/tkText.c b/generic/tkText.c
index 7c62621b..c41fc674 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -14,9 +14,9 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
#include "tkUndo.h"
+#include "default.h"
#if defined(MAC_OSX_TK)
#define Style TkStyle
@@ -461,7 +461,7 @@ Tk_TextObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -502,7 +502,7 @@ CreateWidget(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkText *textPtr;
+ TkText *textPtr;
Tk_OptionTable optionTable;
TkTextIndex startIndex;
Tk_Window newWin;
@@ -523,7 +523,7 @@ CreateWidget(
* and 'insert', 'current' mark pointers are all NULL to start.
*/
- textPtr = ckalloc(sizeof(TkText));
+ textPtr = (TkText *)ckalloc(sizeof(TkText));
memset(textPtr, 0, sizeof(TkText));
textPtr->tkwin = newWin;
@@ -534,7 +534,7 @@ CreateWidget(
textPtr, TextCmdDeletedProc);
if (sharedPtr == NULL) {
- sharedPtr = ckalloc(sizeof(TkSharedText));
+ sharedPtr = (TkSharedText *)ckalloc(sizeof(TkSharedText));
memset(sharedPtr, 0, sizeof(TkSharedText));
sharedPtr->refCount = 0;
@@ -632,7 +632,7 @@ CreateWidget(
*/
textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL);
- textPtr->selTagPtr->reliefString =
+ textPtr->selTagPtr->reliefString = (char *)
ckalloc(sizeof(DEF_TEXT_SELECT_RELIEF));
strcpy(textPtr->selTagPtr->reliefString, DEF_TEXT_SELECT_RELIEF);
Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief);
@@ -699,9 +699,9 @@ TextWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
int result = TCL_OK;
- int index;
+ int idx;
static const char *const optionStrings[] = {
"bbox", "cget", "compare", "configure", "count", "debug", "delete",
@@ -724,12 +724,12 @@ TextWidgetObjCmd(
}
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
- sizeof(char *), "option", 0, &index) != TCL_OK) {
+ sizeof(char *), "option", 0, &idx) != TCL_OK) {
return TCL_ERROR;
}
textPtr->refCount++;
- switch ((enum options) index) {
+ switch ((enum options) idx) {
case TEXT_BBOX: {
int x, y, width, height;
const TkTextIndex *indexPtr;
@@ -864,11 +864,10 @@ TextWidgetObjCmd(
for (i = 2; i < objc-2; i++) {
int value;
- size_t length;
- const char *option = Tcl_GetString(objv[i]);
+ int length;
+ const char *option = Tcl_GetStringFromObj(objv[i], &length);
char c;
- length = objv[i]->length;
if (length < 2 || option[0] != '-') {
goto badOption;
}
@@ -1126,7 +1125,7 @@ TextWidgetObjCmd(
objc -= 2;
objv += 2;
- indices = ckalloc((objc + 1) * sizeof(TkTextIndex));
+ indices = (TkTextIndex *)ckalloc((objc + 1) * sizeof(TkTextIndex));
/*
* First pass verifies that all indices are valid.
@@ -1154,8 +1153,8 @@ TextWidgetObjCmd(
COUNT_INDICES);
objc++;
}
- useIdx = ckalloc(objc);
- memset(useIdx, 0, (size_t) objc);
+ useIdx = (char *)ckalloc(objc);
+ memset(useIdx, 0, objc);
/*
* Do a decreasing order sort so that we delete the end ranges
@@ -1260,7 +1259,7 @@ TextWidgetObjCmd(
Tcl_Obj *objPtr = NULL;
int i, found = 0, visible = 0;
const char *name;
- size_t length;
+ int length;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -1276,14 +1275,12 @@ TextWidgetObjCmd(
i = 2;
if (objc > 3) {
- name = Tcl_GetString(objv[i]);
- length = objv[i]->length;
+ name = Tcl_GetStringFromObj(objv[i], &length);
if (length > 1 && name[0] == '-') {
if (strncmp("-displaychars", name, length) == 0) {
i++;
visible = 1;
- name = Tcl_GetString(objv[i]);
- length = objv[i]->length;
+ name = Tcl_GetStringFromObj(objv[i], &length);
}
if ((i < objc-1) && (length == 2) && !strcmp("--", name)) {
i++;
@@ -1610,7 +1607,7 @@ SharedTextObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkSharedText *sharedPtr = clientData;
+ TkSharedText *sharedPtr = (TkSharedText *)clientData;
int result = TCL_OK;
int index;
@@ -1980,7 +1977,7 @@ DestroyText(
for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->windowTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
TkTextEmbWindowClient *loop;
- TkTextSegment *ewPtr = Tcl_GetHashValue(hPtr);
+ TkTextSegment *ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
loop = ewPtr->body.ew.clients;
if (loop->textPtr == textPtr) {
@@ -2012,7 +2009,7 @@ DestroyText(
for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- tagPtr = Tcl_GetHashValue(hPtr);
+ tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr);
/*
* No need to use 'TkTextDeleteTag' since we've already removed
@@ -2078,7 +2075,7 @@ DestroyText(
static int
ConfigureText(
Tcl_Interp *interp, /* Used for error reporting. */
- register TkText *textPtr, /* Information about widget; may or may not
+ TkText *textPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2381,7 +2378,7 @@ static void
TextWorldChangedCallback(
ClientData instanceData) /* Information about widget. */
{
- TkText *textPtr = instanceData;
+ TkText *textPtr = (TkText *)instanceData;
TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY);
}
@@ -2470,9 +2467,9 @@ TextWorldChanged(
static void
TextEventProc(
ClientData clientData, /* Information about window. */
- register XEvent *eventPtr) /* Information about event. */
+ XEvent *eventPtr) /* Information about event. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TkTextIndex index, index2;
if (eventPtr->type == Expose) {
@@ -2581,7 +2578,7 @@ static void
TextCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
Tk_Window tkwin = textPtr->tkwin;
/*
@@ -2634,14 +2631,13 @@ InsertChars(
int viewUpdate) /* Update the view if set. */
{
int lineIndex;
- size_t length;
+ int length;
TkText *tPtr;
int *lineAndByteIndex;
int resetViewCount;
int pixels[2*PIXEL_CLIENTS];
- const char *string = Tcl_GetString(stringPtr);
+ const char *string = Tcl_GetStringFromObj(stringPtr, &length);
- length = stringPtr->length;
if (sharedTextPtr == NULL) {
sharedTextPtr = textPtr->sharedTextPtr;
}
@@ -2667,7 +2663,7 @@ InsertChars(
resetViewCount = 0;
if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
- lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
+ lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
} else {
lineAndByteIndex = pixels;
}
@@ -2916,7 +2912,7 @@ TextUndoRedoCallback(
Tcl_Obj *objPtr) /* Arguments of a command to be handled by the
* shared text data structure. */
{
- TkSharedText *sharedPtr = clientData;
+ TkSharedText *sharedPtr = (TkSharedText *)clientData;
int res, objc;
Tcl_Obj **objv;
TkText *textPtr;
@@ -3128,7 +3124,7 @@ DeleteIndexRange(
line2 = TkBTreeLinesTo(textPtr, index2.linePtr);
if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) {
TkTextTag **arrayPtr;
- int arraySize, i;
+ int arraySize;
TkTextIndex oldIndex2;
oldIndex2 = index2;
@@ -3155,9 +3151,7 @@ DeleteIndexRange(
for (i=0, hPtr=Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search);
hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
- TkTextTag *tagPtr = Tcl_GetHashValue(hPtr);
-
- TkBTreeTag(&index1, &index2, tagPtr, 0);
+ TkBTreeTag(&index1, &index2, (TkTextTag *)Tcl_GetHashValue(hPtr), 0);
}
/*
@@ -3191,7 +3185,7 @@ DeleteIndexRange(
resetViewCount = 0;
if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
- lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
+ lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
} else {
lineAndByteIndex = pixels;
}
@@ -3380,7 +3374,7 @@ TextFetchSelection(
* not including terminating NULL
* character. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TkTextIndex eof;
int count, chunkSize, offsetInSeg;
TkTextSearch search;
@@ -3464,7 +3458,7 @@ TextFetchSelection(
if ((segPtr->typePtr == &tkTextCharType)
&& !TkTextIsElided(textPtr, &textPtr->selIndex, NULL)) {
memcpy(buffer, segPtr->body.chars + offsetInSeg,
- (size_t) chunkSize);
+ chunkSize);
buffer += chunkSize;
maxBytes -= chunkSize;
count += chunkSize;
@@ -3511,7 +3505,7 @@ void
TkTextLostSelection(
ClientData clientData) /* Information about text widget. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
if (TkpAlwaysShowSelection(textPtr->tkwin)) {
TkTextIndex start, end;
@@ -3596,7 +3590,7 @@ static void
TextBlinkProc(
ClientData clientData) /* Pointer to record describing text. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TkTextIndex index;
int x, y, w, h, charWidth;
@@ -3976,7 +3970,7 @@ TextSearchGetLineIndex(
{
const TkTextIndex *indexPtr;
int line;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr);
if (indexPtr == NULL) {
@@ -4041,7 +4035,7 @@ TextSearchIndexInLine(
TkTextSegment *segPtr;
TkTextIndex curIndex;
int index, leftToScan;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
index = 0;
curIndex.tree = textPtr->sharedTextPtr->tree;
@@ -4111,7 +4105,7 @@ TextSearchAddNextLine(
TkTextLine *linePtr, *thisLinePtr;
TkTextIndex curIndex;
TkTextSegment *segPtr;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
int nothingYet = 1;
/*
@@ -4233,7 +4227,7 @@ TextSearchFoundMatch(
TkTextIndex curIndex, foundIndex;
TkTextSegment *segPtr;
TkTextLine *linePtr;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
if (lineNum == searchSpecPtr->stopLine) {
/*
@@ -4284,7 +4278,7 @@ TextSearchFoundMatch(
* reached the end of the match or we have reached the end of the line.
*/
- linePtr = clientData;
+ linePtr = (TkTextLine *)clientData;
if (linePtr == NULL) {
linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
lineNum);
@@ -4494,8 +4488,8 @@ TkTextGetTabs(
* Parse the elements of the list one at a time to fill in the array.
*/
- tabArrayPtr = ckalloc(sizeof(TkTextTabArray)
- + (count - 1) * sizeof(TkTextTab));
+ tabArrayPtr = (TkTextTabArray *)ckalloc(Tk_Offset(TkTextTabArray, tabs)
+ + count * sizeof(TkTextTab));
tabArrayPtr->numTabs = 0;
prevStop = 0.0;
lastStop = 0.0;
@@ -4621,7 +4615,7 @@ TkTextGetTabs(
static int
TextDumpCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -4708,14 +4702,13 @@ TextDumpCmd(
if (objc == arg) {
TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES);
} else {
- size_t length;
+ int length;
const char *str;
if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) {
return TCL_ERROR;
}
- str = Tcl_GetString(objv[arg]);
- length = objv[arg]->length;
+ str = Tcl_GetStringFromObj(objv[arg], &length);
if (strncmp(str, "end", length) == 0) {
atEnd = 1;
}
@@ -4859,7 +4852,7 @@ DumpLine(
*/
int length = last - first;
- char *range = ckalloc(length + 1);
+ char *range = (char *)ckalloc(length + 1);
memcpy(range, segPtr->body.chars + first, length);
range[length] = '\0';
@@ -4890,7 +4883,7 @@ DumpLine(
name = NULL;
lineChanged = 0;
} else {
- name = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ name = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
markPtr->hPtr);
}
if (name != NULL) {
@@ -5016,7 +5009,7 @@ DumpSegment(
const char *value, /* Segment value. */
Tcl_Obj *command, /* Script callback. */
const TkTextIndex *index, /* index with line/byte position info. */
- int what) /* Look for TK_DUMP_INDEX bit. */
+ TCL_UNUSED(int)) /* Look for TK_DUMP_INDEX bit. */
{
char buffer[TK_POS_CHARS];
Tcl_Obj *values[3], *tuple;
@@ -5039,7 +5032,7 @@ DumpSegment(
Tcl_DStringAppend(&buf, Tcl_GetString(command), -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, Tcl_GetString(tuple), -1);
- code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
@@ -5321,11 +5314,6 @@ TextEditCmd(
* appending several thousand lines, we could attempt to pre-allocate a
* larger space).
*
- * Also the result is built up as a utf-8 string, but, if we knew we
- * wanted it as Unicode, we could potentially save a huge conversion by
- * building it up as Unicode directly. This could be as simple as
- * replacing Tcl_NewObj by Tcl_NewUnicodeObj.
- *
* Results:
* Tcl_Obj of string type containing the specified text. If the
* visibleOnly flag is set to 1, then only those characters which are not
@@ -5523,7 +5511,7 @@ void
TkTextRunAfterSyncCmd(
ClientData clientData) /* Information about text widget. */
{
- register TkText *textPtr = (TkText *) clientData;
+ TkText *textPtr = (TkText *)clientData;
int code;
if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
@@ -5597,7 +5585,7 @@ SearchPerform(
if (toPtr != NULL) {
const TkTextIndex *indexToPtr, *indexFromPtr;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr);
if (indexToPtr == NULL) {
@@ -5678,7 +5666,8 @@ SearchCore(
* they are Unicode char offsets.
*/
- int firstOffset, lastOffset, matchOffset, matchLength;
+ int firstOffset, lastOffset;
+ int matchOffset, matchLength;
int passes;
int lineNum = searchSpecPtr->startLine;
int code = TCL_OK;
@@ -5751,8 +5740,7 @@ SearchCore(
* it has dual purpose.
*/
- pattern = Tcl_GetString(patObj);
- matchLength = patObj->length;
+ pattern = Tcl_GetStringFromObj(patObj, &matchLength);
nl = strchr(pattern, '\n');
/*
@@ -5921,7 +5909,7 @@ SearchCore(
}
while (p >= startOfLine + firstOffset) {
if (matchLength == 0 || (p[0] == c && !strncmp(
- p, pattern, (size_t) matchLength))) {
+ p, pattern, matchLength))) {
goto backwardsMatch;
}
p--;
@@ -5950,7 +5938,7 @@ SearchCore(
*/
p = startOfLine + lastOffset - firstNewLine - 1;
- if (strncmp(p, pattern, (unsigned) firstNewLine + 1)) {
+ if (strncmp(p, pattern, firstNewLine + 1)) {
/*
* No match.
*/
@@ -6016,7 +6004,7 @@ SearchCore(
* result.
*/
- if (strncmp(p,pattern,(size_t)matchLength)) {
+ if (strncmp(p, pattern, matchLength)) {
p = NULL;
}
break;
@@ -6264,8 +6252,8 @@ SearchCore(
*/
if ((match &&
- firstOffset+info.matches[0].end != lastTotal &&
- firstOffset+info.matches[0].end < prevFullLine)
+ firstOffset + info.matches[0].end != lastTotal &&
+ firstOffset + info.matches[0].end < prevFullLine)
|| info.extendStart < 0) {
break;
}
@@ -6334,8 +6322,8 @@ SearchCore(
* Possible overlap or enclosure.
*/
- if (thisOffset-lastNonOverlap >=
- lastBackwardsMatchOffset+matchLength){
+ if (thisOffset - lastNonOverlap >=
+ lastBackwardsMatchOffset + matchLength){
/*
* Totally encloses previous match, so
* forget the previous match.
@@ -6439,7 +6427,7 @@ SearchCore(
* matches on the heap.
*/
- int *newArray =
+ int *newArray = (int *)
ckalloc(4 * matchNum * sizeof(int));
memcpy(newArray, storeMatch, matchNum*sizeof(int));
memcpy(newArray + 2*matchNum, storeLength,
@@ -6700,8 +6688,8 @@ SearchCore(
static Tcl_Obj *
GetLineStartEnd(
- ClientData clientData,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr, /* Pointer to widget record. */
int internalOffset) /* Offset within *recordPtr containing the
* line value. */
@@ -6735,9 +6723,9 @@ GetLineStartEnd(
static int
SetLineStartEnd(
- ClientData clientData,
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interp; may be used for errors. */
- Tk_Window tkwin, /* Window for which option is being set. */
+ TCL_UNUSED(Tk_Window), /* Window for which option is being set. */
Tcl_Obj **value, /* Pointer to the pointer to the value object.
* We use a pointer to the pointer because we
* may need to return a value (NULL). */
@@ -6794,8 +6782,8 @@ SetLineStartEnd(
static void
RestoreLineStartEnd(
- ClientData clientData,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *internalPtr, /* Pointer to storage for value. */
char *oldInternalPtr) /* Pointer to old value. */
{
@@ -6853,7 +6841,7 @@ ObjectIsEmpty(
int
TkpTesttextCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
@@ -6872,7 +6860,7 @@ TkpTesttextCmd(
if (Tcl_GetCommandInfo(interp, Tcl_GetString(objv[1]), &info) == 0) {
return TCL_ERROR;
}
- textPtr = info.objClientData;
+ textPtr = (TkText *)info.objClientData;
len = strlen(Tcl_GetString(objv[2]));
if (strncmp(Tcl_GetString(objv[2]), "byteindex", len) == 0) {
if (objc != 5) {
diff --git a/generic/tkText.h b/generic/tkText.h
index a8a17da0..9a9495a3 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -168,7 +168,7 @@ typedef struct TkTextSegment {
int size; /* Size of this segment (# of bytes of index
* space it occupies). */
union {
- char chars[2]; /* Characters that make up character info.
+ char chars[TKFLEXARRAY]; /* Characters that make up character info.
* Actual length varies to hold as many
* characters as needed.*/
TkTextToggle toggle; /* Information about tag toggle. */
@@ -489,7 +489,7 @@ typedef struct TkTextTabArray {
double tabIncrement; /* The accurate fractional pixel increment
* between interpolated tabs we have to create
* when we exceed numTabs. */
- TkTextTab tabs[1]; /* Array of tabs. The actual size will be
+ TkTextTab tabs[TKFLEXARRAY];/* Array of tabs. The actual size will be
* numTabs. THIS FIELD MUST BE THE LAST IN THE
* STRUCTURE. */
} TkTextTabArray;
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index 81e31dce..7832992b 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -140,9 +140,9 @@ int tkBTreeDebug = 0;
* Macros that determine how much space to allocate for new segments:
*/
-#define CSEG_SIZE(chars) ((unsigned) (Tk_Offset(TkTextSegment, body) \
+#define CSEG_SIZE(chars) ((unsigned)(Tk_Offset(TkTextSegment, body) \
+ 1 + (chars)))
-#define TSEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \
+#define TSEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
+ sizeof(TkTextToggle)))
/*
@@ -261,10 +261,10 @@ TkTextBTree
TkBTreeCreate(
TkSharedText *sharedTextPtr)
{
- register BTree *treePtr;
- register Node *rootPtr;
- register TkTextLine *linePtr, *linePtr2;
- register TkTextSegment *segPtr;
+ BTree *treePtr;
+ Node *rootPtr;
+ TkTextLine *linePtr, *linePtr2;
+ TkTextSegment *segPtr;
/*
* The tree will initially have two empty lines. The second line isn't
@@ -273,9 +273,9 @@ TkBTreeCreate(
* of the tree.
*/
- rootPtr = ckalloc(sizeof(Node));
- linePtr = ckalloc(sizeof(TkTextLine));
- linePtr2 = ckalloc(sizeof(TkTextLine));
+ rootPtr = (Node *)ckalloc(sizeof(Node));
+ linePtr = (TkTextLine *)ckalloc(sizeof(TkTextLine));
+ linePtr2 = (TkTextLine *)ckalloc(sizeof(TkTextLine));
rootPtr->parentPtr = NULL;
rootPtr->nextPtr = NULL;
@@ -296,7 +296,7 @@ TkBTreeCreate(
linePtr->parentPtr = rootPtr;
linePtr->nextPtr = linePtr2;
- segPtr = ckalloc(CSEG_SIZE(1));
+ segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(1));
linePtr->segPtr = segPtr;
segPtr->typePtr = &tkTextCharType;
segPtr->nextPtr = NULL;
@@ -306,7 +306,7 @@ TkBTreeCreate(
linePtr2->parentPtr = rootPtr;
linePtr2->nextPtr = NULL;
- segPtr = ckalloc(CSEG_SIZE(1));
+ segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(1));
linePtr2->segPtr = segPtr;
segPtr->typePtr = &tkTextCharType;
segPtr->nextPtr = NULL;
@@ -314,7 +314,7 @@ TkBTreeCreate(
segPtr->body.chars[0] = '\n';
segPtr->body.chars[1] = 0;
- treePtr = ckalloc(sizeof(BTree));
+ treePtr = (BTree *)ckalloc(sizeof(BTree));
treePtr->sharedTextPtr = sharedTextPtr;
treePtr->rootPtr = rootPtr;
treePtr->clients = 0;
@@ -366,7 +366,7 @@ TkBTreeAddClient(
int defaultHeight) /* Default line height for the new client, or
* -1 if no pixel heights are to be kept. */
{
- register BTree *treePtr = (BTree *) tree;
+ BTree *treePtr = (BTree *) tree;
if (treePtr == NULL) {
Tcl_Panic("NULL treePtr in TkBTreeAddClient");
@@ -632,9 +632,9 @@ AdjustStartEndRefs(
i++;
}
treePtr->startEndCount = count;
- treePtr->startEnd = ckrealloc(treePtr->startEnd,
+ treePtr->startEnd = (TkTextLine **)ckrealloc(treePtr->startEnd,
sizeof(TkTextLine *) * count);
- treePtr->startEndRef = ckrealloc(treePtr->startEndRef,
+ treePtr->startEndRef = (TkText **)ckrealloc(treePtr->startEndRef,
sizeof(TkText *) * count);
}
if ((action & TEXT_ADD_REFS)
@@ -650,9 +650,9 @@ AdjustStartEndRefs(
count = treePtr->startEndCount;
- treePtr->startEnd = ckrealloc(treePtr->startEnd,
+ treePtr->startEnd = (TkTextLine **)ckrealloc(treePtr->startEnd,
sizeof(TkTextLine *) * count);
- treePtr->startEndRef = ckrealloc(treePtr->startEndRef,
+ treePtr->startEndRef = (TkText **)ckrealloc(treePtr->startEndRef,
sizeof(TkText *) * count);
if (textPtr->start != NULL) {
@@ -725,7 +725,7 @@ AdjustPixelClient(
loopPtr = loopPtr->nextPtr;
}
} else {
- register TkTextLine *linePtr = nodePtr->children.linePtr;
+ TkTextLine *linePtr = nodePtr->children.linePtr;
while (linePtr != NULL) {
if (!*counting && (linePtr == start)) {
@@ -735,7 +735,7 @@ AdjustPixelClient(
*counting = 0;
}
if (newPixelReferences != treePtr->pixelReferences) {
- linePtr->pixels = ckrealloc(linePtr->pixels,
+ linePtr->pixels = (int *)ckrealloc(linePtr->pixels,
sizeof(int) * 2 * newPixelReferences);
}
@@ -752,7 +752,7 @@ AdjustPixelClient(
}
}
if (newPixelReferences != treePtr->pixelReferences) {
- nodePtr->numPixels = ckrealloc(nodePtr->numPixels,
+ nodePtr->numPixels = (int *)ckrealloc(nodePtr->numPixels,
sizeof(int) * newPixelReferences);
}
nodePtr->numPixels[useReference] = pixelCount;
@@ -802,7 +802,7 @@ RemovePixelClient(
ckfree(nodePtr->numPixels);
nodePtr->numPixels = NULL;
} else {
- nodePtr->numPixels = ckrealloc(nodePtr->numPixels,
+ nodePtr->numPixels = (int *)ckrealloc(nodePtr->numPixels,
sizeof(int) * (treePtr->pixelReferences - 1));
}
if (nodePtr->level != 0) {
@@ -812,7 +812,7 @@ RemovePixelClient(
nodePtr = nodePtr->nextPtr;
}
} else {
- register TkTextLine *linePtr = nodePtr->children.linePtr;
+ TkTextLine *linePtr = nodePtr->children.linePtr;
while (linePtr != NULL) {
if (overwriteWithLast != -1) {
linePtr->pixels[2*overwriteWithLast] =
@@ -823,7 +823,7 @@ RemovePixelClient(
if (treePtr->pixelReferences == 1) {
linePtr->pixels = NULL;
} else {
- linePtr->pixels = ckrealloc(linePtr->pixels,
+ linePtr->pixels = (int *)ckrealloc(linePtr->pixels,
sizeof(int) * 2 * (treePtr->pixelReferences-1));
}
linePtr = linePtr->nextPtr;
@@ -850,7 +850,7 @@ RemovePixelClient(
static void
DestroyNode(
- register Node *nodePtr) /* Destroy from this node downwards. */
+ Node *nodePtr) /* Destroy from this node downwards. */
{
if (nodePtr->level == 0) {
TkTextLine *linePtr;
@@ -868,7 +868,7 @@ DestroyNode(
ckfree(linePtr);
}
} else {
- register Node *childPtr;
+ Node *childPtr;
while (nodePtr->children.nodePtr != NULL) {
childPtr = nodePtr->children.nodePtr;
@@ -900,10 +900,10 @@ DestroyNode(
static void
DeleteSummaries(
- register Summary *summaryPtr)
+ Summary *summaryPtr)
/* First in list of node's tag summaries. */
{
- register Summary *nextPtr;
+ Summary *nextPtr;
while (summaryPtr != NULL) {
nextPtr = summaryPtr->nextPtr;
@@ -932,7 +932,7 @@ DeleteSummaries(
int
TkBTreeAdjustPixelHeight(
const TkText *textPtr, /* Client of the B-tree. */
- register TkTextLine *linePtr,
+ TkTextLine *linePtr,
/* The logical line to update. */
int newPixelHeight, /* The line's known height in pixels. */
int mergedLogicalLines) /* The number of extra logical lines which
@@ -942,7 +942,7 @@ TkBTreeAdjustPixelHeight(
* height associated with the given
* linePtr. */
{
- register Node *nodePtr;
+ Node *nodePtr;
int changeToPixelCount; /* Counts change to total number of pixels in
* file. */
int pixelReference = textPtr->pixelReference;
@@ -1001,7 +1001,7 @@ TkBTreeAdjustPixelHeight(
void
TkBTreeInsertChars(
TkTextBTree tree, /* Tree to insert into. */
- register TkTextIndex *indexPtr,
+ TkTextIndex *indexPtr,
/* Indicates where to insert text. When the
* function returns, this index is no longer
* valid because of changes to the segment
@@ -1009,8 +1009,8 @@ TkBTreeInsertChars(
const char *string) /* Pointer to bytes to insert (may contain
* newlines, must be null-terminated). */
{
- register Node *nodePtr;
- register TkTextSegment *prevPtr;
+ Node *nodePtr;
+ TkTextSegment *prevPtr;
/* The segment just before the first new
* segment (NULL means new segment is at
* beginning of line). */
@@ -1019,10 +1019,10 @@ TkBTreeInsertChars(
* insert at beginning of line. */
TkTextLine *linePtr; /* Current line (new segments are added to
* this line). */
- register TkTextSegment *segPtr;
+ TkTextSegment *segPtr;
TkTextLine *newLinePtr;
int chunkSize; /* # characters in current chunk. */
- register const char *eol; /* Pointer to character just after last one in
+ const char *eol; /* Pointer to character just after last one in
* current chunk. */
int changeToLineCount; /* Counts change to total number of lines in
* file. */
@@ -1044,7 +1044,7 @@ TkBTreeInsertChars(
changeToLineCount = 0;
if (treePtr->pixelReferences > PIXEL_CLIENTS) {
- changeToPixelCount = ckalloc(sizeof(int) * treePtr->pixelReferences);
+ changeToPixelCount = (int *)ckalloc(sizeof(int) * treePtr->pixelReferences);
} else {
changeToPixelCount = pixels;
}
@@ -1060,7 +1060,7 @@ TkBTreeInsertChars(
}
}
chunkSize = eol-string;
- segPtr = ckalloc(CSEG_SIZE(chunkSize));
+ segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(chunkSize));
segPtr->typePtr = &tkTextCharType;
if (curPtr == NULL) {
segPtr->nextPtr = linePtr->segPtr;
@@ -1070,7 +1070,7 @@ TkBTreeInsertChars(
curPtr->nextPtr = segPtr;
}
segPtr->size = chunkSize;
- memcpy(segPtr->body.chars, string, (size_t) chunkSize);
+ memcpy(segPtr->body.chars, string, chunkSize);
segPtr->body.chars[chunkSize] = 0;
if (eol[-1] != '\n') {
@@ -1082,8 +1082,8 @@ TkBTreeInsertChars(
* the remainder of the old line to it.
*/
- newLinePtr = ckalloc(sizeof(TkTextLine));
- newLinePtr->pixels =
+ newLinePtr = (TkTextLine *)ckalloc(sizeof(TkTextLine));
+ newLinePtr->pixels = (int *)
ckalloc(sizeof(int) * 2 * treePtr->pixelReferences);
newLinePtr->parentPtr = linePtr->parentPtr;
@@ -1312,10 +1312,10 @@ CleanupLine(
void
TkBTreeDeleteIndexRange(
TkTextBTree tree, /* Tree to delete from. */
- register TkTextIndex *index1Ptr,
+ TkTextIndex *index1Ptr,
/* Indicates first character that is to be
* deleted. */
- register TkTextIndex *index2Ptr)
+ TkTextIndex *index2Ptr)
/* Indicates character just after the last one
* that is to be deleted. */
{
@@ -1596,8 +1596,8 @@ TkBTreeFindLine(
int line) /* Index of desired line. */
{
BTree *treePtr = (BTree *) tree;
- register Node *nodePtr;
- register TkTextLine *linePtr;
+ Node *nodePtr;
+ TkTextLine *linePtr;
if (treePtr == NULL) {
treePtr = (BTree *) textPtr->sharedTextPtr->tree;
@@ -1686,8 +1686,8 @@ TkBTreeFindPixelLine(
int *pixelOffset) /* Used to return offset. */
{
BTree *treePtr = (BTree *) tree;
- register Node *nodePtr;
- register TkTextLine *linePtr;
+ Node *nodePtr;
+ TkTextLine *linePtr;
int pixelReference = textPtr->pixelReference;
nodePtr = treePtr->rootPtr;
@@ -1755,10 +1755,10 @@ TkBTreeFindPixelLine(
TkTextLine *
TkBTreeNextLine(
const TkText *textPtr, /* Next line in the context of this client. */
- register TkTextLine *linePtr)
+ TkTextLine *linePtr)
/* Pointer to existing line in B-tree. */
{
- register Node *nodePtr;
+ Node *nodePtr;
if (linePtr->nextPtr != NULL) {
if (textPtr != NULL && (linePtr == textPtr->end)) {
@@ -1811,12 +1811,12 @@ TkBTreeNextLine(
TkTextLine *
TkBTreePreviousLine(
TkText *textPtr, /* Relative to this client of the B-tree. */
- register TkTextLine *linePtr)
+ TkTextLine *linePtr)
/* Pointer to existing line in B-tree. */
{
- register Node *nodePtr;
- register Node *node2Ptr;
- register TkTextLine *prevPtr;
+ Node *nodePtr;
+ Node *node2Ptr;
+ TkTextLine *prevPtr;
if (textPtr != NULL && textPtr->start == linePtr) {
return NULL;
@@ -1895,8 +1895,8 @@ TkBTreePixelsTo(
const TkText *textPtr, /* Relative to this client of the B-tree. */
TkTextLine *linePtr) /* Pointer to existing line in B-tree. */
{
- register TkTextLine *linePtr2;
- register Node *nodePtr, *parentPtr;
+ TkTextLine *linePtr2;
+ Node *nodePtr, *parentPtr;
int index;
int pixelReference = textPtr->pixelReference;
@@ -1921,7 +1921,7 @@ TkBTreePixelsTo(
for (parentPtr = nodePtr->parentPtr ; parentPtr != NULL;
nodePtr = parentPtr, parentPtr = parentPtr->parentPtr) {
- register Node *nodePtr2;
+ Node *nodePtr2;
for (nodePtr2 = parentPtr->children.nodePtr; nodePtr2 != nodePtr;
nodePtr2 = nodePtr2->nextPtr) {
@@ -1957,8 +1957,8 @@ TkBTreeLinesTo(
const TkText *textPtr, /* Relative to this client of the B-tree. */
TkTextLine *linePtr) /* Pointer to existing line in B-tree. */
{
- register TkTextLine *linePtr2;
- register Node *nodePtr, *parentPtr, *nodePtr2;
+ TkTextLine *linePtr2;
+ Node *nodePtr, *parentPtr, *nodePtr2;
int index;
/*
@@ -2037,7 +2037,6 @@ TkBTreeLinesTo(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
void
TkBTreeLinkSegment(
TkTextSegment *segPtr, /* Pointer to new segment to be added to
@@ -2046,7 +2045,7 @@ TkBTreeLinkSegment(
TkTextIndex *indexPtr) /* Where to add segment: it gets linked in
* just before the segment indicated here. */
{
- register TkTextSegment *prevPtr;
+ TkTextSegment *prevPtr;
prevPtr = SplitSeg(indexPtr);
if (prevPtr == NULL) {
@@ -2080,13 +2079,12 @@ TkBTreeLinkSegment(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
void
TkBTreeUnlinkSegment(
TkTextSegment *segPtr, /* Segment to be unlinked. */
TkTextLine *linePtr) /* Line that currently contains segment. */
{
- register TkTextSegment *prevPtr;
+ TkTextSegment *prevPtr;
if (linePtr->segPtr == segPtr) {
linePtr->segPtr = segPtr->nextPtr;
@@ -2135,9 +2133,9 @@ TkBTreeUnlinkSegment(
int
TkBTreeTag(
- register TkTextIndex *index1Ptr,
+ TkTextIndex *index1Ptr,
/* Indicates first character in range. */
- register TkTextIndex *index2Ptr,
+ TkTextIndex *index2Ptr,
/* Indicates character just after the last one
* in range. */
TkTextTag *tagPtr, /* Tag to add or remove. */
@@ -2157,7 +2155,7 @@ TkBTreeTag(
oldState = TkBTreeCharTagged(index1Ptr, tagPtr);
if ((add != 0) ^ oldState) {
- segPtr = ckalloc(TSEG_SIZE);
+ segPtr = (TkTextSegment *)ckalloc(TSEG_SIZE);
segPtr->typePtr = (add) ? &tkTextToggleOnType : &tkTextToggleOffType;
prevPtr = SplitSeg(index1Ptr);
if (prevPtr == NULL) {
@@ -2228,7 +2226,7 @@ TkBTreeTag(
}
}
if ((add != 0) ^ oldState) {
- segPtr = ckalloc(TSEG_SIZE);
+ segPtr = (TkTextSegment *)ckalloc(TSEG_SIZE);
segPtr->typePtr = (add) ? &tkTextToggleOffType : &tkTextToggleOnType;
prevPtr = SplitSeg(index2Ptr);
if (prevPtr == NULL) {
@@ -2285,14 +2283,14 @@ TkBTreeTag(
static void
ChangeNodeToggleCount(
- register Node *nodePtr, /* Node whose toggle count for a tag must be
+ Node *nodePtr, /* Node whose toggle count for a tag must be
* changed. */
TkTextTag *tagPtr, /* Information about tag. */
int delta) /* Amount to add to current toggle count for
* tag (may be negative). */
{
- register Summary *summaryPtr, *prevPtr;
- register Node *node2Ptr;
+ Summary *summaryPtr, *prevPtr;
+ Node *node2Ptr;
int rootLevel; /* Level of original tag root. */
tagPtr->toggleCount += delta;
@@ -2372,7 +2370,7 @@ ChangeNodeToggleCount(
Node *rootNodePtr = tagPtr->tagRootPtr;
- summaryPtr = ckalloc(sizeof(Summary));
+ summaryPtr = (Summary *)ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = tagPtr->toggleCount - delta;
summaryPtr->nextPtr = rootNodePtr->summaryPtr;
@@ -2381,7 +2379,7 @@ ChangeNodeToggleCount(
rootLevel = rootNodePtr->level;
tagPtr->tagRootPtr = rootNodePtr;
}
- summaryPtr = ckalloc(sizeof(Summary));
+ summaryPtr = (Summary *)ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = delta;
summaryPtr->nextPtr = nodePtr->summaryPtr;
@@ -2471,10 +2469,10 @@ FindTagStart(
TkTextTag *tagPtr, /* Tag to search for. */
TkTextIndex *indexPtr) /* Return - index information. */
{
- register Node *nodePtr;
- register TkTextLine *linePtr;
- register TkTextSegment *segPtr;
- register Summary *summaryPtr;
+ Node *nodePtr;
+ TkTextLine *linePtr;
+ TkTextSegment *segPtr;
+ Summary *summaryPtr;
int offset;
nodePtr = tagPtr->tagRootPtr;
@@ -2556,10 +2554,10 @@ FindTagEnd(
TkTextTag *tagPtr, /* Tag to search for. */
TkTextIndex *indexPtr) /* Return - index information. */
{
- register Node *nodePtr, *lastNodePtr;
- register TkTextLine *linePtr ,*lastLinePtr;
- register TkTextSegment *segPtr, *lastSegPtr, *last2SegPtr;
- register Summary *summaryPtr;
+ Node *nodePtr, *lastNodePtr;
+ TkTextLine *linePtr ,*lastLinePtr;
+ TkTextSegment *segPtr, *lastSegPtr, *last2SegPtr;
+ Summary *summaryPtr;
int lastoffset, lastoffset2, offset;
nodePtr = tagPtr->tagRootPtr;
@@ -2652,7 +2650,7 @@ TkBTreeStartSearch(
* position *will* be returned. */
TkTextTag *tagPtr, /* Tag to search for. NULL means search for
* any tag. */
- register TkTextSearch *searchPtr)
+ TkTextSearch *searchPtr)
/* Where to store information about search's
* progress. */
{
@@ -2748,7 +2746,7 @@ TkBTreeStartSearchBack(
* position *will* be returned. */
TkTextTag *tagPtr, /* Tag to search for. NULL means search for
* any tag. */
- register TkTextSearch *searchPtr)
+ TkTextSearch *searchPtr)
/* Where to store information about search's
* progress. */
{
@@ -2849,14 +2847,14 @@ TkBTreeStartSearchBack(
int
TkBTreeNextTag(
- register TkTextSearch *searchPtr)
+ TkTextSearch *searchPtr)
/* Information about search in progress; must
* have been set up by call to
* TkBTreeStartSearch. */
{
- register TkTextSegment *segPtr;
- register Node *nodePtr;
- register Summary *summaryPtr;
+ TkTextSegment *segPtr;
+ Node *nodePtr;
+ Summary *summaryPtr;
if (searchPtr->linesLeft <= 0) {
goto searchOver;
@@ -3014,15 +3012,15 @@ TkBTreeNextTag(
int
TkBTreePrevTag(
- register TkTextSearch *searchPtr)
+ TkTextSearch *searchPtr)
/* Information about search in progress; must
* have been set up by call to
* TkBTreeStartSearch. */
{
- register TkTextSegment *segPtr, *prevPtr;
- register TkTextLine *linePtr, *prevLinePtr;
- register Node *nodePtr, *node2Ptr, *prevNodePtr;
- register Summary *summaryPtr;
+ TkTextSegment *segPtr, *prevPtr;
+ TkTextLine *linePtr, *prevLinePtr;
+ Node *nodePtr, *node2Ptr, *prevNodePtr;
+ Summary *summaryPtr;
int byteIndex, linesSkipped;
int pastLast; /* Saw last marker during scan. */
@@ -3232,9 +3230,9 @@ TkBTreeCharTagged(
* check for a tag. */
TkTextTag *tagPtr) /* Tag of interest. */
{
- register Node *nodePtr;
- register TkTextLine *siblingLinePtr;
- register TkTextSegment *segPtr;
+ Node *nodePtr;
+ TkTextLine *siblingLinePtr;
+ TkTextSegment *segPtr;
TkTextSegment *toggleSegPtr;
int toggles, index;
@@ -3288,8 +3286,8 @@ TkBTreeCharTagged(
toggles = 0;
for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
nodePtr = nodePtr->parentPtr) {
- register Node *siblingPtr;
- register Summary *summaryPtr;
+ Node *siblingPtr;
+ Summary *summaryPtr;
for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
@@ -3336,7 +3334,6 @@ TkBTreeCharTagged(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
TkTextTag **
TkBTreeGetTags(
const TkTextIndex *indexPtr,/* Indicates a particular position in the
@@ -3347,9 +3344,9 @@ TkBTreeGetTags(
int *numTagsPtr) /* Store number of tags found at this
* location. */
{
- register Node *nodePtr;
- register TkTextLine *siblingLinePtr;
- register TkTextSegment *segPtr;
+ Node *nodePtr;
+ TkTextLine *siblingLinePtr;
+ TkTextSegment *segPtr;
TkTextLine *linePtr;
int src, dst, index;
TagInfo tagInfo;
@@ -3357,8 +3354,8 @@ TkBTreeGetTags(
tagInfo.numTags = 0;
tagInfo.arraySize = NUM_TAG_INFOS;
- tagInfo.tagPtrs = ckalloc(NUM_TAG_INFOS * sizeof(TkTextTag *));
- tagInfo.counts = ckalloc(NUM_TAG_INFOS * sizeof(int));
+ tagInfo.tagPtrs = (TkTextTag **)ckalloc(NUM_TAG_INFOS * sizeof(TkTextTag *));
+ tagInfo.counts = (int *)ckalloc(NUM_TAG_INFOS * sizeof(int));
/*
* Record tag toggles within the line of indexPtr but preceding indexPtr.
@@ -3410,8 +3407,8 @@ TkBTreeGetTags(
for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
nodePtr = nodePtr->parentPtr) {
- register Node *siblingPtr;
- register Summary *summaryPtr;
+ Node *siblingPtr;
+ Summary *summaryPtr;
for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
@@ -3482,7 +3479,6 @@ TkBTreeGetTags(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
TkTextIsElided(
const TkText *textPtr, /* Overall information about text widget. */
@@ -3492,17 +3488,17 @@ TkTextIsElided(
* indexPtr's elide state will be stored and
* returned. */
{
- register Node *nodePtr;
- register TkTextLine *siblingLinePtr;
- register TkTextSegment *segPtr;
- register TkTextTag *tagPtr = NULL;
- register int i, index;
- register TkTextElideInfo *infoPtr;
+ Node *nodePtr;
+ TkTextLine *siblingLinePtr;
+ TkTextSegment *segPtr;
+ TkTextTag *tagPtr = NULL;
+ int i, index;
+ TkTextElideInfo *infoPtr;
TkTextLine *linePtr;
int elide;
if (elideInfo == NULL) {
- infoPtr = ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo));
} else {
infoPtr = elideInfo;
}
@@ -3517,8 +3513,8 @@ TkTextIsElided(
*/
if (LOTSA_TAGS < infoPtr->numTags) {
- infoPtr->tagCnts = ckalloc(sizeof(int) * infoPtr->numTags);
- infoPtr->tagPtrs = ckalloc(sizeof(TkTextTag *) * infoPtr->numTags);
+ infoPtr->tagCnts = (int *)ckalloc(sizeof(int) * infoPtr->numTags);
+ infoPtr->tagPtrs = (TkTextTag **)ckalloc(sizeof(TkTextTag *) * infoPtr->numTags);
}
for (i=0; inumTags; i++) {
@@ -3591,8 +3587,8 @@ TkTextIsElided(
for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
nodePtr = nodePtr->parentPtr) {
- register Node *siblingPtr;
- register Summary *summaryPtr;
+ Node *siblingPtr;
+ Summary *summaryPtr;
for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
@@ -3697,7 +3693,7 @@ IncCount(
TagInfo *tagInfoPtr) /* Holds cumulative information about tags;
* increment count here. */
{
- register TkTextTag **tagPtrPtr;
+ TkTextTag **tagPtrPtr;
int count;
for (tagPtrPtr = tagInfoPtr->tagPtrs, count = tagInfoPtr->numTags;
@@ -3718,12 +3714,12 @@ IncCount(
int *newCounts, newSize;
newSize = 2 * tagInfoPtr->arraySize;
- newTags = ckalloc(newSize * sizeof(TkTextTag *));
+ newTags = (TkTextTag **)ckalloc(newSize * sizeof(TkTextTag *));
memcpy(newTags, tagInfoPtr->tagPtrs,
tagInfoPtr->arraySize * sizeof(TkTextTag *));
ckfree(tagInfoPtr->tagPtrs);
tagInfoPtr->tagPtrs = newTags;
- newCounts = ckalloc(newSize * sizeof(int));
+ newCounts = (int *)ckalloc(newSize * sizeof(int));
memcpy(newCounts, tagInfoPtr->counts,
tagInfoPtr->arraySize * sizeof(int));
ckfree(tagInfoPtr->counts);
@@ -3759,11 +3755,11 @@ TkBTreeCheck(
TkTextBTree tree) /* Tree to check. */
{
BTree *treePtr = (BTree *) tree;
- register Summary *summaryPtr;
- register Node *nodePtr;
- register TkTextLine *linePtr;
- register TkTextSegment *segPtr;
- register TkTextTag *tagPtr;
+ Summary *summaryPtr;
+ Node *nodePtr;
+ TkTextLine *linePtr;
+ TkTextSegment *segPtr;
+ TkTextTag *tagPtr;
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
int count;
@@ -3774,7 +3770,7 @@ TkBTreeCheck(
for (entryPtr=Tcl_FirstHashEntry(&treePtr->sharedTextPtr->tagTable,&search);
entryPtr != NULL ; entryPtr = Tcl_NextHashEntry(&search)) {
- tagPtr = Tcl_GetHashValue(entryPtr);
+ tagPtr = (TkTextTag *)Tcl_GetHashValue(entryPtr);
nodePtr = tagPtr->tagRootPtr;
if (nodePtr == NULL) {
if (tagPtr->toggleCount != 0) {
@@ -3898,14 +3894,14 @@ TkBTreeCheck(
static void
CheckNodeConsistency(
- register Node *nodePtr, /* Node whose subtree should be checked. */
+ Node *nodePtr, /* Node whose subtree should be checked. */
int references) /* Number of referring widgets which have
* pixel counts. */
{
- register Node *childNodePtr;
- register Summary *summaryPtr, *summaryPtr2;
- register TkTextLine *linePtr;
- register TkTextSegment *segPtr;
+ Node *childNodePtr;
+ Summary *summaryPtr, *summaryPtr2;
+ TkTextLine *linePtr;
+ TkTextSegment *segPtr;
int numChildren, numLines, toggleCount, minChildren, i;
int *numPixels;
int pixels[PIXEL_CLIENTS];
@@ -3926,7 +3922,7 @@ CheckNodeConsistency(
numChildren = 0;
numLines = 0;
if (references > PIXEL_CLIENTS) {
- numPixels = ckalloc(sizeof(int) * references);
+ numPixels = (int *)ckalloc(sizeof(int) * references);
} else {
numPixels = pixels;
}
@@ -4087,7 +4083,7 @@ CheckNodeConsistency(
static void
Rebalance(
BTree *treePtr, /* Tree that is being rebalanced. */
- register Node *nodePtr) /* Node that may be out of balance. */
+ Node *nodePtr) /* Node that may be out of balance. */
{
/*
* Loop over the entire ancestral chain of the node, working up through
@@ -4095,8 +4091,8 @@ Rebalance(
*/
for ( ; nodePtr != NULL; nodePtr = nodePtr->parentPtr) {
- register Node *newPtr, *childPtr;
- register TkTextLine *linePtr;
+ Node *newPtr, *childPtr;
+ TkTextLine *linePtr;
int i;
/*
@@ -4114,7 +4110,7 @@ Rebalance(
*/
if (nodePtr->parentPtr == NULL) {
- newPtr = ckalloc(sizeof(Node));
+ newPtr = (Node *)ckalloc(sizeof(Node));
newPtr->parentPtr = NULL;
newPtr->nextPtr = NULL;
newPtr->summaryPtr = NULL;
@@ -4122,7 +4118,7 @@ Rebalance(
newPtr->children.nodePtr = nodePtr;
newPtr->numChildren = 1;
newPtr->numLines = nodePtr->numLines;
- newPtr->numPixels =
+ newPtr->numPixels = (int *)
ckalloc(sizeof(int) * treePtr->pixelReferences);
for (i=0; ipixelReferences; i++) {
newPtr->numPixels[i] = nodePtr->numPixels[i];
@@ -4130,8 +4126,8 @@ Rebalance(
RecomputeNodeCounts(treePtr, newPtr);
treePtr->rootPtr = newPtr;
}
- newPtr = ckalloc(sizeof(Node));
- newPtr->numPixels =
+ newPtr = (Node *)ckalloc(sizeof(Node));
+ newPtr->numPixels = (int *)
ckalloc(sizeof(int) * treePtr->pixelReferences);
for (i=0; ipixelReferences; i++) {
newPtr->numPixels[i] = 0;
@@ -4170,10 +4166,10 @@ Rebalance(
}
while (nodePtr->numChildren < MIN_CHILDREN) {
- register Node *otherPtr;
+ Node *otherPtr;
Node *halfwayNodePtr = NULL; /* Initialization needed only */
TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */
- int totalChildren, firstChildren, i;
+ int totalChildren, firstChildren;
/*
* Too few children for this node. If this is the root then, it's
@@ -4234,8 +4230,6 @@ Rebalance(
otherPtr->children.linePtr = NULL;
}
if (nodePtr->level == 0) {
- register TkTextLine *linePtr;
-
for (linePtr = nodePtr->children.linePtr, i = 1;
linePtr->nextPtr != NULL;
linePtr = linePtr->nextPtr, i++) {
@@ -4250,8 +4244,6 @@ Rebalance(
i++;
}
} else {
- register Node *childPtr;
-
for (childPtr = nodePtr->children.nodePtr, i = 1;
childPtr->nextPtr != NULL;
childPtr = childPtr->nextPtr, i++) {
@@ -4326,14 +4318,14 @@ Rebalance(
static void
RecomputeNodeCounts(
- register BTree *treePtr, /* The whole B-tree. */
- register Node *nodePtr) /* Node whose tag summary information must be
+ BTree *treePtr, /* The whole B-tree. */
+ Node *nodePtr) /* Node whose tag summary information must be
* recomputed. */
{
- register Summary *summaryPtr, *summaryPtr2;
- register Node *childPtr;
- register TkTextLine *linePtr;
- register TkTextSegment *segPtr;
+ Summary *summaryPtr, *summaryPtr2;
+ Node *childPtr;
+ TkTextLine *linePtr;
+ TkTextSegment *segPtr;
TkTextTag *tagPtr;
int ref;
@@ -4377,7 +4369,7 @@ RecomputeNodeCounts(
for (summaryPtr = nodePtr->summaryPtr; ;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr == NULL) {
- summaryPtr = ckalloc(sizeof(Summary));
+ summaryPtr = (Summary *)ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = 1;
summaryPtr->nextPtr = nodePtr->summaryPtr;
@@ -4405,7 +4397,7 @@ RecomputeNodeCounts(
for (summaryPtr = nodePtr->summaryPtr; ;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr == NULL) {
- summaryPtr = ckalloc(sizeof(Summary));
+ summaryPtr = (Summary *)ckalloc(sizeof(Summary));
summaryPtr->tagPtr = summaryPtr2->tagPtr;
summaryPtr->toggleCount = summaryPtr2->toggleCount;
summaryPtr->nextPtr = nodePtr->summaryPtr;
@@ -4558,12 +4550,12 @@ CharSplitProc(
{
TkTextSegment *newPtr1, *newPtr2;
- newPtr1 = ckalloc(CSEG_SIZE(index));
- newPtr2 = ckalloc(CSEG_SIZE(segPtr->size - index));
+ newPtr1 = (TkTextSegment *)ckalloc(CSEG_SIZE(index));
+ newPtr2 = (TkTextSegment *)ckalloc(CSEG_SIZE(segPtr->size - index));
newPtr1->typePtr = &tkTextCharType;
newPtr1->nextPtr = newPtr2;
newPtr1->size = index;
- memcpy(newPtr1->body.chars, segPtr->body.chars, (size_t) index);
+ memcpy(newPtr1->body.chars, segPtr->body.chars, index);
newPtr1->body.chars[index] = 0;
newPtr2->typePtr = &tkTextCharType;
newPtr2->nextPtr = segPtr->nextPtr;
@@ -4592,12 +4584,11 @@ CharSplitProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static TkTextSegment *
CharCleanupProc(
TkTextSegment *segPtr, /* Pointer to first of two adjacent segments
* to join. */
- TkTextLine *linePtr) /* Line containing segments (not used). */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segments (not used). */
{
TkTextSegment *segPtr2, *newPtr;
@@ -4605,7 +4596,7 @@ CharCleanupProc(
if ((segPtr2 == NULL) || (segPtr2->typePtr != &tkTextCharType)) {
return segPtr;
}
- newPtr = ckalloc(CSEG_SIZE(segPtr->size + segPtr2->size));
+ newPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(segPtr->size + segPtr2->size));
newPtr->typePtr = &tkTextCharType;
newPtr->nextPtr = segPtr2->nextPtr;
newPtr->size = segPtr->size + segPtr2->size;
@@ -4633,12 +4624,11 @@ CharCleanupProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
CharDeleteProc(
TkTextSegment *segPtr, /* Segment to delete. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -4663,11 +4653,10 @@ CharDeleteProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
CharCheckProc(
TkTextSegment *segPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
/*
* Make sure that the segment contains the number of characters indicated
@@ -4679,7 +4668,7 @@ CharCheckProc(
if (segPtr->size <= 0) {
Tcl_Panic("CharCheckProc: segment has size <= 0");
}
- if (strlen(segPtr->body.chars) != (size_t) segPtr->size) {
+ if (strlen(segPtr->body.chars) != (size_t)segPtr->size) {
Tcl_Panic("CharCheckProc: segment has wrong size");
}
if (segPtr->nextPtr == NULL) {
@@ -4858,7 +4847,7 @@ ToggleCheckProc(
TkTextSegment *segPtr, /* Segment to check. */
TkTextLine *linePtr) /* Line containing segment. */
{
- register Summary *summaryPtr;
+ Summary *summaryPtr;
int needSummary;
if (segPtr->size != 0) {
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index c848fd26..a02544d2 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -20,15 +20,13 @@
#include "tkWinInt.h"
#elif defined(__CYGWIN__)
#include "tkUnixInt.h"
+#elif defined(MAC_OSX_TK)
+#include "tkMacOSXInt.h"
+#define OK_TO_LOG (!TkpWillDrawWidget(textPtr->tkwin))
#endif
-#ifdef MAC_OSX_TK
-#include "tkMacOSXInt.h"
-#define OK_TO_LOG (!TkpAppIsDrawing())
-#define FORCE_DISPLAY(winPtr) TkpDisplayWindow(winPtr)
-#else
+#if !defined(MAC_OSX_TK)
#define OK_TO_LOG 1
-#define FORCE_DISPLAY(winPtr)
#endif
/*
@@ -446,8 +444,8 @@ typedef struct TextDInfo {
typedef struct CharInfo {
int numBytes; /* Number of bytes to display. */
- char chars[1]; /* UTF characters to display. Actual size will
- * be numBytes, not 1. THIS MUST BE THE LAST
+ char chars[TKFLEXARRAY]; /* UTF characters to display.
+ * Allocated as large as necessary. THIS MUST BE THE LAST
* FIELD IN THE STRUCTURE. */
} CharInfo;
@@ -660,10 +658,10 @@ void
TkTextCreateDInfo(
TkText *textPtr) /* Overall information for text widget. */
{
- register TextDInfo *dInfoPtr;
+ TextDInfo *dInfoPtr;
XGCValues gcValues;
- dInfoPtr = ckalloc(sizeof(TextDInfo));
+ dInfoPtr = (TextDInfo *)ckalloc(sizeof(TextDInfo));
Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int));
dInfoPtr->dLinePtr = NULL;
dInfoPtr->copyGC = NULL;
@@ -719,7 +717,7 @@ void
TkTextFreeDInfo(
TkText *textPtr) /* Overall information for text widget. */
{
- register TextDInfo *dInfoPtr = textPtr->dInfoPtr;
+ TextDInfo *dInfoPtr = textPtr->dInfoPtr;
/*
* Be careful to free up styleTable *after* freeing up all the DLines, so
@@ -775,7 +773,7 @@ GetStyle(
* information is wanted. */
{
TkTextTag **tagPtrs;
- register TkTextTag *tagPtr;
+ TkTextTag *tagPtr;
StyleValues styleValues;
TextStyle *stylePtr;
Tcl_HashEntry *hPtr;
@@ -1004,7 +1002,7 @@ GetStyle(
hPtr = Tcl_CreateHashEntry(&textPtr->dInfoPtr->styleTable,
(char *) &styleValues, &isNew);
if (!isNew) {
- stylePtr = Tcl_GetHashValue(hPtr);
+ stylePtr = (TextStyle *)Tcl_GetHashValue(hPtr);
stylePtr->refCount++;
return stylePtr;
}
@@ -1013,7 +1011,7 @@ GetStyle(
* No existing style matched. Make a new one.
*/
- stylePtr = ckalloc(sizeof(TextStyle));
+ stylePtr = (TextStyle *)ckalloc(sizeof(TextStyle));
stylePtr->refCount = 1;
if (styleValues.border != NULL) {
gcValues.foreground = Tk_3DBorderColor(styleValues.border)->pixel;
@@ -1071,11 +1069,10 @@ GetStyle(
static void
FreeStyle(
TkText *textPtr, /* Information about overall widget. */
- register TextStyle *stylePtr)
+ TextStyle *stylePtr)
/* Information about style to free. */
{
- stylePtr->refCount--;
- if (stylePtr->refCount == 0) {
+ if (stylePtr->refCount-- <= 1) {
if (stylePtr->bgGC != NULL) {
Tk_FreeGC(textPtr->display, stylePtr->bgGC);
}
@@ -1134,7 +1131,7 @@ LayoutDLine(
* necessarily point to a character
* segment. */
{
- register DLine *dlPtr; /* New display line. */
+ DLine *dlPtr; /* New display line. */
TkTextSegment *segPtr; /* Current segment in text. */
TkTextDispChunk *lastChunkPtr;
/* Last chunk allocated so far for line. */
@@ -1188,7 +1185,7 @@ LayoutDLine(
* Create and initialize a new DLine structure.
*/
- dlPtr = ckalloc(sizeof(DLine));
+ dlPtr = (DLine *)ckalloc(sizeof(DLine));
dlPtr->index = *indexPtr;
dlPtr->byteCount = 0;
dlPtr->y = 0;
@@ -1369,7 +1366,7 @@ LayoutDLine(
* expectations in the rest of the code, but we are able to skip
* elided portions of the line quickly.
*
- * If current chunk is elided and last chunk was too, coalese.
+ * If current chunk is elided and last chunk was too, coalesce.
*
* This also means that each logical line which is entirely elided
* still gets laid out into a DLine, but with zero height. This isn't
@@ -1437,7 +1434,7 @@ LayoutDLine(
continue;
}
if (chunkPtr == NULL) {
- chunkPtr = ckalloc(sizeof(TkTextDispChunk));
+ chunkPtr = (TkTextDispChunk *)ckalloc(sizeof(TkTextDispChunk));
chunkPtr->nextPtr = NULL;
chunkPtr->clientData = NULL;
}
@@ -1835,8 +1832,8 @@ static void
UpdateDisplayInfo(
TkText *textPtr) /* Text widget to update. */
{
- register TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register DLine *dlPtr, *prevPtr;
+ TextDInfo *dInfoPtr = textPtr->dInfoPtr;
+ DLine *dlPtr, *prevPtr;
TkTextIndex index;
TkTextLine *lastLinePtr;
int y, maxY, xPixelOffset, maxOffset, lineHeight;
@@ -1873,7 +1870,7 @@ UpdateDisplayInfo(
y = dInfoPtr->y - dInfoPtr->newTopPixelOffset;
maxY = dInfoPtr->maxY;
while (1) {
- register DLine *newPtr;
+ DLine *newPtr;
if (index.linePtr == lastLinePtr) {
break;
@@ -1984,7 +1981,7 @@ UpdateDisplayInfo(
*/
if (index.linePtr != prevPtr->index.linePtr) {
- register DLine *nextPtr;
+ DLine *nextPtr;
nextPtr = dlPtr;
while ((nextPtr != NULL)
@@ -2353,7 +2350,7 @@ UpdateDisplayInfo(
static void
FreeDLines(
TkText *textPtr, /* Information about overall text widget. */
- register DLine *firstPtr, /* Pointer to first DLine to free up. */
+ DLine *firstPtr, /* Pointer to first DLine to free up. */
DLine *lastPtr, /* Pointer to DLine just after last one to
* free (NULL means everything starting with
* firstPtr). */
@@ -2366,8 +2363,8 @@ FreeDLines(
* we shouldn't invalidate anything for the
* overall widget. */
{
- register TkTextDispChunk *chunkPtr, *nextChunkPtr;
- register DLine *nextDLinePtr;
+ TkTextDispChunk *chunkPtr, *nextChunkPtr;
+ DLine *nextDLinePtr;
if (action == DLINE_FREE_TEMP) {
lineHeightsRecalculated++;
@@ -2386,7 +2383,7 @@ FreeDLines(
if (textPtr->dInfoPtr->dLinePtr == firstPtr) {
textPtr->dInfoPtr->dLinePtr = lastPtr;
} else {
- register DLine *prevPtr;
+ DLine *prevPtr;
for (prevPtr = textPtr->dInfoPtr->dLinePtr;
prevPtr->nextPtr != firstPtr; prevPtr = prevPtr->nextPtr) {
@@ -2434,14 +2431,14 @@ FreeDLines(
static void
DisplayDLine(
TkText *textPtr, /* Text widget in which to draw line. */
- register DLine *dlPtr, /* Information about line to draw. */
+ DLine *dlPtr, /* Information about line to draw. */
DLine *prevPtr, /* Line just before one to draw, or NULL if
* dlPtr is the top line. */
Pixmap pixmap) /* Pixmap to use for double-buffering. Caller
* must make sure it's large enough to hold
* line. */
{
- register TkTextDispChunk *chunkPtr;
+ TkTextDispChunk *chunkPtr;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
Display *display;
int height, y_off;
@@ -2613,7 +2610,7 @@ DisplayDLine(
static void
DisplayLineBackground(
TkText *textPtr, /* Text widget containing line. */
- register DLine *dlPtr, /* Information about line to draw. */
+ DLine *dlPtr, /* Information about line to draw. */
DLine *prevPtr, /* Line just above dlPtr, or NULL if dlPtr is
* the top-most line in the window. */
Pixmap pixmap) /* Pixmap to use for double-buffering. Caller
@@ -3009,7 +3006,7 @@ static void
AsyncUpdateLineMetrics(
ClientData clientData) /* Information about widget. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
int lineNum;
@@ -3157,7 +3154,7 @@ GenerateWidgetViewSyncEvent(
*/
if (!tkTextDebug) {
- FORCE_DISPLAY(textPtr->tkwin);
+ TkpRedrawWidget(textPtr->tkwin);
}
if (NewSyncState != OldSyncState) {
@@ -3166,8 +3163,8 @@ GenerateWidgetViewSyncEvent(
} else {
textPtr->dInfoPtr->flags |= OUT_OF_SYNC;
}
- TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
- Tcl_NewBooleanObj(NewSyncState));
+ TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
+ Tcl_NewBooleanObj(NewSyncState));
}
}
@@ -4166,9 +4163,9 @@ static void
DisplayText(
ClientData clientData) /* Information about widget. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register DLine *dlPtr;
+ DLine *dlPtr;
DLine *prevPtr;
Pixmap pixmap;
int maxHeight, borders;
@@ -4176,18 +4173,6 @@ DisplayText(
* warnings. */
Tcl_Interp *interp;
-#ifdef MAC_OSX_TK
- /*
- * If drawing is disabled, all we need to do is
- * clear the REDRAW_PENDING flag.
- */
- TkWindow *winPtr = (TkWindow *)(textPtr->tkwin);
- MacDrawable *macWin = winPtr->privatePtr;
- if (macWin && (macWin->flags & TK_DO_NOT_DRAW)){
- dInfoPtr->flags &= ~REDRAW_PENDING;
- return;
- }
-#endif
if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
/*
@@ -4197,6 +4182,22 @@ DisplayText(
return;
}
+#ifdef MAC_OSX_TK
+ /*
+ * If the toplevel is being resized it would be dangerous to try redrawing
+ * the widget. But we can just clear the REDRAW_PENDING flag and return.
+ * This display proc will be called again after the widget has been
+ * reconfigured.
+ */
+
+ TkWindow *winPtr = (TkWindow *)(textPtr->tkwin);
+ MacDrawable *macWin = winPtr->privatePtr;
+ if (macWin && (macWin->flags & TK_DO_NOT_DRAW)){
+ dInfoPtr->flags &= ~REDRAW_PENDING;
+ return;
+ }
+#endif
+
interp = textPtr->interp;
Tcl_Preserve(interp);
@@ -4252,7 +4253,7 @@ DisplayText(
*/
for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL; dlPtr = dlPtr->nextPtr) {
- register DLine *dlPtr2;
+ DLine *dlPtr2;
int offset, height, y, oldY;
TkRegion damageRgn;
@@ -4550,7 +4551,7 @@ DisplayText(
* proc of embedded windows only.
*/
#endif
- register TkTextDispChunk *chunkPtr;
+ TkTextDispChunk *chunkPtr;
for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL);
chunkPtr = chunkPtr->nextPtr) {
@@ -4752,7 +4753,7 @@ TextInvalidateRegion(
TkText *textPtr, /* Widget record for text widget. */
TkRegion region) /* Region of area to redraw. */
{
- register DLine *dlPtr;
+ DLine *dlPtr;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
int maxY, inset;
XRectangle rect;
@@ -5010,7 +5011,7 @@ TextRedrawTag(
int withTag) /* 1 means redraw characters that have the
* tag, 0 means redraw those without. */
{
- register DLine *dlPtr;
+ DLine *dlPtr;
DLine *endPtr;
int tagOn;
TkTextSearch search;
@@ -5273,7 +5274,7 @@ TkTextRelayoutWindow(
/*
* Invalidate cached scrollbar positions, so that scrollbars sliders will
- * be udpated.
+ * be updated.
*/
dInfoPtr->xScrollFirst = dInfoPtr->xScrollLast = -1;
@@ -5350,7 +5351,7 @@ TkTextSetYView(
* are to be off the top of the screen. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register DLine *dlPtr;
+ DLine *dlPtr;
int bottomY, close, lineIndex;
TkTextIndex tmpIndex, rounded;
int lineHeight;
@@ -6178,7 +6179,7 @@ TkTextYviewCmd(
pickPlace = 0;
if (Tcl_GetString(objv[2])[0] == '-') {
- register const char *switchStr =
+ const char *switchStr =
Tcl_GetStringFromObj(objv[2], &switchLength);
if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace",
@@ -6356,7 +6357,7 @@ TkTextPendingsync(
int
TkTextScanCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -6525,7 +6526,7 @@ GetXView(
Tcl_DStringAppend(&buf, textPtr->xScrollCmd, -1);
Tcl_DStringAppend(&buf, buf1, -1);
Tcl_DStringAppend(&buf, buf2, -1);
- code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
@@ -6810,7 +6811,7 @@ GetYView(
Tcl_DStringAppend(&buf, textPtr->yScrollCmd, -1);
Tcl_DStringAppend(&buf, buf1, -1);
Tcl_DStringAppend(&buf, buf2, -1);
- code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
@@ -6842,7 +6843,7 @@ static void
AsyncUpdateYScrollbar(
ClientData clientData) /* Information about widget. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
textPtr->dInfoPtr->scrollbarTimer = NULL;
@@ -6877,7 +6878,7 @@ AsyncUpdateYScrollbar(
static DLine *
FindDLine(
TkText *textPtr, /* Widget record for text widget. */
- register DLine *dlPtr, /* Pointer to first in list of DLines to
+ DLine *dlPtr, /* Pointer to first in list of DLines to
* search. */
const TkTextIndex *indexPtr)/* Index of desired character. */
{
@@ -7047,7 +7048,7 @@ TkTextPixelIndex(
* border of the widget). */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register DLine *dlPtr, *validDlPtr;
+ DLine *dlPtr, *validDlPtr;
int nearby = 0;
/*
@@ -7149,7 +7150,7 @@ DlineIndexOfX(
* the character nearest to x. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register TkTextDispChunk *chunkPtr;
+ TkTextDispChunk *chunkPtr;
/*
* Scan through the line's chunks to find the one that contains the
@@ -7277,7 +7278,7 @@ DlineXOfIndex(
int byteIndex) /* The byte index for which we want the
* coordinate. */
{
- register TkTextDispChunk *chunkPtr = dlPtr->chunkPtr;
+ TkTextDispChunk *chunkPtr = dlPtr->chunkPtr;
int x = 0;
if (byteIndex == 0 || chunkPtr == NULL) {
@@ -7347,7 +7348,7 @@ TkTextIndexBbox(
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
DLine *dlPtr;
- register TkTextDispChunk *chunkPtr;
+ TkTextDispChunk *chunkPtr;
int byteCount;
/*
@@ -7539,14 +7540,14 @@ TkTextDLineInfo(
static void
ElideBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
- int lineHeight, /* Height of line, in pixels. */
- int baseline, /* Location of line's baseline, in pixels
+ TCL_UNUSED(int), /* Height of line, in pixels. */
+ TCL_UNUSED(int), /* Location of line's baseline, in pixels
* measured down from y. */
int *xPtr, int *yPtr, /* Gets filled in with coords of character's
* upper-left pixel. X-coord is in same
@@ -7567,8 +7568,8 @@ ElideBboxProc(
static int
ElideMeasureProc(
- TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */
- int x) /* X-coordinate, in same coordinate system as
+ TCL_UNUSED(TkTextDispChunk *), /* Chunk containing desired coord. */
+ TCL_UNUSED(int)) /* X-coordinate, in same coordinate system as
* chunkPtr->x. */
{
return 0 /*chunkPtr->numBytes - 1*/;
@@ -7597,8 +7598,8 @@ ElideMeasureProc(
int
TkTextCharLayoutProc(
- TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Index of first character to lay out
+ TCL_UNUSED(TkText *), /* Text widget being layed out. */
+ TCL_UNUSED(TkTextIndex *), /* Index of first character to lay out
* (corresponds to segPtr and offset). */
TkTextSegment *segPtr, /* Segment being layed out. */
int byteOffset, /* Byte offset within segment of first
@@ -7612,7 +7613,7 @@ TkTextCharLayoutProc(
TkWrapMode wrapMode, /* How to handle line wrapping:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr)
+ TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -7763,9 +7764,9 @@ TkTextCharLayoutProc(
chunkPtr->breakIndex = -1;
#if !TK_LAYOUT_WITH_BASE_CHUNKS
- ciPtr = ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit);
+ ciPtr = (CharInfo *)ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit);
chunkPtr->clientData = ciPtr;
- memcpy(ciPtr->chars, p, (unsigned) bytesThatFit);
+ memcpy(ciPtr->chars, p, bytesThatFit);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
ciPtr->numBytes = bytesThatFit;
@@ -7876,7 +7877,7 @@ CharChunkMeasureChars(
* here. */
{
Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
- CharInfo *ciPtr = chunkPtr->clientData;
+ CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
#if !TK_LAYOUT_WITH_BASE_CHUNKS
if (chars == NULL) {
@@ -7951,21 +7952,21 @@ CharChunkMeasureChars(
static void
CharDisplayProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
int x, /* X-position in dst at which to draw this
* chunk (may differ from the x-position in
* the chunk because of scrolling). */
int y, /* Y-position at which to draw this chunk in
* dst. */
- int height, /* Total height of line. */
+ TCL_UNUSED(int), /* Total height of line. */
int baseline, /* Offset of baseline from y. */
Display *display, /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw chunk. */
- int screenY) /* Y-coordinate in text window that
+ TCL_UNUSED(int)) /* Y-coordinate in text window that
* corresponds to y. */
{
- CharInfo *ciPtr = chunkPtr->clientData;
+ CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
const char *string;
TextStyle *stylePtr;
StyleValues *sValuePtr;
@@ -8113,10 +8114,10 @@ CharDisplayProc(
static void
CharUndisplayProc(
- TkText *textPtr, /* Overall information about text widget. */
+ TCL_UNUSED(TkText *), /* Overall information about text widget. */
TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
- CharInfo *ciPtr = chunkPtr->clientData;
+ CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
if (ciPtr) {
#if TK_LAYOUT_WITH_BASE_CHUNKS
@@ -8202,13 +8203,13 @@ CharMeasureProc(
static void
CharBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
int byteIndex, /* Byte offset of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
- int lineHeight, /* Height of line, in pixels. */
+ TCL_UNUSED(int), /* Height of line, in pixels. */
int baseline, /* Location of line's baseline, in pixels
* measured down from y. */
int *xPtr, int *yPtr, /* Gets filled in with coords of character's
@@ -8219,7 +8220,7 @@ CharBboxProc(
int *heightPtr) /* Gets filled in with height of character, in
* pixels. */
{
- CharInfo *ciPtr = chunkPtr->clientData;
+ CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
int maxX;
maxX = chunkPtr->width + chunkPtr->x;
@@ -8382,7 +8383,7 @@ AdjustForTab(
if (chunkPtr2->displayProc != CharDisplayProc) {
continue;
}
- ciPtr = chunkPtr2->clientData;
+ ciPtr = (CharInfo *)chunkPtr2->clientData;
for (p = ciPtr->chars, i = 0; i < ciPtr->numBytes; p++, i++) {
if (isdigit(UCHAR(*p))) {
gotDigit = 1;
@@ -8403,7 +8404,7 @@ AdjustForTab(
if (decimalChunkPtr != NULL) {
int curX;
- ciPtr = decimalChunkPtr->clientData;
+ ciPtr = (CharInfo *)decimalChunkPtr->clientData;
CharChunkMeasureChars(decimalChunkPtr, NULL, 0, 0, decimal,
decimalChunkPtr->x, -1, 0, &curX);
desired = tabX - (curX - x);
@@ -8674,7 +8675,7 @@ MeasureChars(
int curX, width, ch;
const char *special, *end, *start;
- ch = 0; /* lint. */
+ ch = 0;
curX = startX;
start = source + rangeStart;
end = start + rangeLength;
@@ -8809,24 +8810,25 @@ TextGetScrollInfoObj(
}
switch ((enum viewUnits) index) {
case VIEW_SCROLL_PAGES:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
- return TKTEXT_SCROLL_ERROR;
+ if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) {
+ return TKTEXT_SCROLL_PAGES;
}
- return TKTEXT_SCROLL_PAGES;
+ break;
case VIEW_SCROLL_PIXELS:
if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[3],
- intPtr) != TCL_OK) {
- return TKTEXT_SCROLL_ERROR;
+ intPtr) == TCL_OK) {
+ return TKTEXT_SCROLL_PIXELS;
}
- return TKTEXT_SCROLL_PIXELS;
+ break;
case VIEW_SCROLL_UNITS:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
- return TKTEXT_SCROLL_ERROR;
+ if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) {
+ return TKTEXT_SCROLL_UNITS;
}
- return TKTEXT_SCROLL_UNITS;
+ break;
+ default:
+ Tcl_Panic("unexpected switch fallthrough");
}
}
- Tcl_Panic("unexpected switch fallthrough");
return TKTEXT_SCROLL_ERROR;
}
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index 41dd4489..bc0da0af 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -18,7 +18,7 @@
*/
#define EI_SEG_SIZE \
- ((unsigned) (Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage)))
+ ((unsigned)(Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage)))
/*
* Prototypes for functions defined in this file:
@@ -117,7 +117,7 @@ static const Tk_OptionSpec optionSpecs[] = {
int
TkTextImageCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -125,7 +125,7 @@ TkTextImageCmd(
* objv[1] is "image". */
{
int idx;
- register TkTextSegment *eiPtr;
+ TkTextSegment *eiPtr;
TkTextIndex index;
static const char *const optionStrings[] = {
"cget", "configure", "create", "names", NULL
@@ -161,7 +161,7 @@ TkTextImageCmd(
Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", NULL);
return TCL_ERROR;
}
- objPtr = Tk_GetOptionValue(interp, (char *) &eiPtr->body.ei,
+ objPtr = Tk_GetOptionValue(interp, (char *)&eiPtr->body.ei,
eiPtr->body.ei.optionTable, objv[4], textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -188,7 +188,7 @@ TkTextImageCmd(
}
if (objc <= 5) {
Tcl_Obj *objPtr = Tk_GetOptionInfo(interp,
- (char *) &eiPtr->body.ei, eiPtr->body.ei.optionTable,
+ (char *)&eiPtr->body.ei, eiPtr->body.ei.optionTable,
(objc == 5) ? objv[4] : NULL, textPtr->tkwin);
if (objPtr == NULL) {
@@ -242,7 +242,7 @@ TkTextImageCmd(
* Create the new image segment and initialize it.
*/
- eiPtr = ckalloc(EI_SEG_SIZE);
+ eiPtr = (TkTextSegment *)ckalloc(EI_SEG_SIZE);
eiPtr->typePtr = &tkTextEmbImageType;
eiPtr->size = 1;
eiPtr->body.ei.sharedTextPtr = textPtr->sharedTextPtr;
@@ -279,19 +279,18 @@ TkTextImageCmd(
Tcl_HashEntry *hPtr;
Tcl_Obj *resultObj;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, NULL);
- return TCL_ERROR;
+ if (objc == 3) {
+ resultObj = Tcl_NewObj();
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
+ &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1));
+ }
+ Tcl_SetObjResult(interp, resultObj);
+ return TCL_OK;
}
- resultObj = Tcl_NewObj();
- for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
- &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
- -1));
- }
- Tcl_SetObjResult(interp, resultObj);
- return TCL_OK;
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ break;
}
default:
Tcl_Panic("unexpected switch fallthrough");
@@ -337,7 +336,7 @@ EmbImageConfigure(
int conflict = 0; /* True if we have a name conflict */
size_t len; /* length of image name */
- if (Tk_SetOptions(textPtr->interp, (char *) &eiPtr->body.ei,
+ if (Tk_SetOptions(textPtr->interp, (char *)&eiPtr->body.ei,
eiPtr->body.ei.optionTable,
objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
@@ -389,7 +388,7 @@ EmbImageConfigure(
len = strlen(name);
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
&search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- char *haveName =
+ char *haveName = (char *)
Tcl_GetHashKey(&textPtr->sharedTextPtr->imageTable, hPtr);
if (strncmp(name, haveName, len) == 0) {
@@ -419,7 +418,7 @@ EmbImageConfigure(
&dummy);
Tcl_SetHashValue(hPtr, eiPtr);
Tcl_SetObjResult(textPtr->interp, Tcl_NewStringObj(name, -1));
- eiPtr->body.ei.name = ckalloc(Tcl_DStringLength(&newName) + 1);
+ eiPtr->body.ei.name = (char *)ckalloc(Tcl_DStringLength(&newName) + 1);
strcpy(eiPtr->body.ei.name, name);
Tcl_DStringFree(&newName);
@@ -444,12 +443,11 @@ EmbImageConfigure(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
EmbImageDeleteProc(
TkTextSegment *eiPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -527,24 +525,23 @@ EmbImageCleanupProc(
*--------------------------------------------------------------
*/
- /*ARGSUSED*/
static int
EmbImageLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */
int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(int), /* Chunk must not include more than this many
* characters. */
int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Wrap mode to use for line:
+ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr)
+ TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -619,7 +616,7 @@ EmbImageLayoutProc(
static void
EmbImageCheckProc(
TkTextSegment *eiPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
if (eiPtr->nextPtr == NULL) {
Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line");
@@ -660,12 +657,12 @@ EmbImageDisplayProc(
* (x-position is in the chunk itself). */
int lineHeight, /* Total height of line. */
int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing. */
+ TCL_UNUSED(Display *), /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw */
- int screenY) /* Y-coordinate in text window that
+ TCL_UNUSED(int)) /* Y-coordinate in text window that
* corresponds to y. */
{
- TkTextSegment *eiPtr = chunkPtr->clientData;
+ TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData;
int lineX, imageX, imageY, width, height;
Tk_Image image;
@@ -713,9 +710,9 @@ EmbImageDisplayProc(
static void
EmbImageBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
@@ -729,7 +726,7 @@ EmbImageBboxProc(
int *heightPtr) /* Gets filled in with height of image, in
* pixels. */
{
- TkTextSegment *eiPtr = chunkPtr->clientData;
+ TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData;
Tk_Image image;
image = eiPtr->body.ei.image;
@@ -794,7 +791,7 @@ TkTextImageIndex(
if (hPtr == NULL) {
return 0;
}
- eiPtr = Tcl_GetHashValue(hPtr);
+ eiPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = eiPtr->body.ei.linePtr;
indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr);
@@ -821,14 +818,17 @@ TkTextImageIndex(
static void
EmbImageProc(
ClientData clientData, /* Pointer to widget record. */
- int x, int y, /* Upper left pixel (within image) that must
+ TCL_UNUSED(int), /* Upper left pixel (within image) that must
* be redisplayed. */
- int width, int height, /* Dimensions of area to redisplay (may be
+ TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Dimensions of area to redisplay (may be
* <= 0). */
- int imgWidth, int imgHeight)/* New dimensions of image. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),/* New dimensions of image. */
+ TCL_UNUSED(int))
{
- TkTextSegment *eiPtr = clientData;
+ TkTextSegment *eiPtr = (TkTextSegment *)clientData;
TkTextIndex index;
index.tree = eiPtr->body.ei.sharedTextPtr->tree;
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 056902a2..16283899 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -11,9 +11,9 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
#include "tkText.h"
+#include "default.h"
/*
* Index to use to select last character in line (very large integer):
@@ -62,7 +62,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr);
#define GET_INDEXEPOCH(objPtr) \
(PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2))
#define SET_TEXTINDEX(objPtr, indexPtr) \
- ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr))
+ ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(indexPtr))
#define SET_INDEXEPOCH(objPtr, epoch) \
((objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(epoch))
@@ -107,7 +107,7 @@ DupTextIndexInternalRep(
int epoch;
TkTextIndex *dupIndexPtr, *indexPtr;
- dupIndexPtr = ckalloc(sizeof(TkTextIndex));
+ dupIndexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex));
indexPtr = GET_TEXTINDEX(srcPtr);
epoch = GET_INDEXEPOCH(srcPtr);
@@ -139,7 +139,7 @@ UpdateStringOfTextIndex(
len = TkTextPrintIndex(indexPtr->textPtr, indexPtr, buffer);
- objPtr->bytes = ckalloc(len + 1);
+ objPtr->bytes = (char *)ckalloc(len + 1);
strcpy(objPtr->bytes, buffer);
objPtr->length = len;
}
@@ -176,7 +176,7 @@ MakeObjIndex(
* position. */
const TkTextIndex *origPtr) /* Pointer to index. */
{
- TkTextIndex *indexPtr = ckalloc(sizeof(TkTextIndex));
+ TkTextIndex *indexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex));
indexPtr->tree = origPtr->tree;
indexPtr->linePtr = origPtr->linePtr;
@@ -436,7 +436,7 @@ TkTextMakeByteIndex(
*/
start = segPtr->body.chars + (byteIndex - index);
- p = Tcl_UtfPrev(start, segPtr->body.chars);
+ p = TkUtfPrev(start, segPtr->body.chars);
p += TkUtfToUniChar(p, &ch);
indexPtr->byteIndex += p - start;
}
@@ -477,7 +477,7 @@ TkTextMakeCharIndex(
int charIndex, /* Index of desired character. */
TkTextIndex *indexPtr) /* Structure to fill in. */
{
- register TkTextSegment *segPtr;
+ TkTextSegment *segPtr;
char *p, *start, *end;
int index, offset;
int ch;
@@ -816,7 +816,7 @@ GetIndex(
hPtr = Tcl_FindHashEntry(&sharedPtr->tagTable, tagName);
*p = '.';
if (hPtr != NULL) {
- tagPtr = Tcl_GetHashValue(hPtr);
+ tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr);
}
}
@@ -832,7 +832,7 @@ GetIndex(
if (tagPtr == textPtr->selTagPtr) {
tagName = "sel";
} else if (hPtr != NULL) {
- tagName = Tcl_GetHashKey(&sharedPtr->tagTable, hPtr);
+ tagName = (const char *)Tcl_GetHashKey(&sharedPtr->tagTable, hPtr);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"text doesn't contain any characters tagged with \"%s\"",
@@ -923,7 +923,7 @@ GetIndex(
}
if ((string[0] == 'e')
&& (strncmp(string, "end",
- (size_t) (endOfBase-Tcl_DStringValue(©))) == 0)) {
+ endOfBase-Tcl_DStringValue(©)) == 0)) {
/*
* Base position is end of text.
*/
@@ -1151,7 +1151,7 @@ ForwBack(
* or "-" that starts modifier. */
TkTextIndex *indexPtr) /* Index to update as specified in string. */
{
- register const char *p, *units;
+ const char *p, *units;
char *end;
int count, lineIndex, modifier;
size_t length;
@@ -1499,7 +1499,7 @@ TkTextIndexForwChars(
return;
}
if (checkElided) {
- infoPtr = ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, srcPtr, infoPtr);
}
@@ -1597,7 +1597,7 @@ TkTextIndexForwChars(
charCount--;
}
} else if (type & COUNT_INDICES) {
- if (charCount < segPtr->size - byteOffset) {
+ if (charCount + byteOffset < segPtr->size) {
dstPtr->byteIndex += charCount;
goto forwardCharDone;
}
@@ -1767,7 +1767,7 @@ TkTextIndexCount(
seg2Ptr = TkTextIndexToSeg(indexPtr2, &maxBytes);
if (checkElided) {
- infoPtr = ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, indexPtr1, infoPtr);
}
@@ -1844,12 +1844,12 @@ TkTextIndexCount(
if (segPtr->typePtr == &tkTextCharType) {
int byteLen = segPtr->size - byteOffset;
- register unsigned char *str = (unsigned char *)
+ unsigned char *str = (unsigned char *)
segPtr->body.chars + byteOffset;
- register int i;
+ int i;
if (segPtr == seg2Ptr) {
- if (byteLen > (maxBytes - byteOffset)) {
+ if (byteLen + byteOffset > maxBytes) {
byteLen = maxBytes - byteOffset;
}
}
@@ -1879,7 +1879,7 @@ TkTextIndexCount(
int byteLen = segPtr->size - byteOffset;
if (segPtr == seg2Ptr) {
- if (byteLen > (maxBytes - byteOffset)) {
+ if (byteLen + byteOffset > maxBytes) {
byteLen = maxBytes - byteOffset;
}
}
@@ -2025,7 +2025,7 @@ TkTextIndexBackChars(
return;
}
if (checkElided) {
- infoPtr = ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, srcPtr, infoPtr);
}
@@ -2125,7 +2125,7 @@ TkTextIndexBackChars(
if (segPtr->typePtr == &tkTextCharType) {
start = segPtr->body.chars;
end = segPtr->body.chars + segSize;
- for (p = end; ; p = Tcl_UtfPrev(p, start)) {
+ for (p = end; ; p = TkUtfPrev(p, start)) {
if (charCount == 0) {
dstPtr->byteIndex -= (end - p);
goto backwardCharDone;
@@ -2225,7 +2225,7 @@ StartEnd(
{
const char *p;
size_t length;
- register TkTextSegment *segPtr;
+ TkTextSegment *segPtr;
int modifier;
/*
@@ -2366,7 +2366,7 @@ StartEnd(
}
if (offset > 0) {
chSize = (segPtr->body.chars + offset
- - Tcl_UtfPrev(segPtr->body.chars + offset,
+ - TkUtfPrev(segPtr->body.chars + offset,
segPtr->body.chars));
}
firstChar = 0;
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index 6a41c77d..dcd7008c 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -19,7 +19,7 @@
* Macro that determines the size of a mark segment:
*/
-#define MSEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \
+#define MSEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
+ sizeof(TkTextMark)))
/*
@@ -93,7 +93,7 @@ const Tk_SegType tkTextLeftMarkType = {
int
TkTextMarkCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -147,7 +147,7 @@ TkTextMarkCmd(
NULL);
return TCL_ERROR;
}
- markPtr = Tcl_GetHashValue(hPtr);
+ markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
}
if (objc == 4) {
const char *typeStr;
@@ -162,10 +162,10 @@ TkTextMarkCmd(
}
str = Tcl_GetStringFromObj(objv[4],&length);
c = str[0];
- if ((c == 'l') && (strncmp(str, "left", (unsigned) length) == 0)) {
+ if ((c == 'l') && (strncmp(str, "left", length) == 0)) {
newTypePtr = &tkTextLeftMarkType;
} else if ((c == 'r') &&
- (strncmp(str, "right", (unsigned) length) == 0)) {
+ (strncmp(str, "right", length) == 0)) {
newTypePtr = &tkTextRightMarkType;
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -194,7 +194,7 @@ TkTextMarkCmd(
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->markTable,
&search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
+ (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
-1));
}
Tcl_SetObjResult(interp, resultObj);
@@ -229,7 +229,7 @@ TkTextMarkCmd(
hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable,
Tcl_GetString(objv[i]));
if (hPtr != NULL) {
- markPtr = Tcl_GetHashValue(hPtr);
+ markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
/*
* Special case not needed with peer widgets.
@@ -290,7 +290,7 @@ TkTextSetMark(
widgetSpecific = 0;
hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name,
&isNew);
- markPtr = Tcl_GetHashValue(hPtr);
+ markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
}
if (!isNew) {
/*
@@ -330,7 +330,7 @@ TkTextSetMark(
}
TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
} else {
- markPtr = ckalloc(MSEG_SIZE);
+ markPtr = (TkTextSegment *)ckalloc(MSEG_SIZE);
markPtr->typePtr = &tkTextRightMarkType;
markPtr->size = 0;
markPtr->body.mark.textPtr = textPtr;
@@ -452,7 +452,7 @@ TkTextMarkNameToIndex(
if (hPtr == NULL) {
return TCL_ERROR;
}
- segPtr = Tcl_GetHashValue(hPtr);
+ segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
}
TkTextMarkSegToIndex(textPtr, segPtr, indexPtr);
@@ -499,12 +499,11 @@ TkTextMarkNameToIndex(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
MarkDeleteProc(
- TkTextSegment *segPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextSegment *), /* Segment being deleted. */
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -559,18 +558,18 @@ MarkCleanupProc(
static int
MarkLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */
- int offset, /* Offset within segPtr corresponding to
+ TCL_UNUSED(int), /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX, /* Chunk must not occupy pixels at this
+ TCL_UNUSED(int), /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(int), /* Chunk must not include more than this many
* characters. */
- int noCharsYet, /* Non-zero means no characters have been
+ TCL_UNUSED(int), /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Not used. */
- register TkTextDispChunk *chunkPtr)
+ TCL_UNUSED(TkWrapMode), /* Not used. */
+ TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -615,19 +614,18 @@ MarkLayoutProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
void
TkTextInsertDisplayProc(
TkText *textPtr, /* The current text widget. */
- TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ TCL_UNUSED(TkTextDispChunk *), /* Chunk that is to be drawn. */
int x, /* X-position in dst at which to draw this
* chunk (may differ from the x-position in
* the chunk because of scrolling). */
int y, /* Y-position at which to draw this chunk in
* dst (x-position is in the chunk itself). */
int height, /* Total height of line. */
- int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing. */
+ TCL_UNUSED(int), /* Offset of baseline from y. */
+ TCL_UNUSED(Display *), /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw chunk. */
int screenY) /* Y-coordinate in text window that
* corresponds to y. */
@@ -721,11 +719,10 @@ TkTextInsertDisplayProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
InsertUndisplayProc(
- TkText *textPtr, /* Overall information about text widget. */
- TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
+ TCL_UNUSED(TkText *), /* Overall information about text widget. */
+ TCL_UNUSED(TkTextDispChunk *)) /* Chunk that is about to be freed. */
{
return;
}
@@ -809,7 +806,7 @@ MarkFindNext(
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
- register TkTextSegment *segPtr;
+ TkTextSegment *segPtr;
int offset;
const char *string = Tcl_GetString(obj);
@@ -830,7 +827,7 @@ MarkFindNext(
* position.
*/
- segPtr = Tcl_GetHashValue(hPtr);
+ segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
TkTextMarkSegToIndex(textPtr, segPtr, &index);
segPtr = segPtr->nextPtr;
} else {
@@ -900,7 +897,7 @@ MarkFindPrev(
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
- register TkTextSegment *segPtr, *seg2Ptr, *prevPtr;
+ TkTextSegment *segPtr, *seg2Ptr, *prevPtr;
int offset;
const char *string = Tcl_GetString(obj);
@@ -919,7 +916,7 @@ MarkFindPrev(
* position.
*/
- segPtr = Tcl_GetHashValue(hPtr);
+ segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
TkTextMarkSegToIndex(textPtr, segPtr, &index);
} else {
/*
@@ -1012,7 +1009,7 @@ GetMarkName(
return NULL;
} else {
- markName = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ markName = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
segPtr->body.mark.hPtr);
}
return Tcl_NewStringObj(markName, -1);
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index 0d223fee..c15773e9 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -12,9 +12,9 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
#include "tkText.h"
+#include "default.h"
/*
* The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap
@@ -137,7 +137,7 @@ static void TagBindEvent(TkText *textPtr, XEvent *eventPtr,
int
TkTextTagCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -154,7 +154,7 @@ TkTextTagCmd(
TAG_REMOVE
};
int optionIndex, i;
- register TkTextTag *tagPtr;
+ TkTextTag *tagPtr;
TkTextIndex index1, index2;
if (objc < 3) {
@@ -343,7 +343,7 @@ TkTextTagCmd(
if (tagPtr == NULL) {
return TCL_ERROR;
}
- objPtr = Tk_GetOptionValue(interp, (char *) tagPtr,
+ objPtr = Tk_GetOptionValue(interp, (char *)tagPtr,
tagPtr->optionTable, objv[4], textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -362,7 +362,7 @@ TkTextTagCmd(
}
tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), &newTag);
if (objc <= 5) {
- Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *) tagPtr,
+ Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *)tagPtr,
tagPtr->optionTable,
(objc == 5) ? objv[4] : NULL, textPtr->tkwin);
@@ -374,7 +374,7 @@ TkTextTagCmd(
} else {
int result = TCL_OK;
- if (Tk_SetOptions(interp, (char *) tagPtr, tagPtr->optionTable,
+ if (Tk_SetOptions(interp, (char *)tagPtr, tagPtr->optionTable,
objc-4, objv+4, textPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
}
@@ -584,7 +584,7 @@ TkTextTagCmd(
continue;
}
- tagPtr = Tcl_GetHashValue(hPtr);
+ tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr);
if (tagPtr == textPtr->selTagPtr) {
continue;
}
@@ -645,12 +645,12 @@ TkTextTagCmd(
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
- arrayPtr = ckalloc(textPtr->sharedTextPtr->numTags
+ arrayPtr = (TkTextTag **)ckalloc(textPtr->sharedTextPtr->numTags
* sizeof(TkTextTag *));
for (i=0, hPtr = Tcl_FirstHashEntry(
&textPtr->sharedTextPtr->tagTable, &search);
hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
- arrayPtr[i] = Tcl_GetHashValue(hPtr);
+ arrayPtr[i] = (TkTextTag *)Tcl_GetHashValue(hPtr);
}
/*
@@ -986,7 +986,7 @@ TkTextCreateTag(
int *newTag) /* If non-NULL, then return 1 if new, or 0 if
* already exists. */
{
- register TkTextTag *tagPtr;
+ TkTextTag *tagPtr;
Tcl_HashEntry *hPtr = NULL;
int isNew;
const char *name;
@@ -1009,9 +1009,9 @@ TkTextCreateTag(
*newTag = isNew;
}
if (!isNew) {
- return Tcl_GetHashValue(hPtr);
+ return (TkTextTag *)Tcl_GetHashValue(hPtr);
}
- name = Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr);
+ name = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr);
}
/*
@@ -1019,7 +1019,7 @@ TkTextCreateTag(
* to it to the hash table entry.
*/
- tagPtr = ckalloc(sizeof(TkTextTag));
+ tagPtr = (TkTextTag *)ckalloc(sizeof(TkTextTag));
tagPtr->name = name;
tagPtr->textPtr = NULL;
tagPtr->toggleCount = 0;
@@ -1118,7 +1118,7 @@ FindTag(
hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable,
Tcl_GetString(tagName));
if (hPtr != NULL) {
- return Tcl_GetHashValue(hPtr);
+ return (TkTextTag *)Tcl_GetHashValue(hPtr);
}
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1158,7 +1158,7 @@ FindTag(
void
TkTextDeleteTag(
TkText *textPtr, /* Info about overall widget. */
- register TkTextTag *tagPtr) /* Tag being deleted. */
+ TkTextTag *tagPtr) /* Tag being deleted. */
{
TkTextIndex first, last;
@@ -1216,7 +1216,7 @@ TkTextDeleteTag(
void
TkTextFreeTag(
TkText *textPtr, /* Info about overall widget. */
- register TkTextTag *tagPtr) /* Tag being deleted. */
+ TkTextTag *tagPtr) /* Tag being deleted. */
{
int i;
@@ -1295,7 +1295,7 @@ SortTags(
TkTextTag **tagArrayPtr) /* Pointer to array of pointers. */
{
int i, j, prio;
- register TkTextTag **tagPtrPtr;
+ TkTextTag **tagPtrPtr;
TkTextTag **maxPtrPtr, *tmp;
if (numTags < 2) {
@@ -1379,7 +1379,7 @@ ChangeTagPriority(
int prio) /* New priority for tag. */
{
int low, high, delta;
- register TkTextTag *tagPtr2;
+ TkTextTag *tagPtr2;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
@@ -1412,7 +1412,7 @@ ChangeTagPriority(
}
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->tagTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- tagPtr2 = Tcl_GetHashValue(hPtr);
+ tagPtr2 = (TkTextTag *)Tcl_GetHashValue(hPtr);
if ((tagPtr2->priority >= low) && (tagPtr2->priority <= high)) {
tagPtr2->priority += delta;
}
@@ -1440,10 +1440,10 @@ ChangeTagPriority(
void
TkTextBindProc(
- ClientData clientData, /* Pointer to canvas structure. */
+ ClientData clientData, /* Pointer to text widget structure. */
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
- TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
int repick = 0;
textPtr->refCount++;
@@ -1529,7 +1529,7 @@ TkTextBindProc(
void
TkTextPickCurrent(
- register TkText *textPtr, /* Text widget in which to select current
+ TkText *textPtr, /* Text widget in which to select current
* character. */
XEvent *eventPtr) /* Event describing location of mouse cursor.
* Must be EnterWindow, LeaveWindow,
@@ -1632,8 +1632,8 @@ TkTextPickCurrent(
SortTags(textPtr->numCurTags, textPtr->curTagArrayPtr);
if (numNewTags > 0) {
size = numNewTags * sizeof(TkTextTag *);
- copyArrayPtr = ckalloc(size);
- memcpy(copyArrayPtr, newArrayPtr, (size_t) size);
+ copyArrayPtr = (TkTextTag **)ckalloc(size);
+ memcpy(copyArrayPtr, newArrayPtr, size);
for (i = 0; i < textPtr->numCurTags; i++) {
for (j = 0; j < numNewTags; j++) {
if (textPtr->curTagArrayPtr[i] == copyArrayPtr[j]) {
@@ -1736,7 +1736,7 @@ TagBindEvent(
*/
if (numTags > NUM_BIND_TAGS) {
- nameArrPtr = ckalloc(numTags * sizeof(const char *));
+ nameArrPtr = (const char **)ckalloc(numTags * sizeof(const char *));
} else {
nameArrPtr = nameArray;
}
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index c9fc20f0..c9f34e43 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -22,20 +22,20 @@
static void EmbWinRequestProc(ClientData clientData,
Tk_Window tkwin);
-static void EmbWinLostSlaveProc(ClientData clientData,
+static void EmbWinLostContentProc(ClientData clientData,
Tk_Window tkwin);
static const Tk_GeomMgr textGeomType = {
"text", /* name */
EmbWinRequestProc, /* requestProc */
- EmbWinLostSlaveProc, /* lostSlaveProc */
+ EmbWinLostContentProc, /* lostSlaveProc */
};
/*
* Macro that determines the size of an embedded window segment:
*/
-#define EW_SEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \
+#define EW_SEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
+ sizeof(TkTextEmbWindow)))
/*
@@ -133,7 +133,7 @@ static const Tk_OptionSpec optionSpecs[] = {
int
TkTextWindowCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -147,7 +147,7 @@ TkTextWindowCmd(
enum windOptions {
WIND_CGET, WIND_CONFIGURE, WIND_CREATE, WIND_NAMES
};
- register TkTextSegment *ewPtr;
+ TkTextSegment *ewPtr;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?");
@@ -160,7 +160,6 @@ TkTextWindowCmd(
switch ((enum windOptions) optionIndex) {
case WIND_CGET: {
TkTextIndex index;
- TkTextSegment *ewPtr;
Tcl_Obj *objPtr;
TkTextEmbWindowClient *client;
@@ -191,7 +190,7 @@ TkTextWindowCmd(
ewPtr->body.ew.tkwin = NULL;
}
- objPtr = Tk_GetOptionValue(interp, (char *) &ewPtr->body.ew,
+ objPtr = Tk_GetOptionValue(interp, (char *)&ewPtr->body.ew,
ewPtr->body.ew.optionTable, objv[4], textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -201,7 +200,6 @@ TkTextWindowCmd(
}
case WIND_CONFIGURE: {
TkTextIndex index;
- TkTextSegment *ewPtr;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 3, objv, "index ?-option value ...?");
@@ -233,7 +231,7 @@ TkTextWindowCmd(
ewPtr->body.ew.tkwin = NULL;
}
- objPtr = Tk_GetOptionInfo(interp, (char *) &ewPtr->body.ew,
+ objPtr = Tk_GetOptionInfo(interp, (char *)&ewPtr->body.ew,
ewPtr->body.ew.optionTable, (objc == 5) ? objv[4] : NULL,
textPtr->tkwin);
if (objPtr == NULL) {
@@ -290,7 +288,7 @@ TkTextWindowCmd(
* Create the new window segment and initialize it.
*/
- ewPtr = ckalloc(EW_SEG_SIZE);
+ ewPtr = (TkTextSegment *)ckalloc(EW_SEG_SIZE);
ewPtr->typePtr = &tkTextEmbWindowType;
ewPtr->size = 1;
ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr;
@@ -302,7 +300,7 @@ TkTextWindowCmd(
ewPtr->body.ew.stretch = 0;
ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs);
- client = ckalloc(sizeof(TkTextEmbWindowClient));
+ client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient));
client->next = NULL;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -345,7 +343,7 @@ TkTextWindowCmd(
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->windowTable,
&search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
+ (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
-1));
}
Tcl_SetObjResult(interp, resultObj);
@@ -403,7 +401,7 @@ EmbWinConfigure(
}
oldWindow = ewPtr->body.ew.tkwin;
- if (Tk_SetOptions(textPtr->interp, (char *) &ewPtr->body.ew,
+ if (Tk_SetOptions(textPtr->interp, (char *)&ewPtr->body.ew,
ewPtr->body.ew.optionTable, objc, objv, textPtr->tkwin, NULL,
NULL) != TCL_OK) {
return TCL_ERROR;
@@ -443,7 +441,7 @@ EmbWinConfigure(
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- badMaster:
+ badContainer:
Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf(
"can't embed %s in %s",
Tk_PathName(ewPtr->body.ew.tkwin),
@@ -459,7 +457,7 @@ EmbWinConfigure(
}
if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin)
|| (ewPtr->body.ew.tkwin == textPtr->tkwin)) {
- goto badMaster;
+ goto badContainer;
}
if (client == NULL) {
@@ -467,7 +465,7 @@ EmbWinConfigure(
* Have to make the new client.
*/
- client = ckalloc(sizeof(TkTextEmbWindowClient));
+ client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient));
client->next = ewPtr->body.ew.clients;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -526,7 +524,7 @@ EmbWinStructureProc(
ClientData clientData, /* Pointer to record describing window item. */
XEvent *eventPtr) /* Describes what just happened. */
{
- TkTextEmbWindowClient *client = clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
Tcl_HashEntry *hPtr;
@@ -573,13 +571,12 @@ EmbWinStructureProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
EmbWinRequestProc(
ClientData clientData, /* Pointer to record for window item. */
- Tk_Window tkwin) /* Window that changed its desired size. */
+ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */
{
- TkTextEmbWindowClient *client = clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
@@ -594,9 +591,9 @@ EmbWinRequestProc(
/*
*--------------------------------------------------------------
*
- * EmbWinLostSlaveProc --
+ * EmbWinLostContentProc --
*
- * This function is invoked by the Tk geometry manager when a slave
+ * This function is invoked by the Tk geometry manager when a content
* window managed by a text widget is claimed away by another geometry
* manager.
*
@@ -611,12 +608,12 @@ EmbWinRequestProc(
*/
static void
-EmbWinLostSlaveProc(
+EmbWinLostContentProc(
ClientData clientData, /* Pointer to record describing window item. */
Tk_Window tkwin) /* Window that was claimed away by another
* geometry manager. */
{
- TkTextEmbWindowClient *client = clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
Tcl_HashEntry *hPtr;
@@ -736,12 +733,11 @@ TkTextWinFreeClient(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
EmbWinDeleteProc(
TkTextSegment *ewPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -816,24 +812,23 @@ EmbWinCleanupProc(
*--------------------------------------------------------------
*/
- /*ARGSUSED*/
static int
EmbWinLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */
int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(int), /* Chunk must not include more than this many
* characters. */
int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Wrap mode to use for line:
+ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr)
+ TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -936,12 +931,12 @@ EmbWinLayoutProc(
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- goto badMaster;
+ goto badContainer;
}
}
if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin)
|| (textPtr->tkwin == ewPtr->body.ew.tkwin)) {
- badMaster:
+ badContainer:
Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf(
"can't embed %s relative to %s",
Tk_PathName(ewPtr->body.ew.tkwin),
@@ -959,7 +954,7 @@ EmbWinLayoutProc(
* now need to add to our client list.
*/
- client = ckalloc(sizeof(TkTextEmbWindowClient));
+ client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient));
client->next = ewPtr->body.ew.clients;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -1052,7 +1047,7 @@ EmbWinLayoutProc(
static void
EmbWinCheckProc(
TkTextSegment *ewPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
if (ewPtr->nextPtr == NULL) {
Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line");
@@ -1087,20 +1082,20 @@ TkTextEmbWinDisplayProc(
int x, /* X-position in dst at which to draw this
* chunk (differs from the x-position in the
* chunk because of scrolling). */
- int y, /* Top of rectangular bounding box for line:
+ TCL_UNUSED(int), /* Top of rectangular bounding box for line:
* tells where to draw this chunk in dst
* (x-position is in the chunk itself). */
int lineHeight, /* Total height of line. */
int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing (unused). */
- Drawable dst, /* Pixmap or window in which to draw
+ TCL_UNUSED(Display *), /* Display to use for drawing (unused). */
+ TCL_UNUSED(Drawable), /* Pixmap or window in which to draw
* (unused). */
int screenY) /* Y-coordinate in text window that
* corresponds to y. */
{
int lineX, windowX, windowY, width, height;
Tk_Window tkwin;
- TkTextSegment *ewPtr = chunkPtr->clientData;
+ TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
if (client == NULL) {
@@ -1180,7 +1175,7 @@ EmbWinUndisplayProc(
TkText *textPtr, /* Overall information about text widget. */
TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
- TkTextSegment *ewPtr = chunkPtr->clientData;
+ TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
if (client == NULL) {
@@ -1228,7 +1223,7 @@ static void
EmbWinBboxProc(
TkText *textPtr, /* Information about text widget. */
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
@@ -1243,7 +1238,7 @@ EmbWinBboxProc(
* pixels. */
{
Tk_Window tkwin;
- TkTextSegment *ewPtr = chunkPtr->clientData;
+ TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
if (client == NULL) {
@@ -1305,7 +1300,7 @@ static void
EmbWinDelayedUnmap(
ClientData clientData) /* Token for the window to be unmapped. */
{
- TkTextEmbWindowClient *client = clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
if (!client->displayed && (client->tkwin != NULL)) {
if (client->textPtr->tkwin != Tk_Parent(client->tkwin)) {
@@ -1353,7 +1348,7 @@ TkTextWindowIndex(
return 0;
}
- ewPtr = Tcl_GetHashValue(hPtr);
+ ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = ewPtr->body.ew.linePtr;
indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr);
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 8e3e2ee7..00ac7bea 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -299,6 +299,7 @@ TkOffsetParseProc(
tsoffset.flags = INT_MAX;
goto goodTSOffset;
}
+ break;
case 'w':
if (value[1] != '\0') {goto badTSOffset;}
tsoffset.flags = TK_OFFSET_LEFT|TK_OFFSET_MIDDLE;
@@ -1132,7 +1133,7 @@ TkMakeEnsemble(
dictObj = Tcl_NewObj();
for (i = 0; map[i].name != NULL ; ++i) {
- Tcl_Obj *nameObj, *fqdnObj;
+ Tcl_Obj *fqdnObj;
nameObj = Tcl_NewStringObj(map[i].name, -1);
fqdnObj = Tcl_NewStringObj(Tcl_DStringValue(&ds),
@@ -1177,7 +1178,7 @@ TkSendVirtualEvent(
const char *eventName,
Tcl_Obj *detail)
{
- union {XEvent general; XVirtualEvent virtual;} event;
+ union {XEvent general; XVirtualEvent virt;} event;
memset(&event, 0, sizeof(event));
event.general.xany.type = VirtualEvent;
@@ -1185,10 +1186,8 @@ TkSendVirtualEvent(
event.general.xany.send_event = False;
event.general.xany.window = Tk_WindowId(target);
event.general.xany.display = Tk_Display(target);
- event.virtual.name = Tk_GetUid(eventName);
- if (detail != NULL) {
- event.virtual.user_data = detail;
- }
+ event.virt.name = Tk_GetUid(eventName);
+ event.virt.user_data = detail;
Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
}
@@ -1216,26 +1215,23 @@ TkSendVirtualEvent(
int
TkUtfToUniChar(
const char *src, /* The UTF-8 string. */
- int *chPtr) /* Filled with the Tcl_UniChar represented by
+ int *chPtr) /* Filled with the Unicode value represented by
* the UTF-8 string. */
{
Tcl_UniChar uniChar = 0;
int len = Tcl_UtfToUniChar(src, &uniChar);
- if ((uniChar & 0xfc00) == 0xd800) {
- Tcl_UniChar high = uniChar;
+ if ((sizeof(Tcl_UniChar) == 2) && ((uniChar & 0xFC00) == 0xD800)) {
+ Tcl_UniChar low = uniChar;
/* This can only happen if Tcl is compiled with TCL_UTF_MAX=4,
* or when a high surrogate character is detected in UTF-8 form */
- int len2 = Tcl_UtfToUniChar(src+len, &uniChar);
- if ((uniChar & 0xfc00) == 0xdc00) {
- *chPtr = (((high & 0x3ff) << 10) | (uniChar & 0x3ff)) + 0x10000;
- len += len2;
- } else {
- *chPtr = high;
+ int len2 = Tcl_UtfToUniChar(src+len, &low);
+ if ((low & 0xFC00) == 0xDC00) {
+ *chPtr = (((uniChar & 0x3FF) << 10) | (low & 0x3FF)) + 0x10000;
+ return len + len2;
}
- } else {
- *chPtr = uniChar;
}
+ *chPtr = uniChar;
return len;
}
@@ -1244,8 +1240,9 @@ TkUtfToUniChar(
*
* TkUniCharToUtf --
*
- * Almost the same as Tcl_UniCharToUtf but producing 4-byte UTF-8
- * sequences even when TCL_UTF_MAX==3. So, up to 4 bytes might be produced.
+ * Almost the same as Tcl_UniCharToUtf but producing 2 x 3-byte UTF-8
+ * sequences for out-of-bmp characters when TCL_UTF_MAX==3.
+ * So, up to 6 bytes might be produced.
*
* Results:
* *buf is filled with the UTF-8 string, and the return value is the
@@ -1259,21 +1256,84 @@ TkUtfToUniChar(
int TkUniCharToUtf(int ch, char *buf)
{
- int size = Tcl_UniCharToUtf(ch, buf);
- if ((((unsigned)(ch - 0x10000) <= 0xFFFFF)) && (size < 4)) {
- /* Hey, this is wrong, we must be running TCL_UTF_MAX==3
- * The best thing we can do is spit out a 4-byte UTF-8 character */
- buf[3] = (char) ((ch | 0x80) & 0xBF);
- buf[2] = (char) (((ch >> 6) | 0x80) & 0xBF);
- buf[1] = (char) (((ch >> 12) | 0x80) & 0xBF);
- buf[0] = (char) ((ch >> 18) | 0xF0);
- size = 4;
+ if ((sizeof(Tcl_UniChar) == 2) && (((unsigned)(ch - 0x10000) <= 0xFFFFF))) {
+ /* Spit out a 4-byte UTF-8 character or 2 x 3-byte UTF-8 characters, depending on Tcl
+ * version and/or TCL_UTF_MAX build value */
+ int len = Tcl_UniCharToUtf(0xD800 | ((ch - 0x10000) >> 10), buf);
+ return len + Tcl_UniCharToUtf(0xDC00 | (ch & 0x7FF), buf + len);
}
- return size;
+ return Tcl_UniCharToUtf(ch, buf);
+}
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkUtfPrev --
+ *
+ * Almost the same as Tcl_UtfPrev.
+ * This function is capable of jumping over a upper/lower surrogate pair.
+ * So, might jump back up to 6 bytes.
+ *
+ * Results:
+ * pointer to the first byte of the current UTF-8 character. A surrogate
+ * pair is also handled as being a single entity.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+const char *
+TkUtfPrev(
+ const char *src, /* The UTF-8 string. */
+ const char *start) /* Start position of string */
+{
+ const char *p = Tcl_UtfPrev(src, start);
+ const char *first = Tcl_UtfPrev(p, start);
+ int ch;
+
+#if TCL_UTF_MAX == 3
+ if ((src - start > 3) && ((src[-1] & 0xC0) == 0x80) && ((src[-2] & 0xC0) == 0x80)
+ && ((src[-3] & 0xC0) == 0x80) && (UCHAR(src[-4]) >= 0xF0)) {
+ return src - 4;
+ }
+#endif
+
+ return (first + TkUtfToUniChar(first, &ch) >= src) ? first : p ;
}
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkUtfAtIndex --
+ *
+ * Returns a pointer to the specified character (not byte) position in
+ * a CESU-8 string. This will never point at a low surrogate.
+ *
+ * Results:
+ * As above.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+const char *
+TkUtfAtIndex(
+ const char *src, /* The UTF-8 string. */
+ int index) /* The position of the desired character. */
+{
+ int ch;
+ const char *p = Tcl_UtfAtIndex(src, index);
+ if ((p > src) && (UCHAR(p[-1]) >= 0xF0)) {
+ --p;
+ return p + TkUtfToUniChar(p, &ch);
+ }
+ return p;
+}
#endif
+
/*
* Local Variables:
* mode: c
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 00fb344b..92c40180 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -13,7 +13,7 @@
*/
#include "tkInt.h"
-
+#include "tkPort.h"
#ifdef _WIN32
#include "tkWinInt.h"
#elif !defined(MAC_OSX_TK)
@@ -124,7 +124,7 @@ static const TkCmd commands[] = {
{"place", Tk_PlaceObjCmd, PASSMAINWINDOW|ISSAFE},
{"raise", Tk_RaiseObjCmd, PASSMAINWINDOW|ISSAFE},
{"selection", Tk_SelectionObjCmd, PASSMAINWINDOW},
- {"tk", (Tcl_ObjCmdProc *) TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE},
+ {"tk", (Tcl_ObjCmdProc *)(void *)TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE},
{"tkwait", Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE},
{"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE},
{"winfo", Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE},
@@ -939,7 +939,7 @@ TkCreateMainWindow(
clientData = NULL;
}
if (cmdPtr->flags & USEINITPROC) {
- ((TkInitProc *) cmdPtr->objProc)(interp, clientData);
+ ((TkInitProc *)(void *)cmdPtr->objProc)(interp, clientData);
} else {
Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc,
clientData, NULL);
@@ -1648,7 +1648,7 @@ Tk_MapWindow(
event.xmap.event = winPtr->window;
event.xmap.window = winPtr->window;
event.xmap.override_redirect = winPtr->atts.override_redirect;
- Tk_HandleEvent(&event);
+ TkpHandleMapOrUnmap((Tk_Window)winPtr, &event);
}
/*
@@ -1810,7 +1810,7 @@ Tk_UnmapWindow(
event.xunmap.event = winPtr->window;
event.xunmap.window = winPtr->window;
event.xunmap.from_configure = False;
- Tk_HandleEvent(&event);
+ TkpHandleMapOrUnmap((Tk_Window)winPtr, &event);
}
}
@@ -2866,7 +2866,7 @@ TkCygwinMainEx(
return 0;
}
tkmainex = (void (*)(int, char **, Tcl_AppInitProc *, Tcl_Interp *))
- GetProcAddress(tkcygwindll, "Tk_MainEx");
+ (void *)GetProcAddress(tkcygwindll, "Tk_MainEx");
if (!tkmainex) {
return 0;
}
@@ -2906,7 +2906,7 @@ Tk_Init(
if (tkcygwindll) {
int (*tkinit)(Tcl_Interp *);
- tkinit = (int(*)(Tcl_Interp *)) GetProcAddress(tkcygwindll,"Tk_Init");
+ tkinit = (int(*)(Tcl_Interp *))(void *)GetProcAddress(tkcygwindll,"Tk_Init");
if (tkinit) {
return tkinit(interp);
}
@@ -2969,7 +2969,7 @@ Tk_SafeInit(
* Current risks:
*
* - No CPU time limit, no memory allocation limits, no color limits.
- * CPU time limits can be imposed by an unsafe master interpreter.
+ * CPU time limits can be imposed by an unsafe parent interpreter.
*
* The actual code called is the same as Tk_Init but Tcl_IsSafe() is
* checked at several places to differentiate the two initialisations.
@@ -2980,7 +2980,7 @@ Tk_SafeInit(
int (*tksafeinit)(Tcl_Interp *);
tksafeinit = (int (*)(Tcl_Interp *))
- GetProcAddress(tkcygwindll, "Tk_SafeInit");
+ (void *)GetProcAddress(tkcygwindll, "Tk_SafeInit");
if (tksafeinit) {
return tksafeinit(interp);
}
@@ -3081,23 +3081,23 @@ Initialize(
if (Tcl_IsSafe(interp)) {
/*
* Get the clearance to start Tk and the "argv" parameters from the
- * master.
+ * parent.
*/
/*
- * Step 1 : find the master and construct the interp name (could be a
+ * Step 1 : find the parent and construct the interp name (could be a
* function if new APIs were ok). We could also construct the path
* while walking, but there is no API to get the name of an interp
* either.
*/
- Tcl_Interp *master = interp;
+ Tcl_Interp *parent = interp;
- while (Tcl_IsSafe(master)) {
- master = Tcl_GetMaster(master);
- if (master == NULL) {
+ while (Tcl_IsSafe(parent)) {
+ parent = Tcl_GetParent(parent);
+ if (parent == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "no controlling master interpreter", -1));
+ "no controlling parent interpreter", -1));
Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_MASTER", NULL);
return TCL_ERROR;
}
@@ -3107,35 +3107,35 @@ Initialize(
* Construct the name (rewalk...)
*/
- code = Tcl_GetInterpPath(master, interp);
+ code = Tcl_GetInterpPath(parent, interp);
if (code != TCL_OK) {
Tcl_Panic("Tcl_GetInterpPath broken!");
}
/*
- * Build the command to eval in trusted master.
+ * Build the command to eval in trusted parent.
*/
cmd = Tcl_NewListObj(2, NULL);
Tcl_ListObjAppendElement(NULL, cmd,
Tcl_NewStringObj("::safe::TkInit", -1));
- Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(master));
+ Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(parent));
/*
- * Step 2 : Eval in the master. The argument is the *reversed* interp
- * path of the slave.
+ * Step 2 : Eval in the parent. The argument is the *reversed* interp
+ * path of the child.
*/
Tcl_IncrRefCount(cmd);
- code = Tcl_EvalObjEx(master, cmd, 0);
+ code = Tcl_EvalObjEx(parent, cmd, 0);
Tcl_DecrRefCount(cmd);
- Tcl_TransferResult(master, code, interp);
+ Tcl_TransferResult(parent, code, interp);
if (code != TCL_OK) {
return code;
}
/*
- * Use the master's result as argv. Note: We don't use the Obj
+ * Use the parent's result as argv. Note: We don't use the Obj
* interfaces to avoid dealing with cross interp refcounting and
* changing the code below.
*/
@@ -3339,7 +3339,7 @@ Initialize(
tcl_findLibrary tk $tk_version $tk_patchLevel tk.tcl TK_LIBRARY tk_library\n\
}\n\
}\n\
-tkInit", -1, 0);
+tkInit", -1, TCL_EVAL_GLOBAL);
}
if (code == TCL_OK) {
/*
diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c
index 706a871c..a7d4a9ae 100644
--- a/generic/ttk/ttkBlink.c
+++ b/generic/ttk/ttkBlink.c
@@ -14,7 +14,7 @@
* Add script-level access to configure application-wide blink rate.
*/
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -57,7 +57,7 @@ static CursorManager *GetCursorManager(Tcl_Interp *interp)
cm->owner = 0;
cm->onTime = DEF_CURSOR_ON_TIME;
cm->offTime = DEF_CURSOR_OFF_TIME;
- Tcl_SetAssocData(interp,cm_key,CursorManagerDeleteProc,(ClientData)cm);
+ Tcl_SetAssocData(interp, cm_key, CursorManagerDeleteProc, cm);
}
return cm;
}
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index 1be7ee60..f4ef7bc8 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -4,8 +4,7 @@
* label, button, checkbutton, radiobutton, and menubutton widgets.
*/
-#include
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -81,9 +80,9 @@ static Tk_OptionSpec BaseOptionSpecs[] =
* Compound base/image options
*/
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- NULL, Tk_Offset(Base,base.compoundObj), -1,
- TK_OPTION_NULL_OK,(ClientData)ttkCompoundStrings,
- GEOMETRY_CHANGED },
+ NULL, Tk_Offset(Base,base.compoundObj), -1,
+ TK_OPTION_NULL_OK, (void *)ttkCompoundStrings,
+ GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-padding", "padding", "Pad",
NULL, Tk_Offset(Base,base.paddingObj), -1,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED},
@@ -103,7 +102,7 @@ static Tk_OptionSpec BaseOptionSpecs[] =
*/
static void TextVariableChanged(void *clientData, const char *value)
{
- Base *basePtr = clientData;
+ Base *basePtr = (Base *)clientData;
Tcl_Obj *newText;
if (WidgetDestroyed(&basePtr->core)) {
@@ -120,9 +119,11 @@ static void TextVariableChanged(void *clientData, const char *value)
}
static void
-BaseInitialize(Tcl_Interp *interp, void *recordPtr)
+BaseInitialize(Tcl_Interp *dummy, void *recordPtr)
{
- Base *basePtr = recordPtr;
+ Base *basePtr = (Base *)recordPtr;
+ (void)dummy;
+
basePtr->base.textVariableTrace = 0;
basePtr->base.imageSpec = NULL;
}
@@ -130,7 +131,7 @@ BaseInitialize(Tcl_Interp *interp, void *recordPtr)
static void
BaseCleanup(void *recordPtr)
{
- Base *basePtr = recordPtr;
+ Base *basePtr = (Base *)recordPtr;
if (basePtr->base.textVariableTrace)
Ttk_UntraceVariable(basePtr->base.textVariableTrace);
if (basePtr->base.imageSpec)
@@ -143,12 +144,19 @@ BaseImageChanged(
int imageWidth, int imageHeight)
{
Base *basePtr = (Base *)clientData;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+ (void)imageWidth;
+ (void)imageHeight;
+
TtkResizeWidget(&basePtr->core);
}
static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Base *basePtr = recordPtr;
+ Base *basePtr = (Base *)recordPtr;
Tcl_Obj *textVarName = basePtr->base.textVariableObj;
Ttk_TraceHandle *vt = 0;
Ttk_ImageSpec *imageSpec = NULL;
@@ -191,10 +199,12 @@ error:
}
static int
-BasePostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
+BasePostConfigure(Tcl_Interp *dummy, void *recordPtr, int mask)
{
- Base *basePtr = recordPtr;
+ Base *basePtr = (Base *)recordPtr;
int status = TCL_OK;
+ (void)dummy;
+ (void)mask;
if (basePtr->base.textVariableTrace) {
status = Ttk_FireTrace(basePtr->base.textVariableTrace);
@@ -316,7 +326,7 @@ static Tk_OptionSpec ButtonOptionSpecs[] =
"", Tk_Offset(Button, button.commandObj), -1, 0,0,0},
{TK_OPTION_STRING_TABLE, "-default", "default", "Default",
"normal", Tk_Offset(Button, button.defaultStateObj), -1,
- 0, (ClientData) ttkDefaultStrings, DEFAULTSTATE_CHANGED},
+ 0, (void *)ttkDefaultStrings, DEFAULTSTATE_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
@@ -324,7 +334,7 @@ static Tk_OptionSpec ButtonOptionSpecs[] =
static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Button *buttonPtr = recordPtr;
+ Button *buttonPtr = (Button *)recordPtr;
if (BaseConfigure(interp, recordPtr, mask) != TCL_OK) {
return TCL_ERROR;
@@ -352,7 +362,7 @@ static int
ButtonInvokeCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Button *buttonPtr = recordPtr;
+ Button *buttonPtr = (Button *)recordPtr;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "invoke");
return TCL_ERROR;
@@ -444,7 +454,7 @@ static Tk_OptionSpec CheckbuttonOptionSpecs[] =
*/
static void CheckbuttonVariableChanged(void *clientData, const char *value)
{
- Checkbutton *checkPtr = clientData;
+ Checkbutton *checkPtr = (Checkbutton *)clientData;
if (WidgetDestroyed(&checkPtr->core)) {
return;
@@ -466,7 +476,7 @@ static void CheckbuttonVariableChanged(void *clientData, const char *value)
static void
CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr)
{
- Checkbutton *checkPtr = recordPtr;
+ Checkbutton *checkPtr = (Checkbutton *)recordPtr;
Tcl_Obj *variableObj;
/* default -variable is the widget name:
@@ -480,7 +490,7 @@ CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr)
static void
CheckbuttonCleanup(void *recordPtr)
{
- Checkbutton *checkPtr = recordPtr;
+ Checkbutton *checkPtr = (Checkbutton *)recordPtr;
Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace);
checkPtr->checkbutton.variableTrace = 0;
BaseCleanup(recordPtr);
@@ -489,10 +499,10 @@ CheckbuttonCleanup(void *recordPtr)
static int
CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Checkbutton *checkPtr = recordPtr;
+ Checkbutton *checkPtr = (Checkbutton *)recordPtr;
Tcl_Obj *varName = checkPtr->checkbutton.variableObj;
Ttk_TraceHandle *vt = NULL;
-
+
if (varName != NULL && *Tcl_GetString(varName) != '\0') {
vt = Ttk_TraceVariable(interp, varName,
CheckbuttonVariableChanged, checkPtr);
@@ -517,7 +527,7 @@ CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
static int
CheckbuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Checkbutton *checkPtr = recordPtr;
+ Checkbutton *checkPtr = (Checkbutton *)recordPtr;
int status = TCL_OK;
if (checkPtr->checkbutton.variableTrace)
@@ -535,7 +545,7 @@ static int
CheckbuttonInvokeCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Checkbutton *checkPtr = recordPtr;
+ Checkbutton *checkPtr = (Checkbutton *)recordPtr;
WidgetCore *corePtr = &checkPtr->core;
Tcl_Obj *newValue;
@@ -650,7 +660,7 @@ static Tk_OptionSpec RadiobuttonOptionSpecs[] =
static void
RadiobuttonVariableChanged(void *clientData, const char *value)
{
- Radiobutton *radioPtr = clientData;
+ Radiobutton *radioPtr = (Radiobutton *)clientData;
if (WidgetDestroyed(&radioPtr->core)) {
return;
@@ -672,7 +682,7 @@ RadiobuttonVariableChanged(void *clientData, const char *value)
static void
RadiobuttonCleanup(void *recordPtr)
{
- Radiobutton *radioPtr = recordPtr;
+ Radiobutton *radioPtr = (Radiobutton *)recordPtr;
Ttk_UntraceVariable(radioPtr->radiobutton.variableTrace);
radioPtr->radiobutton.variableTrace = 0;
BaseCleanup(recordPtr);
@@ -681,7 +691,7 @@ RadiobuttonCleanup(void *recordPtr)
static int
RadiobuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Radiobutton *radioPtr = recordPtr;
+ Radiobutton *radioPtr = (Radiobutton *)recordPtr;
Ttk_TraceHandle *vt = Ttk_TraceVariable(
interp, radioPtr->radiobutton.variableObj,
RadiobuttonVariableChanged, radioPtr);
@@ -704,7 +714,7 @@ RadiobuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
static int
RadiobuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Radiobutton *radioPtr = recordPtr;
+ Radiobutton *radioPtr = (Radiobutton *)recordPtr;
int status = TCL_OK;
if (radioPtr->radiobutton.variableTrace)
@@ -722,7 +732,7 @@ static int
RadiobuttonInvokeCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Radiobutton *radioPtr = recordPtr;
+ Radiobutton *radioPtr = (Radiobutton *)recordPtr;
WidgetCore *corePtr = &radioPtr->core;
if (objc > 2) {
@@ -809,7 +819,7 @@ static Tk_OptionSpec MenubuttonOptionSpecs[] =
"", Tk_Offset(Menubutton, menubutton.menuObj), -1, 0,0,0},
{TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction",
"below", Tk_Offset(Menubutton, menubutton.directionObj), -1,
- 0,(ClientData)directionStrings,GEOMETRY_CHANGED},
+ 0, (void *)directionStrings, GEOMETRY_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
@@ -844,7 +854,7 @@ TTK_BEGIN_LAYOUT(MenubuttonLayout)
TTK_GROUP("Menubutton.border", TTK_FILL_BOTH,
TTK_GROUP("Menubutton.focus", TTK_FILL_BOTH,
TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT)
- TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
+ TTK_GROUP("Menubutton.padding", TTK_FILL_X,
TTK_NODE("Menubutton.label", TTK_PACK_LEFT))))
TTK_END_LAYOUT
diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c
index 0ae23723..c29007c4 100644
--- a/generic/ttk/ttkCache.c
+++ b/generic/ttk/ttkCache.c
@@ -28,8 +28,7 @@
* but this will be a transient effect.
*/
-#include /* for sprintf */
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
struct Ttk_ResourceCache_ {
diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c
index 15ebcb7b..733a391f 100644
--- a/generic/ttk/ttkClamTheme.c
+++ b/generic/ttk/ttkClamTheme.c
@@ -4,11 +4,11 @@
* "clam" theme; inspired by the XFCE family of Gnome themes.
*/
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
-/*
- * Under windows, the Tk-provided XDrawLine and XDrawArc have an
+/*
+ * Under windows, the Tk-provided XDrawLine and XDrawArc have an
* off-by-one error in the end point. This is especially apparent with this
* theme. Defining this macro as true handles this case.
*/
@@ -117,36 +117,42 @@ static Ttk_ElementOptionSpec BorderElementOptions[] = {
Tk_Offset(BorderElement,reliefObj), "flat" },
{ "-borderwidth", TK_OPTION_PIXELS,
Tk_Offset(BorderElement,borderWidthObj), "2" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
/*
* <>: -borderwidth is only partially supported:
* in this theme, borders are always exactly 2 pixels thick.
- * With -borderwidth 0, border is not drawn at all;
- * otherwise a 2-pixel border is used. For -borderwidth > 2,
+ * With -borderwidth 0, border is not drawn at all;
+ * otherwise a 2-pixel border is used. For -borderwidth > 2,
* the excess is used as padding.
*/
static void BorderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
BorderElement *border = (BorderElement*)elementRecord;
int borderWidth = 2;
+ (void)dummy;
+ (void)widthPtr;
+ (void)heightPtr;
+
Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth);
if (borderWidth == 1) ++borderWidth;
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
}
static void BorderElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
- BorderElement *border = elementRecord;
+ BorderElement *border = (BorderElement *)elementRecord;
int relief = TK_RELIEF_FLAT;
int borderWidth = 2;
Tcl_Obj *outer = 0, *upper = 0, *lower = 0;
+ (void)dummy;
+ (void)state;
Tk_GetReliefFromObj(NULL, border->reliefObj, &relief);
Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth);
@@ -205,25 +211,33 @@ static Ttk_ElementOptionSpec FieldElementOptions[] = {
Tk_Offset(FieldElement,darkColorObj), DARK_COLOR },
{ "-fieldbackground", TK_OPTION_BORDER,
Tk_Offset(FieldElement,backgroundObj), "white" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void FieldElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+
*paddingPtr = Ttk_UniformPadding(2);
}
static void FieldElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
- FieldElement *field = elementRecord;
+ FieldElement *field = (FieldElement *)elementRecord;
Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj);
Ttk_Box f = Ttk_PadBox(b, Ttk_UniformPadding(2));
Tcl_Obj *outer = field->borderColorObj,
*inner = field->lightColorObj;
+ (void)dummy;
+ (void)state;
DrawSmoothBorder(tkwin, d, b, outer, inner, inner);
Tk_Fill3DRectangle(
@@ -246,7 +260,7 @@ static void ComboboxFieldElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
- FieldElement *field = elementRecord;
+ FieldElement *field = (FieldElement *)elementRecord;
GC gc = Ttk_GCForColor(tkwin,field->borderColorObj,d);
++b.width;
@@ -291,16 +305,19 @@ static Ttk_ElementOptionSpec IndicatorElementOptions[] = {
Tk_Offset(IndicatorElement,upperColorObj), DARKEST_COLOR },
{ "-lowerbordercolor", TK_OPTION_COLOR,
Tk_Offset(IndicatorElement,lowerColorObj), DARK_COLOR },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void IndicatorElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- IndicatorElement *indicator = elementRecord;
+ IndicatorElement *indicator = (IndicatorElement *)elementRecord;
Ttk_Padding margins;
int size = 10;
+ (void)dummy;
+ (void)paddingPtr;
+
Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins);
Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size);
*widthPtr = size + Ttk_PaddingWidth(margins);
@@ -308,15 +325,16 @@ static void IndicatorElementSize(
}
static void RadioIndicatorElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
- IndicatorElement *indicator = elementRecord;
+ IndicatorElement *indicator = (IndicatorElement *)elementRecord;
GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d);
GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d);
GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d);
GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d);
Ttk_Padding padding;
+ (void)dummy;
Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding);
b = Ttk_PadBox(b, padding);
@@ -336,17 +354,19 @@ static void RadioIndicatorElementDraw(
}
static void CheckIndicatorElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
Display *display = Tk_Display(tkwin);
- IndicatorElement *indicator = elementRecord;
+ IndicatorElement *indicator = (IndicatorElement *)elementRecord;
+
GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d);
GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d);
GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d);
GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d);
Ttk_Padding padding;
const int w = WIN32_XDRAWLINE_HACK;
+ (void)dummy;
Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding);
b = Ttk_PadBox(b, padding);
@@ -402,7 +422,7 @@ typedef struct {
static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] =
{
{ "-arrowsize", TK_OPTION_PIXELS,
- Tk_Offset(MenuIndicatorElement,sizeObj),
+ Tk_Offset(MenuIndicatorElement,sizeObj),
STR(MENUBUTTON_ARROW_SIZE)},
{ "-arrowcolor",TK_OPTION_COLOR,
Tk_Offset(MenuIndicatorElement,colorObj),
@@ -410,16 +430,19 @@ static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] =
{ "-arrowpadding",TK_OPTION_STRING,
Tk_Offset(MenuIndicatorElement,paddingObj),
"3" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void MenuIndicatorElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- MenuIndicatorElement *indicator = elementRecord;
+ MenuIndicatorElement *indicator = (MenuIndicatorElement *)elementRecord;
Ttk_Padding margins;
int size = MENUBUTTON_ARROW_SIZE;
+ (void)dummy;
+ (void)paddingPtr;
+
Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size);
Ttk_GetPaddingFromObj(NULL, tkwin, indicator->paddingObj, &margins);
TtkArrowSize(size, ARROW_DOWN, widthPtr, heightPtr);
@@ -428,14 +451,16 @@ static void MenuIndicatorElementSize(
}
static void MenuIndicatorElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- MenuIndicatorElement *indicator = elementRecord;
+ MenuIndicatorElement *indicator = (MenuIndicatorElement *)elementRecord;
XColor *arrowColor = Tk_GetColorFromObj(tkwin, indicator->colorObj);
GC gc = Tk_GCForColor(arrowColor, d);
int size = MENUBUTTON_ARROW_SIZE;
int width, height;
+ (void)dummy;
+ (void)state;
Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size);
@@ -476,7 +501,7 @@ static Ttk_ElementOptionSpec GripElementOptions[] = {
Tk_Offset(GripElement,borderColorObj), DARKEST_COLOR },
{ "-gripcount", TK_OPTION_INT,
Tk_Offset(GripElement,gripCountObj), "5" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void GripElementSize(
@@ -484,8 +509,10 @@ static void GripElementSize(
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
- GripElement *grip = elementRecord;
+ GripElement *grip = (GripElement *)elementRecord;
int gripCount = 0;
+ (void)tkwin;
+ (void)paddingPtr;
Tcl_GetIntFromObj(NULL, grip->gripCountObj, &gripCount);
if (horizontal) {
@@ -501,7 +528,7 @@ static void GripElementDraw(
{
const int w = WIN32_XDRAWLINE_HACK;
int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
- GripElement *grip = elementRecord;
+ GripElement *grip = (GripElement *)elementRecord;
GC lightGC = Ttk_GCForColor(tkwin,grip->lightColorObj,d);
GC darkGC = Ttk_GCForColor(tkwin,grip->borderColorObj,d);
int gripPad = 1, gripCount = 0;
@@ -575,16 +602,19 @@ static Ttk_ElementOptionSpec ScrollbarElementOptions[] = {
Tk_Offset(ScrollbarElement,gripCountObj), "5" },
{ "-sliderlength", TK_OPTION_INT,
Tk_Offset(ScrollbarElement,sliderlengthObj), "30" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void TroughElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
- ScrollbarElement *sb = elementRecord;
+ ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
GC gcb = Ttk_GCForColor(tkwin,sb->borderColorObj,d);
GC gct = Ttk_GCForColor(tkwin,sb->troughColorObj,d);
+ (void)dummy;
+ (void)state;
+
XFillRectangle(Tk_Display(tkwin), d, gct, b.x, b.y, b.width-1, b.height-1);
XDrawRectangle(Tk_Display(tkwin), d, gcb, b.x, b.y, b.width-1, b.height-1);
}
@@ -598,24 +628,31 @@ static Ttk_ElementSpec TroughElementSpec = {
};
static void ThumbElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ScrollbarElement *sb = elementRecord;
+ ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
int size = SCROLLBAR_THICKNESS;
+ (void)dummy;
+ (void)tkwin;
+ (void)paddingPtr;
+
Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &size);
*widthPtr = *heightPtr = size;
}
static void ThumbElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
- ScrollbarElement *sb = elementRecord;
- int gripCount = 0, orient = TTK_ORIENT_HORIZONTAL;
+ ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
+ int gripCount = 0;
+ int orient = TTK_ORIENT_HORIZONTAL;
GC lightGC, darkGC;
int x1, y1, x2, y2, dx, dy, i;
const int w = WIN32_XDRAWLINE_HACK;
+ (void)dummy;
+ (void)state;
DrawSmoothBorder(tkwin, d, b,
sb->borderColorObj, sb->lightColorObj, sb->darkColorObj);
@@ -630,7 +667,7 @@ static void ThumbElementDraw(
Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount);
lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d);
darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d);
-
+
if (orient == TTK_ORIENT_HORIZONTAL) {
dx = 1; dy = 0;
x1 = x2 = b.x + b.width / 2 - gripCount;
@@ -663,11 +700,14 @@ static Ttk_ElementSpec ThumbElementSpec = {
* +++ Slider element.
*/
static void SliderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ScrollbarElement *sb = elementRecord;
- int length, thickness, orient;
+ ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
+ int length, thickness;
+ int orient;
+ (void)dummy;
+ (void)paddingPtr;
length = thickness = SCROLLBAR_THICKNESS;
Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient);
@@ -706,16 +746,18 @@ static void PbarElementSize(
}
static void PbarElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
- ScrollbarElement *sb = elementRecord;
-
+ ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
+ (void)dummy;
+ (void)state;
+
b = Ttk_PadBox(b, Ttk_UniformPadding(2));
if (b.width > 4 && b.height > 4) {
DrawSmoothBorder(tkwin, d, b,
sb->borderColorObj, sb->lightColorObj, sb->darkColorObj);
- XFillRectangle(Tk_Display(tkwin), d,
+ XFillRectangle(Tk_Display(tkwin), d,
BackgroundGC(tkwin, sb->backgroundObj),
b.x+2, b.y+2, b.width-4, b.height-4);
}
@@ -736,11 +778,15 @@ static Ttk_ElementSpec PbarElementSpec = {
static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
static void ArrowElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ScrollbarElement *sb = elementRecord;
+ ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
int size = SCROLLBAR_THICKNESS;
+ (void)dummy;
+ (void)tkwin;
+ (void)paddingPtr;
+
Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &size);
*widthPtr = *heightPtr = size;
}
@@ -749,8 +795,8 @@ static void ArrowElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
- ArrowDirection dir = *(ArrowDirection*)clientData;
- ScrollbarElement *sb = elementRecord;
+ ArrowDirection direction = *(ArrowDirection*)clientData;
+ ScrollbarElement *sb = (ScrollbarElement *)elementRecord;
GC gc = Ttk_GCForColor(tkwin,sb->arrowColorObj, d);
int h, cx, cy;
@@ -763,10 +809,10 @@ static void ArrowElementDraw(
b = Ttk_PadBox(b, Ttk_UniformPadding(3));
h = b.width < b.height ? b.width : b.height;
- TtkArrowSize(h/2, dir, &cx, &cy);
+ TtkArrowSize(h/2, direction, &cx, &cy);
b = Ttk_AnchorBox(b, cx, cy, TK_ANCHOR_CENTER);
- TtkFillArrow(Tk_Display(tkwin), d, gc, b, dir);
+ TtkFillArrow(Tk_Display(tkwin), d, gc, b, direction);
}
static Ttk_ElementSpec ArrowElementSpec = {
@@ -780,8 +826,8 @@ static Ttk_ElementSpec ArrowElementSpec = {
/*------------------------------------------------------------------------
* +++ Notebook elements.
- *
- * Note: Tabs, except for the rightmost, overlap the neighbor to
+ *
+ * Note: Tabs, except for the rightmost, overlap the neighbor to
* their right by one pixel.
*/
@@ -801,29 +847,36 @@ static Ttk_ElementOptionSpec NotebookElementOptions[] = {
Tk_Offset(NotebookElement,lightColorObj), LIGHT_COLOR },
{ "-darkcolor", TK_OPTION_COLOR,
Tk_Offset(NotebookElement,darkColorObj), DARK_COLOR },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void TabElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
int borderWidth = 2;
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+
paddingPtr->top = paddingPtr->left = paddingPtr->right = borderWidth;
paddingPtr->bottom = 0;
}
static void TabElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- NotebookElement *tab = elementRecord;
+ NotebookElement *tab = (NotebookElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj);
Display *display = Tk_Display(tkwin);
int borderWidth = 2, dh = 0;
int x1,y1,x2,y2;
GC gc;
const int w = WIN32_XDRAWLINE_HACK;
+ (void)dummy;
if (state & TTK_STATE_SELECTED) {
dh = borderWidth;
@@ -860,20 +913,28 @@ static Ttk_ElementSpec TabElementSpec =
};
static void ClientElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
int borderWidth = 2;
+ (void)dummy;
+ (void)elementRecord;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
+
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
}
static void ClientElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- NotebookElement *ce = elementRecord;
+ NotebookElement *ce = (NotebookElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj);
int borderWidth = 2;
+ (void)dummy;
+ (void)state;
Tk_Fill3DRectangle(tkwin, d, border,
b.x, b.y, b.width, b.height, borderWidth,TK_RELIEF_FLAT);
@@ -898,7 +959,7 @@ TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
TTK_LAYOUT("TCombobox",
TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y)
- TTK_GROUP("Combobox.field", TTK_PACK_LEFT|TTK_FILL_BOTH|TTK_EXPAND,
+ TTK_GROUP("Combobox.field", TTK_FILL_BOTH,
TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))
diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c
index e0886f2a..8436aec1 100644
--- a/generic/ttk/ttkClassicTheme.c
+++ b/generic/ttk/ttkClassicTheme.c
@@ -26,27 +26,34 @@ static Ttk_ElementOptionSpec HighlightElementOptions[] = {
Tk_Offset(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND },
{ "-highlightthickness",TK_OPTION_PIXELS,
Tk_Offset(HighlightElement,highlightThicknessObj), "0" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void HighlightElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- HighlightElement *hl = elementRecord;
+ HighlightElement *hl = (HighlightElement *)elementRecord;
int highlightThickness = 0;
+ (void)dummy;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness);
*paddingPtr = Ttk_UniformPadding((short)highlightThickness);
}
static void HighlightElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- HighlightElement *hl = elementRecord;
+ HighlightElement *hl = (HighlightElement *)elementRecord;
int highlightThickness = 0;
XColor *highlightColor = Tk_GetColorFromObj(tkwin, hl->highlightColorObj);
+ (void)dummy;
+ (void)b;
+ (void)state;
Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness);
if (highlightColor && highlightThickness > 0) {
@@ -66,7 +73,7 @@ static Ttk_ElementSpec HighlightElementSpec =
/*------------------------------------------------------------------------
* +++ Button Border element:
- *
+ *
* The Motif-style button border on X11 consists of (from outside-in):
*
* + focus indicator (controlled by -highlightcolor and -highlightthickness),
@@ -83,24 +90,28 @@ typedef struct {
static Ttk_ElementOptionSpec ButtonBorderElementOptions[] =
{
- { "-background", TK_OPTION_BORDER,
+ { "-background", TK_OPTION_BORDER,
Tk_Offset(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND },
- { "-borderwidth", TK_OPTION_PIXELS,
+ { "-borderwidth", TK_OPTION_PIXELS,
Tk_Offset(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH },
- { "-relief", TK_OPTION_RELIEF,
+ { "-relief", TK_OPTION_RELIEF,
Tk_Offset(ButtonBorderElement,reliefObj), "flat" },
- { "-default", TK_OPTION_ANY,
+ { "-default", TK_OPTION_ANY,
Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void ButtonBorderElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ButtonBorderElement *bd = elementRecord;
+ ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord;
int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
int borderWidth = 0;
+ (void)dummy;
+ (void)tkwin;
+ (void)widthPtr;
+ (void)heightPtr;
Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth);
Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);
@@ -113,18 +124,20 @@ static void ButtonBorderElementSize(
/*
* (@@@ Note: ButtonBorderElement still still still buggy:
- * padding for default ring is drawn in the wrong color
+ * padding for default ring is drawn in the wrong color
* when the button is active.)
*/
static void ButtonBorderElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- ButtonBorderElement *bd = elementRecord;
+ ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord;
Tk_3DBorder border = NULL;
int borderWidth = 1, relief = TK_RELIEF_FLAT;
int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
int inset = 0;
+ (void)dummy;
+ (void)state;
/*
* Get option values.
@@ -204,15 +217,17 @@ static Ttk_ElementOptionSpec ArrowElementOptions[] =
{ "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,borderWidthObj),
DEFAULT_BORDERWIDTH },
{ "-relief", TK_OPTION_RELIEF, Tk_Offset(ArrowElement,reliefObj),"raised" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void ArrowElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ArrowElement *arrow = elementRecord;
+ ArrowElement *arrow = (ArrowElement *)elementRecord;
int size = 12;
+ (void)dummy;
+ (void)paddingPtr;
Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size);
*widthPtr = *heightPtr = size;
@@ -223,12 +238,13 @@ static void ArrowElementDraw(
Drawable d, Ttk_Box b, unsigned int state)
{
int direction = *(int *)clientData;
- ArrowElement *arrow = elementRecord;
+ ArrowElement *arrow = (ArrowElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj);
int borderWidth = 2;
int relief = TK_RELIEF_RAISED;
int size = b.width < b.height ? b.width : b.height;
XPoint points[3];
+ (void)state;
Tk_GetPixelsFromObj(NULL, tkwin, arrow->borderWidthObj, &borderWidth);
Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief);
@@ -279,19 +295,19 @@ static Ttk_ElementSpec ArrowElementSpec =
/*------------------------------------------------------------------------
* +++ Sash element (for ttk::panedwindow)
*
- * NOTES:
+ * NOTES:
*
* panedwindows with -orient horizontal use vertical sashes, and vice versa.
*
* Interpretation of -sashrelief 'groove' and 'ridge' are
* swapped wrt. the core panedwindow, which (I think) has them backwards.
*
- * Default -sashrelief is sunken; the core panedwindow has default
+ * Default -sashrelief is sunken; the core panedwindow has default
* -sashrelief raised, but that looks wrong to me.
*/
static Ttk_Orient SashClientData[] = {
- TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL
+ TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL
};
typedef struct {
@@ -304,28 +320,29 @@ typedef struct {
} SashElement;
static Ttk_ElementOptionSpec SashOptions[] = {
- { "-background", TK_OPTION_BORDER,
+ { "-background", TK_OPTION_BORDER,
Tk_Offset(SashElement,borderObj), DEFAULT_BACKGROUND },
- { "-sashrelief", TK_OPTION_RELIEF,
+ { "-sashrelief", TK_OPTION_RELIEF,
Tk_Offset(SashElement,sashReliefObj), "sunken" },
{ "-sashthickness", TK_OPTION_PIXELS,
Tk_Offset(SashElement,sashThicknessObj), "6" },
- { "-sashpad", TK_OPTION_PIXELS,
+ { "-sashpad", TK_OPTION_PIXELS,
Tk_Offset(SashElement,sashPadObj), "2" },
{ "-handlesize", TK_OPTION_PIXELS,
Tk_Offset(SashElement,handleSizeObj), "8" },
{ "-handlepad", TK_OPTION_PIXELS,
Tk_Offset(SashElement,handlePadObj), "8" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void SashElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- SashElement *sash = elementRecord;
+ SashElement *sash = (SashElement *)elementRecord;
int sashPad = 2, sashThickness = 6, handleSize = 8;
int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
+ (void)paddingPtr;
Tk_GetPixelsFromObj(NULL, tkwin, sash->sashThicknessObj, &sashThickness);
Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize);
@@ -344,13 +361,14 @@ static void SashElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- SashElement *sash = elementRecord;
+ SashElement *sash = (SashElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, sash->borderObj);
GC gc1,gc2;
int relief = TK_RELIEF_RAISED;
int handleSize = 8, handlePad = 8;
int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL;
Ttk_Box hb;
+ (void)state;
Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize);
Tk_GetPixelsFromObj(NULL, tkwin, sash->handlePadObj, &handlePad);
@@ -365,10 +383,10 @@ static void SashElementDraw(
gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC);
break;
- case TK_RELIEF_SOLID:
+ case TK_RELIEF_SOLID:
gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC);
break;
- case TK_RELIEF_FLAT:
+ case TK_RELIEF_FLAT:
default:
gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC);
break;
@@ -396,7 +414,7 @@ static void SashElementDraw(
hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_N);
hb.y += handlePad;
}
- Tk_Fill3DRectangle(tkwin, d, border,
+ Tk_Fill3DRectangle(tkwin, d, border,
hb.x, hb.y, hb.width, hb.height, 1, TK_RELIEF_RAISED);
}
}
@@ -439,7 +457,7 @@ TTK_LAYOUT("TMenubutton",
TTK_GROUP("Menubutton.highlight", TTK_FILL_BOTH,
TTK_GROUP("Menubutton.border", TTK_FILL_BOTH,
TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT)
- TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
+ TTK_GROUP("Menubutton.padding", TTK_FILL_X,
TTK_NODE("Menubutton.label", 0)))))
/* "classic" entry, includes highlight border */
@@ -493,7 +511,7 @@ MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *interp)
Ttk_RegisterElement(interp, theme, "arrow",
&ArrowElementSpec, &ArrowElements[0]);
- Ttk_RegisterElement(interp, theme, "hsash",
+ Ttk_RegisterElement(interp, theme, "hsash",
&SashElementSpec, &SashClientData[0]);
Ttk_RegisterElement(interp, theme, "vsash",
&SashElementSpec, &SashClientData[1]);
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c
index 5c95dbae..4dd2adb6 100644
--- a/generic/ttk/ttkElements.c
+++ b/generic/ttk/ttkElements.c
@@ -5,9 +5,7 @@
*
*/
-#include
-#include
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 1579a329..1d8137bb 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -339,8 +339,8 @@ EntryFetchSelection(
}
string = entryPtr->entry.displayString;
- selStart = Tcl_UtfAtIndex(string, entryPtr->entry.selectFirst);
- selEnd = Tcl_UtfAtIndex(selStart,
+ selStart = TkUtfAtIndex(string, entryPtr->entry.selectFirst);
+ selEnd = TkUtfAtIndex(selStart,
entryPtr->entry.selectLast - entryPtr->entry.selectFirst);
byteCount = selEnd - selStart - offset;
if (byteCount > maxBytes) {
@@ -458,11 +458,11 @@ ExpandPercents(
break;
case 'S': /* string to be inserted/deleted, if any */
if (reason == VALIDATE_INSERT) {
- string = Tcl_UtfAtIndex(new, index);
- stringLength = Tcl_UtfAtIndex(string, count) - string;
+ string = TkUtfAtIndex(new, index);
+ stringLength = TkUtfAtIndex(string, count) - string;
} else if (reason == VALIDATE_DELETE) {
- string = Tcl_UtfAtIndex(entryPtr->entry.string, index);
- stringLength = Tcl_UtfAtIndex(string, count) - string;
+ string = TkUtfAtIndex(entryPtr->entry.string, index);
+ stringLength = TkUtfAtIndex(string, count) - string;
} else {
string = "";
stringLength = 0;
@@ -557,7 +557,7 @@ static int EntryNeedsValidation(VMODE vmode, VREASON reason)
* Returns:
* TCL_OK if the change is accepted
* TCL_BREAK if the change is rejected
- * TCL_ERROR if any errors occured
+ * TCL_ERROR if any errors occurred
*
* The change will be rejected if -validatecommand returns 0,
* or if -validatecommand or -invalidcommand modifies the value.
@@ -650,8 +650,12 @@ static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason)
static void EntryRevalidateBG(Entry *entryPtr, VREASON reason)
{
Tcl_Interp *interp = entryPtr->core.interp;
- if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) {
- Tcl_BackgroundException(interp, TCL_ERROR);
+ VMODE vmode = entryPtr->entry.validate;
+
+ if (EntryNeedsValidation(vmode, reason)) {
+ if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) {
+ Tcl_BackgroundException(interp, TCL_ERROR);
+ }
}
}
@@ -808,7 +812,7 @@ InsertChars(
const char *value) /* New characters to add */
{
char *string = entryPtr->entry.string;
- size_t byteIndex = Tcl_UtfAtIndex(string, index) - string;
+ size_t byteIndex = TkUtfAtIndex(string, index) - string;
size_t byteCount = strlen(value);
int charsAdded = Tcl_NumUtfChars(value, byteCount);
size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1;
@@ -862,8 +866,8 @@ DeleteChars(
return TCL_OK;
}
- byteIndex = Tcl_UtfAtIndex(string, index) - string;
- byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex);
+ byteIndex = TkUtfAtIndex(string, index) - string;
+ byteCount = TkUtfAtIndex(string+byteIndex, count) - (string+byteIndex);
newByteCount = entryPtr->entry.numBytes + 1 - byteCount;
new = ckalloc(newByteCount);
@@ -1270,16 +1274,27 @@ static void EntryDisplay(void *clientData, Drawable d)
/* Draw the text:
*/
gc = EntryGetGC(entryPtr, es.foregroundObj, clipRegion);
- Tk_DrawTextLayout(
- Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
- entryPtr->entry.layoutX, entryPtr->entry.layoutY,
- leftIndex, rightIndex);
- XSetClipMask(Tk_Display(tkwin), gc, None);
- Tk_FreeGC(Tk_Display(tkwin), gc);
-
- /* Overwrite the selected portion (if any) in the -selectforeground color:
- */
if (showSelection) {
+
+ /* Draw the selected and unselected portions separately.
+ */
+ if (leftIndex < selFirst) {
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ leftIndex, selFirst);
+ }
+ if (selLast < rightIndex) {
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ selLast, rightIndex);
+ }
+ XSetClipMask(Tk_Display(tkwin), gc, None);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+
+ /* Draw the selected portion in the -selectforeground color:
+ */
gc = EntryGetGC(entryPtr, es.selForegroundObj, clipRegion);
Tk_DrawTextLayout(
Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
@@ -1287,6 +1302,16 @@ static void EntryDisplay(void *clientData, Drawable d)
selFirst, selLast);
XSetClipMask(Tk_Display(tkwin), gc, None);
Tk_FreeGC(Tk_Display(tkwin), gc);
+ } else {
+
+ /* Draw the entire visible text
+ */
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ leftIndex, rightIndex);
+ XSetClipMask(Tk_Display(tkwin), gc, None);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
}
/* Drop the region. Note that we have to manually remove the reference to
@@ -1378,7 +1403,7 @@ EntryIndex(
*indexPtr += 1;
}
} else {
- if (Tcl_GetInt(interp, string, indexPtr) != TCL_OK) {
+ if (Tcl_GetIntFromObj(interp, indexObj, indexPtr) != TCL_OK) {
goto badIndex;
}
if (*indexPtr < 0) {
@@ -2068,7 +2093,7 @@ TTK_END_LAYOUT
TTK_BEGIN_LAYOUT(ComboboxLayout)
TTK_GROUP("Combobox.field", TTK_FILL_BOTH,
TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y)
- TTK_GROUP("Combobox.padding", TTK_FILL_BOTH|TTK_PACK_LEFT|TTK_EXPAND,
+ TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))
TTK_END_LAYOUT
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c
index 8a15e5b5..b8b3477f 100644
--- a/generic/ttk/ttkFrame.c
+++ b/generic/ttk/ttkFrame.c
@@ -4,8 +4,7 @@
* ttk::frame and ttk::labelframe widgets.
*/
-#include
-
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
#include "ttkManager.h"
@@ -89,9 +88,12 @@ static Ttk_Padding FrameMargins(Frame *framePtr)
* The frame doesn't request a size of its own by default,
* but it does have an internal border. See also <>
*/
-static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr)
+static int FrameSize(
+ void *recordPtr,
+ TCL_UNUSED(int *),
+ TCL_UNUSED(int *))
{
- Frame *framePtr = recordPtr;
+ Frame *framePtr = (Frame *)recordPtr;
Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr));
return 0;
}
@@ -112,7 +114,7 @@ static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr)
static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Frame *framePtr = recordPtr;
+ Frame *framePtr = (Frame *)recordPtr;
int width, height;
/*
@@ -338,9 +340,12 @@ LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr)
* Like the frame, this doesn't request a size of its own
* but it does have internal padding and a minimum size.
*/
-static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr)
+static int LabelframeSize(
+ void *recordPtr,
+ TCL_UNUSED(int *),
+ TCL_UNUSED(int *))
{
- Labelframe *lframePtr = recordPtr;
+ Labelframe *lframePtr = (Labelframe *)recordPtr;
WidgetCore *corePtr = &lframePtr->core;
Ttk_Padding margins;
LabelframeStyle style;
@@ -385,7 +390,7 @@ static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr)
static Ttk_Layout LabelframeGetLayout(
Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
{
- Labelframe *lf = recordPtr;
+ Labelframe *lf = (Labelframe *)recordPtr;
Ttk_Layout frameLayout = TtkWidgetGetLayout(interp, theme, recordPtr);
Ttk_Layout labelLayout;
@@ -416,7 +421,7 @@ static Ttk_Layout LabelframeGetLayout(
static void LabelframeDoLayout(void *recordPtr)
{
- Labelframe *lframePtr = recordPtr;
+ Labelframe *lframePtr = (Labelframe *)recordPtr;
WidgetCore *corePtr = &lframePtr->core;
int lw, lh; /* Label width and height */
LabelframeStyle style;
@@ -456,13 +461,13 @@ static void LabelframeDoLayout(void *recordPtr)
Ttk_PlaceLayout(
lframePtr->label.labelLayout, corePtr->state, labelParcel);
}
- /* labelWidget placed in LabelframePlaceSlaves GM hook */
+ /* labelWidget placed in LabelframePlaceContent GM hook */
lframePtr->label.labelParcel = labelParcel;
}
static void LabelframeDisplay(void *recordPtr, Drawable d)
{
- Labelframe *lframePtr = recordPtr;
+ Labelframe *lframePtr = (Labelframe *)recordPtr;
Ttk_DrawLayout(lframePtr->core.layout, lframePtr->core.state, d);
if (lframePtr->label.labelLayout) {
Ttk_DrawLayout(lframePtr->label.labelLayout, lframePtr->core.state, d);
@@ -472,23 +477,27 @@ static void LabelframeDisplay(void *recordPtr, Drawable d)
/* +++ Labelframe geometry manager hooks.
*/
-/* LabelframePlaceSlaves --
+/* LabelframePlaceContent --
* Sets the position and size of the labelwidget.
*/
-static void LabelframePlaceSlaves(void *recordPtr)
+static void LabelframePlaceContent(void *recordPtr)
{
- Labelframe *lframe = recordPtr;
+ Labelframe *lframe = (Labelframe *)recordPtr;
- if (Ttk_NumberSlaves(lframe->label.mgr) == 1) {
+ if (Ttk_NumberContent(lframe->label.mgr) == 1) {
Ttk_Box b;
LabelframeDoLayout(recordPtr);
b = lframe->label.labelParcel;
- /* ASSERT: slave #0 is lframe->label.labelWidget */
- Ttk_PlaceSlave(lframe->label.mgr, 0, b.x,b.y,b.width,b.height);
+ /* ASSERT: content #0 is lframe->label.labelWidget */
+ Ttk_PlaceContent(lframe->label.mgr, 0, b.x,b.y,b.width,b.height);
}
}
-static int LabelRequest(void *managerData, int index, int width, int height)
+static int LabelRequest(
+ TCL_UNUSED(void *),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
return 1;
}
@@ -498,18 +507,21 @@ static int LabelRequest(void *managerData, int index, int width, int height)
*
* <>:
* This routine is also called when the widget voluntarily forgets
- * the slave in LabelframeConfigure.
+ * the window in LabelframeConfigure.
*/
-static void LabelRemoved(void *managerData, int slaveIndex)
+static void LabelRemoved(
+ void *managerData,
+ TCL_UNUSED(int))
{
- Labelframe *lframe = managerData;
+ Labelframe *lframe = (Labelframe *)managerData;
+
lframe->label.labelWidget = 0;
}
static Ttk_ManagerSpec LabelframeManagerSpec = {
- { "labelframe", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ { "labelframe", Ttk_GeometryRequestProc, Ttk_LostContentProc },
LabelframeSize,
- LabelframePlaceSlaves,
+ LabelframePlaceContent,
LabelRequest,
LabelRemoved
};
@@ -517,9 +529,11 @@ static Ttk_ManagerSpec LabelframeManagerSpec = {
/* LabelframeInitialize --
* Initialization hook.
*/
-static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr)
+static void LabelframeInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
- Labelframe *lframe = recordPtr;
+ Labelframe *lframe = (Labelframe *)recordPtr;
lframe->label.mgr = Ttk_CreateManager(
&LabelframeManagerSpec, lframe, lframe->core.tkwin);
@@ -533,7 +547,7 @@ static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr)
*/
static void LabelframeCleanup(void *recordPtr)
{
- Labelframe *lframe = recordPtr;
+ Labelframe *lframe = (Labelframe *)recordPtr;
Ttk_DeleteManager(lframe->label.mgr);
if (lframe->label.labelLayout) {
Ttk_FreeLayout(lframe->label.labelLayout);
@@ -564,7 +578,7 @@ static void RaiseLabelWidget(Labelframe *lframe)
*/
static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask)
{
- Labelframe *lframePtr = recordPtr;
+ Labelframe *lframePtr = (Labelframe *)recordPtr;
Tk_Window labelWidget = lframePtr->label.labelWidget;
Ttk_PositionSpec unused;
@@ -591,15 +605,15 @@ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask)
/* Update -labelwidget changes, if any:
*/
if (mask & LABELWIDGET_CHANGED) {
- if (Ttk_NumberSlaves(lframePtr->label.mgr) == 1) {
- Ttk_ForgetSlave(lframePtr->label.mgr, 0);
+ if (Ttk_NumberContent(lframePtr->label.mgr) == 1) {
+ Ttk_ForgetContent(lframePtr->label.mgr, 0);
/* Restore labelWidget field (see <>)
*/
lframePtr->label.labelWidget = labelWidget;
}
if (labelWidget) {
- Ttk_InsertSlave(lframePtr->label.mgr, 0, labelWidget, NULL);
+ Ttk_InsertContent(lframePtr->label.mgr, 0, labelWidget, NULL);
RaiseLabelWidget(lframePtr);
}
}
diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl
index 8047e3fc..6aabd613 100644
--- a/generic/ttk/ttkGenStubs.tcl
+++ b/generic/ttk/ttkGenStubs.tcl
@@ -284,18 +284,26 @@ proc genStubs::rewriteFile {file text} {
# Results:
# Returns the original text inside an appropriate #ifdef.
-proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} {
+proc genStubs::addPlatformGuard {plat iftxt {eltxt {}} {withCygwin 0}} {
set text ""
switch $plat {
win {
- append text "#ifdef _WIN32 /* WIN */\n${iftxt}"
+ append text "#if defined(_WIN32)"
+ if {$withCygwin} {
+ append text " || defined(__CYGWIN__)"
+ }
+ append text " /* WIN */\n${iftxt}"
if {$eltxt ne ""} {
append text "#else /* WIN */\n${eltxt}"
}
append text "#endif /* WIN */\n"
}
unix {
- append text "#if !defined(_WIN32) && !defined(MAC_OSX_TCL)\
+ append text "#if !defined(_WIN32)"
+ if {$withCygwin} {
+ append text " && !defined(__CYGWIN__)"
+ }
+ append text " && !defined(MAC_OSX_TCL)\
/* UNIX */\n${iftxt}"
if {$eltxt ne ""} {
append text "#else /* UNIX */\n${eltxt}"
@@ -317,7 +325,11 @@ proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} {
append text "#endif /* AQUA */\n"
}
x11 {
- append text "#if !(defined(_WIN32) || defined(MAC_OSX_TK))\
+ append text "#if !(defined(_WIN32)"
+ if {$withCygwin} {
+ append text " || defined(__CYGWIN__)"
+ }
+ append text " || defined(MAC_OSX_TK))\
/* X11 */\n${iftxt}"
if {$eltxt ne ""} {
append text "#else /* X11 */\n${eltxt}"
@@ -450,12 +462,23 @@ proc genStubs::parseArg {arg} {
proc genStubs::makeDecl {name decl index} {
variable scspec
+ variable stubs
+ variable libraryName
lassign $decl rtype fname args
append text "/* $index */\n"
- set line "$scspec $rtype"
+ if {[info exists stubs($name,deprecated,$index)]} {
+ append text "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n"
+ set line "$rtype"
+ } elseif {[string range $rtype end-5 end] eq "MP_WUR"} {
+ set line "$scspec [string trim [string range $rtype 0 end-6]]"
+ } else {
+ set line "$scspec $rtype"
+ }
set count [expr {2 - ([string length $line] / 8)}]
- append line [string range "\t\t\t" 0 $count]
+ if {$count >= 0} {
+ append line [string range "\t\t\t" 0 $count]
+ }
set pad [expr {24 - [string length $line]}]
if {$pad <= 0} {
append line " "
@@ -494,6 +517,9 @@ proc genStubs::makeDecl {name decl index} {
set sep ", "
}
append line ", ...)"
+ if {[lindex $args end] eq "{const char *} format"} {
+ append line " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")"
+ }
}
default {
set sep "("
@@ -517,6 +543,9 @@ proc genStubs::makeDecl {name decl index} {
append line ")"
}
}
+ if {[string range $rtype end-5 end] eq "MP_WUR"} {
+ append line " MP_WUR"
+ }
return "$text$line;\n"
}
@@ -561,17 +590,27 @@ proc genStubs::makeMacro {name decl index} {
proc genStubs::makeSlot {name decl index} {
lassign $decl rtype fname args
+ variable stubs
set lfname [string tolower [string index $fname 0]]
append lfname [string range $fname 1 end]
set text " "
+ if {[info exists stubs($name,deprecated,$index)]} {
+ append text "TCL_DEPRECATED_API(\"$stubs($name,deprecated,$index)\") "
+ } elseif {[info exists stubs($name,nostub,$index)]} {
+ append text "TCL_DEPRECATED_API(\"$stubs($name,nostub,$index)\") "
+ }
if {$args eq ""} {
append text $rtype " *" $lfname "; /* $index */\n"
return $text
}
if {[string range $rtype end-8 end] eq "__stdcall"} {
append text [string trim [string range $rtype 0 end-9]] " (__stdcall *" $lfname ") "
+ } elseif {[string range $rtype 0 11] eq "TCL_NORETURN"} {
+ append text "TCL_NORETURN1 " [string trim [string range $rtype 12 end]] " (*" $lfname ") "
+ } elseif {[string range $rtype end-5 end] eq "MP_WUR"} {
+ append text [string trim [string range $rtype 0 end-6]] " (*" $lfname ") "
} else {
append text $rtype " (*" $lfname ") "
}
@@ -591,6 +630,9 @@ proc genStubs::makeSlot {name decl index} {
set sep ", "
}
append text ", ...)"
+ if {[lindex $args end] eq "{const char *} format"} {
+ append text " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")"
+ }
}
default {
set sep "("
@@ -606,6 +648,9 @@ proc genStubs::makeSlot {name decl index} {
}
}
+ if {[string range $rtype end-5 end] eq "MP_WUR"} {
+ append text " MP_WUR"
+ }
append text "; /* $index */\n"
return $text
}
@@ -837,7 +882,7 @@ proc genStubs::emitInit {name textVar} {
}
foreach intf [array names interfaces] {
if {[info exists hooks($intf)]} {
- if {[lsearch -exact $hooks($intf) $name] >= 0} {
+ if {$name in $hooks($intf)} {
set root 0
break
}
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index e403e2dd..2ef30e04 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -10,8 +10,7 @@
* [style map].
*/
-#include
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#define MIN(a,b) ((a) < (b) ? (a) : (b))
diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c
index dc6e994c..0bda18bd 100644
--- a/generic/ttk/ttkInit.c
+++ b/generic/ttk/ttkInit.c
@@ -4,8 +4,7 @@
* Ttk package: initialization routine and miscellaneous utilities.
*/
-#include
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -115,7 +114,7 @@ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr)
*/
void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName)
{
- union {XEvent general; XVirtualEvent virtual;} event;
+ union {XEvent general; XVirtualEvent virt;} event;
memset(&event, 0, sizeof(event));
event.general.xany.type = VirtualEvent;
@@ -123,7 +122,7 @@ void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName)
event.general.xany.send_event = False;
event.general.xany.window = Tk_WindowId(tgtWin);
event.general.xany.display = Tk_Display(tgtWin);
- event.virtual.name = Tk_GetUid(eventName);
+ event.virt.name = Tk_GetUid(eventName);
Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
}
@@ -275,7 +274,7 @@ Ttk_Init(Tcl_Interp *interp)
Ttk_PlatformInit(interp);
- Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (ClientData)&ttkStubs);
+ Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs);
return TCL_OK;
}
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c
index 3cebc14e..6f322999 100644
--- a/generic/ttk/ttkLabel.c
+++ b/generic/ttk/ttkLabel.c
@@ -65,7 +65,7 @@ static Ttk_ElementOptionSpec TextElementOptions[] = {
Tk_Offset(TextElement,wrapLengthObj), "0" },
{ "-embossed", TK_OPTION_INT,
Tk_Offset(TextElement,embossedObj), "0"},
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static int TextSetup(TextElement *text, Tk_Window tkwin)
@@ -138,7 +138,7 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b)
gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin));
gc2 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues);
- /*
+ /*
* Place text according to -anchor:
*/
Tk_GetAnchorFromObj(NULL, text->anchorObj, &anchor);
@@ -193,10 +193,12 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b)
}
static void TextElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- TextElement *text = elementRecord;
+ TextElement *text = (TextElement *)elementRecord;
+ (void)dummy;
+ (void)paddingPtr;
if (!TextSetup(text, tkwin))
return;
@@ -210,10 +212,13 @@ static void TextElementSize(
}
static void TextElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- TextElement *text = elementRecord;
+ TextElement *text = (TextElement *)elementRecord;
+ (void)dummy;
+ (void)state;
+
if (TextSetup(text, tkwin)) {
TextDraw(text, tkwin, d, b);
TextCleanup(text);
@@ -253,7 +258,7 @@ static Ttk_ElementOptionSpec ImageElementOptions[] = {
Tk_Offset(ImageElement,stippleObj), "gray50" },
{ "-background", TK_OPTION_COLOR,
Tk_Offset(ImageElement,backgroundObj), DEFAULT_BACKGROUND },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
/*
@@ -341,15 +346,15 @@ static void ImageDraw(
Tk_RedrawImage(image->tkimg, 0,0, width, height, d, b.x, b.y);
- /* If we're disabled there's no state-specific 'disabled' image,
+ /* If we're disabled there's no state-specific 'disabled' image,
* stipple the image.
* @@@ Possibly: Don't do disabled-stippling at all;
* @@@ it's ugly and out of fashion.
- * Do not stipple at all under Aqua, just draw the image: it shows up
+ * Do not stipple at all under Aqua, just draw the image: it shows up
* as a white rectangle otherwise.
*/
-
+
if (state & TTK_STATE_DISABLED) {
if (TtkSelectImage(image->imageSpec, 0ul) == image->tkimg) {
#ifndef MAC_OSX_TK
@@ -360,10 +365,12 @@ static void ImageDraw(
}
static void ImageElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- ImageElement *image = elementRecord;
+ ImageElement *image = (ImageElement *)elementRecord;
+ (void)dummy;
+ (void)paddingPtr;
if (ImageSetup(image, tkwin, 0)) {
*widthPtr = image->width;
@@ -373,10 +380,11 @@ static void ImageElementSize(
}
static void ImageElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- ImageElement *image = elementRecord;
+ ImageElement *image = (ImageElement *)elementRecord;
+ (void)dummy;
if (ImageSetup(image, tkwin, state)) {
ImageDraw(image, tkwin, d, b, state);
@@ -477,7 +485,7 @@ static Ttk_ElementOptionSpec LabelElementOptions[] = {
Tk_Offset(LabelElement,image.stippleObj), "gray50" },
{ "-background", TK_OPTION_COLOR,
Tk_Offset(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
/*
@@ -494,8 +502,8 @@ static void LabelSetup(
{
Ttk_Compound *compoundPtr = &c->compound;
- Tk_GetPixelsFromObj(NULL,tkwin,c->spaceObj,&c->space);
- Ttk_GetCompoundFromObj(NULL,c->compoundObj,(int*)compoundPtr);
+ Tk_GetPixelsFromObj(NULL, tkwin, c->spaceObj, &c->space);
+ Ttk_GetCompoundFromObj(NULL, c->compoundObj, (int *)compoundPtr);
/*
* Deal with TTK_COMPOUND_NONE.
@@ -561,11 +569,13 @@ static void LabelCleanup(LabelElement *c)
}
static void LabelElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- LabelElement *label = elementRecord;
+ LabelElement *label = (LabelElement *)elementRecord;
int textReqWidth = 0;
+ (void)dummy;
+ (void)paddingPtr;
LabelSetup(label, tkwin, 0);
@@ -576,7 +586,7 @@ static void LabelElementSize(
if (label->compound != TTK_COMPOUND_IMAGE)
textReqWidth = TextReqWidth(&label->text);
- switch (label->compound)
+ switch (label->compound)
{
case TTK_COMPOUND_TEXT:
*widthPtr = textReqWidth;
@@ -587,11 +597,11 @@ static void LabelElementSize(
case TTK_COMPOUND_TOP:
case TTK_COMPOUND_BOTTOM:
case TTK_COMPOUND_CENTER:
- *widthPtr = MAX(label->image.width, textReqWidth);
+ *widthPtr = MAX(label->image.width, textReqWidth);
break;
case TTK_COMPOUND_LEFT:
case TTK_COMPOUND_RIGHT:
- *widthPtr = label->image.width + textReqWidth + label->space;
+ *widthPtr = label->image.width + textReqWidth + label->space;
break;
case TTK_COMPOUND_NONE:
break; /* Can't happen */
@@ -618,11 +628,12 @@ static void DrawCompound(
}
static void LabelElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- LabelElement *l = elementRecord;
+ LabelElement *l = (LabelElement *)elementRecord;
Tk_Anchor anchor = TK_ANCHOR_CENTER;
+ (void)dummy;
LabelSetup(l, tkwin, state);
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index 2512c4b7..ed61a1ce 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -6,7 +6,6 @@
* Copyright (c) 2003 Joe English. Freely redistributable.
*/
-#include
#include "tkInt.h"
#include "ttkThemeInt.h"
@@ -810,7 +809,7 @@ Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node)
APPENDSTR("-sticky");
APPENDOBJ(Ttk_NewStickyObj(flags & _TTK_MASK_STICK));
- /* @@@ Check again: are these necessary? */
+ /* @@@ Check again: are these necessary? Can't see any effect! */
if (flags & TTK_BORDER) { APPENDSTR("-border"); APPENDSTR("1"); }
if (flags & TTK_UNIT) { APPENDSTR("-unit"); APPENDSTR("1"); }
diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c
index 24a0fb10..a47d8dcb 100644
--- a/generic/ttk/ttkManager.c
+++ b/generic/ttk/ttkManager.c
@@ -4,66 +4,65 @@
* Support routines for geometry managers.
*/
-#include
-#include
+#include "tkInt.h"
#include "ttkManager.h"
/*------------------------------------------------------------------------
* +++ The Geometry Propagation Dance.
*
- * When a slave window requests a new size or some other parameter changes,
- * the manager recomputes the required size for the master window and calls
+ * When a content window requests a new size or some other parameter changes,
+ * the manager recomputes the required size for the container window and calls
* Tk_GeometryRequest(). This is scheduled as an idle handler so multiple
* updates can be processed as a single batch.
*
- * If all goes well, the master's manager will process the request
- * (and so on up the chain to the toplevel window), and the master
+ * If all goes well, the container's manager will process the request
+ * (and so on up the chain to the toplevel window), and the container
* window will eventually receive a event. At this point
- * it recomputes the size and position of all slaves and places them.
+ * it recomputes the size and position of all content windows and places them.
*
- * If all does not go well, however, the master's request may be ignored
+ * If all does not go well, however, the container's request may be ignored
* (typically because the top-level window has a fixed, user-specified size).
* Tk doesn't provide any notification when this happens; to account for this,
* we also schedule an idle handler to call the layout procedure
* after making a geometry request.
*
- * +++ Slave removal <>.
+ * +++ Content window removal <>.
*
- * There are three conditions under which a slave is removed:
+ * There are three conditions under which a content window is removed:
*
* (1) Another GM claims control
* (2) Manager voluntarily relinquishes control
- * (3) Slave is destroyed
+ * (3) Content window is destroyed
*
* In case (1), Tk calls the manager's lostSlaveProc.
- * Case (2) is performed by calling Tk_ManageGeometry(slave,NULL,0);
- * in this case Tk does _not_ call the LostSlaveProc (documented behavior).
+ * Case (2) is performed by calling Tk_ManageGeometry(window,NULL,0);
+ * in this case Tk does _not_ call the lostSlaveProc (documented behavior).
* Tk doesn't handle case (3) either; to account for that we
- * register an event handler on the slave widget to track events.
+ * register an event handler on the content window to track events.
*/
/* ++ Data structures.
*/
typedef struct
{
- Tk_Window slaveWindow;
+ Tk_Window window;
Ttk_Manager *manager;
- void *slaveData;
+ void *data;
unsigned flags;
-} Ttk_Slave;
+} Ttk_Content;
-/* slave->flags bits:
+/* content->flags bits:
*/
-#define SLAVE_MAPPED 0x1 /* slave to be mapped when master is */
+#define CONTENT_MAPPED 0x1 /* content windows to be mapped when container is */
struct TtkManager_
{
Ttk_ManagerSpec *managerSpec;
void *managerData;
- Tk_Window masterWindow;
+ Tk_Window window;
unsigned flags;
- int nSlaves;
- Ttk_Slave **slaves;
+ int nContent;
+ Ttk_Content **content;
};
/* manager->flags bits:
@@ -88,7 +87,7 @@ static void ScheduleUpdate(Ttk_Manager *mgr, unsigned flags)
}
/* ++ RecomputeSize --
- * Recomputes the required size of the master window,
+ * Recomputes the required size of the container window,
* makes geometry request.
*/
static void RecomputeSize(Ttk_Manager *mgr)
@@ -96,14 +95,14 @@ static void RecomputeSize(Ttk_Manager *mgr)
int width = 1, height = 1;
if (mgr->managerSpec->RequestedSize(mgr->managerData, &width, &height)) {
- Tk_GeometryRequest(mgr->masterWindow, width, height);
+ Tk_GeometryRequest(mgr->window, width, height);
ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED);
}
mgr->flags &= ~MGR_RESIZE_REQUIRED;
}
/* ++ RecomputeLayout --
- * Recompute geometry of all slaves.
+ * Recompute geometry of all content windows.
*/
static void RecomputeLayout(Ttk_Manager *mgr)
{
@@ -116,7 +115,7 @@ static void RecomputeLayout(Ttk_Manager *mgr)
*/
static void ManagerIdleProc(ClientData clientData)
{
- Ttk_Manager *mgr = clientData;
+ Ttk_Manager *mgr = (Ttk_Manager *)clientData;
mgr->flags &= ~MGR_UPDATE_PENDING;
if (mgr->flags & MGR_RESIZE_REQUIRED) {
@@ -136,13 +135,13 @@ static void ManagerIdleProc(ClientData clientData)
*/
/* ++ ManagerEventHandler --
- * Recompute slave layout when master widget is resized.
- * Keep the slave's map state in sync with the master's.
+ * Recompute content layout when container widget is resized.
+ * Keep the content's map state in sync with the container's.
*/
static const int ManagerEventMask = StructureNotifyMask;
static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr)
{
- Ttk_Manager *mgr = clientData;
+ Ttk_Manager *mgr = (Ttk_Manager *)clientData;
int i;
switch (eventPtr->type)
@@ -151,56 +150,55 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr)
RecomputeLayout(mgr);
break;
case MapNotify:
- for (i = 0; i < mgr->nSlaves; ++i) {
- Ttk_Slave *slave = mgr->slaves[i];
- if (slave->flags & SLAVE_MAPPED) {
- Tk_MapWindow(slave->slaveWindow);
+ for (i = 0; i < mgr->nContent; ++i) {
+ Ttk_Content *content = mgr->content[i];
+ if (content->flags & CONTENT_MAPPED) {
+ Tk_MapWindow(content->window);
}
}
break;
case UnmapNotify:
- for (i = 0; i < mgr->nSlaves; ++i) {
- Ttk_Slave *slave = mgr->slaves[i];
- Tk_UnmapWindow(slave->slaveWindow);
+ for (i = 0; i < mgr->nContent; ++i) {
+ Ttk_Content *content = mgr->content[i];
+ Tk_UnmapWindow(content->window);
}
break;
}
}
-/* ++ SlaveEventHandler --
- * Notifies manager when a slave is destroyed
- * (see <>).
+/* ++ ContentLostEventHandler --
+ * Notifies manager when a content window is destroyed
+ * (see <>).
*/
-static const unsigned SlaveEventMask = StructureNotifyMask;
-static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr)
+static void ContentLostEventHandler(void *clientData, XEvent *eventPtr)
{
- Ttk_Slave *slave = clientData;
+ Ttk_Content *content = (Ttk_Content *)clientData;
if (eventPtr->type == DestroyNotify) {
- slave->manager->managerSpec->tkGeomMgr.lostSlaveProc(
- slave->manager, slave->slaveWindow);
+ content->manager->managerSpec->tkGeomMgr.lostSlaveProc(
+ content->manager, content->window);
}
}
/*------------------------------------------------------------------------
- * +++ Slave initialization and cleanup.
+ * +++ Content initialization and cleanup.
*/
-static Ttk_Slave *NewSlave(
- Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData)
+static Ttk_Content *NewContent(
+ Ttk_Manager *mgr, Tk_Window window, void *data)
{
- Ttk_Slave *slave = ckalloc(sizeof(*slave));
+ Ttk_Content *content = (Ttk_Content *)ckalloc(sizeof(Ttk_Content));
- slave->slaveWindow = slaveWindow;
- slave->manager = mgr;
- slave->flags = 0;
- slave->slaveData = slaveData;
+ content->window = window;
+ content->manager = mgr;
+ content->flags = 0;
+ content->data = data;
- return slave;
+ return content;
}
-static void DeleteSlave(Ttk_Slave *slave)
+static void DeleteContent(Ttk_Content *content)
{
- ckfree(slave);
+ ckfree(content);
}
/*------------------------------------------------------------------------
@@ -208,19 +206,19 @@ static void DeleteSlave(Ttk_Slave *slave)
*/
Ttk_Manager *Ttk_CreateManager(
- Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow)
+ Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window window)
{
- Ttk_Manager *mgr = ckalloc(sizeof(*mgr));
+ Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr));
mgr->managerSpec = managerSpec;
mgr->managerData = managerData;
- mgr->masterWindow = masterWindow;
- mgr->nSlaves = 0;
- mgr->slaves = NULL;
+ mgr->window = window;
+ mgr->nContent = 0;
+ mgr->content = NULL;
mgr->flags = 0;
Tk_CreateEventHandler(
- mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr);
+ mgr->window, ManagerEventMask, ManagerEventHandler, mgr);
return mgr;
}
@@ -228,13 +226,13 @@ Ttk_Manager *Ttk_CreateManager(
void Ttk_DeleteManager(Ttk_Manager *mgr)
{
Tk_DeleteEventHandler(
- mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr);
+ mgr->window, ManagerEventMask, ManagerEventHandler, mgr);
- while (mgr->nSlaves > 0) {
- Ttk_ForgetSlave(mgr, mgr->nSlaves - 1);
+ while (mgr->nContent > 0) {
+ Ttk_ForgetContent(mgr, mgr->nContent - 1);
}
- if (mgr->slaves) {
- ckfree(mgr->slaves);
+ if (mgr->content) {
+ ckfree(mgr->content);
}
Tcl_CancelIdleCall(ManagerIdleProc, mgr);
@@ -243,44 +241,44 @@ void Ttk_DeleteManager(Ttk_Manager *mgr)
}
/*------------------------------------------------------------------------
- * +++ Slave management.
+ * +++ Content window management.
*/
-/* ++ InsertSlave --
- * Adds slave to the list of managed windows.
+/* ++ InsertContent --
+ * Adds content to the list of managed windows.
*/
-static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, int index)
+static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, int index)
{
- int endIndex = mgr->nSlaves++;
- mgr->slaves = ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *));
+ int endIndex = mgr->nContent++;
+ mgr->content = (Ttk_Content **)ckrealloc(mgr->content, mgr->nContent * sizeof(Ttk_Content *));
while (endIndex > index) {
- mgr->slaves[endIndex] = mgr->slaves[endIndex - 1];
+ mgr->content[endIndex] = mgr->content[endIndex - 1];
--endIndex;
}
- mgr->slaves[index] = slave;
+ mgr->content[index] = content;
- Tk_ManageGeometry(slave->slaveWindow,
- &mgr->managerSpec->tkGeomMgr, (ClientData)mgr);
+ Tk_ManageGeometry(content->window,
+ &mgr->managerSpec->tkGeomMgr, mgr);
- Tk_CreateEventHandler(slave->slaveWindow,
- SlaveEventMask, SlaveEventHandler, (ClientData)slave);
+ Tk_CreateEventHandler(content->window,
+ StructureNotifyMask, ContentLostEventHandler, content);
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
-/* RemoveSlave --
- * Unmanage and delete the slave.
+/* RemoveContent --
+ * Unmanage and delete the content window.
*
* NOTES/ASSUMPTIONS:
*
* [1] It's safe to call Tk_UnmapWindow / Tk_UnmaintainGeometry even if this
- * routine is called from the slave's DestroyNotify event handler.
+ * routine is called from the content window's DestroyNotify event handler.
*/
-static void RemoveSlave(Ttk_Manager *mgr, int index)
+static void RemoveContent(Ttk_Manager *mgr, int index)
{
- Ttk_Slave *slave = mgr->slaves[index];
+ Ttk_Content *content = mgr->content[index];
int i;
/* Notify manager:
@@ -289,21 +287,21 @@ static void RemoveSlave(Ttk_Manager *mgr, int index)
/* Remove from array:
*/
- --mgr->nSlaves;
- for (i = index ; i < mgr->nSlaves; ++i) {
- mgr->slaves[i] = mgr->slaves[i+1];
+ --mgr->nContent;
+ for (i = index ; i < mgr->nContent; ++i) {
+ mgr->content[i] = mgr->content[i+1];
}
/* Clean up:
*/
Tk_DeleteEventHandler(
- slave->slaveWindow, SlaveEventMask, SlaveEventHandler, slave);
+ content->window, StructureNotifyMask, ContentLostEventHandler, content);
/* Note [1] */
- Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow);
- Tk_UnmapWindow(slave->slaveWindow);
+ Tk_UnmaintainGeometry(content->window, mgr->window);
+ Tk_UnmapWindow(content->window);
- DeleteSlave(slave);
+ DeleteContent(content);
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
@@ -312,83 +310,83 @@ static void RemoveSlave(Ttk_Manager *mgr, int index)
* +++ Tk_GeomMgr hooks.
*/
-void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow)
+void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window)
{
- Ttk_Manager *mgr = clientData;
- int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow);
- int reqWidth = Tk_ReqWidth(slaveWindow);
- int reqHeight= Tk_ReqHeight(slaveWindow);
+ Ttk_Manager *mgr = (Ttk_Manager *)clientData;
+ int index = Ttk_ContentIndex(mgr, window);
+ int reqWidth = Tk_ReqWidth(window);
+ int reqHeight= Tk_ReqHeight(window);
if (mgr->managerSpec->SlaveRequest(
- mgr->managerData, slaveIndex, reqWidth, reqHeight))
+ mgr->managerData, index, reqWidth, reqHeight))
{
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
}
-void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow)
+void Ttk_LostContentProc(ClientData clientData, Tk_Window window)
{
- Ttk_Manager *mgr = clientData;
- int index = Ttk_SlaveIndex(mgr, slaveWindow);
+ Ttk_Manager *mgr = (Ttk_Manager *)clientData;
+ int index = Ttk_ContentIndex(mgr, window);
/* ASSERT: index >= 0 */
- RemoveSlave(mgr, index);
+ RemoveContent(mgr, index);
}
/*------------------------------------------------------------------------
* +++ Public API.
*/
-/* ++ Ttk_InsertSlave --
- * Add a new slave window at the specified index.
+/* ++ Ttk_InsertContent --
+ * Add a new content window at the specified index.
*/
-void Ttk_InsertSlave(
- Ttk_Manager *mgr, int index, Tk_Window tkwin, void *slaveData)
+void Ttk_InsertContent(
+ Ttk_Manager *mgr, int index, Tk_Window tkwin, void *data)
{
- Ttk_Slave *slave = NewSlave(mgr, tkwin, slaveData);
- InsertSlave(mgr, slave, index);
+ Ttk_Content *content = NewContent(mgr, tkwin, data);
+ InsertContent(mgr, content, index);
}
-/* ++ Ttk_ForgetSlave --
- * Unmanage the specified slave.
+/* ++ Ttk_ForgetContent --
+ * Unmanage the specified content window.
*/
-void Ttk_ForgetSlave(Ttk_Manager *mgr, int slaveIndex)
+void Ttk_ForgetContent(Ttk_Manager *mgr, int index)
{
- Tk_Window slaveWindow = mgr->slaves[slaveIndex]->slaveWindow;
- RemoveSlave(mgr, slaveIndex);
- Tk_ManageGeometry(slaveWindow, NULL, 0);
+ Tk_Window window = mgr->content[index]->window;
+ RemoveContent(mgr, index);
+ Tk_ManageGeometry(window, NULL, 0);
}
-/* ++ Ttk_PlaceSlave --
- * Set the position and size of the specified slave window.
+/* ++ Ttk_PlaceContent --
+ * Set the position and size of the specified content window.
*
* NOTES:
* Contrary to documentation, Tk_MaintainGeometry doesn't always
- * map the slave.
+ * map the content window.
*/
-void Ttk_PlaceSlave(
- Ttk_Manager *mgr, int slaveIndex, int x, int y, int width, int height)
+void Ttk_PlaceContent(
+ Ttk_Manager *mgr, int index, int x, int y, int width, int height)
{
- Ttk_Slave *slave = mgr->slaves[slaveIndex];
- Tk_MaintainGeometry(slave->slaveWindow,mgr->masterWindow,x,y,width,height);
- slave->flags |= SLAVE_MAPPED;
- if (Tk_IsMapped(mgr->masterWindow)) {
- Tk_MapWindow(slave->slaveWindow);
+ Ttk_Content *content = mgr->content[index];
+ Tk_MaintainGeometry(content->window,mgr->window,x,y,width,height);
+ content->flags |= CONTENT_MAPPED;
+ if (Tk_IsMapped(mgr->window)) {
+ Tk_MapWindow(content->window);
}
}
-/* ++ Ttk_UnmapSlave --
- * Unmap the specified slave, but leave it managed.
+/* ++ Ttk_UnmapContent --
+ * Unmap the specified content window, but leave it managed.
*/
-void Ttk_UnmapSlave(Ttk_Manager *mgr, int slaveIndex)
+void Ttk_UnmapContent(Ttk_Manager *mgr, int index)
{
- Ttk_Slave *slave = mgr->slaves[slaveIndex];
- Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow);
- slave->flags &= ~SLAVE_MAPPED;
+ Ttk_Content *content = mgr->content[index];
+ Tk_UnmaintainGeometry(content->window, mgr->window);
+ content->flags &= ~CONTENT_MAPPED;
/* Contrary to documentation, Tk_UnmaintainGeometry doesn't always
- * unmap the slave:
+ * unmap the content window:
*/
- Tk_UnmapWindow(slave->slaveWindow);
+ Tk_UnmapWindow(content->window);
}
/* LayoutChanged, SizeChanged --
@@ -406,77 +404,77 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr)
/* +++ Accessors.
*/
-int Ttk_NumberSlaves(Ttk_Manager *mgr)
+int Ttk_NumberContent(Ttk_Manager *mgr)
{
- return mgr->nSlaves;
+ return mgr->nContent;
}
-void *Ttk_SlaveData(Ttk_Manager *mgr, int slaveIndex)
+void *Ttk_ContentData(Ttk_Manager *mgr, int index)
{
- return mgr->slaves[slaveIndex]->slaveData;
+ return mgr->content[index]->data;
}
-Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, int slaveIndex)
+Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, int index)
{
- return mgr->slaves[slaveIndex]->slaveWindow;
+ return mgr->content[index]->window;
}
/*------------------------------------------------------------------------
* +++ Utility routines.
*/
-/* ++ Ttk_SlaveIndex --
- * Returns the index of specified slave window, -1 if not found.
+/* ++ Ttk_ContentIndex --
+ * Returns the index of specified content window, -1 if not found.
*/
-int Ttk_SlaveIndex(Ttk_Manager *mgr, Tk_Window slaveWindow)
+int Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window)
{
int index;
- for (index = 0; index < mgr->nSlaves; ++index)
- if (mgr->slaves[index]->slaveWindow == slaveWindow)
+ for (index = 0; index < mgr->nContent; ++index)
+ if (mgr->content[index]->window == window)
return index;
return -1;
}
-/* ++ Ttk_GetSlaveIndexFromObj(interp, mgr, objPtr, indexPtr) --
- * Return the index of the slave specified by objPtr.
- * Slaves may be specified as an integer index or
+/* ++ Ttk_GetContentIndexFromObj(interp, mgr, objPtr, indexPtr) --
+ * Return the index of the content window specified by objPtr.
+ * Content windows may be specified as an integer index or
* as the name of the managed window.
*
* Returns:
* Standard Tcl completion code. Leaves an error message in case of error.
*/
-int Ttk_GetSlaveIndexFromObj(
+int Ttk_GetContentIndexFromObj(
Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, int *indexPtr)
{
const char *string = Tcl_GetString(objPtr);
- int slaveIndex = 0;
+ int index = 0;
Tk_Window tkwin;
/* Try interpreting as an integer first:
*/
- if (Tcl_GetIntFromObj(NULL, objPtr, &slaveIndex) == TCL_OK) {
- if (slaveIndex < 0 || slaveIndex >= mgr->nSlaves) {
+ if (Tcl_GetIntFromObj(NULL, objPtr, &index) == TCL_OK) {
+ if (index < 0 || index >= mgr->nContent) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Slave index %d out of bounds", slaveIndex));
+ "Slave index %d out of bounds", index));
Tcl_SetErrorCode(interp, "TTK", "SLAVE", "INDEX", NULL);
return TCL_ERROR;
}
- *indexPtr = slaveIndex;
+ *indexPtr = index;
return TCL_OK;
}
- /* Try interpreting as a slave window name;
+ /* Try interpreting as a window name;
*/
if ((*string == '.') &&
- (tkwin = Tk_NameToWindow(interp, string, mgr->masterWindow))) {
- slaveIndex = Ttk_SlaveIndex(mgr, tkwin);
- if (slaveIndex < 0) {
+ (tkwin = Tk_NameToWindow(interp, string, mgr->window))) {
+ index = Ttk_ContentIndex(mgr, tkwin);
+ if (index < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s is not managed by %s", string,
- Tk_PathName(mgr->masterWindow)));
+ Tk_PathName(mgr->window)));
Tcl_SetErrorCode(interp, "TTK", "SLAVE", "MANAGER", NULL);
return TCL_ERROR;
}
- *indexPtr = slaveIndex;
+ *indexPtr = index;
return TCL_OK;
}
@@ -486,48 +484,48 @@ int Ttk_GetSlaveIndexFromObj(
return TCL_ERROR;
}
-/* ++ Ttk_ReorderSlave(mgr, fromIndex, toIndex) --
- * Change slave order.
+/* ++ Ttk_ReorderContent(mgr, fromIndex, toIndex) --
+ * Change content window order.
*/
-void Ttk_ReorderSlave(Ttk_Manager *mgr, int fromIndex, int toIndex)
+void Ttk_ReorderContent(Ttk_Manager *mgr, int fromIndex, int toIndex)
{
- Ttk_Slave *moved = mgr->slaves[fromIndex];
+ Ttk_Content *moved = mgr->content[fromIndex];
/* Shuffle down: */
while (fromIndex > toIndex) {
- mgr->slaves[fromIndex] = mgr->slaves[fromIndex - 1];
+ mgr->content[fromIndex] = mgr->content[fromIndex - 1];
--fromIndex;
}
/* Or, shuffle up: */
while (fromIndex < toIndex) {
- mgr->slaves[fromIndex] = mgr->slaves[fromIndex + 1];
+ mgr->content[fromIndex] = mgr->content[fromIndex + 1];
++fromIndex;
}
/* ASSERT: fromIndex == toIndex */
- mgr->slaves[fromIndex] = moved;
+ mgr->content[fromIndex] = moved;
- /* Schedule a relayout. In general, rearranging slaves
+ /* Schedule a relayout. In general, rearranging content
* may also change the size:
*/
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
-/* ++ Ttk_Maintainable(interp, slave, master) --
- * Utility routine. Verifies that 'master' may be used to maintain
- * the geometry of 'slave' via Tk_MaintainGeometry:
+/* ++ Ttk_Maintainable(interp, window, container) --
+ * Utility routine. Verifies that 'container' may be used to maintain
+ * the geometry of 'window' via Tk_MaintainGeometry:
*
- * + 'master' is either 'slave's parent -OR-
- * + 'master is a descendant of 'slave's parent.
- * + 'slave' is not a toplevel window
- * + 'slave' belongs to the same toplevel as 'master'
+ * + 'container' is either 'window's parent -OR-
+ * + 'container is a descendant of 'window's parent.
+ * + 'window' is not a toplevel window
+ * + 'window' belongs to the same toplevel as 'container'
*
* Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'.
*/
-int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master)
+int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window window, Tk_Window container)
{
- Tk_Window ancestor = master, parent = Tk_Parent(slave);
+ Tk_Window ancestor = container, parent = Tk_Parent(window);
- if (Tk_IsTopLevel(slave) || slave == master) {
+ if (Tk_IsTopLevel(window) || window == container) {
goto badWindow;
}
@@ -542,7 +540,7 @@ int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master)
badWindow:
Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as slave of %s",
- Tk_PathName(slave), Tk_PathName(master)));
+ Tk_PathName(window), Tk_PathName(container)));
Tcl_SetErrorCode(interp, "TTK", "GEOMETRY", "MAINTAINABLE", NULL);
return 0;
}
diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h
index d22ff98e..d487deaf 100644
--- a/generic/ttk/ttkManager.h
+++ b/generic/ttk/ttkManager.h
@@ -14,16 +14,16 @@ typedef struct TtkManager_ Ttk_Manager;
/*
* Geometry manager specification record:
*
- * RequestedSize computes the requested size of the master window.
+ * RequestedSize computes the requested size of the container window.
*
- * PlaceSlaves sets the position and size of all managed slaves
- * by calling Ttk_PlaceSlave().
+ * PlaceSlaves sets the position and size of all managed content windows
+ * by calling Ttk_PlaceContent().
*
- * SlaveRemoved() is called immediately before a slave is removed.
- * NB: the associated slave window may have been destroyed when this
+ * SlaveRemoved() is called immediately before a content window is removed.
+ * NB: the associated content window may have been destroyed when this
* routine is called.
- *
- * SlaveRequest() is called when a slave requests a size change.
+ *
+ * SlaveRequest() is called when a content window requests a size change.
* It should return 1 if the request should propagate, 0 otherwise.
*/
typedef struct { /* Manager hooks */
@@ -31,37 +31,43 @@ typedef struct { /* Manager hooks */
int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr);
void (*PlaceSlaves)(void *managerData);
- int (*SlaveRequest)(void *managerData, int slaveIndex, int w, int h);
- void (*SlaveRemoved)(void *managerData, int slaveIndex);
+ int (*SlaveRequest)(void *managerData, int index, int w, int h);
+ void (*SlaveRemoved)(void *managerData, int index);
} Ttk_ManagerSpec;
/*
* Default implementations for Tk_GeomMgr hooks:
*/
-MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window slave);
-MODULE_SCOPE void Ttk_LostSlaveProc(ClientData, Tk_Window slave);
+#define Ttk_LostContentProc Ttk_LostSlaveProc
+MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window window);
+MODULE_SCOPE void Ttk_LostContentProc(ClientData, Tk_Window window);
/*
* Public API:
*/
MODULE_SCOPE Ttk_Manager *Ttk_CreateManager(
- Ttk_ManagerSpec *, void *managerData, Tk_Window masterWindow);
+ Ttk_ManagerSpec *, void *managerData, Tk_Window window);
MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *);
-MODULE_SCOPE void Ttk_InsertSlave(
- Ttk_Manager *, int position, Tk_Window, void *slaveData);
+#define Ttk_InsertContent Ttk_InsertSlave
+MODULE_SCOPE void Ttk_InsertContent(
+ Ttk_Manager *, int position, Tk_Window, void *data);
-MODULE_SCOPE void Ttk_ForgetSlave(Ttk_Manager *, int slaveIndex);
+#define Ttk_ForgetContent Ttk_ForgetSlave
+MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, int index);
-MODULE_SCOPE void Ttk_ReorderSlave(Ttk_Manager *, int fromIndex, int toIndex);
- /* Rearrange slave positions */
+#define Ttk_ReorderContent Ttk_ReorderSlave
+MODULE_SCOPE void Ttk_ReorderContent(Ttk_Manager *, int fromIndex, int toIndex);
+ /* Rearrange content window positions */
-MODULE_SCOPE void Ttk_PlaceSlave(
- Ttk_Manager *, int slaveIndex, int x, int y, int width, int height);
- /* Position and map the slave */
+#define Ttk_PlaceContent Ttk_PlaceSlave
+MODULE_SCOPE void Ttk_PlaceContent(
+ Ttk_Manager *, int index, int x, int y, int width, int height);
+ /* Position and map the content window */
-MODULE_SCOPE void Ttk_UnmapSlave(Ttk_Manager *, int slaveIndex);
- /* Unmap the slave */
+#define Ttk_UnmapContent Ttk_UnmapSlave
+MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, int index);
+ /* Unmap the content window */
MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *);
MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *);
@@ -69,24 +75,29 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *);
/* Utilities:
*/
-MODULE_SCOPE int Ttk_SlaveIndex(Ttk_Manager *, Tk_Window);
- /* Returns: index in slave array of specified window, -1 if not found */
+#define Ttk_ContentIndex Ttk_SlaveIndex
+MODULE_SCOPE int Ttk_ContentIndex(Ttk_Manager *, Tk_Window);
+ /* Returns: index in content array of specified window, -1 if not found */
-MODULE_SCOPE int Ttk_GetSlaveIndexFromObj(
+#define Ttk_GetContentIndexFromObj Ttk_GetSlaveIndexFromObj
+MODULE_SCOPE int Ttk_GetContentIndexFromObj(
Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, int *indexPtr);
/* Accessor functions:
*/
-MODULE_SCOPE int Ttk_NumberSlaves(Ttk_Manager *);
- /* Returns: number of managed slaves */
+#define Ttk_NumberContent Ttk_NumberSlaves
+MODULE_SCOPE int Ttk_NumberContent(Ttk_Manager *);
+ /* Returns: number of managed content windows */
-MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, int slaveIndex);
- /* Returns: client data associated with slave */
+#define Ttk_ContentData Ttk_SlaveData
+MODULE_SCOPE void *Ttk_ContentData(Ttk_Manager *, int index);
+ /* Returns: client data associated with content window */
-MODULE_SCOPE Tk_Window Ttk_SlaveWindow(Ttk_Manager *, int slaveIndex);
- /* Returns: slave window */
+#define Ttk_ContentWindow Ttk_SlaveWindow
+MODULE_SCOPE Tk_Window Ttk_ContentWindow(Ttk_Manager *, int index);
+ /* Returns: content window */
-MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window slave, Tk_Window master);
- /* Returns: 1 if master can manage slave; 0 otherwise leaving error msg */
+MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window content, Tk_Window container);
+ /* Returns: 1 if container can manage content; 0 otherwise leaving error msg */
#endif /* _TTKMANAGER */
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 39ed6aaa..ea82ef18 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -2,10 +2,7 @@
* Copyright (c) 2004, Joe English
*/
-#include
-#include
-#include
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -57,20 +54,20 @@ typedef struct
* relevant to the tab.
*
* PaneOptionSpecs includes additional options for child window placement
- * and is used to configure the slave.
+ * and is used to configure the content window.
*/
static Tk_OptionSpec TabOptionSpecs[] =
{
{TK_OPTION_STRING_TABLE, "-state", "", "",
"normal", -1,Tk_Offset(Tab,state),
- 0,(ClientData)TabStateStrings,0 },
+ 0, (void *)TabStateStrings, 0 },
{TK_OPTION_STRING, "-text", "text", "Text", "",
Tk_Offset(Tab,textObj), -1, 0,0,GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/,
Tk_Offset(Tab,imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
NULL, Tk_Offset(Tab,compoundObj), -1,
- TK_OPTION_NULL_OK,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED },
+ TK_OPTION_NULL_OK, (void *)ttkCompoundStrings, GEOMETRY_CHANGED },
{TK_OPTION_INT, "-underline", "underline", "Underline", "-1",
Tk_Offset(Tab,underlineObj), -1, 0,0,GEOMETRY_CHANGED },
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 }
@@ -102,7 +99,7 @@ typedef struct
int activeIndex; /* index of currently active tab */
Ttk_Layout tabLayout; /* Sublayout for tabs */
- Ttk_Box clientArea; /* Where to pack slave widgets */
+ Ttk_Box clientArea; /* Where to pack content widgets */
} NotebookPart;
typedef struct
@@ -191,13 +188,13 @@ static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle)
* +++ Tab management.
*/
-static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window slaveWindow)
+static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window window)
{
Tk_OptionTable optionTable = nb->notebook.paneOptionTable;
- void *record = ckalloc(sizeof(Tab));
+ Tab *record = (Tab *)ckalloc(sizeof(Tab));
memset(record, 0, sizeof(Tab));
- if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) {
+ if (Tk_InitOptions(interp, (char *)record, optionTable, window) != TCL_OK) {
ckfree(record);
return NULL;
}
@@ -213,7 +210,7 @@ static void DestroyTab(Notebook *nb, Tab *tab)
}
static int ConfigureTab(
- Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window slaveWindow,
+ Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Ttk_Sticky sticky = tab->sticky;
@@ -221,8 +218,8 @@ static int ConfigureTab(
Tk_SavedOptions savedOptions;
int mask = 0;
- if (Tk_SetOptions(interp, (ClientData)tab, nb->notebook.paneOptionTable,
- objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK)
+ if (Tk_SetOptions(interp, (void *)tab, nb->notebook.paneOptionTable,
+ objc, objv, window, &savedOptions, &mask) != TCL_OK)
{
return TCL_ERROR;
}
@@ -234,7 +231,7 @@ static int ConfigureTab(
{
goto error;
}
- if (Ttk_GetPaddingFromObj(interp, slaveWindow, tab->paddingObj, &padding)
+ if (Ttk_GetPaddingFromObj(interp, window, tab->paddingObj, &padding)
!= TCL_OK)
{
goto error;
@@ -261,8 +258,8 @@ error:
static int IdentifyTab(Notebook *nb, int x, int y)
{
int index;
- for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) {
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index);
+ for (index = 0; index < Ttk_NumberContent(nb->notebook.mgr); ++index) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,index);
if ( tab->state != TAB_STATE_HIDDEN
&& Ttk_BoxContains(tab->parcel, x,y))
{
@@ -294,7 +291,7 @@ static void ActivateTab(Notebook *nb, int index)
static Ttk_State TabState(Notebook *nb, int index)
{
Ttk_State state = nb->core.state;
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *itab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
int i = 0;
if (index == nb->notebook.currentIndex) {
@@ -306,8 +303,8 @@ static Ttk_State TabState(Notebook *nb, int index)
if (index == nb->notebook.activeIndex) {
state |= TTK_STATE_ACTIVE;
}
- for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
+ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
if (tab->state == TAB_STATE_HIDDEN) {
continue;
}
@@ -316,8 +313,8 @@ static Ttk_State TabState(Notebook *nb, int index)
}
break;
}
- for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i >= 0; --i) {
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
+ for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i != -1; --i) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
if (tab->state == TAB_STATE_HIDDEN) {
continue;
}
@@ -326,7 +323,7 @@ static Ttk_State TabState(Notebook *nb, int index)
}
break;
}
- if (tab->state == TAB_STATE_DISABLED) {
+ if (itab->state == TAB_STATE_DISABLED) {
state |= TTK_STATE_DISABLED;
}
@@ -357,8 +354,8 @@ static void TabrowSize(
int tabrowWidth = 0, tabrowHeight = 0;
int i;
- for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
+ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
Ttk_State tabState = TabState(nb,i);
Ttk_RebindSublayout(tabLayout, tab);
@@ -382,13 +379,13 @@ static void TabrowSize(
*
* Total height is tab height + client area height + pane internal padding
* Total width is max(client width, tab width) + pane internal padding
- * Client area size determined by max size of slaves,
+ * Client area size determined by max size of content windows,
* overridden by -width and/or -height if nonzero.
*/
static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
{
- Notebook *nb = clientData;
+ Notebook *nb = (Notebook *)clientData;
NotebookStyle nbstyle;
Ttk_Padding padding;
Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client");
@@ -399,18 +396,18 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
NotebookStyleOptions(nb, &nbstyle);
- /* Compute max requested size of all slaves:
+ /* Compute max requested size of all content windows:
*/
- for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
- Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, i);
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
- int slaveWidth
- = Tk_ReqWidth(slaveWindow) + Ttk_PaddingWidth(tab->padding);
- int slaveHeight
- = Tk_ReqHeight(slaveWindow) + Ttk_PaddingHeight(tab->padding);
+ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
+ Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, i);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
+ int width
+ = Tk_ReqWidth(window) + Ttk_PaddingWidth(tab->padding);
+ int height
+ = Tk_ReqHeight(window) + Ttk_PaddingHeight(tab->padding);
- clientWidth = MAX(clientWidth, slaveWidth);
- clientHeight = MAX(clientHeight, slaveHeight);
+ clientWidth = MAX(clientWidth, width);
+ clientHeight = MAX(clientHeight, height);
}
/* Client width/height overridable by widget options:
@@ -465,7 +462,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
static void SqueezeTabs(
Notebook *nb, int needed, int available)
{
- int nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ int nTabs = Ttk_NumberContent(nb->notebook.mgr);
if (nTabs > 0) {
int difference = available - needed;
@@ -474,7 +471,7 @@ static void SqueezeTabs(
int i;
for (i = 0; i < nTabs; ++i) {
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr,i);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,i);
double ad = slack + tab->width * delta;
tab->width += (int)ad;
slack = ad - (int)ad;
@@ -489,11 +486,11 @@ static void PlaceTabs(
Notebook *nb, Ttk_Box tabrowBox, Ttk_PositionSpec tabPlacement)
{
Ttk_Layout tabLayout = nb->notebook.tabLayout;
- int nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ int nTabs = Ttk_NumberContent(nb->notebook.mgr);
int i;
for (i = 0; i < nTabs; ++i) {
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
Ttk_State tabState = TabState(nb, i);
if (tab->state != TAB_STATE_HIDDEN) {
@@ -517,11 +514,11 @@ static void PlaceTabs(
* Computes notebook layout and places tabs.
*
* Side effects:
- * Sets clientArea, used to place slave panes.
+ * Sets clientArea, used to place panes.
*/
static void NotebookDoLayout(void *recordPtr)
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
Tk_Window nbwin = nb->core.tkwin;
Ttk_Box cavity = Ttk_WinBox(nbwin);
int tabrowWidth = 0, tabrowHeight = 0;
@@ -571,32 +568,32 @@ static void NotebookDoLayout(void *recordPtr)
}
/*
- * NotebookPlaceSlave --
+ * NotebookPlaceContent --
* Set the position and size of a child widget
- * based on the current client area and slave options:
+ * based on the current client area and content window options:
*/
-static void NotebookPlaceSlave(Notebook *nb, int slaveIndex)
+static void NotebookPlaceContent(Notebook *nb, int index)
{
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex);
- Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, slaveIndex);
- Ttk_Box slaveBox =
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, index);
+ Ttk_Box box =
Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding),
- Tk_ReqWidth(slaveWindow), Tk_ReqHeight(slaveWindow),tab->sticky);
+ Tk_ReqWidth(window), Tk_ReqHeight(window),tab->sticky);
- Ttk_PlaceSlave(nb->notebook.mgr, slaveIndex,
- slaveBox.x, slaveBox.y, slaveBox.width, slaveBox.height);
+ Ttk_PlaceContent(nb->notebook.mgr, index,
+ box.x, box.y, box.width, box.height);
}
-/* NotebookPlaceSlaves --
+/* NotebookPlaceContents --
* Geometry manager hook.
*/
-static void NotebookPlaceSlaves(void *recordPtr)
+static void NotebookPlaceContents(void *recordPtr)
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
int currentIndex = nb->notebook.currentIndex;
if (currentIndex >= 0) {
NotebookDoLayout(nb);
- NotebookPlaceSlave(nb, currentIndex);
+ NotebookPlaceContent(nb, currentIndex);
}
}
@@ -606,7 +603,7 @@ static void NotebookPlaceSlaves(void *recordPtr)
*/
static void SelectTab(Notebook *nb, int index)
{
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
int currentIndex = nb->notebook.currentIndex;
if (index == currentIndex) {
@@ -624,15 +621,15 @@ static void SelectTab(Notebook *nb, int index)
}
if (currentIndex >= 0) {
- Ttk_UnmapSlave(nb->notebook.mgr, currentIndex);
+ Ttk_UnmapContent(nb->notebook.mgr, currentIndex);
}
- /* Must be set before calling NotebookPlaceSlave(), otherwise it may
- * happen that NotebookPlaceSlaves(), triggered by an interveaning
+ /* Must be set before calling NotebookPlaceContent(), otherwise it may
+ * happen that NotebookPlaceContents(), triggered by an interveaning
* geometry request, will swap to old index. */
nb->notebook.currentIndex = index;
- NotebookPlaceSlave(nb, index);
+ NotebookPlaceContent(nb, index);
TtkRedisplayWidget(&nb->core);
TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
@@ -645,13 +642,13 @@ static void SelectTab(Notebook *nb, int index)
*/
static int NextTab(Notebook *nb, int index)
{
- int nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ int nTabs = Ttk_NumberContent(nb->notebook.mgr);
int nextIndex;
/* Scan forward for following usable tab:
*/
for (nextIndex = index + 1; nextIndex < nTabs; ++nextIndex) {
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex);
if (tab->state == TAB_STATE_NORMAL) {
return nextIndex;
}
@@ -660,7 +657,7 @@ static int NextTab(Notebook *nb, int index)
/* Not found -- scan backwards.
*/
for (nextIndex = index - 1; nextIndex >= 0; --nextIndex) {
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex);
if (tab->state == TAB_STATE_NORMAL) {
return nextIndex;
}
@@ -684,7 +681,7 @@ static void SelectNearestTab(Notebook *nb)
int nextIndex = NextTab(nb, currentIndex);
if (currentIndex >= 0) {
- Ttk_UnmapSlave(nb->notebook.mgr, currentIndex);
+ Ttk_UnmapContent(nb->notebook.mgr, currentIndex);
}
if (currentIndex != nextIndex) {
TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
@@ -695,14 +692,14 @@ static void SelectNearestTab(Notebook *nb)
TtkRedisplayWidget(&nb->core);
}
-/* TabRemoved -- GM SlaveRemoved hook.
+/* TabRemoved -- GM TabRemoved hook.
* Select the next tab if the current one is being removed.
- * Adjust currentIndex to account for removed slave.
+ * Adjust currentIndex to account for removed content window.
*/
static void TabRemoved(void *managerData, int index)
{
- Notebook *nb = managerData;
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index);
+ Notebook *nb = (Notebook *)managerData;
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
if (index == nb->notebook.currentIndex) {
SelectNearestTab(nb);
@@ -717,7 +714,11 @@ static void TabRemoved(void *managerData, int index)
TtkRedisplayWidget(&nb->core);
}
-static int TabRequest(void *managerData, int index, int width, int height)
+static int TabRequest(
+ TCL_UNUSED(void *),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
return 1;
}
@@ -727,17 +728,17 @@ static int TabRequest(void *managerData, int index, int width, int height)
*/
static int AddTab(
Tcl_Interp *interp, Notebook *nb,
- int destIndex, Tk_Window slaveWindow,
+ int destIndex, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Tab *tab;
- if (!Ttk_Maintainable(interp, slaveWindow, nb->core.tkwin)) {
+ if (!Ttk_Maintainable(interp, window, nb->core.tkwin)) {
return TCL_ERROR;
}
#if 0 /* can't happen */
- if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) >= 0) {
+ if (Ttk_ContentIndex(nb->notebook.mgr, window) >= 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added",
- Tk_PathName(slaveWindow)));
+ Tk_PathName(window)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL);
return TCL_ERROR;
}
@@ -745,16 +746,16 @@ static int AddTab(
/* Create and insert tab.
*/
- tab = CreateTab(interp, nb, slaveWindow);
+ tab = CreateTab(interp, nb, window);
if (!tab) {
return TCL_ERROR;
}
- if (ConfigureTab(interp, nb, tab, slaveWindow, objc, objv) != TCL_OK) {
+ if (ConfigureTab(interp, nb, tab, window, objc, objv) != TCL_OK) {
DestroyTab(nb, tab);
return TCL_ERROR;
}
- Ttk_InsertSlave(nb->notebook.mgr, destIndex, slaveWindow, tab);
+ Ttk_InsertContent(nb->notebook.mgr, destIndex, window, tab);
/* Adjust indices and/or autoselect first tab:
*/
@@ -768,9 +769,9 @@ static int AddTab(
}
static Ttk_ManagerSpec NotebookManagerSpec = {
- { "notebook", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ { "notebook", Ttk_GeometryRequestProc, Ttk_LostContentProc },
NotebookSize,
- NotebookPlaceSlaves,
+ NotebookPlaceContents,
TabRequest,
TabRemoved
};
@@ -789,7 +790,7 @@ static const int NotebookEventMask
;
static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr)
{
- Notebook *nb = clientData;
+ Notebook *nb = (Notebook *)clientData;
if (eventPtr->type == DestroyNotify) { /* Remove self */
Tk_DeleteEventHandler(nb->core.tkwin,
@@ -813,7 +814,7 @@ static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr)
* + positional specifications @x,y,
* + "current",
* + numeric indices [0..nTabs],
- * + slave window names
+ * + content window names
*
* Stores index of specified tab in *index_rtn, -1 if not found.
*
@@ -844,15 +845,15 @@ static int FindTabIndex(
return TCL_OK;
}
- /* ... or integer index or slave window name:
+ /* ... or integer index or content window name:
*/
- if (Ttk_GetSlaveIndexFromObj(
+ if (Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objPtr, index_rtn) == TCL_OK)
{
return TCL_OK;
}
- /* Nothing matched; Ttk_GetSlaveIndexFromObj will have left error message.
+ /* Nothing matched; Ttk_GetContentIndexFromObj will have left error message.
*/
return TCL_ERROR;
}
@@ -885,10 +886,9 @@ static int GetTabIndex(
static int NotebookAddCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Notebook *nb = recordPtr;
- int index = Ttk_NumberSlaves(nb->notebook.mgr);
- Tk_Window slaveWindow;
- int slaveIndex;
+ Notebook *nb = (Notebook *)recordPtr;
+ Tk_Window window;
+ int index;
Tab *tab;
if (objc <= 2 || objc % 2 != 1) {
@@ -896,21 +896,21 @@ static int NotebookAddCommand(
return TCL_ERROR;
}
- slaveWindow = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin);
- if (!slaveWindow) {
+ window = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin);
+ if (!window) {
return TCL_ERROR;
}
- slaveIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow);
+ index = Ttk_ContentIndex(nb->notebook.mgr, window);
- if (slaveIndex < 0) { /* New tab */
- return AddTab(interp, nb, index, slaveWindow, objc-3,objv+3);
+ if (index < 0) { /* New tab */
+ return AddTab(interp, nb, Ttk_NumberContent(nb->notebook.mgr), window, objc-3,objv+3);
}
- tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex);
+ tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
if (tab->state == TAB_STATE_HIDDEN) {
tab->state = TAB_STATE_NORMAL;
}
- if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) {
+ if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) {
return TCL_ERROR;
}
@@ -925,9 +925,9 @@ static int NotebookAddCommand(
static int NotebookInsertCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
int current = nb->notebook.currentIndex;
- int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ int nContent = Ttk_NumberContent(nb->notebook.mgr);
int srcIndex, destIndex;
if (objc < 4) {
@@ -936,46 +936,46 @@ static int NotebookInsertCommand(
}
if (!strcmp(Tcl_GetString(objv[2]), "end")) {
- destIndex = Ttk_NumberSlaves(nb->notebook.mgr);
- } else if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ destIndex = Ttk_NumberContent(nb->notebook.mgr);
+ } else if (TCL_OK != Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objv[2], &destIndex)) {
return TCL_ERROR;
}
if (Tcl_GetString(objv[3])[0] == '.') {
- /* Window name -- could be new or existing slave.
+ /* Window name -- could be new or existing content window.
*/
- Tk_Window slaveWindow =
+ Tk_Window window =
Tk_NameToWindow(interp,Tcl_GetString(objv[3]),nb->core.tkwin);
- if (!slaveWindow) {
+ if (!window) {
return TCL_ERROR;
}
- srcIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow);
- if (srcIndex < 0) { /* New slave */
- return AddTab(interp, nb, destIndex, slaveWindow, objc-4,objv+4);
+ srcIndex = Ttk_ContentIndex(nb->notebook.mgr, window);
+ if (srcIndex < 0) { /* New content window */
+ return AddTab(interp, nb, destIndex, window, objc-4,objv+4);
}
- } else if (Ttk_GetSlaveIndexFromObj(
+ } else if (Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK)
{
return TCL_ERROR;
}
- /* Move existing slave:
+ /* Move existing content window:
*/
if (ConfigureTab(interp, nb,
- Ttk_SlaveData(nb->notebook.mgr,srcIndex),
- Ttk_SlaveWindow(nb->notebook.mgr,srcIndex),
+ (Tab *)Ttk_ContentData(nb->notebook.mgr, srcIndex),
+ Ttk_ContentWindow(nb->notebook.mgr, srcIndex),
objc-4,objv+4) != TCL_OK)
{
return TCL_ERROR;
}
- if (destIndex >= nSlaves) {
- destIndex = nSlaves - 1;
+ if (destIndex >= nContent) {
+ destIndex = nContent - 1;
}
- Ttk_ReorderSlave(nb->notebook.mgr, srcIndex, destIndex);
+ Ttk_ReorderContent(nb->notebook.mgr, srcIndex, destIndex);
/* Adjust internal indexes:
*/
@@ -999,7 +999,7 @@ static int NotebookInsertCommand(
static int NotebookForgetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
int index;
if (objc != 3) {
@@ -1011,7 +1011,7 @@ static int NotebookForgetCommand(
return TCL_ERROR;
}
- Ttk_ForgetSlave(nb->notebook.mgr, index);
+ Ttk_ForgetContent(nb->notebook.mgr, index);
TtkRedisplayWidget(&nb->core);
return TCL_OK;
@@ -1023,7 +1023,7 @@ static int NotebookForgetCommand(
static int NotebookHideCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
int index;
Tab *tab;
@@ -1036,7 +1036,7 @@ static int NotebookHideCommand(
return TCL_ERROR;
}
- tab = Ttk_SlaveData(nb->notebook.mgr, index);
+ tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
tab->state = TAB_STATE_HIDDEN;
if (index == nb->notebook.currentIndex) {
SelectNearestTab(nb);
@@ -1056,16 +1056,17 @@ static int NotebookIdentifyCommand(
static const char *whatTable[] = { "element", "tab", NULL };
enum { IDENTIFY_ELEMENT, IDENTIFY_TAB };
int what = IDENTIFY_ELEMENT;
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
Ttk_Element element = NULL;
- int x, y, tabIndex;
+ int x, y;
+ int tabIndex;
if (objc < 4 || objc > 5) {
Tcl_WrongNumArgs(interp, 2,objv, "?what? x y");
return TCL_ERROR;
}
- if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
+ if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
|| Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK
|| (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable,
sizeof(char *), "option", 0, &what) != TCL_OK)
@@ -1075,7 +1076,7 @@ static int NotebookIdentifyCommand(
tabIndex = IdentifyTab(nb, x, y);
if (tabIndex >= 0) {
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, tabIndex);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, tabIndex);
Ttk_State state = TabState(nb, tabIndex);
Ttk_Layout tabLayout = nb->notebook.tabLayout;
@@ -1110,8 +1111,9 @@ static int NotebookIdentifyCommand(
static int NotebookIndexCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Notebook *nb = recordPtr;
- int index, status;
+ Notebook *nb = (Notebook *)recordPtr;
+ int index;
+ int status;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "tab");
@@ -1122,8 +1124,8 @@ static int NotebookIndexCommand(
* Special-case for "end":
*/
if (!strcmp("end", Tcl_GetString(objv[2]))) {
- int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(nSlaves));
+ int nContent = Ttk_NumberContent(nb->notebook.mgr);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(nContent));
return TCL_OK;
}
@@ -1142,11 +1144,11 @@ static int NotebookIndexCommand(
static int NotebookSelectCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
if (objc == 2) {
if (nb->notebook.currentIndex >= 0) {
- Tk_Window pane = Ttk_SlaveWindow(
+ Tk_Window pane = Ttk_ContentWindow(
nb->notebook.mgr, nb->notebook.currentIndex);
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(pane), -1));
}
@@ -1168,7 +1170,7 @@ static int NotebookSelectCommand(
static int NotebookTabsCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
Ttk_Manager *mgr = nb->notebook.mgr;
Tcl_Obj *result;
int i;
@@ -1179,8 +1181,8 @@ static int NotebookTabsCommand(
}
result = Tcl_NewListObj(0, NULL);
- for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) {
- const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i));
+ for (i = 0; i < Ttk_NumberContent(mgr); ++i) {
+ const char *pathName = Tk_PathName(Ttk_ContentWindow(mgr,i));
Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(pathName,-1));
}
@@ -1193,10 +1195,10 @@ static int NotebookTabsCommand(
static int NotebookTabCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
Ttk_Manager *mgr = nb->notebook.mgr;
int index;
- Tk_Window slaveWindow;
+ Tk_Window window;
Tab *tab;
if (objc < 3) {
@@ -1208,18 +1210,18 @@ static int NotebookTabCommand(
return TCL_ERROR;
}
- tab = Ttk_SlaveData(mgr, index);
- slaveWindow = Ttk_SlaveWindow(mgr, index);
+ tab = (Tab *)Ttk_ContentData(mgr, index);
+ window = Ttk_ContentWindow(mgr, index);
if (objc == 3) {
return TtkEnumerateOptions(interp, tab,
- PaneOptionSpecs, nb->notebook.paneOptionTable, slaveWindow);
+ PaneOptionSpecs, nb->notebook.paneOptionTable, window);
} else if (objc == 4) {
return TtkGetOptionValue(interp, tab, objv[3],
- nb->notebook.paneOptionTable, slaveWindow);
+ nb->notebook.paneOptionTable, window);
} /* else */
- if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) {
+ if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) {
return TCL_ERROR;
}
@@ -1258,7 +1260,7 @@ static const Ttk_Ensemble NotebookCommands[] = {
static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr)
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
nb->notebook.mgr = Ttk_CreateManager(
&NotebookManagerSpec, recordPtr, nb->core.tkwin);
@@ -1278,7 +1280,7 @@ static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr)
static void NotebookCleanup(void *recordPtr)
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
Ttk_DeleteManager(nb->notebook.mgr);
if (nb->notebook.tabLayout)
@@ -1287,7 +1289,7 @@ static void NotebookCleanup(void *recordPtr)
static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask)
{
- Notebook *nb = clientData;
+ Notebook *nb = (Notebook *)clientData;
/*
* Error-checks:
@@ -1311,7 +1313,7 @@ static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask)
static Ttk_Layout NotebookGetLayout(
Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
{
- Notebook *nb = recordPtr;
+ Notebook *nb = (Notebook *)recordPtr;
Ttk_Layout notebookLayout = TtkWidgetGetLayout(interp, theme, recordPtr);
Ttk_Layout tabLayout;
@@ -1339,7 +1341,7 @@ static Ttk_Layout NotebookGetLayout(
static void DisplayTab(Notebook *nb, int index, Drawable d)
{
Ttk_Layout tabLayout = nb->notebook.tabLayout;
- Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
Ttk_State state = TabState(nb, index);
if (tab->state != TAB_STATE_HIDDEN) {
@@ -1351,8 +1353,8 @@ static void DisplayTab(Notebook *nb, int index, Drawable d)
static void NotebookDisplay(void *clientData, Drawable d)
{
- Notebook *nb = clientData;
- int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ Notebook *nb = (Notebook *)clientData;
+ int nContent = Ttk_NumberContent(nb->notebook.mgr);
int index;
/* Draw notebook background (base layout):
@@ -1362,7 +1364,7 @@ static void NotebookDisplay(void *clientData, Drawable d)
/* Draw tabs from left to right, but draw the current tab last
* so it will overwrite its neighbors.
*/
- for (index = 0; index < nSlaves; ++index) {
+ for (index = 0; index < nContent; ++index) {
if (index != nb->notebook.currentIndex) {
DisplayTab(nb, index, d);
}
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index adc2aefb..4fbbf94c 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -6,8 +6,7 @@
* TODO: track active/pressed sash.
*/
-#include
-#include
+#include "tkInt.h"
#include "ttkManager.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -29,7 +28,7 @@
* gives the same result as changing the size by X+Y pixels
* in one step).
*
- * The request size is initially set to the slave window's requested size.
+ * The request size is initially set to the content window's requested size.
* When the user drags a sash, each pane's request size is set to its
* actual size. This ensures that panes "stay put" on the next resize.
*
@@ -78,20 +77,20 @@ typedef struct {
static Tk_OptionSpec PanedOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
Tk_Offset(Paned,paned.orientObj), Tk_Offset(Paned,paned.orient),
- 0,(ClientData)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, READONLY_OPTION|STYLE_CHANGED },
{TK_OPTION_INT, "-width", "width", "Width", "0",
-1,Tk_Offset(Paned,paned.width),
- 0,0,GEOMETRY_CHANGED },
+ 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_INT, "-height", "height", "Height", "0",
-1,Tk_Offset(Paned,paned.height),
- 0,0,GEOMETRY_CHANGED },
+ 0, 0, GEOMETRY_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
};
/*------------------------------------------------------------------------
- * +++ Slave pane record.
+ * +++ Pane record.
*/
typedef struct {
int reqSize; /* Pane request size */
@@ -108,21 +107,21 @@ static Tk_OptionSpec PaneOptionSpecs[] = {
/* CreatePane --
* Create a new pane record.
*/
-static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow)
+static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window window)
{
Tk_OptionTable optionTable = pw->paned.paneOptionTable;
void *record = ckalloc(sizeof(Pane));
- Pane *pane = record;
+ Pane *pane = (Pane *)record;
memset(record, 0, sizeof(Pane));
- if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) {
+ if (Tk_InitOptions(interp, record, optionTable, window) != TCL_OK) {
ckfree(record);
return NULL;
}
pane->reqSize
= pw->paned.orient == TTK_ORIENT_HORIZONTAL
- ? Tk_ReqWidth(slaveWindow) : Tk_ReqHeight(slaveWindow);
+ ? Tk_ReqWidth(window) : Tk_ReqHeight(window);
return pane;
}
@@ -141,7 +140,7 @@ static void DestroyPane(Paned *pw, Pane *pane)
* Set pane options.
*/
static int ConfigurePane(
- Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow,
+ Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Ttk_Manager *mgr = pw->paned.mgr;
@@ -149,7 +148,7 @@ static int ConfigurePane(
int mask = 0;
if (Tk_SetOptions(interp, (void*)pane, pw->paned.paneOptionTable,
- objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK)
+ objc, objv, window, &savedOptions, &mask) != TCL_OK)
{
return TCL_ERROR;
}
@@ -189,14 +188,14 @@ error:
static int ShoveUp(Paned *pw, int i, int pos)
{
- Pane *pane = Ttk_SlaveData(pw->paned.mgr, i);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, i);
int sashThickness = pw->paned.sashThickness;
if (i == 0) {
if (pos < 0)
pos = 0;
} else {
- Pane *prevPane = Ttk_SlaveData(pw->paned.mgr, i-1);
+ Pane *prevPane = (Pane *)Ttk_ContentData(pw->paned.mgr, i-1);
if (pos < prevPane->sashPos + sashThickness)
pos = ShoveUp(pw, i-1, pos - sashThickness) + sashThickness;
}
@@ -209,13 +208,13 @@ static int ShoveUp(Paned *pw, int i, int pos)
*/
static int ShoveDown(Paned *pw, int i, int pos)
{
- Pane *pane = Ttk_SlaveData(pw->paned.mgr,i);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr,i);
int sashThickness = pw->paned.sashThickness;
- if (i == Ttk_NumberSlaves(pw->paned.mgr) - 1) {
- pos = pane->sashPos; /* Sentinel value == master window size */
+ if (i == Ttk_NumberContent(pw->paned.mgr) - 1) {
+ pos = pane->sashPos; /* Sentinel value == container window size */
} else {
- Pane *nextPane = Ttk_SlaveData(pw->paned.mgr,i+1);
+ Pane *nextPane = (Pane *)Ttk_ContentData(pw->paned.mgr,i+1);
if (pos + sashThickness > nextPane->sashPos)
pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness;
}
@@ -230,8 +229,8 @@ static int ShoveDown(Paned *pw, int i, int pos)
*/
static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr)
{
- Paned *pw = recordPtr;
- int nPanes = Ttk_NumberSlaves(pw->paned.mgr);
+ Paned *pw = (Paned *)recordPtr;
+ int nPanes = Ttk_NumberContent(pw->paned.mgr);
int nSashes = nPanes - 1;
int sashThickness = pw->paned.sashThickness;
int width = 0, height = 0;
@@ -239,21 +238,21 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr)
if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) {
for (index = 0; index < nPanes; ++index) {
- Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
- Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index);
- if (height < Tk_ReqHeight(slaveWindow))
- height = Tk_ReqHeight(slaveWindow);
+ if (height < Tk_ReqHeight(window))
+ height = Tk_ReqHeight(window);
width += pane->reqSize;
}
width += nSashes * sashThickness;
} else {
for (index = 0; index < nPanes; ++index) {
- Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
- Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index);
- if (width < Tk_ReqWidth(slaveWindow))
- width = Tk_ReqWidth(slaveWindow);
+ if (width < Tk_ReqWidth(window))
+ width = Tk_ReqWidth(window);
height += pane->reqSize;
}
height += nSashes * sashThickness;
@@ -278,8 +277,8 @@ static void AdjustPanes(Paned *pw)
int pos = 0;
int index;
- for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
- Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) {
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
int size = pane->sashPos - pos;
pane->reqSize = size >= 0 ? size : 0;
pos = pane->sashPos + sashThickness;
@@ -305,7 +304,7 @@ static void AdjustPanes(Paned *pw)
static void PlaceSashes(Paned *pw, int width, int height)
{
Ttk_Manager *mgr = pw->paned.mgr;
- int nPanes = Ttk_NumberSlaves(mgr);
+ int nPanes = Ttk_NumberContent(mgr);
int sashThickness = pw->paned.sashThickness;
int available = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? width : height;
int reqSize = 0, totalWeight = 0;
@@ -317,7 +316,7 @@ static void PlaceSashes(Paned *pw, int width, int height)
/* Compute total required size and total available weight:
*/
for (i = 0; i < nPanes; ++i) {
- Pane *pane = Ttk_SlaveData(mgr, i);
+ Pane *pane = (Pane *)Ttk_ContentData(mgr, i);
reqSize += pane->reqSize;
totalWeight += pane->weight * (pane->reqSize != 0);
}
@@ -341,7 +340,7 @@ static void PlaceSashes(Paned *pw, int width, int height)
*/
pos = 0;
for (i = 0; i < nPanes; ++i) {
- Pane *pane = Ttk_SlaveData(mgr, i);
+ Pane *pane = (Pane *)Ttk_ContentData(mgr, i);
int weight = pane->weight * (pane->reqSize != 0);
int size = pane->reqSize + delta * weight;
@@ -365,7 +364,7 @@ static void PlaceSashes(Paned *pw, int width, int height)
}
/* PlacePanes --
- * Places slave panes based on sash positions.
+ * Places panes based on sash positions.
*/
static void PlacePanes(Paned *pw)
{
@@ -375,18 +374,18 @@ static void PlacePanes(Paned *pw)
int pos = 0;
int index;
- for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
- Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) {
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
int size = pane->sashPos - pos;
if (size > 0) {
if (horizontal) {
- Ttk_PlaceSlave(pw->paned.mgr, index, pos, 0, size, height);
+ Ttk_PlaceContent(pw->paned.mgr, index, pos, 0, size, height);
} else {
- Ttk_PlaceSlave(pw->paned.mgr, index, 0, pos, width, size);
+ Ttk_PlaceContent(pw->paned.mgr, index, 0, pos, width, size);
}
} else {
- Ttk_UnmapSlave(pw->paned.mgr, index);
+ Ttk_UnmapContent(pw->paned.mgr, index);
}
pos = pane->sashPos + sashThickness;
@@ -397,72 +396,72 @@ static void PlacePanes(Paned *pw)
* +++ Manager specification.
*/
-static void PanedPlaceSlaves(void *managerData)
+static void PanedPlaceContent(void *managerData)
{
- Paned *pw = managerData;
+ Paned *pw = (Paned *)managerData;
PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin));
PlacePanes(pw);
}
static void PaneRemoved(void *managerData, int index)
{
- Paned *pw = managerData;
- Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ Paned *pw = (Paned *)managerData;
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
DestroyPane(pw, pane);
}
static int AddPane(
Tcl_Interp *interp, Paned *pw,
- int destIndex, Tk_Window slaveWindow,
+ int destIndex, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Pane *pane;
- if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) {
+ if (!Ttk_Maintainable(interp, window, pw->core.tkwin)) {
return TCL_ERROR;
}
- if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) >= 0) {
+ if (Ttk_ContentIndex(pw->paned.mgr, window) >= 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "%s already added", Tk_PathName(slaveWindow)));
+ "%s already added", Tk_PathName(window)));
Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL);
return TCL_ERROR;
}
- pane = CreatePane(interp, pw, slaveWindow);
+ pane = CreatePane(interp, pw, window);
if (!pane) {
return TCL_ERROR;
}
- if (ConfigurePane(interp, pw, pane, slaveWindow, objc, objv) != TCL_OK) {
+ if (ConfigurePane(interp, pw, pane, window, objc, objv) != TCL_OK) {
DestroyPane(pw, pane);
return TCL_ERROR;
}
- Ttk_InsertSlave(pw->paned.mgr, destIndex, slaveWindow, pane);
+ Ttk_InsertContent(pw->paned.mgr, destIndex, window, pane);
return TCL_OK;
}
/* PaneRequest --
- * Only update pane request size if slave is currently unmapped.
- * Geometry requests from mapped slaves are not directly honored
+ * Only update pane request size if pane is currently unmapped.
+ * Geometry requests from mapped panes are not directly honored
* in order to avoid unexpected pane resizes (esp. while the
* user is dragging a sash [#1325286]).
*/
static int PaneRequest(void *managerData, int index, int width, int height)
{
- Paned *pw = managerData;
- Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
- Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ Paned *pw = (Paned *)managerData;
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index);
int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL;
- if (!Tk_IsMapped(slaveWindow)) {
+ if (!Tk_IsMapped(window)) {
pane->reqSize = horizontal ? width : height;
}
return 1;
}
static Ttk_ManagerSpec PanedManagerSpec = {
- { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostContentProc },
PanedSize,
- PanedPlaceSlaves,
+ PanedPlaceContent,
PaneRequest,
PaneRemoved
};
@@ -483,7 +482,7 @@ static Ttk_ManagerSpec PanedManagerSpec = {
static const unsigned PanedEventMask = LeaveWindowMask;
static void PanedEventProc(ClientData clientData, XEvent *eventPtr)
{
- WidgetCore *corePtr = clientData;
+ WidgetCore *corePtr = (WidgetCore *)clientData;
if ( eventPtr->type == LeaveNotify
&& eventPtr->xcrossing.detail == NotifyInferior)
{
@@ -497,7 +496,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr)
static void PanedInitialize(Tcl_Interp *interp, void *recordPtr)
{
- Paned *pw = recordPtr;
+ Paned *pw = (Paned *)recordPtr;
Tk_CreateEventHandler(pw->core.tkwin,
PanedEventMask, PanedEventProc, recordPtr);
@@ -509,7 +508,7 @@ static void PanedInitialize(Tcl_Interp *interp, void *recordPtr)
static void PanedCleanup(void *recordPtr)
{
- Paned *pw = recordPtr;
+ Paned *pw = (Paned *)recordPtr;
if (pw->paned.sashLayout)
Ttk_FreeLayout(pw->paned.sashLayout);
@@ -520,9 +519,12 @@ static void PanedCleanup(void *recordPtr)
/* Post-configuration hook.
*/
-static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
+static int PanedPostConfigure(
+ TCL_UNUSED(Tcl_Interp *),
+ void *clientData,
+ int mask)
{
- Paned *pw = clientData;
+ Paned *pw = (Paned *)clientData;
if (mask & GEOMETRY_CHANGED) {
/* User has changed -width or -height.
@@ -543,7 +545,7 @@ static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
static Ttk_Layout PanedGetLayout(
Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr)
{
- Paned *pw = recordPtr;
+ Paned *pw = (Paned *)recordPtr;
Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr);
if (panedLayout) {
@@ -581,7 +583,7 @@ static Ttk_Layout PanedGetLayout(
*/
static Ttk_Layout SashLayout(Paned *pw, int index)
{
- Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
int thickness = pw->paned.sashThickness,
height = Tk_Height(pw->core.tkwin),
width = Tk_Width(pw->core.tkwin),
@@ -603,8 +605,8 @@ static void DrawSash(Paned *pw, int index, Drawable d)
static void PanedDisplay(void *recordPtr, Drawable d)
{
- Paned *pw = recordPtr;
- int i, nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ Paned *pw = (Paned *)recordPtr;
+ int i, nSashes = Ttk_NumberContent(pw->paned.mgr) - 1;
TtkWidgetDisplay(recordPtr, d);
for (i = 0; i < nSashes; ++i) {
@@ -621,69 +623,69 @@ static void PanedDisplay(void *recordPtr, Drawable d)
static int PanedAddCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Paned *pw = recordPtr;
- Tk_Window slaveWindow;
+ Paned *pw = (Paned *)recordPtr;
+ Tk_Window window;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- slaveWindow = Tk_NameToWindow(
+ window = Tk_NameToWindow(
interp, Tcl_GetString(objv[2]), pw->core.tkwin);
- if (!slaveWindow) {
+ if (!window) {
return TCL_ERROR;
}
- return AddPane(interp, pw, Ttk_NumberSlaves(pw->paned.mgr), slaveWindow,
+ return AddPane(interp, pw, Ttk_NumberContent(pw->paned.mgr), window,
objc - 3, objv + 3);
}
-/* $pw insert $index $slave ?-option value ...?
- * Insert new slave, or move existing one.
+/* $pw insert $index $window ?-option value ...?
+ * Insert new content window, or move existing one.
*/
static int PanedInsertCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Paned *pw = recordPtr;
- int nSlaves = Ttk_NumberSlaves(pw->paned.mgr);
+ Paned *pw = (Paned *)recordPtr;
+ int nContent = Ttk_NumberContent(pw->paned.mgr);
int srcIndex, destIndex;
- Tk_Window slaveWindow;
+ Tk_Window window;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?");
return TCL_ERROR;
}
- slaveWindow = Tk_NameToWindow(
+ window = Tk_NameToWindow(
interp, Tcl_GetString(objv[3]), pw->core.tkwin);
- if (!slaveWindow) {
+ if (!window) {
return TCL_ERROR;
}
if (!strcmp(Tcl_GetString(objv[2]), "end")) {
- destIndex = Ttk_NumberSlaves(pw->paned.mgr);
- } else if (TCL_OK != Ttk_GetSlaveIndexFromObj(
- interp,pw->paned.mgr,objv[2],&destIndex))
+ destIndex = Ttk_NumberContent(pw->paned.mgr);
+ } else if (TCL_OK != Ttk_GetContentIndexFromObj(
+ interp,pw->paned.mgr, objv[2], &destIndex))
{
return TCL_ERROR;
}
- srcIndex = Ttk_SlaveIndex(pw->paned.mgr, slaveWindow);
- if (srcIndex < 0) { /* New slave: */
- return AddPane(interp, pw, destIndex, slaveWindow, objc-4, objv+4);
- } /* else -- move existing slave: */
+ srcIndex = Ttk_ContentIndex(pw->paned.mgr, window);
+ if (srcIndex < 0) { /* New content: */
+ return AddPane(interp, pw, destIndex, window, objc-4, objv+4);
+ } /* else -- move existing content: */
- if (destIndex >= nSlaves)
- destIndex = nSlaves - 1;
- Ttk_ReorderSlave(pw->paned.mgr, srcIndex, destIndex);
+ if (destIndex >= nContent)
+ destIndex = nContent - 1;
+ Ttk_ReorderContent(pw->paned.mgr, srcIndex, destIndex);
return objc == 4 ? TCL_OK :
ConfigurePane(interp, pw,
- Ttk_SlaveData(pw->paned.mgr, destIndex),
- Ttk_SlaveWindow(pw->paned.mgr, destIndex),
- objc-4,objv+4);
+ (Pane *)Ttk_ContentData(pw->paned.mgr, destIndex),
+ Ttk_ContentWindow(pw->paned.mgr, destIndex),
+ objc-4, objv+4);
}
/* $pw forget $pane
@@ -691,7 +693,7 @@ static int PanedInsertCommand(
static int PanedForgetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Paned *pw = recordPtr;
+ Paned *pw = (Paned *)recordPtr;
int paneIndex;
if (objc != 3) {
@@ -699,12 +701,12 @@ static int PanedForgetCommand(
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp, pw->paned.mgr, objv[2], &paneIndex))
{
return TCL_ERROR;
}
- Ttk_ForgetSlave(pw->paned.mgr, paneIndex);
+ Ttk_ForgetContent(pw->paned.mgr, paneIndex);
return TCL_OK;
}
@@ -718,9 +720,9 @@ static int PanedIdentifyCommand(
static const char *whatTable[] = { "element", "sash", NULL };
enum { IDENTIFY_ELEMENT, IDENTIFY_SASH };
int what = IDENTIFY_SASH;
- Paned *pw = recordPtr;
+ Paned *pw = (Paned *)recordPtr;
int sashThickness = pw->paned.sashThickness;
- int nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ int nSashes = Ttk_NumberContent(pw->paned.mgr) - 1;
int x, y, pos;
int index;
@@ -739,7 +741,7 @@ static int PanedIdentifyCommand(
pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y;
for (index = 0; index < nSashes; ++index) {
- Pane *pane = Ttk_SlaveData(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) {
/* Found it. */
switch (what) {
@@ -769,9 +771,9 @@ static int PanedIdentifyCommand(
static int PanedPaneCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Paned *pw = recordPtr;
+ Paned *pw = (Paned *)recordPtr;
int paneIndex;
- Tk_Window slaveWindow;
+ Tk_Window window;
Pane *pane;
if (objc < 3) {
@@ -779,24 +781,24 @@ static int PanedPaneCommand(
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
- interp,pw->paned.mgr,objv[2],&paneIndex))
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
+ interp,pw->paned.mgr, objv[2], &paneIndex))
{
return TCL_ERROR;
}
- pane = Ttk_SlaveData(pw->paned.mgr, paneIndex);
- slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, paneIndex);
+ pane = (Pane *)Ttk_ContentData(pw->paned.mgr, paneIndex);
+ window = Ttk_ContentWindow(pw->paned.mgr, paneIndex);
switch (objc) {
case 3:
return TtkEnumerateOptions(interp, pane, PaneOptionSpecs,
- pw->paned.paneOptionTable, slaveWindow);
+ pw->paned.paneOptionTable, window);
case 4:
return TtkGetOptionValue(interp, pane, objv[3],
- pw->paned.paneOptionTable, slaveWindow);
+ pw->paned.paneOptionTable, window);
default:
- return ConfigurePane(interp, pw, pane, slaveWindow, objc-3,objv+3);
+ return ConfigurePane(interp, pw, pane, window, objc-3,objv+3);
}
}
@@ -806,7 +808,7 @@ static int PanedPaneCommand(
static int PanedPanesCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Paned *pw = recordPtr;
+ Paned *pw = (Paned *)recordPtr;
Ttk_Manager *mgr = pw->paned.mgr;
Tcl_Obj *panes;
int i;
@@ -817,8 +819,8 @@ static int PanedPanesCommand(
}
panes = Tcl_NewListObj(0, NULL);
- for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) {
- const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i));
+ for (i = 0; i < Ttk_NumberContent(mgr); ++i) {
+ const char *pathName = Tk_PathName(Ttk_ContentWindow(mgr,i));
Tcl_ListObjAppendElement(interp, panes, Tcl_NewStringObj(pathName,-1));
}
Tcl_SetObjResult(interp, panes);
@@ -833,7 +835,7 @@ static int PanedPanesCommand(
static int PanedSashposCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Paned *pw = recordPtr;
+ Paned *pw = (Paned *)recordPtr;
int sashIndex, position = -1;
Pane *pane;
@@ -844,14 +846,14 @@ static int PanedSashposCommand(
if (Tcl_GetIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) {
return TCL_ERROR;
}
- if (sashIndex < 0 || sashIndex >= Ttk_NumberSlaves(pw->paned.mgr) - 1) {
+ if (sashIndex < 0 || sashIndex >= Ttk_NumberContent(pw->paned.mgr) - 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"sash index %d out of range", sashIndex));
Tcl_SetErrorCode(interp, "TTK", "PANE", "SASH_INDEX", NULL);
return TCL_ERROR;
}
- pane = Ttk_SlaveData(pw->paned.mgr, sashIndex);
+ pane = (Pane *)Ttk_ContentData(pw->paned.mgr, sashIndex);
if (objc == 3) {
Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos));
@@ -924,15 +926,20 @@ typedef struct {
static Ttk_ElementOptionSpec SashElementOptions[] = {
{ "-sashthickness", TK_OPTION_INT,
Tk_Offset(SashElement,thicknessObj), "5" },
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
static void SashElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ TCL_UNUSED(Tk_Window),
+ int *widthPtr,
+ int *heightPtr,
+ TCL_UNUSED(Ttk_Padding *))
{
- SashElement *sash = elementRecord;
+ SashElement *sash = (SashElement *)elementRecord;
int thickness = DEFAULT_SASH_THICKNESS;
+
Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness);
*widthPtr = *heightPtr = thickness;
}
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 6c139920..f65cb084 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -4,9 +4,7 @@
* ttk::progressbar widget.
*/
-#include
-#include
-
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -48,14 +46,14 @@ static Tk_OptionSpec ProgressbarOptionSpecs[] =
{
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
"horizontal", Tk_Offset(Progressbar,progress.orientObj), -1,
- 0, (ClientData)ttkOrientStrings, STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
{TK_OPTION_PIXELS, "-length", "length", "Length",
DEF_PROGRESSBAR_LENGTH, Tk_Offset(Progressbar,progress.lengthObj), -1,
0, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate",
Tk_Offset(Progressbar,progress.modeObj),
Tk_Offset(Progressbar,progress.mode),
- 0, (ClientData)ProgressbarModeStrings, 0 },
+ 0, (void *)ProgressbarModeStrings, 0 },
{TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum",
"100", Tk_Offset(Progressbar,progress.maximumObj), -1,
0, 0, 0 },
@@ -100,10 +98,9 @@ static int AnimationEnabled(Progressbar *pb)
*/
static void AnimateProgressProc(ClientData clientData)
{
- Progressbar *pb = clientData;
+ Progressbar *pb = (Progressbar *)clientData;
pb->progress.timer = 0;
-
if (AnimationEnabled(pb)) {
int phase = 0;
Tcl_GetIntFromObj(NULL, pb->progress.phaseObj, &phase);
@@ -111,9 +108,11 @@ static void AnimateProgressProc(ClientData clientData)
/*
* Update -phase:
*/
+
++phase;
- if (pb->progress.maxPhase)
- phase %= pb->progress.maxPhase;
+ if (phase > pb->progress.maxPhase) {
+ phase = 0;
+ }
Tcl_DecrRefCount(pb->progress.phaseObj);
pb->progress.phaseObj = Tcl_NewIntObj(phase);
Tcl_IncrRefCount(pb->progress.phaseObj);
@@ -121,9 +120,9 @@ static void AnimateProgressProc(ClientData clientData)
/*
* Reschedule:
*/
+
pb->progress.timer = Tcl_CreateTimerHandler(
pb->progress.period, AnimateProgressProc, clientData);
-
TtkRedisplayWidget(&pb->core);
}
}
@@ -137,7 +136,7 @@ static void CheckAnimation(Progressbar *pb)
if (AnimationEnabled(pb)) {
if (pb->progress.timer == 0) {
pb->progress.timer = Tcl_CreateTimerHandler(
- pb->progress.period, AnimateProgressProc, (ClientData)pb);
+ pb->progress.period, AnimateProgressProc, pb);
}
} else {
if (pb->progress.timer != 0) {
@@ -153,7 +152,7 @@ static void CheckAnimation(Progressbar *pb)
static void VariableChanged(void *recordPtr, const char *value)
{
- Progressbar *pb = recordPtr;
+ Progressbar *pb = (Progressbar *)recordPtr;
Tcl_Obj *newValue;
double scratch;
@@ -186,16 +185,18 @@ static void VariableChanged(void *recordPtr, const char *value)
* +++ Widget class methods:
*/
-static void ProgressbarInitialize(Tcl_Interp *interp, void *recordPtr)
+static void ProgressbarInitialize(Tcl_Interp *dummy, void *recordPtr)
{
- Progressbar *pb = recordPtr;
+ Progressbar *pb = (Progressbar *)recordPtr;
+ (void)dummy;
+
pb->progress.variableTrace = 0;
pb->progress.timer = 0;
}
static void ProgressbarCleanup(void *recordPtr)
{
- Progressbar *pb = recordPtr;
+ Progressbar *pb = (Progressbar *)recordPtr;
if (pb->progress.variableTrace)
Ttk_UntraceVariable(pb->progress.variableTrace);
if (pb->progress.timer)
@@ -209,7 +210,7 @@ static void ProgressbarCleanup(void *recordPtr)
*/
static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Progressbar *pb = recordPtr;
+ Progressbar *pb = (Progressbar *)recordPtr;
Tcl_Obj *varName = pb->progress.variableObj;
Ttk_TraceHandle *vt = 0;
@@ -235,10 +236,12 @@ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Post-configuration hook:
*/
static int ProgressbarPostConfigure(
- Tcl_Interp *interp, void *recordPtr, int mask)
+ Tcl_Interp *dummy, void *recordPtr, int mask)
{
- Progressbar *pb = recordPtr;
+ Progressbar *pb = (Progressbar *)recordPtr;
int status = TCL_OK;
+ (void)dummy;
+ (void)mask;
if (pb->progress.variableTrace) {
status = Ttk_FireTrace(pb->progress.variableTrace);
@@ -266,8 +269,9 @@ static int ProgressbarPostConfigure(
*/
static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr)
{
- Progressbar *pb = recordPtr;
- int length = 100, orient = TTK_ORIENT_HORIZONTAL;
+ Progressbar *pb = (Progressbar *)recordPtr;
+ int length = 100;
+ int orient = TTK_ORIENT_HORIZONTAL;
TtkWidgetSize(recordPtr, widthPtr, heightPtr);
@@ -334,7 +338,7 @@ static void ProgressbarIndeterminateLayout(
static void ProgressbarDoLayout(void *recordPtr)
{
- Progressbar *pb = recordPtr;
+ Progressbar *pb = (Progressbar *)recordPtr;
WidgetCore *corePtr = &pb->core;
Ttk_Element pbar = Ttk_FindElement(corePtr->layout, "pbar");
double value = 0.0, maximum = 100.0;
@@ -366,7 +370,7 @@ static void ProgressbarDoLayout(void *recordPtr)
static Ttk_Layout ProgressbarGetLayout(
Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
{
- Progressbar *pb = recordPtr;
+ Progressbar *pb = (Progressbar *)recordPtr;
Ttk_Layout layout = TtkWidgetGetOrientedLayout(
interp, theme, recordPtr, pb->progress.orientObj);
@@ -396,9 +400,9 @@ static Ttk_Layout ProgressbarGetLayout(
static int ProgressbarStepCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Progressbar *pb = recordPtr;
+ Progressbar *pb = (Progressbar *)recordPtr;
double value = 0.0, stepAmount = 1.0;
- Tcl_Obj *newValueObj;
+ Tcl_Obj *newValueObj;
if (objc == 3) {
if (Tcl_GetDoubleFromObj(interp, objv[2], &stepAmount) != TCL_OK) {
@@ -425,7 +429,7 @@ static int ProgressbarStepCommand(
TtkRedisplayWidget(&pb->core);
- /* Update value by setting the linked -variable, if there is one:
+ /* Update value by setting the linked -variable, if there is one:
*/
if (pb->progress.variableTrace) {
int result = Tcl_ObjSetVar2(
@@ -446,7 +450,7 @@ static int ProgressbarStepCommand(
}
/* $sb start|stop ?args? --
- * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...]
+ * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...]
* and pass to interpreter.
*/
static int ProgressbarStartStopCommand(
@@ -472,6 +476,8 @@ static int ProgressbarStartStopCommand(
static int ProgressbarStartCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
+ (void)recordPtr;
+
return ProgressbarStartStopCommand(
interp, "::ttk::progressbar::start", objc, objv);
}
@@ -479,6 +485,8 @@ static int ProgressbarStartCommand(
static int ProgressbarStopCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
+ (void)recordPtr;
+
return ProgressbarStartStopCommand(
interp, "::ttk::progressbar::stop", objc, objv);
}
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index 279fc7a5..a4b2a4e8 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -4,9 +4,7 @@
* ttk::scale widget.
*/
-#include
-#include
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -55,15 +53,15 @@ typedef struct
static Tk_OptionSpec ScaleOptionSpecs[] =
{
{TK_OPTION_STRING, "-command", "command", "Command", "",
- Tk_Offset(Scale,scale.commandObj), -1,
+ Tk_Offset(Scale,scale.commandObj), -1,
TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-variable", "variable", "Variable", "",
- Tk_Offset(Scale,scale.variableObj), -1,
+ Tk_Offset(Scale,scale.variableObj), -1,
0,0,0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
Tk_Offset(Scale,scale.orientObj),
- Tk_Offset(Scale,scale.orient), 0,
- (ClientData)ttkOrientStrings, STYLE_CHANGED },
+ Tk_Offset(Scale,scale.orient), 0,
+ (void *)ttkOrientStrings, STYLE_CHANGED },
{TK_OPTION_DOUBLE, "-from", "from", "From", "0",
Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0},
@@ -72,7 +70,7 @@ static Tk_OptionSpec ScaleOptionSpecs[] =
{TK_OPTION_DOUBLE, "-value", "value", "Value", "0",
Tk_Offset(Scale,scale.valueObj), -1, 0, 0, 0},
{TK_OPTION_PIXELS, "-length", "length", "Length",
- DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0,
+ DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0,
GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-state", "state", "State",
@@ -89,12 +87,12 @@ static double PointToValue(Scale *scalePtr, int x, int y);
/* ScaleVariableChanged --
* Variable trace procedure for scale -variable;
* Updates the scale's value.
- * If the linked variable is not a valid double,
+ * If the linked variable is not a valid double,
* sets the 'invalid' state.
*/
static void ScaleVariableChanged(void *recordPtr, const char *value)
{
- Scale *scale = recordPtr;
+ Scale *scale = (Scale *)recordPtr;
double v;
if (value == NULL || Tcl_GetDouble(0, value, &v) != TCL_OK) {
@@ -112,15 +110,17 @@ static void ScaleVariableChanged(void *recordPtr, const char *value)
/* ScaleInitialize --
* Scale widget initialization hook.
*/
-static void ScaleInitialize(Tcl_Interp *interp, void *recordPtr)
+static void ScaleInitialize(Tcl_Interp *dummy, void *recordPtr)
{
- Scale *scalePtr = recordPtr;
+ Scale *scalePtr = (Scale *)recordPtr;
+ (void)dummy;
+
TtkTrackElementState(&scalePtr->core);
}
static void ScaleCleanup(void *recordPtr)
{
- Scale *scale = recordPtr;
+ Scale *scale = (Scale *)recordPtr;
if (scale->scale.variableTrace) {
Ttk_UntraceVariable(scale->scale.variableTrace);
@@ -133,7 +133,7 @@ static void ScaleCleanup(void *recordPtr)
*/
static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
- Scale *scale = recordPtr;
+ Scale *scale = (Scale *)recordPtr;
Tcl_Obj *varName = scale->scale.variableObj;
Ttk_TraceHandle *vt = 0;
@@ -163,10 +163,12 @@ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Post-configuration hook.
*/
static int ScalePostConfigure(
- Tcl_Interp *interp, void *recordPtr, int mask)
+ Tcl_Interp *dummy, void *recordPtr, int mask)
{
- Scale *scale = recordPtr;
+ Scale *scale = (Scale *)recordPtr;
int status = TCL_OK;
+ (void)dummy;
+ (void)mask;
if (scale->scale.variableTrace) {
status = Ttk_FireTrace(scale->scale.variableTrace);
@@ -189,10 +191,10 @@ static int ScalePostConfigure(
/* ScaleGetLayout --
* getLayout hook.
*/
-static Ttk_Layout
+static Ttk_Layout
ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
{
- Scale *scalePtr = recordPtr;
+ Scale *scalePtr = (Scale *)recordPtr;
return TtkWidgetGetOrientedLayout(
interp, theme, recordPtr, scalePtr->scale.orientObj);
}
@@ -253,14 +255,14 @@ static double ScaleFraction(Scale *scalePtr, double value)
}
/* $scale get ?x y? --
- * Returns the current value of the scale widget, or if $x and
+ * Returns the current value of the scale widget, or if $x and
* $y are specified, the value represented by point @x,y.
*/
static int
ScaleGetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Scale *scalePtr = recordPtr;
+ Scale *scalePtr = (Scale *)recordPtr;
int x, y, r = TCL_OK;
double value = 0;
@@ -288,7 +290,7 @@ static int
ScaleSetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Scale *scalePtr = recordPtr;
+ Scale *scalePtr = (Scale *)recordPtr;
double from = 0.0, to = 1.0, value;
int result = TCL_OK;
@@ -356,7 +358,7 @@ static int
ScaleCoordsCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Scale *scalePtr = recordPtr;
+ Scale *scalePtr = (Scale *)recordPtr;
double value;
int r = TCL_OK;
@@ -383,7 +385,7 @@ ScaleCoordsCommand(
static void ScaleDoLayout(void *clientData)
{
- WidgetCore *corePtr = clientData;
+ WidgetCore *corePtr = (WidgetCore *)clientData;
Ttk_Element slider = Ttk_FindElement(corePtr->layout, "slider");
Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
@@ -391,7 +393,7 @@ static void ScaleDoLayout(void *clientData)
/* Adjust the slider position:
*/
if (slider) {
- Scale *scalePtr = clientData;
+ Scale *scalePtr = (Scale *)clientData;
Ttk_Box troughBox = TroughBox(scalePtr);
Ttk_Box sliderBox = Ttk_ElementParcel(slider);
double value = 0.0;
@@ -418,8 +420,8 @@ static void ScaleDoLayout(void *clientData)
*/
static int ScaleSize(void *clientData, int *widthPtr, int *heightPtr)
{
- WidgetCore *corePtr = clientData;
- Scale *scalePtr = clientData;
+ WidgetCore *corePtr = (WidgetCore *)clientData;
+ Scale *scalePtr = (Scale *)clientData;
int length;
Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr);
diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c
index 47db6acd..9cf8eae7 100644
--- a/generic/ttk/ttkScroll.c
+++ b/generic/ttk/ttkScroll.c
@@ -104,15 +104,18 @@ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h)
Tcl_Release(corePtr);
if (code != TCL_OK && !Tcl_InterpDeleted(interp)) {
- /* Disable the -scrollcommand, add to stack trace:
+ /* Add error to stack trace.
+ * Also set the SCROLL_UPDATE_REQUIRED flag so that a later call to
+ * TtkScrolled has an effect. Indeed, the error in the -scrollcommand
+ * callback may later be gone, for instance the callback proc got
+ * defined in the meantime.
*/
- ckfree(s->scrollCmd);
- s->scrollCmd = 0;
Tcl_AddErrorInfo(interp, /* @@@ "horizontal" / "vertical" */
"\n (scrolling command executed by ");
Tcl_AddErrorInfo(interp, Tk_PathName(h->corePtr->tkwin));
Tcl_AddErrorInfo(interp, ")");
+ TtkScrollbarUpdateRequired(h);
}
return code;
}
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
index 5b0c2124..5ffd671a 100644
--- a/generic/ttk/ttkScrollbar.c
+++ b/generic/ttk/ttkScrollbar.c
@@ -4,8 +4,7 @@
* ttk::scrollbar widget.
*/
-#include
-
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -22,7 +21,7 @@ typedef struct
double first; /* top fraction */
double last; /* bottom fraction */
- Ttk_Box troughBox; /* trough parcel */
+ Ttk_Box troughBox; /* trough parcel */
int minSize; /* minimum size of thumb */
} ScrollbarPart;
@@ -40,7 +39,7 @@ static Tk_OptionSpec ScrollbarOptionSpecs[] =
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
Tk_Offset(Scrollbar,scrollbar.orientObj),
Tk_Offset(Scrollbar,scrollbar.orient),
- 0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -50,10 +49,12 @@ static Tk_OptionSpec ScrollbarOptionSpecs[] =
* +++ Widget hooks.
*/
-static void
-ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr)
+static void
+ScrollbarInitialize(Tcl_Interp *dummy, void *recordPtr)
{
- Scrollbar *sb = recordPtr;
+ Scrollbar *sb = (Scrollbar *)recordPtr;
+ (void)dummy;
+
sb->scrollbar.first = 0.0;
sb->scrollbar.last = 1.0;
@@ -63,7 +64,7 @@ ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr)
static Ttk_Layout ScrollbarGetLayout(
Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
{
- Scrollbar *sb = recordPtr;
+ Scrollbar *sb = (Scrollbar *)recordPtr;
return TtkWidgetGetOrientedLayout(
interp, theme, recordPtr, sb->scrollbar.orientObj);
}
@@ -77,7 +78,7 @@ static Ttk_Layout ScrollbarGetLayout(
*/
static void ScrollbarDoLayout(void *recordPtr)
{
- Scrollbar *sb = recordPtr;
+ Scrollbar *sb = (Scrollbar *)recordPtr;
WidgetCore *corePtr = &sb->core;
Ttk_Element thumb;
Ttk_Box thumbBox;
@@ -133,7 +134,7 @@ static int
ScrollbarSetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Scrollbar *scrollbar = recordPtr;
+ Scrollbar *scrollbar = (Scrollbar *)recordPtr;
Tcl_Obj *firstObj, *lastObj;
double first, last;
@@ -184,7 +185,7 @@ static int
ScrollbarGetCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Scrollbar *scrollbar = recordPtr;
+ Scrollbar *scrollbar = (Scrollbar *)recordPtr;
Tcl_Obj *result[2];
if (objc != 2) {
@@ -207,7 +208,7 @@ static int
ScrollbarDeltaCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Scrollbar *sb = recordPtr;
+ Scrollbar *sb = (Scrollbar *)recordPtr;
double dx, dy;
double delta = 0.0;
@@ -241,13 +242,13 @@ ScrollbarDeltaCommand(
/* $sb fraction $x $y --
* Returns a real number between 0 and 1 indicating where the
- * point given by x and y lies in the trough area of the scrollbar.
+ * point given by x and y lies in the trough area of the scrollbar.
*/
static int
ScrollbarFractionCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- Scrollbar *sb = recordPtr;
+ Scrollbar *sb = (Scrollbar *)recordPtr;
Ttk_Box b = sb->scrollbar.troughBox;
int minSize = sb->scrollbar.minSize;
double x, y;
@@ -315,16 +316,14 @@ TTK_BEGIN_LAYOUT(VerticalScrollbarLayout)
TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y,
TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_TOP)
TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM)
- TTK_NODE(
- "Vertical.Scrollbar.thumb", TTK_PACK_TOP|TTK_EXPAND|TTK_FILL_BOTH))
+ TTK_NODE("Vertical.Scrollbar.thumb", TTK_FILL_BOTH))
TTK_END_LAYOUT
TTK_BEGIN_LAYOUT(HorizontalScrollbarLayout)
TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X,
TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_LEFT)
TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT)
- TTK_NODE(
- "Horizontal.Scrollbar.thumb", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH))
+ TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH))
TTK_END_LAYOUT
/*------------------------------------------------------------------------
diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c
index b52e6f4c..a0ae5966 100644
--- a/generic/ttk/ttkSeparator.c
+++ b/generic/ttk/ttkSeparator.c
@@ -4,8 +4,7 @@
* ttk::separator and ttk::sizegrip widgets.
*/
-#include
-
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -27,7 +26,7 @@ static Tk_OptionSpec SeparatorOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
Tk_Offset(Separator,separator.orientObj),
Tk_Offset(Separator,separator.orient),
- 0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c
index d002f2f4..bd2a8c79 100644
--- a/generic/ttk/ttkSquare.c
+++ b/generic/ttk/ttkSquare.c
@@ -3,7 +3,7 @@
* Minimal sample ttk widget.
*/
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -56,24 +56,24 @@ static Tk_OptionSpec SquareOptionSpecs[] =
{TK_OPTION_BORDER, "-foreground", "foreground", "Foreground",
DEFAULT_BACKGROUND, Tk_Offset(Square,square.foregroundObj),
-1, 0, 0, 0},
-
+
{TK_OPTION_PIXELS, "-width", "width", "Width",
"50", Tk_Offset(Square,square.widthObj), -1, 0, 0,
GEOMETRY_CHANGED},
{TK_OPTION_PIXELS, "-height", "height", "Height",
"50", Tk_Offset(Square,square.heightObj), -1, 0, 0,
GEOMETRY_CHANGED},
-
+
{TK_OPTION_STRING, "-padding", "padding", "Pad", NULL,
- Tk_Offset(Square,square.paddingObj), -1,
+ Tk_Offset(Square,square.paddingObj), -1,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
-
+
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
NULL, Tk_Offset(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0},
-
+
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0},
-
+
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
};
@@ -109,7 +109,7 @@ SquareDoLayout(void *clientData)
*/
if (squareNode) {
- Square *squarePtr = clientData;
+ Square *squarePtr = (Square *)clientData;
Tk_Anchor anchor = TK_ANCHOR_CENTER;
Ttk_Box b;
@@ -138,7 +138,7 @@ static const Ttk_Ensemble SquareCommands[] = {
};
/*
- * The Widget specification structure holds all the implementation
+ * The Widget specification structure holds all the implementation
* information about this widget and this is what must be registered
* with Tk in the package initialization code (see bottom).
*/
@@ -159,7 +159,7 @@ static WidgetSpec SquareWidgetSpec =
TtkWidgetDisplay /* displayProc */
};
-/* ----------------------------------------------------------------------
+/* ----------------------------------------------------------------------
* Square element
*
* In this section we demonstrate what is required to create a new themed
@@ -176,7 +176,7 @@ typedef struct
Tcl_Obj *heightObj;
} SquareElement;
-static Ttk_ElementOptionSpec SquareElementOptions[] =
+static Ttk_ElementOptionSpec SquareElementOptions[] =
{
{ "-background", TK_OPTION_BORDER, Tk_Offset(SquareElement,borderObj),
DEFAULT_BACKGROUND },
@@ -188,7 +188,7 @@ static Ttk_ElementOptionSpec SquareElementOptions[] =
"raised" },
{ "-width", TK_OPTION_PIXELS, Tk_Offset(SquareElement,widthObj), "20"},
{ "-height", TK_OPTION_PIXELS, Tk_Offset(SquareElement,heightObj), "20"},
- { NULL, 0, 0, NULL }
+ { NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
/*
@@ -198,11 +198,12 @@ static Ttk_ElementOptionSpec SquareElementOptions[] =
*/
static void SquareElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
- SquareElement *square = elementRecord;
+ SquareElement *square = (SquareElement *)elementRecord;
int borderWidth = 0;
+ (void)dummy;
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
@@ -215,12 +216,14 @@ static void SquareElementSize(
*/
static void SquareElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
+ void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
- SquareElement *square = elementRecord;
+ SquareElement *square = (SquareElement *)elementRecord;
Tk_3DBorder foreground = NULL;
int borderWidth = 1, relief = TK_RELIEF_FLAT;
+ (void)dummy;
+ (void)state;
foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj);
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
@@ -248,7 +251,7 @@ static Ttk_ElementSpec SquareElementSpec =
* engine is similar to the Tk pack geometry manager. Read the documentation
* for the details. In this example we just need to have the square element
* that has been defined for this widget placed on a background. We will
- * also need some padding to keep it away from the edges.
+ * also need some padding to keep it away from the edges.
*/
TTK_BEGIN_LAYOUT(SquareLayout)
@@ -257,12 +260,12 @@ TTK_BEGIN_LAYOUT(SquareLayout)
TTK_NODE("Square.square", 0))
TTK_END_LAYOUT
-/* ----------------------------------------------------------------------
+/* ----------------------------------------------------------------------
*
* Widget initialization.
*
* This file defines a new element and a new widget. We need to register
- * the element with the themes that will need it. In this case we will
+ * the element with the themes that will need it. In this case we will
* register with the default theme that is the root of the theme inheritance
* tree. This means all themes will find this element.
* We then need to register the widget class style. This is the layout
@@ -287,10 +290,10 @@ TtkSquareWidget_Init(Tcl_Interp *interp)
/* register the new elements for this theme engine */
Ttk_RegisterElement(interp, theme, "square", &SquareElementSpec, NULL);
-
+
/* register the layout for this theme */
Ttk_RegisterLayout(theme, "TSquare", SquareLayout);
-
+
/* register the widget */
RegisterWidget(interp, "ttk::square", &SquareWidgetSpec);
diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c
index 5b62f3cb..9e5cf4b9 100644
--- a/generic/ttk/ttkState.c
+++ b/generic/ttk/ttkState.c
@@ -5,9 +5,7 @@
*
*/
-#include
-
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
/*
diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c
index 87b33dcd..0039585c 100644
--- a/generic/ttk/ttkStubInit.c
+++ b/generic/ttk/ttkStubInit.c
@@ -3,7 +3,7 @@
* It is compiled and linked in with the ttk package proper.
*/
-#include "tk.h"
+#include "tkInt.h"
#include "ttkTheme.h"
MODULE_SCOPE const TtkStubs ttkStubs;
diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c
index 2c07b9dd..faeabe8d 100644
--- a/generic/ttk/ttkStubLib.c
+++ b/generic/ttk/ttkStubLib.c
@@ -6,7 +6,7 @@
#undef USE_TCL_STUBS
#define USE_TCL_STUBS
-#include "tk.h"
+#include "tkInt.h"
#define USE_TTK_STUBS 1
#include "ttkTheme.h"
@@ -36,10 +36,10 @@ TtkInitializeStubs(
int exact = 0;
const char *packageName = "Ttk";
const char *errMsg = NULL;
- ClientData pkgClientData = NULL;
+ void *pkgClientData = NULL;
const char *actualVersion = Tcl_PkgRequireEx(
interp, packageName, version, exact, &pkgClientData);
- const TtkStubs *stubsPtr = pkgClientData;
+ const TtkStubs *stubsPtr = (const TtkStubs *)pkgClientData;
if (!actualVersion) {
return NULL;
@@ -67,7 +67,7 @@ error:
"Error loading ", packageName, " package",
" (requested version '", version,
"', loaded version '", actualVersion, "'): ",
- errMsg,
+ errMsg,
NULL);
return NULL;
}
diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c
index f2108b9d..0ce5ceaf 100644
--- a/generic/ttk/ttkTagSet.c
+++ b/generic/ttk/ttkTagSet.c
@@ -4,9 +4,7 @@
* Copyright (C) 2005, Joe English. Freely redistributable.
*/
-#include /* for memset() */
-#include
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -34,7 +32,7 @@ struct TtkTagTable {
*/
static Ttk_Tag NewTag(Ttk_TagTable tagTable, const char *tagName)
{
- Ttk_Tag tag = ckalloc(sizeof(*tag));
+ Ttk_Tag tag = (Ttk_Tag)ckalloc(sizeof(*tag));
tag->tagRecord = ckalloc(tagTable->recordSize);
memset(tag->tagRecord, 0, tagTable->recordSize);
/* Don't need Tk_InitOptions() here, all defaults should be NULL. */
@@ -58,7 +56,7 @@ Ttk_TagTable Ttk_CreateTagTable(
Tcl_Interp *interp, Tk_Window tkwin,
Tk_OptionSpec optionSpecs[], int recordSize)
{
- Ttk_TagTable tagTable = ckalloc(sizeof(*tagTable));
+ Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable));
tagTable->tkwin = tkwin;
tagTable->optionSpecs = optionSpecs;
tagTable->optionTable = Tk_CreateOptionTable(interp, optionSpecs);
@@ -75,7 +73,7 @@ void Ttk_DeleteTagTable(Ttk_TagTable tagTable)
entryPtr = Tcl_FirstHashEntry(&tagTable->tags, &search);
while (entryPtr != NULL) {
- DeleteTag(tagTable, Tcl_GetHashValue(entryPtr));
+ DeleteTag(tagTable, (Ttk_Tag)Tcl_GetHashValue(entryPtr));
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -90,10 +88,10 @@ Ttk_Tag Ttk_GetTag(Ttk_TagTable tagTable, const char *tagName)
&tagTable->tags, tagName, &isNew);
if (isNew) {
- tagName = Tcl_GetHashKey(&tagTable->tags, entryPtr);
+ tagName = (char *)Tcl_GetHashKey(&tagTable->tags, entryPtr);
Tcl_SetHashValue(entryPtr, NewTag(tagTable,tagName));
}
- return Tcl_GetHashValue(entryPtr);
+ return (Ttk_Tag)Tcl_GetHashValue(entryPtr);
}
Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr)
@@ -116,7 +114,7 @@ Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr)
Ttk_TagSet Ttk_GetTagSetFromObj(
Tcl_Interp *interp, Ttk_TagTable tagTable, Tcl_Obj *objPtr)
{
- Ttk_TagSet tagset = ckalloc(sizeof(*tagset));
+ Ttk_TagSet tagset = (Ttk_TagSet)ckalloc(sizeof(*tagset));
Tcl_Obj **objv;
int i, objc;
@@ -131,7 +129,7 @@ Ttk_TagSet Ttk_GetTagSetFromObj(
return NULL;
}
- tagset->tags = ckalloc((objc+1) * sizeof(Ttk_Tag));
+ tagset->tags = (Ttk_Tag *)ckalloc((objc+1) * sizeof(Ttk_Tag));
for (i=0; itags[i] = Ttk_GetTagFromObj(tagTable, objv[i]);
}
@@ -188,7 +186,7 @@ int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag)
return 0;
}
}
- tagset->tags = ckrealloc(tagset->tags,
+ tagset->tags = (Ttk_Tag *)ckrealloc(tagset->tags,
(tagset->nTags+1)*sizeof(tagset->tags[0]));
tagset->tags[tagset->nTags++] = tag;
return 1;
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index cc75238e..00cb50bb 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -15,13 +15,6 @@
#define PKG_ASSOC_KEY "Ttk"
-#ifdef MAC_OSX_TK
- extern void TkMacOSXFlushWindows(void);
- #define UPDATE_WINDOWS() TkMacOSXFlushWindows()
-#else
- #define UPDATE_WINDOWS()
-#endif
-
/*------------------------------------------------------------------------
* +++ Styles.
*
@@ -42,9 +35,9 @@ typedef struct Ttk_Style_
Ttk_ResourceCache cache; /* Back-pointer to resource cache */
} Style;
-static Style *NewStyle()
+static Style *NewStyle(void)
{
- Style *stylePtr = ckalloc(sizeof(Style));
+ Style *stylePtr = (Style *)ckalloc(sizeof(Style));
stylePtr->styleName = NULL;
stylePtr->parentStyle = NULL;
@@ -63,7 +56,7 @@ static void FreeStyle(Style *stylePtr)
entryPtr = Tcl_FirstHashEntry(&stylePtr->settingsTable, &search);
while (entryPtr != NULL) {
- Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr);
+ Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr);
Tcl_DecrRefCount(stateMap);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -71,7 +64,7 @@ static void FreeStyle(Style *stylePtr)
entryPtr = Tcl_FirstHashEntry(&stylePtr->defaultsTable, &search);
while (entryPtr != NULL) {
- Tcl_Obj *defaultValue = Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *defaultValue = (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
Tcl_DecrRefCount(defaultValue);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -92,7 +85,7 @@ Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state)
Tcl_HashEntry *entryPtr =
Tcl_FindHashEntry(&style->settingsTable, optionName);
if (entryPtr) {
- Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr);
+ Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr);
return Ttk_StateMapLookup(NULL, stateMap, state);
}
style = style->parentStyle;
@@ -110,7 +103,7 @@ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName)
Tcl_HashEntry *entryPtr =
Tcl_FindHashEntry(&style->defaultsTable, optionName);
if (entryPtr)
- return Tcl_GetHashValue(entryPtr);
+ return (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
style= style->parentStyle;
}
return 0;
@@ -183,7 +176,7 @@ static const Tk_OptionSpec *TTKGetOptionSpec(
static OptionMap
BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
{
- OptionMap optionMap = ckalloc(
+ OptionMap optionMap = (OptionMap)ckalloc(
sizeof(const Tk_OptionSpec) * elementClass->nResources + 1);
int i;
@@ -211,7 +204,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
optionMap = BuildOptionMap(elementClass, optionTable);
Tcl_SetHashValue(entryPtr, optionMap);
} else {
- optionMap = Tcl_GetHashValue(entryPtr);
+ optionMap = (OptionMap)Tcl_GetHashValue(entryPtr);
}
return optionMap;
@@ -225,7 +218,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
static Ttk_ElementClass *
NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData)
{
- Ttk_ElementClass *elementClass = ckalloc(sizeof(Ttk_ElementClass));
+ Ttk_ElementClass *elementClass = (Ttk_ElementClass *)ckalloc(sizeof(Ttk_ElementClass));
int i;
elementClass->name = name;
@@ -241,7 +234,7 @@ NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData)
/* Initialize default values:
*/
- elementClass->defaultValues =
+ elementClass->defaultValues = (Tcl_Obj **)
ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1);
for (i=0; i < elementClass->nResources; ++i) {
const char *defaultValue = specPtr->options[i].defaultValue;
@@ -298,8 +291,13 @@ static void FreeElementClass(Ttk_ElementClass *elementClass)
* +++ Themes.
*/
-static int ThemeEnabled(Ttk_Theme theme, void *clientData) { return 1; }
+static int ThemeEnabled(
+ TCL_UNUSED(Ttk_Theme),
+ TCL_UNUSED(void *))
+{
/* Default ThemeEnabledProc -- always return true */
+ return 1;
+}
typedef struct Ttk_Theme_
{
@@ -314,7 +312,7 @@ typedef struct Ttk_Theme_
static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent)
{
- Theme *themePtr = ckalloc(sizeof(Theme));
+ Theme *themePtr = (Theme *)ckalloc(sizeof(Theme));
Tcl_HashEntry *entryPtr;
int unused;
@@ -331,7 +329,7 @@ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent)
entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, ".", &unused);
themePtr->rootStyle = NewStyle();
themePtr->rootStyle->styleName =
- Tcl_GetHashKey(&themePtr->styleTable, entryPtr);
+ (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr);
themePtr->rootStyle->cache = themePtr->cache;
Tcl_SetHashValue(entryPtr, themePtr->rootStyle);
@@ -348,7 +346,7 @@ static void FreeTheme(Theme *themePtr)
*/
entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search);
while (entryPtr != NULL) {
- Ttk_ElementClass *elementClass = Tcl_GetHashValue(entryPtr);
+ Ttk_ElementClass *elementClass = (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr);
FreeElementClass(elementClass);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -359,7 +357,7 @@ static void FreeTheme(Theme *themePtr)
*/
entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search);
while (entryPtr != NULL) {
- Style *stylePtr = Tcl_GetHashValue(entryPtr);
+ Style *stylePtr = (Style *)Tcl_GetHashValue(entryPtr);
FreeStyle(stylePtr);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -391,7 +389,7 @@ typedef struct CleanupStruct {
} Cleanup;
/*------------------------------------------------------------------------
- * +++ Master style package data structure.
+ * +++ Style package data structure.
*/
typedef struct
{
@@ -405,14 +403,16 @@ typedef struct
int themeChangePending; /* scheduled ThemeChangedProc call? */
} StylePackageData;
-static void ThemeChangedProc(ClientData); /* Forward */
+static void ThemeChangedProc(void *); /* Forward */
/* Ttk_StylePkgFree --
* Cleanup procedure for StylePackageData.
*/
-static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp)
+static void Ttk_StylePkgFree(
+ ClientData clientData,
+ TCL_UNUSED(Tcl_Interp *))
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr;
Cleanup *cleanup;
@@ -429,7 +429,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp)
*/
entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search);
while (entryPtr != NULL) {
- Theme *themePtr = Tcl_GetHashValue(entryPtr);
+ Theme *themePtr = (Theme *)Tcl_GetHashValue(entryPtr);
FreeTheme(themePtr);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -471,7 +471,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp)
static StylePackageData *GetStylePackageData(Tcl_Interp *interp)
{
- return Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL);
+ return (StylePackageData *)Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL);
}
/*
@@ -486,8 +486,8 @@ static StylePackageData *GetStylePackageData(Tcl_Interp *interp)
void Ttk_RegisterCleanup(
Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc)
{
- StylePackageData *pkgPtr = GetStylePackageData(interp);
- Cleanup *cleanup = ckalloc(sizeof(*cleanup));
+ StylePackageData *pkgPtr = (StylePackageData *)GetStylePackageData(interp);
+ Cleanup *cleanup = (Cleanup *)ckalloc(sizeof(*cleanup));
cleanup->clientData = clientData;
cleanup->cleanupProc = cleanupProc;
@@ -510,14 +510,13 @@ void Ttk_RegisterCleanup(
static void ThemeChangedProc(ClientData clientData)
{
static char ThemeChangedScript[] = "ttk::ThemeChanged";
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
int code = Tcl_EvalEx(pkgPtr->interp, ThemeChangedScript, -1, TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
Tcl_BackgroundException(pkgPtr->interp, code);
}
pkgPtr->themeChangePending = 0;
- UPDATE_WINDOWS();
}
/*
@@ -591,7 +590,7 @@ void Ttk_SetThemeEnabledProc(
static Ttk_Theme LookupTheme(
Tcl_Interp *interp, /* where to leave error messages */
- StylePackageData *pkgPtr, /* style package master record */
+ StylePackageData *pkgPtr, /* style package record */
const char *name) /* theme name */
{
Tcl_HashEntry *entryPtr;
@@ -604,7 +603,7 @@ static Ttk_Theme LookupTheme(
return NULL;
}
- return Tcl_GetHashValue(entryPtr);
+ return (Ttk_Theme)Tcl_GetHashValue(entryPtr);
}
/*
@@ -712,12 +711,12 @@ Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName)
stylePtr->parentStyle = themePtr->rootStyle;
}
- stylePtr->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr);
+ stylePtr->styleName = (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr);
stylePtr->cache = stylePtr->parentStyle->cache;
Tcl_SetHashValue(entryPtr, stylePtr);
return stylePtr;
}
- return Tcl_GetHashValue(entryPtr);
+ return (Ttk_Style)Tcl_GetHashValue(entryPtr);
}
/* FindLayoutTemplate --
@@ -763,7 +762,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName)
*/
entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, elementName);
if (entryPtr) {
- return Tcl_GetHashValue(entryPtr);
+ return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr);
}
/*
@@ -774,7 +773,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName)
entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, dot);
}
if (entryPtr) {
- return Tcl_GetHashValue(entryPtr);
+ return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr);
}
/*
@@ -790,7 +789,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName)
*/
entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, "");
/* ASSERT: entryPtr != 0 */
- return Tcl_GetHashValue(entryPtr);
+ return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr);
}
const char *Ttk_ElementClassName(Ttk_ElementClass *elementClass)
@@ -807,7 +806,7 @@ int Ttk_RegisterElementFactory(
Ttk_ElementFactory factory, void *clientData)
{
StylePackageData *pkgPtr = GetStylePackageData(interp);
- FactoryRec *recPtr = ckalloc(sizeof(*recPtr));
+ FactoryRec *recPtr = (FactoryRec *)ckalloc(sizeof(*recPtr));
Tcl_HashEntry *entryPtr;
int newEntry;
@@ -828,7 +827,7 @@ int Ttk_RegisterElementFactory(
* (style element create $name) "from" $theme ?$element?
*/
static int Ttk_CloneElement(
- Tcl_Interp *interp, void *clientData,
+ Tcl_Interp *interp, TCL_UNUSED(void *),
Ttk_Theme theme, const char *elementName,
int objc, Tcl_Obj *const objv[])
{
@@ -903,7 +902,7 @@ Ttk_ElementClass *Ttk_RegisterElement(
return 0;
}
- name = Tcl_GetHashKey(&theme->elementTable, entryPtr);
+ name = (char *)Tcl_GetHashKey(&theme->elementTable, entryPtr);
elementClass = NewElementClass(name, specPtr, clientData);
Tcl_SetHashValue(entryPtr, elementClass);
@@ -992,7 +991,7 @@ int InitializeElementRecord(
int i;
for (i=0; ioffset);
+ ((char *)elementRecord + elementOption->offset);
const char *optionName = elementOption->optionName;
Tcl_Obj *dynamicSetting = Ttk_StyleMap(style, optionName, state);
Tcl_Obj *widgetValue = 0;
@@ -1000,7 +999,7 @@ int InitializeElementRecord(
if (optionMap[i]) {
widgetValue = *(Tcl_Obj **)
- (widgetRecord + optionMap[i]->objOffset);
+ ((char *)widgetRecord + optionMap[i]->objOffset);
}
if (widgetValue) {
@@ -1142,7 +1141,7 @@ int TtkEnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht)
Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search);
while (entryPtr != NULL) {
- Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1);
+ Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1);
Tcl_ListObjAppendElement(interp, result, nameObj);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -1162,8 +1161,8 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht)
Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search);
while (entryPtr != NULL) {
- Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1);
- Tcl_Obj *valueObj = Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1);
+ Tcl_Obj *valueObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
Tcl_ListObjAppendElement(NULL, result, nameObj);
Tcl_ListObjAppendElement(NULL, result, valueObj);
entryPtr = Tcl_NextHashEntry(&search);
@@ -1179,12 +1178,12 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht)
*/
static int
StyleMapCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *styleName;
Style *stylePtr;
@@ -1248,7 +1247,7 @@ usage:
static int StyleConfigureCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *styleName;
Style *stylePtr;
@@ -1303,7 +1302,7 @@ usage:
static int StyleLookupCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
Ttk_Style style = NULL;
const char *optionName;
@@ -1345,7 +1344,7 @@ static int StyleLookupCmd(
static int StyleThemeCurrentCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[])
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr = NULL;
const char *name = NULL;
@@ -1357,9 +1356,9 @@ static int StyleThemeCurrentCmd(
entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search);
while (entryPtr != NULL) {
- Theme *ptr = Tcl_GetHashValue(entryPtr);
+ Theme *ptr = (Theme *)Tcl_GetHashValue(entryPtr);
if (ptr == pkgPtr->currentTheme) {
- name = Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr);
+ name = (char *)Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr);
break;
}
entryPtr = Tcl_NextHashEntry(&search);
@@ -1381,7 +1380,7 @@ static int StyleThemeCurrentCmd(
static int StyleThemeCreateCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
static const char *optStrings[] =
{ "-parent", "-settings", NULL };
enum { OP_PARENT, OP_SETTINGS };
@@ -1443,9 +1442,13 @@ static int StyleThemeCreateCmd(
* Return list of registered themes.
*/
static int StyleThemeNamesCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ ClientData clientData,
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
+
return TtkEnumerateHashTable(interp, &pkgPtr->themeTable);
}
@@ -1456,12 +1459,12 @@ static int StyleThemeNamesCmd(
*/
static int
StyleThemeSettingsCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme oldTheme = pkgPtr->currentTheme;
Ttk_Theme newTheme;
int status;
@@ -1487,7 +1490,7 @@ StyleThemeSettingsCmd(
static int StyleElementCreateCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *elementName, *factoryName;
Tcl_HashEntry *entryPtr;
@@ -1510,7 +1513,7 @@ static int StyleElementCreateCmd(
return TCL_ERROR;
}
- recPtr = Tcl_GetHashValue(entryPtr);
+ recPtr = (FactoryRec *)Tcl_GetHashValue(entryPtr);
return recPtr->factory(interp, recPtr->clientData,
theme, elementName, objc - 5, objv + 5);
@@ -1522,7 +1525,7 @@ static int StyleElementCreateCmd(
static int StyleElementNamesCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
if (objc != 3) {
@@ -1538,7 +1541,7 @@ static int StyleElementNamesCmd(
static int StyleElementOptionsCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *elementName;
Ttk_ElementClass *elementClass;
@@ -1576,7 +1579,7 @@ static int StyleElementOptionsCmd(
static int StyleLayoutCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *layoutName;
Ttk_LayoutTemplate layoutTemplate;
@@ -1614,12 +1617,12 @@ static int StyleLayoutCmd(
*/
static int
StyleThemeUseCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
{
- StylePackageData *pkgPtr = clientData;
+ StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme;
if (objc < 3 || objc > 4) {
@@ -1671,7 +1674,7 @@ static const Ttk_Ensemble StyleEnsemble[] = {
static int
StyleObjCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -1714,7 +1717,7 @@ void Ttk_StylePkgInit(Tcl_Interp *interp)
{
Tcl_Namespace *nsPtr;
- StylePackageData *pkgPtr = ckalloc(sizeof(StylePackageData));
+ StylePackageData *pkgPtr = (StylePackageData *)ckalloc(sizeof(StylePackageData));
pkgPtr->interp = interp;
Tcl_InitHashTable(&pkgPtr->themeTable, TCL_STRING_KEYS);
diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c
index 7c4345d9..d086c027 100644
--- a/generic/ttk/ttkTrace.c
+++ b/generic/ttk/ttkTrace.c
@@ -3,11 +3,11 @@
*
* Simplified interface to Tcl_TraceVariable.
*
- * PROBLEM: Can't distinguish "variable does not exist" (which is OK)
+ * PROBLEM: Can't distinguish "variable does not exist" (which is OK)
* from other errors (which are not).
*/
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -30,9 +30,11 @@ VarTraceProc(
const char *name2, /* (unused) */
int flags) /* Information about what happened. */
{
- Ttk_TraceHandle *tracePtr = clientData;
+ Ttk_TraceHandle *tracePtr = (Ttk_TraceHandle *)clientData;
const char *name, *value;
Tcl_Obj *valuePtr;
+ (void)name1;
+ (void)name2;
if (Tcl_InterpDeleted(interp)) {
return NULL;
@@ -51,7 +53,7 @@ VarTraceProc(
*/
if (tracePtr->interp == NULL) {
Tcl_DecrRefCount(tracePtr->varnameObj);
- ckfree((ClientData)tracePtr);
+ ckfree(tracePtr);
return NULL;
}
Tcl_TraceVar2(interp, name, NULL,
@@ -85,7 +87,7 @@ Ttk_TraceHandle *Ttk_TraceVariable(
Ttk_TraceProc callback,
void *clientData)
{
- Ttk_TraceHandle *h = ckalloc(sizeof(*h));
+ Ttk_TraceHandle *h = (Ttk_TraceHandle *)ckalloc(sizeof(*h));
int status;
h->interp = interp;
@@ -96,7 +98,7 @@ Ttk_TraceHandle *Ttk_TraceVariable(
status = Tcl_TraceVar2(interp, Tcl_GetString(varnameObj),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- VarTraceProc, (ClientData)h);
+ VarTraceProc, h);
if (status != TCL_OK) {
Tcl_DecrRefCount(h->varnameObj);
@@ -137,7 +139,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h)
*/
while ((cd = Tcl_VarTraceInfo(h->interp, Tcl_GetString(h->varnameObj),
TCL_GLOBAL_ONLY, VarTraceProc, cd)) != NULL) {
- if (cd == (ClientData) h) {
+ if (cd == h) {
break;
}
}
@@ -152,7 +154,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h)
}
Tcl_UntraceVar2(h->interp, Tcl_GetString(h->varnameObj),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- VarTraceProc, (ClientData)h);
+ VarTraceProc, h);
Tcl_DecrRefCount(h->varnameObj);
ckfree(h);
}
diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c
index 396b073a..fa2a7e06 100644
--- a/generic/ttk/ttkTrack.c
+++ b/generic/ttk/ttkTrack.c
@@ -23,7 +23,7 @@
* TODO: Handle "chords" properly (e.g., )
*/
-#include
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index ccc5e2e1..41b05e58 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -4,8 +4,6 @@
* ttk::treeview widget implementation.
*/
-#include
-#include
#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -1779,7 +1777,7 @@ static void DrawItem(
x+indent, y, colwidth-indent, rowHeight);
if (item->textObj) { displayItem.textObj = item->textObj; }
if (item->imageObj) { displayItem.imageObj = item->imageObj; }
- /* ??? displayItem.anchorObj = 0; <> */
+ displayItem.anchorObj = tv->tree.column0.anchorObj;
DisplayLayout(tv->tree.itemLayout, &displayItem, state, parcel, d);
x += colwidth;
}
@@ -2842,7 +2840,6 @@ static int TreeviewSeeCommand(
TtkRedisplayWidget(&tv->core);
}
}
- tv->tree.yscroll.total = CountRows(tv->tree.root) - 1;
/* Make sure item is visible:
*/
@@ -3321,8 +3318,7 @@ TTK_LAYOUT("Item",
TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH,
TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT)
TTK_NODE("Treeitem.image", TTK_PACK_LEFT)
- TTK_GROUP("Treeitem.focus", TTK_PACK_LEFT,
- TTK_NODE("Treeitem.text", TTK_PACK_LEFT))))
+ TTK_NODE("Treeitem.text", TTK_FILL_BOTH)))
TTK_LAYOUT("Cell",
TTK_GROUP("Treedata.padding", TTK_FILL_BOTH,
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index d7f4b25a..0cfc1198 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -4,7 +4,6 @@
* Core widget utilities.
*/
-#include
#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -263,7 +262,7 @@ static const unsigned CoreEventMask
static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
{
- WidgetCore *corePtr = clientData;
+ WidgetCore *corePtr = (WidgetCore *)clientData;
switch (eventPtr->type)
{
@@ -310,12 +309,15 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
corePtr->state |= TTK_STATE_HOVER;
TtkRedisplayWidget(corePtr);
break;
- case VirtualEvent:
- if (!strcmp("ThemeChanged", ((XVirtualEvent *)(eventPtr))->name)) {
+ case VirtualEvent: {
+ const char *name = ((XVirtualEvent *)eventPtr)->name;
+ if ((name != NULL) && !strcmp("ThemeChanged", name)) {
(void)UpdateLayout(corePtr->interp, corePtr);
SizeChanged(corePtr);
TtkRedisplayWidget(corePtr);
}
+ break;
+ }
default:
/* can't happen... */
break;
diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h
index 8a94bb74..6cd691b1 100644
--- a/generic/ttk/ttkWidget.h
+++ b/generic/ttk/ttkWidget.h
@@ -111,8 +111,8 @@ MODULE_SCOPE int TtkWidgetConstructorObjCmd(
/* WIDGET_TAKEFOCUS_TRUE --
* WIDGET_TAKEFOCUS_FALSE --
- * Add one or the other of these to each OptionSpecs table
- * to indicate whether the widget should take focus
+ * Add one or the other of these to each OptionSpecs table
+ * to indicate whether the widget should take focus
* during keyboard traversal.
*/
#define WIDGET_TAKEFOCUS_TRUE \
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index 84219247..fe8dfe04 100644
--- a/library/bgerror.tcl
+++ b/library/bgerror.tcl
@@ -41,7 +41,7 @@ proc ::tk::dialog::error::Details {} {
set w .bgerrorDialog
set caption [option get $w.function text {}]
set command [option get $w.function command {}]
- if { ($caption eq "") || ($command eq "") } {
+ if {($caption eq "") || ($command eq "")} {
grid forget $w.function
}
lappend command [$w.top.info.text get 1.0 end-1c]
@@ -50,7 +50,7 @@ proc ::tk::dialog::error::Details {} {
}
proc ::tk::dialog::error::SaveToLog {text} {
- if { $::tcl_platform(platform) eq "windows" } {
+ if {$::tcl_platform(platform) eq "windows"} {
set allFiles *.*
} else {
set allFiles *
@@ -129,11 +129,11 @@ proc ::tk::dialog::error::bgerror {err {flag 1}} {
set lines 0
set maxLine 45
foreach line [split $err \n] {
- if { [string length $line] > $maxLine } {
- append displayedErr "[string range $line 0 [expr {$maxLine-3}]]..."
+ if {[string length $line] > $maxLine} {
+ append displayedErr "[string range $line 0 $maxLine-3]..."
break
}
- if { $lines > 4 } {
+ if {$lines > 4} {
append displayedErr "..."
break
} else {
@@ -182,7 +182,7 @@ proc ::tk::dialog::error::bgerror {err {flag 1}} {
pack $W.text -side left -expand yes -fill both
$W.text insert 0.0 "$err\n$info"
$W.text mark set insert 0.0
- bind $W.text { focus %W }
+ bind $W.text {focus %W}
$W.text configure -state disabled
# 2. Fill the top part with bitmap and message
diff --git a/library/clrpick.tcl b/library/clrpick.tcl
index 600be162..e408d037 100644
--- a/library/clrpick.tcl
+++ b/library/clrpick.tcl
@@ -396,7 +396,7 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
# Draw the selection polygons
CreateSelector $w $sel $c
- $sel bind $data($c,index) \
+ $sel bind $data($c,index) \
[list tk::dialog::color::StartMove $w $sel $c %x $data(selPad) 1]
$sel bind $data($c,index) \
[list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)]
@@ -409,14 +409,14 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
set data($c,clickRegion) [$sel create rectangle 0 0 \
$data(canvasWidth) $height -fill {} -outline {}]
- bind $col \
+ bind $col \
[list tk::dialog::color::StartMove $w $sel $c %x $data(colorPad)]
bind $col \
[list tk::dialog::color::MoveSelector $w $sel $c %x $data(colorPad)]
bind $col \
[list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(colorPad)]
- $sel bind $data($c,clickRegion) \
+ $sel bind $data($c,clickRegion) \
[list tk::dialog::color::StartMove $w $sel $c %x $data(selPad)]
$sel bind $data($c,clickRegion) \
[list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)]
diff --git a/library/comdlg.tcl b/library/comdlg.tcl
index 18df8a64..b4d89785 100644
--- a/library/comdlg.tcl
+++ b/library/comdlg.tcl
@@ -29,7 +29,8 @@
# {....}
# }
#
-# flags = currently unused.
+# flags = a list of flags. Currently supported flags are:
+# DONTSETDEFAULTS = skip default values setting
#
# argList = The list of "-option value" pairs.
#
@@ -63,8 +64,10 @@ proc tclParseConfigSpec {w specs flags argList} {
# 2: set the default values
#
- foreach cmdsw [array names cmd] {
- set data($cmdsw) $def($cmdsw)
+ if {"DONTSETDEFAULTS" ni $flags} {
+ foreach cmdsw [array names cmd] {
+ set data($cmdsw) $def($cmdsw)
+ }
}
# 3: parse the argument list
diff --git a/library/console.tcl b/library/console.tcl
index 355a43b0..30c4d883 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -131,7 +131,7 @@ proc ::tk::ConsoleInit {} {
default { set preferred {} }
}
foreach {family size} $preferred {
- if {[lsearch -exact $families $family] != -1} {
+ if {$family in $families} {
font configure TkConsoleFont -family $family -size $size
break
}
@@ -592,7 +592,7 @@ proc ::tk::ConsoleBind {w} {
}
bind Console {
eval destroy [winfo child .]
- source [file join $tk_library console.tcl]
+ source -encoding utf-8 [file join $tk_library console.tcl]
}
if {[tk windowingsystem] eq "aqua"} {
bind Console {
@@ -740,9 +740,9 @@ proc ::tk::console::FontchooserToggle {} {
}
proc ::tk::console::FontchooserVisibility {index} {
if {[tk fontchooser configure -visible]} {
- .menubar.edit entryconfigure $index -label [msgcat::mc "Hide Fonts"]
+ .menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Hide Fonts"]
} else {
- .menubar.edit entryconfigure $index -label [msgcat::mc "Show Fonts"]
+ .menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Show Fonts"]
}
}
proc ::tk::console::FontchooserFocus {w isFocusIn} {
diff --git a/library/demos/arrow.tcl b/library/demos/arrow.tcl
index 12249c0b..3d0b4067 100644
--- a/library/demos/arrow.tcl
+++ b/library/demos/arrow.tcl
@@ -154,11 +154,11 @@ $c bind box "$c itemconfigure current $demo_arrowInfo(activeStyle)"
$c bind box "$c itemconfigure current $demo_arrowInfo(boxStyle)"
$c bind box " "
$c bind box " "
-$c bind box1 <1> {set demo_arrowInfo(motionProc) arrowMove1}
-$c bind box2 <1> {set demo_arrowInfo(motionProc) arrowMove2}
-$c bind box3 <1> {set demo_arrowInfo(motionProc) arrowMove3}
+$c bind box1 {set demo_arrowInfo(motionProc) arrowMove1}
+$c bind box2 {set demo_arrowInfo(motionProc) arrowMove2}
+$c bind box3 {set demo_arrowInfo(motionProc) arrowMove3}
$c bind box "\$demo_arrowInfo(motionProc) $c %x %y"
-bind $c "arrowSetup $c"
+bind $c "arrowSetup $c"
# arrowMove1 --
# This procedure is called for each mouse motion event on box1 (the
diff --git a/library/demos/bind.tcl b/library/demos/bind.tcl
index 03f6d3b6..8b56639f 100644
--- a/library/demos/bind.tcl
+++ b/library/demos/bind.tcl
@@ -63,16 +63,16 @@ $w.text insert end \
# Create bindings for tags.
foreach tag {d1 d2 d3 d4 d5 d6} {
- $w.text tag bind $tag "$w.text tag configure $tag $bold"
- $w.text tag bind $tag "$w.text tag configure $tag $normal"
+ $w.text tag bind $tag "$w.text tag configure $tag $bold"
+ $w.text tag bind $tag "$w.text tag configure $tag $normal"
}
# Main widget program sets variable tk_demoDirectory
-$w.text tag bind d1 <1> {source [file join $tk_demoDirectory items.tcl]}
-$w.text tag bind d2 <1> {source [file join $tk_demoDirectory plot.tcl]}
-$w.text tag bind d3 <1> {source [file join $tk_demoDirectory ctext.tcl]}
-$w.text tag bind d4 <1> {source [file join $tk_demoDirectory arrow.tcl]}
-$w.text tag bind d5 <1> {source [file join $tk_demoDirectory ruler.tcl]}
-$w.text tag bind d6 <1> {source [file join $tk_demoDirectory cscroll.tcl]}
+$w.text tag bind d1 {source -encoding utf-8 [file join $tk_demoDirectory items.tcl]}
+$w.text tag bind d2 {source -encoding utf-8 [file join $tk_demoDirectory plot.tcl]}
+$w.text tag bind d3 {source -encoding utf-8 [file join $tk_demoDirectory ctext.tcl]}
+$w.text tag bind d4 {source -encoding utf-8 [file join $tk_demoDirectory arrow.tcl]}
+$w.text tag bind d5 {source -encoding utf-8 [file join $tk_demoDirectory ruler.tcl]}
+$w.text tag bind d6 {source -encoding utf-8 [file join $tk_demoDirectory cscroll.tcl]}
$w.text mark set insert 0.0
$w.text configure -state disabled
diff --git a/library/demos/colors.tcl b/library/demos/colors.tcl
index 99dec923..fdfdc5b1 100644
--- a/library/demos/colors.tcl
+++ b/library/demos/colors.tcl
@@ -32,7 +32,7 @@ listbox $w.frame.list -yscroll "$w.frame.scroll set" \
-width 20 -height 16 -setgrid 1
pack $w.frame.list $w.frame.scroll -side left -fill y -expand 1
-bind $w.frame.list {
+bind $w.frame.list {
tk_setPalette [selection get]
}
$w.frame.list insert 0 gray60 gray70 gray80 gray85 gray90 gray95 \
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index 443b102b..d210c7df 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -53,54 +53,84 @@ for {set i 0} {$i < 20} {incr i} {
}
}
-$c bind all "scrollEnter $c"
-$c bind all "scrollLeave $c"
-$c bind all <1> "scrollButton $c"
-bind $c <2> "$c scan mark %x %y"
-bind $c "$c scan dragto %x %y"
-if {[tk windowingsystem] eq "aqua"} {
+$c bind all "scrollEnter $c"
+$c bind all "scrollLeave $c"
+$c bind all "scrollButton $c"
+if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide Tk] 8.7-]} {
+ bind $c "$c scan mark %x %y"
+ bind $c "$c scan dragto %x %y"
bind $c {
- %W yview scroll [expr {-(%D)}] units
+ %W yview scroll [expr {-%D}] units
}
bind $c {
- %W yview scroll [expr {-10 * (%D)}] units
+ %W yview scroll [expr {-10*%D}] units
}
bind $c {
- %W xview scroll [expr {-(%D)}] units
+ %W xview scroll [expr {-%D}] units
}
bind $c {
- %W xview scroll [expr {-10 * (%D)}] units
+ %W xview scroll [expr {-10*%D}] units
}
} else {
+ bind $c "$c scan mark %x %y"
+ bind $c "$c scan dragto %x %y"
+ # We must make sure that positive and negative movements are rounded
+ # equally to integers, avoiding the problem that
+ # (int)1/-30 = -1,
+ # but
+ # (int)-1/-30 = 0
+ # The following code ensure equal +/- behaviour.
bind $c {
- %W yview scroll [expr {-(%D / 30)}] units
+ if {%D >= 0} {
+ %W yview scroll [expr {%D/-30}] units
+ } else {
+ %W yview scroll [expr {(%D-29)/-30}] units
+ }
+ }
+ bind $c {
+ if {%D >= 0} {
+ %W yview scroll [expr {%D/-3}] units
+ } else {
+ %W yview scroll [expr {(%D-2)/-3}] units
+ }
}
bind $c {
- %W xview scroll [expr {-(%D / 30)}] units
+ if {%D >= 0} {
+ %W xview scroll [expr {%D/-30}] units
+ } else {
+ %W xview scroll [expr {(%D-29)/-30}] units
+ }
+ }
+ bind $c {
+ if {%D >= 0} {
+ %W xview scroll [expr {%D/-3}] units
+ } else {
+ %W xview scroll [expr {(%D-2)/-3}] units
+ }
}
}
-if {[tk windowingsystem] eq "x11"} {
+if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} {
# Support for mousewheels on Linux/Unix commonly comes through mapping
# the wheel to the extended buttons. If you have a mousewheel, find
# Linux configuration info at:
# http://linuxreviews.org/howtos/xfree/mouse/
- bind $c <4> {
+ bind $c {
if {!$tk_strictMotif} {
%W yview scroll -5 units
}
}
- bind $c {
+ bind $c {
if {!$tk_strictMotif} {
%W xview scroll -5 units
}
}
- bind $c <5> {
+ bind $c {
if {!$tk_strictMotif} {
%W yview scroll 5 units
}
}
- bind $c {
+ bind $c {
if {!$tk_strictMotif} {
%W xview scroll 5 units
}
diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl
index a3b4e8a8..d3fec331 100644
--- a/library/demos/ctext.tcl
+++ b/library/demos/ctext.tcl
@@ -41,16 +41,20 @@ $c create rectangle 245 195 255 205 -outline black -fill red
# First, create the text item and give it bindings so it can be edited.
$c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been defined to support editing (see above)." -width 440 -anchor n -font $textFont -justify left]
-$c bind text <1> "textB1Press $c %x %y"
+$c bind text "textB1Press $c %x %y"
$c bind text "textB1Move $c %x %y"
-$c bind text "$c select adjust current @%x,%y"
+$c bind text "$c select adjust current @%x,%y"
$c bind text "textB1Move $c %x %y"
-$c bind text "textInsert $c %A"
+$c bind text "textInsert $c %A"
$c bind text "textInsert $c \\n"
$c bind text "textBs $c"
$c bind text "textBs $c"
$c bind text "textDel $c"
-$c bind text <2> "textPaste $c @%x,%y"
+if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
+ $c bind text "textPaste $c @%x,%y"
+} else {
+ $c bind text "textPaste $c @%x,%y"
+}
# Next, create some items that allow the text's anchor position
# to be edited.
@@ -58,14 +62,14 @@ $c bind text <2> "textPaste $c @%x,%y"
proc mkTextConfigBox {w x y option value color} {
set item [$w create rect $x $y [expr {$x+30}] [expr {$y+30}] \
-outline black -fill $color -width 1]
- $w bind $item <1> "$w itemconf text $option $value"
+ $w bind $item "$w itemconf text $option $value"
$w addtag config withtag $item
}
proc mkTextConfigPie {w x y a option value color} {
set item [$w create arc $x $y [expr {$x+90}] [expr {$y+90}] \
-start [expr {$a-15}] -extent 30 -outline black -fill $color \
-width 1]
- $w bind $item <1> "$w itemconf text $option $value"
+ $w bind $item "$w itemconf text $option $value"
$w addtag config withtag $item
}
@@ -84,7 +88,7 @@ mkTextConfigBox $c [expr {$x+60}] [expr {$y+60}] -anchor nw $color
set item [$c create rect \
[expr {$x+40}] [expr {$y+40}] [expr {$x+50}] [expr {$y+50}] \
-outline black -fill red]
-$c bind $item <1> "$c itemconf text -anchor center"
+$c bind $item "$c itemconf text -anchor center"
$c create text [expr {$x+45}] [expr {$y-5}] \
-text {Text Position} -anchor s -font {Times 20} -fill brown
diff --git a/library/demos/dialog1.tcl b/library/demos/dialog1.tcl
index 976e9550..66d8c9af 100644
--- a/library/demos/dialog1.tcl
+++ b/library/demos/dialog1.tcl
@@ -2,16 +2,16 @@
#
# This demonstration script creates a dialog box with a local grab.
-interp create slave
-load {} Tk slave
-slave eval {
- wm title . slave
+interp create child
+load {} Tk child
+child eval {
+ wm title . child
wm geometry . +700+30
pack [text .t -width 30 -height 10]
}
after idle {.dialog1.msg configure -wraplength 4i}
-set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "slave" which was created by a slave interpreter.} \
+set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "child" which was created by a child interpreter.} \
info 0 OK Cancel {Show Code}]
switch $i {
@@ -20,6 +20,6 @@ switch $i {
2 {showCode .dialog1}
}
-if {[interp exists slave]} {
- interp delete slave
+if {[interp exists child]} {
+ interp delete child
}
diff --git a/library/demos/entry1.tcl b/library/demos/entry1.tcl
index eef89644..7365fc72 100644
--- a/library/demos/entry1.tcl
+++ b/library/demos/entry1.tcl
@@ -16,7 +16,7 @@ wm title $w "Entry Demonstration (no scrollbars)"
wm iconname $w "entry1"
positionWindow $w
-label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse button2 pressed."
+label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse the middle mouse button pressed."
pack $w.msg -side top
## See Code / Dismiss buttons
diff --git a/library/demos/entry2.tcl b/library/demos/entry2.tcl
index 9e3f4ef1..6405d851 100644
--- a/library/demos/entry2.tcl
+++ b/library/demos/entry2.tcl
@@ -16,7 +16,7 @@ wm title $w "Entry Demonstration (with scrollbars)"
wm iconname $w "entry2"
positionWindow $w
-label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries with the scrollbars, or by dragging with mouse button2 pressed."
+label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries with the scrollbars, or by dragging with the middle mouse button pressed."
pack $w.msg -side top
## See Code / Dismiss buttons
diff --git a/library/demos/entry3.tcl b/library/demos/entry3.tcl
index d4435c61..acde1b36 100644
--- a/library/demos/entry3.tcl
+++ b/library/demos/entry3.tcl
@@ -102,7 +102,7 @@ foreach {chars digit} {abc 2 def 3 ghi 4 jkl 5 mno 6 pqrs 7 tuv 8 wxyz 9} {
proc validatePhoneChange {W vmode idx char} {
global phoneNumberMap entry3content
- if {$idx == -1} {return 1}
+ if {$idx < 0} {return 1}
after idle [list $W configure -validate $vmode -invcmd bell]
if {
!($idx<3 || $idx==6 || $idx==7 || $idx==11 || $idx>15) &&
diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl
index d5ef3a07..eb2ea7f2 100644
--- a/library/demos/floor.tcl
+++ b/library/demos/floor.tcl
@@ -1354,13 +1354,18 @@ floorDisplay $c 3
# Set up event bindings for canvas:
-$c bind floor1 <1> "floorDisplay $c 1"
-$c bind floor2 <1> "floorDisplay $c 2"
-$c bind floor3 <1> "floorDisplay $c 3"
+$c bind floor1 "floorDisplay $c 1"
+$c bind floor2 "floorDisplay $c 2"
+$c bind floor3 "floorDisplay $c 3"
$c bind room "newRoom $c"
$c bind room {set currentRoom ""}
-bind $c <2> "$c scan mark %x %y"
-bind $c "$c scan dragto %x %y"
+if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
+ bind $c "$c scan mark %x %y"
+ bind $c "$c scan dragto %x %y"
+} else {
+ bind $c "$c scan mark %x %y"
+ bind $c "$c scan dragto %x %y"
+}
bind $c "unset currentRoom"
set currentRoom ""
trace variable currentRoom w "roomChanged $c"
diff --git a/library/demos/fontchoose.tcl b/library/demos/fontchoose.tcl
index 8b34377e..446ed34e 100644
--- a/library/demos/fontchoose.tcl
+++ b/library/demos/fontchoose.tcl
@@ -55,10 +55,6 @@ grid $f.msg $f.vs -sticky news
grid $f.font - -sticky e
grid columnconfigure $f 0 -weight 1
grid rowconfigure $f 0 -weight 1
-bind $w {
- bind %W {}
- grid propagate %W.f 0
-}
## See Code / Dismiss buttons
set btns [addSeeDismiss $w.buttons $w]
@@ -67,3 +63,5 @@ grid $f -sticky news
grid $btns -sticky ew
grid columnconfigure $w 0 -weight 1
grid rowconfigure $w 0 -weight 1
+update idletasks
+grid propagate $f 0
diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl
index 284b5c2e..1cc52c62 100644
--- a/library/demos/goldberg.tcl
+++ b/library/demos/goldberg.tcl
@@ -105,7 +105,7 @@ proc DoDisplay {w} {
$w.c yview moveto .05
pack $w.c -in $w.screen -side top -fill both -expand 1
- bind $w.c <3> [list $w.pause invoke]
+ bind $w.c [list $w.pause invoke]
bind $w.c {
after cancel $animationCallbacks(goldberg)
unset animationCallbacks(goldberg)
@@ -162,7 +162,7 @@ proc DoCtrlFrame {w} {
grid $w.speed -in $w.ctrl -row 99 -sticky ew -pady {0 5}
pack $w.speed.scale -fill both -expand 1
grid $w.about -in $w.ctrl -row 100 -sticky ew
- bind $w.reset <3> {set S(mode) -1} ;# Debugging
+ bind $w.reset {set S(mode) -1} ;# Debugging
## See Code / Dismiss buttons hack!
set btns [addSeeDismiss $w.ctrl.buttons $w]
@@ -342,7 +342,7 @@ proc Draw0 {w} {
set xy {719 119 763 119}
$w.c create line $xy -tag I0 -fill $color -width 5 -arrow last \
-arrowshape {18 18 5}
- $w.c bind I0 <1> Start
+ $w.c bind I0 Start
}
proc Move0 {w {step {}}} {
set step [GetStep 0 $step]
@@ -372,7 +372,7 @@ proc Draw1 {w} {
set xy [box 812 122 9]
$w.c create oval $xy -tag I1 -fill $color2 -outline {}
- $w.c bind I1 <1> Start
+ $w.c bind I1 Start
}
proc Move1 {w {step {}}} {
set step [GetStep 1 $step]
@@ -1620,7 +1620,7 @@ proc Move26 {w {step {}}} {
$w.c delete I24 I26
$w.c create text 430 755 -anchor s -tag I26 \
-text "click to continue" -font {{Times Roman} 24 bold}
- bind $w.c <1> [list Reset $w]
+ bind $w.c [list Reset $w]
return 4
}
@@ -1675,7 +1675,7 @@ proc RotateC {x y Ox Oy beta} {
proc Reset {w} {
global S
DrawAll $w
- bind $w.c <1> {}
+ bind $w.c {}
set S(mode) $::MSTART
set S(active) 0
}
diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl
index 2d7ba035..7af52be2 100644
--- a/library/demos/image2.tcl
+++ b/library/demos/image2.tcl
@@ -95,7 +95,7 @@ listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set"
ttk::scrollbar $w.f.scroll -command "$w.f.list yview"
pack $w.f.list $w.f.scroll -side left -fill y -expand 1
$w.f.list insert 0 earth.gif earthris.gif teapot.ppm
-bind $w.f.list "loadImage $w %x %y"
+bind $w.f.list "loadImage $w %x %y"
catch {image delete image2a}
image create photo image2a
diff --git a/library/demos/items.tcl b/library/demos/items.tcl
index be9214a8..12970461 100644
--- a/library/demos/items.tcl
+++ b/library/demos/items.tcl
@@ -17,7 +17,7 @@ wm iconname $w "Items"
positionWindow $w
set c $w.frame.c
-label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Button-1 drag:\tmoves item under pointer.\n Button-2 drag:\trepositions view.\n Button-3 drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
+label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Left-Button drag:\tmoves item under pointer.\n Middle-Button drag:\trepositions view.\n Right-Button drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -171,14 +171,21 @@ $c create text 28.5c 17.4c -text Scale: -anchor s
# Set up event bindings for canvas:
-$c bind item "itemEnter $c"
-$c bind item "itemLeave $c"
-bind $c <2> "$c scan mark %x %y"
-bind $c "$c scan dragto %x %y"
-bind $c <3> "itemMark $c %x %y"
-bind $c "itemStroke $c %x %y"
+$c bind item "itemEnter $c"
+$c bind item "itemLeave $c"
+if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
+ bind $c "itemMark $c %x %y"
+ bind $c "itemStroke $c %x %y"
+ bind $c "$c scan mark %x %y"
+ bind $c "$c scan dragto %x %y"
+} else {
+ bind $c "$c scan mark %x %y"
+ bind $c "$c scan dragto %x %y"
+ bind $c "itemMark $c %x %y"
+ bind $c "itemStroke $c %x %y"
+}
bind $c <> "itemsUnderArea $c"
-bind $c <1> "itemStartDrag $c %x %y"
+bind $c "itemStartDrag $c %x %y"
bind $c "itemDrag $c %x %y"
# Utility procedures for highlighting the item under the pointer:
@@ -250,14 +257,14 @@ proc itemsUnderArea {c} {
set area [$c find withtag area]
set items ""
foreach i [$c find enclosed $areaX1 $areaY1 $areaX2 $areaY2] {
- if {[lsearch [$c gettags $i] item] != -1} {
+ if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}
puts stdout "Items enclosed by area: $items"
set items ""
foreach i [$c find overlapping $areaX1 $areaY1 $areaX2 $areaY2] {
- if {[lsearch [$c gettags $i] item] != -1} {
+ if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}
diff --git a/library/demos/ixset b/library/demos/ixset
index 13235de3..85664d97 100644
--- a/library/demos/ixset
+++ b/library/demos/ixset
@@ -54,7 +54,7 @@ proc readsettings {} {
global screencyc ; set screencyc 600
set xfd [open "|xset q" r]
- while {[gets $xfd line] > -1} {
+ while {[gets $xfd line] >= 0} {
switch -- [lindex $line 0] {
auto {
set rpt [lindex $line 1]
@@ -197,7 +197,7 @@ proc createwindows {} {
bind . {.buttons.ok flash; .buttons.ok invoke}
bind . {.buttons.quit flash; .buttons.quit invoke}
- bind . <1> {
+ bind . {
if {![string match .buttons* %W]} {
.buttons.apply configure -state normal
.buttons.cancel configure -state normal
diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl
index 3c297206..11b3b5cf 100644
--- a/library/demos/knightstour.tcl
+++ b/library/demos/knightstour.tcl
@@ -21,7 +21,7 @@
# If you let it repeat then it will choose random start positions
# for each new tour.
-package require Tk 8.5
+package require Tk
# Return a list of accessible squares from a given square
proc ValidMoves {square} {
@@ -29,7 +29,7 @@ proc ValidMoves {square} {
foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} {
set col [expr {($square % 8) + [lindex $pair 0]}]
set row [expr {($square / 8) + [lindex $pair 1]}]
- if {$row > -1 && $row < 8 && $col > -1 && $col < 8} {
+ if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} {
lappend moves [expr {$row * 8 + $col}]
}
}
@@ -41,7 +41,7 @@ proc CheckSquare {square} {
variable visited
set moves 0
foreach test [ValidMoves $square] {
- if {[lsearch -exact -integer $visited $test] == -1} {
+ if {[lsearch -exact -integer $visited $test] < 0} {
incr moves
}
}
@@ -55,7 +55,7 @@ proc Next {square} {
set minimum 9
set nextSquare -1
foreach testSquare [ValidMoves $square] {
- if {[lsearch -exact -integer $visited $testSquare] == -1} {
+ if {[lsearch -exact -integer $visited $testSquare] < 0} {
set count [CheckSquare $testSquare]
if {$count < $minimum} {
set minimum $count
@@ -190,7 +190,7 @@ proc CreateGUI {} {
ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg]
ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg]
set square 0
- for {set row 7} {$row != -1} {incr row -1} {
+ for {set row 7} {$row >= 0} {incr row -1} {
for {set col 0} {$col < 8} {incr col} {
if {(($col & 1) ^ ($row & 1))} {
set fill tan3 ; set dfill tan4
@@ -218,7 +218,7 @@ proc CreateGUI {} {
-fill black -activefill "#600000"
}
$c moveto knight {*}[lrange [$c coords [expr {1 + int(rand() * 64)}]] 0 1]
- $c bind knight [namespace code [list DragStart %W %x %y]]
+ $c bind knight [namespace code [list DragStart %W %x %y]]
$c bind knight [namespace code [list DragMotion %W %x %y]]
$c bind knight [namespace code [list DragEnd %W %x %y]]
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl
index a788a654..62991f3e 100644
--- a/library/demos/menu.tcl
+++ b/library/demos/menu.tcl
@@ -63,7 +63,7 @@ if {[tk windowingsystem] eq "aqua"} {
}
foreach i {A B C D E F} {
$m add command -label "Print letter \"$i\"" -underline 14 \
- -accelerator Meta+$i -command "puts $i" -accelerator $modifier+$i
+ -accelerator $modifier+$i -command "puts $i"
bind $w <$modifier-[string tolower $i]> "puts $i"
}
@@ -144,9 +144,24 @@ $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \
set m $w.menu.colors
$w.menu add cascade -label "Colors" -menu $m -underline 1
menu $m -tearoff 1
-foreach i {red orange yellow green blue} {
- $m add command -label $i -background $i -command [list \
- puts "You invoked \"$i\"" ]
+if {[tk windowingsystem] eq "aqua"} {
+ # Aqua ignores the -background and -foreground options, but a compound
+ # button can be used for selecting colors.
+ foreach i {red orange yellow green blue} {
+ image create photo image_$i -height 16 -width 16
+ image_$i put black -to 0 0 16 1
+ image_$i put black -to 0 1 1 16
+ image_$i put black -to 0 15 16 16
+ image_$i put black -to 15 1 16 16
+ image_$i put $i -to 1 1 15 15
+ $m add command -label $i -image image_$i -compound left -command [list \
+ puts "You invoked \"$i\"" ]
+ }
+} else {
+ foreach i {red orange yellow green blue} {
+ $m add command -label $i -background $i -command [list \
+ puts "You invoked \"$i\"" ]
+ }
}
$w configure -menu $w.menu
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl
index 6422c67f..9833e8f8 100644
--- a/library/demos/pendulum.tcl
+++ b/library/demos/pendulum.tcl
@@ -113,7 +113,7 @@ bind $w.c {
after cancel $animationCallbacks(pendulum)
unset animationCallbacks(pendulum)
}
-bind $w.c <1> {
+bind $w.c {
after cancel $animationCallbacks(pendulum)
showPendulum %W at %x %y
}
diff --git a/library/demos/plot.tcl b/library/demos/plot.tcl
index e7f0361b..453b7a66 100644
--- a/library/demos/plot.tcl
+++ b/library/demos/plot.tcl
@@ -55,9 +55,9 @@ foreach point {
$c addtag point withtag $item
}
-$c bind point "$c itemconfig current -fill red"
-$c bind point "$c itemconfig current -fill SkyBlue2"
-$c bind point <1> "plotDown $c %x %y"
+$c bind point "$c itemconfig current -fill red"
+$c bind point "$c itemconfig current -fill SkyBlue2"
+$c bind point "plotDown $c %x %y"
$c bind point "$c dtag selected"
bind $c "plotMove $c %x %y"
diff --git a/library/demos/ruler.tcl b/library/demos/ruler.tcl
index f7bc37b8..0b783707 100644
--- a/library/demos/ruler.tcl
+++ b/library/demos/ruler.tcl
@@ -77,10 +77,10 @@ $c addtag well withtag [$c create rect 13.2c 1c 13.8c 0.5c \
$c addtag well withtag [rulerMkTab $c [winfo pixels $c 13.5c] \
[winfo pixels $c .65c]]
-$c bind well <1> "rulerNewTab $c %x %y"
-$c bind tab <1> "rulerSelectTab $c %x %y"
+$c bind well "rulerNewTab $c %x %y"
+$c bind tab "rulerSelectTab $c %x %y"
bind $c "rulerMoveTab $c %x %y"
-bind $c "rulerReleaseTab $c"
+bind $c "rulerReleaseTab $c"
# rulerNewTab --
# Does all the work of creating a tab stop, including creating the
diff --git a/library/demos/square b/library/demos/square
index 6ce91b82..9f200ba6 100644
--- a/library/demos/square
+++ b/library/demos/square
@@ -18,7 +18,7 @@ square .s
pack .s -expand yes -fill both
wm minsize . 1 1
-bind .s <1> {center %x %y}
+bind .s {center %x %y}
bind .s {center %x %y}
bind .s a animate
focus .s
diff --git a/library/demos/tclIndex b/library/demos/tclIndex
index 86a72e24..cdb2f2c1 100644
--- a/library/demos/tclIndex
+++ b/library/demos/tclIndex
@@ -6,62 +6,62 @@
# element name is the name of a command and the value is
# a script that loads the command.
-set auto_index(arrowSetup) [list source [file join $dir arrow.tcl]]
-set auto_index(arrowMove1) [list source [file join $dir arrow.tcl]]
-set auto_index(arrowMove2) [list source [file join $dir arrow.tcl]]
-set auto_index(arrowMove3) [list source [file join $dir arrow.tcl]]
-set auto_index(textLoadFile) [list source [file join $dir search.tcl]]
-set auto_index(textSearch) [list source [file join $dir search.tcl]]
-set auto_index(textToggle) [list source [file join $dir search.tcl]]
-set auto_index(itemEnter) [list source [file join $dir items.tcl]]
-set auto_index(itemLeave) [list source [file join $dir items.tcl]]
-set auto_index(itemMark) [list source [file join $dir items.tcl]]
-set auto_index(itemStroke) [list source [file join $dir items.tcl]]
-set auto_index(itemsUnderArea) [list source [file join $dir items.tcl]]
-set auto_index(itemStartDrag) [list source [file join $dir items.tcl]]
-set auto_index(itemDrag) [list source [file join $dir items.tcl]]
-set auto_index(butPress) [list source [file join $dir items.tcl]]
-set auto_index(loadDir) [list source [file join $dir image2.tcl]]
-set auto_index(loadImage) [list source [file join $dir image2.tcl]]
-set auto_index(rulerMkTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerNewTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerSelectTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerMoveTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerReleaseTab) [list source [file join $dir ruler.tcl]]
-set auto_index(mkTextConfig) [list source [file join $dir ctext.tcl]]
-set auto_index(textEnter) [list source [file join $dir ctext.tcl]]
-set auto_index(textInsert) [list source [file join $dir ctext.tcl]]
-set auto_index(textPaste) [list source [file join $dir ctext.tcl]]
-set auto_index(textB1Press) [list source [file join $dir ctext.tcl]]
-set auto_index(textB1Move) [list source [file join $dir ctext.tcl]]
-set auto_index(textBs) [list source [file join $dir ctext.tcl]]
-set auto_index(textDel) [list source [file join $dir ctext.tcl]]
-set auto_index(bitmapRow) [list source [file join $dir bitmap.tcl]]
-set auto_index(scrollEnter) [list source [file join $dir cscroll.tcl]]
-set auto_index(scrollLeave) [list source [file join $dir cscroll.tcl]]
-set auto_index(scrollButton) [list source [file join $dir cscroll.tcl]]
-set auto_index(textWindOn) [list source [file join $dir twind.tcl]]
-set auto_index(textWindOff) [list source [file join $dir twind.tcl]]
-set auto_index(textWindPlot) [list source [file join $dir twind.tcl]]
-set auto_index(embPlotDown) [list source [file join $dir twind.tcl]]
-set auto_index(embPlotMove) [list source [file join $dir twind.tcl]]
-set auto_index(textWindDel) [list source [file join $dir twind.tcl]]
-set auto_index(embDefBg) [list source [file join $dir twind.tcl]]
-set auto_index(floorDisplay) [list source [file join $dir floor.tcl]]
-set auto_index(newRoom) [list source [file join $dir floor.tcl]]
-set auto_index(roomChanged) [list source [file join $dir floor.tcl]]
-set auto_index(bg1) [list source [file join $dir floor.tcl]]
-set auto_index(bg2) [list source [file join $dir floor.tcl]]
-set auto_index(bg3) [list source [file join $dir floor.tcl]]
-set auto_index(fg1) [list source [file join $dir floor.tcl]]
-set auto_index(fg2) [list source [file join $dir floor.tcl]]
-set auto_index(fg3) [list source [file join $dir floor.tcl]]
-set auto_index(setWidth) [list source [file join $dir hscale.tcl]]
-set auto_index(plotDown) [list source [file join $dir plot.tcl]]
-set auto_index(plotMove) [list source [file join $dir plot.tcl]]
-set auto_index(puzzleSwitch) [list source [file join $dir puzzle.tcl]]
-set auto_index(setHeight) [list source [file join $dir vscale.tcl]]
-set auto_index(showMessageBox) [list source [file join $dir msgbox.tcl]]
-set auto_index(setColor) [list source [file join $dir clrpick.tcl]]
-set auto_index(setColor_helper) [list source [file join $dir clrpick.tcl]]
-set auto_index(fileDialog) [list source [file join $dir filebox.tcl]]
+set auto_index(arrowSetup) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(arrowMove1) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(arrowMove2) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(arrowMove3) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(textLoadFile) [list source -encoding utf-8 [file join $dir search.tcl]]
+set auto_index(textSearch) [list source -encoding utf-8 [file join $dir search.tcl]]
+set auto_index(textToggle) [list source -encoding utf-8 [file join $dir search.tcl]]
+set auto_index(itemEnter) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemLeave) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemMark) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemStroke) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemsUnderArea) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemStartDrag) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemDrag) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(butPress) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(loadDir) [list source -encoding utf-8 [file join $dir image2.tcl]]
+set auto_index(loadImage) [list source -encoding utf-8 [file join $dir image2.tcl]]
+set auto_index(rulerMkTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerNewTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerSelectTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerMoveTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerReleaseTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(mkTextConfig) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textEnter) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textInsert) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textPaste) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textB1Press) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textB1Move) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textBs) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textDel) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(bitmapRow) [list source -encoding utf-8 [file join $dir bitmap.tcl]]
+set auto_index(scrollEnter) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
+set auto_index(scrollLeave) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
+set auto_index(scrollButton) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
+set auto_index(textWindOn) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(textWindOff) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(textWindPlot) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(embPlotDown) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(embPlotMove) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(textWindDel) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(embDefBg) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(floorDisplay) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(newRoom) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(roomChanged) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(bg1) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(bg2) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(bg3) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(fg1) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(fg2) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(fg3) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(setWidth) [list source -encoding utf-8 [file join $dir hscale.tcl]]
+set auto_index(plotDown) [list source -encoding utf-8 [file join $dir plot.tcl]]
+set auto_index(plotMove) [list source -encoding utf-8 [file join $dir plot.tcl]]
+set auto_index(puzzleSwitch) [list source -encoding utf-8 [file join $dir puzzle.tcl]]
+set auto_index(setHeight) [list source -encoding utf-8 [file join $dir vscale.tcl]]
+set auto_index(showMessageBox) [list source -encoding utf-8 [file join $dir msgbox.tcl]]
+set auto_index(setColor) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
+set auto_index(setColor_helper) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
+set auto_index(fileDialog) [list source -encoding utf-8 [file join $dir filebox.tcl]]
diff --git a/library/demos/tcolor b/library/demos/tcolor
index 6e50c611..0aa133bc 100644
--- a/library/demos/tcolor
+++ b/library/demos/tcolor
@@ -7,7 +7,7 @@ exec wish "$0" ${1+"$@"}
# create colors using either the RGB, HSB, or CYM color spaces
# and apply the color to existing applications.
-package require Tk 8.4
+package require Tk
wm title . "Color Editor"
# Global variables that control the program:
@@ -90,7 +90,7 @@ foreach i {
grid columnconfigure . 0 -weight 1
listbox .names.lb -width 20 -height 12 -yscrollcommand ".names.s set" \
-exportselection false
- bind .names.lb {
+ bind .names.lb {
tc_loadNamedColor [.names.lb get [.names.lb curselection]]
}
scrollbar .names.s -orient vertical -command ".names.lb yview"
diff --git a/library/demos/text.tcl b/library/demos/text.tcl
index d1801d1d..2736b883 100644
--- a/library/demos/text.tcl
+++ b/library/demos/text.tcl
@@ -57,8 +57,9 @@ can do to a text widget:
1. Scrolling. Use the scrollbar to adjust the view in the text window.
-2. Scanning. Press mouse button 2 in the text window and drag up or down.
-This will drag the text at high speed to allow you to scan its contents.
+2. Scanning. Press the middle mouse button in the text window and drag up
+or down. This will drag the text at high speed to allow you to scan its
+contents.
3. Insert text. Press mouse button 1 to set the insertion cursor, then
type text. What you type will be added to the widget.
@@ -77,7 +78,8 @@ text, in which case it will replace the selected text.
6. Copy the selection. To copy the selection into this window, select
what you want to copy (either here or in another application), then
-click button 2 to copy the selection to the point of the mouse cursor.
+click the middle mouse button to copy the selection to the point of the
+mouse cursor.
7. Edit. Text widgets support the standard Motif editing characters
plus many Emacs editing characters. Backspace and Control-h erase the
diff --git a/library/demos/tree.tcl b/library/demos/tree.tcl
index 8decdf26..1cc70f87 100644
--- a/library/demos/tree.tcl
+++ b/library/demos/tree.tcl
@@ -39,6 +39,7 @@ proc populateTree {tree node} {
set path [$tree set $node fullpath]
$tree delete [$tree children $node]
foreach f [lsort -dictionary [glob -nocomplain -dir $path *]] {
+ set f [file normalize $f]
set type [file type $f]
set id [$tree insert $node end -text [file tail $f] \
-values [list $f $type]]
diff --git a/library/demos/twind.tcl b/library/demos/twind.tcl
index 45d1da87..74f11ebf 100644
--- a/library/demos/twind.tcl
+++ b/library/demos/twind.tcl
@@ -265,9 +265,9 @@ proc createPlot {t} {
$c addtag point withtag $item
}
- $c bind point "$c itemconfig current -fill red"
- $c bind point "$c itemconfig current -fill SkyBlue2"
- $c bind point <1> "embPlotDown $c %x %y"
+ $c bind point "$c itemconfig current -fill red"
+ $c bind point "$c itemconfig current -fill SkyBlue2"
+ $c bind point "embPlotDown $c %x %y"
$c bind point "$c dtag selected"
bind $c