diff options
author | dgp <dgp@users.sourceforge.net> | 2020-09-15 16:57:02 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2020-09-15 16:57:02 (GMT) |
commit | 7b0e937f9ff083f35896d0d13cf90d618812de49 (patch) | |
tree | de7f5dad34e664debf6ad3b48e2deafd20741a11 | |
parent | af244231877a2b478b9fb0b0481621e1c12fc561 (diff) | |
parent | c40f0f6cefb57728ba9162a8509918ae31fd2210 (diff) | |
download | tk-7b0e937f9ff083f35896d0d13cf90d618812de49.zip tk-7b0e937f9ff083f35896d0d13cf90d618812de49.tar.gz tk-7b0e937f9ff083f35896d0d13cf90d618812de49.tar.bz2 |
merge 8.6
251 files changed, 9467 insertions, 8615 deletions
diff --git a/.fossil-settings/encoding-glob b/.fossil-settings/encoding-glob index d1fd9fc..d0ad4b9 100644 --- a/.fossil-settings/encoding-glob +++ b/.fossil-settings/encoding-glob @@ -2,4 +2,10 @@ win/buildall.vc.bat win/makefile.vc win/mkd.bat win/rmd.bat +win/rules-ext.vc win/rules.vc +win/targets.vc +win/rc/*.bmp +win/rc/*.cur +win/rc/*.ico +win/rc/*.rc diff --git a/.gitattributes b/.gitattributes index e9a67c8..fe89ab8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,15 +22,19 @@ # Declare files that will always have CRLF line endings on checkout. *.bat eol=crlf +*.rc eol=crlf *.sln eol=crlf *.vc eol=crlf # Denote all files that are truly binary and should not be modified. *.a binary +*.bmp binary +*.cur binary *.dll binary *.exe binary *.gif binary *.gz binary +*.ico binary *.jpg binary *.lib binary *.pdf binary diff --git a/.travis.yml b/.travis.yml index 29a66d8..5b30453 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -sudo: required language: c addons: apt: @@ -12,38 +11,65 @@ addons: - gcc-multilib - tcl-dev - libx11-dev + - xvfb homebrew: packages: - tcl-tk casks: - xquartz - update: true -matrix: +jobs: include: # Testing on Linux with various compilers - name: "Linux/GCC/Shared" os: linux - dist: bionic + dist: focal + services: + - xvfb compiler: gcc env: - BUILD_DIR=unix + script: &x11gui + - make binaries libraries tktest + - make install + - make test - name: "Linux/GCC/Shared/no-xft" os: linux - dist: bionic + dist: focal + services: + - xvfb compiler: gcc env: - BUILD_DIR=unix - CFGOPT="--disable-xft" - - name: "Linux/GCC/Static" + 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: bionic + dist: focal compiler: gcc env: - BUILD_DIR=unix @@ -51,7 +77,7 @@ matrix: # Older versions of GCC... - name: "Linux/GCC 7/Shared" os: linux - dist: bionic + dist: focal compiler: gcc-7 addons: apt: @@ -88,35 +114,35 @@ matrix: # Clang - name: "Linux/Clang/Shared" os: linux - dist: bionic + dist: focal compiler: clang env: - BUILD_DIR=unix - name: "Linux/Clang/Shared/no-xft" os: linux - dist: bionic + dist: focal compiler: clang env: - BUILD_DIR=unix - CFGOPT="--disable-xft" - name: "Linux/Clang/Static" os: linux - dist: bionic + dist: focal compiler: clang env: - CFGOPT="--disable-shared" - BUILD_DIR=unix - name: "Linux/Clang/Debug" os: linux - dist: bionic + dist: focal compiler: clang env: - BUILD_DIR=unix - CFGOPT="--enable-symbols" # Testing on Mac, various styles - - name: "macOS/Clang/Xcode 11.5/Shared" + - name: "macOS/Clang/Xcode 11.7/Shared" os: osx - osx_image: xcode11.5 + 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" @@ -124,27 +150,27 @@ matrix: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: &mactest - make binaries libraries tktest - - name: "macOS/Clang/Xcode 11.5/Static" + - name: "macOS/Clang/Xcode 11.7/Static" os: osx - osx_image: xcode11.5 + osx_image: xcode11.7 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" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 11.5/Debug" + - name: "macOS/Clang/Xcode 11.7/Debug" os: osx - osx_image: xcode11.5 + osx_image: xcode11.7 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" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 11.5/Shared/XQuartz" + - name: "macOS/Clang/Xcode 11.7/Shared/XQuartz" os: osx - osx_image: xcode11.5 + osx_image: xcode11.7 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" @@ -164,6 +190,11 @@ matrix: - name: "macOS/Clang/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" @@ -173,6 +204,11 @@ matrix: - name: "macOS/Clang/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" @@ -195,7 +231,7 @@ matrix: # "make dist" only - name: "Linux: make dist" os: linux - dist: bionic + dist: focal compiler: gcc env: - BUILD_DIR=unix diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3 index cbbc11e..ac8c9bb 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 <tk.h>\fR @@ -19,6 +19,11 @@ Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind o ClientData \fBTk_GetImageMasterData\fR(\fIinterp, name, typePtrPtr\fR) .sp +.VS "TIP 581" +ClientData +\fBTk_GetImageModelData\fR(\fIinterp, name, typePtrPtr\fR) +.VE "TIP 581" +.sp \fBTk_InitImageArgs\fR(\fIinterp, argc, argvPtr\fR) .SH ARGUMENTS .AS "const Tk_ImageType" *typePtrPtr @@ -71,7 +76,7 @@ The fields of this structure will be described in later subsections of this entry. .PP The second major data structure manipulated by an image manager -is called an \fIimage master\fR; it contains overall information +is called an \fIimage model\fR; it contains overall information about a particular image, such as the values of the configuration options specified in an \fBimage create\fR command. There will usually be one of these structures for each @@ -113,8 +118,8 @@ typedef int \fBTk_ImageCreateProc\fR( int \fIobjc\fR, Tcl_Obj *const \fIobjv\fR[], const Tk_ImageType *\fItypePtr\fR, - Tk_ImageMaster \fImaster\fR, - ClientData *\fImasterDataPtr\fR); + Tk_ImageMaster \fImodel\fR, + ClientData *\fImodelDataPtr\fR); .CE The \fIinterp\fR argument is the interpreter in which the \fBimage\fR command was invoked, and \fIname\fR is the name for the new image, @@ -123,15 +128,15 @@ or generated automatically by the \fBimage\fR command. The \fIobjc\fR and \fIobjv\fR arguments describe all the configuration options for the new image (everything after the name argument to \fBimage\fR). -The \fImaster\fR argument is a token that refers to Tk's information +The \fImodel\fR argument is a token that refers to Tk's information about this image; the image manager must return this token to Tk when invoking the \fBTk_ImageChanged\fR procedure. Typically \fIcreateProc\fR will parse \fIobjc\fR and \fIobjv\fR -and create an image master data structure for the new image. +and create an image model data structure for the new image. \fIcreateProc\fR may store an arbitrary one-word value at -*\fImasterDataPtr\fR, which will be passed back to the +*\fImodelDataPtr\fR, which will be passed back to the image manager when other callbacks are invoked. -Typically the value is a pointer to the master data +Typically the value is a pointer to the model data structure for the image. .PP If \fIcreateProc\fR encounters an error, it should leave an error @@ -148,11 +153,11 @@ This procedure must match the following prototype: .CS typedef ClientData \fBTk_ImageGetProc\fR( Tk_Window \fItkwin\fR, - ClientData \fImasterData\fR); + ClientData \fImodelData\fR); .CE The \fItkwin\fR argument identifies the window in which the -image will be used and \fImasterData\fR is the value -returned by \fIcreateProc\fR when the image master was created. +image will be used and \fImodelData\fR is the value +returned by \fIcreateProc\fR when the image model was created. \fIgetProc\fR will usually create a data structure for the new instance, including such things as the resources needed to display the image in the given window. @@ -221,26 +226,30 @@ each of the image's instances. \fIdeleteProc\fR must match the following prototype: .CS typedef void \fBTk_ImageDeleteProc\fR( - ClientData \fImasterData\fR); + ClientData \fImodelData\fR); .CE -The \fImasterData\fR argument will be the same as the value -stored in \fI*masterDataPtr\fR by \fIcreateProc\fR when the +The \fImodelData\fR argument will be the same as the value +stored in \fI*modelDataPtr\fR by \fIcreateProc\fR when the image was created. \fIdeleteProc\fR should release any resources associated with the image. -.SH TK_GETIMAGEMASTERDATA +.SH TK_GETIMAGEMODELDATA .PP The procedure \fBTk_GetImageMasterData\fR may be invoked to retrieve information about an image. For example, an image manager can use this -procedure to locate its image master data for an image. +procedure to locate its image model data for an image. If there exists an image named \fIname\fR in the interpreter given by \fIinterp\fR, then \fI*typePtrPtr\fR is filled in with type information for the image (the \fItypePtr\fR value passed to \fBTk_CreateImageType\fR when the image type was registered) and the return value is the ClientData value returned by the \fIcreateProc\fR when the image was created (this is typically a -pointer to the image master data structure). If no such image exists +pointer to the image model data structure). If no such image exists then NULL is returned and NULL is stored at \fI*typePtrPtr\fR. +.PP +.VS "TIP 581" +\fBTk_GetImageModelData\fR is synonym for \fBTk_GetImageMasterData\fR +.VE "TIP 581" .SH "LEGACY INTERFACE SUPPORT" .PP In Tk 8.2 and earlier, the definition of \fBTk_ImageCreateProc\fR @@ -252,8 +261,8 @@ typedef int \fBTk_ImageCreateProc\fR( int \fIargc\fR, char **\fIargv\fR, Tk_ImageType *\fItypePtr\fR, - Tk_ImageMaster \fImaster\fR, - ClientData *\fImasterDataPtr\fR); + Tk_ImageMaster \fImodel\fR, + ClientData *\fImodelDataPtr\fR); .CE Legacy programs and libraries dating from those days may still contain code that defines extended Tk image types using the old @@ -261,6 +270,10 @@ interface. The Tk header file will still support this legacy interface if the code is compiled with the macro \fBUSE_OLD_IMAGE\fR defined. .PP +.VS "TIP 581" +\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR +.VE "TIP 581" +.PP When the \fBUSE_OLD_IMAGE\fR legacy support is enabled, you may see the routine \fBTk_InitImageArgs\fR in use. This was a migration tool used to create stub-enabled extensions that could be loaded @@ -280,4 +293,4 @@ interfaces. Expect their support to go away in Tk 9. .SH "SEE ALSO" Tk_ImageChanged, Tk_GetImage, Tk_FreeImage, Tk_RedrawImage, Tk_SizeOfImage .SH KEYWORDS -image manager, image type, instance, master +image manager, image type, instance, model diff --git a/doc/GetScroll.3 b/doc/GetScroll.3 index a71986d..2615301 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 f4d2c04..6d8ae91 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 <tk.h>\fR .sp -\fBTk_ImageChanged\fR(\fIimageMaster, x, y, width, height, imageWidth, imageHeight\fR) +\fBTk_ImageChanged\fR(\fImodel, x, y, width, height, imageWidth, imageHeight\fR) .SH ARGUMENTS .AS Tk_ImageMaster imageHeight -.AP Tk_ImageMaster imageMaster in +.AP Tk_ImageMaster model in Token for image, which was passed to image's \fIcreateProc\fR when the image was created. .AP int x in @@ -42,12 +42,16 @@ whenever anything happens that requires the image to be redrawn. As a result of calling \fBTk_ImageChanged\fR, any widgets using the image are notified so that they can redisplay themselves appropriately. -The \fIimageMaster\fR argument identifies the image, and +The \fImodel\fR argument identifies the image, and \fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR specify a rectangular region within the image that needs to be redrawn. \fIimageWidth\fR and \fIimageHeight\fR specify the image's (new) size. .PP +.VS "TIP 581" +\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR +.VE "TIP 581" +.PP An image manager should call \fBTk_ImageChanged\fR during its \fIcreateProc\fR to specify the image's initial size and to force redisplay if there are existing instances for the image. diff --git a/doc/MaintGeom.3 b/doc/MaintGeom.3 index d1c2d1c..a509b0b 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 <tk.h>\fR .sp -\fBTk_MaintainGeometry\fR(\fIslave, master, x, y, width, height\fR) +\fBTk_MaintainGeometry\fR(\fIwindow, container, x, y, width, height\fR) .sp -\fBTk_UnmaintainGeometry\fR(\fIslave, master\fR) +\fBTk_UnmaintainGeometry\fR(\fIwindow, container\fR) .SH ARGUMENTS -.AS Tk_Window master -.AP Tk_Window slave in +.AS Tk_Window container +.AP Tk_Window window in Window whose geometry is to be controlled. -.AP Tk_Window master in -Window relative to which \fIslave\fR's geometry will be controlled. +.AP Tk_Window container in +Window relative to which \fIwindow\fR's geometry will be controlled. .AP int x in -Desired x-coordinate of \fIslave\fR in \fImaster\fR, measured in pixels -from the inside of \fImaster\fR's left border to the outside of -\fIslave\fR's left border. +Desired x-coordinate of \fIwindow\fR in \fIcontainer\fR, measured in pixels +from the inside of \fIcontainer\fR's left border to the outside of +\fIwindow\fR's left border. .AP int y in -Desired y-coordinate of \fIslave\fR in \fImaster\fR, measured in pixels -from the inside of \fImaster\fR's top border to the outside of -\fIslave\fR's top border. +Desired y-coordinate of \fIwindow\fR in \fIcontainer\fR, measured in pixels +from the inside of \fIcontainer\fR's top border to the outside of +\fIwindow\fR's top border. .AP int width in -Desired width for \fIslave\fR, in pixels. +Desired width for \fIwindow\fR, in pixels. .AP int height in -Desired height for \fIslave\fR, in pixels. +Desired height for \fIwindow\fR, in pixels. .BE .SH DESCRIPTION .PP \fBTk_MaintainGeometry\fR and \fBTk_UnmaintainGeometry\fR make it -easier for geometry managers to deal with slaves whose masters are not +easier for geometry managers to deal with windows whose containers are not their parents. -Three problems arise if the master for a slave is not its parent: +Three problems arise if the container for a window is not its parent: .IP [1] -The x- and y-position of the slave must be translated from the -coordinate system of the master to that of the parent before -positioning the slave. +The x- and y-position of the window must be translated from the +coordinate system of the container to that of the parent before +positioning the window. .IP [2] -If the master window, or any of its ancestors up to the slave's -parent, is moved, then the slave must be repositioned within its +If the container window, or any of its ancestors up to the window's +parent, is moved, then the window must be repositioned within its parent in order to maintain the correct position relative to the -master. +container. .IP [3] -If the master or one of its ancestors is mapped or unmapped, then -the slave must be mapped or unmapped to correspond. +If the container or one of its ancestors is mapped or unmapped, then +the window must be mapped or unmapped to correspond. .LP -None of these problems is an issue if the parent and master are -the same. For example, if the master or one of its ancestors -is unmapped, the slave is automatically removed by the screen +None of these problems is an issue if the parent and container are +the same. For example, if the container or one of its ancestors +is unmapped, the window is automatically removed by the screen by X. .PP -\fBTk_MaintainGeometry\fR deals with these problems for slaves -whose masters are not their parents, as well as handling the simpler -case of slaves whose masters are their parents. +\fBTk_MaintainGeometry\fR deals with these problems for windows +whose containers are not their parents, as well as handling the simpler +case of windows whose container are their parents. \fBTk_MaintainGeometry\fR is typically called by a window manager -once it has decided where a slave should be positioned relative -to its master. +once it has decided where a window should be positioned relative +to its container. \fBTk_MaintainGeometry\fR translates the coordinates to the -coordinate system of \fIslave\fR's parent and then moves and -resizes the slave appropriately. +coordinate system of \fIwindow\fR's parent and then moves and +resizes the window appropriately. Furthermore, it remembers the desired position and creates event -handlers to monitor the master and all of its ancestors up -to (but not including) the slave's parent. +handlers to monitor the container and all of its ancestors up +to (but not including) the window's parent. If any of these windows is moved, mapped, or unmapped, -the slave will be adjusted so that it is mapped only when the -master is mapped and its geometry relative to the master +the window will be adjusted so that it is mapped only when the +container is mapped and its geometry relative to the container remains as specified by \fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR. .PP @@ -83,17 +83,17 @@ if it decides that it does not want the window to appear on the screen under any conditions, it calls \fBTk_UnmaintainGeometry\fR. \fBTk_UnmaintainGeometry\fR unmaps the window and cancels any previous calls to \fBTk_MaintainGeometry\fR for the -\fImaster\fR\-\fIslave\fR pair, so that the slave's +\fIcontainer\fR\-\fIwindow\fR pair, so that the window's geometry and mapped state are no longer maintained automatically. \fBTk_UnmaintainGeometry\fR need not be called by a geometry -manager if the slave, the master, or any of the master's ancestors +manager if the window, the container, or any of the container's ancestors is destroyed: Tk will call it automatically. .PP If \fBTk_MaintainGeometry\fR is called repeatedly for the same -\fImaster\fR\-\fIslave\fR pair, the information from the most +\fIcontainer\fR\-\fIwindow\fR pair, the information from the most recent call supersedes any older information. -If \fBTk_UnmaintainGeometry\fR is called for a \fImaster\fR\-\fIslave\fR +If \fBTk_UnmaintainGeometry\fR is called for a \fIcontainer\fR\-\fIwindow\fR pair that is is not currently managed, the call has no effect. .SH KEYWORDS -geometry manager, map, master, parent, position, slave, unmap +geometry manager, map, container, parent, position, window, unmap diff --git a/doc/ManageGeom.3 b/doc/ManageGeom.3 index 520546f..fd2fac9 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 8c191ce..484e479 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 ae6e353..2a37de7 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 diff --git a/doc/canvas.n b/doc/canvas.n index cd9f56c..4641c1c 100644 --- a/doc/canvas.n +++ b/doc/canvas.n @@ -1123,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. diff --git a/doc/colors.n b/doc/colors.n index c1609b9..3747ee8 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,112 +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 +systemLabelColor systemLinkColor -systemSelectedTextBackgroundColor +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 @@ -961,7 +912,6 @@ systemWindowBackgroundColor7 .RE .TP - \fBWindows\fR . On Windows, the following additional system colors are available diff --git a/doc/frame.n b/doc/frame.n index f2fbd96..4800461 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 @@ -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 \window\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 \window\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. +.TP +.VS "TIP 581" +\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 857208e..5ca5ad7 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 3673e98..e1c93c8 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: @@ -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. +.TP +.VS "TIP 581" +\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 9fc2b72..9fb89d0 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 3a092c2..f52ec53 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. +.TP +.VS "TIP 581" +\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 ec678fa..a2c5ae5 100644 --- a/doc/selection.n +++ b/doc/selection.n @@ -150,7 +150,7 @@ A GUI event, for example \fB<<PasteSelection>>\fR, can copy the \fBPRIMARY\fR se .PP On X11, the \fBPRIMARY\fR selection is a system-wide feature of the X server, allowing communication between different processes that are X11 clients. .PP -On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a master interpreter and its unsafe slave interpreters. It is not shared between interpreters in different processes or different threads. Each master interpreter has a separate \fBPRIMARY\fR selection that is shared only with its unsafe slaves. +On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a parent interpreter and its child interpreters. It is not shared between interpreters in different processes or different threads. Each parent interpreter has a separate \fBPRIMARY\fR selection that is shared only with its child interpreters which are not safe interpreters. .PP .SH SECURITY .PP @@ -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 diff --git a/doc/ttk_Geometry.3 b/doc/ttk_Geometry.3 index 09d59e0..0f8a171 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_entry.n b/doc/ttk_entry.n index 0da60d1..4eb67cc 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 diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n index 581cb44..f93cbe3 100644 --- a/doc/ttk_intro.n +++ b/doc/ttk_intro.n @@ -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 ae32a44..efbfe6c 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_style.n b/doc/ttk_style.n index db80d95..0de3311 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 51c0dbd..82a1520 100644 --- a/doc/ttk_widget.n +++ b/doc/ttk_widget.n @@ -93,6 +93,11 @@ Display image above, below, left of, or right of the text, respectively. .IP none 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. @@ -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 ee1d97b..e891dbb 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. @@ -1140,24 +1143,14 @@ declare 10 aqua { int Tk_MacOSXIsAppInFront(void) } declare 11 aqua { - void Tk_MacOSXSetEmbedHandler_( - Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, - Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, - Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, - Tk_MacOSXEmbedGetClipProc *getClipProc, - Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc) + Tk_Window Tk_MacOSXGetTkWindow(void *w) } declare 12 aqua { - void Tk_MacOSXTurnOffMenus_(void) + void *Tk_MacOSXGetCGContextForDrawable(Drawable drawable) } +# Replaces TkMacOSXDrawable declare 13 aqua { - void Tk_MacOSXTkOwnsCursor_(int tkOwnsIt) -} -declare 14 aqua { - void TkMacOSXInitMenus_(Tcl_Interp *interp) -} -declare 15 aqua { - void TkMacOSXInitAppleEvents_(Tcl_Interp *interp) + void *Tk_MacOSXGetNSWindowForDrawable(Drawable drawable) } declare 16 aqua { void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width, diff --git a/generic/tk.h b/generic/tk.h index 3e52eb4..af8e5ca 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -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; /* @@ -1228,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/tkBind.c b/generic/tkBind.c index bdc1f45..979d61e 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -790,7 +790,7 @@ GetButtonNumber( } static Time -CurrentTimeInMilliSecs() +CurrentTimeInMilliSecs(void) { Tcl_Time now; Tcl_GetTime(&now); @@ -942,7 +942,7 @@ ClearList( static PSEntry * FreePatSeqEntry( - PSList *pool, + TCL_UNUSED(PSList *), PSEntry *entry) { PSEntry *next = PSList_Next(entry); @@ -1043,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 { @@ -1120,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; } /* @@ -1158,13 +1158,13 @@ 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; } } - psList = Tcl_GetHashValue(hPtr); + psList = (PSList *)Tcl_GetHashValue(hPtr); PSList_Move(pool, psList); ckfree(psList); DEBUG(countListItems -= 1;) @@ -1375,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; @@ -1451,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); @@ -1510,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); @@ -1577,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); @@ -1670,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); } @@ -1680,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); @@ -1742,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 { @@ -1843,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)); } @@ -1882,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) { @@ -1966,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; /* @@ -2037,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); @@ -2362,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])); @@ -2403,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]); @@ -3468,7 +3468,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;) @@ -3550,7 +3550,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); @@ -3612,7 +3612,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) { @@ -3744,7 +3744,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))); } @@ -3833,7 +3833,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; @@ -3936,7 +3936,7 @@ HandleEventGenerate( } 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)) { @@ -4376,7 +4376,7 @@ 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); } @@ -4636,7 +4636,7 @@ FindSequence( assert(lookupTables); assert(eventString); - psPtr = ckalloc(PATSEQ_MEMSIZE(patsBufSize)); + psPtr = (PatSeq *)ckalloc(PATSEQ_MEMSIZE(patsBufSize)); /* *------------------------------------------------------------------ @@ -4648,7 +4648,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; } @@ -4697,18 +4697,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); @@ -4744,7 +4744,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); @@ -4886,7 +4886,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'; @@ -4918,7 +4918,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; @@ -4933,7 +4933,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]; @@ -5169,7 +5169,7 @@ 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: { @@ -5257,7 +5257,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 7bd9a44..1e4e91f 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/tkCanvWind.c b/generic/tkCanvWind.c index f73546f..4047b0f 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 50a88b4..c63520b 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -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 @@ -4856,7 +4856,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(); diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 2e504eb..703ef41 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; @@ -173,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; @@ -206,7 +206,7 @@ static void ClipboardLostSel( ClientData clientData) /* Pointer to TkDisplay structure. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; dispPtr->clipboardActive = 0; } @@ -359,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; @@ -381,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; @@ -391,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); @@ -423,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 }; @@ -636,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; @@ -700,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 1bc4f8c..193c3d6 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); @@ -1755,7 +1749,7 @@ Tk_WinfoObjCmd( * 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; @@ -1774,7 +1768,7 @@ Tk_WinfoObjCmd( break; } case WIN_VISUALSAVAILABLE: { - XVisualInfo template, *visInfoPtr; + XVisualInfo templ, *visInfoPtr; int count, i; int includeVisualId; Tcl_Obj *strPtr, *resultPtr; @@ -1795,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)); @@ -2094,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)); @@ -2128,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 44af1ea..46338e2 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; } @@ -1166,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; @@ -1192,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; @@ -1289,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; @@ -1500,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); @@ -1530,7 +1528,6 @@ Tk_FreeSavedOptions( *---------------------------------------------------------------------- */ - /* ARGSUSED */ void Tk_FreeConfigOptions( char *recordPtr, /* Record whose fields contain current values @@ -2069,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 @@ -2079,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 e8f5920..095d132 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -67,7 +67,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp, static const Tcl_ChannelType consoleChannelType = { "console", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v4 channel */ + TCL_CHANNEL_VERSION_5, /* v5 channel */ ConsoleClose, /* Close proc. */ ConsoleInput, /* Input proc. */ ConsoleOutput, /* Output proc. */ @@ -228,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. @@ -256,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++; @@ -279,7 +279,7 @@ Tk_InitConsoleChannels( } if (doOut) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -296,7 +296,7 @@ Tk_InitConsoleChannels( } if (doErr) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -378,7 +378,7 @@ Tk_CreateConsoleWindow( * New ConsoleInfo for a new console window. */ - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo)); info->refCount = 0; /* @@ -408,7 +408,7 @@ Tk_CreateConsoleWindow( } } } else { - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo)); info->refCount = 0; } @@ -457,7 +457,7 @@ Tk_CreateConsoleWindow( if (mainWindow) { Tk_DeleteEventHandler(mainWindow, StructureNotifyMask, ConsoleEventProc, info); - if (--info->refCount <= 0) { + if (info->refCount-- <= 1) { ckfree(info); } } @@ -498,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; @@ -559,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. */ } @@ -587,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. */ @@ -639,11 +637,10 @@ Console2Close( *---------------------------------------------------------------------- */ - /* 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. */ { @@ -666,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; } @@ -707,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) { @@ -797,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) { @@ -816,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; } @@ -865,7 +861,7 @@ static void DeleteConsoleInterp( ClientData clientData) { - Tcl_Interp *interp = clientData; + Tcl_Interp *interp = (Tcl_Interp *)clientData; Tcl_DeleteInterp(interp); } @@ -892,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); } } @@ -924,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); } } @@ -939,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". @@ -959,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 64c32cd..87bb218 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 diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 0994a07..456b86d 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -685,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 @@ -701,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; @@ -732,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; } @@ -775,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)); /* @@ -851,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; @@ -892,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) { @@ -925,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)); /* @@ -933,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 */ @@ -971,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) { @@ -1002,7 +1002,7 @@ Tk_DeleteClientMessageHandler( void TkEventInit(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->handlersActive = 0; @@ -1035,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; @@ -1124,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) @@ -1337,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)); /* @@ -1387,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) { @@ -1442,7 +1442,7 @@ Tk_RestrictEvents( * argument. */ { Tk_RestrictProc *prev; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); prev = tsdPtr->restrictProc; @@ -1535,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); @@ -1567,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)) { @@ -1698,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)) { @@ -1799,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"); @@ -1831,7 +1831,7 @@ TkCreateExitHandler( { ExitHandler *exitPtr; - exitPtr = ckalloc(sizeof(ExitHandler)); + exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; Tcl_MutexLock(&exitMutex); @@ -1927,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; @@ -1968,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; @@ -2007,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; @@ -2059,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/tkFont.c b/generic/tkFont.c index 0b858fc..3aed702 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -96,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; @@ -380,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); @@ -473,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", @@ -617,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( @@ -797,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, @@ -843,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) { /* @@ -856,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); @@ -874,7 +874,7 @@ static void TheWorldHasChanged( ClientData clientData) /* Info about application's fonts. */ { - TkFontInfo *fiPtr = clientData; + TkFontInfo *fiPtr = (TkFontInfo *)clientData; /* * On macOS it is catastrophic to recompute all widgets while the @@ -964,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( @@ -986,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; @@ -1025,7 +1025,7 @@ TkDeleteNamedFont( } return TCL_ERROR; } - nfPtr = Tcl_GetHashValue(namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (nfPtr->refCount != 0) { nfPtr->deletePending = 1; } else { @@ -1114,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) { /* @@ -1143,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) { @@ -1166,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); @@ -1299,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) { /* @@ -1326,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++; @@ -1361,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; @@ -1437,8 +1437,7 @@ Tk_FreeFont( if (fontPtr == NULL) { return; } - fontPtr->resourceRefCount--; - if (fontPtr->resourceRefCount > 0) { + if (fontPtr->resourceRefCount-- > 1) { return; } if (fontPtr->namedHashPtr != NULL) { @@ -1447,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); @@ -1455,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); @@ -1533,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--; @@ -1568,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; @@ -2007,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; @@ -3405,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 @@ -3780,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; @@ -4244,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"); } @@ -4297,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 ce7dc8c..1112f81 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 */ }; /* @@ -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 870c1f3..5ecac0e 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,40 @@ 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)) { + ((TkWindow *)window)->maintainerPtr = (TkWindow *)container; + 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 +455,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 +512,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 +547,37 @@ 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)) { + ((TkWindow *)window)->maintainerPtr = NULL; + 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 +589,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 +648,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 +692,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 +703,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 +727,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 6eff3a3..f2aed2c 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; diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 2855637..a1ff46c 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 be15c14..75ce1a9 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); @@ -384,16 +384,17 @@ Tk_GridObjCmd( return GridPropagateCommand(tkwin, interp, objc, objv); case GRID_SIZE: return GridSizeCommand(tkwin, interp, objc, objv); + case GRID_CONTENT: case GRID_SLAVES: - return GridSlavesCommand(tkwin, interp, objc, objv); + return GridContentCommand(tkwin, interp, objc, objv); /* * Sample argument combinations: - * grid columnconfigure <master> <index> -option - * grid columnconfigure <master> <index> -option value -option value - * grid rowconfigure <master> <index> - * grid rowconfigure <master> <index> -option - * grid rowconfigure <master> <index> -option value -option value. + * grid columnconfigure <container> <index> -option + * grid columnconfigure <container> <index> -option value -option value + * grid rowconfigure <container> <index> + * grid rowconfigure <container> <index> -option + * grid rowconfigure <container> <index> -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; + int 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; + int 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,38 @@ 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 + * If the container has no content anymore, then don't do anything at all: + * just leave the container's 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; } - if (masterPtr->masterDataPtr == NULL) { + if (containerPtr->containerDataPtr == NULL) { return; } @@ -1752,128 +1753,128 @@ 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 width, height; /* Slot or content size */ + 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 +1892,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 +1914,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 @@ -1941,13 +1942,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 +1957,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 +1998,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; - - 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; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + int rightEdge = contentPtr->column + contentPtr->numCols - 1; + + 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 +2029,17 @@ ResolveConstraints( } break; case ROW: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - int rightEdge = slavePtr->row + slavePtr->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; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + int rightEdge = contentPtr->row + contentPtr->numRows - 1; + + 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; @@ -2078,7 +2079,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); @@ -2129,16 +2130,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 +2150,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 +2171,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 +2385,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 +2423,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 +2440,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 +2467,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 +2479,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 +2494,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 +2546,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 +2587,8 @@ SetSlaveRow( return TCL_ERROR; } - slavePtr->row = newRow; - slavePtr->numRows = newNumRows; + contentPtr->row = newRow; + contentPtr->numRows = newNumRows; return TCL_OK; } @@ -2603,7 +2604,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 +2614,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 +2630,7 @@ CheckSlotData( return TCL_ERROR; } - if ((checkOnly == CHECK_ONLY) && (masterPtr->masterDataPtr == NULL)) { + if ((checkOnly == CHECK_ONLY) && (containerPtr->containerDataPtr == NULL)) { return TCL_ERROR; } @@ -2639,39 +2640,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 +2682,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 = + 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 +2728,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 +2742,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 +2794,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 +2810,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 +2840,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 +2851,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 +2908,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 +2920,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 +2975,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) + struct Gridder *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 +3070,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 +3087,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 +3116,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)) { @@ -3135,27 +3136,27 @@ ConfigureSlaves( } } - 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 +3177,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 +3190,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 +3199,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 +3220,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 +3232,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 +3243,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 +3266,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 +3279,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 +3287,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 +3301,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 +3357,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 *)TkGetGeomMaster(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); } } @@ -3443,7 +3444,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); @@ -3479,19 +3480,19 @@ ConfigureSlaves( lastColumn += numSkip; match = 0; - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->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) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + + 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 +3506,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 dc4e8e0..763c65b 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; } /* @@ -363,34 +363,34 @@ Tk_ImageObjCmd( 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 +400,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 +415,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 +449,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 +463,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 +474,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 +523,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 +534,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 +551,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 +565,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 +610,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 +669,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 +692,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 +741,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 +754,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 +837,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 +859,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 +895,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 +933,7 @@ Tk_DeleteImage( if (hPtr == NULL) { return; } - DeleteImage(Tcl_GetHashValue(hPtr)); + DeleteImage((ImageModel *)Tcl_GetHashValue(hPtr)); } /* @@ -948,7 +948,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 +956,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 +1004,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 +1045,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 +1053,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 +1071,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 +1081,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 +1118,6 @@ Tk_GetImageMasterData( *---------------------------------------------------------------------- */ -/*ARGSUSED*/ void Tk_SetTSOrigin( Tk_Window tkwin, diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index f4ee407..04027b0 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)); - - 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); + BitmapModel *modelPtr = ckalloc(sizeof(BitmapModel)); + + 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 c6f2dcb..07b4f8b 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 6f084f0..89d4387 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -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; diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index c500050..a40ee7f 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 26b0446..afbf7b0 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, @@ -331,38 +331,38 @@ ImgPhotoCreate( 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 + 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 = 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; @@ -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; @@ -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]))); @@ -821,7 +821,7 @@ ImgPhotoCmd( * Extract the value of the desired pixel and format it as a string. */ - 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,7 +1100,7 @@ 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( @@ -1122,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); @@ -1141,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; @@ -1195,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]))); @@ -1212,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); @@ -1235,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]))); @@ -1249,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) { /* @@ -1259,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); /* @@ -1273,8 +1273,8 @@ ImgPhotoCmd( * Make pixel opaque. */ - TkUnionRectWithRegion(&setBox, masterPtr->validRegion, - masterPtr->validRegion); + TkUnionRectWithRegion(&setBox, modelPtr->validRegion, + modelPtr->validRegion); pixelPtr[3] = 255; } @@ -1283,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; } @@ -1327,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); @@ -1344,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)); @@ -1420,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); @@ -1759,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 @@ -1767,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 @@ -1777,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. */ @@ -1839,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; } @@ -1870,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) { /* @@ -1887,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) { /* @@ -1904,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); @@ -1927,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. */ @@ -1943,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; } @@ -1954,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( @@ -1968,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) { @@ -1981,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); @@ -2008,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; } /* @@ -2036,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); } @@ -2045,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); @@ -2056,7 +2056,7 @@ ImgPhotoConfigureMaster( Tcl_DecrRefCount(oldFormat); } - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); return TCL_OK; @@ -2083,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; @@ -2121,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: @@ -2135,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 = 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); } /* @@ -2187,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 = 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)); } } @@ -2212,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; @@ -2229,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) { @@ -2247,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)) { @@ -2275,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; @@ -2284,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); } /* @@ -2303,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)); } @@ -2316,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)) { @@ -2338,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 @@ -2360,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); } @@ -2659,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. * @@ -2724,7 +2724,7 @@ Tk_PhotoPutBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; + register PhotoModel *modelPtr = (PhotoModel *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -2743,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; @@ -2769,18 +2769,18 @@ Tk_PhotoPutBlock( */ sourceBlock = *blockPtr; memToFree = NULL; - if (sourceBlock.pixelPtr >= masterPtr->pix32 - && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width - * masterPtr->height * 4) { + 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 masterPtr->pix32[] when + * bytes past the end of modelPtr->pix32[] when * - * blockPtr->pixelPtr > (masterPtr->pix32 + - * 4 * masterPtr->width * masterPtr->height - + * blockPtr->pixelPtr > (modelPtr->pix32 + + * 4 * modelPtr->width * modelPtr->height - * sourceBlock.height * sourceBlock.pitch) */ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + @@ -2802,9 +2802,9 @@ Tk_PhotoPutBlock( 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)); @@ -2814,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; } /* @@ -2839,7 +2839,7 @@ Tk_PhotoPutBlock( alphaOffset -= sourceBlock.offset[0]; } if ((greenOffset != 0) || (blueOffset != 0)) { - masterPtr->flags |= COLOR_IMAGE; + modelPtr->flags |= COLOR_IMAGE; } /* @@ -2847,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 @@ -2859,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], @@ -3041,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); } @@ -3051,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); } /* @@ -3076,21 +3076,21 @@ Tk_PhotoPutBlock( * [Patch 1539990] */ - if (!(masterPtr->flags & COMPLEX_ALPHA)) { + if (!(modelPtr->flags & COMPLEX_ALPHA)) { register int x1; for (x1=x ; x1<x+width ; x1++) { register unsigned char newAlpha; - destLinePtr = masterPtr->pix32 + (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 @@ -3098,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); @@ -3162,7 +3162,7 @@ Tk_PhotoPutZoomedBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; + register PhotoModel *modelPtr = (PhotoModel *) handle; register Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -3190,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; @@ -3215,18 +3215,18 @@ Tk_PhotoPutZoomedBlock( */ sourceBlock = *blockPtr; memToFree = NULL; - if (sourceBlock.pixelPtr >= masterPtr->pix32 - && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width - * masterPtr->height * 4) { + 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 masterPtr->pix32[] when + * bytes past the end of modelPtr->pix32[] when * - * blockPtr->pixelPtr > (masterPtr->pix32 + - * 4 * masterPtr->width * masterPtr->height - + * blockPtr->pixelPtr > (modelPtr->pix32 + + * 4 * modelPtr->width * modelPtr->height - * sourceBlock.height * sourceBlock.pitch) */ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + @@ -3247,9 +3247,9 @@ Tk_PhotoPutZoomedBlock( 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)); @@ -3259,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; } /* @@ -3284,7 +3284,7 @@ Tk_PhotoPutZoomedBlock( alphaOffset -= sourceBlock.offset[0]; } if ((greenOffset != 0) || (blueOffset != 0)) { - masterPtr->flags |= COLOR_IMAGE; + modelPtr->flags |= COLOR_IMAGE; } /* @@ -3313,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; @@ -3322,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; @@ -3409,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); } /* @@ -3437,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); @@ -3486,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. * *---------------------------------------------------------------------- @@ -3501,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); } @@ -3524,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 @@ -3548,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++; } } } @@ -3580,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); } @@ -3611,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); } /* @@ -3642,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)); @@ -3660,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; } @@ -3690,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; } /* @@ -3722,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)); @@ -3735,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; } @@ -3765,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; } /* @@ -3793,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 @@ -3803,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)))) { @@ -4041,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; diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h index 36bc6cb..994fa40 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 f6e7ea9..2faf410 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -636,10 +636,10 @@ declare 184 { } # Support for aqua's inability to draw outside [NSView drawRect:] -declare 185 aqua { +declare 185 macosx { void TkpRedrawWidget(Tk_Window tkwin) } -declare 186 aqua { +declare 186 macosx { int TkpWillDrawWidget(Tk_Window tkwin) } @@ -956,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) } @@ -977,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) } @@ -1823,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) } @@ -1844,11 +1851,32 @@ 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) } diff --git a/generic/tkInt.h b/generic/tkInt.h index 6f40078..c1c9f88 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -59,6 +59,21 @@ # 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) @@ -69,6 +84,16 @@ # 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 @@ -338,9 +363,9 @@ 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 ? \ @@ -645,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. */ @@ -840,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; /* @@ -1041,6 +1066,10 @@ void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn)); #include "tkIntDecls.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * Themed widget set init function: */ @@ -1196,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); @@ -1324,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 1344cc6..7057411 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -550,14 +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_TK /* AQUA */ +#ifdef MAC_OSX_TCL /* MACOSX */ /* 185 */ EXTERN void TkpRedrawWidget(Tk_Window tkwin); -#endif /* AQUA */ -#ifdef MAC_OSX_TK /* AQUA */ +#endif /* MACOSX */ +#ifdef MAC_OSX_TCL /* MACOSX */ /* 186 */ EXTERN int TkpWillDrawWidget(Tk_Window tkwin); -#endif /* AQUA */ +#endif /* MACOSX */ typedef struct TkIntStubs { int magic; @@ -775,26 +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_TK)) /* X11 */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ void (*reserved185)(void); -#endif /* X11 */ +#endif /* UNIX */ #if defined(_WIN32) /* WIN */ void (*reserved185)(void); #endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - void (*reserved185)(void); /* Dummy entry for stubs table backwards compatibility */ +#ifdef MAC_OSX_TCL /* MACOSX */ void (*tkpRedrawWidget) (Tk_Window tkwin); /* 185 */ -#endif /* AQUA */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ +#endif /* MACOSX */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ void (*reserved186)(void); -#endif /* X11 */ +#endif /* UNIX */ #if defined(_WIN32) /* WIN */ void (*reserved186)(void); #endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - void (*reserved186)(void); /* Dummy entry for stubs table backwards compatibility */ +#ifdef MAC_OSX_TCL /* MACOSX */ int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 186 */ -#endif /* AQUA */ +#endif /* MACOSX */ } TkIntStubs; extern const TkIntStubs *tkIntStubsPtr; @@ -1167,14 +1165,14 @@ extern const TkIntStubs *tkIntStubsPtr; (tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */ #define TkDrawAngledChars \ (tkIntStubsPtr->tkDrawAngledChars) /* 184 */ -#ifdef MAC_OSX_TK /* AQUA */ +#ifdef MAC_OSX_TCL /* MACOSX */ #define TkpRedrawWidget \ (tkIntStubsPtr->tkpRedrawWidget) /* 185 */ -#endif /* AQUA */ -#ifdef MAC_OSX_TK /* AQUA */ +#endif /* MACOSX */ +#ifdef MAC_OSX_TCL /* MACOSX */ #define TkpWillDrawWidget \ (tkIntStubsPtr->tkpWillDrawWidget) /* 186 */ -#endif /* AQUA */ +#endif /* MACOSX */ #endif /* defined(USE_TK_STUBS) */ @@ -1219,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 8221d7a..2f15ae7 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -199,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 */ @@ -214,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 */ @@ -420,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 */ @@ -657,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 \ @@ -671,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 \ diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index f1b0018..9d4200a 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -713,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 */ @@ -734,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 */ @@ -743,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 */ @@ -761,9 +766,16 @@ EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im, /* Slot 141 is reserved */ /* Slot 142 is reserved */ /* Slot 143 is reserved */ -/* Slot 144 is reserved */ -/* Slot 145 is reserved */ -/* Slot 146 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 */ @@ -774,7 +786,9 @@ EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im, /* Slot 154 is reserved */ /* Slot 155 is reserved */ /* Slot 156 is reserved */ -/* Slot 157 is reserved */ +/* 157 */ +EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, + int i); /* 158 */ EXTERN void TkUnusedStubEntry(void); #endif /* AQUA */ @@ -1051,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 */ @@ -1065,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); @@ -1074,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); @@ -1089,9 +1103,9 @@ typedef struct TkIntXlibStubs { void (*reserved141)(void); void (*reserved142)(void); void (*reserved143)(void); - void (*reserved144)(void); - void (*reserved145)(void); - void (*reserved146)(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); @@ -1102,7 +1116,7 @@ typedef struct TkIntXlibStubs { void (*reserved154)(void); void (*reserved155)(void); void (*reserved156)(void); - void (*reserved157)(void); + KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */ void (*tkUnusedStubEntry) (void); /* 158 */ #endif /* AQUA */ } TkIntXlibStubs; @@ -1606,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 \ @@ -1627,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 */ @@ -1636,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 */ @@ -1652,9 +1669,12 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; /* Slot 141 is reserved */ /* Slot 142 is reserved */ /* Slot 143 is reserved */ -/* Slot 144 is reserved */ -/* Slot 145 is reserved */ -/* Slot 146 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 */ @@ -1665,7 +1685,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; /* Slot 154 is reserved */ /* Slot 155 is reserved */ /* Slot 156 is reserved */ -/* Slot 157 is reserved */ +#define XkbKeycodeToKeysym \ + (tkIntXlibStubsPtr->xkbKeycodeToKeysym) /* 157 */ #define TkUnusedStubEntry \ (tkIntXlibStubsPtr->tkUnusedStubEntry) /* 158 */ #endif /* AQUA */ diff --git a/generic/tkMain.c b/generic/tkMain.c index c6c9835..32006b3 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -40,6 +40,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] */ @@ -50,6 +53,9 @@ typedef struct { int (*tclpIsAtty) (int fd); /* 16 */ } TclIntPlatStubs; extern const TclIntPlatStubs *tclIntPlatStubsPtr; +#ifdef __cplusplus +} +#endif # include "tkWinInt.h" #else # define TCHAR char @@ -417,7 +423,7 @@ StdinProc( 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 f43bbe0..638139a 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 @@ -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; @@ -1982,7 +1982,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 @@ -2416,7 +2416,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 +2697,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) { @@ -2752,7 +2752,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 a0fa7ab..386b204 100644 --- a/generic/tkMenu.h +++ b/generic/tkMenu.h @@ -185,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; @@ -266,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 @@ -354,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 @@ -433,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 @@ -451,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/tkObj.c b/generic/tkObj.c index 559f0e2..716c7e1 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 f20f38f..d01da95 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 @@ -971,7 +971,6 @@ Tk_ConfigureValue( *---------------------------------------------------------------------- */ - /* ARGSUSED */ void Tk_FreeOptions( const Tk_ConfigSpec *specs, /* Describes legal options. */ @@ -983,7 +982,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 +1070,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 +1087,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 +1103,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 +1130,7 @@ GetCachedSpecs( } } } else { - cachedSpecs = Tcl_GetHashValue(entryPtr); + cachedSpecs = (Tk_ConfigSpec *)Tcl_GetHashValue(entryPtr); } return cachedSpecs; @@ -1157,9 +1156,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 948883d..8996f31 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 8aaf805..15fc405 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))) { @@ -407,11 +407,11 @@ Tk_GetOption( { Tk_Uid nameId, classId = NULL; const char *masqName; - register Element *elPtr, *bestPtr; - register int count; + 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 9005d7f..28ae74b 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 *)TkGetGeomMaster(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 ac61ba8..fec9448 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -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} }; @@ -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"); @@ -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); @@ -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: @@ -616,21 +616,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 +666,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 +706,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 +721,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 +749,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 +817,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 +847,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 +865,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 +874,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 +892,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 = 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 +923,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 +951,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 +966,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 = 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 = ckalloc(i); + memset(newPanes, 0, (size_t) 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 +1101,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 +1130,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 +1163,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 +1198,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; } } @@ -1369,15 +1369,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); } } } @@ -1443,7 +1443,7 @@ DisplayPanedWindow( ClientData clientData) /* Information about window. */ { PanedWindow *pwPtr = clientData; - Slave *slavePtr; + Pane *panePtr; Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; int i, sashWidth, sashHeight; @@ -1496,19 +1496,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 +1569,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); } /* @@ -1630,8 +1630,8 @@ PanedWindowReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - Slave *slavePtr = clientData; - PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; + Pane *panePtr = clientData; + PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; if (Tk_IsMapped(pwPtr->tkwin)) { if (!(pwPtr->flags & RESIZE_PENDING)) { @@ -1639,13 +1639,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 +1654,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. */ + Tk_Window tkwin) /* Tk's handle for the pane. */ { - register Slave *slavePtr = clientData; - PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; - - if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin); - } - Unlink(slavePtr); - Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask, - SlaveStructureProc, slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); - slavePtr->tkwin = NULL; - ckfree(slavePtr); + register Pane *panePtr = clientData; + PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; + + if (pwPtr->tkwin != Tk_Parent(panePtr->tkwin)) { + Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin); + } + Unlink(panePtr); + Tk_DeleteEventHandler(panePtr->tkwin, StructureNotifyMask, + PaneStructureProc, panePtr); + Tk_UnmapWindow(panePtr->tkwin); + panePtr->tkwin = NULL; + ckfree(panePtr); ComputeGeometry(pwPtr); } @@ -1704,19 +1704,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; + register Pane *panePtr; + int i, newPaneWidth, newPaneHeight, paneX, paneY; int paneWidth, paneHeight, paneSize, paneMinSize; int doubleBw; int x, y; @@ -1731,13 +1731,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; } @@ -1776,37 +1776,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 +1818,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 +1874,7 @@ ArrangePanes( } paneDynSize -= paneSize; - paneDynMinSize -= slavePtr->minSize; + paneDynMinSize -= panePtr->minSize; stretchAmount = (int) (frac * stretchReserve); if (paneSize + stretchAmount >= paneMinSize) { stretchReserve -= stretchAmount; @@ -1899,9 +1899,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 +1929,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 +1945,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 +2001,7 @@ ArrangePanes( * * Unlink -- * - * Remove a slave from a paned window. + * Remove a pane from a paned window. * * Results: * None. @@ -2014,57 +2014,57 @@ ArrangePanes( static void Unlink( - register Slave *slavePtr) /* Window to unlink. */ + register Pane *panePtr) /* Window to unlink. */ { - register PanedWindow *masterPtr; + register 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 +2076,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 +2085,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 +2125,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 +2138,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 +2148,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 = 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 +2177,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,7 +2195,7 @@ 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; @@ -2221,20 +2221,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 +2243,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 +2258,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 +2324,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; @@ -2535,11 +2535,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 +2556,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 +2608,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 +2618,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 +2627,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 +2647,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 +2658,7 @@ MoveSash( if (diff > 0) { expandPane = sash; reduceFirst = nextSash; - reduceLast = pwPtr->numSlaves; + reduceLast = pwPtr->numPanes; reduceIncr = 1; } else { diff = abs(diff); @@ -2674,14 +2674,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 +2695,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 +2707,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; } } } @@ -2949,9 +2949,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. */ @@ -3101,12 +3101,12 @@ PanedWindowIdentifyCoords( 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 +3117,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 59b8a2b..615eb9e 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 ancestor; - tkwin = slavePtr->inTkwin; + tkwin = 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)) { + 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(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); goto error; } } - if (slavePtr->tkwin == tkwin) { + if (contentPtr->tkwin == tkwin) { 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 *)tkwin; container != NULL; + container = (TkWindow *)TkGetGeomMaster(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(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } } - if (tkwin != Tk_Parent(slavePtr->tkwin)) { - ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; + if (tkwin != Tk_Parent(contentPtr->tkwin)) { + ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; } - if ((slavePtr->masterPtr != NULL) - && (slavePtr->masterPtr->tkwin == tkwin)) { + if ((contentPtr->containerPtr != NULL) + && (contentPtr->containerPtr->tkwin == tkwin)) { /* - * 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 = tkwin; } /* - * 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 db9141c..bad633f 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -83,20 +83,13 @@ EXTERN void Tk_MacOSXSetupTkNotifier(void); /* 10 */ EXTERN int Tk_MacOSXIsAppInFront(void); /* 11 */ -EXTERN void Tk_MacOSXSetEmbedHandler_( - Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, - Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, - Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, - Tk_MacOSXEmbedGetClipProc *getClipProc, - Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); +EXTERN Tk_Window Tk_MacOSXGetTkWindow(void *w); /* 12 */ -EXTERN void Tk_MacOSXTurnOffMenus_(void); +EXTERN void * Tk_MacOSXGetCGContextForDrawable(Drawable drawable); /* 13 */ -EXTERN void Tk_MacOSXTkOwnsCursor_(int tkOwnsIt); -/* 14 */ -EXTERN void TkMacOSXInitMenus_(Tcl_Interp *interp); -/* 15 */ -EXTERN void TkMacOSXInitAppleEvents_(Tcl_Interp *interp); +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); @@ -126,11 +119,11 @@ typedef struct TkPlatStubs { void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */ void (*tk_MacOSXSetupTkNotifier) (void); /* 9 */ int (*tk_MacOSXIsAppInFront) (void); /* 10 */ - void (*tk_MacOSXSetEmbedHandler_) (Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacOSXEmbedGetClipProc *getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); /* 11 */ - void (*tk_MacOSXTurnOffMenus_) (void); /* 12 */ - void (*tk_MacOSXTkOwnsCursor_) (int tkOwnsIt); /* 13 */ - void (*tkMacOSXInitMenus_) (Tcl_Interp *interp); /* 14 */ - void (*tkMacOSXInitAppleEvents_) (Tcl_Interp *interp); /* 15 */ + 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; @@ -184,16 +177,14 @@ extern const TkPlatStubs *tkPlatStubsPtr; (tkPlatStubsPtr->tk_MacOSXSetupTkNotifier) /* 9 */ #define Tk_MacOSXIsAppInFront \ (tkPlatStubsPtr->tk_MacOSXIsAppInFront) /* 10 */ -#define Tk_MacOSXSetEmbedHandler_ \ - (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler_) /* 11 */ -#define Tk_MacOSXTurnOffMenus_ \ - (tkPlatStubsPtr->tk_MacOSXTurnOffMenus_) /* 12 */ -#define Tk_MacOSXTkOwnsCursor_ \ - (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor_) /* 13 */ -#define TkMacOSXInitMenus_ \ - (tkPlatStubsPtr->tkMacOSXInitMenus_) /* 14 */ -#define TkMacOSXInitAppleEvents_ \ - (tkPlatStubsPtr->tkMacOSXInitAppleEvents_) /* 15 */ +#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 */ @@ -202,13 +193,6 @@ extern const TkPlatStubs *tkPlatStubsPtr; /* !END!: Do not edit above this line. */ -#undef Tk_MacOSXSetEmbedHandler_ -#undef Tk_MacOSXTurnOffMenus_ -#undef Tk_MacOSXTkOwnsCursor_ -#undef TkMacOSXInitMenus_ -#undef TkMacOSXInitAppleEvents_ -#undef TkGenWMConfigureEvent_ - #ifdef __cplusplus } #endif @@ -216,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 c17367a..cc67401 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 diff --git a/generic/tkScale.c b/generic/tkScale.c index 5957b00..825f661 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/tkSelect.c b/generic/tkSelect.c index ef16ff5..9584be4 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; } @@ -1411,7 +1410,7 @@ HandleTclCommand( 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'; } @@ -1470,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) { @@ -1483,7 +1482,7 @@ TkSelDefaultSelection( } if (target == dispPtr->targetsAtom) { - register TkSelHandler *selPtr; + TkSelHandler *selPtr; int length; Tcl_DString ds; @@ -1509,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; @@ -1566,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 4abc637..e637f8e 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 */ @@ -55,14 +56,30 @@ MODULE_SCOPE const TkStubs tkStubs; #define TkWmCleanup_ TkWmCleanup #define TkSendCleanup_ TkSendCleanup #define TkpTestsendCmd_ TkpTestsendCmd -#define Tk_MacOSXSetEmbedHandler_ Tk_MacOSXSetEmbedHandler -#define Tk_MacOSXTurnOffMenus_ Tk_MacOSXTurnOffMenus -#define Tk_MacOSXTkOwnsCursor_ Tk_MacOSXTkOwnsCursor -#define TkMacOSXInitMenus_ TkMacOSXInitMenus -#define TkMacOSXInitAppleEvents_ TkMacOSXInitAppleEvents #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 int @@ -485,26 +502,24 @@ static const TkIntStubs tkIntStubs = { TkUnderlineAngledTextLayout, /* 182 */ TkIntersectAngledTextLayout, /* 183 */ TkDrawAngledChars, /* 184 */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ 0, /* 185 */ -#endif /* X11 */ +#endif /* UNIX */ #if defined(_WIN32) /* WIN */ 0, /* 185 */ #endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - 0, /* 185 */ /* Dummy entry for stubs table backwards compatibility */ +#ifdef MAC_OSX_TCL /* MACOSX */ TkpRedrawWidget, /* 185 */ -#endif /* AQUA */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ +#endif /* MACOSX */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ 0, /* 186 */ -#endif /* X11 */ +#endif /* UNIX */ #if defined(_WIN32) /* WIN */ 0, /* 186 */ #endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - 0, /* 186 */ /* Dummy entry for stubs table backwards compatibility */ +#ifdef MAC_OSX_TCL /* MACOSX */ TkpWillDrawWidget, /* 186 */ -#endif /* AQUA */ +#endif /* MACOSX */ }; static const TkIntPlatStubs tkIntPlatStubs = { @@ -587,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 */ @@ -939,7 +954,7 @@ static const TkIntXlibStubs tkIntXlibStubs = { 0, /* 103 */ 0, /* 104 */ 0, /* 105 */ - 0, /* 106 */ + XSetClipRectangles, /* 106 */ XFlush, /* 107 */ XGrabServer, /* 108 */ XUngrabServer, /* 109 */ @@ -953,7 +968,7 @@ static const TkIntXlibStubs tkIntXlibStubs = { 0, /* 117 */ 0, /* 118 */ 0, /* 119 */ - 0, /* 120 */ + XOffsetRegion, /* 120 */ 0, /* 121 */ 0, /* 122 */ 0, /* 123 */ @@ -962,7 +977,7 @@ static const TkIntXlibStubs tkIntXlibStubs = { 0, /* 126 */ 0, /* 127 */ 0, /* 128 */ - 0, /* 129 */ + XLowerWindow, /* 129 */ 0, /* 130 */ 0, /* 131 */ 0, /* 132 */ @@ -977,9 +992,9 @@ static const TkIntXlibStubs tkIntXlibStubs = { 0, /* 141 */ 0, /* 142 */ 0, /* 143 */ - 0, /* 144 */ - 0, /* 145 */ - 0, /* 146 */ + XDestroyIC, /* 144 */ + XCreatePixmapCursor, /* 145 */ + XCreateGlyphCursor, /* 146 */ 0, /* 147 */ 0, /* 148 */ 0, /* 149 */ @@ -990,7 +1005,7 @@ static const TkIntXlibStubs tkIntXlibStubs = { 0, /* 154 */ 0, /* 155 */ 0, /* 156 */ - 0, /* 157 */ + XkbKeycodeToKeysym, /* 157 */ TkUnusedStubEntry, /* 158 */ #endif /* AQUA */ }; @@ -1018,11 +1033,11 @@ static const TkPlatStubs tkPlatStubs = { TkMacOSXGetRootControl, /* 8 */ Tk_MacOSXSetupTkNotifier, /* 9 */ Tk_MacOSXIsAppInFront, /* 10 */ - Tk_MacOSXSetEmbedHandler_, /* 11 */ - Tk_MacOSXTurnOffMenus_, /* 12 */ - Tk_MacOSXTkOwnsCursor_, /* 13 */ - TkMacOSXInitMenus_, /* 14 */ - TkMacOSXInitAppleEvents_, /* 15 */ + Tk_MacOSXGetTkWindow, /* 11 */ + Tk_MacOSXGetCGContextForDrawable, /* 12 */ + Tk_MacOSXGetNSWindowForDrawable, /* 13 */ + 0, /* 14 */ + 0, /* 15 */ TkGenWMConfigureEvent_, /* 16 */ #endif /* AQUA */ }; @@ -1311,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 9cf95d0..1289f14 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,7 +604,7 @@ 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; @@ -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,7 +686,7 @@ 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; @@ -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 c22e649..3c17407 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -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,7 +68,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. */ Bool displayFailed; /* macOS display attempted out of drawRect. */ @@ -81,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, @@ -1062,14 +1062,14 @@ 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, @@ -1080,10 +1080,10 @@ TestobjconfigObjCmd( } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(SlaveRecord)); + recordPtr = 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; @@ -1386,12 +1386,12 @@ ImageCreate( 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 + 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; @@ -1410,8 +1410,8 @@ ImageCreate( varName = Tcl_GetString(objv[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; @@ -1421,7 +1421,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; } @@ -1450,7 +1450,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) { @@ -1471,7 +1471,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]), @@ -1503,9 +1503,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; @@ -1515,7 +1515,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); @@ -1580,9 +1580,9 @@ ImageDisplay( */ sprintf(instPtr->buffer, "%s display %d %d %d %d", - instPtr->masterPtr->imageName, imageX, imageY, width, height); + instPtr->modelPtr->imageName, imageX, imageY, width, height); } - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, + Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, instPtr->buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); instPtr->displayFailed = False; @@ -1592,18 +1592,18 @@ ImageDisplay( * 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->masterPtr->imageName, imageX, imageY, width, height); + 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, @@ -1640,8 +1640,8 @@ ImageFree( 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); @@ -1667,11 +1667,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); diff --git a/generic/tkText.c b/generic/tkText.c index 2ddfea1..5996688 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,7 +699,7 @@ 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; @@ -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; @@ -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; @@ -5518,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)) { @@ -5592,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) { @@ -5673,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; @@ -5746,8 +5740,7 @@ SearchCore( * it has dual purpose. */ - pattern = Tcl_GetString(patObj); - matchLength = patObj->length; + pattern = Tcl_GetStringFromObj(patObj, &matchLength); nl = strchr(pattern, '\n'); /* @@ -5916,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--; @@ -5945,7 +5938,7 @@ SearchCore( */ p = startOfLine + lastOffset - firstNewLine - 1; - if (strncmp(p, pattern, (unsigned) firstNewLine + 1)) { + if (strncmp(p, pattern, firstNewLine + 1)) { /* * No match. */ @@ -6011,7 +6004,7 @@ SearchCore( * result. */ - if (strncmp(p,pattern,(size_t)matchLength)) { + if (strncmp(p, pattern, matchLength)) { p = NULL; } break; @@ -6259,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; } @@ -6329,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. @@ -6434,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, @@ -6695,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. */ @@ -6730,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). */ @@ -6789,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. */ { @@ -6848,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. */ @@ -6867,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 a8a17da..9a9495a 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/tkTextDisp.c b/generic/tkTextDisp.c index 6d680f6..0eae4a9 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -444,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; @@ -658,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; @@ -717,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 @@ -773,7 +773,7 @@ GetStyle( * information is wanted. */ { TkTextTag **tagPtrs; - register TkTextTag *tagPtr; + TkTextTag *tagPtr; StyleValues styleValues; TextStyle *stylePtr; Tcl_HashEntry *hPtr; @@ -1002,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; } @@ -1011,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; @@ -1069,7 +1069,7 @@ GetStyle( static void FreeStyle( TkText *textPtr, /* Information about overall widget. */ - register TextStyle *stylePtr) + TextStyle *stylePtr) /* Information about style to free. */ { stylePtr->refCount--; @@ -1132,7 +1132,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. */ @@ -1186,7 +1186,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; @@ -1435,7 +1435,7 @@ LayoutDLine( continue; } if (chunkPtr == NULL) { - chunkPtr = ckalloc(sizeof(TkTextDispChunk)); + chunkPtr = (TkTextDispChunk *)ckalloc(sizeof(TkTextDispChunk)); chunkPtr->nextPtr = NULL; chunkPtr->clientData = NULL; } @@ -1833,8 +1833,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; @@ -1871,7 +1871,7 @@ UpdateDisplayInfo( y = dInfoPtr->y - dInfoPtr->newTopPixelOffset; maxY = dInfoPtr->maxY; while (1) { - register DLine *newPtr; + DLine *newPtr; if (index.linePtr == lastLinePtr) { break; @@ -1982,7 +1982,7 @@ UpdateDisplayInfo( */ if (index.linePtr != prevPtr->index.linePtr) { - register DLine *nextPtr; + DLine *nextPtr; nextPtr = dlPtr; while ((nextPtr != NULL) @@ -2351,7 +2351,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). */ @@ -2364,8 +2364,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++; @@ -2384,7 +2384,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) { @@ -2432,14 +2432,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; @@ -2611,7 +2611,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 @@ -3007,7 +3007,7 @@ static void AsyncUpdateLineMetrics( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; int lineNum; @@ -4164,9 +4164,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; @@ -4254,7 +4254,7 @@ DisplayText( */ for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL; dlPtr = dlPtr->nextPtr) { - register DLine *dlPtr2; + DLine *dlPtr2; int offset, height, y, oldY; TkRegion damageRgn; @@ -4552,7 +4552,7 @@ DisplayText( * proc of embedded windows only. */ #endif - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL); chunkPtr = chunkPtr->nextPtr) { @@ -4754,7 +4754,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; @@ -5012,7 +5012,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; @@ -5352,7 +5352,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; @@ -6180,7 +6180,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", @@ -6358,7 +6358,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 @@ -6844,7 +6844,7 @@ static void AsyncUpdateYScrollbar( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; textPtr->dInfoPtr->scrollbarTimer = NULL; @@ -6879,7 +6879,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. */ { @@ -7049,7 +7049,7 @@ TkTextPixelIndex( * border of the widget). */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr, *validDlPtr; + DLine *dlPtr, *validDlPtr; int nearby = 0; /* @@ -7151,7 +7151,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 @@ -7279,7 +7279,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) { @@ -7349,7 +7349,7 @@ TkTextIndexBbox( { TextDInfo *dInfoPtr = textPtr->dInfoPtr; DLine *dlPtr; - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; int byteCount; /* @@ -7541,14 +7541,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 @@ -7569,8 +7569,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*/; @@ -7599,8 +7599,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 @@ -7614,7 +7614,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. */ @@ -7765,9 +7765,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; @@ -7878,7 +7878,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) { @@ -7953,21 +7953,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; @@ -8115,10 +8115,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 @@ -8204,13 +8204,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 @@ -8221,7 +8221,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; @@ -8384,7 +8384,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; @@ -8405,7 +8405,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); @@ -8676,7 +8676,7 @@ MeasureChars( int curX, width, ch; const char *special, *end, *start; - ch = 0; /* lint. */ + ch = 0; curX = startX; start = source + rangeStart; end = start + rangeLength; diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index c9fc20f..a0e7089 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -22,13 +22,13 @@ 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 */ }; /* @@ -443,7 +443,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 +459,7 @@ EmbWinConfigure( } if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin) || (ewPtr->body.ew.tkwin == textPtr->tkwin)) { - goto badMaster; + goto badContainer; } if (client == NULL) { @@ -594,9 +594,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,7 +611,7 @@ 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. */ @@ -936,12 +936,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), diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 8ec18e2..5e5e836 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -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. @@ -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. */ diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c index 706a871..a7d4a9a 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 <tk.h> +#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 43fd95f..f4ef7bc 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -4,8 +4,7 @@ * label, button, checkbutton, radiobutton, and menubutton widgets. */ -#include <string.h> -#include <tk.h> +#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}, @@ -820,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) @@ -855,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 0ae2372..e7f885f 100644 --- a/generic/ttk/ttkCache.c +++ b/generic/ttk/ttkCache.c @@ -29,7 +29,7 @@ */ #include <stdio.h> /* for sprintf */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" struct Ttk_ResourceCache_ { diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 299b568..733a391 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -4,7 +4,7 @@ * "clam" theme; inspired by the XFCE family of Gnome themes. */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" /* @@ -959,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 4b245c7..8436aec 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -457,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 */ diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 5c95dba..c4469dc 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -5,8 +5,7 @@ * */ -#include <tcl.h> -#include <tk.h> +#include "tkInt.h" #include <string.h> #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index b87e861..1d8137b 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -2093,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 8a15e5b..b8b3477 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -4,8 +4,7 @@ * ttk::frame and ttk::labelframe widgets. */ -#include <tk.h> - +#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 <<NOTE-SIZE>> */ -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) * * <<NOTE-LABELREMOVED>>: * 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 <<NOTE-LABELREMOVED>>) */ 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 8047e3f..6aabd61 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 e403e2d..5c2a55f 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -11,7 +11,7 @@ */ #include <string.h> -#include <tk.h> +#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 01a393a..f1b6e26 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -5,7 +5,7 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -275,7 +275,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/ttkLayout.c b/generic/ttk/ttkLayout.c index 2512c4b..fdbeacf 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -810,7 +810,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 c396f63..8cad58c 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -5,65 +5,65 @@ */ #include <string.h> -#include <tk.h> +#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 <Configure> 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 <<NOTE-LOSTSLAVE>>. + * +++ Content window removal <<NOTE-LOSTCONTENT>>. * - * 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 <Destroy> events. + * register an event handler on the content window to track <Destroy> 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 +88,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 +96,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) { @@ -136,8 +136,8 @@ 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) @@ -151,56 +151,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 <<NOTE-LOSTSLAVE>>). +/* ++ ContentLostEventHandler -- + * Notifies manager when a content window is destroyed + * (see <<NOTE-LOSTCONTENT>>). */ -static const unsigned SlaveEventMask = StructureNotifyMask; -static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) +static void ContentLostEventHandler(void *clientData, XEvent *eventPtr) { - Ttk_Slave *slave = (Ttk_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 = (Ttk_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 +207,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 = (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 +227,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 +242,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 = (Ttk_Slave **)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 +288,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 +311,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 = (Ttk_Manager *)clientData; - int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); - int reqWidth = Tk_ReqWidth(slaveWindow); - int reqHeight= Tk_ReqHeight(slaveWindow); + 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 = (Ttk_Manager *)clientData; - int index = Ttk_SlaveIndex(mgr, slaveWindow); + 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 +405,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 +485,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 +541,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 07fcea1..d487dea 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 39ed6aa..bd7c7ba 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -5,7 +5,7 @@ #include <string.h> #include <ctype.h> #include <stdio.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -57,20 +57,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 +102,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 +191,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 +213,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 +221,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 +234,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 +261,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 +294,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 *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); int i = 0; if (index == nb->notebook.currentIndex) { @@ -306,8 +306,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 +316,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; } @@ -357,8 +357,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 +382,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 +399,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 +465,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 +474,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 +489,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 +517,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 +571,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 +606,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 +624,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 +645,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 +660,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 +684,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 +695,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 +717,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 +731,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 +749,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 +772,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 +793,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 +817,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 +848,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 +889,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 +899,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 +928,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 +939,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 +1002,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 +1014,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 +1026,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 +1039,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 +1059,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 +1079,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 +1114,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 +1127,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 +1147,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 +1173,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 +1184,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 +1198,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 +1213,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 +1263,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 +1283,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 +1292,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 +1316,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 +1344,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 +1356,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 +1367,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 adc2aef..fa0d5c8 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -7,7 +7,7 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkManager.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -29,7 +29,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 +78,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 +108,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 +141,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 +149,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 +189,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 +209,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 +230,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 +239,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 +278,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 +305,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 +317,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 +341,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 +365,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 +375,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 +397,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 +483,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 +497,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 +509,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 +520,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 +546,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 +584,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 +606,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 +624,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 +694,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 +702,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 +721,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 +742,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 +772,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 +782,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 +809,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 +820,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 +836,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 +847,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 +927,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 eb776ba..ae945ae 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -5,8 +5,7 @@ */ #include <math.h> -#include <tk.h> - +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -48,14 +47,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 }, diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 8348fb5..4d05f97 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -4,9 +4,9 @@ * ttk::scale widget. */ -#include <tk.h> #include <string.h> #include <stdio.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -63,7 +63,7 @@ static Tk_OptionSpec ScaleOptionSpecs[] = {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Scale,scale.orientObj), Tk_Offset(Scale,scale.orient), 0, - (ClientData)ttkOrientStrings, STYLE_CHANGED }, + (void *)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0}, diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 04430ee..5ffd671 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -4,8 +4,7 @@ * ttk::scrollbar widget. */ -#include <tk.h> - +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -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) @@ -317,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 b52e6f4..a0ae596 100644 --- a/generic/ttk/ttkSeparator.c +++ b/generic/ttk/ttkSeparator.c @@ -4,8 +4,7 @@ * ttk::separator and ttk::sizegrip widgets. */ -#include <tk.h> - +#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 b5bf6f9..bd2a8c7 100644 --- a/generic/ttk/ttkSquare.c +++ b/generic/ttk/ttkSquare.c @@ -3,7 +3,7 @@ * Minimal sample ttk widget. */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index 5b62f3c..d37f7f6 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -6,8 +6,7 @@ */ #include <string.h> - -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" /* diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c index 87b33dc..0039585 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 5675416..faeabe8 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" diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index 07aee76..fc026cb 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -5,8 +5,7 @@ */ #include <string.h> /* for memset() */ -#include <tcl.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 7bde80e..00cb50b 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -37,7 +37,7 @@ typedef struct Ttk_Style_ static Style *NewStyle(void) { - Style *stylePtr = ckalloc(sizeof(Style)); + Style *stylePtr = (Style *)ckalloc(sizeof(Style)); stylePtr->styleName = NULL; stylePtr->parentStyle = NULL; @@ -56,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); } @@ -64,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); } @@ -85,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; @@ -103,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; @@ -176,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; @@ -204,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; @@ -218,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; @@ -234,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; @@ -291,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_ { @@ -307,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; @@ -324,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); @@ -341,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); } @@ -352,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); } @@ -384,7 +389,7 @@ typedef struct CleanupStruct { } Cleanup; /*------------------------------------------------------------------------ - * +++ Master style package data structure. + * +++ Style package data structure. */ typedef struct { @@ -398,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; @@ -422,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); } @@ -464,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); } /* @@ -479,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; @@ -503,7 +510,7 @@ 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) { @@ -583,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; @@ -596,7 +603,7 @@ static Ttk_Theme LookupTheme( return NULL; } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Theme)Tcl_GetHashValue(entryPtr); } /* @@ -704,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 -- @@ -755,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); } /* @@ -766,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); } /* @@ -782,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) @@ -799,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; @@ -820,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[]) { @@ -895,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); @@ -984,7 +991,7 @@ int InitializeElementRecord( int i; for (i=0; i<nResources; ++i, ++elementOption) { Tcl_Obj **dest = (Tcl_Obj **) - (elementRecord + elementOption->offset); + ((char *)elementRecord + elementOption->offset); const char *optionName = elementOption->optionName; Tcl_Obj *dynamicSetting = Ttk_StyleMap(style, optionName, state); Tcl_Obj *widgetValue = 0; @@ -992,7 +999,7 @@ int InitializeElementRecord( if (optionMap[i]) { widgetValue = *(Tcl_Obj **) - (widgetRecord + optionMap[i]->objOffset); + ((char *)widgetRecord + optionMap[i]->objOffset); } if (widgetValue) { @@ -1134,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); } @@ -1154,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); @@ -1171,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; @@ -1240,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; @@ -1295,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; @@ -1337,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; @@ -1349,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); @@ -1373,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 }; @@ -1435,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); } @@ -1448,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; @@ -1479,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; @@ -1502,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); @@ -1514,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) { @@ -1530,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; @@ -1568,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; @@ -1606,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) { @@ -1663,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 */ @@ -1706,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 919f25a..d086c02 100644 --- a/generic/ttk/ttkTrace.c +++ b/generic/ttk/ttkTrace.c @@ -7,7 +7,7 @@ * from other errors (which are not). */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -53,7 +53,7 @@ VarTraceProc( */ if (tracePtr->interp == NULL) { Tcl_DecrRefCount(tracePtr->varnameObj); - ckfree((ClientData)tracePtr); + ckfree(tracePtr); return NULL; } Tcl_TraceVar2(interp, name, NULL, @@ -98,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); @@ -139,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; } } @@ -154,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 396b073..fa2a7e0 100644 --- a/generic/ttk/ttkTrack.c +++ b/generic/ttk/ttkTrack.c @@ -23,7 +23,7 @@ * TODO: Handle "chords" properly (e.g., <B1-ButtonPress-2>) */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 358e409..0a156a5 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -1779,7 +1779,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; <<NOTE-ANCHOR>> */ + displayItem.anchorObj = tv->tree.column0.anchorObj; DisplayLayout(tv->tree.itemLayout, &displayItem, state, parcel, d); x += colwidth; } @@ -3320,8 +3320,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/library/clrpick.tcl b/library/clrpick.tcl index 600be16..e408d03 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) <ButtonPress-1> \ + $sel bind $data($c,index) <Button-1> \ [list tk::dialog::color::StartMove $w $sel $c %x $data(selPad) 1] $sel bind $data($c,index) <B1-Motion> \ [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 <ButtonPress-1> \ + bind $col <Button-1> \ [list tk::dialog::color::StartMove $w $sel $c %x $data(colorPad)] bind $col <B1-Motion> \ [list tk::dialog::color::MoveSelector $w $sel $c %x $data(colorPad)] bind $col <ButtonRelease-1> \ [list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(colorPad)] - $sel bind $data($c,clickRegion) <ButtonPress-1> \ + $sel bind $data($c,clickRegion) <Button-1> \ [list tk::dialog::color::StartMove $w $sel $c %x $data(selPad)] $sel bind $data($c,clickRegion) <B1-Motion> \ [list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)] diff --git a/library/console.tcl b/library/console.tcl index 6527607..4e2b9d0 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 } diff --git a/library/demos/dialog1.tcl b/library/demos/dialog1.tcl index 976e955..66d8c9a 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/entry3.tcl b/library/demos/entry3.tcl index d4435c6..acde1b3 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/items.tcl b/library/demos/items.tcl index be9214a..c3e14c1 100644 --- a/library/demos/items.tcl +++ b/library/demos/items.tcl @@ -250,14 +250,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 13235de..7cc35aa 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] diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl index 3c29720..11b3b5c 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 <ButtonPress-1> [namespace code [list DragStart %W %x %y]] + $c bind knight <Button-1> [namespace code [list DragStart %W %x %y]] $c bind knight <Motion> [namespace code [list DragMotion %W %x %y]] $c bind knight <ButtonRelease-1> [namespace code [list DragEnd %W %x %y]] diff --git a/library/demos/tcolor b/library/demos/tcolor index 6e50c61..d8067cc 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: diff --git a/library/fontchooser.tcl b/library/fontchooser.tcl index 3e2b6df..a9bd706 100644 --- a/library/fontchooser.tcl +++ b/library/fontchooser.tcl @@ -121,7 +121,7 @@ proc ::tk::fontchooser::Configure {args} { if {[string trim $S(-title)] eq ""} { set S(-title) [::msgcat::mc "Font"] } - if {[winfo exists $S(W)] && [lsearch $args -font] != -1} { + if {[winfo exists $S(W)] && ("-font" in $args)} { Init $S(-font) event generate $S(-parent) <<TkFontchooserFontChanged>> } @@ -384,7 +384,7 @@ proc ::tk::fontchooser::Tracer {var1 var2 op} { $S(W).l${var}s selection clear 0 end set n [lsearch -exact $S(${var}s,lcase) $value] $S(W).l${var}s selection set $n - if {$n != -1} { + if {$n >= 0} { set S($var) [lindex $S(${var}s) $n] $S(W).e$var icursor end $S(W).e$var selection clear diff --git a/library/iconlist.tcl b/library/iconlist.tcl index eed7476..34b19d0 100644 --- a/library/iconlist.tcl +++ b/library/iconlist.tcl @@ -26,7 +26,7 @@ # <path> selection includes <item> # <path> selection set <first> ?<last>? -package require Tk 8.6 +package require Tk ::tk::Megawidget create ::tk::IconList ::tk::FocusableWidget { variable w canvas sbar accel accelCB fill font index \ @@ -697,7 +697,7 @@ package require Tk 8.6 } } - if {$theIndex > -1} { + if {$theIndex >= 0} { $w selection clear 0 end $w selection set $theIndex $w selection anchor $theIndex diff --git a/library/listbox.tcl b/library/listbox.tcl index a094883..9e628a8 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -311,13 +311,13 @@ proc ::tk::ListboxMotion {w el} { set Priv(listboxSelection) [$w curselection] } while {($i < $el) && ($i < $anchor)} { - if {[lsearch $Priv(listboxSelection) $i] >= 0} { + if {$i in $Priv(listboxSelection)} { $w selection set $i } incr i } while {($i > $el) && ($i > $anchor)} { - if {[lsearch $Priv(listboxSelection) $i] >= 0} { + if {$i in $Priv(listboxSelection)} { $w selection set $i } incr i -1 @@ -517,7 +517,7 @@ proc ::tk::ListboxCancel w { } $w selection clear $first $last while {$first <= $last} { - if {[lsearch $Priv(listboxSelection) $first] >= 0} { + if {$first in $Priv(listboxSelection)} { $w selection set $first } incr first diff --git a/library/megawidget.tcl b/library/megawidget.tcl index aeb1263..ec9f469 100644 --- a/library/megawidget.tcl +++ b/library/megawidget.tcl @@ -10,7 +10,7 @@ # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -package require Tk 8.6 +package require Tk ::oo::class create ::tk::Megawidget { superclass ::oo::class diff --git a/library/menu.tcl b/library/menu.tcl index 9d6370a..c4991f8 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -138,7 +138,7 @@ bind Menu <Leave> { bind Menu <Motion> { tk::MenuMotion %W %x %y %s } -bind Menu <ButtonPress> { +bind Menu <Button> { tk::MenuButtonDown %W } bind Menu <ButtonRelease> { diff --git a/library/safetk.tcl b/library/safetk.tcl index 9f8e25d..9e71cc6 100644 --- a/library/safetk.tcl +++ b/library/safetk.tcl @@ -14,9 +14,9 @@ # Note: It is now ok to let untrusted code being executed # between the creation of the interp and the actual loading # of Tk in that interp because the C side Tk_Init will -# now look up the master interp and ask its safe::TkInit +# now look up the parent interp and ask its safe::TkInit # for the actual parameters to use for it's initialization (if allowed), -# not relying on the slave state. +# not relying on the child state. # # We use opt (optional arguments parsing) @@ -29,31 +29,31 @@ namespace eval ::safe { } # -# tkInterpInit : prepare the slave interpreter for tk loading +# tkInterpInit : prepare the child interpreter for tk loading # most of the real job is done by loadTk -# returns the slave name (tkInterpInit does) +# returns the child name (tkInterpInit does) # -proc ::safe::tkInterpInit {slave argv} { +proc ::safe::tkInterpInit {child argv} { global env tk_library # We have to make sure that the tk_library variable is normalized. set tk_library [file normalize $tk_library] # Clear Tk's access for that interp (path). - allowTk $slave $argv + allowTk $child $argv # Ensure tk_library and subdirs (eg, ttk) are on the access path - ::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]] + ::interp eval $child [list set tk_library [::safe::interpAddToAccessPath $child $tk_library]] foreach subdir [::safe::AddSubDirs [list $tk_library]] { - ::safe::interpAddToAccessPath $slave $subdir + ::safe::interpAddToAccessPath $child $subdir } - return $slave + return $child } # tkInterpLoadTk: # Do additional configuration as needed (calling tkInterpInit) -# and actually load Tk into the slave. +# and actually load Tk into the child. # # Either contained in the specified windowId (-use) or # creating a decorated toplevel for it. @@ -62,37 +62,37 @@ proc ::safe::tkInterpInit {slave argv} { proc ::safe::loadTk {} {} ::tcl::OptProc ::safe::loadTk { - {slave -interp "name of the slave interpreter"} + {child -interp "name of the child interpreter"} {-use -windowId {} "window Id to use (new toplevel otherwise)"} {-display -displayName {} "display name to use (current one otherwise)"} } { set displayGiven [::tcl::OptProcArgGiven "-display"] if {!$displayGiven} { # Try to get the current display from "." - # (which might not exist if the master is tk-less) + # (which might not exist if the parent is tk-less) if {[catch {set display [winfo screen .]}]} { if {[info exists ::env(DISPLAY)]} { set display $::env(DISPLAY) } else { - Log $slave "no winfo screen . nor env(DISPLAY)" WARNING + Log $child "no winfo screen . nor env(DISPLAY)" WARNING set display ":0.0" } } } # Get state for access to the cleanupHook. - namespace upvar ::safe S$slave state + namespace upvar ::safe S$child state if {![::tcl::OptProcArgGiven "-use"]} { # create a decorated toplevel - lassign [tkTopLevel $slave $display] w use + lassign [tkTopLevel $child $display] w use - # set our delete hook (slave arg is added by interpDelete) - # to clean up both window related code and tkInit(slave) + # set our delete hook (child arg is added by interpDelete) + # to clean up both window related code and tkInit(child) set state(cleanupHook) [list tkDelete {} $w] } else { - # set our delete hook (slave arg is added by interpDelete) - # to clean up tkInit(slave) + # set our delete hook (child arg is added by interpDelete) + # to clean up tkInit(child) set state(cleanupHook) [list disallowTk] # Let's be nice and also accept tk window names instead of ids @@ -122,12 +122,12 @@ proc ::safe::loadTk {} {} } } - # Prepares the slave for tk with those parameters - tkInterpInit $slave [list "-use" $use "-display" $display] + # Prepares the child for tk with those parameters + tkInterpInit $child [list "-use" $use "-display" $display] - load {} Tk $slave + load {} Tk $child - return $slave + return $child } proc ::safe::TkInit {interpPath} { @@ -149,7 +149,7 @@ proc ::safe::TkInit {interpPath} { # safe::TkInit. # # Arguments: -# interpPath slave interpreter handle +# interpPath child interpreter handle # argv arguments passed to safe::TkInterpInit # # Results: @@ -168,7 +168,7 @@ proc ::safe::allowTk {interpPath argv} { # in safe::TkInit. # # Arguments: -# interpPath slave interpreter handle +# interpPath child interpreter handle # # Results: # none. @@ -188,43 +188,43 @@ proc ::safe::disallowTk {interpPath} { # Clean up the window associated with the interp being deleted. # # Arguments: -# interpPath slave interpreter handle +# interpPath child interpreter handle # # Results: # none. -proc ::safe::tkDelete {W window slave} { +proc ::safe::tkDelete {W window child} { # we are going to be called for each widget... skip untill it's # top level - Log $slave "Called tkDelete $W $window" NOTICE - if {[::interp exists $slave]} { - if {[catch {::safe::interpDelete $slave} msg]} { - Log $slave "Deletion error : $msg" + Log $child "Called tkDelete $W $window" NOTICE + if {[::interp exists $child]} { + if {[catch {::safe::interpDelete $child} msg]} { + Log $child "Deletion error : $msg" } } if {[winfo exists $window]} { - Log $slave "Destroy toplevel $window" NOTICE + Log $child "Destroy toplevel $window" NOTICE destroy $window } - # clean up tkInit(slave) - disallowTk $slave + # clean up tkInit(child) + disallowTk $child return } -proc ::safe::tkTopLevel {slave display} { +proc ::safe::tkTopLevel {child display} { variable tkSafeId incr tkSafeId set w ".safe$tkSafeId" if {[catch {toplevel $w -screen $display -class SafeTk} msg]} { return -code error -errorcode {TK TOPLEVEL SAFE} \ - "Unable to create toplevel for safe slave \"$slave\" ($msg)" + "Unable to create toplevel for \"$child\" ($msg)" } - Log $slave "New toplevel $w" NOTICE + Log $child "New toplevel $w" NOTICE - set msg "Untrusted Tcl applet ($slave)" + set msg "Untrusted Tcl applet ($child)" wm title $w $msg # Control frame (we must create a style for it) @@ -236,7 +236,7 @@ proc ::safe::tkTopLevel {slave display} { # We will destroy the interp when the window is destroyed bindtags $wc [concat Safe$wc [bindtags $wc]] - bind Safe$wc <Destroy> [list ::safe::tkDelete %W $w $slave] + bind Safe$wc <Destroy> [list ::safe::tkDelete %W $w $child] ttk::label $wc.l -text $msg -anchor w @@ -247,7 +247,7 @@ proc ::safe::tkTopLevel {slave display} { # but still have the default background instead of red one from the parent ttk::frame $wc.fb -borderwidth 0 ttk::button $wc.fb.b -text "Delete" \ - -command [list ::safe::tkDelete $w $w $slave] + -command [list ::safe::tkDelete $w $w $child] pack $wc.fb.b -side right -fill both pack $wc.fb -side right -fill both -expand 1 pack $wc.l -side left -fill both -expand 1 -ipady 2 diff --git a/library/spinbox.tcl b/library/spinbox.tcl index f5a2ad3..2b387d2 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -483,10 +483,10 @@ proc ::tk::spinbox::MouseSelect {w x {cursor {}}} { word { if {$cur < [$w index anchor]} { set before [tcl_wordBreakBefore [$w get] $cur] - set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]] + set after [tcl_wordBreakAfter [$w get] $anchor-1] } else { set before [tcl_wordBreakBefore [$w get] $anchor] - set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]] + set after [tcl_wordBreakAfter [$w get] $cur-1] } if {$before < 0} { set before 0 diff --git a/library/tearoff.tcl b/library/tearoff.tcl index 4c8b404..dece4df 100644 --- a/library/tearoff.tcl +++ b/library/tearoff.tcl @@ -153,7 +153,7 @@ proc ::tk::MenuDup {src dst type} { # Copy tags to x, replacing each substring of src with dst. - while {[set index [string first $src $tags]] != -1} { + while {[set index [string first $src $tags]] >= 0} { if {$index > 0} { append x [string range $tags 0 $index-1]$dst } @@ -170,7 +170,7 @@ proc ::tk::MenuDup {src dst type} { # Copy script to x, replacing each substring of event with dst. - while {[set index [string first $event $script]] != -1} { + while {[set index [string first $event $script]] >= 0} { if {$index > 0} { append x [string range $script 0 $index-1] } diff --git a/library/tk.tcl b/library/tk.tcl index 980e4f9..cf2edd5 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -400,7 +400,7 @@ switch -exact -- [tk windowingsystem] { event add <<NextPara>> <Control-Down> event add <<SelectPrevPara>> <Control-Shift-Up> event add <<SelectNextPara>> <Control-Shift-Down> - event add <<ToggleSelection>> <Control-ButtonPress-1> + event add <<ToggleSelection>> <Control-Button-1> # Some OS's define a goofy (as in, not <Shift-Tab>) keysym that is # returned when the user presses <Shift-Tab>. In order for tab @@ -449,7 +449,7 @@ switch -exact -- [tk windowingsystem] { event add <<NextPara>> <Control-Down> event add <<SelectPrevPara>> <Control-Shift-Up> event add <<SelectNextPara>> <Control-Shift-Down> - event add <<ToggleSelection>> <Control-ButtonPress-1> + event add <<ToggleSelection>> <Control-Button-1> } "aqua" { event add <<Cut>> <Command-Key-x> <Key-F2> <Command-Lock-Key-X> @@ -486,7 +486,7 @@ switch -exact -- [tk windowingsystem] { event add <<NextPara>> <Option-Down> event add <<SelectPrevPara>> <Shift-Option-Up> event add <<SelectNextPara>> <Shift-Option-Down> - event add <<ToggleSelection>> <Command-ButtonPress-1> + event add <<ToggleSelection>> <Command-Button-1> } } @@ -687,9 +687,11 @@ if {[tk windowingsystem] eq "aqua"} { if {[tk windowingsystem] eq "aqua"} { #stub procedures to respond to "do script" Apple Events proc ::tk::mac::DoScriptFile {file} { + uplevel #0 $file source $file } proc ::tk::mac::DoScriptText {script} { + uplevel #0 $script eval $script } } diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index e8009be..8bba226 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -15,7 +15,7 @@ namespace eval ttk::theme::aqua { -insertwidth 1 ttk::style map . \ - -foreground { + -foreground { disabled systemDisabledControlTextColor background systemLabelColor} \ -selectbackground { @@ -49,7 +49,7 @@ namespace eval ttk::theme::aqua { -selectbackground { background systemTextBackgroundColor } - + # Workaround for #1100117: # Actually, on Aqua we probably shouldn't stipple images in @@ -100,7 +100,7 @@ namespace eval ttk::theme::aqua { !focus systemTextBackgroundColor focus systemSelectedTextBackgroundColor } - + # Treeview: ttk::style configure Heading \ -font TkHeadingFont \ diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl index 9f2cec7..e8c24a1 100644 --- a/library/ttk/button.tcl +++ b/library/ttk/button.tcl @@ -8,8 +8,8 @@ # (If the button is released off the widget, the grab deactivates and # we get a <Leave> event then, which turns off the "active" state) # -# Normally, <ButtonRelease> and <ButtonN-Enter/Leave> events are -# delivered to the widget which received the initial <ButtonPress> +# Normally, <ButtonRelease> and <ButtonN-Enter/Leave> events are +# delivered to the widget which received the initial <Button> # event. However, Tk [grab]s (#1223103) and menu interactions # (#1222605) can interfere with this. To guard against spurious # <Button1-Enter> events, the <Button1-Enter> binding only sets @@ -20,10 +20,10 @@ namespace eval ttk::button {} bind TButton <Enter> { %W instate !disabled {%W state active} } bind TButton <Leave> { %W state !active } -bind TButton <Key-space> { ttk::button::activate %W } +bind TButton <space> { ttk::button::activate %W } bind TButton <<Invoke>> { ttk::button::activate %W } -bind TButton <ButtonPress-1> \ +bind TButton <Button-1> \ { %W instate !disabled { ttk::clickToFocus %W; %W state pressed } } bind TButton <ButtonRelease-1> \ { %W instate pressed { %W state !pressed; %W instate !disabled { %W invoke } } } @@ -39,11 +39,11 @@ ttk::copyBindings TButton TRadiobutton # ...plus a few more: -bind TRadiobutton <KeyPress-Up> { ttk::button::RadioTraverse %W -1 } -bind TRadiobutton <KeyPress-Down> { ttk::button::RadioTraverse %W +1 } +bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 } +bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 } -# bind TCheckbutton <KeyPress-plus> { %W select } -# bind TCheckbutton <KeyPress-minus> { %W deselect } +# bind TCheckbutton <plus> { %W select } +# bind TCheckbutton <minus> { %W deselect } # activate -- # Simulate a button press: temporarily set the state to 'pressed', diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl index 6935fc7..bfcb194 100644 --- a/library/ttk/clamTheme.tcl +++ b/library/ttk/clamTheme.tcl @@ -5,7 +5,7 @@ # namespace eval ttk::theme::clam { - variable colors + variable colors array set colors { -disabledfg "#999999" -frame "#dcdad5" diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 2378643..e339f97 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -45,13 +45,13 @@ namespace eval ttk::combobox { ttk::copyBindings TEntry TCombobox -bind TCombobox <KeyPress-Down> { ttk::combobox::Post %W } -bind TCombobox <KeyPress-Escape> { ttk::combobox::Unpost %W } +bind TCombobox <Down> { ttk::combobox::Post %W } +bind TCombobox <Escape> { ttk::combobox::Unpost %W } -bind TCombobox <ButtonPress-1> { ttk::combobox::Press "" %W %x %y } -bind TCombobox <Shift-ButtonPress-1> { ttk::combobox::Press "s" %W %x %y } -bind TCombobox <Double-ButtonPress-1> { ttk::combobox::Press "2" %W %x %y } -bind TCombobox <Triple-ButtonPress-1> { ttk::combobox::Press "3" %W %x %y } +bind TCombobox <Button-1> { ttk::combobox::Press "" %W %x %y } +bind TCombobox <Shift-Button-1> { ttk::combobox::Press "s" %W %x %y } +bind TCombobox <Double-Button-1> { ttk::combobox::Press "2" %W %x %y } +bind TCombobox <Triple-Button-1> { ttk::combobox::Press "3" %W %x %y } bind TCombobox <B1-Motion> { ttk::combobox::Drag %W %x } bind TCombobox <Motion> { ttk::combobox::Motion %W %x %y } @@ -62,9 +62,9 @@ bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W } ### Combobox listbox bindings. # bind ComboboxListbox <ButtonRelease-1> { ttk::combobox::LBSelected %W } -bind ComboboxListbox <KeyPress-Return> { ttk::combobox::LBSelected %W } -bind ComboboxListbox <KeyPress-Escape> { ttk::combobox::LBCancel %W } -bind ComboboxListbox <KeyPress-Tab> { ttk::combobox::LBTab %W next } +bind ComboboxListbox <Return> { ttk::combobox::LBSelected %W } +bind ComboboxListbox <Escape> { ttk::combobox::LBCancel %W } +bind ComboboxListbox <Tab> { ttk::combobox::LBTab %W next } bind ComboboxListbox <<PrevWindow>> { ttk::combobox::LBTab %W prev } bind ComboboxListbox <Destroy> { ttk::combobox::LBCleanup %W } bind ComboboxListbox <Motion> { ttk::combobox::LBHover %W %x %y } @@ -82,7 +82,7 @@ switch -- [tk windowingsystem] { # bind ComboboxPopdown <Map> { ttk::combobox::MapPopdown %W } bind ComboboxPopdown <Unmap> { ttk::combobox::UnmapPopdown %W } -bind ComboboxPopdown <ButtonPress> \ +bind ComboboxPopdown <Button> \ { ttk::combobox::Unpost [winfo parent %W] } ### Option database settings. @@ -106,7 +106,7 @@ switch -- [tk windowingsystem] { ### Binding procedures. # -## Press $mode $x $y -- ButtonPress binding for comboboxes. +## Press $mode $x $y -- Button binding for comboboxes. # Either post/unpost the listbox, or perform Entry widget binding, # depending on widget state and location of button press. # @@ -135,7 +135,7 @@ proc ttk::combobox::Press {mode w x y} { } ## Drag -- B1-Motion binding for comboboxes. -# If the initial ButtonPress event was handled by Entry binding, +# If the initial Button event was handled by Entry binding, # perform Entry widget drag binding; otherwise nothing. # proc ttk::combobox::Drag {w x} { diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index a15d1d9..2db9a37 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -43,7 +43,7 @@ namespace eval ttk::theme::default { ttk::style configure TButton \ -anchor center -padding "3 3" -width -9 \ -relief raised -shiftrelief 1 - ttk::style map TButton -relief [list {!disabled pressed} sunken] + ttk::style map TButton -relief [list {!disabled pressed} sunken] ttk::style configure TCheckbutton \ -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1 diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index 1ee6005..4cdb5ac 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -40,20 +40,20 @@ option add *TEntry.cursor [ttk::cursor text] widgetDefault # # Removed the following standard Tk bindings: # -# <Control-Key-space>, <Control-Shift-Key-space>, -# <Key-Select>, <Shift-Key-Select>: +# <Control-space>, <Control-Shift-space>, +# <Select>, <Shift-Select>: # Ttk entry widget doesn't use selection anchor. -# <Key-Insert>: +# <Insert>: # Inserts PRIMARY selection (on non-Windows platforms). # This is inconsistent with typical platform bindings. -# <Double-Shift-ButtonPress-1>, <Triple-Shift-ButtonPress-1>: +# <Double-Shift-Button-1>, <Triple-Shift-Button-1>: # These don't do the right thing to start with. -# <Meta-Key-b>, <Meta-Key-d>, <Meta-Key-f>, -# <Meta-Key-BackSpace>, <Meta-Key-Delete>: +# <Meta-b>, <Meta-d>, <Meta-f>, +# <Meta-BackSpace>, <Meta-Delete>: # Judgment call. If <Meta> happens to be assigned to the Alt key, # these could conflict with application accelerators. # (Plus, who has a Meta key these days?) -# <Control-Key-t>: +# <Control-t>: # Another judgment call. If anyone misses this, let me know # and I'll put it back. # @@ -68,15 +68,15 @@ bind TEntry <<Clear>> { ttk::entry::Clear %W } ## Button1 bindings: # Used for selection and navigation. # -bind TEntry <ButtonPress-1> { ttk::entry::Press %W %x } -bind TEntry <Shift-ButtonPress-1> { ttk::entry::Shift-Press %W %x } -bind TEntry <Double-ButtonPress-1> { ttk::entry::Select %W %x word } -bind TEntry <Triple-ButtonPress-1> { ttk::entry::Select %W %x line } +bind TEntry <Button-1> { ttk::entry::Press %W %x } +bind TEntry <Shift-Button-1> { ttk::entry::Shift-Press %W %x } +bind TEntry <Double-Button-1> { ttk::entry::Select %W %x word } +bind TEntry <Triple-Button-1> { ttk::entry::Select %W %x line } bind TEntry <B1-Motion> { ttk::entry::Drag %W %x } -bind TEntry <B1-Leave> { ttk::entry::DragOut %W %m } -bind TEntry <B1-Enter> { ttk::entry::DragIn %W } -bind TEntry <ButtonRelease-1> { ttk::entry::Release %W } +bind TEntry <B1-Leave> { ttk::entry::DragOut %W %m } +bind TEntry <B1-Enter> { ttk::entry::DragIn %W } +bind TEntry <ButtonRelease-1> { ttk::entry::Release %W } bind TEntry <<ToggleSelection>> { %W instate {!readonly !disabled} { %W icursor @%x ; focus %W } @@ -88,13 +88,13 @@ bind TEntry <<ToggleSelection>> { # is mapped to <<PasteSelection>> in tk.tcl. # if {[tk windowingsystem] ne "aqua"} { - bind TEntry <ButtonPress-2> { ttk::entry::ScanMark %W %x } + bind TEntry <Button-2> { ttk::entry::ScanMark %W %x } bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x } - bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x } + bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x } } else { - bind TEntry <ButtonPress-3> { ttk::entry::ScanMark %W %x } + bind TEntry <Button-3> { ttk::entry::ScanMark %W %x } bind TEntry <B3-Motion> { ttk::entry::ScanDrag %W %x } - bind TEntry <ButtonRelease-3> { ttk::entry::ScanRelease %W %x } + bind TEntry <ButtonRelease-3> { ttk::entry::ScanRelease %W %x } } bind TEntry <<PasteSelection>> { ttk::entry::ScanRelease %W %x } @@ -121,26 +121,26 @@ bind TEntry <<TraverseIn>> { %W selection range 0 end; %W icursor end } ## Edit bindings: # -bind TEntry <KeyPress> { ttk::entry::Insert %W %A } -bind TEntry <Key-Delete> { ttk::entry::Delete %W } -bind TEntry <Key-BackSpace> { ttk::entry::Backspace %W } +bind TEntry <Key> { ttk::entry::Insert %W %A } +bind TEntry <Delete> { ttk::entry::Delete %W } +bind TEntry <BackSpace> { ttk::entry::Backspace %W } # Ignore all Alt, Meta, and Control keypresses unless explicitly bound. -# Otherwise, the <KeyPress> class binding will fire and insert the character. +# Otherwise, the <Key> class binding will fire and insert the character. # Ditto for Escape, Return, and Tab. # -bind TEntry <Alt-KeyPress> {# nothing} -bind TEntry <Meta-KeyPress> {# nothing} -bind TEntry <Control-KeyPress> {# nothing} -bind TEntry <Key-Escape> {# nothing} -bind TEntry <Key-Return> {# nothing} -bind TEntry <Key-KP_Enter> {# nothing} -bind TEntry <Key-Tab> {# nothing} +bind TEntry <Alt-Key> {# nothing} +bind TEntry <Meta-Key> {# nothing} +bind TEntry <Control-Key> {# nothing} +bind TEntry <Escape> {# nothing} +bind TEntry <Return> {# nothing} +bind TEntry <KP_Enter> {# nothing} +bind TEntry <Tab> {# nothing} # Argh. Apparently on Windows, the NumLock modifier is interpreted # as a Command modifier. if {[tk windowingsystem] eq "aqua"} { - bind TEntry <Command-KeyPress> {# nothing} + bind TEntry <Command-Key> {# nothing} } # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] bind TEntry <<PrevLine>> {# nothing} @@ -148,9 +148,9 @@ bind TEntry <<NextLine>> {# nothing} ## Additional emacs-like bindings: # -bind TEntry <Control-Key-d> { ttk::entry::Delete %W } -bind TEntry <Control-Key-h> { ttk::entry::Backspace %W } -bind TEntry <Control-Key-k> { %W delete insert end } +bind TEntry <Control-d> { ttk::entry::Delete %W } +bind TEntry <Control-h> { ttk::entry::Backspace %W } +bind TEntry <Control-k> { %W delete insert end } # Bindings for IME text input. @@ -358,7 +358,7 @@ proc ttk::entry::Extend {w where} { # Triple-clicking enters "line-select" mode. # -## Press -- ButtonPress-1 binding. +## Press -- Button-1 binding. # Set the insertion cursor, claim the input focus, set up for # future drag operations. # @@ -375,7 +375,7 @@ proc ttk::entry::Press {w x} { set State(anchor) [$w index insert] } -## Shift-Press -- Shift-ButtonPress-1 binding. +## Shift-Press -- Shift-Button-1 binding. # Extends the selection, sets anchor for future drag operations. # proc ttk::entry::Shift-Press {w x} { @@ -524,7 +524,7 @@ proc ttk::entry::LineSelect {w _ _} { ### Button 2 binding procedures. # -## ScanMark -- ButtonPress-2 binding. +## ScanMark -- Button-2 binding. # Marks the start of a scan or primary transfer operation. # proc ttk::entry::ScanMark {w x} { diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl index a2781c6..bf4ccd0 100644 --- a/library/ttk/fonts.tcl +++ b/library/ttk/fonts.tcl @@ -82,7 +82,7 @@ switch -- [tk windowingsystem] { set F(family) "MS Sans Serif" } } else { - if {[lsearch -exact [font families] Tahoma] != -1} { + if {[lsearch -exact [font families] Tahoma] >= 0} { set F(family) "Tahoma" } else { set F(family) "MS Sans Serif" diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl index 43b3cd8..a245df8 100644 --- a/library/ttk/menubutton.tcl +++ b/library/ttk/menubutton.tcl @@ -5,12 +5,12 @@ # # Pulldown: Press menubutton, drag over menu, release to activate menu entry # Popdown: Click menubutton to post menu -# Keyboard: <Key-space> or accelerator key to post menu +# Keyboard: <space> or accelerator key to post menu # # (In addition, when menu system is active, "dropdown" -- menu posts # on mouse-over. Ttk menubuttons don't implement this). # -# For keyboard and popdown mode, we hand off to tk_popup and let +# For keyboard and popdown mode, we hand off to tk_popup and let # the built-in Tk bindings handle the rest of the interaction. # # ON X11: @@ -19,16 +19,16 @@ # This won't work for Ttk menubuttons in pulldown mode, # since we need to process the final <ButtonRelease> event, # and this might be delivered to the menu. So instead we -# rely on the passive grab that occurs on <ButtonPress> events, +# rely on the passive grab that occurs on <Button> events, # and transition to popdown mode when the mouse is released # or dragged outside the menubutton. -# +# # ON WINDOWS: # -# I'm not sure what the hell is going on here. [$menu post] apparently +# I'm not sure what the hell is going on here. [$menu post] apparently # sets up some kind of internal grab for native menus. # On this platform, just use [tk_popup] for all menu actions. -# +# # ON MACOS: # # Same probably applies here. @@ -46,15 +46,15 @@ namespace eval ttk { bind TMenubutton <Enter> { %W instate !disabled {%W state active } } bind TMenubutton <Leave> { %W state !active } -bind TMenubutton <Key-space> { ttk::menubutton::Popdown %W } +bind TMenubutton <space> { ttk::menubutton::Popdown %W } bind TMenubutton <<Invoke>> { ttk::menubutton::Popdown %W } if {[tk windowingsystem] eq "x11"} { - bind TMenubutton <ButtonPress-1> { ttk::menubutton::Pulldown %W } + bind TMenubutton <Button-1> { ttk::menubutton::Pulldown %W } bind TMenubutton <ButtonRelease-1> { ttk::menubutton::TransferGrab %W } bind TMenubutton <B1-Leave> { ttk::menubutton::TransferGrab %W } } else { - bind TMenubutton <ButtonPress-1> \ + bind TMenubutton <Button-1> \ { %W state pressed ; ttk::menubutton::Popdown %W } bind TMenubutton <ButtonRelease-1> \ { if {[winfo exists %W]} { %W state !pressed } } @@ -97,7 +97,7 @@ if {[tk windowingsystem] eq "aqua"} { } below { set entry "" - incr y $bh + incr y $bh } left { incr y $menuPad @@ -105,7 +105,7 @@ if {[tk windowingsystem] eq "aqua"} { } right { incr y $menuPad - incr x $bw + incr x $bw } default { incr y $bbh @@ -182,7 +182,7 @@ proc ttk::menubutton::Popdown {mb} { # Pulldown (X11 only) -- # Called when Button1 is pressed on a menubutton. -# Posts the menu; a subsequent ButtonRelease +# Posts the menu; a subsequent ButtonRelease # or Leave event will set a grab on the menu. # proc ttk::menubutton::Pulldown {mb} { @@ -224,11 +224,11 @@ proc ttk::menubutton::TransferGrab {mb} { # FindMenuEntry -- # Hack to support tk_optionMenus. # Returns the index of the menu entry with a matching -label, -# -1 if not found. +# "" if not found. # proc ttk::menubutton::FindMenuEntry {menu s} { set last [$menu index last] - if {$last eq "none"} { + if {$last eq "none" || $last eq ""} { return "" } for {set i 0} {$i <= $last} {incr i} { diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl index 72b85e6..c5340a5 100644 --- a/library/ttk/notebook.tcl +++ b/library/ttk/notebook.tcl @@ -6,11 +6,11 @@ namespace eval ttk::notebook { variable TLNotebooks ;# See enableTraversal } -bind TNotebook <ButtonPress-1> { ttk::notebook::Press %W %x %y } -bind TNotebook <Key-Right> { ttk::notebook::CycleTab %W 1; break } -bind TNotebook <Key-Left> { ttk::notebook::CycleTab %W -1; break } -bind TNotebook <Control-Key-Tab> { ttk::notebook::CycleTab %W 1; break } -bind TNotebook <Control-Shift-Key-Tab> { ttk::notebook::CycleTab %W -1; break } +bind TNotebook <Button-1> { ttk::notebook::Press %W %x %y } +bind TNotebook <Right> { ttk::notebook::CycleTab %W 1; break } +bind TNotebook <Left> { ttk::notebook::CycleTab %W -1; break } +bind TNotebook <Control-Tab> { ttk::notebook::CycleTab %W 1; break } +bind TNotebook <Control-Shift-Tab> { ttk::notebook::CycleTab %W -1; break } catch { bind TNotebook <Control-ISO_Left_Tab> { ttk::notebook::CycleTab %W -1; break } } @@ -43,7 +43,7 @@ proc ttk::notebook::ActivateTab {w tab} { } # Press $nb $x $y -- -# ButtonPress-1 binding for notebook widgets. +# Button-1 binding for notebook widgets. # Activate the tab under the mouse cursor, if any. # proc ttk::notebook::Press {w x y} { @@ -70,7 +70,7 @@ proc ttk::notebook::CycleTab {w dir} { } # MnemonicTab $nb $key -- -# Scan all tabs in the specified notebook for one with the +# Scan all tabs in the specified notebook for one with the # specified mnemonic. If found, returns path name of tab; # otherwise returns "" # @@ -94,8 +94,8 @@ proc ttk::notebook::MnemonicTab {nb key} { # Enable keyboard traversal for a notebook widget # by adding bindings to the containing toplevel window. # -# TLNotebooks($top) keeps track of the list of all traversal-enabled -# notebooks contained in the toplevel +# TLNotebooks($top) keeps track of the list of all traversal-enabled +# notebooks contained in the toplevel # proc ttk::notebook::enableTraversal {nb} { variable TLNotebooks @@ -105,18 +105,18 @@ proc ttk::notebook::enableTraversal {nb} { if {![info exists TLNotebooks($top)]} { # Augment $top bindings: # - bind $top <Control-Key-Next> {+ttk::notebook::TLCycleTab %W 1} - bind $top <Control-Key-Prior> {+ttk::notebook::TLCycleTab %W -1} - bind $top <Control-Key-Tab> {+ttk::notebook::TLCycleTab %W 1} - bind $top <Control-Shift-Key-Tab> {+ttk::notebook::TLCycleTab %W -1} + bind $top <Control-Next> {+ttk::notebook::TLCycleTab %W 1} + bind $top <Control-Prior> {+ttk::notebook::TLCycleTab %W -1} + bind $top <Control-Tab> {+ttk::notebook::TLCycleTab %W 1} + bind $top <Control-Shift-Tab> {+ttk::notebook::TLCycleTab %W -1} catch { - bind $top <Control-Key-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1} + bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1} } if {[tk windowingsystem] eq "aqua"} { - bind $top <Option-KeyPress> \ + bind $top <Option-Key> \ +[list ttk::notebook::MnemonicActivation $top %K] } else { - bind $top <Alt-KeyPress> \ + bind $top <Alt-Key> \ +[list ttk::notebook::MnemonicActivation $top %K] } bind $top <Destroy> {+ttk::notebook::TLCleanup %W} @@ -145,7 +145,7 @@ proc ttk::notebook::Cleanup {nb} { } } -# EnclosingNotebook $w -- +# EnclosingNotebook $w -- # Return the nearest traversal-enabled notebook widget # that contains $w. # @@ -171,7 +171,7 @@ proc ttk::notebook::EnclosingNotebook {w} { # TLCycleTab -- # toplevel binding procedure for Control-Tab / Control-Shift-Tab -# Select the next/previous tab in the nearest ancestor notebook. +# Select the next/previous tab in the nearest ancestor notebook. # proc ttk::notebook::TLCycleTab {w dir} { set nb [EnclosingNotebook $w] @@ -182,7 +182,7 @@ proc ttk::notebook::TLCycleTab {w dir} { } # MnemonicActivation $nb $key -- -# Alt-KeyPress binding procedure for mnemonic activation. +# Alt-Key binding procedure for mnemonic activation. # Scan all notebooks in specified toplevel for a tab with the # the specified mnemonic. If found, activate it and return TCL_BREAK. # diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index ba47003..0fd9bd7 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -15,7 +15,7 @@ namespace eval ttk::panedwindow { ## Bindings: # -bind TPanedwindow <ButtonPress-1> { ttk::panedwindow::Press %W %x %y } +bind TPanedwindow <Button-1> { ttk::panedwindow::Press %W %x %y } bind TPanedwindow <B1-Motion> { ttk::panedwindow::Drag %W %x %y } bind TPanedwindow <ButtonRelease-1> { ttk::panedwindow::Release %W %x %y } diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl index 62c85bf..61c4136 100644 --- a/library/ttk/scale.tcl +++ b/library/ttk/scale.tcl @@ -9,15 +9,15 @@ namespace eval ttk::scale { } } -bind TScale <ButtonPress-1> { ttk::scale::Press %W %x %y } +bind TScale <Button-1> { ttk::scale::Press %W %x %y } bind TScale <B1-Motion> { ttk::scale::Drag %W %x %y } bind TScale <ButtonRelease-1> { ttk::scale::Release %W %x %y } -bind TScale <ButtonPress-2> { ttk::scale::Jump %W %x %y } +bind TScale <Button-2> { ttk::scale::Jump %W %x %y } bind TScale <B2-Motion> { ttk::scale::Drag %W %x %y } bind TScale <ButtonRelease-2> { ttk::scale::Release %W %x %y } -bind TScale <ButtonPress-3> { ttk::scale::Jump %W %x %y } +bind TScale <Button-3> { ttk::scale::Jump %W %x %y } bind TScale <B3-Motion> { ttk::scale::Drag %W %x %y } bind TScale <ButtonRelease-3> { ttk::scale::Release %W %x %y } @@ -52,7 +52,7 @@ proc ttk::scale::Press {w x y} { } } -# scale::Jump -- ButtonPress-2/3 binding for scale acts like +# scale::Jump -- Button-2/3 binding for scale acts like # Press except that clicking in the trough jumps to the # clicked position. proc ttk::scale::Jump {w x y} { diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl index efcf3a1..1213450 100644 --- a/library/ttk/scrollbar.tcl +++ b/library/ttk/scrollbar.tcl @@ -9,11 +9,11 @@ namespace eval ttk::scrollbar { # State(first) -- value of -first at start of drag. } -bind TScrollbar <ButtonPress-1> { ttk::scrollbar::Press %W %x %y } +bind TScrollbar <Button-1> { ttk::scrollbar::Press %W %x %y } bind TScrollbar <B1-Motion> { ttk::scrollbar::Drag %W %x %y } bind TScrollbar <ButtonRelease-1> { ttk::scrollbar::Release %W %x %y } -bind TScrollbar <ButtonPress-2> { ttk::scrollbar::Jump %W %x %y } +bind TScrollbar <Button-2> { ttk::scrollbar::Jump %W %x %y } bind TScrollbar <B2-Motion> { ttk::scrollbar::Drag %W %x %y } bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y } @@ -29,7 +29,7 @@ switch [tk windowingsystem] { x11 { lappend eventList <Button-4> <Button-5> \ <Shift-Button-4> <Shift-Button-5> - # For tk 8.7, the event list should be extended by + # For tk 8.7, the event list will be extended by # <Button-6> <Button-7> } } @@ -59,7 +59,7 @@ proc ttk::scrollbar::Press {w x y} { set State(yPress) $y switch -glob -- [$w identify $x $y] { - *uparrow - + *uparrow - *leftarrow { ttk::Repeatedly Scroll $w -1 units } @@ -67,6 +67,7 @@ proc ttk::scrollbar::Press {w x y} { *rightarrow { ttk::Repeatedly Scroll $w 1 units } + *grip - *thumb { set State(first) [lindex [$w get] 0] } @@ -89,7 +90,7 @@ proc ttk::scrollbar::Press {w x y} { proc ttk::scrollbar::Drag {w x y} { variable State if {![info exists State(first)]} { - # Initial buttonpress was not on the thumb, + # Initial buttonpress was not on the thumb, # or something screwy has happened. In either case, ignore: return; } @@ -104,7 +105,7 @@ proc ttk::scrollbar::Release {w x y} { ttk::CancelRepeat } -# scrollbar::Jump -- ButtonPress-2 binding for scrollbars. +# scrollbar::Jump -- Button-2 binding for scrollbars. # Behaves exactly like scrollbar::Press, except that # clicking in the trough jumps to the the selected position. # @@ -112,6 +113,7 @@ proc ttk::scrollbar::Jump {w x y} { variable State switch -glob -- [$w identify $x $y] { + *grip - *thumb - *trough { set State(first) [$w fraction $x $y] diff --git a/library/ttk/sizegrip.tcl b/library/ttk/sizegrip.tcl index 24a67c6..080ab2d 100644 --- a/library/ttk/sizegrip.tcl +++ b/library/ttk/sizegrip.tcl @@ -32,7 +32,7 @@ namespace eval ttk::sizegrip { } } -bind TSizegrip <ButtonPress-1> { ttk::sizegrip::Press %W %X %Y } +bind TSizegrip <Button-1> { ttk::sizegrip::Press %W %X %Y } bind TSizegrip <B1-Motion> { ttk::sizegrip::Drag %W %X %Y } bind TSizegrip <ButtonRelease-1> { ttk::sizegrip::Release %W %X %Y } diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl index 344ee60..33936d9 100644 --- a/library/ttk/spinbox.tcl +++ b/library/ttk/spinbox.tcl @@ -12,13 +12,13 @@ namespace eval ttk::spinbox { } ttk::copyBindings TEntry TSpinbox bind TSpinbox <Motion> { ttk::spinbox::Motion %W %x %y } -bind TSpinbox <ButtonPress-1> { ttk::spinbox::Press %W %x %y } +bind TSpinbox <Button-1> { ttk::spinbox::Press %W %x %y } bind TSpinbox <ButtonRelease-1> { ttk::spinbox::Release %W } bind TSpinbox <Double-Button-1> { ttk::spinbox::DoubleClick %W %x %y } bind TSpinbox <Triple-Button-1> {} ;# disable TEntry triple-click -bind TSpinbox <KeyPress-Up> { event generate %W <<Increment>> } -bind TSpinbox <KeyPress-Down> { event generate %W <<Decrement>> } +bind TSpinbox <Up> { event generate %W <<Increment>> } +bind TSpinbox <Down> { event generate %W <<Decrement>> } bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 } bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 } diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index a9f623c..62fc630 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -28,25 +28,25 @@ namespace eval ttk::treeview { bind Treeview <Motion> { ttk::treeview::Motion %W %x %y } bind Treeview <B1-Leave> { #nothing } bind Treeview <Leave> { ttk::treeview::ActivateHeading {} {}} -bind Treeview <ButtonPress-1> { ttk::treeview::Press %W %x %y } -bind Treeview <Double-ButtonPress-1> { ttk::treeview::DoubleClick %W %x %y } +bind Treeview <Button-1> { ttk::treeview::Press %W %x %y } +bind Treeview <Double-Button-1> { ttk::treeview::DoubleClick %W %x %y } bind Treeview <ButtonRelease-1> { ttk::treeview::Release %W %x %y } bind Treeview <B1-Motion> { ttk::treeview::Drag %W %x %y } -bind Treeview <KeyPress-Up> { ttk::treeview::Keynav %W up } -bind Treeview <KeyPress-Down> { ttk::treeview::Keynav %W down } -bind Treeview <KeyPress-Right> { ttk::treeview::Keynav %W right } -bind Treeview <KeyPress-Left> { ttk::treeview::Keynav %W left } -bind Treeview <KeyPress-Prior> { %W yview scroll -1 pages } -bind Treeview <KeyPress-Next> { %W yview scroll 1 pages } -bind Treeview <KeyPress-Return> { ttk::treeview::ToggleFocus %W } -bind Treeview <KeyPress-space> { ttk::treeview::ToggleFocus %W } - -bind Treeview <Shift-ButtonPress-1> \ +bind Treeview <Up> { ttk::treeview::Keynav %W up } +bind Treeview <Down> { ttk::treeview::Keynav %W down } +bind Treeview <Right> { ttk::treeview::Keynav %W right } +bind Treeview <Left> { ttk::treeview::Keynav %W left } +bind Treeview <Prior> { %W yview scroll -1 pages } +bind Treeview <Next> { %W yview scroll 1 pages } +bind Treeview <Return> { ttk::treeview::ToggleFocus %W } +bind Treeview <space> { ttk::treeview::ToggleFocus %W } + +bind Treeview <Shift-Button-1> \ { ttk::treeview::Select %W %x %y extend } bind Treeview <<ToggleSelection>> \ { ttk::treeview::Select %W %x %y toggle } -ttk::copyBindings TtkScrollable Treeview +ttk::copyBindings TtkScrollable Treeview ### Binding procedures. # @@ -131,7 +131,7 @@ proc ttk::treeview::ActivateHeading {w heading} { # triggers a <Leave> event. A proc checking if the display column # $State(activeHeading) is really still present or not could be # written but it would need to check several special cases: - # a. -displaycolumns "#all" or being an explicit columns list + # a. -displaycolumns "#all" or being an explicit columns list # b. column #0 display is not governed by the -displaycolumn # list but by the value of the -show option # --> Let's rather catch the following line. @@ -155,7 +155,7 @@ proc ttk::treeview::Select {w x y op} { } } -## DoubleClick -- Double-ButtonPress-1 binding. +## DoubleClick -- Double-Button-1 binding. # proc ttk::treeview::DoubleClick {w x y} { if {[set row [$w identify row $x $y]] ne ""} { @@ -165,7 +165,7 @@ proc ttk::treeview::DoubleClick {w x y} { } } -## Press -- ButtonPress binding. +## Press -- Button binding. # proc ttk::treeview::Press {w x y} { focus $w diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl index 7bae211..665222d 100644 --- a/library/ttk/ttk.tcl +++ b/library/ttk/ttk.tcl @@ -122,7 +122,7 @@ proc ttk::LoadThemes {} { variable library # "default" always present: - uplevel #0 [list source [file join $library defaults.tcl]] + uplevel #0 [list source [file join $library defaults.tcl]] set builtinThemes [style theme names] foreach {theme scripts} { diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl index 101162f..7a5cc71 100644 --- a/library/ttk/utils.tcl +++ b/library/ttk/utils.tcl @@ -58,7 +58,7 @@ proc ttk::traverseTo {w} { } ## ttk::clickToFocus $w -- -# Utility routine, used in <ButtonPress-1> bindings -- +# Utility routine, used in <Button-1> bindings -- # Assign keyboard focus to the specified widget if -takefocus is enabled. # proc ttk::clickToFocus {w} { @@ -298,8 +298,8 @@ proc ttk::copyBindings {from to} { proc ttk::bindMouseWheel {bindtag callback} { if {[tk windowingsystem] eq "x11"} { - bind $bindtag <ButtonPress-4> "$callback -1" - bind $bindtag <ButtonPress-5> "$callback +1" + bind $bindtag <Button-4> "$callback -1" + bind $bindtag <Button-5> "$callback +1" } if {[tk windowingsystem] eq "aqua"} { bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ] @@ -318,10 +318,10 @@ proc ttk::bindMouseWheel {bindtag callback} { # if {[tk windowingsystem] eq "x11"} { - bind TtkScrollable <ButtonPress-4> { %W yview scroll -5 units } - bind TtkScrollable <ButtonPress-5> { %W yview scroll 5 units } - bind TtkScrollable <Shift-ButtonPress-4> { %W xview scroll -5 units } - bind TtkScrollable <Shift-ButtonPress-5> { %W xview scroll 5 units } + bind TtkScrollable <Button-4> { %W yview scroll -5 units } + bind TtkScrollable <Button-5> { %W yview scroll 5 units } + bind TtkScrollable <Shift-Button-4> { %W xview scroll -5 units } + bind TtkScrollable <Shift-Button-5> { %W xview scroll 5 units } } if {[tk windowingsystem] eq "aqua"} { bind TtkScrollable <MouseWheel> \ diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl index 094288c..0700353 100644 --- a/library/ttk/vistaTheme.tcl +++ b/library/ttk/vistaTheme.tcl @@ -3,7 +3,7 @@ # # The Vista theme can only be defined on Windows Vista and above. The theme -# is created in C due to the need to assign a theme-enabled function for +# is created in C due to the need to assign a theme-enabled function for # detecting when themeing is disabled. On systems that cannot support the # Vista theme, there will be no such theme created and we must not # evaluate this script. @@ -69,9 +69,9 @@ namespace eval ttk::theme::vista { ttk::style layout TCombobox { Combobox.border -sticky nswe -border 0 -children { Combobox.rightdownarrow -side right -sticky ns - Combobox.padding -expand 1 -sticky nswe -children { + Combobox.padding -sticky nswe -children { Combobox.background -sticky nswe -children { - Combobox.focus -expand 1 -sticky nswe -children { + Combobox.focus -sticky nswe -children { Combobox.textarea -sticky nswe } } @@ -138,7 +138,7 @@ namespace eval ttk::theme::vista { Spinbox.background -sticky news -children { Spinbox.padding -sticky news -children { Spinbox.innerbg -sticky news -children { - Spinbox.textarea -expand 1 + Spinbox.textarea } } Spinbox.uparrow -side top -sticky ens @@ -151,7 +151,7 @@ namespace eval ttk::theme::vista { -selectforeground [list !focus SystemWindowText] \ ; - + # SCROLLBAR elements (Vista includes a state for 'hover') ttk::style element create Vertical.Scrollbar.uparrow vsapi \ SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \ @@ -196,14 +196,14 @@ namespace eval ttk::theme::vista { Vertical.Progressbar.pbar -side bottom -sticky we } } - + # Scale ttk::style element create Horizontal.Scale.slider vsapi \ TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ -width 6 -height 12 ttk::style layout Horizontal.TScale { - Scale.focus -expand 1 -sticky nswe -children { - Horizontal.Scale.trough -expand 1 -sticky nswe -children { + Scale.focus -sticky nswe -children { + Horizontal.Scale.trough -sticky nswe -children { Horizontal.Scale.track -sticky we Horizontal.Scale.slider -side left -sticky {} } @@ -213,17 +213,17 @@ namespace eval ttk::theme::vista { TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ -width 12 -height 6 ttk::style layout Vertical.TScale { - Scale.focus -expand 1 -sticky nswe -children { - Vertical.Scale.trough -expand 1 -sticky nswe -children { + Scale.focus -sticky nswe -children { + Vertical.Scale.trough -sticky nswe -children { Vertical.Scale.track -sticky ns Vertical.Scale.slider -side top -sticky {} } } } - + # Treeview ttk::style configure Item -padding {4 0 0 0} - + package provide ttk::theme::vista 1.0 } } diff --git a/macosx/README b/macosx/README index 79025f1..0a02999 100644 --- a/macosx/README +++ b/macosx/README @@ -662,15 +662,35 @@ source and destination rectangles for the scrolling. The embedded windows are redrawn within the DisplayText function by some conditional code which is only used for macOS. -6.0 Virtual events on 10.14 -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +6.0 Virtual events on macOS 10.14 and later +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The 10.14 release added support for system appearance changes, +including a "Dark Mode" that renders all window frames and menus in +dark colors. Tk 8.6.11 provides three virtual events <<LightAqua>>, +<<DarkAqua>> and <<AppearanceChanged>>, to allow you to update your Tk +app's appearance when the system appearance changes. These events are +generated in [NSView effectiveAppearanceChanged], which is called by +the Apple window manager when the General Preferences is changed +either by switching between Light Mode and Dark Mode or by changing +the Accent Color or Highlight Color. + +The <<AppearanceChanged>> virtual event has a data string which can be +accessed with the %d substitution. The format of the data string is +that it consists of 6 words: + "Appearance XXXX Accent YYYY Highlight ZZZZ" +For example, the following code will print the current appearance +name, accent color and highlight color when the <<AppearanceChanged>> +virtual event fires: + +bind . <<AppearanceChanged>> { + array set data [split %d] + puts " Appearance: $data(Appearance)" + puts " Accent: $data(Accent)" + puts " Highlight: $data(Highlight)\n" +} + -10.14 supports system appearance changes, and has added a "Dark Mode" -that casts all window frames and menus as black. Tk 8.6.9 has added two -virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update -your Tk app's appearance when the system appearance changes. Just bind -your appearance-updating code to these virtual events and you will see -it triggered when the system appearance toggles between dark and light. 7.0 Mac Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/macosx/Tk.xcode/project.pbxproj b/macosx/Tk.xcode/project.pbxproj index 93143f7..c93b15b 100644 --- a/macosx/Tk.xcode/project.pbxproj +++ b/macosx/Tk.xcode/project.pbxproj @@ -1411,7 +1411,7 @@ F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; }; F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; }; F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; }; - F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; }; + F96D3E2208F272A5004A47F5 /* CrtAlias.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtAlias.3; sourceTree = "<group>"; }; F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; }; F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; }; F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; }; @@ -3078,7 +3078,7 @@ F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */, F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */, F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */, - F96D3E2208F272A5004A47F5 /* CrtSlave.3 */, + F96D3E2208F272A5004A47F5 /* CrtAlias.3 */, F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */, F96D3E2408F272A5004A47F5 /* CrtTrace.3 */, F96D3E2508F272A5004A47F5 /* dde.n */, diff --git a/macosx/Tk.xcodeproj/project.pbxproj b/macosx/Tk.xcodeproj/project.pbxproj index 53ebe3e..10a9c9a 100644 --- a/macosx/Tk.xcodeproj/project.pbxproj +++ b/macosx/Tk.xcodeproj/project.pbxproj @@ -1411,7 +1411,7 @@ F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; }; F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; }; F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; }; - F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; }; + F96D3E2208F272A5004A47F5 /* CrtAlias.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtAlias.3; sourceTree = "<group>"; }; F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; }; F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; }; F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; }; @@ -3078,7 +3078,7 @@ F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */, F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */, F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */, - F96D3E2208F272A5004A47F5 /* CrtSlave.3 */, + F96D3E2208F272A5004A47F5 /* CrtAlias.3 */, F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */, F96D3E2408F272A5004A47F5 /* CrtTrace.3 */, F96D3E2508F272A5004A47F5 /* dde.n */, diff --git a/macosx/tkMacOSX.h b/macosx/tkMacOSX.h index 05ea6c2..3ab0a34 100644 --- a/macosx/tkMacOSX.h +++ b/macosx/tkMacOSX.h @@ -26,7 +26,7 @@ typedef int (Tk_MacOSXEmbedRegisterWinProc) (long winID, Tk_Window window); typedef void* (Tk_MacOSXEmbedGetGrafPortProc) (Tk_Window window); typedef int (Tk_MacOSXEmbedMakeContainerExistProc) (Tk_Window window); -typedef void (Tk_MacOSXEmbedGetClipProc) (Tk_Window window, TkRegion rgn); +typedef void (Tk_MacOSXEmbedGetClipProc) (Tk_Window window, void *rgn); typedef void (Tk_MacOSXEmbedGetOffsetInParentProc) (Tk_Window window, void *ulCorner); #include "tkPlatDecls.h" diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c index 2b08235..29bb163 100644 --- a/macosx/tkMacOSXBitmap.c +++ b/macosx/tkMacOSXBitmap.c @@ -44,7 +44,7 @@ static BuiltInIcon builtInIcons[] = { {"stop", kAlertStopIcon}, {"note", kAlertNoteIcon}, {"caution", kAlertCautionIcon}, - {NULL} + {NULL, 0} }; #define builtInIconSize 32 @@ -100,7 +100,7 @@ TkpDefineNativeBitmaps(void) name = Tk_GetUid(builtInPtr->name); predefHashPtr = Tcl_CreateHashEntry(tablePtr, name, &isNew); if (isNew) { - TkPredefBitmap *predefPtr = ckalloc(sizeof(TkPredefBitmap)); + TkPredefBitmap *predefPtr = (TkPredefBitmap *)ckalloc(sizeof(TkPredefBitmap)); predefPtr->source = UINT2PTR(builtInPtr->iconType); predefPtr->width = builtInIconSize; @@ -136,15 +136,13 @@ PixmapFromImage( Pixmap pixmap; pixmap = Tk_GetPixmap(display, None, size.width, size.height, 0); - if (TkMacOSXSetupDrawingContext(pixmap, NULL, 1, &dc)) { + if (TkMacOSXSetupDrawingContext(pixmap, NULL, &dc)) { if (dc.context) { CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0, .ty = size.height}; CGContextConcatCTM(dc.context, t); [NSGraphicsContext saveGraphicsState]; - [NSGraphicsContext setCurrentContext:[NSGraphicsContext - graphicsContextWithGraphicsPort:dc.context - flipped:NO]]; + [NSGraphicsContext setCurrentContext:GET_NSCONTEXT(dc.context, NO)]; [image drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; [NSGraphicsContext restoreGraphicsState]; @@ -343,7 +341,7 @@ TkpGetNativeAppBitmap( int TkMacOSXIconBitmapObjCmd( - ClientData clientData, /* Unused. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -398,7 +396,7 @@ TkMacOSXIconBitmapObjCmd( } } #endif - ib.value = ckalloc(len + 1); + ib.value = (char *)ckalloc(len + 1); strcpy(ib.value, value); if (!iconBitmapTable.buckets) { Tcl_InitHashTable(&iconBitmapTable, TCL_STRING_KEYS); @@ -408,7 +406,7 @@ TkMacOSXIconBitmapObjCmd( iconBitmap = Tcl_GetHashValue(hPtr); ckfree(iconBitmap->value); } else { - iconBitmap = ckalloc(sizeof(IconBitmap)); + iconBitmap = (IconBitmap *)ckalloc(sizeof(IconBitmap)); Tcl_SetHashValue(hPtr, iconBitmap); } *iconBitmap = ib; diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 5aa8f7d..857ce34 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -95,6 +95,8 @@ static void PulseDefaultButtonProc(ClientData clientData); const Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ + NULL, + NULL }; static int bCount; @@ -143,7 +145,7 @@ TkButton * TkpCreateButton( Tk_Window tkwin) { - MacButton *macButtonPtr = ckalloc(sizeof(MacButton)); + MacButton *macButtonPtr = (MacButton *)ckalloc(sizeof(MacButton)); Tk_CreateEventHandler(tkwin, ActivateMask, ButtonEventProc, macButtonPtr); @@ -192,13 +194,6 @@ TkpDisplayButton( } pixmap = (Pixmap) Tk_WindowId(tkwin); - /* - * Set up clipping region. Make sure the we are using the port - * for this button, or we will set the wrong window's clip. - */ - - TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin)); - if (TkMacOSXComputeButtonDrawParams(butPtr, dpPtr)) { macButtonPtr->useTkText = 0; } else { @@ -724,7 +719,7 @@ TkpDestroyButton( static void TkMacOSXDrawButton( MacButton *mbPtr, /* Mac button. */ - GC gc, /* The GC we are drawing into - needed for + TCL_UNUSED(GC), /* The GC we are drawing into - needed for * the bevel button */ Pixmap pixmap) /* The pixmap we are drawing into - needed * for the bevel button */ @@ -749,7 +744,7 @@ TkMacOSXDrawButton( ButtonBackgroundDrawCB(&cntrRect, mbPtr, 32, true); - if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) { return; } @@ -782,7 +777,7 @@ TkMacOSXDrawButton( ButtonContentDrawCB(&contHIRec, mbPtr->btnkind, &mbPtr->drawinfo, (MacButton *) mbPtr, 32, true); } else { - if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) { return; } @@ -810,10 +805,10 @@ TkMacOSXDrawButton( static void ButtonBackgroundDrawCB( - const HIRect *btnbounds, + TCL_UNUSED(const HIRect *), MacButton *ptr, - SInt16 depth, - Boolean isColorDev) + TCL_UNUSED(SInt16), + TCL_UNUSED(Boolean)) { MacButton *mbPtr = (MacButton *) ptr; TkButton *butPtr = (TkButton *) mbPtr; @@ -862,12 +857,12 @@ ButtonBackgroundDrawCB( */ static void ButtonContentDrawCB ( - const HIRect * btnbounds, - ThemeButtonKind kind, - const HIThemeButtonDrawInfo *drawinfo, + TCL_UNUSED(const HIRect *), + TCL_UNUSED(ThemeButtonKind), + TCL_UNUSED(const HIThemeButtonDrawInfo *), MacButton *ptr, - SInt16 depth, - Boolean isColorDev) + TCL_UNUSED(SInt16), + TCL_UNUSED(Boolean)) { TkButton *butPtr = (TkButton *) ptr; Tk_Window tkwin = butPtr->tkwin; diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index be1f16c..bae2b89 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -177,7 +177,7 @@ XSetSelectionOwner( Display *display, /* X Display. */ Atom selection, /* What selection to own. */ Window owner, /* Window to be the owner. */ - Time time) /* The current time? */ + TCL_UNUSED(Time)) /* The current time? */ { TkDisplay *dispPtr = TkGetDisplayList(); @@ -237,8 +237,8 @@ TkMacOSXSelDeadWindow( void TkSelUpdateClipboard( - TkWindow *winPtr, /* Window associated with clipboard. */ - TkClipboardTarget *targetPtr) + TCL_UNUSED(TkWindow *), /* Window associated with clipboard. */ + TCL_UNUSED(TkClipboardTarget *)) /* Info about the content. */ { NSPasteboard *pb = [NSPasteboard generalPasteboard]; @@ -294,7 +294,7 @@ TkSelEventProc( void TkSelPropProc( - XEvent *eventPtr) /* X PropertyChange event. */ + TCL_UNUSED(XEvent *)) /* X PropertyChange event. */ { } diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index ce91520..208fc8b 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -23,6 +23,7 @@ static Tcl_HashTable systemColors; static int numSystemColors; static int rgbColorIndex; static int controlAccentIndex; +static int selectedTabTextIndex; static Bool useFakeAccentColor = NO; static SystemColorDatum **systemColorIndex; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 @@ -35,18 +36,25 @@ static CGFloat windowBackground[4] = void initColorTable() { + NSAutoreleasePool *pool = [NSAutoreleasePool new]; Tcl_InitHashTable(&systemColors, TCL_STRING_KEYS); SystemColorDatum *entry, *oldEntry; Tcl_HashSearch search; Tcl_HashEntry *hPtr; int newPtr, index = 0; + NSColorList *systemColorList = [NSColorList colorListNamed:@"System"]; + NSString *key; + #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - darkAqua = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; - lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; + if (@available(macOS 10.14, *)) { + darkAqua = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; + lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; + } #endif /* * Build a hash table for looking up a color by its name. + * First add all of the static entries from tkMacOSXColor.h */ for (entry = systemColorData; entry->name != NULL; entry++) { @@ -59,7 +67,7 @@ void initColorTable() if (![NSColor respondsToSelector:colorSelector]) { if ([colorName isEqualToString:@"controlAccentColor"]) { useFakeAccentColor = YES; - } else { + } else if (![colorName isEqualToString:@"selectedTabTextColor"]) { /* Uncomment to print all unsupported colors: */ /* printf("Unsupported color %s\n", colorName.UTF8String); */ continue; @@ -78,6 +86,40 @@ void initColorTable() } /* + * Add all of the colors in the System ColorList. + */ + + for (key in [systemColorList allKeys]) { + int length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + char *name; + entry = ckalloc(sizeof(SystemColorDatum)); + bzero(entry, sizeof(SystemColorDatum)); + name = ckalloc(length + 1); + strcpy(name, key.UTF8String); + name[0] = toupper(name[0]); + if (!strcmp(name, "WindowBackgroundColor")) { + + /* + * Avoid black windows on old systems. + */ + + continue; + } + entry->type=semantic; + entry->name = name; + entry->selector = [key retain]; + hPtr = Tcl_CreateHashEntry(&systemColors, entry->name, &newPtr); + if (newPtr == 0) { + oldEntry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); + entry->index = oldEntry->index; + [oldEntry->selector release]; + } else { + entry->index = index++; + } + Tcl_SetHashValue(hPtr, entry); + } + + /* * Build an array for looking up a color by its index. */ @@ -102,6 +144,10 @@ void initColorTable() hPtr = Tcl_FindHashEntry(&systemColors, "ControlAccentColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); controlAccentIndex = entry->index; + hPtr = Tcl_FindHashEntry(&systemColors, "SelectedTabTextColor"); + entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); + selectedTabTextIndex = entry->index; + [pool drain]; } /* @@ -191,7 +237,7 @@ GetEntryFromPixel( unsigned long pixel) { MacPixel p; - unsigned int index = rgbColorIndex; + int index = rgbColorIndex; p.ulong = pixel; if (p.pixel.colortype != rgbColor) { @@ -208,7 +254,7 @@ GetEntryFromPixel( /* *---------------------------------------------------------------------- * - * GetRGB -- + * GetRGBA -- * * Given a SystemColorDatum and a pointer to an array of 4 CGFloats, store * the associated RGBA color values in the array. In the case of the @@ -269,9 +315,15 @@ GetRGBA( break; case semantic: if (entry->index == controlAccentIndex && useFakeAccentColor) { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 101500 - color = [NSColor colorForControlTint: [NSColor currentControlTint]]; +#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400 + color = [[NSColor colorForControlTint: [NSColor currentControlTint]] + colorUsingColorSpace:sRGB]; #endif + } else if (entry->index == selectedTabTextIndex) { + int OSVersion = [NSApp macOSVersion]; + if (OSVersion > 100600 && OSVersion < 110000) { + color = [[NSColor whiteColor] colorUsingColorSpace:sRGB]; + } } else { color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB]; } @@ -375,25 +427,24 @@ SetCGColorComponents( MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin) { - int result = false; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - - if ([NSApp macOSVersion] >= 101400) { + if (@available(macOS 10.14, *)) { TkWindow *winPtr = (TkWindow*) tkwin; + NSAppearanceName name; NSView *view = nil; if (winPtr && winPtr->privatePtr) { - view = TkMacOSXDrawableView(winPtr->privatePtr); + view = TkMacOSXGetNSViewForDrawable((Drawable)winPtr->privatePtr); } if (view) { - result = (view.effectiveAppearance.name == NSAppearanceNameDarkAqua); + name = [[view effectiveAppearance] name]; } else { - result = ([NSAppearance currentAppearance].name == NSAppearanceNameDarkAqua); + name = [[NSAppearance currentAppearance] name]; } + return (name == NSAppearanceNameDarkAqua); } #endif - - return result; + return false; } /* @@ -681,6 +732,7 @@ TkpGetColor( TkColor *tkColPtr; XColor color; Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap; + NSView *view = nil; static Bool initialized = NO; static NSColorSpace* sRGB = NULL; @@ -691,6 +743,8 @@ TkpGetColor( } if (tkwin) { display = Tk_Display(tkwin); + Drawable d = Tk_WindowId(tkwin); + view = TkMacOSXGetNSViewForDrawable(d); } /* @@ -711,18 +765,23 @@ TkpGetColor( if (entry->type == semantic) { CGFloat rgba[4]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - NSAppearance *savedAppearance = [NSAppearance currentAppearance]; - NSAppearance *windowAppearance; - if (TkMacOSXInDarkMode(tkwin)) { - windowAppearance = darkAqua; - colormap = darkColormap; + if (@available(macOS 10.14, *)) { + NSAppearance *savedAppearance = [NSAppearance currentAppearance]; + NSAppearance *windowAppearance = savedAppearance; + if (view) { + windowAppearance = [view effectiveAppearance]; + } + if ([windowAppearance name] == NSAppearanceNameDarkAqua) { + colormap = darkColormap; + } else { + colormap = lightColormap; + } + [NSAppearance setCurrentAppearance:windowAppearance]; + GetRGBA(entry, p.ulong, rgba); + [NSAppearance setCurrentAppearance:savedAppearance]; } else { - windowAppearance = lightAqua; - colormap = lightColormap; + GetRGBA(entry, p.ulong, rgba); } - [NSAppearance setCurrentAppearance:windowAppearance]; - GetRGBA(entry, p.ulong, rgba); - [NSAppearance setCurrentAppearance:savedAppearance]; #else GetRGBA(entry, p.ulong, rgba); #endif @@ -756,7 +815,7 @@ TkpGetColor( } validXColor: - tkColPtr = ckalloc(sizeof(TkColor)); + tkColPtr = (TkColor *)ckalloc(sizeof(TkColor)); tkColPtr->colormap = colormap; tkColPtr->color = color; return tkColPtr; @@ -786,11 +845,11 @@ validXColor: TkColor * TkpGetColorByValue( - Tk_Window tkwin, /* Window in which color will be used. */ + TCL_UNUSED(Tk_Window), /* Window in which color will be used. */ XColor *colorPtr) /* Red, green, and blue fields indicate * desired color. */ { - TkColor *tkColPtr = ckalloc(sizeof(TkColor)); + TkColor *tkColPtr = (TkColor *)ckalloc(sizeof(TkColor)); tkColPtr->color.red = colorPtr->red; tkColPtr->color.green = colorPtr->green; @@ -819,7 +878,7 @@ TkpGetColorByValue( Status XAllocColor( Display *display, /* Display. */ - Colormap map, /* Not used. */ + TCL_UNUSED(Colormap), /* Not used. */ XColor *colorPtr) /* XColor struct to modify. */ { display->request++; @@ -829,10 +888,10 @@ XAllocColor( Colormap XCreateColormap( - Display *display, /* Display. */ - Window window, /* X window. */ - Visual *visual, /* Not used. */ - int alloc) /* Not used. */ + TCL_UNUSED(Display *), /* Display. */ + TCL_UNUSED(Window), /* X window. */ + TCL_UNUSED(Visual *), /* Not used. */ + TCL_UNUSED(int)) /* Not used. */ { static Colormap index = 16; @@ -845,19 +904,19 @@ XCreateColormap( int XFreeColormap( - Display* display, /* Display. */ - Colormap colormap) /* Colormap. */ + TCL_UNUSED(Display *), /* Display. */ + TCL_UNUSED(Colormap)) /* Colormap. */ { return Success; } int XFreeColors( - Display* display, /* Display. */ - Colormap colormap, /* Colormap. */ - unsigned long* pixels, /* Array of pixels. */ - int npixels, /* Number of pixels. */ - unsigned long planes) /* Number of pixel planes. */ + TCL_UNUSED(Display *), /* Display. */ + TCL_UNUSED(Colormap), /* Colormap. */ + TCL_UNUSED(unsigned long *), /* Array of pixels. */ + TCL_UNUSED(int), /* Number of pixels. */ + TCL_UNUSED(unsigned long)) /* Number of pixel planes. */ { /* * Nothing needs to be done to release colors as there really is no diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h index 82c88c9..e27500d 100644 --- a/macosx/tkMacOSXColor.h +++ b/macosx/tkMacOSXColor.h @@ -6,7 +6,7 @@ * colors in a GC are unsigned longs. These are meant to be used as indexes * into a table of XColors, where an XColor is declared in Xlib.h as: * typedef struct { - * unsigned long pixel; + * unsigned long pixel; * unsigned short red, green, blue; * char flags; * char pad; @@ -48,7 +48,7 @@ typedef struct xpixel_t { unsigned value: 24; /* Either RGB or an index into systemColorMap. */ unsigned colortype: 8; } xpixel; - + typedef union MacPixel_t { unsigned long ulong; xpixel pixel; @@ -64,17 +64,17 @@ enum macColormap { lightColormap, darkColormap, }; - + /* * In TkMacOSXColor.c a Tk hash table is constructed from the static data * below to map system color names to CGColors. - */ + */ typedef struct { const char *name; enum colorType type; int value; - char *macName; + const char *macName; /* Fields below are filled in after or during construction of the hash table. */ int index; NSString *selector; @@ -88,181 +88,168 @@ typedef struct { */ static SystemColorDatum systemColorData[] = { -{"Pixel", rgbColor, 0 }, -{"Transparent", clearColor, 0 }, +{"Pixel", rgbColor, 0, NULL, 0, NULL }, +{"Transparent", clearColor, 0, NULL, 0, NULL }, -{"Highlight", HIBrush, kThemeBrushPrimaryHighlightColor }, -{"HighlightSecondary", HIBrush, kThemeBrushSecondaryHighlightColor }, -{"HighlightText", HIBrush, kThemeBrushBlack }, -{"HighlightAlternate", HIBrush, kThemeBrushAlternatePrimaryHighlightColor }, -{"PrimaryHighlightColor", HIBrush, kThemeBrushPrimaryHighlightColor }, -{"ButtonFace", HIBrush, kThemeBrushButtonFaceActive }, -{"SecondaryHighlightColor", HIBrush, kThemeBrushSecondaryHighlightColor }, -{"ButtonFrame", HIBrush, kThemeBrushButtonFrameActive }, -{"AlternatePrimaryHighlightColor", HIBrush, kThemeBrushAlternatePrimaryHighlightColor }, -{"WindowBody", HIBrush, kThemeBrushDocumentWindowBackground }, -{"SheetBackground", HIBrush, kThemeBrushSheetBackground }, -{"MenuActive", HIBrush, kThemeBrushMenuBackgroundSelected }, -{"Menu", HIBrush, kThemeBrushMenuBackground }, -{"DialogBackgroundInactive", HIBrush, kThemeBrushDialogBackgroundInactive }, -{"DialogBackgroundActive", HIBrush, kThemeBrushDialogBackgroundActive }, -{"AlertBackgroundActive", HIBrush, kThemeBrushAlertBackgroundActive }, -{"AlertBackgroundInactive", HIBrush, kThemeBrushAlertBackgroundInactive }, -{"ModelessDialogBackgroundActive", HIBrush, kThemeBrushModelessDialogBackgroundActive }, -{"ModelessDialogBackgroundInactive", HIBrush, kThemeBrushModelessDialogBackgroundInactive }, -{"UtilityWindowBackgroundActive", HIBrush, kThemeBrushUtilityWindowBackgroundActive }, -{"UtilityWindowBackgroundInactive", HIBrush, kThemeBrushUtilityWindowBackgroundInactive }, -{"ListViewSortColumnBackground", HIBrush, kThemeBrushListViewSortColumnBackground }, -{"ListViewBackground", HIBrush, kThemeBrushListViewBackground }, -{"IconLabelBackground", HIBrush, kThemeBrushIconLabelBackground }, -{"ListViewSeparator", HIBrush, kThemeBrushListViewSeparator }, -{"ChasingArrows", HIBrush, kThemeBrushChasingArrows }, -{"DragHilite", HIBrush, kThemeBrushDragHilite }, -{"DocumentWindowBackground", HIBrush, kThemeBrushDocumentWindowBackground }, -{"FinderWindowBackground", HIBrush, kThemeBrushFinderWindowBackground }, -{"ScrollBarDelimiterActive", HIBrush, kThemeBrushScrollBarDelimiterActive }, -{"ScrollBarDelimiterInactive", HIBrush, kThemeBrushScrollBarDelimiterInactive }, -{"FocusHighlight", HIBrush, kThemeBrushFocusHighlight }, -{"PopupArrowActive", HIBrush, kThemeBrushPopupArrowActive }, -{"PopupArrowPressed", HIBrush, kThemeBrushPopupArrowPressed }, -{"PopupArrowInactive", HIBrush, kThemeBrushPopupArrowInactive }, -{"AppleGuideCoachmark", HIBrush, kThemeBrushAppleGuideCoachmark }, -{"IconLabelBackgroundSelected", HIBrush, kThemeBrushIconLabelBackgroundSelected }, -{"StaticAreaFill", HIBrush, kThemeBrushStaticAreaFill }, -{"ActiveAreaFill", HIBrush, kThemeBrushActiveAreaFill }, -{"ButtonFrameActive", HIBrush, kThemeBrushButtonFrameActive }, -{"ButtonFrameInactive", HIBrush, kThemeBrushButtonFrameInactive }, -{"ButtonFaceActive", HIBrush, kThemeBrushButtonFaceActive }, -{"ButtonFaceInactive", HIBrush, kThemeBrushButtonFaceInactive }, -{"ButtonFacePressed", HIBrush, kThemeBrushButtonFacePressed }, -{"ButtonActiveDarkShadow", HIBrush, kThemeBrushButtonActiveDarkShadow }, -{"ButtonActiveDarkHighlight", HIBrush, kThemeBrushButtonActiveDarkHighlight }, -{"ButtonActiveLightShadow", HIBrush, kThemeBrushButtonActiveLightShadow }, -{"ButtonActiveLightHighlight", HIBrush, kThemeBrushButtonActiveLightHighlight }, -{"ButtonInactiveDarkShadow", HIBrush, kThemeBrushButtonInactiveDarkShadow }, -{"ButtonInactiveDarkHighlight", HIBrush, kThemeBrushButtonInactiveDarkHighlight }, -{"ButtonInactiveLightShadow", HIBrush, kThemeBrushButtonInactiveLightShadow }, -{"ButtonInactiveLightHighlight", HIBrush, kThemeBrushButtonInactiveLightHighlight }, -{"ButtonPressedDarkShadow", HIBrush, kThemeBrushButtonPressedDarkShadow }, -{"ButtonPressedDarkHighlight", HIBrush, kThemeBrushButtonPressedDarkHighlight }, -{"ButtonPressedLightShadow", HIBrush, kThemeBrushButtonPressedLightShadow }, -{"ButtonPressedLightHighlight", HIBrush, kThemeBrushButtonPressedLightHighlight }, -{"BevelActiveLight", HIBrush, kThemeBrushBevelActiveLight }, -{"BevelActiveDark", HIBrush, kThemeBrushBevelActiveDark }, -{"BevelInactiveLight", HIBrush, kThemeBrushBevelInactiveLight }, -{"BevelInactiveDark", HIBrush, kThemeBrushBevelInactiveDark }, -{"NotificationWindowBackground", HIBrush, kThemeBrushNotificationWindowBackground }, -{"MovableModalBackground", HIBrush, kThemeBrushMovableModalBackground }, -{"SheetBackgroundOpaque", HIBrush, kThemeBrushSheetBackgroundOpaque }, -{"DrawerBackground", HIBrush, kThemeBrushDrawerBackground }, -{"ToolbarBackground", HIBrush, kThemeBrushToolbarBackground }, -{"SheetBackgroundTransparent", HIBrush, kThemeBrushSheetBackgroundTransparent }, -{"MenuBackground", HIBrush, kThemeBrushMenuBackground }, -{"MenuBackgroundSelected", HIBrush, kThemeBrushMenuBackgroundSelected }, -{"ListViewOddRowBackground", HIBrush, kThemeBrushListViewOddRowBackground }, -{"ListViewEvenRowBackground", HIBrush, kThemeBrushListViewEvenRowBackground }, -{"ListViewColumnDivider", HIBrush, kThemeBrushListViewColumnDivider }, +{"Highlight", HIBrush, kThemeBrushPrimaryHighlightColor, NULL, 0, NULL }, +{"HighlightSecondary", HIBrush, kThemeBrushSecondaryHighlightColor, NULL, 0, NULL }, +{"HighlightText", HIBrush, kThemeBrushBlack, NULL, 0, NULL }, +{"HighlightAlternate", HIBrush, kThemeBrushAlternatePrimaryHighlightColor, NULL, 0, NULL }, +{"PrimaryHighlightColor", HIBrush, kThemeBrushPrimaryHighlightColor, NULL, 0, NULL }, +{"ButtonFace", HIBrush, kThemeBrushButtonFaceActive, NULL, 0, NULL }, +{"SecondaryHighlightColor", HIBrush, kThemeBrushSecondaryHighlightColor, NULL, 0, NULL }, +{"ButtonFrame", HIBrush, kThemeBrushButtonFrameActive, NULL, 0, NULL }, +{"AlternatePrimaryHighlightColor", HIBrush, kThemeBrushAlternatePrimaryHighlightColor, NULL, 0, NULL }, +{"WindowBody", HIBrush, kThemeBrushDocumentWindowBackground, NULL, 0, NULL }, +{"SheetBackground", HIBrush, kThemeBrushSheetBackground, NULL, 0, NULL }, +{"MenuActive", HIBrush, kThemeBrushMenuBackgroundSelected, NULL, 0, NULL }, +{"Menu", HIBrush, kThemeBrushMenuBackground, NULL, 0, NULL }, +{"DialogBackgroundInactive", HIBrush, kThemeBrushDialogBackgroundInactive, NULL, 0, NULL }, +{"DialogBackgroundActive", HIBrush, kThemeBrushDialogBackgroundActive, NULL, 0, NULL }, +{"AlertBackgroundActive", HIBrush, kThemeBrushAlertBackgroundActive, NULL, 0, NULL }, +{"AlertBackgroundInactive", HIBrush, kThemeBrushAlertBackgroundInactive, NULL, 0, NULL }, +{"ModelessDialogBackgroundActive", HIBrush, kThemeBrushModelessDialogBackgroundActive, NULL, 0, NULL }, +{"ModelessDialogBackgroundInactive", HIBrush, kThemeBrushModelessDialogBackgroundInactive, NULL, 0, NULL }, +{"UtilityWindowBackgroundActive", HIBrush, kThemeBrushUtilityWindowBackgroundActive, NULL, 0, NULL }, +{"UtilityWindowBackgroundInactive", HIBrush, kThemeBrushUtilityWindowBackgroundInactive, NULL, 0, NULL }, +{"ListViewSortColumnBackground", HIBrush, kThemeBrushListViewSortColumnBackground, NULL, 0, NULL }, +{"ListViewBackground", HIBrush, kThemeBrushListViewBackground, NULL, 0, NULL }, +{"IconLabelBackground", HIBrush, kThemeBrushIconLabelBackground, NULL, 0, NULL }, +{"ListViewSeparator", HIBrush, kThemeBrushListViewSeparator, NULL, 0, NULL }, +{"ChasingArrows", HIBrush, kThemeBrushChasingArrows, NULL, 0, NULL }, +{"DragHilite", HIBrush, kThemeBrushDragHilite, NULL, 0, NULL }, +{"DocumentWindowBackground", HIBrush, kThemeBrushDocumentWindowBackground, NULL, 0, NULL }, +{"FinderWindowBackground", HIBrush, kThemeBrushFinderWindowBackground, NULL, 0, NULL }, +{"ScrollBarDelimiterActive", HIBrush, kThemeBrushScrollBarDelimiterActive, NULL, 0, NULL }, +{"ScrollBarDelimiterInactive", HIBrush, kThemeBrushScrollBarDelimiterInactive, NULL, 0, NULL }, +{"FocusHighlight", HIBrush, kThemeBrushFocusHighlight, NULL, 0, NULL }, +{"PopupArrowActive", HIBrush, kThemeBrushPopupArrowActive, NULL, 0, NULL }, +{"PopupArrowPressed", HIBrush, kThemeBrushPopupArrowPressed, NULL, 0, NULL }, +{"PopupArrowInactive", HIBrush, kThemeBrushPopupArrowInactive, NULL, 0, NULL }, +{"AppleGuideCoachmark", HIBrush, kThemeBrushAppleGuideCoachmark, NULL, 0, NULL }, +{"IconLabelBackgroundSelected", HIBrush, kThemeBrushIconLabelBackgroundSelected, NULL, 0, NULL }, +{"StaticAreaFill", HIBrush, kThemeBrushStaticAreaFill, NULL, 0, NULL }, +{"ActiveAreaFill", HIBrush, kThemeBrushActiveAreaFill, NULL, 0, NULL }, +{"ButtonFrameActive", HIBrush, kThemeBrushButtonFrameActive, NULL, 0, NULL }, +{"ButtonFrameInactive", HIBrush, kThemeBrushButtonFrameInactive, NULL, 0, NULL }, +{"ButtonFaceActive", HIBrush, kThemeBrushButtonFaceActive, NULL, 0, NULL }, +{"ButtonFaceInactive", HIBrush, kThemeBrushButtonFaceInactive, NULL, 0, NULL }, +{"ButtonFacePressed", HIBrush, kThemeBrushButtonFacePressed, NULL, 0, NULL }, +{"ButtonActiveDarkShadow", HIBrush, kThemeBrushButtonActiveDarkShadow, NULL, 0, NULL }, +{"ButtonActiveDarkHighlight", HIBrush, kThemeBrushButtonActiveDarkHighlight, NULL, 0, NULL }, +{"ButtonActiveLightShadow", HIBrush, kThemeBrushButtonActiveLightShadow, NULL, 0, NULL }, +{"ButtonActiveLightHighlight", HIBrush, kThemeBrushButtonActiveLightHighlight, NULL, 0, NULL }, +{"ButtonInactiveDarkShadow", HIBrush, kThemeBrushButtonInactiveDarkShadow, NULL, 0, NULL }, +{"ButtonInactiveDarkHighlight", HIBrush, kThemeBrushButtonInactiveDarkHighlight, NULL, 0, NULL }, +{"ButtonInactiveLightShadow", HIBrush, kThemeBrushButtonInactiveLightShadow, NULL, 0, NULL }, +{"ButtonInactiveLightHighlight", HIBrush, kThemeBrushButtonInactiveLightHighlight, NULL, 0, NULL }, +{"ButtonPressedDarkShadow", HIBrush, kThemeBrushButtonPressedDarkShadow, NULL, 0, NULL }, +{"ButtonPressedDarkHighlight", HIBrush, kThemeBrushButtonPressedDarkHighlight, NULL, 0, NULL }, +{"ButtonPressedLightShadow", HIBrush, kThemeBrushButtonPressedLightShadow, NULL, 0, NULL }, +{"ButtonPressedLightHighlight", HIBrush, kThemeBrushButtonPressedLightHighlight, NULL, 0, NULL }, +{"BevelActiveLight", HIBrush, kThemeBrushBevelActiveLight, NULL, 0, NULL }, +{"BevelActiveDark", HIBrush, kThemeBrushBevelActiveDark, NULL, 0, NULL }, +{"BevelInactiveLight", HIBrush, kThemeBrushBevelInactiveLight, NULL, 0, NULL }, +{"BevelInactiveDark", HIBrush, kThemeBrushBevelInactiveDark, NULL, 0, NULL }, +{"NotificationWindowBackground", HIBrush, kThemeBrushNotificationWindowBackground, NULL, 0, NULL }, +{"MovableModalBackground", HIBrush, kThemeBrushMovableModalBackground, NULL, 0, NULL }, +{"SheetBackgroundOpaque", HIBrush, kThemeBrushSheetBackgroundOpaque, NULL, 0, NULL }, +{"DrawerBackground", HIBrush, kThemeBrushDrawerBackground, NULL, 0, NULL }, +{"ToolbarBackground", HIBrush, kThemeBrushToolbarBackground, NULL, 0, NULL }, +{"SheetBackgroundTransparent", HIBrush, kThemeBrushSheetBackgroundTransparent, NULL, 0, NULL }, +{"MenuBackground", HIBrush, kThemeBrushMenuBackground, NULL, 0, NULL }, +{"MenuBackgroundSelected", HIBrush, kThemeBrushMenuBackgroundSelected, NULL, 0, NULL }, +{"ListViewOddRowBackground", HIBrush, kThemeBrushListViewOddRowBackground, NULL, 0, NULL }, +{"ListViewEvenRowBackground", HIBrush, kThemeBrushListViewEvenRowBackground, NULL, 0, NULL }, +{"ListViewColumnDivider", HIBrush, kThemeBrushListViewColumnDivider, NULL, 0, NULL }, -{"ButtonText", HIText, kThemeTextColorPushButtonActive }, -{"MenuActiveText", HIText, kThemeTextColorMenuItemSelected }, -{"MenuDisabled", HIText, kThemeTextColorMenuItemDisabled }, -{"MenuText", HIText, kThemeTextColorMenuItemActive }, -{"BlackText", HIText, kThemeTextColorBlack }, -{"DialogActiveText", HIText, kThemeTextColorDialogActive }, -{"DialogInactiveText", HIText, kThemeTextColorDialogInactive }, -{"AlertActiveText", HIText, kThemeTextColorAlertActive }, -{"AlertInactiveText", HIText, kThemeTextColorAlertInactive }, -{"ModelessDialogActiveText", HIText, kThemeTextColorModelessDialogActive }, -{"ModelessDialogInactiveText", HIText, kThemeTextColorModelessDialogInactive }, -{"WindowHeaderActiveText", HIText, kThemeTextColorWindowHeaderActive }, -{"WindowHeaderInactiveText", HIText, kThemeTextColorWindowHeaderInactive }, -{"PlacardActiveText", HIText, kThemeTextColorPlacardActive }, -{"PlacardInactiveText", HIText, kThemeTextColorPlacardInactive }, -{"PlacardPressedText", HIText, kThemeTextColorPlacardPressed }, -{"PushButtonActiveText", HIText, kThemeTextColorPushButtonActive }, -{"PushButtonInactiveText", HIText, kThemeTextColorPushButtonInactive }, -{"PushButtonPressedText", HIText, kThemeTextColorPushButtonPressed }, -{"BevelButtonActiveText", HIText, kThemeTextColorBevelButtonActive }, -{"BevelButtonInactiveText", HIText, kThemeTextColorBevelButtonInactive }, -{"BevelButtonPressedText", HIText, kThemeTextColorBevelButtonPressed }, -{"PopupButtonActiveText", HIText, kThemeTextColorPopupButtonActive }, -{"PopupButtonInactiveText", HIText, kThemeTextColorPopupButtonInactive }, -{"PopupButtonPressedText", HIText, kThemeTextColorPopupButtonPressed }, -{"IconLabelText", HIText, kThemeTextColorIconLabel }, -{"ListViewText", HIText, kThemeTextColorListView }, -{"DocumentWindowTitleActiveText", HIText, kThemeTextColorDocumentWindowTitleActive }, -{"DocumentWindowTitleInactiveText", HIText, kThemeTextColorDocumentWindowTitleInactive }, -{"MovableModalWindowTitleActiveText", HIText, kThemeTextColorMovableModalWindowTitleActive }, -{"MovableModalWindowTitleInactiveText", HIText, kThemeTextColorMovableModalWindowTitleInactive }, -{"UtilityWindowTitleActiveText", HIText, kThemeTextColorUtilityWindowTitleActive }, -{"UtilityWindowTitleInactiveText", HIText, kThemeTextColorUtilityWindowTitleInactive }, -{"PopupWindowTitleActiveText", HIText, kThemeTextColorPopupWindowTitleActive }, -{"PopupWindowTitleInactiveText", HIText, kThemeTextColorPopupWindowTitleInactive }, -{"RootMenuActiveText", HIText, kThemeTextColorRootMenuActive }, -{"RootMenuSelectedText", HIText, kThemeTextColorRootMenuSelected }, -{"RootMenuDisabledText", HIText, kThemeTextColorRootMenuDisabled }, -{"MenuItemActiveText", HIText, kThemeTextColorMenuItemActive }, -{"MenuItemSelectedText", HIText, kThemeTextColorMenuItemSelected }, -{"MenuItemDisabledText", HIText, kThemeTextColorMenuItemDisabled }, -{"PopupLabelActiveText", HIText, kThemeTextColorPopupLabelActive }, -{"PopupLabelInactiveText", HIText, kThemeTextColorPopupLabelInactive }, -{"TabFrontActiveText", HIText, kThemeTextColorTabFrontActive }, -{"TabNonFrontActiveText", HIText, kThemeTextColorTabNonFrontActive }, -{"TabNonFrontPressedText", HIText, kThemeTextColorTabNonFrontPressed }, -{"TabFrontInactiveText", HIText, kThemeTextColorTabFrontInactive }, -{"TabNonFrontInactiveText", HIText, kThemeTextColorTabNonFrontInactive }, -{"IconLabelSelectedText", HIText, kThemeTextColorIconLabelSelected }, -{"BevelButtonStickyActiveText", HIText, kThemeTextColorBevelButtonStickyActive }, -{"BevelButtonStickyInactiveText", HIText, kThemeTextColorBevelButtonStickyInactive }, -{"NotificationText", HIText, kThemeTextColorNotification }, -{"SystemDetailText", HIText, kThemeTextColorSystemDetail }, -{"PlacardBackground", HIBackground, kThemeBackgroundPlacard }, -{"WindowHeaderBackground", HIBackground, kThemeBackgroundWindowHeader }, -{"ListViewWindowHeaderBackground", HIBackground, kThemeBackgroundListViewWindowHeader }, -{"MetalBackground", HIBackground, kThemeBackgroundMetal }, +{"ButtonText", HIText, kThemeTextColorPushButtonActive, NULL, 0, NULL }, +{"MenuActiveText", HIText, kThemeTextColorMenuItemSelected, NULL, 0, NULL }, +{"MenuDisabled", HIText, kThemeTextColorMenuItemDisabled, NULL, 0, NULL }, +{"MenuText", HIText, kThemeTextColorMenuItemActive, NULL, 0, NULL }, +{"BlackText", HIText, kThemeTextColorBlack, NULL, 0, NULL }, +{"DialogActiveText", HIText, kThemeTextColorDialogActive, NULL, 0, NULL }, +{"DialogInactiveText", HIText, kThemeTextColorDialogInactive, NULL, 0, NULL }, +{"AlertActiveText", HIText, kThemeTextColorAlertActive, NULL, 0, NULL }, +{"AlertInactiveText", HIText, kThemeTextColorAlertInactive, NULL, 0, NULL }, +{"ModelessDialogActiveText", HIText, kThemeTextColorModelessDialogActive, NULL, 0, NULL }, +{"ModelessDialogInactiveText", HIText, kThemeTextColorModelessDialogInactive, NULL, 0, NULL }, +{"WindowHeaderActiveText", HIText, kThemeTextColorWindowHeaderActive, NULL, 0, NULL }, +{"WindowHeaderInactiveText", HIText, kThemeTextColorWindowHeaderInactive, NULL, 0, NULL }, +{"PlacardActiveText", HIText, kThemeTextColorPlacardActive, NULL, 0, NULL }, +{"PlacardInactiveText", HIText, kThemeTextColorPlacardInactive, NULL, 0, NULL }, +{"PlacardPressedText", HIText, kThemeTextColorPlacardPressed, NULL, 0, NULL }, +{"PushButtonActiveText", HIText, kThemeTextColorPushButtonActive, NULL, 0, NULL }, +{"PushButtonInactiveText", HIText, kThemeTextColorPushButtonInactive, NULL, 0, NULL }, +{"PushButtonPressedText", HIText, kThemeTextColorPushButtonPressed, NULL, 0, NULL }, +{"BevelButtonActiveText", HIText, kThemeTextColorBevelButtonActive, NULL, 0, NULL }, +{"BevelButtonInactiveText", HIText, kThemeTextColorBevelButtonInactive, NULL, 0, NULL }, +{"BevelButtonPressedText", HIText, kThemeTextColorBevelButtonPressed, NULL, 0, NULL }, +{"PopupButtonActiveText", HIText, kThemeTextColorPopupButtonActive, NULL, 0, NULL }, +{"PopupButtonInactiveText", HIText, kThemeTextColorPopupButtonInactive, NULL, 0, NULL }, +{"PopupButtonPressedText", HIText, kThemeTextColorPopupButtonPressed, NULL, 0, NULL }, +{"IconLabelText", HIText, kThemeTextColorIconLabel, NULL, 0, NULL }, +{"ListViewText", HIText, kThemeTextColorListView, NULL, 0, NULL }, +{"DocumentWindowTitleActiveText", HIText, kThemeTextColorDocumentWindowTitleActive, NULL, 0, NULL }, +{"DocumentWindowTitleInactiveText", HIText, kThemeTextColorDocumentWindowTitleInactive, NULL, 0, NULL }, +{"MovableModalWindowTitleActiveText", HIText, kThemeTextColorMovableModalWindowTitleActive, NULL, 0, NULL }, +{"MovableModalWindowTitleInactiveText", HIText, kThemeTextColorMovableModalWindowTitleInactive, NULL, 0, NULL }, +{"UtilityWindowTitleActiveText", HIText, kThemeTextColorUtilityWindowTitleActive, NULL, 0, NULL }, +{"UtilityWindowTitleInactiveText", HIText, kThemeTextColorUtilityWindowTitleInactive, NULL, 0, NULL }, +{"PopupWindowTitleActiveText", HIText, kThemeTextColorPopupWindowTitleActive, NULL, 0, NULL }, +{"PopupWindowTitleInactiveText", HIText, kThemeTextColorPopupWindowTitleInactive, NULL, 0, NULL }, +{"RootMenuActiveText", HIText, kThemeTextColorRootMenuActive, NULL, 0, NULL }, +{"RootMenuSelectedText", HIText, kThemeTextColorRootMenuSelected, NULL, 0, NULL }, +{"RootMenuDisabledText", HIText, kThemeTextColorRootMenuDisabled, NULL, 0, NULL }, +{"MenuItemActiveText", HIText, kThemeTextColorMenuItemActive, NULL, 0, NULL }, +{"MenuItemSelectedText", HIText, kThemeTextColorMenuItemSelected, NULL, 0, NULL }, +{"MenuItemDisabledText", HIText, kThemeTextColorMenuItemDisabled, NULL, 0, NULL }, +{"PopupLabelActiveText", HIText, kThemeTextColorPopupLabelActive, NULL, 0, NULL }, +{"PopupLabelInactiveText", HIText, kThemeTextColorPopupLabelInactive, NULL, 0, NULL }, +{"TabFrontActiveText", HIText, kThemeTextColorTabFrontActive, NULL, 0, NULL }, +{"TabNonFrontActiveText", HIText, kThemeTextColorTabNonFrontActive, NULL, 0, NULL }, +{"TabNonFrontPressedText", HIText, kThemeTextColorTabNonFrontPressed, NULL, 0, NULL }, +{"TabFrontInactiveText", HIText, kThemeTextColorTabFrontInactive, NULL, 0, NULL }, +{"TabNonFrontInactiveText", HIText, kThemeTextColorTabNonFrontInactive, NULL, 0, NULL }, +{"IconLabelSelectedText", HIText, kThemeTextColorIconLabelSelected, NULL, 0, NULL }, +{"BevelButtonStickyActiveText", HIText, kThemeTextColorBevelButtonStickyActive, NULL, 0, NULL }, +{"BevelButtonStickyInactiveText", HIText, kThemeTextColorBevelButtonStickyInactive, NULL, 0, NULL }, +{"NotificationText", HIText, kThemeTextColorNotification, NULL, 0, NULL }, +{"SystemDetailText", HIText, kThemeTextColorSystemDetail, NULL, 0, NULL }, +{"PlacardBackground", HIBackground, kThemeBackgroundPlacard, NULL, 0, NULL }, +{"WindowHeaderBackground", HIBackground, kThemeBackgroundWindowHeader, NULL, 0, NULL }, +{"ListViewWindowHeaderBackground", HIBackground, kThemeBackgroundListViewWindowHeader, NULL, 0, NULL }, +{"MetalBackground", HIBackground, kThemeBackgroundMetal, NULL, 0, NULL }, -{"SecondaryGroupBoxBackground", HIBackground, kThemeBackgroundSecondaryGroupBox }, -{"TabPaneBackground", HIBackground, kThemeBackgroundTabPane }, -{"WhiteText", HIText, kThemeTextColorWhite }, -{"Black", HIBrush, kThemeBrushBlack }, -{"White", HIBrush, kThemeBrushWhite }, +{"SecondaryGroupBoxBackground", HIBackground, kThemeBackgroundSecondaryGroupBox, NULL, 0, NULL }, +{"TabPaneBackground", HIBackground, kThemeBackgroundTabPane, NULL, 0, NULL }, +{"WhiteText", HIText, kThemeTextColorWhite, NULL, 0, NULL }, +{"Black", HIBrush, kThemeBrushBlack, NULL, 0, NULL }, +{"White", HIBrush, kThemeBrushWhite, NULL, 0, NULL }, /* * Dynamic Colors */ -{"WindowBackgroundColor", ttkBackground, 0 }, -{"WindowBackgroundColor1", ttkBackground, 1 }, -{"WindowBackgroundColor2", ttkBackground, 2 }, -{"WindowBackgroundColor3", ttkBackground, 3 }, -{"WindowBackgroundColor4", ttkBackground, 4 }, -{"WindowBackgroundColor5", ttkBackground, 5 }, -{"WindowBackgroundColor6", ttkBackground, 6 }, -{"WindowBackgroundColor7", ttkBackground, 7 }, +{"WindowBackgroundColor", ttkBackground, 0, NULL, 0, NULL }, +{"WindowBackgroundColor1", ttkBackground, 1, NULL, 0, NULL }, +{"WindowBackgroundColor2", ttkBackground, 2, NULL, 0, NULL }, +{"WindowBackgroundColor3", ttkBackground, 3, NULL, 0, NULL }, +{"WindowBackgroundColor4", ttkBackground, 4, NULL, 0, NULL }, +{"WindowBackgroundColor5", ttkBackground, 5, NULL, 0, NULL }, +{"WindowBackgroundColor6", ttkBackground, 6, NULL, 0, NULL }, +{"WindowBackgroundColor7", ttkBackground, 7, NULL, 0, NULL }, /* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */ -{"SecondaryLabelColor", ttkBackground, 14 }, - -{"TextColor", semantic, 0, "textColor" }, -{"SelectedTextColor", semantic, 0, "selectedTextColor" }, -{"LabelColor", semantic, 0, "textColor"}, -{"LabelColor", semantic, 0, "labelColor"}, -{"ControlTextColor", semantic, 0, "controlTextColor" }, -{"DisabledControlTextColor", semantic, 0, "disabledControlTextColor" }, -#if MAC_OS_X_VERSION_MAX_ALLOWED > 1060 -{"SelectedTabTextColor", semantic, 0, "whiteColor" }, -#else -{"SelectedTabTextColor", semantic, 0, "blackColor" }, -#endif -{"TextBackgroundColor", semantic, 0, "textBackgroundColor" }, -{"SelectedTextBackgroundColor", semantic, 0, "selectedTextBackgroundColor" }, -{"ControlAccentColor", semantic, 0, "controlAccentColor" }, -{"LinkColor", semantic, 0, "blueColor" }, -{"LinkColor", semantic, 0, "linkColor" }, -{"PlaceholderTextColor", semantic, 0, "grayColor" }, -{"PlaceholderTextColor", semantic, 0, "placeholderTextColor" }, -{"SeparatorColor", semantic, 0, "grayColor" }, -{"SeparatorColor", semantic, 0, "separatorColor" }, -{NULL, 0, 0 } +{"SecondaryLabelColor", ttkBackground, 14, NULL, 0, NULL }, +/* Color to use for notebook tab labels -- depends on OS version. */ +{"SelectedTabTextColor", semantic, 0, "textColor", 0, NULL }, +/* Semantic colors that we simulate on older systems which don't supoort them. */ +{"ControlAccentColor", semantic, 0, "controlAccentColor", 0, NULL }, +{"LabelColor", semantic, 0, "blackColor", 0, NULL }, +{"LinkColor", semantic, 0, "blueColor", 0, NULL }, +{"PlaceholderTextColor", semantic, 0, "grayColor", 0, NULL }, +{"SeparatorColor", semantic, 0, "grayColor", 0, NULL }, +{NULL, 0, 0, NULL, 0, NULL } }; #endif diff --git a/macosx/tkMacOSXConstants.h b/macosx/tkMacOSXConstants.h index 19ffd2c..0b6ae2b 100644 --- a/macosx/tkMacOSXConstants.h +++ b/macosx/tkMacOSXConstants.h @@ -102,12 +102,18 @@ typedef NSInteger NSModalResponse; #define NSStringPboardType NSPasteboardTypeString #define NSOnState NSControlStateValueOn #define NSOffState NSControlStateValueOff -// Now we are also changing names of methods! -#define graphicsContextWithGraphicsPort graphicsContextWithCGContext #endif #if MAC_OS_X_VERSION_MIN_REQUIRED >= 110000 #define NSWindowStyleMaskTexturedBackground 0 #endif +#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000 +#define GET_NSCONTEXT(context, flip) [NSGraphicsContext \ + graphicsContextWithGraphicsPort:context flipped:flip] +#else +#define GET_NSCONTEXT(context, flip) [NSGraphicsContext \ + graphicsContextWithCGContext:context flipped:NO] +#endif + #endif diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 026439f..c2b1b15 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -198,13 +198,17 @@ getFileURL( @implementation TKApplication(TKDialog) - (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url { + (void)sender; + (void)url; return YES; } - (void)panel:(id)sender didChangeToDirectoryURL:(NSURL *)url { + (void)sender; (void)url; } - (BOOL)panel:(id)sender validateURL:(NSURL *)url error:(NSError **)outError { + (void)sender; (void)url; *outError = nil; return YES; } @@ -233,7 +237,7 @@ getFileURL( callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { - tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); + tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = resultObj; TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, @@ -271,7 +275,7 @@ getFileURL( callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { - tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); + tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = resultObj; TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, @@ -804,7 +808,7 @@ Tk_GetOpenFileObjCmd( } Tcl_IncrRefCount(cmdObj); } - callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); + callbackInfo = (FilePanelCallbackInfo *)ckalloc(sizeof(FilePanelCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = multiple; @@ -814,7 +818,7 @@ Tk_GetOpenFileObjCmd( [openpanel setDirectoryURL:fileURL]; } if (haveParentOption) { - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; @@ -913,7 +917,7 @@ Tk_GetSaveFileObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int confirmOverwrite = 1; @@ -1080,7 +1084,7 @@ Tk_GetSaveFileObjCmd( } Tcl_IncrRefCount(cmdObj); } - callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); + callbackInfo = (FilePanelCallbackInfo *)ckalloc(sizeof(FilePanelCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; @@ -1100,7 +1104,7 @@ Tk_GetSaveFileObjCmd( [savepanel setNameFieldStringValue:@""]; } if (haveParentOption) { - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; @@ -1155,7 +1159,7 @@ Tk_ChooseDirectoryObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, len, mustexist = 0; @@ -1229,7 +1233,7 @@ Tk_ChooseDirectoryObjCmd( } Tcl_IncrRefCount(cmdObj); } - callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); + callbackInfo = (FilePanelCallbackInfo *)ckalloc(sizeof(FilePanelCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; @@ -1242,10 +1246,10 @@ Tk_ChooseDirectoryObjCmd( if (!directory) { directory = @"/"; } - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; if (haveParentOption) { - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; @@ -1355,7 +1359,7 @@ TkAboutDlg(void) int TkMacOSXStandardAboutPanelObjCmd( - ClientData clientData, /* Unused. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1391,7 +1395,7 @@ Tk_MessageBoxObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, typeIndex, iconIndex, indexDefaultOption = 0; @@ -1525,11 +1529,11 @@ Tk_MessageBoxObjCmd( } Tcl_IncrRefCount(cmdObj); } - callbackInfo = ckalloc(sizeof(AlertCallbackInfo)); + callbackInfo = (AlertCallbackInfo *)ckalloc(sizeof(AlertCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->typeIndex = typeIndex; - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 @@ -1626,6 +1630,7 @@ enum FontchooserOption { - (void) changeFont: (id) sender { NSFontManager *fm = [NSFontManager sharedFontManager]; + (void)sender; if ([fm currentFontAction] == NSViaPanelFontAction) { NSFont *font = [fm convertFont:fontPanelFont]; @@ -1649,14 +1654,16 @@ enum FontchooserOption { } } -- (NSUInteger) validModesForFontPanel: (NSFontPanel *) fontPanel +- (NSUInteger) validModesForFontPanel: (NSFontPanel *)fontPanel { + (void)fontPanel; + return (NSFontPanelStandardModesMask & ~NSFontPanelAllEffectsModeMask) | NSFontPanelUnderlineEffectModeMask | NSFontPanelStrikethroughEffectModeMask; } -- (void) windowDidOrderOffScreen: (NSNotification *) notification +- (void) windowDidOrderOffScreen: (NSNotification *)notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); @@ -1714,7 +1721,7 @@ FontchooserEvent( result = Tcl_ListObjGetElements(fontchooserInterp, fcdPtr->cmdObj, &objc, &objv); if (result == TCL_OK) { - tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); + tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = fontObj; TkBackgroundEvalObjv(fontchooserInterp, objc + 1, tmpv, @@ -1756,7 +1763,7 @@ FontchooserCget( case FontchooserParent: if (fcdPtr->parent != None) { resObj = Tcl_NewStringObj( - ((TkWindow *) fcdPtr->parent)->pathName, -1); + ((TkWindow *)fcdPtr->parent)->pathName, -1); } else { resObj = Tcl_NewStringObj(".", 1); } @@ -1977,14 +1984,14 @@ static int FontchooserShowCmd( ClientData clientData, /* Main window */ Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) + TCL_UNUSED(int), + TCL_UNUSED(Tcl_Obj *const *)) { FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); if (fcdPtr->parent == None) { - fcdPtr->parent = (Tk_Window) clientData; + fcdPtr->parent = (Tk_Window)clientData; Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); } @@ -2023,10 +2030,10 @@ FontchooserShowCmd( static int FontchooserHideCmd( - ClientData clientData, /* Main window */ - Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) + TCL_UNUSED(void *), /* Main window */ + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(int), + TCL_UNUSED(Tcl_Obj *const *)) { NSFontPanel *fp = [[NSFontManager sharedFontManager] fontPanel:NO]; @@ -2125,9 +2132,9 @@ DeleteFontchooserData( MODULE_SCOPE int TkInitFontchooser( Tcl_Interp *interp, - ClientData clientData) + TCL_UNUSED(void *)) { - FontchooserData *fcdPtr = ckalloc(sizeof(FontchooserData)); + FontchooserData *fcdPtr = (FontchooserData *)ckalloc(sizeof(FontchooserData)); bzero(fcdPtr, sizeof(FontchooserData)); Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteFontchooserData, diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 645b72b..06d1810 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -1,13 +1,13 @@ /* * tkMacOSXDraw.c -- * - * This file contains functions that perform drawing to Xlib windows. Most - * of the functions simply emulate Xlib functions. + * This file contains functions that draw to windows. Many of thees + * functions emulate Xlib functions. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright 2001-2009, Apple Inc. + * Copyright (c) 2001-2009 Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright 2014 Marc Culler. + * Copyright (c) 2014-2020 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -17,7 +17,7 @@ #include "tkMacOSXDebug.h" #include "tkButton.h" -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 #define GET_CGCONTEXT [[NSGraphicsContext currentContext] CGContext] #else #define GET_CGCONTEXT [[NSGraphicsContext currentContext] graphicsPort] @@ -50,6 +50,8 @@ static unsigned long transparentColor; */ static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr); +static NSImage *CreateNSImageFromPixmap(Pixmap pixmap, int width, int height); + /* *---------------------------------------------------------------------- @@ -70,7 +72,7 @@ static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr); MODULE_SCOPE int TkMacOSXInitCGDrawing( Tcl_Interp *interp, - int enable, + TCL_UNUSED(int), int limit) { static Boolean initialized = FALSE; @@ -83,7 +85,7 @@ TkMacOSXInitCGDrawing( } if (Tcl_LinkVar(interp, "::tk::mac::CGAntialiasLimit", - (char *) &cgAntiAliasLimit, TCL_LINK_INT) != TCL_OK) { + (char *)&cgAntiAliasLimit, TCL_LINK_INT) != TCL_OK) { Tcl_ResetResult(interp); } cgAntiAliasLimit = limit; @@ -93,11 +95,11 @@ TkMacOSXInitCGDrawing( */ if (Tcl_LinkVar(interp, "::tk::mac::useThemedToplevel", - (char *) &useThemedToplevel, TCL_LINK_BOOLEAN) != TCL_OK) { + (char *)&useThemedToplevel, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::mac::useThemedFrame", - (char *) &useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) { + (char *)&useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } transparentColor = TkMacOSXClearPixel(); @@ -108,384 +110,7 @@ TkMacOSXInitCGDrawing( /* *---------------------------------------------------------------------- * - * TkMacOSXBitmapRepFromDrawableRect - * - * Extract bitmap data from a MacOSX drawable as an NSBitmapImageRep. - * - * This is only used by XGetImage, which is never called. And this - * implementation does not work correctly. Originally it relied on - * [NSBitmapImageRep initWithFocusedViewRect:view_rect] which was - * deprecated by Apple in OSX 10.14 and also required the use of other - * deprecated functions such as [NSView lockFocus]. Apple's suggested - * replacement is [NSView cacheDisplayInRect: toBitmapImageRep:] and that - * is what is being used here. However, that method only works when the - * view has a valid CGContext, and a view is only guaranteed to have a - * valid context during a call to [NSView drawRect]. To further complicate - * matters, cacheDisplayInRect calls [NSView drawRect]. Essentially it is - * asking the view to draw a subrectangle of itself into a special - * graphics context which is linked to the BitmapImageRep. But our - * implementation of [NSView drawRect] does not allow recursive calls. If - * called recursively it returns immediately without doing any drawing. - * So the bottom line is that this function either returns a NULL pointer - * or a black image. To make it useful would require a significant amount - * of rewriting of the drawRect method. Perhaps the next release of OSX - * will include some more helpful ways of doing this. - * - * Results: - * Returns an NSBitmapRep representing the image of the given rectangle of - * the given drawable. This object is retained. The caller is responsible - * for releasing it. - * - * NOTE: The x,y coordinates should be relative to a coordinate system - * with origin at the top left, as used by XImage and CGImage, not bottom - * left as used by NSView. - * - * Side effects: - * None - * - *---------------------------------------------------------------------- - */ - -NSBitmapImageRep * -TkMacOSXBitmapRepFromDrawableRect( - Drawable drawable, - int x, - int y, - unsigned int width, - unsigned int height) -{ - MacDrawable *mac_drawable = (MacDrawable *) drawable; - CGContextRef cg_context = NULL; - CGImageRef cg_image = NULL, sub_cg_image = NULL; - NSBitmapImageRep *bitmap_rep = NULL; - NSView *view = NULL; - if (mac_drawable->flags & TK_IS_PIXMAP) { - /* - * This MacDrawable is a bitmap, so its view is NULL. - */ - - CGRect image_rect = CGRectMake(x, y, width, height); - - cg_context = TkMacOSXGetCGContextForDrawable(drawable); - cg_image = CGBitmapContextCreateImage((CGContextRef) cg_context); - sub_cg_image = CGImageCreateWithImageInRect(cg_image, image_rect); - if (sub_cg_image) { - bitmap_rep = [NSBitmapImageRep alloc]; - [bitmap_rep initWithCGImage:sub_cg_image]; - } - if (cg_image) { - CGImageRelease(cg_image); - } - } else if (TkMacOSXDrawableView(mac_drawable) != NULL) { - TKContentView *tkview = (TKContentView *)view; - - /* - * Convert Tk top-left to NSView bottom-left coordinates. - */ - - int view_height = [view bounds].size.height; - NSRect view_rect = NSMakeRect(x + mac_drawable->xOff, - view_height - height - y - mac_drawable->yOff, - width, height); - - /* - * Attempt to copy from the view to a bitmapImageRep. If the view does - * not have a valid CGContext, doing this will silently corrupt memory - * and make a big mess. So, in that case, we mark the view as needing - * display and return NULL. - */ - - if (view == [NSView focusView]) { - bitmap_rep = [view bitmapImageRepForCachingDisplayInRect: view_rect]; - [bitmap_rep retain]; - [view cacheDisplayInRect:view_rect toBitmapImageRep:bitmap_rep]; - } else { - TkMacOSXDbgMsg("No CGContext - cannot copy from screen to bitmap."); - [tkview addTkDirtyRect:[tkview bounds]]; - return NULL; - } - } else { - TkMacOSXDbgMsg("Invalid source drawable"); - } - return bitmap_rep; -} - -/* - *---------------------------------------------------------------------- - * - * XCopyArea -- - * - * Copies data from one drawable to another. - * - * Results: - * None. - * - * Side effects: - * Data is moved from a window or bitmap to a second window or bitmap. - * - *---------------------------------------------------------------------- - */ - -int -XCopyArea( - Display *display, /* Display. */ - Drawable src, /* Source drawable. */ - Drawable dst, /* Destination drawable. */ - GC gc, /* GC to use. */ - int src_x, /* X & Y, width & height */ - int src_y, /* define the source rectangle */ - unsigned int width, /* that will be copied. */ - unsigned int height, - int dest_x, /* Dest X & Y on dest rect. */ - int dest_y) -{ - TkMacOSXDrawingContext dc; - MacDrawable *srcDraw = (MacDrawable *) src; - NSBitmapImageRep *bitmap_rep = NULL; - CGImageRef img = NULL; - CGRect bounds, srcRect, dstRect; - - display->request++; - if (!width || !height) { - return BadDrawable; - } - - if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { - TkMacOSXDbgMsg("Failed to setup drawing context."); - return BadDrawable; - } - - if (!dc.context) { - TkMacOSXDbgMsg("Invalid destination drawable - no context."); - return BadDrawable; - } - - if (srcDraw->flags & TK_IS_PIXMAP) { - img = TkMacOSXCreateCGImageWithDrawable(src); - } else if (TkMacOSXDrawableWindow(src)) { - bitmap_rep = TkMacOSXBitmapRepFromDrawableRect(src, - src_x, src_y, width, height); - if (bitmap_rep) { - img = [bitmap_rep CGImage]; - } - } else { - TkMacOSXDbgMsg("Invalid source drawable - neither window nor pixmap."); - } - - if (img) { - bounds = CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height); - srcRect = CGRectMake(src_x, src_y, width, height); - dstRect = CGRectMake(dest_x, dest_y, width, height); - TkMacOSXDrawCGImage(dst, gc, dc.context, img, - gc->foreground, gc->background, bounds, srcRect, dstRect); - CFRelease(img); - } else { - TkMacOSXDbgMsg("Failed to construct CGImage."); - } - - TkMacOSXRestoreDrawingContext(&dc); - return Success; -} - -/* - *---------------------------------------------------------------------- - * - * XCopyPlane -- - * - * Copies a bitmap from a source drawable to a destination drawable. The - * plane argument specifies which bit plane of the source contains the - * bitmap. Note that this implementation ignores the gc->function. - * - * Results: - * None. - * - * Side effects: - * Changes the destination drawable. - * - *---------------------------------------------------------------------- - */ - -int -XCopyPlane( - Display *display, /* Display. */ - Drawable src, /* Source drawable. */ - Drawable dst, /* Destination drawable. */ - GC gc, /* GC to use. */ - int src_x, /* X & Y, width & height */ - int src_y, /* define the source rectangle */ - unsigned int width, /* that will be copied. */ - unsigned int height, - int dest_x, /* Dest X & Y on dest rect. */ - int dest_y, - unsigned long plane) /* Which plane to copy. */ -{ - TkMacOSXDrawingContext dc; - MacDrawable *srcDraw = (MacDrawable *) src; - MacDrawable *dstDraw = (MacDrawable *) dst; - CGRect bounds, srcRect, dstRect; - display->request++; - if (!width || !height) { - /* TkMacOSXDbgMsg("Drawing of empty area requested"); */ - return BadDrawable; - } - if (plane != 1) { - Tcl_Panic("Unexpected plane specified for XCopyPlane"); - } - if (srcDraw->flags & TK_IS_PIXMAP) { - if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { - return BadDrawable; - } - - CGContextRef context = dc.context; - - if (context) { - CGImageRef img = TkMacOSXCreateCGImageWithDrawable(src); - - if (img) { - TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask; - unsigned long imageBackground = gc->background; - - if (clipPtr && clipPtr->type == TKP_CLIP_PIXMAP) { - srcRect = CGRectMake(src_x, src_y, width, height); - CGImageRef mask = TkMacOSXCreateCGImageWithDrawable( - clipPtr->value.pixmap); - CGImageRef submask = CGImageCreateWithImageInRect( - img, srcRect); - CGRect rect = CGRectMake(dest_x, dest_y, width, height); - - rect = CGRectOffset(rect, dstDraw->xOff, dstDraw->yOff); - CGContextSaveGState(context); - - /* - * Move the origin of the destination to top left. - */ - - CGContextTranslateCTM(context, - 0, rect.origin.y + CGRectGetMaxY(rect)); - CGContextScaleCTM(context, 1, -1); - - /* - * Fill with the background color, clipping to the mask. - */ - - CGContextClipToMask(context, rect, submask); - TkMacOSXSetColorInContext(gc, gc->background, dc.context); - CGContextFillRect(context, rect); - - /* - * Fill with the foreground color, clipping to the - * intersection of img and mask. - */ - - CGImageRef subimage = CGImageCreateWithImageInRect( - img, srcRect); - CGContextClipToMask(context, rect, subimage); - TkMacOSXSetColorInContext(gc, gc->foreground, context); - CGContextFillRect(context, rect); - CGContextRestoreGState(context); - CGImageRelease(img); - CGImageRelease(mask); - CGImageRelease(submask); - CGImageRelease(subimage); - } else { - bounds = CGRectMake(0, 0, - srcDraw->size.width, srcDraw->size.height); - srcRect = CGRectMake(src_x, src_y, width, height); - dstRect = CGRectMake(dest_x, dest_y, width, height); - TkMacOSXDrawCGImage(dst, gc, dc.context, img, - gc->foreground, imageBackground, bounds, - srcRect, dstRect); - CGImageRelease(img); - } - } else { - /* no image */ - TkMacOSXDbgMsg("Invalid source drawable"); - } - } else { - TkMacOSXDbgMsg("Invalid destination drawable - " - "could not get a bitmap context."); - } - TkMacOSXRestoreDrawingContext(&dc); - return Success; - } else { - /* - * Source drawable is a Window, not a Pixmap. - */ - - return XCopyArea(display, src, dst, gc, src_x, src_y, width, height, - dest_x, dest_y); - } -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXCreateCGImageWithDrawable -- - * - * Create a CGImage from the given Drawable. - * - * Results: - * CGImage, release after use. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -CGImageRef -TkMacOSXCreateCGImageWithDrawable( - Drawable drawable) -{ - CGImageRef img = NULL; - CGContextRef context = TkMacOSXGetCGContextForDrawable(drawable); - - if (context) { - img = CGBitmapContextCreateImage(context); - } - return img; -} - -/* - *---------------------------------------------------------------------- - * - * CreateNSImageWithPixmap -- - * - * Create NSImage for Pixmap. - * - * Results: - * NSImage. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -static NSImage * -CreateNSImageWithPixmap( - Pixmap pixmap, - int width, - int height) -{ - CGImageRef cgImage; - NSImage *nsImage; - NSBitmapImageRep *bitmapImageRep; - - cgImage = TkMacOSXCreateCGImageWithDrawable(pixmap); - nsImage = [[NSImage alloc] initWithSize:NSMakeSize(width, height)]; - bitmapImageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; - [nsImage addRepresentation:bitmapImageRep]; - [bitmapImageRep release]; - CFRelease(cgImage); - - return nsImage; -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXGetNSImageWithTkImage -- + * TkMacOSXGetNSImageFromTkImage -- * * Get autoreleased NSImage for Tk_Image. * @@ -499,7 +124,7 @@ CreateNSImageWithPixmap( */ NSImage * -TkMacOSXGetNSImageWithTkImage( +TkMacOSXGetNSImageFromTkImage( Display *display, Tk_Image image, int width, @@ -512,7 +137,7 @@ TkMacOSXGetNSImageWithTkImage( } pixmap = Tk_GetPixmap(display, None, width, height, 0); Tk_RedrawImage(image, 0, 0, width, height, pixmap, 0, 0); - nsImage = CreateNSImageWithPixmap(pixmap, width, height); + nsImage = CreateNSImageFromPixmap(pixmap, width, height); Tk_FreePixmap(display, pixmap); return [nsImage autorelease]; @@ -521,7 +146,7 @@ TkMacOSXGetNSImageWithTkImage( /* *---------------------------------------------------------------------- * - * TkMacOSXGetNSImageWithBitmap -- + * TkMacOSXGetNSImageFromBitmap -- * * Get autoreleased NSImage for Bitmap. * @@ -535,7 +160,7 @@ TkMacOSXGetNSImageWithTkImage( */ NSImage * -TkMacOSXGetNSImageWithBitmap( +TkMacOSXGetNSImageFromBitmap( Display *display, Pixmap bitmap, GC gc, @@ -551,7 +176,7 @@ TkMacOSXGetNSImageWithBitmap( XSetClipOrigin(display, gc, 0, 0); XCopyPlane(display, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1); gc->background = origBackground; - nsImage = CreateNSImageWithPixmap(pixmap, width, height); + nsImage = CreateNSImageFromPixmap(pixmap, width, height); Tk_FreePixmap(display, pixmap); return [nsImage autorelease]; @@ -560,6 +185,47 @@ TkMacOSXGetNSImageWithBitmap( /* *---------------------------------------------------------------------- * + * CreateNSImageFromPixmap -- + * + * Create NSImage for Pixmap. + * + * Results: + * NSImage. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static NSImage * +CreateNSImageFromPixmap( + Pixmap pixmap, + int width, + int height) +{ + CGImageRef cgImage; + NSImage *nsImage; + NSBitmapImageRep *bitmapImageRep; + CGContextRef context = TkMacOSXGetCGContextForDrawable(pixmap); + + if (context) { + cgImage = CGBitmapContextCreateImage(context); + } else { + return NULL; + } + nsImage = [[NSImage alloc] initWithSize:NSMakeSize(width, height)]; + bitmapImageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; + [nsImage addRepresentation:bitmapImageRep]; + [bitmapImageRep release]; + CFRelease(cgImage); + + return nsImage; +} + +/* + *---------------------------------------------------------------------- + * * TkMacOSXGetCGContextForDrawable -- * * Get CGContext for given Drawable, creating one if necessary. @@ -577,7 +243,7 @@ CGContextRef TkMacOSXGetCGContextForDrawable( Drawable drawable) { - MacDrawable *macDraw = (MacDrawable *) drawable; + MacDrawable *macDraw = (MacDrawable *)drawable; if (macDraw && (macDraw->flags & TK_IS_PIXMAP) && !macDraw->context) { const size_t bitsPerComponent = 8; @@ -595,7 +261,7 @@ TkMacOSXGetCGContextForDrawable( if (macDraw->flags & TK_IS_BW_PIXMAP) { bitsPerPixel = 8; - bitmapInfo = (CGBitmapInfo) kCGImageAlphaOnly; + bitmapInfo = (CGBitmapInfo)kCGImageAlphaOnly; } else { colorspace = CGColorSpaceCreateDeviceRGB(); bitsPerPixel = 32; @@ -604,7 +270,7 @@ TkMacOSXGetCGContextForDrawable( bytesPerRow = ((size_t) macDraw->size.width * bitsPerPixel + 127) >> 3 & ~15; len = macDraw->size.height * bytesPerRow; - data = ckalloc(len); + data = (char *)ckalloc(len); bzero(data, len); macDraw->context = CGBitmapContextCreate(data, macDraw->size.width, macDraw->size.height, bitsPerComponent, bytesPerRow, @@ -648,7 +314,7 @@ TkMacOSXDrawCGImage( CGRect srcBounds, CGRect dstBounds) { - MacDrawable *macDraw = (MacDrawable *) d; + MacDrawable *macDraw = (MacDrawable *)d; if (macDraw && context && image) { CGImageRef subImage = NULL; @@ -744,7 +410,7 @@ XDrawLines( int npoints, /* Number of points. */ int mode) /* Line drawing mode. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int i, lw = gc->line_width; @@ -753,7 +419,7 @@ XDrawLines( } display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { @@ -816,12 +482,12 @@ XDrawSegments( XSegment *segments, int nsegments) { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int i, lw = gc->line_width; display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { @@ -865,15 +531,15 @@ XFillPolygon( GC gc, /* Use this GC. */ XPoint *points, /* Array of points. */ int npoints, /* Number of points. */ - int shape, /* Shape to draw. */ + TCL_UNUSED(int), /* Shape to draw. */ int mode) /* Drawing mode. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int i; display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { @@ -926,7 +592,7 @@ XDrawRectangle( unsigned int width, /* Width & height of rect. */ unsigned int height) { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int lw = gc->line_width; @@ -935,7 +601,7 @@ XDrawRectangle( } display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { @@ -976,22 +642,22 @@ XDrawRectangle( *---------------------------------------------------------------------- */ -void +int XDrawRectangles( Display *display, - Drawable drawable, + Drawable d, GC gc, XRectangle *rectArr, int nRects) { - MacDrawable *macWin = (MacDrawable *) drawable; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XRectangle * rectPtr; int i, lw = gc->line_width; display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { + return BadDrawable; } if (dc.context) { CGRect rect; @@ -1009,6 +675,7 @@ XDrawRectangles( } } TkMacOSXRestoreDrawingContext(&dc); + return Success; } #endif @@ -1036,13 +703,13 @@ XFillRectangles( XRectangle *rectangles, /* Rectangle array. */ int n_rectangles) /* Number of rectangles. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XRectangle * rectPtr; int i; display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { @@ -1095,7 +762,7 @@ TkMacOSXDrawSolidBorder( TkMacOSXDrawingContext dc; CGRect outerRect, innerRect; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return; } if (dc.context) { @@ -1138,7 +805,7 @@ XDrawArc( int angle1, /* Staring angle of arc. */ int angle2) /* Extent of arc. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int lw = gc->line_width; @@ -1147,7 +814,7 @@ XDrawArc( } display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { @@ -1212,13 +879,13 @@ XDrawArcs( XArc *arcArr, int nArcs) { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XArc *arcPtr; int i, lw = gc->line_width; display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { @@ -1291,7 +958,7 @@ XFillArc( int angle1, /* Staring angle of arc. */ int angle2) /* Extent of arc. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int lw = gc->line_width; @@ -1300,7 +967,7 @@ XFillArc( } display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { @@ -1360,7 +1027,7 @@ XFillArc( *---------------------------------------------------------------------- */ -void +int XFillArcs( Display *display, Drawable d, @@ -1368,14 +1035,14 @@ XFillArcs( XArc *arcArr, int nArcs) { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XArc * arcPtr; int i, lw = gc->line_width; display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { + return BadDrawable; } if (dc.context) { CGRect rect; @@ -1423,6 +1090,7 @@ XFillArcs( } } TkMacOSXRestoreDrawingContext(&dc); + return Success; } #endif @@ -1464,15 +1132,15 @@ XMaxRequestSize( int TkScrollWindow( Tk_Window tkwin, /* The window to be scrolled. */ - GC gc, /* GC for window to be scrolled. */ + TCL_UNUSED(GC), /* GC for window to be scrolled. */ int x, int y, /* Position rectangle to be scrolled. */ int width, int height, int dx, int dy, /* Distance rectangle should be moved. */ TkRegion damageRgn) /* Region to accumulate damage in. */ { Drawable drawable = Tk_WindowId(tkwin); - MacDrawable *macDraw = (MacDrawable *) drawable; - TKContentView *view = (TKContentView *) TkMacOSXDrawableView(macDraw); + MacDrawable *macDraw = (MacDrawable *)drawable; + TKContentView *view = (TKContentView *)TkMacOSXGetNSViewForDrawable(macDraw); CGRect srcRect, dstRect; HIShapeRef dmgRgn = NULL, extraRgn = NULL; NSRect bounds, visRect, scrollSrc, scrollDst; @@ -1560,8 +1228,8 @@ TkScrollWindow( void TkMacOSXSetUpGraphicsPort( - GC gc, /* GC to apply to current port. */ - void *destPort) + TCL_UNUSED(GC), /* GC to apply to current port. */ + TCL_UNUSED(void *)) { Tcl_Panic("TkMacOSXSetUpGraphicsPort: Obsolete, no more QD!"); } @@ -1572,15 +1240,17 @@ TkMacOSXSetUpGraphicsPort( * * TkMacOSXSetUpDrawingContext -- * - * Set up a drawing context for the given drawable and GC. + * Set up a drawing context for the given drawable from an X GC. * * Results: - * Boolean indicating whether it is ok to draw; if false, drawing context - * was not setup, so do not attempt to draw and do not call + * Boolean indicating whether it is ok to draw; if false, the drawing + * context was not setup, so do not attempt to draw and do not call * TkMacOSXRestoreDrawingContext(). * * Side effects: - * None. + * May modify or create the drawable's graphics context. May expand the + * drawable's dirty rectangle. When the result is true The dcPtr + * parameter is set to reference the new or updated drawing context. * *---------------------------------------------------------------------- */ @@ -1589,26 +1259,28 @@ Bool TkMacOSXSetupDrawingContext( Drawable d, GC gc, - int useCG, /* advisory only ! */ TkMacOSXDrawingContext *dcPtr) { - MacDrawable *macDraw = (MacDrawable *) d; + MacDrawable *macDraw = (MacDrawable *)d; Bool canDraw = true; - NSWindow *win = NULL; + TKContentView *view = nil; TkMacOSXDrawingContext dc = {}; - CGRect clipBounds; /* - * If the drawable is not a pixmap and it has an associated NSWindow then - * we know we are drawing to a window. + * If the drawable is not a pixmap, get the associated NSView. */ if (!(macDraw->flags & TK_IS_PIXMAP)) { - win = TkMacOSXDrawableWindow(d); + view = (TKContentView *)TkMacOSXGetNSViewForDrawable(d); + if (!view) { + Tcl_Panic("TkMacOSXSetupDrawingContext(): " + "no NSView to draw into !"); + } } /* - * Check that we have a non-empty clipping region. + * Intersect the drawable's clipping region with the region stored in the + * X GC. If the resulting region is empty, don't do any drawing. */ dc.clipRgn = TkMacOSXGetClipRgn(d); @@ -1619,173 +1291,158 @@ TkMacOSXSetupDrawingContext( } /* - * If we already have a CGContext, use it. Otherwise, if we are drawing to - * a window then we can get one from the window. + * If the drawable already has a CGContext, use it. Otherwise, we must be + * drawing to a window and we use the current context of its ContentView. */ dc.context = TkMacOSXGetCGContextForDrawable(d); if (dc.context) { - dc.portBounds = clipBounds = CGContextGetClipBoundingBox(dc.context); - } else if (win) { - TKContentView *view = (TKContentView *)TkMacOSXDrawableView(macDraw); + dc.portBounds = CGContextGetClipBoundingBox(dc.context); + } else { + NSRect drawingBounds, currentBounds; - if (!view) { - Tcl_Panic("TkMacOSXSetupDrawingContext(): " - "no NSView to draw into !"); - } + dc.view = view; + dc.context = GET_CGCONTEXT; + dc.portBounds = NSRectToCGRect([view bounds]); if (dc.clipRgn) { + CGRect clipBounds; CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0, .ty = [view bounds].size.height}; HIShapeGetBounds(dc.clipRgn, &clipBounds); clipBounds = CGRectApplyAffineTransform(clipBounds, t); + drawingBounds = NSRectFromCGRect(clipBounds); + } else { + drawingBounds = [view bounds]; } - if (view != [NSView focusView]) { - /* - * We can only draw into the view when the current CGContext is - * valid and belongs to the view. Validity can only be guaranteed - * inside of a view's drawRect or setFrame methods. The isDrawing - * attribute tells us whether we are being called from drawRect. - * If the CGContext is not valid then we mark our view as needing - * display. - */ + /* + * We can only draw into the NSView which is the current focusView. + * When the current [NSView focusView] is nil, the CGContext for + * [NSGraphicsContext currentContext] is nil. Otherwise the current + * CGContext draws into the current focusView. An NSView is guaranteed + * to be the focusView when its drawRect or setFrame methods are + * running. Prior to OSX 10.14 it was also possible to call the + * lockFocus method to force an NSView to become the current focusView. + * But that method was deprecated in 10.14 and so is no longer used by + * Tk. Instead, if the view is not the current focusView then we add + * the drawing bounds to its dirty rectangle and return false. The + * part of the view inside the drawing bounds will get redrawn during + * the next call to its drawRect method. + */ - if (dc.clipRgn) { - [view addTkDirtyRect:NSRectFromCGRect(clipBounds)]; - } else { - [view addTkDirtyRect:[view bounds]]; - } + if (view != [NSView focusView]) { + [view addTkDirtyRect:drawingBounds]; canDraw = false; goto end; - } else if (dc.clipRgn) { - - /* - * Drawing will also fail if we are being called from drawRect but - * the clipping rectangle set by drawRect does not contain the - * clipping region of our drawing context. See bug [2a61eca3a8]. - * If we can't draw all of the clipping region of the drawing - * context then we draw whatever we can, but we also add a dirty - * rectangle so the entire widget will get redrawn in the next - * cycle. - */ - - CGRect currentClip = CGContextGetClipBoundingBox(GET_CGCONTEXT); - if (!NSContainsRect(currentClip, clipBounds)) { - [view addTkDirtyRect:clipBounds]; - } } - dc.view = view; - dc.context = GET_CGCONTEXT; - dc.portBounds = NSRectToCGRect([view bounds]); - if (dc.clipRgn) { - clipBounds = CGContextGetClipBoundingBox(dc.context); + /* + * Drawing will also fail when the view is the current focusView but + * the clipping rectangle set by drawRect does not contain the clipping + * region of our drawing context. (See bug [2a61eca3a8].) If part of + * the drawing bounds will be clipped then we draw whatever we can, but + * we also add the drawing bounds to the view's dirty rectangle so it + * will get redrawn in the next call to its drawRect method. + */ + + currentBounds = CGContextGetClipBoundingBox(dc.context); + if (!NSContainsRect(currentBounds, drawingBounds)) { + [view addTkDirtyRect:drawingBounds]; } - } else { - Tcl_Panic("TkMacOSXSetupDrawingContext(): " - "no context to draw into !"); } /* - * Configure the drawing context. + * Finish configuring the drawing context. */ - if (dc.context) { - CGAffineTransform t = { - .a = 1, .b = 0, - .c = 0, .d = -1, - .tx = 0, - .ty = dc.portBounds.size.height - }; + CGAffineTransform t = { + .a = 1, .b = 0, + .c = 0, .d = -1, + .tx = 0, + .ty = dc.portBounds.size.height + }; - dc.portBounds.origin.x += macDraw->xOff; - dc.portBounds.origin.y += macDraw->yOff; - CGContextSaveGState(dc.context); - CGContextSetTextDrawingMode(dc.context, kCGTextFill); - CGContextConcatCTM(dc.context, t); - if (dc.clipRgn) { + dc.portBounds.origin.x += macDraw->xOff; + dc.portBounds.origin.y += macDraw->yOff; + CGContextSaveGState(dc.context); + CGContextSetTextDrawingMode(dc.context, kCGTextFill); + CGContextConcatCTM(dc.context, t); + if (dc.clipRgn) { #ifdef TK_MAC_DEBUG_DRAWING - CGContextSaveGState(dc.context); - ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); - CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1); - CGContextEOFillPath(dc.context); - CGContextRestoreGState(dc.context); + CGContextSaveGState(dc.context); + ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); + CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1); + CGContextEOFillPath(dc.context); + CGContextRestoreGState(dc.context); #endif /* TK_MAC_DEBUG_DRAWING */ - CGRect r; + CGRect r; + CGRect b = CGRectApplyAffineTransform( + CGContextGetClipBoundingBox(dc.context), t); + if (!HIShapeIsRectangular(dc.clipRgn) || + !CGRectContainsRect(*HIShapeGetBounds(dc.clipRgn, &r), b)) { + ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); + CGContextEOClip(dc.context); + } + } + if (gc) { + static const CGLineCap cgCap[] = { + [CapNotLast] = kCGLineCapButt, + [CapButt] = kCGLineCapButt, + [CapRound] = kCGLineCapRound, + [CapProjecting] = kCGLineCapSquare, + }; + static const CGLineJoin cgJoin[] = { + [JoinMiter] = kCGLineJoinMiter, + [JoinRound] = kCGLineJoinRound, + [JoinBevel] = kCGLineJoinBevel, + }; + bool shouldAntialias = !notAA(gc->line_width); + double w = gc->line_width; - if (!HIShapeIsRectangular(dc.clipRgn) || !CGRectContainsRect( - *HIShapeGetBounds(dc.clipRgn, &r), - CGRectApplyAffineTransform(clipBounds, t))) { - ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); - CGContextEOClip(dc.context); - } + TkMacOSXSetColorInContext(gc, gc->foreground, dc.context); + if (view) { + CGContextSetPatternPhase(dc.context, CGSizeMake( + dc.portBounds.size.width, dc.portBounds.size.height)); } - if (gc) { - static const CGLineCap cgCap[] = { - [CapNotLast] = kCGLineCapButt, - [CapButt] = kCGLineCapButt, - [CapRound] = kCGLineCapRound, - [CapProjecting] = kCGLineCapSquare, - }; - static const CGLineJoin cgJoin[] = { - [JoinMiter] = kCGLineJoinMiter, - [JoinRound] = kCGLineJoinRound, - [JoinBevel] = kCGLineJoinBevel, - }; - bool shouldAntialias; - double w = gc->line_width; - - TkMacOSXSetColorInContext(gc, gc->foreground, dc.context); - if (win) { - CGContextSetPatternPhase(dc.context, CGSizeMake( - dc.portBounds.size.width, dc.portBounds.size.height)); - } - if (gc->function != GXcopy) { - TkMacOSXDbgMsg("Logical functions other than GXcopy are " - "not supported for CG drawing!"); - } + if (gc->function != GXcopy) { + TkMacOSXDbgMsg("Logical functions other than GXcopy are " + "not supported for CG drawing!"); + } + if (!shouldAntialias) { /* - * When should we antialias? + * Make non-antialiased CG drawing look more like X11. */ - shouldAntialias = !notAA(gc->line_width); - if (!shouldAntialias) { - /* - * Make non-antialiased CG drawing look more like X11. - */ - - w -= (gc->line_width ? NON_AA_CG_OFFSET : 0); - } - CGContextSetShouldAntialias(dc.context, shouldAntialias); - CGContextSetLineWidth(dc.context, w); - if (gc->line_style != LineSolid) { - int num = 0; - char *p = &gc->dashes; - CGFloat dashOffset = gc->dash_offset; - dashOffset -= (gc->line_width % 2) ? 0.5 : 0.0; - CGFloat lengths[10]; - - while (p[num] != '\0' && num < 10) { - lengths[num] = p[num]; - num++; - } - CGContextSetLineDash(dc.context, dashOffset, lengths, num); - } - if ((unsigned) gc->cap_style < sizeof(cgCap)/sizeof(CGLineCap)) { - CGContextSetLineCap(dc.context, - cgCap[(unsigned) gc->cap_style]); - } - if ((unsigned)gc->join_style < sizeof(cgJoin)/sizeof(CGLineJoin)) { - CGContextSetLineJoin(dc.context, - cgJoin[(unsigned) gc->join_style]); + w -= (gc->line_width ? NON_AA_CG_OFFSET : 0); + } + CGContextSetShouldAntialias(dc.context, shouldAntialias); + CGContextSetLineWidth(dc.context, w); + if (gc->line_style != LineSolid) { + int num = 0; + char *p = &gc->dashes; + CGFloat dashOffset = gc->dash_offset; + dashOffset -= (gc->line_width % 2) ? 0.5 : 0.0; + CGFloat lengths[10]; + + while (p[num] != '\0' && num < 10) { + lengths[num] = p[num]; + num++; } + CGContextSetLineDash(dc.context, dashOffset, lengths, num); + } + if ((unsigned) gc->cap_style < sizeof(cgCap)/sizeof(CGLineCap)) { + CGContextSetLineCap(dc.context, cgCap[(unsigned) gc->cap_style]); + } + if ((unsigned)gc->join_style < sizeof(cgJoin)/sizeof(CGLineJoin)) { + CGContextSetLineJoin(dc.context, cgJoin[(unsigned) gc->join_style]); } } end: + #ifdef TK_MAC_DEBUG_DRAWING if (!canDraw && win != NULL) { TkWindow *winPtr = TkMacOSXGetTkWindow(win); @@ -1796,6 +1453,7 @@ end: } } #endif + if (!canDraw && dc.clipRgn) { CFRelease(dc.clipRgn); dc.clipRgn = NULL; @@ -1857,7 +1515,7 @@ HIShapeRef TkMacOSXGetClipRgn( Drawable drawable) /* Drawable. */ { - MacDrawable *macDraw = (MacDrawable *) drawable; + MacDrawable *macDraw = (MacDrawable *)drawable; HIShapeRef clipRgn = NULL; if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) { @@ -1865,7 +1523,7 @@ TkMacOSXGetClipRgn( #ifdef TK_MAC_DEBUG_DRAWING TkMacOSXDbgMsg("%s", macDraw->winPtr->pathName); - NSView *view = TkMacOSXDrawableView(macDraw); + NSView *view = TkMacOSXGetNSViewForDrawable(macDraw); CGContextRef context = GET_CGCONTEXT; CGContextSaveGState(context); @@ -1928,12 +1586,12 @@ TkMacOSXSetUpClippingRgn( void TkpClipDrawableToRect( - Display *display, + TCL_UNUSED(Display *), Drawable d, int x, int y, int width, int height) { - MacDrawable *macDraw = (MacDrawable *) d; + MacDrawable *macDraw = (MacDrawable *)d; if (macDraw->drawRgn) { CFRelease(macDraw->drawRgn); @@ -1980,13 +1638,13 @@ ClipToGC( HIShapeRef *clipRgnPtr) /* must point to initialized variable */ { if (gc && gc->clip_mask && - ((TkpClipMask *) gc->clip_mask)->type == TKP_CLIP_REGION) { - TkRegion gcClip = ((TkpClipMask *) gc->clip_mask)->value.region; - int xOffset = ((MacDrawable *) d)->xOff + gc->clip_x_origin; - int yOffset = ((MacDrawable *) d)->yOff + gc->clip_y_origin; + ((TkpClipMask *)gc->clip_mask)->type == TKP_CLIP_REGION) { + TkRegion gcClip = ((TkpClipMask *)gc->clip_mask)->value.region; + int xOffset = ((MacDrawable *)d)->xOff + gc->clip_x_origin; + int yOffset = ((MacDrawable *)d)->yOff + gc->clip_y_origin; HIShapeRef clipRgn = *clipRgnPtr, gcClipRgn; - TkMacOSXOffsetRegion(gcClip, xOffset, yOffset); + XOffsetRegion(gcClip, xOffset, yOffset); gcClipRgn = TkMacOSXGetNativeRegion(gcClip); if (clipRgn) { *clipRgnPtr = HIShapeCreateIntersection(gcClipRgn, clipRgn); @@ -1995,7 +1653,7 @@ ClipToGC( *clipRgnPtr = HIShapeCreateCopy(gcClipRgn); } CFRelease(gcClipRgn); - TkMacOSXOffsetRegion(gcClip, -xOffset, -yOffset); + XOffsetRegion(gcClip, -xOffset, -yOffset); } } @@ -2019,8 +1677,8 @@ ClipToGC( void * TkMacOSXMakeStippleMap( - Drawable drawable, /* Window to apply stipple. */ - Drawable stipple) /* The stipple pattern. */ + TCL_UNUSED(Drawable), /* Window to apply stipple. */ + TCL_UNUSED(Drawable)) /* The stipple pattern. */ { return NULL; } diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index e58cdd0..dc43726 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -446,7 +446,7 @@ TkMacOSXContainerId( for (containerPtr = firstContainerPtr; containerPtr != NULL; containerPtr = containerPtr->nextPtr) { if (containerPtr->embeddedPtr == winPtr) { - return (MacDrawable *) containerPtr->parent; + return (MacDrawable *)containerPtr->parent; } } Tcl_Panic("TkMacOSXContainerId couldn't find window"); @@ -853,7 +853,7 @@ ContainerEventProc( * Here we are following unix, by destroying the container. */ - Tk_DestroyWindow((Tk_Window) winPtr); + Tk_DestroyWindow((Tk_Window)winPtr); } Tk_DeleteErrorHandler(errHandler); } @@ -902,8 +902,8 @@ EmbedStructureProc( errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1, -1, -1, NULL, NULL); - Tk_MoveResizeWindow((Tk_Window) containerPtr->embeddedPtr, 0, 0, - (unsigned) Tk_Width((Tk_Window) containerPtr->parentPtr), + Tk_MoveResizeWindow((Tk_Window)containerPtr->embeddedPtr, 0, 0, + (unsigned) Tk_Width((Tk_Window)containerPtr->parentPtr), (unsigned) Tk_Height((Tk_Window)containerPtr->parentPtr)); Tk_DeleteErrorHandler(errHandler); } @@ -1048,7 +1048,7 @@ EmbedGeometryRequest( * if the window's size didn't change then generate a configure event. */ - Tk_GeometryRequest((Tk_Window) winPtr, width, height); + Tk_GeometryRequest((Tk_Window)winPtr, width, height); while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)) {} if ((winPtr->changes.width != width) || (winPtr->changes.height != height)) { diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c index 7915f6f..75cd198 100644 --- a/macosx/tkMacOSXEntry.c +++ b/macosx/tkMacOSXEntry.c @@ -92,7 +92,7 @@ TkpDrawEntryBorderAndFocus( GC bgGC; Tk_Window tkwin = entryPtr->tkwin; int oldWidth = 0; - MacDrawable *macDraw = (MacDrawable *) d; + MacDrawable *macDraw = (MacDrawable *)d; const HIThemeFrameDrawInfo info = { .version = 0, .kind = kHIThemeFrameTextFieldSquare, @@ -155,7 +155,7 @@ TkpDrawEntryBorderAndFocus( bounds.origin.y = macDraw->yOff + MAC_OSX_FOCUS_WIDTH; bounds.size.width = Tk_Width(tkwin) - 2*MAC_OSX_FOCUS_WIDTH; bounds.size.height = Tk_Height(tkwin) - 2*MAC_OSX_FOCUS_WIDTH; - if (!TkMacOSXSetupDrawingContext(d, NULL, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, NULL, &dc)) { /* * No graphics context is available. If the widget is a Spinbox, we @@ -208,7 +208,7 @@ TkpDrawSpinboxButtons( TkMacOSXDrawingContext dc; XRectangle rects[1]; GC bgGC; - MacDrawable *macDraw = (MacDrawable *) d; + MacDrawable *macDraw = (MacDrawable *)d; HIThemeButtonDrawInfo info = { .version = 0, .adornment = kThemeAdornmentNone, @@ -265,7 +265,7 @@ TkpDrawSpinboxButtons( rects[0].height = Tk_Height(tkwin); XFillRectangles(Tk_Display(tkwin), d, bgGC, rects, 1); - if (!TkMacOSXSetupDrawingContext(d, NULL, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(d, NULL, &dc)) { return 0; } ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 581ada1..f7b87dc 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -451,7 +451,7 @@ TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { Tcl_Interp *interp = mainPtr->interp; - Tk_Window tkwin = (Tk_Window) mainPtr->winPtr; + Tk_Window tkwin = (Tk_Window)mainPtr->winPtr; const struct SystemFontMapEntry *systemFont = systemFontMap; NSFont *nsFont; TkFontAttributes fa; @@ -1189,7 +1189,7 @@ TkpDrawAngledCharsInContext( CTTypesetterRef typesetter; CFIndex start, length; CTLineRef line, full=nil; - MacDrawable *macWin = (MacDrawable *) drawable; + MacDrawable *macWin = (MacDrawable *)drawable; TkMacOSXDrawingContext drawingContext; CGContextRef context; CGColorRef fg; @@ -1199,7 +1199,7 @@ TkpDrawAngledCharsInContext( if (rangeStart < 0 || rangeLength <= 0 || rangeStart + rangeLength > numBytes || - !TkMacOSXSetupDrawingContext(drawable, gc, 1, &drawingContext)) { + !TkMacOSXSetupDrawingContext(drawable, gc, &drawingContext)) { return; } string = [[TKNSString alloc] initWithTclUtfBytes:source length:numBytes]; @@ -1212,8 +1212,7 @@ TkpDrawAngledCharsInContext( [attributes setObject:(id)fg forKey:(id)kCTForegroundColorAttributeName]; CFRelease(fg); nsFont = [attributes objectForKey:NSFontAttributeName]; - [nsFont setInContext:[NSGraphicsContext graphicsContextWithGraphicsPort: - context flipped:NO]]; + [nsFont setInContext:GET_NSCONTEXT(context, NO)]; CGContextSetTextMatrix(context, CGAffineTransformIdentity); attributedString = [[NSAttributedString alloc] initWithString:string attributes:attributes]; diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index d15abde..88036ee 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -309,6 +309,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type, data, actual, NULL)) { + data[actual] = '\0'; AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo)); Tcl_DString *scriptTextCommand = &AEInfo->command; Tcl_DStringInit(scriptTextCommand); @@ -383,9 +384,6 @@ static void ProcessAppleEvent( } code = Tcl_EvalEx(AEInfo->interp, Tcl_DStringValue(&AEInfo->command), Tcl_DStringLength(&AEInfo->command), TCL_EVAL_GLOBAL); - if (code != TCL_OK) { - Tcl_BackgroundException(AEInfo->interp, code); - } if (AEInfo->replyEvent && code >= 0) { int reslen; @@ -400,7 +398,10 @@ static void ProcessAppleEvent( AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], keyErrorNumber, typeSInt32, (Ptr) &code, sizeof(int)); } + } else if (code != TCL_OK) { + Tcl_BackgroundException(AEInfo->interp, code); } + Tcl_DStringFree(&AEInfo->command); ckfree(clientData); } diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index 0e33b23..2604dfa 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -6,7 +6,7 @@ * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright 2017-2018 Marc Culler. + * Copyright (c) 2017-2020 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -15,6 +15,10 @@ #include "tkMacOSXPrivate.h" #include "xbytes.h" +static CGImageRef CreateCGImageFromPixmap(Drawable pixmap); +static CGImageRef CreateCGImageFromDrawableRect( Drawable drawable, + int x, int y, unsigned int width, unsigned int height); + #pragma mark XImage handling int @@ -131,141 +135,6 @@ TkMacOSXCreateCGImageWithXImage( /* *---------------------------------------------------------------------- * - * XGetImage -- - * - * This function copies data from a pixmap or window into an XImage. It - * is essentially never used. At one time it was called by - * pTkImgPhotoDisplay, but that is no longer the case. Currently it is - * called two places, one of which is requesting an XY image which we do - * not support. It probably does not work correctly -- see the comments - * for TkMacOSXBitmapRepFromDrawableRect. - * - * Results: - * Returns a newly allocated XImage containing the data from the given - * rectangle of the given drawable, or NULL if the XImage could not be - * constructed. NOTE: If we are copying from a window on a Retina - * display, the dimensions of the XImage will be 2*width x 2*height. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -struct pixel_fmt {int r; int g; int b; int a;}; -static struct pixel_fmt bgra = {2, 1, 0, 3}; -static struct pixel_fmt abgr = {3, 2, 1, 0}; - -XImage * -XGetImage( - Display *display, - Drawable drawable, - int x, - int y, - unsigned int width, - unsigned int height, - unsigned long plane_mask, - int format) -{ - NSBitmapImageRep* bitmap_rep = NULL; - NSUInteger bitmap_fmt = 0; - XImage* imagePtr = NULL; - char* bitmap = NULL; - char R, G, B, A; - int depth = 32, offset = 0, bitmap_pad = 0; - unsigned int bytes_per_row, size, row, n, m; - unsigned int scalefactor=1, scaled_height=height, scaled_width=width; - NSWindow *win = TkMacOSXDrawableWindow(drawable); - static enum {unknown, no, yes} has_retina = unknown; - - if (win && has_retina == unknown) { -#ifdef __clang__ - has_retina = [win respondsToSelector:@selector(backingScaleFactor)] ? - yes : no; -#else - has_retina = no; -#endif - } - - if (has_retina == yes) { - /* - * We only allow scale factors 1 or 2, as Apple currently does. - */ - -#ifdef __clang__ - scalefactor = [win backingScaleFactor] == 2.0 ? 2 : 1; -#endif - scaled_height *= scalefactor; - scaled_width *= scalefactor; - } - - if (format == ZPixmap) { - if (width == 0 || height == 0) { - return NULL; - } - - bitmap_rep = TkMacOSXBitmapRepFromDrawableRect(drawable, - x, y, width, height); - if (!bitmap_rep) { - TkMacOSXDbgMsg("XGetImage: Failed to construct NSBitmapRep"); - return NULL; - } - bitmap_fmt = [bitmap_rep bitmapFormat]; - size = [bitmap_rep bytesPerPlane]; - bytes_per_row = [bitmap_rep bytesPerRow]; - bitmap = ckalloc(size); - if (!bitmap - || (bitmap_fmt != 0 && bitmap_fmt != 1) - || [bitmap_rep samplesPerPixel] != 4 - || [bitmap_rep isPlanar] != 0 - || bytes_per_row < 4 * scaled_width - || size != bytes_per_row * scaled_height) { - TkMacOSXDbgMsg("XGetImage: Unrecognized bitmap format"); - CFRelease(bitmap_rep); - return NULL; - } - memcpy(bitmap, (char *)[bitmap_rep bitmapData], size); - CFRelease(bitmap_rep); - - /* - * When Apple extracts a bitmap from an NSView, it may be in either - * BGRA or ABGR format. For an XImage we need RGBA. - */ - - struct pixel_fmt pixel = bitmap_fmt == 0 ? bgra : abgr; - - for (row = 0, n = 0; row < scaled_height; row++, n += bytes_per_row) { - for (m = n; m < n + 4*scaled_width; m += 4) { - R = *(bitmap + m + pixel.r); - G = *(bitmap + m + pixel.g); - B = *(bitmap + m + pixel.b); - A = *(bitmap + m + pixel.a); - - *(bitmap + m) = R; - *(bitmap + m + 1) = G; - *(bitmap + m + 2) = B; - *(bitmap + m + 3) = A; - } - } - imagePtr = XCreateImage(display, NULL, depth, format, offset, - (char*) bitmap, scaled_width, scaled_height, - bitmap_pad, bytes_per_row); - if (scalefactor == 2) { - imagePtr->pixelpower = 1; - } - } else { - /* - * There are some calls to XGetImage in the generic Tk code which pass - * an XYPixmap rather than a ZPixmap. XYPixmaps should be handled - * here. - */ - TkMacOSXDbgMsg("XGetImage does not handle XYPixmaps at the moment."); - } - return imagePtr; -} - -/* - *---------------------------------------------------------------------- - * * DestroyImage -- * * Destroys storage associated with an image. @@ -473,13 +342,6 @@ XCreateImage( ximage->data = data; ximage->obdata = NULL; - /* - * The default pixelpower is 0. This must be explicitly set to 1 in the - * case of an XImage extracted from a Retina display. - */ - - ximage->pixelpower = 0; - if (format == ZPixmap) { ximage->bits_per_pixel = 32; ximage->bitmap_unit = 32; @@ -555,10 +417,10 @@ XPutImage( unsigned int height) /* distination and source. */ { TkMacOSXDrawingContext dc; - MacDrawable *macDraw = (MacDrawable *) drawable; + MacDrawable *macDraw = (MacDrawable *)drawable; display->request++; - if (!TkMacOSXSetupDrawingContext(drawable, gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(drawable, gc, &dc)) { return BadDrawable; } if (dc.context) { @@ -574,17 +436,8 @@ XPutImage( } if (img) { - /* - * If the XImage has big pixels, the source is rescaled to reflect - * the actual pixel dimensions. This is not currently used, but - * could arise if the image were copied from a retina monitor and - * redrawn on an ordinary monitor. - */ - - int pp = image->pixelpower; - bounds = CGRectMake(0, 0, image->width, image->height); - srcRect = CGRectMake(src_x<<pp, src_y<<pp, width<<pp, height<<pp); + srcRect = CGRectMake(src_x, src_y, width, height); dstRect = CGRectMake(dest_x, dest_y, width, height); TkMacOSXDrawCGImage(drawable, gc, dc.context, img, gc->foreground, gc->background, @@ -618,6 +471,454 @@ TkPutImage( } /* + *---------------------------------------------------------------------- + * + * CreateCGImageFromDrawableRect + * + * Extract image data from a MacOSX drawable as a CGImage. + * + * This is only called by XGetImage and XCopyArea. The Tk core uses + * these functions on some platforms, but on macOS the core does not + * call them with a source drawable which is a window. Such calls are + * used only for double-buffered drawing. Since macOS defines the + * macro TK_NO_DOUBLE_BUFFERING, the generic code never calls XGetImage + * or XCopyArea on macOS. Nonetheless, these function are in the stubs + * table and therefore could be used by extensions. + * + * This implementation does not work correctly. Originally it relied on + * [NSBitmapImageRep initWithFocusedViewRect:view_rect] which was + * deprecated by Apple in OSX 10.14 and also required the use of other + * deprecated functions such as [NSView lockFocus]. Apple's suggested + * replacement is [NSView cacheDisplayInRect: toBitmapImageRep:] and that + * is what is being used here. However, that method only works when the + * view has a valid CGContext, and a view is only guaranteed to have a + * valid context during a call to [NSView drawRect]. To further complicate + * matters, cacheDisplayInRect calls [NSView drawRect]. Essentially it is + * asking the view to draw a subrectangle of itself using a special + * graphics context which is linked to the BitmapImageRep. But our + * implementation of [NSView drawRect] does not allow recursive calls. If + * called recursively it returns immediately without doing any drawing. + * So the bottom line is that this function either returns a NULL pointer + * or a black image. To make it useful would require a significant amount + * of rewriting of the drawRect method. Perhaps the next release of OSX + * will include some more helpful ways of doing this. + * + * Results: + * Returns an NSBitmapRep representing the image of the given rectangle of + * the given drawable. This object is retained. The caller is responsible + * for releasing it. + * + * NOTE: The x,y coordinates should be relative to a coordinate system + * with origin at the top left, as used by XImage and CGImage, not bottom + * left as used by NSView. + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +static CGImageRef +CreateCGImageFromDrawableRect( + Drawable drawable, + int x, + int y, + unsigned int width, + unsigned int height) +{ + MacDrawable *mac_drawable = (MacDrawable *)drawable; + CGContextRef cg_context = NULL; + CGImageRef cg_image = NULL, result = NULL; + NSBitmapImageRep *bitmapRep = NULL; + NSView *view = NULL; + if (mac_drawable->flags & TK_IS_PIXMAP) { + /* + * This MacDrawable is a bitmap, so its view is NULL. + */ + + CGRect image_rect = CGRectMake(x, y, width, height); + + cg_context = TkMacOSXGetCGContextForDrawable(drawable); + cg_image = CGBitmapContextCreateImage((CGContextRef) cg_context); + if (cg_image) { + result = CGImageCreateWithImageInRect(cg_image, image_rect); + CGImageRelease(cg_image); + } + } else if (TkMacOSXGetNSViewForDrawable(mac_drawable) != NULL) { + + /* + * Convert Tk top-left to NSView bottom-left coordinates. + */ + + int view_height = [view bounds].size.height; + NSRect view_rect = NSMakeRect(x + mac_drawable->xOff, + view_height - height - y - mac_drawable->yOff, + width, height); + + /* + * Attempt to copy from the view to a bitmapImageRep. If the view does + * not have a valid CGContext, doing this will silently corrupt memory + * and make a big mess. So, in that case, we just return NULL. + */ + + if (view == [NSView focusView]) { + bitmapRep = [view bitmapImageRepForCachingDisplayInRect: view_rect]; + [view cacheDisplayInRect:view_rect toBitmapImageRep:bitmapRep]; + result = [bitmapRep CGImage]; + CFRelease(bitmapRep); + } else { + TkMacOSXDbgMsg("No CGContext - cannot copy from screen to bitmap."); + result = NULL; + } + } else { + TkMacOSXDbgMsg("Invalid source drawable"); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * CreateCGImageFromPixmap -- + * + * Create a CGImage from an X Pixmap. + * + * Results: + * CGImage, release after use. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static CGImageRef +CreateCGImageFromPixmap( + Drawable pixmap) +{ + CGImageRef img = NULL; + CGContextRef context = TkMacOSXGetCGContextForDrawable(pixmap); + + if (context) { + img = CGBitmapContextCreateImage(context); + } + return img; +} + +/* + *---------------------------------------------------------------------- + * + * XGetImage -- + * + * This function copies data from a pixmap or window into an XImage. It + * is essentially never used. At one time it was called by + * pTkImgPhotoDisplay, but that is no longer the case. Currently it is + * called two places, one of which is requesting an XY image which we do + * not support. It probably does not work correctly -- see the comments + * for CGImageFromDrawableRect. + * + * Results: + * Returns a newly allocated XImage containing the data from the given + * rectangle of the given drawable, or NULL if the XImage could not be + * constructed. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +struct pixel_fmt {int r; int g; int b; int a;}; +static struct pixel_fmt bgra = {2, 1, 0, 3}; +static struct pixel_fmt abgr = {3, 2, 1, 0}; + +XImage * +XGetImage( + Display *display, + Drawable drawable, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned long plane_mask, + int format) +{ + NSBitmapImageRep* bitmapRep = NULL; + NSUInteger bitmap_fmt = 0; + XImage* imagePtr = NULL; + char* bitmap = NULL; + char R, G, B, A; + int depth = 32, offset = 0, bitmap_pad = 0; + unsigned int bytes_per_row, size, row, n, m; + + if (format == ZPixmap) { + CGImageRef cgImage; + if (width == 0 || height == 0) { + return NULL; + } + + cgImage = CreateCGImageFromDrawableRect(drawable, x, y, width, height); + if (cgImage) { + bitmapRep = [NSBitmapImageRep alloc]; + [bitmapRep initWithCGImage:cgImage]; + CFRelease(cgImage); + } else { + TkMacOSXDbgMsg("XGetImage: Failed to construct CGImage"); + return NULL; + } + bitmap_fmt = [bitmapRep bitmapFormat]; + size = [bitmapRep bytesPerPlane]; + bytes_per_row = [bitmapRep bytesPerRow]; + bitmap = ckalloc(size); + if (!bitmap + || (bitmap_fmt != 0 && bitmap_fmt != 1) + || [bitmapRep samplesPerPixel] != 4 + || [bitmapRep isPlanar] != 0 + || bytes_per_row < 4 * width + || size != bytes_per_row * height) { + TkMacOSXDbgMsg("XGetImage: Unrecognized bitmap format"); + CFRelease(bitmapRep); + return NULL; + } + memcpy(bitmap, (char *)[bitmapRep bitmapData], size); + CFRelease(bitmapRep); + + /* + * When Apple extracts a bitmap from an NSView, it may be in either + * BGRA or ABGR format. For an XImage we need RGBA. + */ + + struct pixel_fmt pixel = bitmap_fmt == 0 ? bgra : abgr; + + for (row = 0, n = 0; row < height; row++, n += bytes_per_row) { + for (m = n; m < n + 4*width; m += 4) { + R = *(bitmap + m + pixel.r); + G = *(bitmap + m + pixel.g); + B = *(bitmap + m + pixel.b); + A = *(bitmap + m + pixel.a); + + *(bitmap + m) = R; + *(bitmap + m + 1) = G; + *(bitmap + m + 2) = B; + *(bitmap + m + 3) = A; + } + } + imagePtr = XCreateImage(display, NULL, depth, format, offset, + (char*) bitmap, width, height, + bitmap_pad, bytes_per_row); + } else { + /* + * There are some calls to XGetImage in the generic Tk code which pass + * an XYPixmap rather than a ZPixmap. XYPixmaps should be handled + * here. + */ + TkMacOSXDbgMsg("XGetImage does not handle XYPixmaps at the moment."); + } + return imagePtr; +} + +/* + *---------------------------------------------------------------------- + * + * XCopyArea -- + * + * Copies image data from one drawable to another. + * + * Results: + * None. + * + * Side effects: + * Image data is moved from a window or bitmap to a second window or bitmap. + * + *---------------------------------------------------------------------- + */ + +int +XCopyArea( + Display *display, /* Display. */ + Drawable src, /* Source drawable. */ + Drawable dst, /* Destination drawable. */ + GC gc, /* GC to use. */ + int src_x, /* X & Y, width & height */ + int src_y, /* define the source rectangle */ + unsigned int width, /* that will be copied. */ + unsigned int height, + int dest_x, /* Dest X & Y on dest rect. */ + int dest_y) +{ + TkMacOSXDrawingContext dc; + MacDrawable *srcDraw = (MacDrawable *)src; + CGImageRef img = NULL; + CGRect bounds, srcRect, dstRect; + + display->request++; + if (!width || !height) { + return BadDrawable; + } + + if (!TkMacOSXSetupDrawingContext(dst, gc, &dc)) { + TkMacOSXDbgMsg("Failed to setup drawing context."); + return BadDrawable; + } + + if (!dc.context) { + TkMacOSXDbgMsg("Invalid destination drawable - no context."); + return BadDrawable; + } + + if (srcDraw->flags & TK_IS_PIXMAP) { + img = CreateCGImageFromPixmap(src); + } else if (TkMacOSXGetNSWindowForDrawable(src)) { + img = CreateCGImageFromDrawableRect(src, src_x, src_y, width, height); + } else { + TkMacOSXDbgMsg("Invalid source drawable - neither window nor pixmap."); + } + + if (img) { + bounds = CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height); + srcRect = CGRectMake(src_x, src_y, width, height); + dstRect = CGRectMake(dest_x, dest_y, width, height); + TkMacOSXDrawCGImage(dst, gc, dc.context, img, + gc->foreground, gc->background, bounds, srcRect, dstRect); + CFRelease(img); + } else { + TkMacOSXDbgMsg("Failed to construct CGImage."); + } + + TkMacOSXRestoreDrawingContext(&dc); + return Success; +} + +/* + *---------------------------------------------------------------------- + * + * XCopyPlane -- + * + * Copies a bitmap from a source drawable to a destination drawable. The + * plane argument specifies which bit plane of the source contains the + * bitmap. Note that this implementation ignores the gc->function. + * + * Results: + * None. + * + * Side effects: + * Changes the destination drawable. + * + *---------------------------------------------------------------------- + */ + +int +XCopyPlane( + Display *display, /* Display. */ + Drawable src, /* Source drawable. */ + Drawable dst, /* Destination drawable. */ + GC gc, /* GC to use. */ + int src_x, /* X & Y, width & height */ + int src_y, /* define the source rectangle */ + unsigned int width, /* that will be copied. */ + unsigned int height, + int dest_x, /* Dest X & Y on dest rect. */ + int dest_y, + unsigned long plane) /* Which plane to copy. */ +{ + TkMacOSXDrawingContext dc; + MacDrawable *srcDraw = (MacDrawable *)src; + MacDrawable *dstDraw = (MacDrawable *)dst; + CGRect bounds, srcRect, dstRect; + display->request++; + if (!width || !height) { + /* TkMacOSXDbgMsg("Drawing of empty area requested"); */ + return BadDrawable; + } + if (plane != 1) { + Tcl_Panic("Unexpected plane specified for XCopyPlane"); + } + if (srcDraw->flags & TK_IS_PIXMAP) { + if (!TkMacOSXSetupDrawingContext(dst, gc, &dc)) { + return BadDrawable; + } + + CGContextRef context = dc.context; + + if (context) { + CGImageRef img = CreateCGImageFromPixmap(src); + + if (img) { + TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask; + unsigned long imageBackground = gc->background; + + if (clipPtr && clipPtr->type == TKP_CLIP_PIXMAP) { + srcRect = CGRectMake(src_x, src_y, width, height); + CGImageRef mask = CreateCGImageFromPixmap( + clipPtr->value.pixmap); + CGImageRef submask = CGImageCreateWithImageInRect( + img, srcRect); + CGRect rect = CGRectMake(dest_x, dest_y, width, height); + + rect = CGRectOffset(rect, dstDraw->xOff, dstDraw->yOff); + CGContextSaveGState(context); + + /* + * Move the origin of the destination to top left. + */ + + CGContextTranslateCTM(context, + 0, rect.origin.y + CGRectGetMaxY(rect)); + CGContextScaleCTM(context, 1, -1); + + /* + * Fill with the background color, clipping to the mask. + */ + + CGContextClipToMask(context, rect, submask); + TkMacOSXSetColorInContext(gc, gc->background, dc.context); + CGContextFillRect(context, rect); + + /* + * Fill with the foreground color, clipping to the + * intersection of img and mask. + */ + + CGImageRef subimage = CGImageCreateWithImageInRect( + img, srcRect); + CGContextClipToMask(context, rect, subimage); + TkMacOSXSetColorInContext(gc, gc->foreground, context); + CGContextFillRect(context, rect); + CGContextRestoreGState(context); + CGImageRelease(img); + CGImageRelease(mask); + CGImageRelease(submask); + CGImageRelease(subimage); + } else { + bounds = CGRectMake(0, 0, + srcDraw->size.width, srcDraw->size.height); + srcRect = CGRectMake(src_x, src_y, width, height); + dstRect = CGRectMake(dest_x, dest_y, width, height); + TkMacOSXDrawCGImage(dst, gc, dc.context, img, + gc->foreground, imageBackground, bounds, + srcRect, dstRect); + CGImageRelease(img); + } + } else { + /* no image */ + TkMacOSXDbgMsg("Invalid source drawable"); + } + } else { + TkMacOSXDbgMsg("Invalid destination drawable - " + "could not get a bitmap context."); + } + TkMacOSXRestoreDrawingContext(&dc); + return Success; + } else { + /* + * Source drawable is a Window, not a Pixmap. + */ + + return XCopyArea(display, src, dst, gc, src_x, src_y, width, height, + dest_x, dest_y); + } +} + +/* * Local Variables: * mode: objc * c-basic-offset: 4 diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index d3c4a0c..2cf4b0c 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -28,6 +28,13 @@ static char tkLibPath[PATH_MAX + 1] = ""; static char scriptPath[PATH_MAX + 1] = ""; +/* + * Forward declarations... + */ + +static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, + int objc, Tcl_Obj *const objv[]); + #pragma mark TKApplication(TKInit) @implementation TKApplication @@ -86,6 +93,7 @@ static char scriptPath[PATH_MAX + 1] = ""; -(void)applicationWillFinishLaunching:(NSNotification *)aNotification { + (void)aNotification; /* * Initialize notifications. @@ -117,6 +125,8 @@ static char scriptPath[PATH_MAX + 1] = ""; -(void)applicationDidFinishLaunching:(NSNotification *)notification { + (void)notification; + /* * It is not safe to force activation of the NSApp until this method is * called. Activating too early can cause the menu bar to be unresponsive. @@ -275,7 +285,6 @@ TkpInit( if (!initialized) { struct stat st; - initialized = 1; /* @@ -330,15 +339,15 @@ TkpInit( [NSApp _setup:interp]; /* - * WARNING: The finishLaunching method runs asynchronously, apparently - * in a separate thread. This creates a race between the - * initialization of the NSApplication and the initialization of Tk. - * If Tk wins the race bad things happen with the root window (see - * below). If the NSApplication wins then an AppleEvent created during - * launch, e.g. by dropping a file icon on the application icon, will - * be delivered before the procedure meant to to handle the AppleEvent - * has been defined. This is now handled by processing the AppleEvent - * as an idle task. See tkMacOSXHLEvents.c. + * WARNING: The finishLaunching method runs asynchronously. This + * creates a race between the initialization of the NSApplication and + * the initialization of Tk. If Tk wins the race bad things happen + * with the root window (see below). If the NSApplication wins then an + * AppleEvent created during launch, e.g. by dropping a file icon on + * the application icon, will be delivered before the procedure meant + * to to handle the AppleEvent has been defined. This is now handled + * by processing the AppleEvent as an idle task. See + * tkMacOSXHLEvents.c. */ [NSApp finishLaunching]; @@ -367,35 +376,47 @@ TkpInit( Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT); /* - * If we don't have a TTY and stdin is a special character file of + * If we don't have a TTY or stdin is a special character file of * length 0, (e.g. /dev/null, which is what Finder sets when double * clicking Wish) then use the Tk based console interpreter. */ - if (getenv("TK_CONSOLE") || - (!isatty(0) && (fstat(0, &st) || - (S_ISCHR(st.st_mode) && st.st_blocks == 0)))) { - Tk_InitConsoleChannels(interp); - Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN)); - Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT)); - Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR)); - - /* - * Only show the console if we don't have a startup script and - * tcl_interactive hasn't been set already. - */ - - if (Tcl_GetStartupScript(NULL) == NULL) { - const char *intvar = Tcl_GetVar2(interp, - "tcl_interactive", NULL, TCL_GLOBAL_ONLY); - - if (intvar == NULL) { - Tcl_SetVar2(interp, "tcl_interactive", NULL, "1", - TCL_GLOBAL_ONLY); + if (!isatty(0) && (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0))) { + if (getenv("TK_CONSOLE")) { + Tk_InitConsoleChannels(interp); + Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN)); + Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT)); + Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR)); + + /* + * Only show the console if we don't have a startup script and + * tcl_interactive hasn't been set already. + */ + + if (Tcl_GetStartupScript(NULL) == NULL) { + const char *intvar = Tcl_GetVar2(interp, + "tcl_interactive", NULL, TCL_GLOBAL_ONLY); + + if (intvar == NULL) { + Tcl_SetVar2(interp, "tcl_interactive", NULL, "1", + TCL_GLOBAL_ONLY); + } } - } - if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { - return TCL_ERROR; + if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { + return TCL_ERROR; + } + } else { + + /* + * When launched as a macOS application with no console, + * redirect stderr and stdout to /dev/null. This avoids waiting + * forever for those files to become writable if the underlying + * Tcl program tries to write to them with a puts command. + */ + + FILE *null = fopen("/dev/null", "w"); + dup2(fileno(null), STDOUT_FILENO); + dup2(fileno(null), STDERR_FILENO); } } @@ -421,7 +442,20 @@ TkpInit( TkMacOSXStandardAboutPanelObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap", TkMacOSXIconBitmapObjCmd, NULL, NULL); - Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath, NULL, NULL); + Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", + TkMacOSXGetAppPathCmd, NULL, NULL); + + /* + * The root window has been created and mapped, but XMapWindow deferred its + * call to makeKeyAndOrderFront because the first call to XMapWindow + * occurs too early in the initialization process for that. Process idle + * tasks now, so the root window is configured, then order it front. + */ + + while(Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}; + for (NSWindow *window in [NSApp windows]) { + [window makeKeyAndOrderFront:NSApp]; + } return TCL_OK; } @@ -461,11 +495,11 @@ TkpGetAppName( } Tcl_DStringAppend(namePtr, name, -1); } - + /* *---------------------------------------------------------------------- * - * TkMacOSXGetAppPath -- + * TkMacOSXGetAppPathCmd -- * * Returns the path of the Wish application bundle. * @@ -477,42 +511,39 @@ TkpGetAppName( * *---------------------------------------------------------------------- */ -int TkMacOSXGetAppPath( - ClientData cd, - Tcl_Interp *ip, - int objc, - Tcl_Obj *const objv[]) -{ - - CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle()); - - - /* - * Convert the URL reference into a string reference. - */ - CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); - - /* - * Get the system encoding method. - */ - - CFStringEncoding encodingMethod = CFStringGetSystemEncoding(); +static int +TkMacOSXGetAppPathCmd( + TCL_UNUSED(void *), + Tcl_Interp *interp, + int objc, + Tcl_Obj *const objv[]) +{ + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, NULL); + return TCL_ERROR; + } - /* - * Convert the string reference into a C string. - */ + /* + * Get the application path URL and convert it to a string path reference. + */ - char *path = (char *) CFStringGetCStringPtr(appPath, encodingMethod); + CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFStringRef appPath = + CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); - Tcl_SetResult(ip, path, NULL); + /* + * Convert (and copy) the string reference into a Tcl result. + */ - CFRelease(mainBundleURL); - CFRelease(appPath); - return TCL_OK; + Tcl_SetObjResult(interp, Tcl_NewStringObj( + CFStringGetCStringPtr(appPath, CFStringGetSystemEncoding()), -1)); + CFRelease(mainBundleURL); + CFRelease(appPath); + return TCL_OK; } - + /* *---------------------------------------------------------------------- * @@ -579,7 +610,7 @@ TkMacOSXDefaultStartupScript(void) CFURLRef scriptFldrURL; char startupScript[PATH_MAX + 1]; - if (CFURLGetFileSystemRepresentation (appMainURL, true, + if (CFURLGetFileSystemRepresentation(appMainURL, true, (unsigned char *) startupScript, PATH_MAX)) { Tcl_SetStartupScript(Tcl_NewStringObj(startupScript,-1), NULL); scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL, @@ -616,10 +647,11 @@ TkMacOSXDefaultStartupScript(void) MODULE_SCOPE void* TkMacOSXGetNamedSymbol( - const char* module, - const char* symbol) + TCL_UNUSED(const char *), + const char *symbol) { void *addr = dlsym(RTLD_NEXT, symbol); + if (!addr) { (void) dlerror(); /* Clear dlfcn error state */ } diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h index 89d76ce..278fcac 100644 --- a/macosx/tkMacOSXInt.h +++ b/macosx/tkMacOSXInt.h @@ -191,17 +191,10 @@ MODULE_SCOPE void TkpFreeGCCache(GC gc); */ MODULE_SCOPE void TkMacOSXDefaultStartupScript(void); -#if 0 -MODULE_SCOPE int XSetClipRectangles(Display *d, GC gc, int clip_x_origin, - int clip_y_origin, XRectangle* rectangles, int n, int ordering); -#endif MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x, int y, int width, int height); -MODULE_SCOPE void TkpRetainRegion(TkRegion r); -MODULE_SCOPE void TkpReleaseRegion(TkRegion r); MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta); MODULE_SCOPE Bool TkTestLogDisplay(Drawable drawable); -MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin); /* * Include the stubbed internal platform-specific API. diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 014caa9..fdf4e66 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -51,7 +51,7 @@ static NSUInteger textInputModifiers; #endif NSWindow *w = [theEvent window]; TkWindow *winPtr = TkMacOSXGetTkWindow(w), *grabWinPtr, *focusWinPtr; - Tk_Window tkwin = (Tk_Window) winPtr; + Tk_Window tkwin = (Tk_Window)winPtr; NSEventType type = [theEvent type]; NSUInteger virtual = [theEvent keyCode]; NSUInteger modifiers = ([theEvent modifierFlags] & @@ -83,7 +83,7 @@ static NSUInteger textInputModifiers; if (winPtr->dispPtr->grabFlags || /* global grab */ grabWinPtr->mainPtr == winPtr->mainPtr){ /* same application */ winPtr =winPtr->dispPtr->focusPtr; - tkwin = (Tk_Window) winPtr; + tkwin = (Tk_Window)winPtr; } } @@ -286,7 +286,7 @@ static NSUInteger textInputModifiers; XEvent xEvent; NSString *str, *keystr, *lower; TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); - Tk_Window tkwin = (Tk_Window) winPtr; + Tk_Window tkwin = (Tk_Window)winPtr; Bool sendingIMEText = NO; str = ([aString isKindOfClass: [NSAttributedString class]]) ? @@ -322,7 +322,7 @@ static NSUInteger textInputModifiers; */ if (repRange.location == 0) { - Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr; + Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL); } @@ -393,7 +393,7 @@ static NSUInteger textInputModifiers; replacementRange: (NSRange)repRange { TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); - Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr; + Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; NSString *temp; NSString *str; @@ -498,7 +498,7 @@ static NSUInteger textInputModifiers; processingCompose = NO; if (aSelector == @selector (deleteBackward:)) { TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); - Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr; + Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL); } } @@ -687,8 +687,8 @@ XGrabKeyboard( TkWindow *captureWinPtr = (TkWindow *) TkpGetCapture(); if (keyboardGrabWinPtr && captureWinPtr) { - NSWindow *w = TkMacOSXDrawableWindow(grab_window); - MacDrawable *macWin = (MacDrawable *) grab_window; + NSWindow *w = TkMacOSXGetNSWindowForDrawable(grab_window); + MacDrawable *macWin = (MacDrawable *)grab_window; if (w && macWin->toplevel->winPtr == (TkWindow *) captureWinPtr) { if (modalSession) { @@ -789,7 +789,7 @@ Tk_SetCaretPos( { TkWindow *winPtr = (TkWindow *) tkwin; TkCaret *caretPtr = &(winPtr->dispPtr->caret); - NSWindow *w = TkMacOSXDrawableWindow(Tk_WindowId(tkwin)); + NSWindow *w = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin)); /* * Register this widget as being capable of text input, so we know we diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 8381aa7..378c30e 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -153,6 +153,8 @@ static int KeyDataToUnicode(UniChar *uniChars, int maxChars, { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); +#else + (void)notification; #endif keyboardChanged = YES; UpdateKeymaps(); @@ -401,14 +403,14 @@ KeyDataToUnicode( */ KeySym -XKeycodeToKeysym( - Display* display, - KeyCode keycode, +XkbKeycodeToKeysym( + TCL_UNUSED(Display *), + unsigned int keycode, + TCL_UNUSED(int), int index) { Tcl_HashEntry *hPtr; MacKeycode macKC; - (void) display; /*unused*/ int modifiers, result; UniChar keychar = 0; @@ -459,6 +461,15 @@ XKeycodeToKeysym( } return NoSymbol; } + +KeySym +XKeycodeToKeysym( + TCL_UNUSED(Display *), + KeyCode keycode, + int index) +{ + return XkbKeycodeToKeysym(NULL, keycode, 0, index); +} /* *---------------------------------------------------------------------- @@ -479,13 +490,12 @@ XKeycodeToKeysym( const char * TkpGetString( - TkWindow *winPtr, /* Window where event occurred: Needed to get + TCL_UNUSED(TkWindow *), /* Window where event occurred: Needed to get * input context. */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Uninitialized or empty string to hold * result. */ { - (void) winPtr; /*unused*/ MacKeycode macKC; char utfChars[8]; int length = 0; @@ -519,11 +529,11 @@ TkpGetString( XModifierKeymap * XGetModifierMapping( - Display *display) + TCL_UNUSED(Display *)) { XModifierKeymap *modmap; - modmap = ckalloc(sizeof(XModifierKeymap)); + modmap = (XModifierKeymap *)ckalloc(sizeof(XModifierKeymap)); modmap->max_keypermod = 0; modmap->modifiermap = NULL; return modmap; @@ -578,14 +588,14 @@ XFreeModifiermap( char * XKeysymToString( - KeySym keysym) + TCL_UNUSED(KeySym)) { return NULL; } KeySym XStringToKeysym( - const char* string) + TCL_UNUSED(const char *)) { return NoSymbol; } @@ -613,7 +623,7 @@ XStringToKeysym( KeyCode XKeysymToKeycode( - Display *display, + TCL_UNUSED(Display *), KeySym keysym) { Tcl_HashEntry *hPtr; @@ -681,7 +691,7 @@ XKeysymToKeycode( */ void TkpSetKeycodeAndState( - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), KeySym keysym, XEvent *eventPtr) { @@ -813,7 +823,7 @@ TkpGetKeySym( * First do the straightforward lookup. */ - sym = XKeycodeToKeysym(dispPtr->display, macKC.uint, index); + sym = XkbKeycodeToKeysym(dispPtr->display, macKC.uint, 0, index); /* * Special handling: If the key was shifted because of Lock, which is only @@ -823,7 +833,7 @@ TkpGetKeySym( if ((index & INDEX_SHIFT) && !(eventPtr->xkey.state & ShiftMask)) { if ((sym == NoSymbol) || !Tcl_UniCharIsUpper(sym)) { - sym = XKeycodeToKeysym(dispPtr->display, macKC.uint, + sym = XkbKeycodeToKeysym(dispPtr->display, macKC.uint, 0, index & ~INDEX_SHIFT); } } @@ -834,7 +844,7 @@ TkpGetKeySym( */ if ((index & INDEX_SHIFT) && (sym == NoSymbol)) { - sym = XKeycodeToKeysym(dispPtr->display, macKC.uint, + sym = XkbKeycodeToKeysym(dispPtr->display, macKC.uint, 0, index & ~INDEX_SHIFT); } return sym; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 735f7d2..8005517 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -108,6 +108,67 @@ static void MenuSelectEvent(TkMenu *menuPtr); static void RecursivelyClearActiveMenu(TkMenu *menuPtr); static int ModifierCharWidth(Tk_Font tkfont); +#pragma mark TkBackgroundLoop + +/* + * The function TkMacOSXEventsCheckProc (in tkMacOSXNotify.c) is the "check + * proc" for the macOS event source. Its job is to remove NSEvents from the + * default event queue of the NSApplication. It does this by calling the + * method [NSApp nextEventMatchingMask: untilDate: inMode: dequeue:]. As a + * rule, when the untilDate is set to the distant past this method returns + * immediately. An exception to that rule is when the next event is the button + * press on a menu button. In that case, the method starts running a nested + * event loop in the mode NSEventTrackingRunLoopMode which does not return + * until the menu has been dismissed. In Tk 8.6.10 and earlier, this meant + * that the Tk event loop would block in its call to the check proc as long as + * the menu was posted. For example, opening a menu during the Rube Goldberg + * demo would cause the animation to stop. This was also the case for + * menubuttons. + * + * The TKBackground object below works around this problem, and allows a Tk + * event loop to run while a menu is open. It is a subclass of NSThread which + * inserts requests to call [NSApp _runBackgroundLoop] onto the queue + * associated with the NSEventTrackingRunLoopMode. One of these threads gets + * started in the callback [NSApp menuBeginTracking] and cancelled in [NSApp + * menuEndTracking]. + */ + +@interface TKBackgroundLoop: NSThread +@end + +@implementation TKBackgroundLoop +- (void) main +{ + NSAutoreleasePool *pool = [NSAutoreleasePool new]; + NSArray *modeArray = [NSArray arrayWithObjects: NSEventTrackingRunLoopMode, + nil]; + while(1) { + + /* + * Queue a request to process Tk events during event tracking. + */ + + [NSApp performSelectorOnMainThread:@selector(_runBackgroundLoop) + withObject:nil + waitUntilDone:true + modes:modeArray]; + if ([self isCancelled]) { + [NSThread exit]; + } + + /* + * Allow the tracked events to be processed too. + */ + + [NSThread sleepForTimeInterval:0.001]; + } + [pool drain]; +} +@end + +TKBackgroundLoop *backgroundLoop = nil; + + #pragma mark TKMenu /* @@ -395,6 +456,12 @@ static int ModifierCharWidth(Tk_Font tkfont); #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif + if (backgroundLoop) { + [backgroundLoop cancel]; + [backgroundLoop release]; + } + backgroundLoop = [[TKBackgroundLoop alloc] init]; + [backgroundLoop start]; //TkMacOSXClearMenubarActive(); //TkMacOSXPreprocessMenu(); } @@ -404,6 +471,11 @@ static int ModifierCharWidth(Tk_Font tkfont); #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif + if (backgroundLoop) { + [backgroundLoop cancel]; + [backgroundLoop release]; + backgroundLoop = nil; + } if (!inPostMenu) { TkMacOSXClearMenubarActive(); } @@ -618,7 +690,7 @@ TkpConfigureMenuEntry( if (mePtr->image) { Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight); - image = TkMacOSXGetNSImageWithTkImage(mePtr->menuPtr->display, + image = TkMacOSXGetNSImageFromTkImage(mePtr->menuPtr->display, mePtr->image, imageWidth, imageHeight); } else if (mePtr->bitmapPtr != None) { Pixmap bitmap = Tk_GetBitmapFromObj(mePtr->menuPtr->tkwin, @@ -626,7 +698,7 @@ TkpConfigureMenuEntry( Tk_SizeOfBitmap(mePtr->menuPtr->display, bitmap, &imageWidth, &imageHeight); - image = TkMacOSXGetNSImageWithBitmap(mePtr->menuPtr->display, bitmap, + image = TkMacOSXGetNSImageFromBitmap(mePtr->menuPtr->display, bitmap, gc, imageWidth, imageHeight); if (gc->foreground == defaultFg) { // Use a semantic foreground color by default @@ -809,7 +881,7 @@ TkpPostMenu( * rather than the appearance of the root window. */ realWinPtr = (TkWindow*) realWin; - realWinView = TkMacOSXDrawableView(realWinPtr->privatePtr); + realWinView = TkMacOSXGetNSViewForDrawable(realWinPtr->privatePtr); if (realWinView != nil) { break; } @@ -1093,12 +1165,12 @@ CheckForSpecialMenu( cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) { if (cascadeEntryPtr->menuPtr->menuType == MENUBAR && cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin) { - TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr; + TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr; int i = 0; Tcl_DString ds; Tcl_DStringInit(&ds); - Tcl_DStringAppend(&ds, Tk_PathName(masterMenuPtr->tkwin), -1); + Tcl_DStringAppend(&ds, Tk_PathName(mainMenuPtr->tkwin), -1); while (specialMenus[i].name) { Tcl_DStringAppend(&ds, specialMenus[i].name, specialMenus[i].len); diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index d1f429e..2fad3cb 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -76,6 +76,8 @@ static void DrawMenuButtonImageAndText(TkMenuButton *butPtr); Tk_ClassProcs tkpMenubuttonClass = { sizeof(Tk_ClassProcs), /* size */ TkMenuButtonWorldChanged, /* worldChangedProc */ + NULL, + NULL }; /* @@ -133,7 +135,7 @@ TkMenuButton * TkpCreateMenuButton( Tk_Window tkwin) { - MacMenuButton *mbPtr = (MacMenuButton *) ckalloc(sizeof(MacMenuButton)); + MacMenuButton *mbPtr = (MacMenuButton *)ckalloc(sizeof(MacMenuButton)); Tk_CreateEventHandler(tkwin, ActivateMask, MenuButtonEventProc, mbPtr); mbPtr->flags = FIRST_DRAW; @@ -179,13 +181,6 @@ TkpDisplayMenuButton( TkMacOSXComputeMenuButtonDrawParams(butPtr, dpPtr); /* - * Set up clipping region. Make sure the we are using the port for this - * button, or we will set the wrong window's clip. - */ - - TkMacOSXSetUpClippingRgn(pixmap); - - /* * Draw the native portion of the buttons. */ @@ -222,7 +217,7 @@ TkpDisplayMenuButton( void TkpDestroyMenuButton( - TkMenuButton *mbPtr) + TCL_UNUSED(TkMenuButton *)) { } @@ -544,8 +539,7 @@ DrawMenuButtonImageAndText( static void TkMacOSXDrawMenuButton( MacMenuButton *mbPtr, /* Mac menubutton. */ - GC gc, /* The GC we are drawing into - needed for the bevel - * button */ + TCL_UNUSED(GC), /* The GC we are drawing into - not used */ Pixmap pixmap) /* The pixmap we are drawing into - needed for the * bevel button */ { @@ -566,7 +560,7 @@ TkMacOSXDrawMenuButton( static HIThemeButtonDrawInfo hiinfo; MenuButtonBackgroundDrawCB(mbPtr, 32, true); - if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) { return; } @@ -597,7 +591,7 @@ TkMacOSXDrawMenuButton( MenuButtonContentDrawCB(mbPtr->btnkind, &mbPtr->drawinfo, mbPtr, 32, true); } else { - if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { + if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) { return; } TkMacOSXRestoreDrawingContext(&dc); @@ -625,8 +619,8 @@ TkMacOSXDrawMenuButton( static void MenuButtonBackgroundDrawCB ( MacMenuButton *ptr, - SInt16 depth, - Boolean isColorDev) + TCL_UNUSED(SInt16), + TCL_UNUSED(Boolean)) { TkMenuButton* butPtr = (TkMenuButton *) ptr; Tk_Window tkwin = butPtr->tkwin; @@ -658,11 +652,11 @@ MenuButtonBackgroundDrawCB ( static void MenuButtonContentDrawCB ( - ThemeButtonKind kind, - const HIThemeButtonDrawInfo *drawinfo, + TCL_UNUSED(ThemeButtonKind), + TCL_UNUSED(const HIThemeButtonDrawInfo *), MacMenuButton *ptr, - SInt16 depth, - Boolean isColorDev) + TCL_UNUSED(SInt16), + TCL_UNUSED(Boolean)) { TkMenuButton *butPtr = (TkMenuButton *) ptr; Tk_Window tkwin = butPtr->tkwin; @@ -709,7 +703,7 @@ MenuButtonEventProc( mbPtr->flags &= ~ACTIVE; } if ((buttonPtr->flags & REDRAW_PENDING) == 0) { - Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) buttonPtr); + Tcl_DoWhenIdle(TkpDisplayMenuButton, buttonPtr); buttonPtr->flags |= REDRAW_PENDING; } } diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c index 9b85e7a..a1519f5 100644 --- a/macosx/tkMacOSXMenus.c +++ b/macosx/tkMacOSXMenus.c @@ -415,7 +415,7 @@ GenerateEditEvent( if (!winPtr) { return; } - tkwin = (Tk_Window) winPtr->dispPtr->focusPtr; + tkwin = (Tk_Window)winPtr->dispPtr->focusPtr; if (!tkwin) { return; } diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index f274a07..00477dd 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -24,6 +24,7 @@ typedef struct { Point global; Point local; } MouseEventData; + static Tk_Window captureWinPtr = NULL; /* Current capture window; may be * NULL. */ @@ -42,9 +43,9 @@ enum { * window attribute pointing to the active window. As of 10.8 this behavior * had changed. The new behavior was that if the mouse were ever moved outside * of a window, all subsequent NSMouseMoved NSEvents would have a Nil window - * attribute. To work around this the TKApplication remembers the last non-Nil - * window that it received in a mouse event. If it receives an NSEvent with a - * Nil window attribute then the saved window is used. + * attribute until the mouse returned to the window. In 11.1 it changed again. + * The window attribute can be non-nil, but referencing a window which does not + * belong to the application. */ @implementation TKApplication(TKMouseEvent) @@ -52,151 +53,164 @@ enum { { NSWindow *eventWindow = [theEvent window]; NSEventType eventType = [theEvent type]; + NSRect viewFrame = [[eventWindow contentView] frame]; + NSPoint location = [theEvent locationInWindow]; TkWindow *winPtr = NULL, *grabWinPtr; - Tk_Window tkwin; + Tk_Window tkwin = None, capture, target; NSPoint local, global; - NSInteger button = -1; -#if 0 - NSTrackingArea *trackingArea = nil; - NSInteger eventNumber, clickCount, buttonNumber; -#endif - [NSEvent stopPeriodicEvents]; + NSInteger button; + Bool inTitleBar = NO; + int win_x, win_y; + unsigned int buttonState = 0; + static int validPresses = 0, ignoredPresses = 0; #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif + + /* + * If this event is not for a Tk toplevel, it should just be passed up the + * responder chain. However, there is an exception for synthesized events, + * which are used in testing. Those events are recognized by having their + * (unused) context pointer set to 1. + */ + + if (eventWindow && ![eventWindow isMemberOfClass:[TKWindow class]]) { + if ([theEvent context] != (void *) 1) + return theEvent; + } + + /* + * Check if the event is located in the titlebar. + */ + + if (eventWindow) { + inTitleBar = viewFrame.size.height < location.y; + } + + button = [theEvent buttonNumber] + Button1; switch (eventType) { - case NSLeftMouseDown: - case NSRightMouseDown: - case NSOtherMouseDown: + case NSRightMouseUp: + case NSOtherMouseUp: + buttonState &= ~TkGetButtonMask(button); + break; case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDragged: - button = [theEvent buttonNumber] + Button1; + case NSRightMouseDown: + case NSOtherMouseDown: + buttonState |= TkGetButtonMask(button); + break; case NSMouseEntered: + if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] && + !inTitleBar) { + [(TKWindow *)eventWindow setMouseInResizeArea:YES]; + } + break; case NSMouseExited: - case NSCursorUpdate: + if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)]) { + [(TKWindow *)eventWindow setMouseInResizeArea:NO]; + break; + } case NSLeftMouseUp: - case NSRightMouseUp: - case NSOtherMouseUp: + case NSLeftMouseDown: case NSMouseMoved: + case NSScrollWheel: +#if 0 + case NSCursorUpdate: case NSTabletPoint: case NSTabletProximity: - case NSScrollWheel: +#endif break; - default: /* Unrecognized mouse event. */ + default: /* This type of event is ignored. */ return theEvent; } /* - * Compute the mouse position in Tk screen coordinates (global) and in the - * Tk coordinates of its containing Tk Window (local). If a grab is in effect, - * the local coordinates should be relative to the grab window. + * Update the button state. We ignore left button presses that start a + * resize or occur in the title bar. See tickets [d72abe6b54] and + * [39cbacb9e8]. */ - if (eventWindow) { - local = [theEvent locationInWindow]; + if (eventType == NSLeftMouseDown || eventType == NSLeftMouseDragged) { + if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] && + [(TKWindow *) eventWindow mouseInResizeArea]) { - /* - * Do not send ButtonPress XEvents for MouseDown NSEvents that start a - * resize. (The MouseUp will be handled during LiveResize.) See - * ticket [d72abe6b54]. - */ + /* + * When the left button is pressed in the resize area, we receive + * NSMouseDown, but when it is released we do not receive + * NSMouseUp. So ignore the event and clear the button state but + * do not change the ignoredPresses count. + */ - if (eventType == NSLeftMouseDown && - ([eventWindow styleMask] & NSResizableWindowMask) && - [NSApp macOSVersion] > 100600) { - NSRect frame = [eventWindow frame]; - if (local.x < 3 || local.x > frame.size.width - 3 || local.y < 3) { - return theEvent; - } + buttonState &= ~TkGetButtonMask(Button1); + return theEvent; } - global = [eventWindow tkConvertPointToScreen: local]; - tkwin = TkMacOSXGetCapture(); - if (tkwin) { - winPtr = (TkWindow *) tkwin; - eventWindow = TkMacOSXDrawableWindow(winPtr->window); - if (eventWindow) { - local = [eventWindow tkConvertPointFromScreen: global]; - } else { - return theEvent; - } + if (inTitleBar) { + ignoredPresses++; + return theEvent; } - local.y = [eventWindow frame].size.height - local.y; - global.y = TkMacOSXZeroScreenHeight() - global.y; - } else { - - /* - * If the event has no NSWindow, the location is in screen coordinates. - */ - - global = [theEvent locationInWindow]; - tkwin = TkMacOSXGetCapture(); - if (tkwin) { - winPtr = (TkWindow *) tkwin; - eventWindow = TkMacOSXDrawableWindow(winPtr->window); - } else { - eventWindow = [NSApp mainWindow]; + validPresses++; + buttonState |= TkGetButtonMask(Button1); + } + if (eventType == NSLeftMouseUp) { + if (ignoredPresses > 0) { + ignoredPresses--; + } else if (validPresses > 0) { + validPresses--; } - if (!eventWindow) { - return theEvent; + if (validPresses == 0) { + buttonState &= ~TkGetButtonMask(Button1); } - local = [eventWindow tkConvertPointFromScreen: global]; - local.y = [eventWindow frame].size.height - local.y; - global.y = TkMacOSXZeroScreenHeight() - global.y; } /* - * If we still don't have a window, try using the toplevel that - * manages the NSWindow. + * Find an appropriate NSWindow to attach to this event, and its + * associated Tk window. */ - if (!tkwin) { - winPtr = TkMacOSXGetTkWindow(eventWindow); - tkwin = (Tk_Window) winPtr; + capture = TkMacOSXGetCapture(); + if (capture) { + winPtr = (TkWindow *) capture; + eventWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); + if (!eventWindow) { + return theEvent; + } + } else { + if (eventWindow) { + winPtr = TkMacOSXGetTkWindow(eventWindow); + } + if (!winPtr) { + eventWindow = [NSApp mainWindow]; + winPtr = TkMacOSXGetTkWindow(eventWindow); + } } - if (!tkwin) { + if (!winPtr) { /* - * We can't find a window for this event. We have to ignore it. + * We couldn't find a Tk window for this event. We have to ignore it. */ #ifdef TK_MAC_DEBUG_EVENTS - TkMacOSXDbgMsg("tkwin == NULL"); + TkMacOSXDbgMsg("Event received with no Tk window."); #endif return theEvent; } + tkwin = (Tk_Window) winPtr; /* - * Ignore the event if a local grab is in effect and the Tk event window is - * not in the grabber's subtree. - */ - - grabWinPtr = winPtr->dispPtr->grabWinPtr; - if (grabWinPtr && /* There is a grab in effect ... */ - !winPtr->dispPtr->grabFlags && /* and it is a local grab ... */ - grabWinPtr->mainPtr == winPtr->mainPtr){ /* in the same application. */ - Tk_Window tkwin2, tkEventWindow = Tk_CoordsToWindow(global.x, global.y, tkwin); - if (!tkEventWindow) { - return theEvent; - } - for (tkwin2 = tkEventWindow; - !Tk_IsTopLevel(tkwin2); - tkwin2 = Tk_Parent(tkwin2)) { - if (tkwin2 == (Tk_Window) grabWinPtr) { - break; - } - } - if (tkwin2 != (Tk_Window) grabWinPtr) { - return theEvent; - } - } - - /* - * Convert local from NSWindow flipped coordinates to the toplevel's - * coordinates. + * Compute the mouse position in local (window) and global (screen) + * coordinates. These are Tk coordinates, meaning that the local origin is + * at the top left corner of the containing toplevel and the global origin + * is at top left corner of the primary screen. */ + global = [NSEvent mouseLocation]; + local = [eventWindow tkConvertPointFromScreen: global]; + global.x = floor(global.x); + global.y = floor(TkMacOSXZeroScreenHeight() - global.y); + local.x = floor(local.x); + local.y = floor([eventWindow frame].size.height - local.y); if (Tk_IsEmbedded(winPtr)) { TkWindow *contPtr = TkpGetOtherWindow(winPtr); if (Tk_IsTopLevel(contPtr)) { @@ -213,25 +227,44 @@ enum { } /* - * Use the toplevel coordinates to find the containing Tk window. Then - * convert local into the coordinates of that window. (The converted - * local coordinates are only needed for scrollwheel events.) + * Use the local coordinates to find the Tk window which should receive + * this event. Also convert local into the coordinates of that window. + * (The converted local coordinates are only needed for scrollwheel + * events.) */ - int win_x, win_y; - tkwin = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y); - local.x = win_x; - local.y = win_y; + target = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y); /* - * Generate an XEvent for this mouse event. + * Ignore the event if a local grab is in effect and the Tk window is + * not in the grabber's subtree. */ - unsigned int state = 0; - if (button > 0) { - state |= TkGetButtonMask(button); + grabWinPtr = winPtr->dispPtr->grabWinPtr; + if (grabWinPtr && /* There is a grab in effect ... */ + !winPtr->dispPtr->grabFlags && /* and it is a local grab ... */ + grabWinPtr->mainPtr == winPtr->mainPtr){ /* in the same application. */ + Tk_Window tkwin2; + if (!target) { + return theEvent; + } + for (tkwin2 = target; + !Tk_IsTopLevel(tkwin2); + tkwin2 = Tk_Parent(tkwin2)) { + if (tkwin2 == (Tk_Window)grabWinPtr) { + break; + } + } + if (tkwin2 != (Tk_Window)grabWinPtr) { + return theEvent; + } } + /* + * Generate an XEvent for this mouse event. + */ + + unsigned int state = buttonState; NSUInteger modifiers = [theEvent modifierFlags]; if (modifiers & NSAlphaShiftKeyMask) { @@ -259,32 +292,34 @@ enum { if (eventType != NSScrollWheel) { /* - * For normal mouse events, Tk_UpdatePointer will send the XEvent. + * For normal mouse events, Tk_UpdatePointer will send the appropriate + * XEvents using its cached state information. Unfortunately, it will + * also recompute the local coordinates. */ #ifdef TK_MAC_DEBUG_EVENTS - TKLog(@"UpdatePointer %p x %f.0 y %f.0 %d", - tkwin, global.x, global.y, state); + TKLog(@"UpdatePointer %p x %.1f y %.1f %d", + target, global.x, global.y, state); #endif - Tk_UpdatePointer(tkwin, global.x, global.y, state); + + Tk_UpdatePointer(target, global.x, global.y, state); } else { + CGFloat delta; + int coarseDelta; + XEvent xEvent; /* * For scroll wheel events we need to send the XEvent here. */ - CGFloat delta; - int coarseDelta; - XEvent xEvent; - xEvent.type = MouseWheelEvent; - xEvent.xbutton.x = local.x; - xEvent.xbutton.y = local.y; + xEvent.xbutton.x = win_x; + xEvent.xbutton.y = win_y; xEvent.xbutton.x_root = global.x; xEvent.xbutton.y_root = global.y; xEvent.xany.send_event = false; - xEvent.xany.display = Tk_Display(tkwin); - xEvent.xany.window = Tk_WindowId(tkwin); + xEvent.xany.display = Tk_Display(target); + xEvent.xany.window = Tk_WindowId(target); delta = [theEvent deltaY]; if (delta != 0.0) { @@ -314,34 +349,6 @@ enum { /* *---------------------------------------------------------------------- * - * TkMacOSXKeyModifiers -- - * - * Returns the current state of the modifier keys. - * - * Results: - * An OS Modifier state. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -EventModifiers -TkMacOSXModifierState(void) -{ - UInt32 keyModifiers; - int isFrontProcess = (GetCurrentEvent() && Tk_MacOSXIsAppInFront()); - - keyModifiers = isFrontProcess ? GetCurrentEventKeyModifiers() : - GetCurrentKeyModifiers(); - - return (EventModifiers) (keyModifiers & USHRT_MAX); -} - -/* - *---------------------------------------------------------------------- - * * TkMacOSXButtonKeyState -- * * Returns the current state of the button & modifier keys. @@ -463,8 +470,8 @@ XQueryPointer( NSPoint global = [NSEvent mouseLocation]; if (getLocal) { - MacDrawable *macWin = (MacDrawable *) w; - NSWindow *win = TkMacOSXDrawableWindow(w); + MacDrawable *macWin = (MacDrawable *)w; + NSWindow *win = TkMacOSXGetNSWindowForDrawable(w); if (win) { NSPoint local; @@ -553,8 +560,8 @@ TkGenerateButtonEvent( Window window, /* X Window containing button event. */ unsigned int state) /* Button Key state suitable for X event. */ { - MacDrawable *macWin = (MacDrawable *) window; - NSWindow *win = TkMacOSXDrawableWindow(window); + MacDrawable *macWin = (MacDrawable *)window; + NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); MouseEventData med; bzero(&med, sizeof(MouseEventData)); @@ -635,6 +642,23 @@ GenerateButtonEvent( return true; } +/* + *---------------------------------------------------------------------- + * + * TkpWarpPointer -- + * + * Move the mouse cursor to the screen location specified by the warpX and + * warpY fields of a TkDisplay. + * + * Results: + * None + * + * Side effects: + * The mouse cursor is moved. + * + *---------------------------------------------------------------------- + */ + void TkpWarpPointer( TkDisplay *dispPtr) @@ -679,8 +703,7 @@ TkpSetCapture( while (winPtr && !Tk_IsTopLevel(winPtr)) { winPtr = winPtr->parentPtr; } - [NSEvent stopPeriodicEvents]; - captureWinPtr = (Tk_Window) winPtr; + captureWinPtr = (Tk_Window)winPtr; } /* diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 83b4695..5163e21 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -176,6 +176,7 @@ void DebugPrintQueue(void) } } #endif + [super sendEvent:theEvent]; [NSApp tkCheckPasteboard]; @@ -185,6 +186,13 @@ void DebugPrintQueue(void) #endif } + +- (void) _runBackgroundLoop +{ + while(Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)){ + TkMacOSXDrawAllViews(NULL); + } +} @end #pragma mark - @@ -203,15 +211,13 @@ void DebugPrintQueue(void) *---------------------------------------------------------------------- */ -NSString * +static NSString * GetRunLoopMode(NSModalSession modalSession) { NSString *runLoopMode = nil; if (modalSession) { runLoopMode = NSModalPanelRunLoopMode; - } else if (TkMacOSXGetCapture()) { - runLoopMode = NSEventTrackingRunLoopMode; } if (!runLoopMode) { runLoopMode = [[NSRunLoop currentRunLoop] currentMode]; diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index 4347766..ba47566 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -163,6 +163,13 @@ #define TK_DYNAMIC_COLORMAP 0x0fffffff /* + * Inform tkImgPhInstance.c that our tkPutImage can render an image with an + * alpha channel directly into a window. + */ + +#define TKPUTIMAGE_CAN_BLEND + +/* * Used by xcolor.c */ diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index ceca8f8..8cb3e15 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -4,7 +4,8 @@ * Macros and declarations that are purely internal & private to TkAqua. * * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright 2008-2009, Apple Inc. + * Copyright (c) 2008-2009 Apple Inc. + * Copyright (c) 2020 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -150,7 +151,7 @@ typedef union MacKeycode_t { keycode_v v; keycode_x x; } MacKeycode; - + /* * Macros used in tkMacOSXKeyboard.c and tkMacOSXKeyEvent.c. * Note that 0x7f is del and 0xF8FF is the Apple Logo character. @@ -218,17 +219,12 @@ MODULE_SCOPE long tkMacOSXMacOSXVersion; MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(TkRegion r); MODULE_SCOPE void TkMacOSXSetWithNativeRegion(TkRegion r, HIShapeRef rgn); -MODULE_SCOPE void TkMacOSXOffsetRegion(TkRegion r, short dx, short dy); MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void); MODULE_SCOPE HIMutableShapeRef TkMacOSXHIShapeCreateMutableWithRect( const CGRect *inRect); MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithShape( HIMutableShapeRef inDestShape, HIShapeRef inSrcShape); -#if 0 -MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithRect(HIMutableShapeRef inShape, - const CGRect *inRect); -#endif MODULE_SCOPE OSStatus TkMacOSHIShapeDifferenceWithRect( HIMutableShapeRef inShape, const CGRect *inRect); MODULE_SCOPE OSStatus TkMacOSHIShapeUnionWithRect(HIMutableShapeRef inShape, @@ -249,45 +245,32 @@ MODULE_SCOPE int TkMacOSXUseAntialiasedText(Tcl_Interp *interp, int enable); MODULE_SCOPE int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable, int antiAlias); -MODULE_SCOPE int TkMacOSXGenerateFocusEvent(TkWindow *winPtr, - int activeFlag); -MODULE_SCOPE WindowClass TkMacOSXWindowClass(TkWindow *winPtr); MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr); MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window); -MODULE_SCOPE EventModifiers TkMacOSXModifierState(void); -MODULE_SCOPE NSBitmapImageRep* TkMacOSXBitmapRepFromDrawableRect(Drawable drawable, - int x, int y, unsigned int width, unsigned int height); -MODULE_SCOPE CGImageRef TkMacOSXCreateCGImageWithXImage(XImage *image); MODULE_SCOPE void TkMacOSXDrawCGImage(Drawable d, GC gc, CGContextRef context, CGImageRef image, unsigned long imageForeground, unsigned long imageBackground, CGRect imageBounds, CGRect srcBounds, CGRect dstBounds); MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc, - int useCG, TkMacOSXDrawingContext *dcPtr); + TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel, CGContextRef context); -MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr, - NSWindow *window, int fullscreen, - Tcl_Interp *interp); -MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr, - int active); -MODULE_SCOPE NSWindow* TkMacOSXDrawableWindow(Drawable drawable); -MODULE_SCOPE NSView* TkMacOSXDrawableView(MacDrawable *macWin); +#define TkMacOSXGetTkWindow(window) (TkWindow *)Tk_MacOSXGetTkWindow(window) +#define TkMacOSXGetNSWindowForDrawable(drawable) ((NSWindow*)TkMacOSXDrawable(drawable)) +#define TkMacOSXGetNSViewForDrawable(macWin) (NSView *)Tk_MacOSXGetNSViewForDrawable((Drawable)(macWin)) MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds); MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable); MODULE_SCOPE void TkMacOSXInvalidateViewRegion(NSView *view, HIShapeRef rgn); MODULE_SCOPE CGContextRef TkMacOSXGetCGContextForDrawable(Drawable drawable); -MODULE_SCOPE CGImageRef TkMacOSXCreateCGImageWithDrawable(Drawable drawable); -MODULE_SCOPE NSImage* TkMacOSXGetNSImageWithTkImage(Display *display, +MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromTkImage(Display *display, Tk_Image image, int width, int height); -MODULE_SCOPE NSImage* TkMacOSXGetNSImageWithBitmap(Display *display, +MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromBitmap(Display *display, Pixmap bitmap, GC gc, int width, int height); MODULE_SCOPE CGColorRef TkMacOSXCreateCGColor(GC gc, unsigned long pixel); MODULE_SCOPE NSColor* TkMacOSXGetNSColor(GC gc, unsigned long pixel); -MODULE_SCOPE TkWindow* TkMacOSXGetTkWindow(NSWindow *w); MODULE_SCOPE NSFont* TkMacOSXNSFontForFont(Tk_Font tkfont); MODULE_SCOPE NSDictionary* TkMacOSXNSFontAttributesForFont(Tk_Font tkfont); MODULE_SCOPE NSModalSession TkMacOSXGetModalSession(void); @@ -304,11 +287,11 @@ MODULE_SCOPE void TkMacOSXDrawSolidBorder(Tk_Window tkwin, GC gc, int inset, int thickness); MODULE_SCOPE int TkMacOSXServices_Init(Tcl_Interp *interp); MODULE_SCOPE int TkMacOSXRegisterServiceWidgetObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE unsigned TkMacOSXAddVirtual(unsigned int keycode); MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view, NSRect *bounds); +MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin); MODULE_SCOPE void TkMacOSXDrawAllViews(ClientData clientData); MODULE_SCOPE unsigned long TkMacOSXClearPixel(void); @@ -341,6 +324,8 @@ VISIBILITY_HIDDEN NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems; NSArray *_defaultHelpMenuItems, *_defaultFileMenuItems; NSAutoreleasePool *_mainPool; + NSThread *_backgoundLoop; + #ifdef __i386__ /* The Objective C runtime used on i386 requires this. */ int _poolLock; @@ -348,6 +333,7 @@ VISIBILITY_HIDDEN Bool _isDrawing; Bool _needsToDraw; #endif + } @property int poolLock; @property int macOSVersion; @@ -378,6 +364,7 @@ VISIBILITY_HIDDEN @interface NSApplication(TKNotify) /* We need to declare this hidden method. */ - (void) _modalSession: (NSModalSession) session sendEvent: (NSEvent *) event; +- (void) _runBackgroundLoop; @end @interface TKApplication(TKEvent) - (NSEvent *)tkProcessEvent:(NSEvent *)theEvent; @@ -449,16 +436,40 @@ VISIBILITY_HIDDEN VISIBILITY_HIDDEN @interface TKWindow : NSWindow +{ +#ifdef __i386__ + /* The Objective C runtime used on i386 requires this. */ + Bool _mouseInResizeArea; + Window _tkWindow; +#endif +} +@property Bool mouseInResizeArea; +@property Window tkWindow; @end @interface TKWindow(TKWm) - (void) tkLayoutChanged; @end -@interface NSDrawerWindow : NSWindow +@interface TKDrawerWindow : NSWindow { id _i1, _i2; +#ifdef __i386__ + /* The Objective C runtime used on i386 requires this. */ + Window _tkWindow; +#endif +} +@property Window tkWindow; +@end + +@interface TKPanel : NSPanel +{ +#ifdef __i386__ + /* The Objective C runtime used on i386 requires this. */ + Window _tkWindow; +#endif } +@property Window tkWindow; @end #pragma mark NSMenu & NSMenuItem Utilities @@ -554,9 +565,7 @@ VISIBILITY_HIDDEN @end #endif /* _TKMACPRIV */ - -int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *const objv[]); - + /* * Local Variables: * mode: objc diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index db19c94..6c70a63 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -12,6 +12,16 @@ */ #include "tkMacOSXPrivate.h" +static void RetainRegion(TkRegion r); +static void ReleaseRegion(TkRegion r); + +#ifdef DEBUG +static int totalRegions = 0; +static int totalRegionRetainCount = 0; +#define DebugLog(msg, ...) fprintf(stderr, (msg), ##__VA_ARGS__) +#else +#define DebugLog(msg, ...) +#endif /* @@ -34,7 +44,10 @@ TkRegion TkCreateRegion(void) { - return (TkRegion) HIShapeCreateMutable(); + TkRegion region = (TkRegion) HIShapeCreateMutable(); + DebugLog("Created region: total regions = %d\n", ++totalRegions); + RetainRegion(region); + return region; } /* @@ -59,7 +72,8 @@ TkDestroyRegion( TkRegion r) { if (r) { - CFRelease(r); + DebugLog("Destroyed region: total regions = %d\n", --totalRegions); + ReleaseRegion(r); } return Success; } @@ -320,7 +334,7 @@ TkpBuildRegionFromAlphaData( /* *---------------------------------------------------------------------- * - * TkpRetainRegion -- + * RetainRegion -- * * Increases reference count of region. * @@ -333,17 +347,18 @@ TkpBuildRegionFromAlphaData( *---------------------------------------------------------------------- */ -void -TkpRetainRegion( +static void +RetainRegion( TkRegion r) { CFRetain(r); + DebugLog("Retained region: total count is %d\n", ++totalRegionRetainCount); } /* *---------------------------------------------------------------------- * - * TkpReleaseRegion -- + * ReleaseRegion -- * * Decreases reference count of region. * @@ -356,11 +371,12 @@ TkpRetainRegion( *---------------------------------------------------------------------- */ -void -TkpReleaseRegion( +static void +ReleaseRegion( TkRegion r) { CFRelease(r); + DebugLog("Released region: total count is %d\n", --totalRegionRetainCount); } /* @@ -436,7 +452,7 @@ TkMacOSXSetWithNativeRegion( /* *---------------------------------------------------------------------- * - * TkMacOSXOffsetRegion -- + * XOffsetRegion -- * * Offsets region by given distances. * @@ -449,20 +465,21 @@ TkMacOSXSetWithNativeRegion( *---------------------------------------------------------------------- */ -void -TkMacOSXOffsetRegion( - TkRegion r, - short dx, - short dy) +int +XOffsetRegion( + void *r, + int dx, + int dy) { ChkErr(HIShapeOffset, (HIMutableShapeRef) r, dx, dy); + return Success; } /* *---------------------------------------------------------------------- * * TkMacOSXHIShapeCreateEmpty, TkMacOSXHIShapeCreateMutableWithRect, - * TkMacOSXHIShapeSetWithShape, TkMacOSXHIShapeSetWithRect, + * TkMacOSXHIShapeSetWithShape, * TkMacOSHIShapeDifferenceWithRect, TkMacOSHIShapeUnionWithRect, * TkMacOSHIShapeUnion -- * @@ -501,22 +518,6 @@ TkMacOSXHIShapeSetWithShape( return result; } -#if 0 -OSStatus -TkMacOSXHIShapeSetWithRect( - HIMutableShapeRef inShape, - const CGRect *inRect) -{ - OSStatus result; - HIShapeRef rgn = HIShapeCreateWithRect(inRect); - - result = TkMacOSXHIShapeSetWithShape(inShape, rgn); - CFRelease(rgn); - - return result; -} -#endif - OSStatus TkMacOSHIShapeDifferenceWithRect( HIMutableShapeRef inShape, diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c index 6ea9f14..5da13d4 100644 --- a/macosx/tkMacOSXScale.c +++ b/macosx/tkMacOSXScale.c @@ -76,7 +76,7 @@ TkScale * TkpCreateScale( Tk_Window tkwin) { - MacScale *macScalePtr = ckalloc(sizeof(MacScale)); + MacScale *macScalePtr = (MacScale *)ckalloc(sizeof(MacScale)); macScalePtr->scaleHandle = NULL; if (scaleActionProc == NULL) { @@ -149,8 +149,6 @@ TkpDisplayScale( MacScale *macScalePtr = clientData; Rect r; WindowRef windowRef; - CGrafPtr destPort, savePort; - Boolean portChanged; MacDrawable *macDraw; SInt32 initialValue, minValue, maxValue; UInt16 numTicks; @@ -215,11 +213,8 @@ TkpDisplayScale( * Set up port for drawing Macintosh control. */ - macDraw = (MacDrawable *) Tk_WindowId(tkwin); - destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin)); - windowRef = TkMacOSXDrawableWindow(Tk_WindowId(tkwin)); - portChanged = QDSwapPort(destPort, &savePort); - TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin)); + macDraw = (MacDrawable *)Tk_WindowId(tkwin); + windowRef = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin)); /* * Create Macintosh control. @@ -292,10 +287,6 @@ TkpDisplayScale( SetControlVisibility(macScalePtr->scaleHandle, true, true); HiliteControl(macScalePtr->scaleHandle, 0); Draw1Control(macScalePtr->scaleHandle); - - if (portChanged) { - QDSwapPort(savePort, NULL); - } done: scalePtr->flags &= ~REDRAW_ALL; } @@ -327,14 +318,10 @@ TkpScaleElement( ControlPartCode part; Point where; Rect bounds; - CGrafPtr destPort, savePort; - Boolean portChanged; #ifdef TK_MAC_DEBUG_SCALE TkMacOSXDbgMsg("TkpScaleElement"); #endif - destPort = TkMacOSXGetDrawablePort(Tk_WindowId(scalePtr->tkwin)); - portChanged = QDSwapPort(destPort, &savePort); /* * All of the calculations in this procedure mirror those in @@ -346,10 +333,6 @@ TkpScaleElement( where.v = y + bounds.top; part = TestControl(macScalePtr->scaleHandle, where); - if (portChanged) { - QDSwapPort(savePort, NULL); - } - #ifdef TK_MAC_DEBUG_SCALE fprintf (stderr,"ScalePart %d, pos ( %d %d )\n", part, where.h, where.v ); #endif @@ -401,23 +384,11 @@ MacScaleEventProc( Point where; Rect bounds; int part; - CGrafPtr destPort, savePort; - Boolean portChanged; #ifdef TK_MAC_DEBUG_SCALE fprintf(stderr,"MacScaleEventProc\n" ); #endif - /* - * To call Macintosh control routines we must have the port set to the - * window containing the control. We will then test which part of the - * control was hit and act accordingly. - */ - - destPort = TkMacOSXGetDrawablePort(Tk_WindowId(macScalePtr->info.tkwin)); - portChanged = QDSwapPort(destPort, &savePort); - TkMacOSXSetUpClippingRgn(Tk_WindowId(macScalePtr->info.tkwin)); - TkMacOSXWinBounds((TkWindow *) macScalePtr->info.tkwin, &bounds); where.h = eventPtr->xbutton.x + bounds.left; where.v = eventPtr->xbutton.y + bounds.top; @@ -447,10 +418,6 @@ MacScaleEventProc( */ TkGenerateButtonEventForXPointer(Tk_WindowId(macScalePtr->info.tkwin)); - - if (portChanged) { - QDSwapPort(savePort, NULL); - } } /* diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index 8bf2998..2d9a038 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -121,7 +121,7 @@ TkScrollbar * TkpCreateScrollbar( Tk_Window tkwin) { - MacScrollbar *scrollPtr = ckalloc(sizeof(MacScrollbar)); + MacScrollbar *scrollPtr = (MacScrollbar *)ckalloc(sizeof(MacScrollbar)); scrollPtr->troughGC = NULL; scrollPtr->copyGC = NULL; @@ -174,8 +174,8 @@ static void drawMacScrollbar( MacScrollbar *msPtr, CGContextRef context) { - MacDrawable *macWin = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin); - NSView *view = TkMacOSXDrawableView(macWin); + Drawable d = Tk_WindowId(scrollPtr->tkwin); + NSView *view = TkMacOSXGetNSViewForDrawable(d); CGPathRef path; CGPoint inner[2], outer[2], thumbOrigin; CGSize thumbSize; @@ -258,12 +258,12 @@ TkpDisplayScrollbar( return; } - MacDrawable *macWin = (MacDrawable *) winPtr->window; - NSView *view = TkMacOSXDrawableView(macWin); + MacDrawable *macWin = (MacDrawable *)winPtr->window; + NSView *view = TkMacOSXGetNSViewForDrawable(macWin); if ((view == NULL) || (macWin->flags & TK_DO_NOT_DRAW) - || !TkMacOSXSetupDrawingContext((Drawable) macWin, NULL, 1, &dc)) { + || !TkMacOSXSetupDrawingContext((Drawable)macWin, NULL, &dc)) { return; } @@ -589,12 +589,12 @@ UpdateControlValues( { MacScrollbar *msPtr = (MacScrollbar *) scrollPtr; Tk_Window tkwin = scrollPtr->tkwin; - MacDrawable *macWin = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin); + MacDrawable *macWin = (MacDrawable *)Tk_WindowId(scrollPtr->tkwin); double dViewSize; HIRect contrlRect; short width, height; - NSView *view = TkMacOSXDrawableView(macWin); + NSView *view = TkMacOSXGetNSViewForDrawable(macWin); CGFloat viewHeight = [view bounds].size.height; NSRect frame; diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c index 0434f10..59e3439 100644 --- a/macosx/tkMacOSXServices.c +++ b/macosx/tkMacOSXServices.c @@ -20,10 +20,11 @@ static int ServicesEventProc( - Tcl_Event *event, - int flags) + TCL_UNUSED(Tcl_Event *), + TCL_UNUSED(int)) { TkMainInfo *info = TkGetMainInfoList(); + Tcl_GlobalEval(info->interp, "::tk::mac::PerformService"); return 1; } @@ -43,8 +44,8 @@ ServicesEventProc( - (void) provideService:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error; -- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard - types:(NSArray *)types; +- (BOOL) writeSelectionToPasteboard:(NSPasteboard *)pboard + types:(NSArray *)types; @end @@ -104,6 +105,8 @@ ServicesEventProc( NSString *pboardString = nil, *pboardType = nil; NSArray *types = [pboard types]; Tcl_Event *event; + (void)data; + (void)error; /* * Get a string from the private pasteboard and copy it to the general @@ -123,7 +126,7 @@ ServicesEventProc( [generalpasteboard declareTypes:[NSArray arrayWithObjects:pboardType, nil] owner:nil]; [generalpasteboard setString:pboardString forType:pboardType]; - event = ckalloc(sizeof(Tcl_Event)); + event = (Tcl_Event *)ckalloc(sizeof(Tcl_Event)); event->proc = ServicesEventProc; Tcl_QueueEvent((Tcl_Event *)event, TCL_QUEUE_TAIL); } @@ -137,7 +140,7 @@ ServicesEventProc( int TkMacOSXServices_Init( - Tcl_Interp *interp) + TCL_UNUSED(Tcl_Interp *)) { /* * Initialize an instance of TkService and register it with the NSApp. diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index a58bab4..682fbb3 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -51,10 +51,10 @@ static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr); int XDestroyWindow( - Display *display, /* Display. */ + TCL_UNUSED(Display *), /* Display. */ Window window) /* Window. */ { - MacDrawable *macWin = (MacDrawable *) window; + MacDrawable *macWin = (MacDrawable *)window; /* * Remove any dangling pointers that may exist if the window we are @@ -68,7 +68,7 @@ XDestroyWindow( if (!Tk_IsTopLevel(macWin->winPtr)) { TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); if (macWin->winPtr->parentPtr != NULL) { - TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr); + TkMacOSXInvalClipRgns((Tk_Window)macWin->winPtr->parentPtr); } if (macWin->visRgn) { CFRelease(macWin->visRgn); @@ -139,10 +139,11 @@ XMapWindow( if (!window) { return BadWindow; } - MacDrawable *macWin = (MacDrawable *) window; + MacDrawable *macWin = (MacDrawable *)window; TkWindow *winPtr = macWin->winPtr; - NSWindow *win = TkMacOSXDrawableWindow(window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); XEvent event; + static Bool initialized = NO; /* * Under certain situations it's possible for this function to be called @@ -172,12 +173,14 @@ XMapWindow( TkMacOSXApplyWindowAttributes(winPtr, win); [win setExcludedFromWindowsMenu:NO]; - [NSApp activateIgnoringOtherApps:NO]; + [NSApp activateIgnoringOtherApps:initialized]; [view addTkDirtyRect: [view bounds]]; - if ([win canBecomeKeyWindow]) { - [win makeKeyAndOrderFront:NSApp]; - } else { - [win orderFrontRegardless]; + if (initialized) { + if ([win canBecomeKeyWindow]) { + [win makeKeyAndOrderFront:NSApp]; + } else { + [win orderFrontRegardless]; + } } } else { TkWindow *contWinPtr = TkpGetOtherWindow(winPtr); @@ -187,11 +190,11 @@ XMapWindow( * the window. */ - TkMacOSXInvalClipRgns((Tk_Window) contWinPtr); + TkMacOSXInvalClipRgns((Tk_Window)contWinPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } - TkMacOSXInvalClipRgns((Tk_Window) winPtr); + TkMacOSXInvalClipRgns((Tk_Window)winPtr); /* * We only need to send the MapNotify event for toplevel windows. @@ -211,7 +214,7 @@ XMapWindow( * we handle this event immediately and then process the idle * events that it generates. */ - + Tk_HandleEvent(&event); while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } else { @@ -221,7 +224,7 @@ XMapWindow( * and redisplay the window. */ - TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr); + TkMacOSXInvalClipRgns((Tk_Window)winPtr->parentPtr); } TKContentView *view = [win contentView]; @@ -233,11 +236,15 @@ XMapWindow( * Generate VisibilityNotify events for window and all mapped children. */ - event.xany.send_event = False; - event.xany.display = display; - event.xvisibility.type = VisibilityNotify; - event.xvisibility.state = VisibilityUnobscured; - NotifyVisibility(winPtr, &event); + if (initialized) { + event.xany.send_event = False; + event.xany.display = display; + event.xvisibility.type = VisibilityNotify; + event.xvisibility.state = VisibilityUnobscured; + NotifyVisibility(winPtr, &event); + } else { + initialized = YES; + } return Success; } @@ -297,10 +304,10 @@ XUnmapWindow( Display *display, /* Display. */ Window window) /* Window. */ { - MacDrawable *macWin = (MacDrawable *) window; + MacDrawable *macWin = (MacDrawable *)window; TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; - NSWindow *win = TkMacOSXDrawableWindow(window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); XEvent event; display->request++; @@ -309,7 +316,7 @@ XUnmapWindow( winPtr->wmInfoPtr->hints.initial_state!=IconicState) { [win orderOut:nil]; } - TkMacOSXInvalClipRgns((Tk_Window) winPtr); + TkMacOSXInvalClipRgns((Tk_Window)winPtr); /* * We only need to send the UnmapNotify event for toplevel windows. @@ -329,7 +336,7 @@ XUnmapWindow( * we handle this event immediately and then process the idle * events that it generates. */ - + Tk_HandleEvent(&event); while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } else { @@ -341,10 +348,10 @@ XUnmapWindow( if (parentPtr && parentPtr->privatePtr->visRgn) { TkMacOSXInvalidateViewRegion( - TkMacOSXDrawableView(parentPtr->privatePtr), + TkMacOSXGetNSViewForDrawable(parentPtr->privatePtr), parentPtr->privatePtr->visRgn); } - TkMacOSXInvalClipRgns((Tk_Window) parentPtr); + TkMacOSXInvalClipRgns((Tk_Window)parentPtr); TkMacOSXUpdateClipRgn(parentPtr); } winPtr->flags &= ~TK_MAPPED; @@ -379,7 +386,7 @@ XResizeWindow( unsigned int width, unsigned int height) { - MacDrawable *macWin = (MacDrawable *) window; + MacDrawable *macWin = (MacDrawable *)window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { @@ -424,7 +431,7 @@ XMoveResizeWindow( unsigned int width, unsigned int height) { - MacDrawable *macWin = (MacDrawable *) window; + MacDrawable *macWin = (MacDrawable *)window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { @@ -477,7 +484,7 @@ XMoveWindow( Window window, /* Window. */ int x, int y) { - MacDrawable *macWin = (MacDrawable *) window; + MacDrawable *macWin = (MacDrawable *)window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { @@ -515,7 +522,7 @@ MoveResizeWindow( { int deltaX = 0, deltaY = 0, parentBorderwidth = 0; MacDrawable *macParent = NULL; - NSWindow *macWindow = TkMacOSXDrawableWindow((Drawable) macWin); + NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable((Drawable)macWin); /* * Find the Parent window, for an embedded window it will be its container. @@ -552,7 +559,7 @@ MoveResizeWindow( if (macWindow) { TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); if (macParent) { - TkMacOSXInvalClipRgns((Tk_Window) macParent->winPtr); + TkMacOSXInvalClipRgns((Tk_Window)macParent->winPtr); } } UpdateOffsets(macWin->winPtr, deltaX, deltaY); @@ -620,7 +627,7 @@ XRaiseWindow( Display *display, /* Display. */ Window window) /* Window. */ { - MacDrawable *macWin = (MacDrawable *) window; + MacDrawable *macWin = (MacDrawable *)window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { @@ -633,7 +640,6 @@ XRaiseWindow( return Success; } -#if 0 /* *---------------------------------------------------------------------- * @@ -650,23 +656,23 @@ XRaiseWindow( *---------------------------------------------------------------------- */ -void +int XLowerWindow( Display *display, /* Display. */ Window window) /* Window. */ { - MacDrawable *macWin = (MacDrawable *) window; + MacDrawable *macWin = (MacDrawable *)window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { TkWmRestackToplevel(macWin->winPtr, Below, NULL); } else { - /* + /* * TODO: this should generate damage */ } + return Success; } -#endif /* *---------------------------------------------------------------------- @@ -691,9 +697,9 @@ XConfigureWindow( Display *display, /* Display. */ Window w, /* Window. */ unsigned int value_mask, - XWindowChanges *values) + TCL_UNUSED(XWindowChanges *)) { - MacDrawable *macWin = (MacDrawable *) w; + MacDrawable *macWin = (MacDrawable *)w; TkWindow *winPtr = macWin->winPtr; display->request++; @@ -715,11 +721,11 @@ XConfigureWindow( */ if (value_mask & CWStackMode) { - NSView *view = TkMacOSXDrawableView(macWin); + NSView *view = TkMacOSXGetNSViewForDrawable(macWin); if (view) { - TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr); - TkpRedrawWidget((Tk_Window) winPtr); + TkMacOSXInvalClipRgns((Tk_Window)winPtr->parentPtr); + TkpRedrawWidget((Tk_Window)winPtr); } } @@ -871,11 +877,11 @@ TkMacOSXUpdateClipRgn( TkRegion r = TkCreateRegion(); HIShapeRef visRgn; - tkMacOSXEmbedHandler->getClipProc((Tk_Window) winPtr, r); + tkMacOSXEmbedHandler->getClipProc((Tk_Window)winPtr, r); visRgn = TkMacOSXGetNativeRegion(r); ChkErr(HIShapeIntersect, visRgn, rgn, rgn); CFRelease(visRgn); - TkpReleaseRegion(r); + TkDestroyRegion(r); } /* @@ -999,7 +1005,7 @@ TkMacOSXVisableClipRgn( static OSStatus InvalViewRect( int msg, - HIShapeRef rgn, + TCL_UNUSED(HIShapeRef), const CGRect *rect, void *ref) { @@ -1063,14 +1069,14 @@ TkMacOSXInvalidateWindow( if (macWin->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(macWin->winPtr); } - TkMacOSXInvalidateViewRegion(TkMacOSXDrawableView(macWin), + TkMacOSXInvalidateViewRegion(TkMacOSXGetNSViewForDrawable(macWin), (flag == TK_WINDOW_ONLY) ? macWin->visRgn : macWin->aboveVisRgn); } /* *---------------------------------------------------------------------- * - * TkMacOSXDrawableWindow -- + * TkMacOSXGetNSWindowForDrawable -- * * This function returns the NSWindow for a given X drawable. * @@ -1083,11 +1089,11 @@ TkMacOSXInvalidateWindow( *---------------------------------------------------------------------- */ -NSWindow * -TkMacOSXDrawableWindow( +void * +TkMacOSXDrawable( Drawable drawable) { - MacDrawable *macWin = (MacDrawable *) drawable; + MacDrawable *macWin = (MacDrawable *)drawable; NSWindow *result = nil; if (!macWin || macWin->flags & TK_IS_PIXMAP) { @@ -1103,25 +1109,19 @@ TkMacOSXDrawableWindow( TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr); if (contWinPtr) { - result = TkMacOSXDrawableWindow((Drawable) contWinPtr->privatePtr); + result = TkMacOSXGetNSWindowForDrawable((Drawable)contWinPtr->privatePtr); } } return result; } - -void * -TkMacOSXDrawable( - Drawable drawable) -{ - return TkMacOSXDrawableWindow(drawable); -} /* *---------------------------------------------------------------------- * * TkMacOSXGetDrawablePort -- * - * This function returns the Graphics Port for a given X drawable. + * This function only exists because it is listed in the stubs table. + * It is useless. * * Results: * NULL. @@ -1134,7 +1134,7 @@ TkMacOSXDrawable( void * TkMacOSXGetDrawablePort( - Drawable drawable) + TCL_UNUSED(Drawable)) { return NULL; } @@ -1142,9 +1142,16 @@ TkMacOSXGetDrawablePort( /* *---------------------------------------------------------------------- * - * TkMacOSXDrawableView -- + * TkMacOSXGetNSViewForDrawable/TkMacOSXGetRootControl -- * - * This function returns the NSView for a given X drawable. + * The function name TkMacOSXGetRootControl is being preserved only + * because it exists in a stubs table. Nobody knows what it means to + * get a "RootControl". The macro TkMacOSXGetNSViewForDrawable calls + * this function and should always be used rather than directly using + * the obscure official name of this function. + * + * It returns the NSView for a given X drawable in the case that the + * drawable is a window. If the drawable is a pixmap it returns nil. * * Results: * A NSView* or nil. @@ -1155,14 +1162,15 @@ TkMacOSXGetDrawablePort( *---------------------------------------------------------------------- */ -NSView * -TkMacOSXDrawableView( - MacDrawable *macWin) +void * +TkMacOSXGetRootControl( + Drawable drawable) { - NSView *result = nil; + void *result = NULL; + MacDrawable *macWin = (MacDrawable *)drawable; if (!macWin) { - result = nil; + result = NULL; } else if (!macWin->toplevel) { result = macWin->view; } else if (!(macWin->toplevel->flags & TK_EMBEDDED)) { @@ -1171,7 +1179,7 @@ TkMacOSXDrawableView( TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr); if (contWinPtr) { - result = TkMacOSXDrawableView(contWinPtr->privatePtr); + result = TkMacOSXGetRootControl((Drawable)contWinPtr->privatePtr); } } return result; @@ -1180,33 +1188,6 @@ TkMacOSXDrawableView( /* *---------------------------------------------------------------------- * - * TkMacOSXGetRootControl -- - * - * This function returns the NSView for a given X drawable. - * - * Results: - * A NSView* . - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -void * -TkMacOSXGetRootControl( - Drawable drawable) -{ - /* - * will probably need to fix this up for embedding - */ - - return TkMacOSXDrawableView((MacDrawable *) drawable); -} - -/* - *---------------------------------------------------------------------- - * * TkMacOSXInvalClipRgns -- * * This function invalidates the clipping regions for a given window and @@ -1267,7 +1248,7 @@ TkMacOSXInvalClipRgns( childPtr = winPtr->childList; while (childPtr) { if (!Tk_IsTopLevel(childPtr)) { - TkMacOSXInvalClipRgns((Tk_Window) childPtr); + TkMacOSXInvalClipRgns((Tk_Window)childPtr); } childPtr = childPtr->nextPtr; } @@ -1280,7 +1261,7 @@ TkMacOSXInvalClipRgns( childPtr = TkpGetOtherWindow(winPtr); if (childPtr) { - TkMacOSXInvalClipRgns((Tk_Window) childPtr); + TkMacOSXInvalClipRgns((Tk_Window)childPtr); } /* @@ -1462,7 +1443,7 @@ UpdateOffsets( Pixmap Tk_GetPixmap( Display *display, /* Display for new pixmap (can be null). */ - Drawable d, /* Drawable where pixmap will be used (ignored). */ + TCL_UNUSED(Drawable), /* Drawable where pixmap will be used (ignored). */ int width, /* Dimensions of pixmap. */ int height, int depth) /* Bits per pixel for pixmap. */ @@ -1472,7 +1453,7 @@ Tk_GetPixmap( if (display != NULL) { display->request++; } - macPix = ckalloc(sizeof(MacDrawable)); + macPix = (MacDrawable *)ckalloc(sizeof(MacDrawable)); macPix->winPtr = NULL; macPix->xOff = 0; macPix->yOff = 0; @@ -1510,7 +1491,7 @@ Tk_FreePixmap( Display *display, /* Display. */ Pixmap pixmap) /* Pixmap to destroy */ { - MacDrawable *macPix = (MacDrawable *) pixmap; + MacDrawable *macPix = (MacDrawable *)pixmap; display->request++; if (macPix->context) { diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index e5dcf5e..16fe37e 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -26,11 +26,11 @@ static int DebuggerObjCmd (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #endif static int PressButtonObjCmd (ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const *objv); static int InjectKeyEventObjCmd (ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const *objv); static int MenuBarHeightObjCmd (ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const *objv); /* @@ -117,10 +117,10 @@ DebuggerObjCmd( static int MenuBarHeightObjCmd( - ClientData clientData, /* Not used. */ + TCL_UNUSED(void *), /* Not used. */ Tcl_Interp *interp, /* Not used. */ - int objc, /* Not used. */ - Tcl_Obj *const objv[]) /* Not used. */ + TCL_UNUSED(int), /* Not used. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Not used. */ { static int height = 0; if (height == 0) { @@ -152,7 +152,7 @@ MODULE_SCOPE Bool TkTestLogDisplay( Drawable drawable) { - MacDrawable *macWin = (MacDrawable *) drawable; + MacDrawable *macWin = (MacDrawable *)drawable; NSWindow *win = nil; if (macWin->toplevel && macWin->toplevel->winPtr && macWin->toplevel->winPtr->wmInfoPtr && @@ -175,9 +175,11 @@ TkTestLogDisplay( * PressButtonObjCmd -- * * This Tcl command simulates a button press at a specific screen - * location. It injects NSEvents into the NSApplication event queue, - * as opposed to adding events to the Tcl queue as event generate - * would do. One application is for testing the grab command. + * location. It injects NSEvents into the NSApplication event queue, as + * opposed to adding events to the Tcl queue as event generate would do. + * One application is for testing the grab command. These events have + * their unused context property set to 1 as a signal indicating that they + * should not be ignored by [NSApp tkProcessMouseEvent]. * * Results: * A standard Tcl result. @@ -188,10 +190,9 @@ TkTestLogDisplay( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int PressButtonObjCmd( - ClientData clientData, + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -237,7 +238,7 @@ PressButtonObjCmd( modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:wNum - context:nil + context:(void *) 1 eventNumber:0 clickCount:1 pressure:0.0]; @@ -247,27 +248,27 @@ PressButtonObjCmd( modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:wNum - context:nil + context:(void *)1 eventNumber:1 clickCount:1 - pressure:0.0]; + pressure:-1.0]; [NSApp postEvent:press atStart:NO]; release = [NSEvent mouseEventWithType:NSLeftMouseUp location:loc modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:wNum - context:nil + context:(void*) 1 eventNumber:2 clickCount:1 - pressure:0.0]; + pressure:-1.0]; [NSApp postEvent:release atStart:NO]; return TCL_OK; } static int InjectKeyEventObjCmd( - ClientData clientData, + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index a23a6d7..9e6c3dd 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -95,7 +95,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; */ flags |= TK_MACOSX_HANDLE_EVENT_IMMEDIATELY; - TkGenWMConfigureEvent((Tk_Window) winPtr, x, y, width, height, flags); + TkGenWMConfigureEvent((Tk_Window)winPtr, x, y, width, height, flags); } } @@ -111,7 +111,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; if (winPtr) { winPtr->wmInfoPtr->hints.initial_state = TkMacOSXIsWindowZoomed(winPtr) ? ZoomState : NormalState; - Tk_MapWindow((Tk_Window) winPtr); + Tk_MapWindow((Tk_Window)winPtr); /* * Process all Tk events generated by Tk_MapWindow(). @@ -132,6 +132,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame { + (void)window; + /* * This method needs to be implemented in order for [NSWindow isZoomed] to * give the correct answer. But it suffices to always validate every @@ -144,6 +146,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize { + (void)window; + /* * We don't need to change the proposed size, but we do need to implement * this method. Otherwise the full screen window will be sized to the @@ -178,7 +182,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { - Tk_UnmapWindow((Tk_Window) winPtr); + Tk_UnmapWindow((Tk_Window)winPtr); } } @@ -190,7 +194,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { - TkGenWMDestroyEvent((Tk_Window) winPtr); + TkGenWMDestroyEvent((Tk_Window)winPtr); } /* @@ -207,6 +211,11 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(window); if (winPtr) { TKContentView *view = [window contentView]; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 + if (@available(macOS 10.15, *)) { + [view viewDidChangeEffectiveAppearance]; + } +#endif [view addTkDirtyRect:[view bounds]]; Tcl_CancelIdleCall(TkMacOSXDrawAllViews, NULL); Tcl_DoWhenIdle(TkMacOSXDrawAllViews, NULL); @@ -243,7 +252,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { - //Tk_UnmapWindow((Tk_Window) winPtr); + //Tk_UnmapWindow((Tk_Window)winPtr); } } @@ -287,6 +296,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (void) applicationActivate: (NSNotification *) notification { + (void)notification; + #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -311,6 +322,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (void) applicationDeactivate: (NSNotification *) notification { + (void)notification; + #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -333,6 +346,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag { + (void)sender; + (void)flag; + /* * Allowing the default response means that withdrawn windows will get * displayed on the screen with unresponsive title buttons. We don't @@ -365,6 +381,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (void) displayChanged: (NSNotification *) notification { + (void)notification; + #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -409,8 +427,8 @@ TkpWillDrawWidget(Tk_Window tkwin) { int result; if (tkwin) { TkWindow *winPtr = (TkWindow *)tkwin; - TKContentView *view = (TKContentView *) TkMacOSXDrawableView( - winPtr->privatePtr); + TKContentView *view = (TKContentView *)TkMacOSXGetNSViewForDrawable( + (Drawable)winPtr->privatePtr); result = ([NSApp isDrawing] && view == [NSView focusView]); #if 0 printf("TkpWillDrawWidget: %s %d %d \n", Tk_PathName(tkwin), @@ -518,35 +536,6 @@ GenerateUpdates( /* *---------------------------------------------------------------------- * - * GenerateActivateEvents -- - * - * Given a Macintosh window activate event this function generates all the - * X Activate events needed by Tk. - * - * Results: - * True if event(s) are generated - false otherwise. - * - * Side effects: - * Additional events may be placed on the Tk event queue. - * - *---------------------------------------------------------------------- - */ - -int -GenerateActivateEvents( - TkWindow *winPtr, - int activeFlag) -{ - TkGenerateActivateEvents(winPtr, activeFlag); - if (activeFlag || ![NSApp isActive]) { - TkMacOSXGenerateFocusEvent(winPtr, activeFlag); - } - return true; -} - -/* - *---------------------------------------------------------------------- - * * TkMacOSXGenerateFocusEvent -- * * Given a Macintosh window activate event this function generates all @@ -561,7 +550,7 @@ GenerateActivateEvents( *---------------------------------------------------------------------- */ -MODULE_SCOPE int +static int TkMacOSXGenerateFocusEvent( TkWindow *winPtr, /* Root X window for event. */ int activeFlag) @@ -603,6 +592,35 @@ TkMacOSXGenerateFocusEvent( /* *---------------------------------------------------------------------- * + * GenerateActivateEvents -- + * + * Given a Macintosh window activate event this function generates all the + * X Activate events needed by Tk. + * + * Results: + * True if event(s) are generated - false otherwise. + * + * Side effects: + * Additional events may be placed on the Tk event queue. + * + *---------------------------------------------------------------------- + */ + +int +GenerateActivateEvents( + TkWindow *winPtr, + int activeFlag) +{ + TkGenerateActivateEvents(winPtr, activeFlag); + if (activeFlag || ![NSApp isActive]) { + TkMacOSXGenerateFocusEvent(winPtr, activeFlag); + } + return true; +} + +/* + *---------------------------------------------------------------------- + * * TkGenWMConfigureEvent -- * * Generate a ConfigureNotify event for Tk. Depending on the value of flag @@ -805,7 +823,7 @@ TkWmProtocolEventProc( if (result != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (command for \"%s\" window manager protocol)", - Tk_GetAtomName((Tk_Window) winPtr, protocol))); + Tk_GetAtomName((Tk_Window)winPtr, protocol))); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); @@ -819,8 +837,8 @@ TkWmProtocolEventProc( * message then just destroy the window. */ - if (protocol == Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW")) { - Tk_DestroyWindow((Tk_Window) winPtr); + if (protocol == Tk_InternAtom((Tk_Window)winPtr, "WM_DELETE_WINDOW")) { + Tk_DestroyWindow((Tk_Window)winPtr); } } @@ -888,7 +906,7 @@ ExposeRestrictProc( static Tk_RestrictAction ConfigureRestrictProc( - ClientData arg, + TCL_UNUSED(void *), XEvent *eventPtr) { return (eventPtr->type==ConfigureNotify ? TK_PROCESS_EVENT : TK_DEFER_EVENT); @@ -912,6 +930,7 @@ ConfigureRestrictProc( - (void) drawRect: (NSRect) rect { + (void)rect; #ifdef TK_MAC_DEBUG_DRAWING TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); @@ -948,7 +967,7 @@ ConfigureRestrictProc( [super setFrameSize: newsize]; NSWindow *w = [self window]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); - Tk_Window tkwin = (Tk_Window) winPtr; + Tk_Window tkwin = (Tk_Window)winPtr; if (![self inLiveResize] && [w respondsToSelector: @selector (tkLayoutChanged)]) { @@ -1066,43 +1085,94 @@ ConfigureRestrictProc( } /* - * This method is called when a user changes between light and dark mode. The - * implementation here generates a Tk virtual event which can be bound to a - * function that redraws the window in an appropriate style. + * In macOS 10.14 and later his method is called when a user changes between + * light and dark mode or changes the accent color. The implementation + * generates two virtual events. The first is either <<LightAqua>> or + * <<DarkAqua>>, depending on the view's current effective appearance. The + * second is <<AppearnceChanged>> and has a data string describing the + * effective appearance of the view and the current accent and highlight + * colors. */ +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 + +static const char *const accentNames[] = { + "Graphite", + "Red", + "Orange", + "Yellow", + "Green", + "Blue", + "Purple", + "Pink" +}; + - (void) viewDidChangeEffectiveAppearance { - XVirtualEvent event; - int x, y; - NSWindow *w = [self window]; - TkWindow *winPtr = TkMacOSXGetTkWindow(w); - Tk_Window tkwin = (Tk_Window) winPtr; + Tk_Window tkwin = (Tk_Window)TkMacOSXGetTkWindow([self window]); + if (!tkwin) { + return; + } + NSAppearanceName effectiveAppearanceName = [[self effectiveAppearance] name]; + NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; + static const char *defaultColor = NULL; + + if (effectiveAppearanceName == NSAppearanceNameAqua) { + TkSendVirtualEvent(tkwin, "LightAqua", NULL); + } else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) { + TkSendVirtualEvent(tkwin, "DarkAqua", NULL); + } + if ([NSApp macOSVersion] < 101500) { + + /* + * Mojave cannot handle the KVO shenanigans that we need for the + * highlight and accent color notifications. + */ - if (!winPtr) { return; } - bzero(&event, sizeof(XVirtualEvent)); - event.type = VirtualEvent; - event.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); - event.send_event = false; - event.display = Tk_Display(tkwin); - event.event = Tk_WindowId(tkwin); - event.root = XRootWindow(Tk_Display(tkwin), 0); - event.subwindow = None; - event.time = TkpGetMS(); - XQueryPointer(NULL, winPtr->window, NULL, NULL, - &event.x_root, &event.y_root, &x, &y, &event.state); - Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y); - event.same_screen = true; - if (TkMacOSXInDarkMode(tkwin)) { - event.name = Tk_GetUid("DarkAqua"); - } else { - event.name = Tk_GetUid("LightAqua"); + if (!defaultColor) { + defaultColor = [NSApp macOSVersion] < 110000 ? "Blue" : "Multicolor"; + + /* + * AppKit calls this method when the user changes the Accent Color + * but not when the user changes the Highlight Color. So we register + * to receive KVO notifications for Highlight Color as well. + */ + + [preferences addObserver:self + forKeyPath:@"AppleHighlightColor" + options:NSKeyValueObservingOptionNew + context:NULL]; } - Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); + NSString *accent = [preferences stringForKey:@"AppleAccentColor"]; + NSArray *words = [[preferences stringForKey:@"AppleHighlightColor"] + componentsSeparatedByString: @" "]; + NSString *highlight = [words count] > 3 ? [words objectAtIndex:3] : nil; + const char *accentName = accent ? accentNames[1 + accent.intValue] : defaultColor; + const char *highlightName = highlight ? highlight.UTF8String: defaultColor; + char data[256]; + snprintf(data, 256, "Appearance %s Accent %s Highlight %s", + effectiveAppearanceName.UTF8String, accentName, + highlightName); + TkSendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, -1)); } +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context +{ + NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; + if (object == preferences && [keyPath isEqualToString:@"AppleHighlightColor"]) { + if (@available(macOS 10.14, *)) { + [self viewDidChangeEffectiveAppearance]; + } + } +} + +#endif + /* * This is no-op on 10.7 and up because Apple has removed this widget, but we * are leaving it here for backwards compatibility. @@ -1116,7 +1186,9 @@ ConfigureRestrictProc( XVirtualEvent event; int x, y; TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); - Tk_Window tkwin = (Tk_Window) winPtr; + Tk_Window tkwin = (Tk_Window)winPtr; + (void)sender; + if (!winPtr){ return; } @@ -1159,6 +1231,8 @@ ConfigureRestrictProc( - (void) keyDown: (NSEvent *) theEvent { + (void)theEvent; + #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif @@ -1166,7 +1240,7 @@ ConfigureRestrictProc( /* * When the services menu is opened this is called for each Responder in - * the Responder chain until a service provider is found. The TkContentView + * the Responder chain until a service provider is found. The TKContentView * should be the first (and generally only) Responder in the chain. We * return the TkServices object that was created in TkpInit. */ diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 90e4a70..b55f039 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -193,13 +193,6 @@ static const Tk_GeomMgr wmMgrType = { static int tkMacOSXWmAttrNotifyVal = 0; /* - * Hash table for Mac Window -> TkWindow mapping. - */ - -static Tcl_HashTable windowTable; -static int windowHashInit = false; - -/* * Forward declarations for procedures defined in this file: */ @@ -320,7 +313,7 @@ static int WmWinAppearance(Tcl_Interp *interp, TkWindow *winPtr, static void ApplyWindowAttributeFlagChanges(TkWindow *winPtr, NSWindow *macWindow, UInt64 oldAttributes, int oldFlags, int create, int initial); -static void ApplyMasterOverrideChanges(TkWindow *winPtr, +static void ApplyContainerOverrideChanges(TkWindow *winPtr, NSWindow *macWindow); static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr); @@ -360,11 +353,21 @@ static void RemoveTransient(TkWindow *winPtr); #pragma mark - -#pragma mark TKWindow(TKWm) +@implementation TKPanel: NSPanel +@synthesize tkWindow = _tkWindow; +@end + +@implementation TKDrawerWindow: NSWindow +@synthesize tkWindow = _tkWindow; +@end @implementation TKWindow: NSWindow +@synthesize mouseInResizeArea = _mouseInResizeArea; +@synthesize tkWindow = _tkWindow; @end +#pragma mark TKWindow(TKWm) + @implementation TKWindow(TKWm) /* @@ -523,7 +526,7 @@ static void SetWindowSizeLimits( TkWindow *winPtr) { - NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); WmInfo *wmPtr = winPtr->wmInfoPtr; int minWidth, minHeight, maxWidth, maxHeight, base; @@ -665,13 +668,13 @@ void TkWmNewWindow( TkWindow *winPtr) /* Newly-created top-level window. */ { - WmInfo *wmPtr = ckalloc(sizeof(WmInfo)); + WmInfo *wmPtr = (WmInfo *)ckalloc(sizeof(WmInfo)); wmPtr->winPtr = winPtr; wmPtr->reparent = None; wmPtr->titleUid = NULL; wmPtr->iconName = NULL; - wmPtr->master = NULL; + wmPtr->container = NULL; wmPtr->hints.flags = InputHint | StateHint; wmPtr->hints.input = True; wmPtr->hints.initial_state = NormalState; @@ -729,7 +732,7 @@ TkWmNewWindow( * detect size and position changes caused by window managers. */ - Tk_CreateEventHandler((Tk_Window) winPtr, StructureNotifyMask, + Tk_CreateEventHandler((Tk_Window)winPtr, StructureNotifyMask, TopLevelEventProc, winPtr); /* @@ -737,7 +740,7 @@ TkWmNewWindow( * window manager. */ - Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0); + Tk_ManageGeometry((Tk_Window)winPtr, &wmMgrType, NULL); } /* @@ -784,7 +787,7 @@ TkWmMapWindow( * Generate configure event when we first map the window. */ - TkGenWMConfigureEvent((Tk_Window) winPtr, wmPtr->x, wmPtr->y, -1, -1, + TkGenWMConfigureEvent((Tk_Window)winPtr, wmPtr->x, wmPtr->y, -1, -1, TK_LOCATION_CHANGED); /* @@ -885,19 +888,19 @@ TkWmDeadWindow( TkWindow *winPtr) /* Top-level window that's being deleted. */ { WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2; - NSWindow *ourNSWindow; + TKWindow *deadNSWindow; if (wmPtr == NULL) { return; } /* - *If the dead window is a transient, remove it from the master's list. + *If the dead window is a transient, remove it from the container's list. */ RemoveTransient(winPtr); - Tk_ManageGeometry((Tk_Window) winPtr, NULL, NULL); - Tk_DeleteEventHandler((Tk_Window) winPtr, StructureNotifyMask, + Tk_ManageGeometry((Tk_Window)winPtr, NULL, NULL); + Tk_DeleteEventHandler((Tk_Window)winPtr, StructureNotifyMask, TopLevelEventProc, winPtr); if (wmPtr->hints.flags & IconPixmapHint) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap); @@ -912,11 +915,11 @@ TkWmDeadWindow( ckfree(wmPtr->leaderName); } if (wmPtr->icon != NULL) { - wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr; + wmPtr2 = ((TkWindow *)wmPtr->icon)->wmInfoPtr; wmPtr2->iconFor = NULL; } if (wmPtr->iconFor != NULL) { - wmPtr2 = ((TkWindow *) wmPtr->iconFor)->wmInfoPtr; + wmPtr2 = ((TkWindow *)wmPtr->iconFor)->wmInfoPtr; wmPtr2->icon = NULL; wmPtr2->hints.flags &= ~IconWindowHint; } @@ -943,11 +946,11 @@ TkWmDeadWindow( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); - if (masterPtr == winPtr) { + if (containerPtr == winPtr) { wmPtr2 = winPtr2->wmInfoPtr; - wmPtr2->master = NULL; + wmPtr2->container = NULL; } } @@ -964,27 +967,27 @@ TkWmDeadWindow( * the parent. Then close and release the NSWindow. */ - ourNSWindow = wmPtr->window; - if (ourNSWindow && !Tk_IsEmbedded(winPtr)) { - NSWindow *parent = [ourNSWindow parentWindow]; - TkMacOSXUnregisterMacWindow(ourNSWindow); + deadNSWindow = (TKWindow *)wmPtr->window; + if (deadNSWindow && !Tk_IsEmbedded(winPtr)) { + NSWindow *parent = [deadNSWindow parentWindow]; + [deadNSWindow setTkWindow:None]; if (winPtr->window) { - ((MacDrawable *) winPtr->window)->view = nil; + ((MacDrawable *)winPtr->window)->view = nil; } wmPtr->window = NULL; if (parent) { - [parent removeChildWindow:ourNSWindow]; + [parent removeChildWindow:deadNSWindow]; } #if DEBUG_ZOMBIES > 1 { - const char *title = [[ourNSWindow title] UTF8String]; + const char *title = [[deadNSWindow title] UTF8String]; if (title == nil) { title = "unnamed window"; } fprintf(stderr, ">>>> Closing <%s>. Count is: %lu\n", title, - [ourNSWindow retainCount]); + [deadNSWindow retainCount]); } #endif @@ -1011,7 +1014,7 @@ TkWmDeadWindow( wmPtr2 = winPtr2->wmInfoPtr; isOnScreen = (wmPtr2->hints.initial_state != IconicState && wmPtr2->hints.initial_state != WithdrawnState); - if (w != ourNSWindow && isOnScreen && [w canBecomeKeyWindow]) { + if (w != deadNSWindow && isOnScreen && [w canBecomeKeyWindow]) { [w makeKeyAndOrderFront:NSApp]; break; } @@ -1021,12 +1024,12 @@ TkWmDeadWindow( * Prevent zombies on systems with a TouchBar. */ - if (ourNSWindow == [NSApp keyWindow]) { + if (deadNSWindow == [NSApp keyWindow]) { [NSApp _setKeyWindow:nil]; [NSApp _setMainWindow:nil]; } - [ourNSWindow close]; - [ourNSWindow release]; + [deadNSWindow close]; + [deadNSWindow release]; [NSApp _resetAutoreleasePool]; #if DEBUG_ZOMBIES > 1 @@ -1065,7 +1068,7 @@ TkWmDeadWindow( void TkWmSetClass( - TkWindow *winPtr) /* Newly-created top-level window. */ + TCL_UNUSED(TkWindow *)) /* Newly-created top-level window. */ { return; } @@ -1087,7 +1090,6 @@ TkWmSetClass( *---------------------------------------------------------------------- */ -/* ARGSUSED */ int Tk_WmObjCmd( ClientData clientData, /* Main window associated with interpreter. */ @@ -1095,7 +1097,7 @@ Tk_WmObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", @@ -1252,7 +1254,7 @@ Tk_WmObjCmd( static int WmAspectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -1434,7 +1436,7 @@ WmSetAttribute( oldFlags, 1, 0); [macWindow setBackgroundColor:boolean ? [NSColor clearColor] : nil]; [macWindow setOpaque:!boolean]; - TkMacOSXInvalidateWindow((MacDrawable *) winPtr->window, + TkMacOSXInvalidateWindow((MacDrawable *)winPtr->window, TK_PARENT_WINDOW); } break; @@ -1520,7 +1522,7 @@ WmGetAttribute( static int WmAttributesCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -1530,12 +1532,12 @@ WmAttributesCmd( NSWindow *macWindow; if (winPtr->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr); + Tk_MakeWindowExist((Tk_Window)winPtr); } if (!TkMacOSXHostToplevelExists(winPtr)) { TkMacOSXMakeRealWindowExist(winPtr); } - macWindow = TkMacOSXDrawableWindow(winPtr->window); + macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (objc == 3) { /* wm attributes $win */ Tcl_Obj *result = Tcl_NewObj(); @@ -1592,7 +1594,7 @@ WmAttributesCmd( static int WmClientCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -1624,7 +1626,7 @@ WmClientCmd( if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } - wmPtr->clientMachine = ckalloc(length + 1); + wmPtr->clientMachine = (char *)ckalloc(length + 1); strcpy(wmPtr->clientMachine, argv3); return TCL_OK; } @@ -1664,7 +1666,7 @@ WmColormapwindowsCmd( return TCL_ERROR; } if (objc == 3) { - Tk_MakeWindowExist((Tk_Window) winPtr); + Tk_MakeWindowExist((Tk_Window)winPtr); resultObj = Tcl_NewObj(); for (i = 0; i < wmPtr->cmapCount; i++) { if ((i == (wmPtr->cmapCount-1)) @@ -1672,7 +1674,7 @@ WmColormapwindowsCmd( break; } Tcl_ListObjAppendElement(NULL, resultObj, - TkNewWindowObj((Tk_Window) wmPtr->cmapList[i])); + TkNewWindowObj((Tk_Window)wmPtr->cmapList[i])); } Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -1681,7 +1683,7 @@ WmColormapwindowsCmd( != TCL_OK) { return TCL_ERROR; } - cmapList = ckalloc((windowObjc+1) * sizeof(TkWindow*)); + cmapList = (TkWindow **)ckalloc((windowObjc+1) * sizeof(TkWindow*)); for (i = 0; i < windowObjc; i++) { if (TkGetWindowFromObj(interp, tkwin, windowObjv[i], (Tk_Window *) &winPtr2) != TCL_OK) { @@ -1692,7 +1694,7 @@ WmColormapwindowsCmd( gotToplevel = 1; } if (winPtr2->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr2); + Tk_MakeWindowExist((Tk_Window)winPtr2); } cmapList[i] = winPtr2; } @@ -1737,7 +1739,7 @@ WmColormapwindowsCmd( static int WmCommandCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -1794,14 +1796,14 @@ WmCommandCmd( static int WmDeiconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1825,27 +1827,27 @@ WmDeiconifyCmd( ZoomState : NormalState); [win setExcludedFromWindowsMenu:NO]; TkMacOSXApplyWindowAttributes(winPtr, win); - [win orderFront:nil]; + [win orderFront:NSApp]; if (wmPtr->icon) { Tk_UnmapWindow((Tk_Window)wmPtr->icon); } /* * If this window has a transient, the transient must also be deiconified if - * it was withdrawn by the master. + * it was withdrawn by the container. */ for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; WmInfo *wmPtr2 = winPtr2->wmInfoPtr; - TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); - if (masterPtr == winPtr) { + if (containerPtr == winPtr) { if ((wmPtr2->hints.initial_state == WithdrawnState) && - ((transientPtr->flags & WITHDRAWN_BY_MASTER) != 0)) { + ((transientPtr->flags & WITHDRAWN_BY_CONTAINER) != 0)) { TkpWmSetState(winPtr2, NormalState); - transientPtr->flags &= ~WITHDRAWN_BY_MASTER; + transientPtr->flags &= ~WITHDRAWN_BY_CONTAINER; } } } @@ -1872,7 +1874,7 @@ WmDeiconifyCmd( static int WmFocusmodelCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -1926,13 +1928,13 @@ WmFocusmodelCmd( static int WmForgetCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { - Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window)winPtr; if (Tk_IsTopLevel(frameWin)) { MacDrawable *macWin; @@ -1940,7 +1942,7 @@ WmForgetCmd( Tk_MakeWindowExist(frameWin); Tk_MakeWindowExist((Tk_Window)winPtr->parentPtr); - macWin = (MacDrawable *) winPtr->window; + macWin = (MacDrawable *)winPtr->window; TkFocusJoin(winPtr); Tk_UnmapWindow(frameWin); @@ -1951,7 +1953,7 @@ WmForgetCmd( macWin->flags &= ~TK_HOST_EXISTS; TkWmDeadWindow(winPtr); - RemapWindows(winPtr, (MacDrawable *) winPtr->parentPtr->window); + RemapWindows(winPtr, (MacDrawable *)winPtr->parentPtr->window); /* * Make sure wm no longer manages this window @@ -1992,7 +1994,7 @@ WmForgetCmd( static int WmFrameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2008,7 +2010,7 @@ WmFrameCmd( } window = wmPtr->reparent; if (window == None) { - window = Tk_WindowId((Tk_Window) winPtr); + window = Tk_WindowId((Tk_Window)winPtr); } sprintf(buf, "0x%" TCL_Z_MODIFIER "x", (size_t)window); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); @@ -2034,14 +2036,14 @@ WmFrameCmd( static int WmGeometryCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); char xSign = '+', ySign = '+'; int width, height, x = wmPtr->x, y= wmPtr->y; char *argv3; @@ -2105,7 +2107,7 @@ WmGeometryCmd( static int WmGridCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2167,7 +2169,7 @@ WmGridCmd( errorMsg = "heightInc can't be <= 0"; goto error; } - Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc, + Tk_SetGrid((Tk_Window)winPtr, reqWidth, reqHeight, widthInc, heightInc); } wmPtr->flags |= WM_UPDATE_SIZE_HINTS; @@ -2238,7 +2240,7 @@ WmGroupCmd( } wmPtr->hints.window_group = Tk_WindowId(tkwin2); wmPtr->hints.flags |= WindowGroupHint; - wmPtr->leaderName = ckalloc(length + 1); + wmPtr->leaderName = (char *)ckalloc(length + 1); strcpy(wmPtr->leaderName, argv3); } return TCL_OK; @@ -2263,7 +2265,7 @@ WmGroupCmd( static int WmIconbitmapCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2288,12 +2290,12 @@ WmIconbitmapCmd( } str = Tcl_GetStringFromObj(objv[3], &len); if (winPtr->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr); + Tk_MakeWindowExist((Tk_Window)winPtr); } if (!TkMacOSXHostToplevelExists(winPtr)) { TkMacOSXMakeRealWindowExist(winPtr); } - if (WmSetAttribute(winPtr, TkMacOSXDrawableWindow(winPtr->window), interp, + if (WmSetAttribute(winPtr, TkMacOSXGetNSWindowForDrawable(winPtr->window), interp, WMATT_TITLEPATH, objv[3]) == TCL_OK) { if (!len) { if (wmPtr->hints.icon_pixmap != None) { @@ -2303,7 +2305,7 @@ WmIconbitmapCmd( wmPtr->hints.flags &= ~IconPixmapHint; } } else { - pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, Tk_GetUid(str)); + pixmap = Tk_GetBitmap(interp, (Tk_Window)winPtr, Tk_GetUid(str)); if (pixmap == None) { return TCL_ERROR; } @@ -2332,7 +2334,7 @@ WmIconbitmapCmd( static int WmIconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2344,14 +2346,14 @@ WmIconifyCmd( return TCL_ERROR; } - if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { + if (Tk_Attributes((Tk_Window)winPtr)->override_redirect) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": override-redirect flag is set", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "OVERRIDE_REDIRECT", NULL); return TCL_ERROR; - } else if (wmPtr->master != NULL) { + } else if (wmPtr->container != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": it is a transient", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "TRANSIENT", NULL); @@ -2377,17 +2379,17 @@ WmIconifyCmd( /* * If this window has a transient the transient must be withdrawn when - * the master is iconified. + * the container is iconified. */ for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); - if (masterPtr == winPtr && + TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + if (containerPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr2, WithdrawnState); - transientPtr->flags |= WITHDRAWN_BY_MASTER; + transientPtr->flags |= WITHDRAWN_BY_CONTAINER; } } @@ -2473,7 +2475,7 @@ WmIconmaskCmd( static int WmIconnameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2498,7 +2500,7 @@ WmIconnameCmd( ckfree(wmPtr->iconName); } argv3 = Tcl_GetStringFromObj(objv[3], &length); - wmPtr->iconName = ckalloc(length + 1); + wmPtr->iconName = (char *)ckalloc(length + 1); strcpy(wmPtr->iconName, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName); @@ -2582,7 +2584,7 @@ WmIconphotoCmd( Tk_SizeOfImage(tk_icon, &width, &height); if (width != 0 && height != 0) { - newIcon = TkMacOSXGetNSImageWithTkImage(winPtr->display, tk_icon, + newIcon = TkMacOSXGetNSImageFromTkImage(winPtr->display, tk_icon, width, height); } Tk_FreeImage(tk_icon); @@ -2615,7 +2617,7 @@ WmIconphotoCmd( static int WmIconpositionCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2698,7 +2700,7 @@ WmIconwindowCmd( if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->hints.flags &= ~IconWindowHint; if (wmPtr->icon != NULL) { - wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr; + wmPtr2 = ((TkWindow *)wmPtr->icon)->wmInfoPtr; wmPtr2->iconFor = NULL; wmPtr2->hints.initial_state = WithdrawnState; } @@ -2715,7 +2717,7 @@ WmIconwindowCmd( NULL); return TCL_ERROR; } - wmPtr2 = ((TkWindow *) tkwin2)->wmInfoPtr; + wmPtr2 = ((TkWindow *)tkwin2)->wmInfoPtr; if (wmPtr2->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s is already an icon for %s", @@ -2726,7 +2728,7 @@ WmIconwindowCmd( if (wmPtr->icon != NULL) { TkWindow *oldIcon = (TkWindow *)wmPtr->icon; WmInfo *wmPtr3 = oldIcon->wmInfoPtr; - NSWindow *win = TkMacOSXDrawableWindow(oldIcon->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(oldIcon->window); /* * The old icon should be withdrawn. @@ -2741,7 +2743,7 @@ WmIconwindowCmd( wmPtr->hints.icon_window = Tk_WindowId(tkwin2); wmPtr->hints.flags |= IconWindowHint; wmPtr->icon = tkwin2; - wmPtr2->iconFor = (Tk_Window) winPtr; + wmPtr2->iconFor = (Tk_Window)winPtr; if (!(wmPtr2->flags & WM_NEVER_MAPPED)) { /* * If the window is in normal or zoomed state, the icon should be @@ -2776,17 +2778,17 @@ WmIconwindowCmd( static int WmManageCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { - Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window)winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; if (!Tk_IsTopLevel(frameWin)) { - MacDrawable *macWin = (MacDrawable *) winPtr->window; + MacDrawable *macWin = (MacDrawable *)winPtr->window; if (!Tk_IsManageable(frameWin)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -2801,8 +2803,8 @@ WmManageCmd( if (wmPtr == NULL) { TkWmNewWindow(winPtr); if (winPtr->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr); - macWin = (MacDrawable *) winPtr->window; + Tk_MakeWindowExist((Tk_Window)winPtr); + macWin = (MacDrawable *)winPtr->window; } } wmPtr = winPtr->wmInfoPtr; @@ -2840,7 +2842,7 @@ WmManageCmd( static int WmMaxsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2894,7 +2896,7 @@ WmMaxsizeCmd( static int WmMinsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2948,7 +2950,7 @@ WmMinsizeCmd( static int WmOverrideredirectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2956,7 +2958,7 @@ WmOverrideredirectCmd( { int flag; XSetWindowAttributes atts; - TKWindow *win = (TKWindow *)TkMacOSXDrawableWindow(winPtr->window); + TKWindow *win = (TKWindow *)TkMacOSXGetNSWindowForDrawable(winPtr->window); if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -2965,7 +2967,7 @@ WmOverrideredirectCmd( if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj( - Tk_Attributes((Tk_Window) winPtr)->override_redirect)); + Tk_Attributes((Tk_Window)winPtr)->override_redirect)); return TCL_OK; } @@ -2973,8 +2975,8 @@ WmOverrideredirectCmd( return TCL_ERROR; } atts.override_redirect = flag ? True : False; - Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); - ApplyMasterOverrideChanges(winPtr, win); + Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); + ApplyContainerOverrideChanges(winPtr, win); return TCL_OK; } @@ -2997,7 +2999,7 @@ WmOverrideredirectCmd( static int WmPositionfromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3063,7 +3065,7 @@ WmPositionfromCmd( static int WmProtocolCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3096,7 +3098,7 @@ WmProtocolCmd( return TCL_OK; } - protocol = Tk_InternAtom((Tk_Window) winPtr, Tcl_GetString(objv[3])); + protocol = Tk_InternAtom((Tk_Window)winPtr, Tcl_GetString(objv[3])); if (objc == 4) { /* * Return the command to handle a given protocol. @@ -3134,12 +3136,12 @@ WmProtocolCmd( } cmd = Tcl_GetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { - protPtr = ckalloc(sizeof(ProtocolHandler)); + protPtr = (ProtocolHandler *)ckalloc(sizeof(ProtocolHandler)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; protPtr->interp = interp; - protPtr->command = ckalloc(cmdLength+1); + protPtr->command = (char *)ckalloc(cmdLength+1); strcpy(protPtr->command, cmd); } return TCL_OK; @@ -3164,7 +3166,7 @@ WmProtocolCmd( static int WmResizableCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3241,7 +3243,7 @@ WmResizableCmd( static int WmSizefromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3334,7 +3336,7 @@ WmStackorderCmd( resultObj = Tcl_NewObj(); for (windowPtr = windows; *windowPtr ; windowPtr++) { Tcl_ListObjAppendElement(NULL, resultObj, - TkNewWindowObj((Tk_Window) *windowPtr)); + TkNewWindowObj((Tk_Window)*windowPtr)); } Tcl_SetObjResult(interp, resultObj); ckfree(windows); @@ -3433,7 +3435,7 @@ WmStackorderCmd( static int WmStateCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3483,7 +3485,7 @@ WmStateCmd( break; case OPT_ICONIC: - if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { + if (Tk_Attributes((Tk_Window)winPtr)->override_redirect) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": override-redirect flag is set", winPtr->pathName)); @@ -3491,7 +3493,7 @@ WmStateCmd( "OVERRIDE_REDIRECT", NULL); return TCL_ERROR; } - if (wmPtr->master != NULL) { + if (wmPtr->container != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": it is a transient", winPtr->pathName)); @@ -3553,7 +3555,7 @@ WmStateCmd( static int WmTitleCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3608,8 +3610,8 @@ WmTransientCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - Tk_Window master; - TkWindow *masterPtr, *w; + Tk_Window container; + TkWindow *containerPtr, *w; WmInfo *wmPtr2; Transient *transient; @@ -3618,27 +3620,27 @@ WmTransientCmd( return TCL_ERROR; } if (objc == 3) { - if (wmPtr->master != NULL) { + if (wmPtr->container != NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(Tk_PathName(wmPtr->master), -1)); + Tcl_NewStringObj(Tk_PathName(wmPtr->container), -1)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { RemoveTransient(winPtr); } else { - if (TkGetWindowFromObj(interp, tkwin, objv[3], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[3], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = (TkWindow*) master; - while (!Tk_TopWinHierarchy(masterPtr)) { + containerPtr = (TkWindow*) container; + while (!Tk_TopWinHierarchy(containerPtr)) { /* - * Ensure that the master window is actually a Tk toplevel. + * Ensure that the container window is actually a Tk toplevel. */ - masterPtr = masterPtr->parentPtr; + containerPtr = containerPtr->parentPtr; } - Tk_MakeWindowExist((Tk_Window)masterPtr); + Tk_MakeWindowExist((Tk_Window)containerPtr); if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3648,7 +3650,7 @@ WmTransientCmd( return TCL_ERROR; } - wmPtr2 = masterPtr->wmInfoPtr; + wmPtr2 = containerPtr->wmInfoPtr; /* * Under some circumstances, wmPtr2 is NULL here. @@ -3662,26 +3664,26 @@ WmTransientCmd( return TCL_ERROR; } - for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL; - w = (TkWindow *)w->wmInfoPtr->master) { + for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; + w = (TkWindow *)w->wmInfoPtr->container) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "setting \"%s\" as master creates a transient/master cycle", - Tk_PathName(masterPtr))); + Tk_PathName(containerPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } } /* - * Add the transient to the master's list, if it not already there. + * Add the transient to the container's list, if it not already there. */ for (transient = wmPtr2->transientPtr; transient != NULL && transient->winPtr != winPtr; transient = transient->nextPtr) {} if (transient == NULL) { - transient = ckalloc(sizeof(Transient)); + transient = (Transient *)ckalloc(sizeof(Transient)); transient->winPtr = winPtr; transient->flags = 0; transient->nextPtr = wmPtr2->transientPtr; @@ -3689,19 +3691,19 @@ WmTransientCmd( } /* - * If the master is withdrawn or iconic then withdraw the transient. + * If the container is withdrawn or iconic then withdraw the transient. */ if ((wmPtr2->hints.initial_state == WithdrawnState || wmPtr2->hints.initial_state == IconicState) && wmPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr, WithdrawnState); - transient->flags |= WITHDRAWN_BY_MASTER; + transient->flags |= WITHDRAWN_BY_CONTAINER; } - wmPtr->master = (Tk_Window) masterPtr; + wmPtr->container = (Tk_Window)containerPtr; } - ApplyMasterOverrideChanges(winPtr, NULL); + ApplyContainerOverrideChanges(winPtr, NULL); return TCL_OK; } @@ -3710,15 +3712,15 @@ WmTransientCmd( * * RemoveTransient -- * - * Clears the transient's master record and removes the transient from the - * master's list. + * Clears the transient's container record and removes the transient from the + * container's list. * * Results: * None * * Side effects: - * References to a master are removed from the transient's wmInfo - * structure and references to the transient are removed from its master's + * References to a container are removed from the transient's wmInfo + * structure and references to the transient are removed from its container's * wmInfo. * *---------------------------------------------------------------------- @@ -3729,18 +3731,18 @@ RemoveTransient( TkWindow *winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2; - TkWindow *masterPtr; + TkWindow *containerPtr; Transient *transPtr, *temp; - if (wmPtr == NULL || wmPtr->master == NULL) { + if (wmPtr == NULL || wmPtr->container == NULL) { return; } - masterPtr = (TkWindow *)wmPtr->master; - wmPtr2 = masterPtr->wmInfoPtr; + containerPtr = (TkWindow *)wmPtr->container; + wmPtr2 = containerPtr->wmInfoPtr; if (wmPtr2 == NULL) { return; } - wmPtr->master = NULL; + wmPtr->container= NULL; transPtr = wmPtr2->transientPtr; while (transPtr != NULL) { if (transPtr->winPtr != winPtr) { @@ -3781,7 +3783,7 @@ RemoveTransient( static int WmWithdrawCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3811,12 +3813,12 @@ WmWithdrawCmd( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); - if (masterPtr == winPtr && + if (containerPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr2, WithdrawnState); - transientPtr->flags |= WITHDRAWN_BY_MASTER; + transientPtr->flags |= WITHDRAWN_BY_CONTAINER; } } @@ -3873,7 +3875,7 @@ Tk_SetGrid( int widthInc, int heightInc)/* Pixel increments corresponding to a change * of one grid unit. */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; WmInfo *wmPtr; /* @@ -3967,7 +3969,7 @@ Tk_UnsetGrid( Tk_Window tkwin) /* Token for window that is currently * controlling gridding. */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; WmInfo *wmPtr; /* @@ -4040,7 +4042,7 @@ TopLevelEventProc( Tk_ErrorHandler handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, NULL, NULL); - Tk_DestroyWindow((Tk_Window) winPtr); + Tk_DestroyWindow((Tk_Window)winPtr); Tk_DeleteErrorHandler(handler); } if (wmTracing) { @@ -4069,13 +4071,12 @@ TopLevelEventProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void TopLevelReqProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(void *), /* Not used. */ Tk_Window tkwin) /* Information about window. */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; WmInfo *wmPtr; wmPtr = winPtr->wmInfoPtr; @@ -4255,7 +4256,7 @@ UpdateGeometryInfo( wmPtr->x = wmPtr->y = 0; wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y); - Tk_GeometryRequest((Tk_Window) contWinPtr, width, height); + Tk_GeometryRequest((Tk_Window)contWinPtr, width, height); } return; } @@ -4508,7 +4509,7 @@ Tk_GetRootCoords( int *yPtr) /* Where to store y-displacement of (0,0). */ { int x, y; - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; /* * Search back through this window's parents all the way to a top-level @@ -4535,17 +4536,17 @@ Tk_GetRootCoords( /* * We do not require that the changes.x & changes.y for a - * non-Tk master window be kept up to date. So we first - * subtract off the possibly bogus values that have been - * added on at the top of this pass through the loop, and - * then call out to the getOffsetProc to give us the - * correct offset. + * non-Tk container window be kept up to date. So we + * first subtract off the possibly bogus values that have + * been added on at the top of this pass through the + * loop, and then call out to the getOffsetProc to give + * us the correct offset. */ x -= winPtr->changes.x + winPtr->changes.border_width; y -= winPtr->changes.y + winPtr->changes.border_width; - tkMacOSXEmbedHandler->getOffsetProc((Tk_Window) winPtr, + tkMacOSXEmbedHandler->getOffsetProc((Tk_Window)winPtr, &theOffset); x += theOffset.h; @@ -4672,10 +4673,10 @@ Tk_CoordsToWindow( } winPtr = nextPtr; } - if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) { + if (winPtr->mainPtr != ((TkWindow *)tkwin)->mainPtr) { return NULL; } - return (Tk_Window) winPtr; + return (Tk_Window)winPtr; } /* @@ -4715,7 +4716,7 @@ Tk_TopCoordsToWindow( int x, y; /* Coordinates in winPtr. */ Window *children; /* Children of winPtr, or NULL. */ - winPtr = (TkWindow *) tkwin; + winPtr = (TkWindow *)tkwin; x = rootX; y = rootY; while (1) { @@ -4768,7 +4769,7 @@ Tk_TopCoordsToWindow( } *newX = x; *newY = y; - return (Tk_Window) winPtr; + return (Tk_Window)winPtr; } /* @@ -4869,7 +4870,7 @@ Tk_GetVRootGeometry( int *heightPtr) { WmInfo *wmPtr; - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; /* * Find the top-level window for tkwin, and locate the window manager @@ -4920,7 +4921,7 @@ Tk_MoveToplevelWindow( Tk_Window tkwin, /* Window to move. */ int x, int y) /* New location for window (within parent). */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; WmInfo *wmPtr = winPtr->wmInfoPtr; if (!(winPtr->flags & TK_TOP_LEVEL)) { @@ -4990,7 +4991,7 @@ TkWmRestackToplevel( wmPtr->hints.initial_state == WithdrawnState) { return; } - macWindow = TkMacOSXDrawableWindow(winPtr->window); + macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (macWindow == nil) { return; } @@ -5006,7 +5007,7 @@ TkWmRestackToplevel( otherWmPtr->hints.initial_state == WithdrawnState) { return; } - otherMacWindow = TkMacOSXDrawableWindow(otherPtr->window); + otherMacWindow = TkMacOSXGetNSWindowForDrawable(otherPtr->window); if (otherMacWindow == nil) { return; } @@ -5095,7 +5096,7 @@ TkWmAddToColormapWindows( * add the toplevel itself as the last element of the list. */ - newPtr = ckalloc((count+2) * sizeof(TkWindow *)); + newPtr = (TkWindow **)ckalloc((count+2) * sizeof(TkWindow *)); if (count > 0) { memcpy(newPtr, oldPtr, count * sizeof(TkWindow *)); } @@ -5207,7 +5208,7 @@ TkWmRemoveFromColormapWindows( void TkGetPointerCoords( - Tk_Window tkwin, /* Toplevel window that identifies screen on + TCL_UNUSED(Tk_Window), /* Toplevel window that identifies screen on * which lookup is to be done. */ int *xPtr, int *yPtr) /* Store pointer coordinates here. */ { @@ -5315,8 +5316,8 @@ TkMacOSXResizable( int TkMacOSXGrowToplevel( - void *whichWindow, - XPoint start) + TCL_UNUSED(void *), + TCL_UNUSED(XPoint)) { return false; } @@ -5348,7 +5349,7 @@ TkSetWMName( } NSString *title = [[NSString alloc] initWithUTF8String:titleUid]; - [TkMacOSXDrawableWindow(winPtr->window) setTitle:title]; + [TkMacOSXGetNSWindowForDrawable(winPtr->window) setTitle:title]; [title release]; } @@ -5358,10 +5359,10 @@ TkSetWMName( * TkGetTransientMaster -- * * If the passed window has the TRANSIENT_FOR property set this will - * return the master window. Otherwise it will return None. + * return the container window. Otherwise it will return None. * * Results: - * The master window or None. + * The container window or None. * * Side effects: * None. @@ -5374,7 +5375,7 @@ TkGetTransientMaster( TkWindow *winPtr) { if (winPtr->wmInfoPtr != NULL) { - return (Tk_Window)winPtr->wmInfoPtr->master; + return (Tk_Window)winPtr->wmInfoPtr->container; } return NULL; } @@ -5384,7 +5385,8 @@ TkGetTransientMaster( * * TkMacOSXGetXWindow -- * - * Returns the X window Id associated with the given NSWindow*. + * Stub function that returns the X window Id associated with the + * given NSWindow*. * * Results: * The window id is returned. None is returned if not a Tk window. @@ -5399,27 +5401,26 @@ Window TkMacOSXGetXWindow( void *macWinPtr) { - Tcl_HashEntry *hPtr; - - if (!macWinPtr || !windowHashInit) { - return None; + Window window = None; + TKWindow *w = (TKWindow *)macWinPtr; + if ([w respondsToSelector: @selector (tkWindow)]) { + window = [w tkWindow]; } - hPtr = Tcl_FindHashEntry(&windowTable, macWinPtr); - if (hPtr == NULL) { - return None; - } - return (Window) Tcl_GetHashValue(hPtr); + return window ? window : None; } /* *---------------------------------------------------------------------- * - * TkMacOSXGetTkWindow -- + * Tk_MacOSXGetTkWindow -- * - * Returns the TkWindow* associated with the given NSWindow*. + * Returns the Tk_Window associated with the given NSWindow*. This + * function is a stub, so the NSWindow* parameter must be declared as + * void*. * * Results: - * The TkWindow* returned. NULL is returned if not a Tk window. + * A Tk_Window, or NULL if the NSWindow is not associated with + * any Tk window. * * Side effects: * None. @@ -5427,15 +5428,17 @@ TkMacOSXGetXWindow( *---------------------------------------------------------------------- */ -TkWindow* -TkMacOSXGetTkWindow( - NSWindow *w) +Tk_Window +Tk_MacOSXGetTkWindow( + void *w) { - Window window = TkMacOSXGetXWindow(w); + Window window = None; TkDisplay *dispPtr = TkGetDisplayList(); - + if ([(NSWindow *)w respondsToSelector: @selector (tkWindow)]) { + window = [(TKWindow *)w tkWindow]; + } return (window != None ? - (TkWindow *)Tk_IdToWindow(dispPtr->display, window) : NULL); + Tk_IdToWindow(dispPtr->display, window) : NULL); } /* @@ -5460,7 +5463,7 @@ MODULE_SCOPE int TkMacOSXIsWindowZoomed( TkWindow *winPtr) { - NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); return [macWindow isZoomed]; } @@ -5533,7 +5536,6 @@ TkMacOSXZoomToplevel( *---------------------------------------------------------------------- */ -/* ARGSUSED */ int TkUnsupported1ObjCmd( ClientData clientData, /* Main window associated with interpreter. */ @@ -5616,7 +5618,7 @@ TkUnsupported1ObjCmd( return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj( - TkMacOSXInDarkMode((Tk_Window) winPtr))); + TkMacOSXInDarkMode((Tk_Window)winPtr))); return TCL_OK; default: return TCL_ERROR; @@ -5669,14 +5671,14 @@ WmWinStyle( { "altPlain", kAltPlainWindowClass }, { "simple", kSimpleWindowClass }, { "drawer", kDrawerWindowClass }, - { NULL } + { NULL, 0 } }; static const struct StrIntMap compositeAttrMap[] = { { "none", kWindowNoAttributes }, { "standardDocument", kWindowStandardDocumentAttributes }, { "standardFloating", kWindowStandardFloatingAttributes }, { "fullZoom", kWindowFullZoomAttribute }, - { NULL } + { NULL, 0 } }; /* @@ -5713,7 +5715,7 @@ WmWinStyle( { "moveToActiveSpace", tkMoveToActiveSpaceAttribute }, { "nonActivating", tkNonactivatingPanelAttribute }, { "hud", tkHUDWindowAttribute }, - { NULL } + { NULL, 0 } }; int index, i; @@ -5843,13 +5845,14 @@ WmWinTabbingId( #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101200) Tcl_Obj *result = NULL; NSString *idString; - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (win) { idString = win.tabbingIdentifier; result = Tcl_NewStringObj(idString.UTF8String, [idString length]); } if (result == NULL) { - NSLog(@"Failed to read tabbing identifier; try calling update idletasks before getting/setting the tabbing identifier of the window."); + NSLog(@"Failed to read tabbing identifier; try calling update idletasks" + " before getting/setting the tabbing identifier of the window."); return TCL_OK; } Tcl_SetObjResult(interp, result); @@ -5933,7 +5936,7 @@ WmWinAppearance( #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 const char *resultString = "unrecognized"; - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (win) { appearance = win.appearance.name; if (appearance == nil) { @@ -6008,7 +6011,7 @@ TkpMakeMenuWindow( * is always visible, e.g. as a floating * menu. */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; if (transient) { winPtr->wmInfoPtr->macClass = kSimpleWindowClass; @@ -6045,13 +6048,13 @@ TkMacOSXMakeRealWindowExist( WmInfo *wmPtr = winPtr->wmInfoPtr; MacDrawable *macWin; WindowClass macClass; - Bool overrideRedirect = Tk_Attributes((Tk_Window) winPtr)->override_redirect; + Bool overrideRedirect = Tk_Attributes((Tk_Window)winPtr)->override_redirect; if (TkMacOSXHostToplevelExists(winPtr)) { return; } - macWin = (MacDrawable *) winPtr->window; + macWin = (MacDrawable *)winPtr->window; /* * If this is embedded, make sure its container's toplevel exists, then @@ -6072,7 +6075,7 @@ TkMacOSXMakeRealWindowExist( Tcl_Panic("TkMacOSXMakeRealWindowExist could not find container"); } if (tkMacOSXEmbedHandler->containerExistProc && - tkMacOSXEmbedHandler->containerExistProc((Tk_Window) winPtr) + tkMacOSXEmbedHandler->containerExistProc((Tk_Window)winPtr) != TCL_OK) { Tcl_Panic("ContainerExistProc could not make container"); } @@ -6112,16 +6115,18 @@ TkMacOSXMakeRealWindowExist( NSUnifiedTitleAndToolbarWindowMask : 0) | ((attributes & kWindowSideTitlebarAttribute) ? 1 << 9 : 0) | (attributes >> WM_NSMASK_SHIFT); - Class winClass = (macClass == kDrawerWindowClass ? [NSDrawerWindow class] : + Class winClass = (macClass == kDrawerWindowClass ? [TKDrawerWindow class] : (styleMask & (NSUtilityWindowMask|NSDocModalWindowMask| - NSNonactivatingPanelMask|NSHUDWindowMask)) ? [NSPanel class] : + NSNonactivatingPanelMask|NSHUDWindowMask)) ? [TKPanel class] : [TKWindow class]); NSRect structureRect = [winClass frameRectForContentRect:NSZeroRect styleMask:styleMask]; NSRect contentRect = NSMakeRect(5 - structureRect.origin.x, TkMacOSXZeroScreenHeight() - (TkMacOSXZeroScreenTop() + 5 + structureRect.origin.y + structureRect.size.height + 200), 200, 200); - NSWindow *window = [[winClass alloc] initWithContentRect:contentRect + if (wmPtr->hints.initial_state == WithdrawnState) { + } + TKWindow *window = [[winClass alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:YES]; if (!window) { Tcl_Panic("couldn't allocate new Mac window"); @@ -6134,7 +6139,7 @@ TkMacOSXMakeRealWindowExist( [window setAcceptsMouseMovedEvents:YES]; [window setReleasedWhenClosed:NO]; if (styleMask & NSUtilityWindowMask) { - [(NSPanel*)window setFloatingPanel:YES]; + [(TKPanel*)window setFloatingPanel:YES]; } if ((styleMask & (NSTexturedBackgroundWindowMask|NSHUDWindowMask)) && !(styleMask & NSDocModalWindowMask)) { @@ -6154,15 +6159,15 @@ TkMacOSXMakeRealWindowExist( geometry.origin.y = TkMacOSXZeroScreenHeight() - (geometry.origin.y + geometry.size.height); [window setFrame:geometry display:YES]; - TkMacOSXRegisterOffScreenWindow((Window) macWin, window); + [window setTkWindow: (Window) macWin]; macWin->flags |= TK_HOST_EXISTS; if (overrideRedirect) { XSetWindowAttributes atts; atts.override_redirect = True; - Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); - ApplyMasterOverrideChanges(winPtr, NULL); + Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); + ApplyContainerOverrideChanges(winPtr, NULL); } } @@ -6186,7 +6191,7 @@ TkMacOSXMakeRealWindowExist( void TkpRedrawWidget(Tk_Window tkwin) { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; NSWindow *w; Rect tkBounds; NSRect bounds; @@ -6194,7 +6199,7 @@ TkpRedrawWidget(Tk_Window tkwin) { if ([NSApp isDrawing]) { return; } - w = TkMacOSXDrawableWindow(winPtr->window); + w = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (w) { TKContentView *view = [w contentView]; TkMacOSXWinBounds(winPtr, &tkBounds); @@ -6207,75 +6212,6 @@ TkpRedrawWidget(Tk_Window tkwin) { } } -/* - *---------------------------------------------------------------------- - * - * TkMacOSXRegisterOffScreenWindow -- - * - * This function adds the passed in Off Screen Port to the hash table that - * maps Mac windows to root X windows. - * - * Results: - * None. - * - * Side effects: - * An entry is added to the windowTable hash table. - * - *---------------------------------------------------------------------- - */ - -void -TkMacOSXRegisterOffScreenWindow( - Window window, /* Window structure. */ - void *portPtr) /* Pointer to a Mac Window. */ -{ - Tcl_HashEntry *valueHashPtr; - int isNew; - - if (!windowHashInit) { - Tcl_InitHashTable(&windowTable, TCL_ONE_WORD_KEYS); - windowHashInit = true; - } - valueHashPtr = Tcl_CreateHashEntry(&windowTable, (char *) portPtr, &isNew); - if (!isNew) { - Tcl_Panic("Same macintosh window allocated twice!"); - } - Tcl_SetHashValue(valueHashPtr, window); -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXUnregisterMacWindow -- - * - * Given a macintosh port window, this function removes the association - * between this window and the root X window that Tk cares about. - * - * Results: - * None. - * - * Side effects: - * An entry is removed from the windowTable hash table. - * - *---------------------------------------------------------------------- - */ - -void -TkMacOSXUnregisterMacWindow( - void *macWinPtr) /* Reference to a Mac Window */ -{ - Tcl_HashEntry *entryPtr; - - if (!windowHashInit) { - Tcl_Panic("TkMacOSXUnregisterMacWindow: unmapping before inited"); - } - entryPtr = Tcl_FindHashEntry(&windowTable, macWinPtr); - if (!entryPtr) { - TkMacOSXDbgMsg("Failed to find window %p", macWinPtr); - } else { - Tcl_DeleteHashEntry(entryPtr); - } -} /* *---------------------------------------------------------------------- @@ -6403,10 +6339,10 @@ TkpWmSetState( return; } - macWin = TkMacOSXDrawableWindow(winPtr->window); + macWin = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (state == WithdrawnState) { - Tk_UnmapWindow((Tk_Window) winPtr); + Tk_UnmapWindow((Tk_Window)winPtr); } else if (state == IconicState) { /* @@ -6418,9 +6354,9 @@ TkpWmSetState( ![macWin isMiniaturized]) { [macWin miniaturize:NSApp]; } - Tk_UnmapWindow((Tk_Window) winPtr); + Tk_UnmapWindow((Tk_Window)winPtr); } else if (state == NormalState || state == ZoomState) { - Tk_MapWindow((Tk_Window) winPtr); + Tk_MapWindow((Tk_Window)winPtr); [macWin deminiaturize:NSApp]; [macWin orderFront:NSApp]; TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn : inZoomOut); @@ -6456,29 +6392,6 @@ TkpIsWindowFloating( } /* - *---------------------------------------------------------------------- - * - * TkMacOSXWindowClass -- - * - * Returns OS X window class of window - * - * Results: - * 1 or 0 depending on window's floating attribute. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -MODULE_SCOPE WindowClass -TkMacOSXWindowClass( - TkWindow *winPtr) -{ - return winPtr->wmInfoPtr->macClass; -} - -/* *-------------------------------------------------------------- * * TkMacOSXWindowOffset -- @@ -6557,10 +6470,10 @@ TkpGetMS(void) int XSetInputFocus( - Display* display, - Window focus, - int revert_to, - Time time) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(int), + TCL_UNUSED(Time)) { /* * Don't need to do a thing. Tk manages the focus for us. @@ -6602,7 +6515,7 @@ TkpChangeFocus( } if (Tk_IsTopLevel(winPtr) && !Tk_IsEmbedded(winPtr)) { - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); TkWmRestackToplevel(winPtr, Above, NULL); if (force) { @@ -6657,7 +6570,7 @@ WmStackorderToplevelWrapperMap( if (Tk_IsMapped(winPtr) && Tk_IsTopLevel(winPtr) && !Tk_IsEmbedded(winPtr) && (winPtr->display == display)) { hPtr = Tcl_CreateHashEntry(table, - (char*) TkMacOSXDrawableWindow(winPtr->window), &newEntry); + (void *)TkMacOSXGetNSWindowForDrawable(winPtr->window), &newEntry); Tcl_SetHashValue(hPtr, winPtr); } @@ -6695,7 +6608,7 @@ TkWmStackorderToplevel( NSArray* backToFront = [[macWindows reverseObjectEnumerator] allObjects]; NSInteger windowCount = [macWindows count]; - windows = windowPtr = ckalloc((windowCount + 1) * sizeof(TkWindow *)); + windows = windowPtr = (TkWindow **)ckalloc((windowCount + 1) * sizeof(TkWindow *)); if (windows != NULL) { Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); @@ -6736,8 +6649,8 @@ TkMacOSXApplyWindowAttributes( WmInfo *wmPtr = winPtr->wmInfoPtr; ApplyWindowAttributeFlagChanges(winPtr, macWindow, 0, 0, 0, 1); - if (wmPtr->master != NULL || winPtr->atts.override_redirect) { - ApplyMasterOverrideChanges(winPtr, macWindow); + if (wmPtr->container != NULL || winPtr->atts.override_redirect) { + ApplyContainerOverrideChanges(winPtr, macWindow); } } @@ -6777,7 +6690,7 @@ ApplyWindowAttributeFlagChanges( if (!create) { return; } - Tk_MakeWindowExist((Tk_Window) winPtr); + Tk_MakeWindowExist((Tk_Window)winPtr); } if (!TkMacOSXHostToplevelExists(winPtr)) { if (!create) { @@ -6785,7 +6698,7 @@ ApplyWindowAttributeFlagChanges( } TkMacOSXMakeRealWindowExist(winPtr); } - macWindow = TkMacOSXDrawableWindow(winPtr->window); + macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); } if ((changedAttributes & kWindowCloseBoxAttribute) || initial) { [[macWindow standardWindowButton:NSWindowCloseButton] @@ -6870,7 +6783,7 @@ ApplyWindowAttributeFlagChanges( */ if ((winPtr->atts.override_redirect) || - (wmPtr->master != NULL) || + (wmPtr->container != NULL) || (winPtr->wmInfoPtr->macClass == kHelpWindowClass)) { b |= (NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorFullScreenAuxiliary); @@ -6909,7 +6822,7 @@ ApplyWindowAttributeFlagChanges( if ((wmPtr->flags & WM_TOPMOST) != (oldFlags & WM_TOPMOST)) { [macWindow setLevel:(wmPtr->flags & WM_TOPMOST) ? kCGUtilityWindowLevel : ([macWindow isKindOfClass: - [NSPanel class]] && [macWindow isFloatingPanel] ? + [TKPanel class]] && [macWindow isFloatingPanel] ? kCGFloatingWindowLevel : kCGNormalWindowLevel)]; } @@ -6930,9 +6843,9 @@ ApplyWindowAttributeFlagChanges( /* *---------------------------------------------------------------------- * - * ApplyMasterOverrideChanges -- + * ApplyContainerOverrideChanges -- * - * This procedure applies changes to override_redirect or master. + * This procedure applies changes to override_redirect or container. * * Results: * None. @@ -6944,7 +6857,7 @@ ApplyWindowAttributeFlagChanges( */ static void -ApplyMasterOverrideChanges( +ApplyContainerOverrideChanges( TkWindow *winPtr, NSWindow *macWindow) { @@ -6957,7 +6870,7 @@ ApplyMasterOverrideChanges( if (!macWindow && winPtr->window != None && TkMacOSXHostToplevelExists(winPtr)) { - macWindow = TkMacOSXDrawableWindow(winPtr->window); + macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); } styleMask = [macWindow styleMask]; @@ -6978,7 +6891,7 @@ ApplyMasterOverrideChanges( } } else { if (wmPtr->macClass == kSimpleWindowClass && - oldAttributes == kWindowNoActivatesAttribute) { + (oldAttributes & kWindowNoActivatesAttribute)) { wmPtr->macClass = kDocumentWindowClass; wmPtr->attributes = macClassAttrs[kDocumentWindowClass].defaultAttrs; @@ -7010,9 +6923,9 @@ ApplyMasterOverrideChanges( [macWindow setExcludedFromWindowsMenu:YES]; [macWindow setStyleMask:styleMask]; if (wmPtr->hints.initial_state == NormalState) { - [macWindow orderFront:nil]; + [macWindow orderFront:NSApp]; } - if (wmPtr->master != NULL) { + if (wmPtr->container != NULL) { wmPtr->flags |= WM_TOPMOST; } else { wmPtr->flags &= ~WM_TOPMOST; @@ -7028,24 +6941,24 @@ ApplyMasterOverrideChanges( [macWindow setExcludedFromWindowsMenu:NO]; wmPtr->flags &= ~WM_TOPMOST; } - if (wmPtr->master != None) { - TkWindow *masterWinPtr = (TkWindow *) wmPtr->master; + if (wmPtr->container != None) { + TkWindow *containerWinPtr = (TkWindow *)wmPtr->container; - if (masterWinPtr && (masterWinPtr->window != None) - && TkMacOSXHostToplevelExists(masterWinPtr)) { - NSWindow *masterMacWin = TkMacOSXDrawableWindow( - masterWinPtr->window); + if (containerWinPtr && (containerWinPtr->window != None) + && TkMacOSXHostToplevelExists(containerWinPtr)) { + NSWindow *containerMacWin = TkMacOSXGetNSWindowForDrawable( + containerWinPtr->window); /* * Try to add the transient window as a child window of the - * master. A child NSWindow retains its relative position with - * respect to the parent when the parent is moved. This is - * pointless if the parent is offscreen, and adding a child to - * an offscreen window causes the parent to be displayed as a - * zombie. So we only do this if the parent is visible. + * container. A child NSWindow retains its relative position + * with respect to the parent when the parent is moved. This + * is pointless if the parent is offscreen, and adding a child + * to an offscreen window causes the parent to be displayed as + * a zombie. So we only do this if the parent is visible. */ - if (masterMacWin && [masterMacWin isVisible] + if (containerMacWin && [containerMacWin isVisible] && (winPtr->flags & TK_MAPPED)) { /* * If the transient is already a child of some other window, @@ -7053,11 +6966,11 @@ ApplyMasterOverrideChanges( */ parentWindow = [macWindow parentWindow]; - if (parentWindow && parentWindow != masterMacWin) { + if (parentWindow && parentWindow != containerMacWin) { [parentWindow removeChildWindow:macWindow]; } - [masterMacWin addChildWindow:macWindow + [containerMacWin addChildWindow:macWindow ordered:NSWindowAbove]; } } @@ -7257,7 +7170,7 @@ RemapWindows( */ if (winPtr->window != None) { - MacDrawable *macWin = (MacDrawable *) winPtr->window; + MacDrawable *macWin = (MacDrawable *)winPtr->window; macWin->toplevel->referenceCount--; macWin->toplevel = parentWin->toplevel; @@ -7274,7 +7187,7 @@ RemapWindows( for (childPtr = winPtr->childList; childPtr != NULL; childPtr = childPtr->nextPtr) { - RemapWindows(childPtr, (MacDrawable *) winPtr->window); + RemapWindows(childPtr, (MacDrawable *)winPtr->window); } } diff --git a/macosx/tkMacOSXWm.h b/macosx/tkMacOSXWm.h index 20bbb6d..19bf379 100644 --- a/macosx/tkMacOSXWm.h +++ b/macosx/tkMacOSXWm.h @@ -37,7 +37,7 @@ typedef struct ProtocolHandler { } ProtocolHandler; /* The following data structure is used in the TkWmInfo to maintain a list of all of the - * transient windows belonging to a given master. + * transient windows belonging to a given container. */ typedef struct Transient { @@ -46,6 +46,7 @@ typedef struct Transient { struct Transient *nextPtr; } Transient; +#define WITHDRAWN_BY_CONTAINER 0x1 #define WITHDRAWN_BY_MASTER 0x1 /* @@ -65,8 +66,8 @@ typedef struct TkWmInfo { Tk_Uid titleUid; /* Title to display in window caption. If NULL, * use name of widget. */ char *iconName; /* Name to display in icon. */ - Tk_Window master; /* Master window for TRANSIENT_FOR property, or - * None. */ + Tk_Window container; /* Container window for TRANSIENT_FOR property, + * or None. */ XWMHints hints; /* Various pieces of information for window * manager. */ char *leaderName; /* Path name of leader of window group diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index dc9ea32..aa1108e 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -201,8 +201,8 @@ TkpOpenDisplay( } } - display = ckalloc(sizeof(Display)); - screen = ckalloc(sizeof(Screen)); + display = (Display *)ckalloc(sizeof(Display)); + screen = (Screen *)ckalloc(sizeof(Screen)); bzero(display, sizeof(Display)); bzero(screen, sizeof(Screen)); @@ -254,7 +254,7 @@ TkpOpenDisplay( screen->white_pixel = 0x00FFFFFF; screen->ext_data = (XExtData *) &maxBounds; - screen->root_visual = ckalloc(sizeof(Visual)); + screen->root_visual = (Visual *)ckalloc(sizeof(Visual)); screen->root_visual->visualid = 0; screen->root_visual->c_class = TrueColor; screen->root_visual->red_mask = 0x00FF0000; @@ -269,7 +269,7 @@ TkpOpenDisplay( TkMacOSXDisplayChanged(display); - gMacDisplay = ckalloc(sizeof(TkDisplay)); + gMacDisplay = (TkDisplay *)ckalloc(sizeof(TkDisplay)); /* * This is the quickest way to make sure that all the *Init flags get @@ -387,7 +387,7 @@ TkClipCleanup( static XID MacXIdAlloc( - Display *display) /* Display for which to allocate. */ + TCL_UNUSED(Display *)) /* Display for which to allocate. */ { static long int cur_id = 100; /* @@ -417,8 +417,8 @@ MacXIdAlloc( static int DefaultErrorHandler( - Display* display, - XErrorEvent* err_evt) + TCL_UNUSED(Display *), + TCL_UNUSED(XErrorEvent *)) { /* * This call should never be called. Tk replaces it with its own error @@ -431,8 +431,8 @@ DefaultErrorHandler( char * XGetAtomName( - Display * display, - Atom atom) + Display *display, + TCL_UNUSED(Atom)) { display->request++; return NULL; @@ -440,7 +440,7 @@ XGetAtomName( XErrorHandler XSetErrorHandler( - XErrorHandler handler) + TCL_UNUSED(XErrorHandler)) { return DefaultErrorHandler; } @@ -448,7 +448,7 @@ XSetErrorHandler( Window XRootWindow( Display *display, - int screen_number) + TCL_UNUSED(int)) { display->request++; return ROOT_ID; @@ -466,7 +466,7 @@ XGetGeometry( unsigned int *border_width_return, unsigned int *depth_return) { - TkWindow *winPtr = ((MacDrawable *) d)->winPtr; + TkWindow *winPtr = ((MacDrawable *)d)->winPtr; display->request++; *root_return = ROOT_ID; @@ -478,7 +478,7 @@ XGetGeometry( *border_width_return = winPtr->changes.border_width; *depth_return = Tk_Depth(winPtr); } else { - CGSize size = ((MacDrawable *) d)->size; + CGSize size = ((MacDrawable *)d)->size; *x_return = 0; *y_return = 0; *width_return = size.width; @@ -491,14 +491,14 @@ XGetGeometry( int XChangeProperty( - Display* display, - Window w, - Atom property, - Atom type, - int format, - int mode, - _Xconst unsigned char* data, - int nelements) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Atom), + TCL_UNUSED(Atom), + TCL_UNUSED(int), + TCL_UNUSED(int), + TCL_UNUSED(_Xconst unsigned char *), + TCL_UNUSED(int)) { Debugger(); return Success; @@ -506,9 +506,9 @@ XChangeProperty( int XSelectInput( - Display* display, - Window w, - long event_mask) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(long)) { Debugger(); return Success; @@ -516,40 +516,16 @@ XSelectInput( int XBell( - Display* display, - int percent) + TCL_UNUSED(Display *), + TCL_UNUSED(int)) { NSBeep(); return Success; } -#if 0 -void -XSetWMNormalHints( - Display* display, - Window w, - XSizeHints* hints) -{ - /* - * Do nothing. Shouldn't even be called. - */ -} - -XSizeHints * -XAllocSizeHints(void) -{ - /* - * Always return NULL. Tk code checks to see if NULL is returned & does - * nothing if it is. - */ - - return NULL; -} -#endif - GContext XGContextFromGC( - GC gc) + TCL_UNUSED(GC)) { /* * TODO: currently a no-op @@ -560,11 +536,11 @@ XGContextFromGC( Status XSendEvent( - Display* display, - Window w, - Bool propagate, - long event_mask, - XEvent* event_send) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Bool), + TCL_UNUSED(long), + TCL_UNUSED(XEvent *)) { Debugger(); return 0; @@ -572,56 +548,31 @@ XSendEvent( int XClearWindow( - Display* display, - Window w) + TCL_UNUSED(Display *), + TCL_UNUSED(Window)) { return Success; } -/* -int -XDrawPoint( - Display* display, - Drawable d, - GC gc, - int x, - int y) -{ - return Success; -} - -int -XDrawPoints( - Display* display, - Drawable d, - GC gc, - XPoint* points, - int npoints, - int mode) -{ - return Success; -} -*/ - int XWarpPointer( - Display* display, - Window src_w, - Window dest_w, - int src_x, - int src_y, - unsigned int src_width, - unsigned int src_height, - int dest_x, - int dest_y) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Window), + TCL_UNUSED(int), + TCL_UNUSED(int), + TCL_UNUSED(unsigned int), + TCL_UNUSED(unsigned int), + TCL_UNUSED(int), + TCL_UNUSED(int)) { return Success; } int XQueryColor( - Display* display, - Colormap colormap, + TCL_UNUSED(Display *), + TCL_UNUSED(Colormap), XColor* def_in_out) { unsigned long p; @@ -642,8 +593,8 @@ XQueryColor( int XQueryColors( - Display* display, - Colormap colormap, + TCL_UNUSED(Display *), + TCL_UNUSED(Colormap), XColor* defs_in_out, int ncolors) { @@ -667,14 +618,13 @@ XQueryColors( } int -XQueryTree(display, w, root_return, parent_return, children_return, - nchildren_return) - Display* display; - Window w; - Window* root_return; - Window* parent_return; - Window** children_return; - unsigned int* nchildren_return; +XQueryTree( + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Window *), + TCL_UNUSED(Window *), + TCL_UNUSED(Window **), + TCL_UNUSED(unsigned int *)) { return 0; } @@ -683,17 +633,17 @@ XQueryTree(display, w, root_return, parent_return, children_return, int XGetWindowProperty( Display *display, - Window w, - Atom property, - long long_offset, - long long_length, - Bool delete, - Atom req_type, + TCL_UNUSED(Window), + TCL_UNUSED(Atom), + TCL_UNUSED(long), + TCL_UNUSED(long), + TCL_UNUSED(Bool), + TCL_UNUSED(Atom), Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, - unsigned char ** prop_return) + TCL_UNUSED(unsigned char **)) { display->request++; *actual_type_return = None; @@ -704,7 +654,7 @@ XGetWindowProperty( int XRefreshKeyboardMapping( - XMappingEvent *x) + TCL_UNUSED(XMappingEvent *)) { /* used by tkXEvent.c */ Debugger(); @@ -714,8 +664,8 @@ XRefreshKeyboardMapping( int XSetIconName( Display* display, - Window w, - const char *icon_name) + TCL_UNUSED(Window), + TCL_UNUSED(const char *)) { /* * This is a no-op, no icon name for Macs. @@ -727,7 +677,7 @@ XSetIconName( int XForceScreenSaver( Display* display, - int mode) + TCL_UNUSED(int)) { /* * This function is just a no-op. It is defined to reset the screen saver. @@ -741,8 +691,8 @@ XForceScreenSaver( void Tk_FreeXId( - Display *display, - XID xid) + TCL_UNUSED(Display *), + TCL_UNUSED(XID)) { /* no-op function needed for stubs implementation. */ } @@ -750,7 +700,7 @@ Tk_FreeXId( int XSync( Display *display, - Bool discard) + TCL_UNUSED(Bool)) { /* * The main use of XSync is by the update command, which alternates @@ -768,7 +718,6 @@ XSync( return 0; } -#if 0 int XSetClipRectangles( Display *d, @@ -782,19 +731,17 @@ XSetClipRectangles( TkRegion clipRgn = TkCreateRegion(); while (n--) { - XRectangle rect = *rectangles; + XRectangle rect = *rectangles; - rect.x += clip_x_origin; - rect.y += clip_y_origin; - TkUnionRectWithRegion(&rect, clipRgn, clipRgn); - rectangles++; + rect.x += clip_x_origin; + rect.y += clip_y_origin; + TkUnionRectWithRegion(&rect, clipRgn, clipRgn); + rectangles++; } TkSetRegion(d, gc, clipRgn); TkDestroyRegion(clipRgn); return 1; } -#endif - /* *---------------------------------------------------------------------- * @@ -853,64 +800,64 @@ TkGetServerInfo( int XChangeWindowAttributes( - Display *display, - Window w, - unsigned long value_mask, - XSetWindowAttributes *attributes) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(unsigned long), + TCL_UNUSED(XSetWindowAttributes *)) { return Success; } int XSetWindowBackground( - Display *display, - Window window, - unsigned long value) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(unsigned long)) { return Success; } int XSetWindowBackgroundPixmap( - Display *display, - Window w, - Pixmap background_pixmap) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Pixmap)) { return Success; } int XSetWindowBorder( - Display *display, - Window w, - unsigned long border_pixel) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(unsigned long)) { return Success; } int XSetWindowBorderPixmap( - Display *display, - Window w, - Pixmap border_pixmap) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Pixmap)) { return Success; } int XSetWindowBorderWidth( - Display *display, - Window w, - unsigned int width) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(unsigned int)) { return Success; } int XSetWindowColormap( - Display *display, - Window w, - Colormap colormap) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Colormap)) { Debugger(); return Success; @@ -918,25 +865,25 @@ XSetWindowColormap( Status XStringListToTextProperty( - char **list, - int count, - XTextProperty *text_prop_return) + TCL_UNUSED(char **), + TCL_UNUSED(int), + TCL_UNUSED(XTextProperty *)) { Debugger(); - return (Status) 0; + return Success; } void XSetWMClientMachine( - Display *display, - Window w, - XTextProperty *text_prop) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(XTextProperty *)) { Debugger(); } XIC -XCreateIC(XIM xim, ...) +XCreateIC(TCL_UNUSED(XIM), ...) { Debugger(); return (XIC) 0; @@ -954,7 +901,7 @@ XVisualIDFromVisual( XAfterFunction XSynchronize( Display *display, - Bool onoff) + TCL_UNUSED(Bool)) { display->request++; return NULL; @@ -963,7 +910,7 @@ XSynchronize( #undef XUngrabServer int XUngrabServer( - Display *display) + TCL_UNUSED(Display *)) { return 0; } @@ -980,7 +927,7 @@ XNoOp( #undef XGrabServer int XGrabServer( - Display *display) + TCL_UNUSED(Display *)) { return 0; } @@ -998,7 +945,7 @@ XFree( #undef XFlush int XFlush( - Display *display) + TCL_UNUSED(Display *)) { return 0; } @@ -1022,7 +969,7 @@ XFlush( const char * TkGetDefaultScreenName( - Tcl_Interp *interp, /* Not used. */ + TCL_UNUSED(Tcl_Interp *), const char *screenName) /* If NULL, use default string. */ { if ((screenName == NULL) || (screenName[0] == '\0')) { @@ -1049,7 +996,7 @@ TkGetDefaultScreenName( long Tk_GetUserInactiveTime( - Display *dpy) + TCL_UNUSED(Display *)) { io_registry_entry_t regEntry; CFMutableDictionaryRef props = NULL; @@ -1058,7 +1005,7 @@ Tk_GetUserInactiveTime( uint64_t time; IOReturn result; - regEntry = IOServiceGetMatchingService(kIOMasterPortDefault, + regEntry = IOServiceGetMatchingService(0, IOServiceMatching("IOHIDSystem")); if (regEntry == 0) { @@ -1115,7 +1062,7 @@ Tk_GetUserInactiveTime( void Tk_ResetUserInactiveTime( - Display *dpy) + TCL_UNUSED(Display *)) { lastInactivityReset = TkpGetMS(); } diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index f1b7b8e..3541dd8 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -39,7 +39,7 @@ #define BEGIN_DRAWING(d) { \ TkMacOSXDrawingContext dc; \ - if (!TkMacOSXSetupDrawingContext((d), NULL, 1, &dc)) {return;} + if (!TkMacOSXSetupDrawingContext((d), NULL, &dc)) {return;} #define END_DRAWING \ TkMacOSXRestoreDrawingContext(&dc);} @@ -153,7 +153,7 @@ static inline CGRect BoxToRect( Drawable d, Ttk_Box b) { - MacDrawable *md = (MacDrawable *) d; + MacDrawable *md = (MacDrawable *)d; CGRect rect; rect.origin.y = b.y + md->yOff; @@ -242,31 +242,31 @@ static CGFloat blackRGBA[4] = {0.0, 0.0, 0.0, 1.0}; * GetBackgroundColor -- * * Fills the array rgba with the color coordinates for a background color. - * Start with the background color of a window's geometry master, or the - * standard ttk window background if there is no master. If the contrast - * parameter is nonzero, modify this color to be darker, for the aqua - * appearance, or lighter for the DarkAqua appearance. This is primarily - * used by the Fill and Background elements. + * Start with the background color of a window's geometry container, or + * the standard ttk window background if there is no container. If the + * contrast parameter is nonzero, modify this color to be darker, for the + * aqua appearance, or lighter for the DarkAqua appearance. This is + * primarily used by the Fill and Background elements. */ static void GetBackgroundColor( - CGContextRef context, + TCL_UNUSED(CGContextRef), Tk_Window tkwin, int contrast, CGFloat *rgba) { - TkWindow *winPtr = (TkWindow *) tkwin; - TkWindow *masterPtr = (TkWindow *) TkGetGeomMaster(tkwin); + TkWindow *winPtr = (TkWindow *)tkwin; + TkWindow *containerPtr = (TkWindow *)TkGetGeomMaster(tkwin); - while (masterPtr && masterPtr->privatePtr) { - if (masterPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) { + while (containerPtr && containerPtr->privatePtr) { + if (containerPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) { break; } - masterPtr = (TkWindow *) TkGetGeomMaster(masterPtr); + containerPtr = (TkWindow *)TkGetGeomMaster(containerPtr); } - if (masterPtr && masterPtr->privatePtr) { + if (containerPtr && containerPtr->privatePtr) { for (int i = 0; i < 4; i++) { - rgba[i] = masterPtr->privatePtr->fillRGBA[i]; + rgba[i] = containerPtr->privatePtr->fillRGBA[i]; } } else { if ([NSApp macOSVersion] > 101300) { @@ -303,9 +303,10 @@ static void GetBackgroundColor( /*---------------------------------------------------------------------- - * +++ Single Arrow Buttons -- + * +++ Single Arrow Images -- * - * Used in ListHeaders and Comboboxes. + * Used in ListHeaders and Comboboxes as well as disclosure triangles in + * macOS 11. */ static void DrawDownArrow( @@ -352,6 +353,48 @@ static void DrawUpArrow( CGContextStrokePath(context); } +static void DrawClosedDisclosure( + CGContextRef context, + CGRect bounds, + CGFloat inset, + CGFloat size, + CGFloat *rgba) +{ + CGFloat x, y; + + CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]); + CGContextSetLineWidth(context, 1.5); + x = bounds.origin.x + inset; + y = bounds.origin.y + trunc(bounds.size.height / 2); + CGContextBeginPath(context); + CGPoint arrow[3] = { + {x, y - size / 4 - 1}, {x + size / 2, y}, {x, y + size / 4 + 1} + }; + CGContextAddLines(context, arrow, 3); + CGContextStrokePath(context); +} + +static void DrawOpenDisclosure( + CGContextRef context, + CGRect bounds, + CGFloat inset, + CGFloat size, + CGFloat *rgba) +{ + CGFloat x, y; + + CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]); + CGContextSetLineWidth(context, 1.5); + x = bounds.origin.x + inset; + y = bounds.origin.y + trunc(bounds.size.height / 2); + CGContextBeginPath(context); + CGPoint arrow[3] = { + {x, y - size / 4}, {x + size / 2, y + size / 2}, {x + size, y - size / 4} + }; + CGContextAddLines(context, arrow, 3); + CGContextStrokePath(context); +} + /*---------------------------------------------------------------------- * +++ Double Arrow Buttons -- * @@ -501,10 +544,13 @@ static void SolidFillRoundedRectangle( NSColor *color) { CGPathRef path; - CHECK_RADIUS(radius, bounds) - CGContextSetFillColorWithColor(context, CGCOLOR(color)); + CHECK_RADIUS(radius, bounds) path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL); + if (!path) { + return; + } + CGContextSetFillColorWithColor(context, CGCOLOR(color)); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextFillPath(context); @@ -547,7 +593,7 @@ static void DrawListHeader( * So we have to query the Apple window manager. */ - NSWindow *win = TkMacOSXDrawableWindow(Tk_WindowId(tkwin)); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin)); CGFloat *bgRGBA = [win isKeyWindow] ? activeBgRGBA : inactiveBgRGBA; CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; @@ -1039,7 +1085,7 @@ static void DrawDarkTab( static void DrawDarkSeparator( CGRect bounds, CGContextRef context, - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { static CGFloat fill[4] = {1.0, 1.0, 1.0, 0.3}; NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; @@ -1165,7 +1211,7 @@ static void DrawDarkFrame( static void DrawDarkListHeader( CGRect bounds, CGContextRef context, - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), int state) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; @@ -1174,10 +1220,10 @@ static void DrawDarkListHeader( CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace); CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; - CGPoint top[2] = {{x, y}, {x + w, y}}; - CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}}; - CGPoint separator[2] = {{x + w, y + 3}, {x + w, y + h - 3}}; + CGPoint top[2] = {{x, y + 1}, {x + w, y + 1}}; + CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}}; + CGPoint separator[2] = {{x + w - 1, y + 3}, {x + w - 1, y + h - 3}}; CGContextSaveGState(context); CGContextSetShouldAntialias(context, false); stroke = [NSColor colorWithColorSpace: deviceRGB @@ -2098,10 +2144,16 @@ static void TrackElementDraw( Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value); factor = RangeToFactor(to); + /* + * HIThemeTrackDrawInfo uses 2-byte alignment; assigning to a separate + * bounds variable avoids UBSan (-fsanitize=alignment) complaints. + */ + + CGRect bounds = BoxToRect(d, b); HIThemeTrackDrawInfo info = { .version = 0, .kind = data->kind, - .bounds = BoxToRect(d, b), + .bounds = bounds, .min = from * factor, .max = to * factor, .value = value * factor, @@ -2236,13 +2288,19 @@ static void PbarElementDraw( Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); factor = RangeToFactor(maximum); + /* + * HIThemeTrackDrawInfo uses 2-byte alignment; assigning to a separate + * bounds variable avoids UBSan (-fsanitize=alignment) complaints. + */ + + CGRect bounds = BoxToRect(d, b); HIThemeTrackDrawInfo info = { .version = 0, .kind = (!strcmp("indeterminate", Tcl_GetString(pbar->modeObj)) && value) ? kThemeIndeterminateBar : kThemeProgressBar, - .bounds = BoxToRect(d, b), + .bounds = bounds, .min = 0, .max = maximum * factor, .value = value * factor, @@ -2448,7 +2506,7 @@ static void ThumbElementDraw( END_DRAWING } else { double thumbSize, trackSize, visibleSize, factor, fraction; - MacDrawable *macWin = (MacDrawable *) Tk_WindowId(tkwin); + MacDrawable *macWin = (MacDrawable *)Tk_WindowId(tkwin); CGRect troughBounds = {{macWin->xOff, macWin->yOff}, {Tk_Width(tkwin), Tk_Height(tkwin)}}; @@ -2998,8 +3056,21 @@ static void DisclosureElementDraw( }; BEGIN_DRAWING(d) - ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, + if ([NSApp macOSVersion] >= 110000) { + CGFloat rgba[4]; + NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; + NSColor *stroke = [[NSColor textColor] + colorUsingColorSpace: deviceRGB]; + [stroke getComponents: rgba]; + if (state & TTK_TREEVIEW_STATE_OPEN) { + DrawOpenDisclosure(dc.context, bounds, 2, 8, rgba); + } else { + DrawClosedDisclosure(dc.context, bounds, 2, 12, rgba); + } + } else { + ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); + } END_DRAWING } } @@ -3049,20 +3120,20 @@ TTK_LAYOUT("TCombobox", /* Notebook tabs -- no focus ring */ TTK_LAYOUT("Tab", TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, - TTK_GROUP("Notebook.padding", TTK_EXPAND | TTK_FILL_BOTH, - TTK_NODE("Notebook.label", TTK_EXPAND | TTK_FILL_BOTH)))) + TTK_GROUP("Notebook.padding", TTK_FILL_BOTH, + TTK_NODE("Notebook.label", TTK_FILL_BOTH)))) /* Spinbox -- buttons 2px to the right of the field. */ TTK_LAYOUT("TSpinbox", TTK_GROUP("Spinbox.buttons", TTK_PACK_RIGHT, TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP | TTK_STICK_E) TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM | TTK_STICK_E)) - TTK_GROUP("Spinbox.field", TTK_EXPAND | TTK_FILL_X, - TTK_NODE("Spinbox.textarea", TTK_EXPAND | TTK_FILL_X))) + TTK_GROUP("Spinbox.field", TTK_FILL_X, + TTK_NODE("Spinbox.textarea", TTK_FILL_X))) /* Progress bars -- track only */ TTK_LAYOUT("TProgressbar", - TTK_NODE("Progressbar.track", TTK_EXPAND | TTK_FILL_BOTH)) + TTK_NODE("Progressbar.track", TTK_FILL_BOTH)) /* Treeview -- no border. */ TTK_LAYOUT("Treeview", @@ -3087,15 +3158,13 @@ TTK_LAYOUT("Item", TTK_LAYOUT("Vertical.TScrollbar", TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y, - TTK_NODE("Vertical.Scrollbar.thumb", - TTK_PACK_TOP | TTK_EXPAND | TTK_FILL_BOTH) + TTK_NODE("Vertical.Scrollbar.thumb", TTK_FILL_BOTH) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_BOTTOM))) TTK_LAYOUT("Horizontal.TScrollbar", TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X, - TTK_NODE("Horizontal.Scrollbar.thumb", - TTK_PACK_LEFT | TTK_EXPAND | TTK_FILL_BOTH) + TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_RIGHT))) diff --git a/tests/all.tcl b/tests/all.tcl index d15e5ca..3b6b75f 100644 --- a/tests/all.tcl +++ b/tests/all.tcl @@ -14,6 +14,7 @@ package require tcltest 2.2 tcltest::configure {*}$argv tcltest::configure -testdir [file normalize [file dirname [info script]]] tcltest::configure -loadfile \ - [file join [tcltest::testsDirectory] constraints.tcl] + [file join [tcltest::testsDirectory] constraints.tcl] tcltest::configure -singleproc 1 -tcltest::runAllTests +set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)] +if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1} diff --git a/tests/bind.test b/tests/bind.test index b6e3e53..6868eba 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -6948,7 +6948,7 @@ test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup { } -cleanup { } -result pass -test bind-36.1 {pointer warp with grab on master, bug [e3888d5820]} -setup { +test bind-36.1 {pointer warp with grab on toplevel, bug [e3888d5820]} -setup { pointerAway toplevel .top grab release .top diff --git a/tests/busy.test b/tests/busy.test index cdce30e..98d83a8 100644 --- a/tests/busy.test +++ b/tests/busy.test @@ -6,7 +6,7 @@ # # Copyright (c) 1998-2000 by Jos Decoster. All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 tcltest::configure {*}$argv tcltest::loadTestedCommands namespace import -force tcltest::test diff --git a/tests/canvMoveto.test b/tests/canvMoveto.test index 79761a4..a6cf849 100644 --- a/tests/canvMoveto.test +++ b/tests/canvMoveto.test @@ -6,7 +6,7 @@ # Copyright (c) 2004 Neil McKay. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands @@ -33,7 +33,7 @@ test canvMoveto-1.5 {Bad args handling for "moveto" command} -body { test canvMoveto-2.1 {Canvas "moveto" command coordinates} { .c moveto test 200 150 .c bbox test -} {200 150 272 232} +} {200 150 272 232} test canvMoveto-2.2 {Canvas "moveto" command, blank y coordinate} { .c moveto test 200 150 .c moveto test 150 {} diff --git a/tests/canvas.test b/tests/canvas.test index 697badb..54bf500 100644 --- a/tests/canvas.test +++ b/tests/canvas.test @@ -7,7 +7,7 @@ # Copyright (c) 2008 Donal K. Fellows # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands imageInit diff --git a/tests/color.test b/tests/color.test index 4cdaf23..1e99a7d 100644 --- a/tests/color.test +++ b/tests/color.test @@ -5,7 +5,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands @@ -162,7 +162,7 @@ test color-1.4 {Tk_AllocColorFromObj - try other colors in list} colorsFree { test color-1.5 {Color table} nonPortable { set fd [open ../xlib/rgb.txt] set result {} - while {[gets $fd line] != -1} { + while {[gets $fd line] >= 0} { if {[string index $line 0] == "!"} continue set rgb [c255 [winfo rgb . [lrange $line 3 end]]] if {$rgb != [lrange $line 0 2] } { diff --git a/tests/constraints.tcl b/tests/constraints.tcl index c77fb00..ee073cf 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -5,7 +5,7 @@ if {[namespace exists tk::test]} { return } -package require Tk 8.4 +package require Tk tk appname tktest wm title . tktest # If the main window isn't already mapped (e.g. because the tests are @@ -17,7 +17,7 @@ if {![winfo ismapped .]} { update } -package require tcltest 2.1 +package require tcltest 2.2 namespace eval tk { namespace eval test { @@ -37,7 +37,7 @@ namespace eval tk { namespace eval bg { # Manage a background process. - # Replace with slave interp or thread? + # Replace with child interp or thread? namespace import ::tcltest::interpreter namespace import ::tk::test::loadTkCommand namespace export setup cleanup do @@ -197,8 +197,8 @@ testConstraint noExceed [expr { }] # constraints for testing facilities defined in the tktest executable... -testConstraint testImageType [expr {[lsearch [image types] test] >= 0}] -testConstraint testOldImageType [expr {[lsearch [image types] oldtest] >= 0}] +testConstraint testImageType [expr {"test" in [image types]}] +testConstraint testOldImageType [expr {"oldtest" in [image types]}] testConstraint testbitmap [llength [info commands testbitmap]] testConstraint testborder [llength [info commands testborder]] testConstraint testcbind [llength [info commands testcbind]] @@ -247,10 +247,10 @@ testConstraint pseudocolor8 [expr { }] destroy .t testConstraint haveTruecolor24 [expr { - [lsearch -exact [winfo visualsavailable .] {truecolor 24}] >= 0 + {truecolor 24} in [winfo visualsavailable .] }] testConstraint haveGrayscale8 [expr { - [lsearch -exact [winfo visualsavailable .] {grayscale 8}] >= 0 + {grayscale 8} in [winfo visualsavailable .] }] testConstraint defaultPseudocolor8 [expr { ([winfo visual .] eq "pseudocolor") && ([winfo depth .] == 8) diff --git a/tests/entry.test b/tests/entry.test index 8512b3f..2f09f92 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -17,7 +17,7 @@ proc scroll args { global scrollInfo set scrollInfo $args } -# For trace variable +# For trace variable proc override args { global x set x 12345 @@ -70,7 +70,7 @@ test entry-1.3 {configuration option: "bd" for entry} -setup { .e cget -bd } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-1.4 {configuration option: "bd" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -107,10 +107,10 @@ test entry-1.7 {configuration option: "borderwidth" for entry} -setup { update } -body { .e configure -borderwidth 1.3 - .e cget -borderwidth + .e cget -borderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-1.8 {configuration option: "borderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -190,7 +190,7 @@ test entry-1.15 {configuration option: "exportselection" for entry} -setup { .e cget -exportselection } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-1.16 {configuration option: "exportselection" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -310,7 +310,7 @@ test entry-1.27 {configuration option: "highlightthickness" for entry} -setup { .e cget -highlightthickness } -cleanup { destroy .e -} -result {6} +} -result 6 test entry-1.28 {configuration option: "highlightthickness" for entry} -setup { entry .e -borderwidth 2 -font {Helvetica -12 bold} pack .e @@ -320,7 +320,7 @@ test entry-1.28 {configuration option: "highlightthickness" for entry} -setup { .e cget -highlightthickness } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-1.29 {configuration option: "highlightthickness" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -360,7 +360,7 @@ test entry-1.32 {configuration option: "insertborderwidth" for entry} -setup { .e cget -insertborderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-1.33 {configuration option: "insertborderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -380,7 +380,7 @@ test entry-1.34 {configuration option: "insertofftime" for entry} -setup { .e cget -insertofftime } -cleanup { destroy .e -} -result {100} +} -result 100 test entry-1.35 {configuration option: "insertofftime" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -400,7 +400,7 @@ test entry-1.36 {configuration option: "insertontime" for entry} -setup { .e cget -insertontime } -cleanup { destroy .e -} -result {100} +} -result 100 test entry-1.37 {configuration option: "insertontime" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -513,7 +513,7 @@ test entry-1.47 {configuration option: "selectborderwidth" for entry} -setup { .e cget -selectborderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-1.48 {configuration option: "selectborderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -606,7 +606,7 @@ test entry-1.56 {configuration option: "width" for entry} -setup { .e cget -width } -cleanup { destroy .e -} -result {402} +} -result 402 test entry-1.57 {configuration option: "width" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -800,7 +800,7 @@ test entry-3.14 {EntryWidgetCmd procedure, "cget" widget command} -setup { .e cget -bd } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup { entry .e pack .e @@ -809,7 +809,7 @@ test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup { llength [.e configure] } -cleanup { destroy .e -} -result {36} +} -result 36 test entry-3.16 {EntryWidgetCmd procedure, "configure" widget command} -setup { entry .e } -body { @@ -825,7 +825,7 @@ test entry-3.17 {EntryWidgetCmd procedure, "configure" widget command} -setup { lindex [.e configure -bd] 4 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-3.18 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { @@ -864,7 +864,7 @@ test entry-3.22 {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {014567890} +} -result 014567890 test entry-3.23 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { @@ -873,7 +873,7 @@ test entry-3.23 {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {0123457890} +} -result 0123457890 test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e @@ -905,7 +905,7 @@ test entry-3.25 {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e @@ -918,7 +918,7 @@ test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.26a {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e @@ -931,7 +931,7 @@ test entry-3.26a {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.27 {EntryWidgetCmd procedure, "get" widget command} -setup { entry .e } -body { @@ -961,7 +961,7 @@ test entry-3.30 {EntryWidgetCmd procedure, "icursor" widget command} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-3.31 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e } -body { @@ -1047,7 +1047,7 @@ test entry-3.40 {EntryWidgetCmd procedure, "insert" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.40a {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e pack .e @@ -1060,7 +1060,7 @@ test entry-3.40a {EntryWidgetCmd procedure, "insert" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.41 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e } -body { @@ -1120,7 +1120,7 @@ test entry-3.46 {EntryWidgetCmd procedure, "scan" widget command} -constraints { .e index @0 } -cleanup { destroy .e -} -result {2} +} -result 2 test entry-3.47 {EntryWidgetCmd procedure, "select" widget command} -setup { entry .e } -body { @@ -1189,7 +1189,7 @@ test entry-3.52 {EntryWidgetCmd procedure, "selection present" widget command} - .e selection present } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-3.53 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e @@ -1202,7 +1202,7 @@ test entry-3.53 {EntryWidgetCmd procedure, "selection present" widget command} - .e selection present } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-3.54 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e @@ -1215,7 +1215,7 @@ test entry-3.54 {EntryWidgetCmd procedure, "selection present" widget command} - .e selection present } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-3.55 {EntryWidgetCmd procedure, "selection adjust" widget command} -setup { entry .e } -body { @@ -1243,7 +1243,7 @@ test entry-3.57 {EntryWidgetCmd procedure, "selection adjust" widget command} -s selection get } -cleanup { destroy .e -} -result {123} +} -result 123 test entry-3.58 {EntryWidgetCmd procedure, "selection adjust" widget command} -setup { entry .e pack .e @@ -1257,7 +1257,7 @@ test entry-3.58 {EntryWidgetCmd procedure, "selection adjust" widget command} -s selection get } -cleanup { destroy .e -} -result {234} +} -result 234 test entry-3.59 {EntryWidgetCmd procedure, "selection from" widget command} -setup { entry .e } -body { @@ -1471,7 +1471,7 @@ test entry-3.75 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e index @0 } -cleanup { destroy .e -} -result {32} +} -result 32 test entry-3.76 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1485,7 +1485,7 @@ test entry-3.76 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e index @0 } -cleanup { destroy .e -} -result {29} +} -result 29 test entry-3.77 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1517,11 +1517,11 @@ test entry-3.79 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e insert end "runs off the end of the window quite a bit." .e xview 0 update - .e xview -4 + .e xview -1 .e index @0 } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-3.80 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1533,7 +1533,7 @@ test entry-3.80 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e index @0 } -cleanup { destroy .e -} -result {73} +} -result 73 test entry-3.86 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1584,7 +1584,7 @@ test entry-5.1 {ConfigureEntry procedure, -textvariable} -body { .e get } -cleanup { destroy .e -} -result {12345} +} -result 12345 test entry-5.2 {ConfigureEntry procedure, -textvariable} -body { set x 12345 entry .e -textvariable x @@ -1601,7 +1601,7 @@ test entry-5.3 {ConfigureEntry procedure, -textvariable} -setup { } -body { .e insert 0 "Some text" .e configure -textvariable x - return $x + set x } -cleanup { destroy .e } -result {Some text} @@ -1636,7 +1636,7 @@ test entry-5.5 {ConfigureEntry procedure} -setup { lappend x [selection get] .e1 configure -exportselection 1 lappend x [selection get] - return $x + set x } -cleanup { destroy .e1 .e2 } -result {{This is so} {This is so} 1234} @@ -1791,7 +1791,7 @@ test entry-6.4 {EntryComputeGeometry procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {6} +} -result 6 test entry-6.5 {EntryComputeGeometry procedure} -setup { entry .e -highlightthickness 2 pack .e @@ -1803,7 +1803,7 @@ test entry-6.5 {EntryComputeGeometry procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {6} +} -result 6 test entry-6.6 {EntryComputeGeometry procedure} -constraints { fonts } -setup { @@ -2011,7 +2011,7 @@ test entry-7.7 {InsertChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {7} +} -result 7 test entry-7.8 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2022,7 +2022,7 @@ test entry-7.8 {InsertChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-7.9 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2034,7 +2034,7 @@ test entry-7.9 {InsertChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {7} +} -result 7 test entry-7.10 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2046,7 +2046,7 @@ test entry-7.10 {InsertChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-7.11 {InsertChars procedure} -constraints { fonts @@ -2060,7 +2060,7 @@ test entry-7.11 {InsertChars procedure} -constraints { winfo reqwidth .e } -cleanup { destroy .e -} -result {59} +} -result 59 test entry-8.1 {DeleteChars procedure} -setup { unset -nocomplain contents @@ -2087,7 +2087,7 @@ test entry-8.2 {DeleteChars procedure} -setup { .e configure -textvariable contents -xscrollcommand scroll set timeout [after 500 {set scrollInfo {-1000000 -1000000}}] .e insert 0 abcde - .e delete -2 2 + .e delete -1 2 vwait scrollInfo list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { @@ -2245,7 +2245,7 @@ test entry-8.12 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-8.13 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2258,7 +2258,7 @@ test entry-8.13 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-8.14 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2271,7 +2271,7 @@ test entry-8.14 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-8.15 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2284,7 +2284,7 @@ test entry-8.15 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-8.16 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2297,7 +2297,7 @@ test entry-8.16 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-8.17 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2310,7 +2310,7 @@ test entry-8.17 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-8.18 {DeleteChars procedure} -setup { entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2322,7 +2322,7 @@ test entry-8.18 {DeleteChars procedure} -setup { winfo reqwidth .e } -cleanup { destroy .e -} -result {31} +} -result 31 test entry-9.1 {EntryValueChanged procedure} -setup { unset -nocomplain x @@ -2403,7 +2403,7 @@ test entry-10.5 {EntrySetValue procedure, updating display position} -setup { .e index @0 } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-10.6 {EntrySetValue procedure, updating display position} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 @@ -2419,7 +2419,7 @@ test entry-10.6 {EntrySetValue procedure, updating display position} -setup { .e index @0 } -cleanup { destroy .e -} -result {10} +} -result 10 test entry-10.7 {EntrySetValue procedure, updating insertion cursor} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 @@ -2434,7 +2434,7 @@ test entry-10.7 {EntrySetValue procedure, updating insertion cursor} -setup { .e index insert } -cleanup { destroy .e -} -result {3} +} -result 3 test entry-10.8 {EntrySetValue procedure, updating insertion cursor} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 @@ -2448,7 +2448,7 @@ test entry-10.8 {EntrySetValue procedure, updating insertion cursor} -setup { .e index insert } -cleanup { destroy .e -} -result {5} +} -result 5 test entry-11.1 {EntryEventProc procedure} -setup { entry .e -highlightthickness 2 -bd 2 -font {Helvetica -12} @@ -2492,7 +2492,7 @@ test entry-13.1 {GetEntryIndex procedure} -setup { .e index end } -cleanup { destroy .e -} -result {21} +} -result 21 test entry-13.2 {GetEntryIndex procedure} -body { entry .e .e index abogus @@ -2511,7 +2511,7 @@ test entry-13.3 {GetEntryIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-13.4 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e @@ -2524,7 +2524,7 @@ test entry-13.4 {GetEntryIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-13.5 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e @@ -2538,7 +2538,7 @@ test entry-13.5 {GetEntryIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {15} +} -result 15 test entry-13.6 {GetEntryIndex procedure} -setup { entry .e } -body { @@ -2557,7 +2557,7 @@ test entry-13.7 {GetEntryIndex procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {2} +} -result 2 test entry-13.8 {GetEntryIndex procedure} -setup { entry .e } -body { @@ -2622,7 +2622,7 @@ test entry-13.11 {GetEntryIndex procedure} -constraints aquaOrWin32 -body { .e index sel.first } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-13.12 {GetEntryIndex procedure} -constraints x11 -body { # Previous settings: @@ -2736,7 +2736,7 @@ test entry-13.16 {GetEntryIndex procedure} -constraints fonts -body { .e index @4 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-13.17 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2747,7 +2747,7 @@ test entry-13.17 {GetEntryIndex procedure} -constraints fonts -body { .e index @11 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-13.18 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2758,7 +2758,7 @@ test entry-13.18 {GetEntryIndex procedure} -constraints fonts -body { .e index @12 } -cleanup { destroy .e -} -result {5} +} -result 5 test entry-13.19 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2769,7 +2769,7 @@ test entry-13.19 {GetEntryIndex procedure} -constraints fonts -body { .e index @[expr {[winfo width .e] - 6}] } -cleanup { destroy .e -} -result {8} +} -result 8 test entry-13.20 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2780,7 +2780,7 @@ test entry-13.20 {GetEntryIndex procedure} -constraints fonts -body { .e index @[expr {[winfo width .e] - 5}] } -cleanup { destroy .e -} -result {9} +} -result 9 test entry-13.21 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2791,7 +2791,7 @@ test entry-13.21 {GetEntryIndex procedure} -body { .e index @1000 } -cleanup { destroy .e -} -result {9} +} -result 9 test entry-13.22 {GetEntryIndex procedure} -setup { entry .e pack .e @@ -2808,10 +2808,10 @@ test entry-13.23 {GetEntryIndex procedure} -body { .e insert 0 012345678901234567890 .e xview 4 update - .e index -10 + .e index -1 } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-13.24 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2822,7 +2822,7 @@ test entry-13.24 {GetEntryIndex procedure} -body { .e index 12 } -cleanup { destroy .e -} -result {12} +} -result 12 test entry-13.25 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2833,7 +2833,7 @@ test entry-13.25 {GetEntryIndex procedure} -body { .e index 49 } -cleanup { destroy .e -} -result {21} +} -result 21 test entry-13.26 {GetEntryIndex procedure} -constraints fonts -body { entry .e -highlightthickness 2 -bd 2 -font {Helvetica -12} selection clear .e @@ -2880,7 +2880,7 @@ test entry-14.3 {EntryFetchSelection procedure} -setup { string compare [selection get] $x } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-15.1 {EntryLostSelection} -body { entry .e @@ -3003,7 +3003,7 @@ test entry-18.1 {Entry widget vs hiding} -setup { set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 == $res2} -} -result {1} +} -result 1 ## ## Entry widget VALIDATION tests @@ -3025,7 +3025,7 @@ test entry-19.1 {entry widget validation} -setup { -background red -foreground white pack .e .e insert 0 a - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e 1 0 a {} a all key} @@ -3057,7 +3057,7 @@ test entry-19.3 {entry widget validation} -setup { pack .e .e insert 0 ab ;# previous settings .e insert end c - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e 1 2 abc ab c all key} @@ -3089,7 +3089,7 @@ test entry-19.5 {entry widget validation} -setup { pack .e .e insert 0 a123bc ;# previous settings .e delete 2 - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e 0 2 a13bc a123bc 2 all key} @@ -3106,7 +3106,7 @@ test entry-19.6 {entry widget validation} -setup { .e insert 0 a13bc ;# previous settings .e configure -validate key .e delete 1 3 - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e 0 1 abc a13bc 13 key key} @@ -3123,7 +3123,7 @@ test entry-19.7 {entry widget validation} -setup { .e insert end abc ;# previous settings set ::vVals {} .e insert end d - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {} @@ -3142,7 +3142,7 @@ test entry-19.8 {entry widget validation} -setup { focus -force .e # update necessary to process FocusIn event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focus focusin} @@ -3163,7 +3163,7 @@ test entry-19.9 {entry widget validation} -setup { focus -force . # update necessary to process FocusOut event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focus focusout} @@ -3181,7 +3181,7 @@ test entry-19.10 {entry widget validation} -setup { focus -force .e # update necessary to process FocusIn event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} all focusin} @@ -3202,7 +3202,7 @@ test entry-19.11 {entry widget validation} -setup { focus -force . # update necessary to process FocusOut event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} all focusout} @@ -3220,7 +3220,7 @@ test entry-19.12 {entry widget validation} -setup { focus -force .e # update necessary to process FocusIn event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focusin focusin} @@ -3239,7 +3239,7 @@ test entry-19.13 {entry widget validation} -setup { focus -force . # update necessary to process FocusOut event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {} @@ -3258,7 +3258,7 @@ test entry-19.14 {entry widget validation} -setup { focus -force .e # update necessary to process FocusIn event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {} @@ -3280,7 +3280,7 @@ test entry-19.15 {entry widget validation} -setup { focus -force . # update necessary to process FocusOut event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focusout focusout} @@ -3422,7 +3422,7 @@ test entry-20.1 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.2 {widget deletion while active} -body { entry .e -validate all \ @@ -3432,7 +3432,7 @@ test entry-20.2 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.3 {widget deletion while active} -body { entry .e -validate all \ @@ -3441,7 +3441,7 @@ test entry-20.3 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.4 {widget deletion while active} -body { entry .e -validate all \ @@ -3451,7 +3451,7 @@ test entry-20.4 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.5 {widget deletion while active} -body { entry .e -validatecommand { destroy .e ; return 0 } @@ -3459,7 +3459,7 @@ test entry-20.5 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.6 {widget deletion while active} -body { pack [entry .e] @@ -3469,7 +3469,7 @@ test entry-20.6 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.7 {widget deletion with textvariable active} -body { # SF bugs 607390 and 617446 @@ -3481,7 +3481,7 @@ test entry-20.7 {widget deletion with textvariable active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-21.1 {selection present while disabled, bug 637828} -body { diff --git a/tests/filebox.test b/tests/filebox.test index 0114a07..fdb5614 100644 --- a/tests/filebox.test +++ b/tests/filebox.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands @@ -167,7 +167,7 @@ foreach mode $modes { catch {tk_getOpenFile -foo 1} msg regsub -all , $msg "" options regsub \"-foo\" $options "" options - + foreach option $options { if {[string index $option 0] eq "-"} { test filebox-1.2-$mode$option "tk_getOpenFile command" -body { diff --git a/tests/focus.test b/tests/focus.test index 7a7e5ef..7ce2df1 100644 --- a/tests/focus.test +++ b/tests/focus.test @@ -104,7 +104,7 @@ test focus-1.7 {Tk_FocusCmd procedure} -constraints unix -body { focus .gorp a } -returnCodes error -result {bad option ".gorp": must be -displayof, -force, or -lastfor} test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} -constraints { - unix + unix } -setup { destroy .t2 } -body { @@ -130,29 +130,29 @@ test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} -constraints { destroy .t2 } -result {.t2.f2 .t2 .t2} test focus-1.9 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focus -displayof } -returnCodes error -result {wrong # args: should be "focus -displayof window"} test focus-1.10 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focus -displayof a b } -returnCodes error -result {wrong # args: should be "focus -displayof window"} test focus-1.11 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focus -displayof .lousy } -returnCodes error -result {bad window path name ".lousy"} test focus-1.12 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focusClear focus .t focus -displayof .t.b3 } -result {} test focus-1.13 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focusClear focus -force .t @@ -185,22 +185,22 @@ test focus-1.19 {Tk_FocusCmd procedure, -force option} -constraints unix -body { lappend x [focus] } -result {{} .t.b1} test focus-1.20 {Tk_FocusCmd procedure, -lastfor option} -constraints { - unix + unix } -body { focus -lastfor } -returnCodes error -result {wrong # args: should be "focus -lastfor window"} test focus-1.21 {Tk_FocusCmd procedure, -lastfor option} -constraints { - unix + unix } -body { focus -lastfor 1 2 } -returnCodes error -result {wrong # args: should be "focus -lastfor window"} test focus-1.22 {Tk_FocusCmd procedure, -lastfor option} -constraints { - unix + unix } -body { focus -lastfor who_knows? } -returnCodes error -result {bad window path name "who_knows?"} test focus-1.23 {Tk_FocusCmd procedure, -lastfor option} -constraints { - unix + unix } -body { focusClear focusSetup @@ -209,7 +209,7 @@ test focus-1.23 {Tk_FocusCmd procedure, -lastfor option} -constraints { list [focus -lastfor .] [focus -lastfor .t.b3] } -result {.b .t.b1} test focus-1.24 {Tk_FocusCmd procedure, -lastfor option} -constraints { - unix + unix } -body { focusClear focusSetup diff --git a/tests/fontchooser.test b/tests/fontchooser.test index 4dad5da..3fbc01f 100644 --- a/tests/fontchooser.test +++ b/tests/fontchooser.test @@ -2,7 +2,7 @@ # # Copyright (c) 2008 Pat Thoyts -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands diff --git a/tests/grid.test b/tests/grid.test index 62474ff..dd02729 100644 --- a/tests/grid.test +++ b/tests/grid.test @@ -45,7 +45,7 @@ test grid-1.1 {basic argument checking} -body { } -returnCodes error -result {wrong # args: should be "grid option arg ?arg ...?"} test grid-1.2 {basic argument checking} -body { grid foo bar -} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves} +} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, size, or slaves} test grid-1.3 {basic argument checking} -body { button .b grid .b -row 0 -column @@ -145,7 +145,7 @@ test grid-3.1 {configure: basic argument checking} -body { test grid-3.2 {configure: basic argument checking} -body { button .b grid configure .b - grid slaves . + grid content . } -cleanup { grid_reset 3.2 } -result {.b} @@ -183,7 +183,7 @@ test grid-3.7 {configure: basic argument checking} -body { test grid-3.8 {configure: basic argument checking} -body { button .b grid configure x .b - grid slaves . + grid content . } -cleanup { grid_reset 3.8 } -result {.b} @@ -193,7 +193,7 @@ test grid-3.9 {configure: basic argument checking} -body { } -cleanup { grid_reset 3.9 } -returnCodes error -result {invalid window shortcut, "y" should be '-', 'x', or '^'} -test grid-3.10 {ConfigureSlave procedure, bad -in option} -body { +test grid-3.10 {ConfigureContent procedure, bad -in option} -body { frame .f grid .f -in .f } -cleanup { @@ -224,9 +224,9 @@ test grid-4.1 {forget: basic argument checking} -body { test grid-4.2 {forget} -body { button .c grid [button .b] - set a [grid slaves .] + set a [grid content .] grid forget .b .c - lappend a [grid slaves .] + lappend a [grid content .] return $a } -cleanup { grid_reset 4.2 @@ -516,43 +516,43 @@ test grid-8.6 {size} -body { grid_reset 8.6 } -result {{51 11} {51 11} {31 11} {21 11} {16 1} {1 1}} -test grid-9.1 {slaves} -body { - grid slaves . +test grid-9.1 {content} -body { + grid content . } -returnCodes ok -result {} -test grid-9.2 {slaves} -body { - grid slaves .foo +test grid-9.2 {content} -body { + grid content .foo } -returnCodes error -result {bad window path name ".foo"} -test grid-9.3 {slaves} -body { - grid slaves a b -} -returnCodes error -result {wrong # args: should be "grid slaves window ?-option value ...?"} -test grid-9.4 {slaves} -body { - grid slaves . a b +test grid-9.3 {content} -body { + grid content a b +} -returnCodes error -result {wrong # args: should be "grid content window ?-option value ...?"} +test grid-9.4 {content} -body { + grid content . a b } -returnCodes error -result {bad option "a": must be -column or -row} -test grid-9.5 {slaves} -body { - grid slaves . -column x +test grid-9.5 {content} -body { + grid content . -column x } -returnCodes error -result {expected integer but got "x"} -test grid-9.6 {slaves} -body { - grid slaves . -row -3 +test grid-9.6 {content} -body { + grid content . -row -3 } -returnCodes error -result {-3 is an invalid value: should NOT be < 0} -test grid-9.7 {slaves} -body { - grid slaves . -foo 3 +test grid-9.7 {content} -body { + grid content . -foo 3 } -returnCodes error -result {bad option "-foo": must be -column or -row} -test grid-9.8 {slaves} -body { - grid slaves .x -row 3 +test grid-9.8 {content} -body { + grid content .x -row 3 } -returnCodes error -result {bad window path name ".x"} -test grid-9.9 {slaves} -body { - grid slaves . -row 3 +test grid-9.9 {content} -body { + grid content . -row 3 } -returnCodes ok -result {} -test grid-9.10 {slaves} -body { +test grid-9.10 {content} -body { foreach i {0 1 2} { label .$i -text $i grid .$i -row $i -column $i } - grid slaves . + grid content . } -cleanup { grid_reset 9.10 } -result {.2 .1 .0} -test grid-9.11 {slaves} -body { +test grid-9.11 {content} -body { catch {unset a} foreach i {0 1 2} { label .$i -text $i @@ -561,10 +561,10 @@ test grid-9.11 {slaves} -body { grid .$i-x -row $i -column [incr i] } foreach row {0 1 2 3} { - lappend a $row{[grid slaves . -row $row]} + lappend a $row{[grid content . -row $row]} } foreach col {0 1 2 3} { - lappend a $col{[grid slaves . -column $col]} + lappend a $col{[grid content . -column $col]} } return $a } -cleanup { @@ -1305,10 +1305,10 @@ test grid-13.20 {reparenting} -body { grid .b -in .1 set a "" catch {unset info}; array set info [grid info .b] - lappend a [grid slaves .1],[grid slaves .2],$info(-in) + lappend a [grid content .1],[grid content .2],$info(-in) grid .b -in .2 catch {unset info}; array set info [grid info .b] - lappend a [grid slaves .1],[grid slaves .2],$info(-in) + lappend a [grid content .1],[grid content .2],$info(-in) unset info return $a } -cleanup { @@ -1369,27 +1369,27 @@ test grid-14.3 {map notify: bug 1648} -constraints {nonPortable} -body { grid_reset 14.3 } -result {.2 2 .0 1 . 2 .1 1} -test grid-15.1 {lost slave} -body { +test grid-15.1 {lost content} -body { button .b grid .b - set a [grid slaves .] + set a [grid content .] pack .b - lappend a [grid slaves .] + lappend a [grid content .] grid .b - lappend a [grid slaves .] + lappend a [grid content .] } -cleanup { grid_reset 15.1 } -result {.b {} .b} -test grid-15.2 {lost slave} -body { +test grid-15.2 {lost content} -body { frame .f grid .f button .b grid .b -in .f - set a [grid slaves .f] + set a [grid content .f] pack .b -in .f - lappend a [grid slaves .f] + lappend a [grid content .f] grid .b -in .f - lappend a [grid slaves .f] + lappend a [grid content .f] } -cleanup { grid_reset 15.2 } -result {.b {} .b} @@ -1975,9 +1975,9 @@ test grid-22.1 {remove: basic argument checking} { test grid-22.2 {remove} { button .c grid [button .b] - set a [grid slaves .] + set a [grid content .] grid remove .b .c - lappend a [grid slaves .] + lappend a [grid content .] return $a } {.b {}} grid_reset 22.2 @@ -2024,7 +2024,7 @@ test grid-22.5 {remove} { } {-in . -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx {3 5} -pady {4 7} -sticky ns} grid_reset 22.5 -test grid-23 {grid configure -in leaked from previous master - bug +test grid-23 {grid configure -in leaked from previous container window - bug 6aea69fccbb266b7f0437686379fbe5b55442958} { frame .f frame .g diff --git a/tests/imgBmap.test b/tests/imgBmap.test index e7f2c7e..56484a6 100644 --- a/tests/imgBmap.test +++ b/tests/imgBmap.test @@ -137,28 +137,28 @@ test imageBmap-2.2 {ImgBmapCreate procedure} -setup { } -result {image1 image1 0 0 #000000 {}} -test imageBmap-3.1 {ImgBmapConfigureMaster procedure, memory de-allocation} -body { +test imageBmap-3.1 {ImgBmapConfigureModel procedure, memory de-allocation} -body { image create bitmap i1 -data $data1 i1 configure -data $data1 } -cleanup { image delete i1 } -result {} -test imageBmap-3.2 {ImgBmapConfigureMaster procedure} -body { +test imageBmap-3.2 {ImgBmapConfigureModel procedure} -body { image create bitmap i1 -data $data1 list [catch {i1 configure -data bogus} msg] $msg [image width i1] \ [image height i1] } -result {1 {format error in bitmap data} 16 16} -test imageBmap-3.3 {ImgBmapConfigureMaster procedure, memory de-allocation} -body { +test imageBmap-3.3 {ImgBmapConfigureModel procedure, memory de-allocation} -body { image create bitmap i1 -data $data1 -maskdata $data2 i1 configure -maskdata $data2 } -cleanup { image delete i1 } -result {} -test imageBmap-3.4 {ImgBmapConfigureMaster procedure} -body { +test imageBmap-3.4 {ImgBmapConfigureModel procedure} -body { image create bitmap i1 i1 configure -maskdata $data2 } -returnCodes error -result {can't have mask without bitmap} -test imageBmap-3.5 {ImgBmapConfigureMaster procedure} -body { +test imageBmap-3.5 {ImgBmapConfigureModel procedure} -body { image create bitmap i1 -data $data1 -maskdata { #define foo_width 8 #define foo_height 16 @@ -167,7 +167,7 @@ test imageBmap-3.5 {ImgBmapConfigureMaster procedure} -body { 0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81}; } } -returnCodes error -result {bitmap and mask have different sizes} -test imageBmap-3.6 {ImgBmapConfigureMaster procedure} -body { +test imageBmap-3.6 {ImgBmapConfigureModel procedure} -body { image create bitmap i1 -data $data1 -maskdata { #define foo_width 16 #define foo_height 8 @@ -176,7 +176,7 @@ test imageBmap-3.6 {ImgBmapConfigureMaster procedure} -body { 0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81}; } } -returnCodes error -result {bitmap and mask have different sizes} -test imageBmap-3.7 {ImgBmapConfigureMaster procedure} -setup { +test imageBmap-3.7 {ImgBmapConfigureModel procedure} -setup { destroy .c pack [canvas .c] } -body { @@ -503,8 +503,8 @@ test imageBmap-11.2 {ImgBmapDelete procedure} -body { test imageBmap-12.1 {ImgBmapCmdDeletedProc procedure} -body { image create bitmap i2 -file foo.bm -maskfile foo2.bm rename i2 {} - list [lsearch -exact [imageNames] i2] [catch {i2 foo} msg] $msg -} -result {-1 1 {invalid command name "i2"}} + list [expr {"i2" in [imageNames]}] [catch {i2 foo} msg] $msg +} -result {0 1 {invalid command name "i2"}} removeFile foo.bm removeFile foo2.bm diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test index 50f0688..140d7fa 100644 --- a/tests/imgPhoto.test +++ b/tests/imgPhoto.test @@ -131,7 +131,7 @@ test imgPhoto-2.2 {ImgPhotoCreate procedure} -setup { # set msg # } {couldn't open "bogus.img": no such file or directory} -test imgPhoto-3.1 {ImgPhotoConfigureMaster procedure} -constraints { +test imgPhoto-3.1 {ImgPhotoConfigureModel procedure} -constraints { hasTeapotPhoto } -body { image create photo photo1 -file $teapotPhotoFile @@ -139,7 +139,7 @@ test imgPhoto-3.1 {ImgPhotoConfigureMaster procedure} -constraints { } -cleanup { image delete photo1 } -result {} -test imgPhoto-3.2 {ImgPhotoConfigureMaster procedure} -constraints { +test imgPhoto-3.2 {ImgPhotoConfigureModel procedure} -constraints { hasTeapotPhoto } -body { image create photo photo1 -file $teapotPhotoFile @@ -148,7 +148,7 @@ test imgPhoto-3.2 {ImgPhotoConfigureMaster procedure} -constraints { } -cleanup { image delete photo1 } -result {1 {couldn't open "bogus": no such file or directory} 256 256} -test imgPhoto-3.3 {ImgPhotoConfigureMaster procedure} -constraints { +test imgPhoto-3.3 {ImgPhotoConfigureModel procedure} -constraints { hasTeapotPhoto } -setup { destroy .c @@ -952,8 +952,8 @@ test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints { } -body { image create photo photo2 -file $teapotPhotoFile rename photo2 {} - list [lsearch -exact [imageNames] photo2] [catch {photo2 foo} msg] $msg -} -result {-1 1 {invalid command name "photo2"}} + list [expr {"photo2" in [imageNames]}] [catch {photo2 foo} msg] $msg +} -result {0 1 {invalid command name "photo2"}} test imgPhoto-10.1 {Tk_ImgPhotoPutBlock procedure} -setup { imageCleanup diff --git a/tests/listbox.test b/tests/listbox.test index 3a6c860..42dc327 100644 --- a/tests/listbox.test +++ b/tests/listbox.test @@ -376,15 +376,15 @@ test listbox-3.5 {ListboxWidgetCmd procedure, "activate" option} -body { test listbox-3.6 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate -1 .l index active -} -result {0} +} -result 0 test listbox-3.7 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate 30 .l index active -} -result {17} +} -result 17 test listbox-3.8 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate end .l index active -} -result {17} +} -result 17 test listbox-3.9 {ListboxWidgetCmd procedure, "bbox" option} -body { .l bbox } -returnCodes error -result {wrong # args: should be ".l bbox index"} @@ -508,7 +508,7 @@ test listbox-3.18b {ListboxWidgetCmd procedure, "bbox" option, justified, non-de } -cleanup { destroy .top.l .top unset -nocomplain lres res -} -result {1} +} -result 1 test listbox-3.19 {ListboxWidgetCmd procedure, "cget" option} -body { .l cget } -returnCodes error -result {wrong # args: should be ".l cget option"} @@ -520,10 +520,10 @@ test listbox-3.21 {ListboxWidgetCmd procedure, "cget" option} -body { } -returnCodes error -result {unknown option "-gorp"} test listbox-3.22 {ListboxWidgetCmd procedure, "cget" option} -body { .l cget -setgrid -} -result {0} +} -result 0 test listbox-3.23 {ListboxWidgetCmd procedure, "configure" option} -body { llength [.l configure] -} -result {28} +} -result 28 test listbox-3.24 {ListboxWidgetCmd procedure, "configure" option} -body { .l configure -gorp } -returnCodes error -result {unknown option "-gorp"} @@ -587,7 +587,7 @@ test listbox-3.36 {ListboxWidgetCmd procedure, "delete" option} -setup { } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 - .l2 delete -3 2 + .l2 delete -1 2 .l2 get 0 end } -cleanup { destroy .l2 @@ -597,7 +597,7 @@ test listbox-3.37 {ListboxWidgetCmd procedure, "delete" option} -setup { } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 - .l2 delete -3 -1 + .l2 delete -1 -1 .l2 get 0 end } -cleanup { destroy .l2 @@ -684,10 +684,10 @@ test listbox-3.49 {ListboxWidgetCmd procedure, "get" option} -body { .l get -1 } -result {} test listbox-3.50 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -2 -1 + .l get -1 -1 } -result {} test listbox-3.51 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -2 3 + .l get -1 3 } -result {el0 el1 el2 el3} test listbox-3.52 {ListboxWidgetCmd procedure, "get" option} -body { .l get 12 end @@ -783,7 +783,7 @@ test listbox-3.72 {ListboxWidgetCmd procedure, "nearest" option} -body { test listbox-3.73 {ListboxWidgetCmd procedure, "nearest" option} -body { .l yview 3 .l nearest 1000 -} -result {7} +} -result 7 test listbox-3.74 {ListboxWidgetCmd procedure, "scan" option} -body { .l scan a b } -returnCodes error -result {wrong # args: should be ".l scan mark|dragto x y"} @@ -830,52 +830,52 @@ test listbox-3.83 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 7 .l index @0,0 -} -result {7} +} -result 7 test listbox-3.84 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 11 .l index @0,0 -} -result {7} +} -result 7 test listbox-3.85 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 6 .l index @0,0 -} -result {6} +} -result 6 test listbox-3.86 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 5 .l index @0,0 -} -result {3} +} -result 3 test listbox-3.87 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 12 .l index @0,0 -} -result {8} +} -result 8 test listbox-3.88 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 13 .l index @0,0 -} -result {11} +} -result 11 test listbox-3.89 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see -1 .l index @0,0 -} -result {0} +} -result 0 test listbox-3.90 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see end .l index @0,0 -} -result {13} +} -result 13 test listbox-3.91 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 322 .l index @0,0 -} -result {13} +} -result 13 test listbox-3.92 {ListboxWidgetCmd procedure, "see" option, partial last line} -body { mkPartial .partial.l see 4 .partial.l index @0,0 -} -result {1} +} -result 1 test listbox-3.93 {ListboxWidgetCmd procedure, "selection" option} -body { .l select a } -returnCodes error -result {wrong # args: should be ".l selection option index ?index?"} @@ -898,15 +898,15 @@ test listbox-3.98 {ListboxWidgetCmd procedure, "selection" option} -body { test listbox-3.99 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection anchor -1 .l index anchor -} -result {0} +} -result 0 test listbox-3.100 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection anchor end .l index anchor -} -result {17} +} -result 17 test listbox-3.101 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection anchor 44 .l index anchor -} -result {17} +} -result 17 test listbox-3.102 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection clear 0 end .l selection set 2 8 @@ -926,16 +926,16 @@ test listbox-3.104 {ListboxWidgetCmd procedure, "selection" option} -body { test listbox-3.105 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection set 0 end .l selection includes -1 -} -result {0} +} -result 0 test listbox-3.106 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection clear 0 end .l selection set end .l selection includes end -} -result {1} +} -result 1 test listbox-3.107 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection set 0 end .l selection includes 44 -} -result {0} +} -result 0 test listbox-3.108 {ListboxWidgetCmd procedure, "selection" option} -setup { destroy .l2 } -body { @@ -943,7 +943,7 @@ test listbox-3.108 {ListboxWidgetCmd procedure, "selection" option} -setup { .l2 selection includes 0 } -cleanup { destroy .l2 -} -result {0} +} -result 0 test listbox-3.109 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection clear 0 end .l selection set 2 @@ -965,7 +965,7 @@ test listbox-3.112 {ListboxWidgetCmd procedure, "size" option} -body { } -returnCodes error -result {wrong # args: should be ".l size"} test listbox-3.113 {ListboxWidgetCmd procedure, "size" option} -body { .l size -} -result {18} +} -result 18 test listbox-3.114 {ListboxWidgetCmd procedure, "xview" option} -setup { destroy .l2 } -body { @@ -1242,7 +1242,7 @@ test listbox-4.2 {ConfigureListbox procedure} -setup { .l cget -highlightthickness } -cleanup { deleteWindows -} -result {0} +} -result 0 test listbox-4.3 {ConfigureListbox procedure} -setup { deleteWindows destroy .l @@ -1573,14 +1573,14 @@ test listbox-6.2 {InsertEls procedure} -body { .l selection anchor 2 .l insert 2 A B .l index anchor -} -result {4} +} -result 4 test listbox-6.3 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l selection anchor 2 .l insert 3 A B .l index anchor -} -result {2} +} -result 2 test listbox-6.4 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1588,7 +1588,7 @@ test listbox-6.4 {InsertEls procedure} -body { update .l insert 2 A B .l index @0,0 -} -result {5} +} -result 5 test listbox-6.5 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1596,31 +1596,31 @@ test listbox-6.5 {InsertEls procedure} -body { update .l insert 3 A B .l index @0,0 -} -result {3} +} -result 3 test listbox-6.6 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 5 .l insert 5 A B .l index active -} -result {7} +} -result 7 test listbox-6.7 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 5 .l insert 6 A B .l index active -} -result {5} +} -result 5 test listbox-6.8 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c .l index active -} -result {2} +} -result 2 test listbox-6.9 {InsertEls procedure} -body { .l delete 0 end .l insert 0 .l index active -} -result {0} +} -result 0 test listbox-6.10 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b "two words" c d e f g h i j @@ -1728,28 +1728,28 @@ test listbox-7.5 {DeleteEls procedure} -body { .l selection anchor 2 .l delete 0 1 .l index anchor -} -result {0} +} -result 0 test listbox-7.6 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l selection anchor 2 .l delete 2 .l index anchor -} -result {2} +} -result 2 test listbox-7.7 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l selection anchor 4 .l delete 2 5 .l index anchor -} -result {2} +} -result 2 test listbox-7.8 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l selection anchor 3 .l delete 4 5 .l index anchor -} -result {3} +} -result 3 test listbox-7.9 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1757,7 +1757,7 @@ test listbox-7.9 {DeleteEls procedure} -body { update .l delete 1 2 .l index @0,0 -} -result {1} +} -result 1 test listbox-7.10 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1765,7 +1765,7 @@ test listbox-7.10 {DeleteEls procedure} -body { update .l delete 3 4 .l index @0,0 -} -result {3} +} -result 3 test listbox-7.11 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1773,7 +1773,7 @@ test listbox-7.11 {DeleteEls procedure} -body { update .l delete 4 6 .l index @0,0 -} -result {3} +} -result 3 test listbox-7.12 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1781,42 +1781,42 @@ test listbox-7.12 {DeleteEls procedure} -body { update .l delete 3 end .l index @0,0 -} -result {1} +} -result 1 test listbox-7.13 {DeleteEls procedure, updating view with partial last line} -body { mkPartial .partial.l yview 8 update .partial.l delete 10 13 .partial.l index @0,0 -} -result {7} +} -result 7 test listbox-7.14 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 6 .l delete 3 4 .l index active -} -result {4} +} -result 4 test listbox-7.15 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 6 .l delete 5 7 .l index active -} -result {5} +} -result 5 test listbox-7.16 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 6 .l delete 5 end .l index active -} -result {4} +} -result 4 test listbox-7.17 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 6 .l delete 0 end .l index active -} -result {0} +} -result 0 test listbox-7.18 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c "two words" d e f g h i j @@ -1987,7 +1987,7 @@ test listbox-10.5 {GetListboxIndex procedure} -setup { .l index end } -cleanup { destroy .l -} -result {12} +} -result 12 test listbox-10.6 {GetListboxIndex procedure} -setup { destroy .l } -body { @@ -2102,7 +2102,7 @@ test listbox-10.16 {GetListboxIndex procedure} -setup { .l index 3 } -cleanup { destroy .l -} -result {3} +} -result 3 test listbox-10.17 {GetListboxIndex procedure} -setup { destroy .l } -body { @@ -2112,7 +2112,7 @@ test listbox-10.17 {GetListboxIndex procedure} -setup { .l index 20 } -cleanup { destroy .l -} -result {20} +} -result 20 test listbox-10.18 {GetListboxIndex procedure} -setup { destroy .l } -body { @@ -2129,10 +2129,10 @@ test listbox-10.19 {GetListboxIndex procedure} -setup { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update - .l index -2 + .l index -1 } -cleanup { destroy .l -} -result -2 +} -result -1 test listbox-10.20 {GetListboxIndex procedure} -setup { destroy .l } -body { @@ -2226,7 +2226,7 @@ test listbox-11.6 {ChangeListboxView procedure, partial last line} -body { .partial.l index @0,0 } -cleanup { destroy .l -} -result {11} +} -result 11 # Listbox used in 12.* tests @@ -2314,7 +2314,7 @@ test listbox-13.3 {ListboxScanTo procedure} -constraints { test listbox-14.1 {NearestListboxElement procedure, partial last line} -body { mkPartial .partial.l nearest [winfo height .partial.l] -} -result {4} +} -result 4 # Listbox used in 14.* tests destroy .l listbox .l -font $fixed -width 20 -height 10 @@ -2326,7 +2326,7 @@ test listbox-14.2 {NearestListboxElement procedure} -constraints { fonts } -body { .l index @50,0 -} -result {4} +} -result 4 test listbox-14.3 {NearestListboxElement procedure} -constraints { fonts } -body { @@ -2336,7 +2336,7 @@ test listbox-14.4 {NearestListboxElement procedure} -constraints { fonts } -body { .l index @50,200 -} -result {13} +} -result 13 # Listbox used in 15.* 16.* and 17.* tests @@ -2378,7 +2378,7 @@ test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} -bo .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end - .l select set -2 -1 + .l select set -1 -1 .l curselection } -result {} test listbox-15.5 {ListboxSelect procedure, boundary conditions for indices} -body { @@ -2415,7 +2415,7 @@ test listbox-15.9 {ListboxSelect procedure, boundary conditions for indices} -bo .l select clear 0 end .l select set end 30 .l curselection -} -result {5} +} -result 5 test listbox-15.10 {ListboxSelect procedure, boundary conditions for indices} -body { .l delete 0 end .l insert 0 a b c d e f @@ -2451,7 +2451,7 @@ test listbox-16.3 {ListboxFetchSelection procedure, retrieve in several parts} - string compare 1$long\n2$long\n3$long\n4$long\n5$long $sel } -cleanup { catch {unset long sel} -} -result {0} +} -result 0 test listbox-17.1 {ListboxLostSelection procedure} -setup { diff --git a/tests/menu.test b/tests/menu.test index a7f5956..6a3c6fe 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -2052,7 +2052,7 @@ test menu-5.8 {DestroyMenuInstance - multiple clones} -setup { set tearoff2 [tk::TearOffMenu .m1] list [destroy $tearoff1] [destroy .m1] } -returnCodes ok -result {{} {}} -test menu-5.9 {DestroyMenuInstace - master menu} -setup { +test menu-5.9 {DestroyMenuInstace - main menu} -setup { destroy .m1 } -body { menu .m1 diff --git a/tests/oldpack.test b/tests/oldpack.test index 72ec065..94e0710 100644 --- a/tests/oldpack.test +++ b/tests/oldpack.test @@ -452,10 +452,10 @@ test oldpack-8.2 {syntax errors} -body { } -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"} test oldpack-8.3 {syntax errors} -body { pack gorp foo -} -returnCodes error -result {bad option "gorp": must be configure, forget, info, propagate, or slaves} +} -returnCodes error -result {bad option "gorp": must be configure, content, forget, info, propagate, or slaves} test oldpack-8.4 {syntax errors} -body { pack a .pack -} -returnCodes error -result {bad option "a": must be configure, forget, info, propagate, or slaves} +} -returnCodes error -result {bad option "a": must be configure, content, forget, info, propagate, or slaves} test oldpack-8.5 {syntax errors} -body { pack after foobar } -returnCodes error -result {bad window path name "foobar"} @@ -527,20 +527,20 @@ test oldpack-9.1 {information output} -body { pack append .pack .pack.blue {top fillx frame n} \ .pack.red {bottom filly frame s} .pack.green {left fill frame w} \ .pack.violet {right expand frame e} - list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \ + list [pack content .pack] [pack info .pack.blue] [pack info .pack.red] \ [pack info .pack.green] [pack info .pack.violet] } -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor n -expand 0 -fill x -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor s -expand 0 -fill y -ipadx 0 -ipady 0 -padx 0 -pady 0 -side bottom} {-in .pack -anchor w -expand 0 -fill both -ipadx 0 -ipady 0 -padx 0 -pady 0 -side left} {-in .pack -anchor e -expand 1 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side right}} test oldpack-9.2 {information output} -body { pack append .pack .pack.blue {padx 10 frame nw} \ .pack.red {pady 20 frame ne} .pack.green {frame se} \ .pack.violet {frame sw} - list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \ + list [pack content .pack] [pack info .pack.blue] [pack info .pack.red] \ [pack info .pack.green] [pack info .pack.violet] } -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor nw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 5 -pady 0 -side top} {-in .pack -anchor ne -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 10 -side top} {-in .pack -anchor se -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor sw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}} test oldpack-9.3 {information output} -body { pack append .pack .pack.blue {frame center} .pack.red {frame center} \ .pack.green {frame c} .pack.violet {frame c} - list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \ + list [pack content .pack] [pack info .pack.blue] [pack info .pack.red] \ [pack info .pack.green] [pack info .pack.violet] } -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}} diff --git a/tests/pack.test b/tests/pack.test index 86fcad2..4128c46 100644 --- a/tests/pack.test +++ b/tests/pack.test @@ -878,28 +878,28 @@ test pack-9.1 {window ordering} -setup { } -body { pack .pack.a .pack.b .pack.c .pack.d -side top pack .pack.a -after .pack.b - pack slaves .pack + pack content .pack } -result {.pack.b .pack.a .pack.c .pack.d} test pack-9.2 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d -side top pack .pack.a -after .pack.a - pack slaves .pack + pack content .pack } -result {.pack.a .pack.b .pack.c .pack.d} test pack-9.3 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d -side top pack .pack.a -before .pack.d - pack slaves .pack + pack content .pack } -result {.pack.b .pack.c .pack.a .pack.d} test pack-9.4 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d -side top pack .pack.d -before .pack.a - pack slaves .pack + pack content .pack } -result {.pack.d .pack.a .pack.b .pack.c} test pack-9.5 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d @@ -907,42 +907,42 @@ test pack-9.5 {window ordering} -setup { pack .pack.a .pack.b .pack.c .pack.d -side top pack propagate .pack.c 0 pack .pack.a -in .pack.c - list [pack slaves .pack] [pack slaves .pack.c] + list [pack content .pack] [pack content .pack.c] } -result {{.pack.b .pack.c .pack.d} .pack.a} test pack-9.6 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d -side top pack .pack.a -in .pack - pack slaves .pack + pack content .pack } -result {.pack.b .pack.c .pack.d .pack.a} test pack-9.7 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d -side top pack .pack.a -padx 0 - pack slaves .pack + pack content .pack } -result {.pack.a .pack.b .pack.c .pack.d} test pack-9.8 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c pack .pack.d - pack slaves .pack + pack content .pack } -result {.pack.a .pack.b .pack.c .pack.d} test pack-9.9 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d pack .pack.b .pack.d .pack.c -before .pack.a - pack slaves .pack + pack content .pack } -result {.pack.b .pack.d .pack.c .pack.a} test pack-9.10 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d pack .pack.a .pack.c .pack.d .pack.b -after .pack.a - pack slaves .pack + pack content .pack } -result {.pack.a .pack.c .pack.d .pack.b} @@ -963,14 +963,14 @@ test pack-10.2 {retaining/clearing configuration state} -setup { pack .pack.a -pady 14 pack info .pack.a } -result {-in .pack -anchor n -expand 1 -fill both -ipadx 3 -ipady 4 -padx 1 -pady 14 -side bottom} -test pack-10.3 {bad -in window does not change master} -setup { +test pack-10.3 {bad -in window does not change container window} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { set result [list [winfo manager .pack.a]] catch {pack .pack.a -in .pack.a} lappend result [winfo manager .pack.a] } -result {{} {}} -test pack-10.4 {bad -in window does not change master} -setup { +test pack-10.4 {bad -in window does not change container window} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { winfo manager .pack.a @@ -1147,7 +1147,7 @@ test pack-12.4 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack configure .pack.b .pack.c - pack slaves .pack + pack content .pack } -result {.pack.b .pack.c} test pack-12.5 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d @@ -1311,7 +1311,7 @@ test pack-12.36 {command options and errors} -setup { } -body { pack .pack.a .pack.b .pack.c .pack.d pack forget .pack.a .pack.d - pack slaves .pack + pack content .pack } -result {.pack.b .pack.c} test pack-12.37 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d @@ -1352,28 +1352,28 @@ test pack-12.41 {command options and errors} -setup { test pack-12.42 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { - pack slaves + pack content } -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"} test pack-12.43 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { - pack slaves a b -} -returnCodes error -result {wrong # args: should be "pack slaves window"} + pack content a b +} -returnCodes error -result {wrong # args: should be "pack content window"} test pack-12.44 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { - pack slaves .x + pack content .x } -returnCodes error -result {bad window path name ".x"} test pack-12.45 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { - pack slaves .pack.a + pack content .pack.a } -returnCodes ok -result {} test pack-12.46 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack lousy .pack -} -returnCodes error -result {bad option "lousy": must be configure, forget, info, propagate, or slaves} +} -returnCodes error -result {bad option "lousy": must be configure, content, forget, info, propagate, or slaves} test pack-13.1 {window deletion} -setup { @@ -1385,7 +1385,7 @@ test pack-13.1 {window deletion} -setup { update destroy .pack.d update - set result [list [pack slaves .pack] [winfo geometry .pack.a] \ + set result [list [pack content .pack] [winfo geometry .pack.a] \ [winfo geometry .pack.b] [winfo geometry .pack.c]] } -result {{.pack.right .pack.bottom .pack.a .pack.b .pack.c} 20x40+30+0 50x30+15+40 80x80+0+70} @@ -1528,7 +1528,7 @@ test pack-16.1 {geometry manager name} -setup { } -result {{} pack {}} -test pack-17.1 {PackLostSlaveProc procedure} -setup { +test pack-17.1 {PackLostContentProc procedure} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a @@ -1537,7 +1537,7 @@ test pack-17.1 {PackLostSlaveProc procedure} -setup { update list [winfo manager .pack.a] [winfo geometry .pack.a] } -result {place 20x40+40+10} -test pack-17.2 {PackLostSlaveProc procedure} -setup { +test pack-17.2 {PackLostContentProc procedure} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a @@ -1558,7 +1558,7 @@ if {[tk windowingsystem] == "win32"} { } } -test pack-18.1 {unmap slaves when master unmapped} -constraints { +test pack-18.1 {unmap content when container unmapped} -constraints { tempNotPc } -setup { eval destroy [winfo child .pack] @@ -1590,7 +1590,7 @@ test pack-18.1 {unmap slaves when master unmapped} -constraints { lappend result [winfo ismapped .pack.a] } -result {1 0 200 75 0 1} -test pack-18.2 {unmap slaves when master unmapped} -setup { +test pack-18.2 {unmap content when container unmapped} -setup { eval destroy [winfo child .pack] } -body { @@ -1618,7 +1618,7 @@ test pack-18.2 {unmap slaves when master unmapped} -setup { test pack-19.1 {test respect for internalborder} -setup { - catch {eval pack forget [pack slaves .pack]} + catch {eval pack forget [pack content .pack]} destroy .pack.l .pack.lf } -body { wm geometry .pack 200x200 @@ -1636,7 +1636,7 @@ test pack-19.1 {test respect for internalborder} -setup { destroy .pack.l .pack.lf } -result {196x188+2+10 177x186+5+7} test pack-19.2 {test support for minreqsize} -setup { - catch {eval pack forget [pack slaves .pack]} + catch {eval pack forget [pack content .pack]} destroy .pack.l .pack.lf } -body { wm geometry .pack {} diff --git a/tests/packgrid.test b/tests/packgrid.test index 6074ce9..6dfba25 100644 --- a/tests/packgrid.test +++ b/tests/packgrid.test @@ -10,7 +10,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::* -test packgrid-1.1 {pack and grid in same master} -setup { +test packgrid-1.1 {pack and grid in same container window} -setup { grid propagate . true pack propagate . true label .p -text PACK @@ -24,7 +24,7 @@ test packgrid-1.1 {pack and grid in same master} -setup { destroy .g } -result {cannot use geometry manager pack inside . which already has slaves managed by grid} -test packgrid-1.2 {pack and grid in same master} -setup { +test packgrid-1.2 {pack and grid in same container window} -setup { grid propagate . true pack propagate . true label .p -text PACK @@ -38,7 +38,7 @@ test packgrid-1.2 {pack and grid in same master} -setup { destroy .g } -result {cannot use geometry manager grid inside . which already has slaves managed by pack} -test packgrid-1.3 {pack and grid in same master} -setup { +test packgrid-1.3 {pack and grid in same container window} -setup { grid propagate . false pack propagate . true label .p -text PACK @@ -52,7 +52,7 @@ test packgrid-1.3 {pack and grid in same master} -setup { destroy .g } -result {} -test packgrid-1.4 {pack and grid in same master} -setup { +test packgrid-1.4 {pack and grid in same container window} -setup { grid propagate . false pack propagate . true label .p -text PACK @@ -66,7 +66,7 @@ test packgrid-1.4 {pack and grid in same master} -setup { destroy .g } -result {} -test packgrid-1.5 {pack and grid in same master} -setup { +test packgrid-1.5 {pack and grid in same container window} -setup { grid propagate . true pack propagate . false label .p -text PACK @@ -80,7 +80,7 @@ test packgrid-1.5 {pack and grid in same master} -setup { destroy .g } -result {} -test packgrid-1.6 {pack and grid in same master} -setup { +test packgrid-1.6 {pack and grid in same container window} -setup { grid propagate . true pack propagate . false label .p -text PACK @@ -94,7 +94,7 @@ test packgrid-1.6 {pack and grid in same master} -setup { destroy .g } -result {} -test packgrid-1.7 {pack and grid in same master} -setup { +test packgrid-1.7 {pack and grid in same container window} -setup { grid propagate . true pack propagate . true label .p -text PACK @@ -103,13 +103,13 @@ test packgrid-1.7 {pack and grid in same master} -setup { # Basic conflict should stop widget from being handled grid .g catch { pack .p } - pack slaves . + pack content . } -cleanup { destroy .p destroy .g } -result {} -test packgrid-1.8 {pack and grid in same master} -setup { +test packgrid-1.8 {pack and grid in same container window} -setup { grid propagate . true pack propagate . true label .p -text PACK @@ -118,13 +118,13 @@ test packgrid-1.8 {pack and grid in same master} -setup { # Basic conflict should stop widget from being handled pack .p catch { grid .g } - grid slaves . + grid content . } -cleanup { destroy .p destroy .g } -result {} -test packgrid-2.1 {pack and grid in same master, change propagation} -setup { +test packgrid-2.1 {pack and grid in same container window, change propagation} -setup { grid propagate . false pack propagate . true label .p -text PACK @@ -139,7 +139,7 @@ test packgrid-2.1 {pack and grid in same master, change propagation} -setup { destroy .g } -result {cannot use geometry manager grid inside . which already has slaves managed by pack} -test packgrid-2.2 {pack and grid in same master, change propagation} -setup { +test packgrid-2.2 {pack and grid in same container window, change propagation} -setup { grid propagate . true pack propagate . false label .p -text PACK @@ -155,7 +155,7 @@ test packgrid-2.2 {pack and grid in same master, change propagation} -setup { destroy .g } -result {cannot use geometry manager pack inside . which already has slaves managed by grid} -test packgrid-2.3 {pack and grid in same master, change propagation} -setup { +test packgrid-2.3 {pack and grid in same container window, change propagation} -setup { grid propagate . false pack propagate . false label .p -text PACK @@ -172,7 +172,7 @@ test packgrid-2.3 {pack and grid in same master, change propagation} -setup { destroy .g } -result {cannot use geometry manager pack inside . which already has slaves managed by grid} -test packgrid-2.4 {pack and grid in same master, change propagation} -setup { +test packgrid-2.4 {pack and grid in same container window, change propagation} -setup { grid propagate . false pack propagate . false label .p -text PACK @@ -188,7 +188,7 @@ test packgrid-2.4 {pack and grid in same master, change propagation} -setup { destroy .g } -result {cannot use geometry manager grid inside . which already has slaves managed by pack} -test packgrid-3.1 {stealing slave} -setup { +test packgrid-3.1 {stealing content} -setup { grid propagate . true pack propagate . true label .p -text PACK @@ -202,7 +202,7 @@ test packgrid-3.1 {stealing slave} -setup { destroy .g } -result {} -test packgrid-3.2 {stealing slave} -setup { +test packgrid-3.2 {stealing content} -setup { grid propagate . true pack propagate . true label .p -text PACK @@ -216,7 +216,7 @@ test packgrid-3.2 {stealing slave} -setup { destroy .g } -result {} -test packgrid-3.3 {stealing slave} -setup { +test packgrid-3.3 {stealing content} -setup { grid propagate . true pack propagate . true label .p -text PACK @@ -231,7 +231,7 @@ test packgrid-3.3 {stealing slave} -setup { destroy .g } -result {cannot use geometry manager pack inside . which already has slaves managed by grid} -test packgrid-3.4 {stealing slave} -setup { +test packgrid-3.4 {stealing content} -setup { grid propagate . true pack propagate . true label .p -text PACK @@ -246,7 +246,7 @@ test packgrid-3.4 {stealing slave} -setup { destroy .g } -result {cannot use geometry manager grid inside . which already has slaves managed by pack} -test packgrid-4.1 {slave stolen after master destruction - bug [aa7679685e]} -setup { +test packgrid-4.1 {content stolen after container destruction - bug [aa7679685e]} -setup { frame .f button .b -text hello } -body { @@ -261,7 +261,7 @@ test packgrid-4.1 {slave stolen after master destruction - bug [aa7679685e]} -se destroy .b } -result {} -test packgrid-4.2 {slave stolen after master destruction - bug [aa7679685e]} -setup { +test packgrid-4.2 {content stolen after container destruction - bug [aa7679685e]} -setup { frame .f button .b -text hello } -body { diff --git a/tests/panedwindow.test b/tests/panedwindow.test index ee184ce..bb3a7fd 100644 --- a/tests/panedwindow.test +++ b/tests/panedwindow.test @@ -498,7 +498,7 @@ test panedwindow-6.9 {sash coord subcommand, errors} -setup { .p add [frame .p.f] list [catch {.p sash coord -1} msg] $msg \ [catch {.p sash coord 0} msg] $msg \ - [catch {.p sash coord 1} msg] $msg + [catch {.p sash coord 1} msg] $msg } -cleanup { deleteWindows } -result [list 1 "invalid sash index" 1 "invalid sash index" 1 "invalid sash index"] @@ -511,7 +511,7 @@ test panedwindow-6.10 {sash coord subcommand, errors} -setup { list [catch {.p sash coord -1} msg] $msg \ [catch {.p sash coord 0} msg] \ [catch {.p sash coord 1} msg] $msg \ - [catch {.p sash coord 2} msg] $msg + [catch {.p sash coord 2} msg] $msg } -cleanup { deleteWindows } -result [list 1 "invalid sash index" 0 1 "invalid sash index" 1 "invalid sash index"] @@ -622,7 +622,7 @@ test panedwindow-8.5 {sash dragto subcommand, errors} -setup { } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "bar"} - + test panedwindow-9.1 {sash mark/sash dragto interaction} -setup { deleteWindows @@ -925,7 +925,7 @@ test panedwindow-11.15 {moving sash into "virtual" space on last pane increases } -cleanup { deleteWindows } -result {68 100} - + test panedwindow-12.1 {horizontal panedwindow lays out widgets properly} -setup { deleteWindows @@ -1022,7 +1022,7 @@ test panedwindow-12.6 {panedwindow takes explicit widget width over reqwidth} -s } -cleanup { deleteWindows } -result [list 20 20] -test panedwindow-12.7 {horizontal panedwindow reqheight is max slave height} -setup { +test panedwindow-12.7 {horizontal panedwindow reqheight is max pane height} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 @@ -1033,7 +1033,7 @@ test panedwindow-12.7 {horizontal panedwindow reqheight is max slave height} -se } -cleanup { deleteWindows } -result {20 40} -test panedwindow-12.8 {horizontal panedwindow reqheight is max slave height} -setup { +test panedwindow-12.8 {horizontal panedwindow reqheight is max pane height} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 @@ -1087,7 +1087,7 @@ test panedwindow-12.11 {panedwindow takes explicit height over reqheight} -setup } -cleanup { deleteWindows } -result [list 20 20] -test panedwindow-12.12 {vertical panedwindow reqwidth is max slave width} -setup { +test panedwindow-12.12 {vertical panedwindow reqwidth is max pane width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ @@ -1099,7 +1099,7 @@ test panedwindow-12.12 {vertical panedwindow reqwidth is max slave width} -setup } -cleanup { deleteWindows } -result {20 40} -test panedwindow-12.13 {vertical panedwindow reqwidth is max slave width} -setup { +test panedwindow-12.13 {vertical panedwindow reqwidth is max pane width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \ @@ -1133,7 +1133,7 @@ test panedwindow-13.1 {PanestructureProc, widget yields managements} -setup { deleteWindows } -body { # Check that the panedwindow correctly yields geometry management of - # a slave when the slave is destroyed. + # a pane when the pane is destroyed. # This test should not cause a core dump, and it should not cause # a memory leak. @@ -1144,12 +1144,12 @@ test panedwindow-13.1 {PanestructureProc, widget yields managements} -setup { destroy .b set result "" } -result {} -test panedwindow-13.2 {PanedWindowLostSlaveProc, widget yields management} -setup { +test panedwindow-13.2 {PanedWindowLostPaneProc, widget yields management} -setup { deleteWindows } -body { # Check that the paned window correctly yields geometry management of - # a slave when some other geometry manager steals the slave from us. - + # a pane when some other geometry manager steals the pane from us. + # This test should not cause a core dump, and it should not cause a # memory leak. panedwindow .p @@ -1518,9 +1518,9 @@ test panedwindow-17.1 {MoveSash, move right} -setup { # Get the requested width of the paned window lappend result [winfo reqwidth .p] - + .p sash place 0 30 0 - + # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqwidth .p] @@ -1538,7 +1538,7 @@ test panedwindow-17.2 {MoveSash, move right (unmapped) clipped by reqwidth} -set } .p sash place 0 100 0 - + # Get the new sash coord; it should be clipped by the reqwidth of # the panedwindow. .p sash coord 0 @@ -1552,13 +1552,13 @@ test panedwindow-17.3 {MoveSash, move right (mapped, width < reqwidth) clipped b foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } - + # Put the panedwindow up on the display and give it a width < reqwidth place .p -x 0 -y 0 -width 32 update .p sash place 0 100 0 - + # Get the new sash coord; it should be clipped by the visible width of # the panedwindow. .p sash coord 0 @@ -1572,13 +1572,13 @@ test panedwindow-17.4 {MoveSash, move right (mapped, width > reqwidth) clipped b foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } - + # Put the panedwindow up on the display and give it a width > reqwidth place .p -x 0 -y 0 -width 102 update .p sash place 0 200 0 - + # Get the new sash coord; it should be clipped by the visible width of # the panedwindow. .p sash coord 0 @@ -1594,7 +1594,7 @@ test panedwindow-17.5 {MoveSash, move right respects minsize} -setup { } .p sash place 0 100 0 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 @@ -1610,7 +1610,7 @@ test panedwindow-17.6 {MoveSash, move right respects minsize} -setup { } .p sash place 0 100 0 - + # Get the new sash coord; it should have moved as far as possible. .p sash coord 0 } -cleanup { @@ -1625,7 +1625,7 @@ test panedwindow-17.7 {MoveSash, move right pushes other sashes} -setup { } .p sash place 0 100 0 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 @@ -1641,7 +1641,7 @@ test panedwindow-17.8 {MoveSash, move right pushes other sashes, respects minsiz } .p sash place 0 100 0 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 @@ -1658,8 +1658,8 @@ test panedwindow-17.9 {MoveSash, move right respects minsize, exludes pad} -setu } .p sash place 0 100 0 - - # Get the new sash coord; it should have moved as far as possible, + + # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 0 } -cleanup { @@ -1675,8 +1675,8 @@ test panedwindow-17.10 {MoveSash, move right, negative minsize becomes 0} -setup } .p sash place 0 50 0 - - # Get the new sash coord; it should have moved as far as possible, + + # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { @@ -1693,9 +1693,9 @@ test panedwindow-17.11 {MoveSash, move left} -setup { # Get the requested width of the paned window lappend result [winfo reqwidth .p] - + .p sash place 0 10 0 - + # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqwidth .p] @@ -1713,7 +1713,7 @@ test panedwindow-17.12 {MoveSash, move left, can't move outside of window} -setu } .p sash place 0 -100 0 - + # Get the new sash coord; it should be clipped by the reqwidth of # the panedwindow. .p sash coord 0 @@ -1729,7 +1729,7 @@ test panedwindow-17.13 {MoveSash, move left respects minsize} -setup { } .p sash place 0 0 0 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 @@ -1745,7 +1745,7 @@ test panedwindow-17.14 {MoveSash, move left respects minsize} -setup { } .p sash place 1 0 0 - + # Get the new sash coord; it should have moved as far as possible. .p sash coord 1 } -cleanup { @@ -1760,7 +1760,7 @@ test panedwindow-17.15 {MoveSash, move left pushes other sashes} -setup { } .p sash place 1 0 0 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 @@ -1776,7 +1776,7 @@ test panedwindow-17.16 {MoveSash, move left pushes other sashes, respects minsiz } .p sash place 1 0 0 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 @@ -1793,8 +1793,8 @@ test panedwindow-17.17 {MoveSash, move left respects minsize, exludes pad} -setu } .p sash place 1 0 0 - - # Get the new sash coord; it should have moved as far as possible, + + # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 1 } -cleanup { @@ -1810,8 +1810,8 @@ test panedwindow-17.18 {MoveSash, move left, negative minsize becomes 0} -setup } .p sash place 1 10 0 - - # Get the new sash coord; it should have moved as far as possible, + + # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { @@ -1831,9 +1831,9 @@ test panedwindow-18.1 {MoveSash, move down} -setup { # Get the requested width of the paned window lappend result [winfo reqheight .p] - + .p sash place 0 0 30 - + # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqheight .p] @@ -1852,7 +1852,7 @@ test panedwindow-18.2 {MoveSash, move down (unmapped) clipped by reqheight} -set } .p sash place 0 0 100 - + # Get the new sash coord; it should be clipped by the reqheight of # the panedwindow. .p sash coord 0 @@ -1867,13 +1867,13 @@ test panedwindow-18.3 {MoveSash, move down (mapped, height < reqheight) clipped foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } - + # Put the panedwindow up on the display and give it a height < reqheight place .p -x 0 -y 0 -height 32 update .p sash place 0 0 100 - + # Get the new sash coord; it should be clipped by the visible height of # the panedwindow. .p sash coord 0 @@ -1888,13 +1888,13 @@ test panedwindow-18.4 {MoveSash, move down (mapped, height > reqheight) clipped foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } - + # Put the panedwindow up on the display and give it a width > reqwidth place .p -x 0 -y 0 -height 102 update .p sash place 0 0 200 - + # Get the new sash coord; it should be clipped by the visible width of # the panedwindow. .p sash coord 0 @@ -1911,7 +1911,7 @@ test panedwindow-18.5 {MoveSash, move down respects minsize} -setup { } .p sash place 0 0 100 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 @@ -1928,7 +1928,7 @@ test panedwindow-18.6 {MoveSash, move down respects minsize} -setup { } .p sash place 0 0 100 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 @@ -1945,7 +1945,7 @@ test panedwindow-18.7 {MoveSash, move down pushes other sashes} -setup { } .p sash place 0 0 100 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 @@ -1962,7 +1962,7 @@ test panedwindow-18.8 {MoveSash, move down pushes other sashes, respects minsize } .p sash place 0 0 100 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 @@ -1980,8 +1980,8 @@ test panedwindow-18.9 {MoveSash, move down respects minsize, exludes pad} -setup } .p sash place 0 0 100 - - # Get the new sash coord; it should have moved as far as possible, + + # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 0 } -cleanup { @@ -1998,8 +1998,8 @@ test panedwindow-18.10 {MoveSash, move right, negative minsize becomes 0} -setup } .p sash place 0 0 50 - - # Get the new sash coord; it should have moved as far as possible, + + # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { @@ -2017,9 +2017,9 @@ test panedwindow-18.11 {MoveSash, move up} -setup { # Get the requested width of the paned window lappend result [winfo reqheight .p] - + .p sash place 0 0 10 - + # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqheight .p] @@ -2038,7 +2038,7 @@ test panedwindow-18.12 {MoveSash, move up, can't move outside of window} -setup } .p sash place 0 0 -100 - + # Get the new sash coord; it should be clipped by the reqwidth of # the panedwindow. .p sash coord 0 @@ -2055,7 +2055,7 @@ test panedwindow-18.13 {MoveSash, move up respects minsize} -setup { } .p sash place 0 0 0 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 @@ -2072,7 +2072,7 @@ test panedwindow-18.14 {MoveSash, move up respects minsize} -setup { } .p sash place 1 0 0 - + # Get the new sash coord; it should have moved as far as possible. .p sash coord 1 } -cleanup { @@ -2088,7 +2088,7 @@ test panedwindow-18.15 {MoveSash, move up pushes other sashes} -setup { } .p sash place 1 0 0 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 @@ -2105,7 +2105,7 @@ test panedwindow-18.16 {MoveSash, move up pushes other sashes, respects minsize} } .p sash place 1 0 0 - + # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 @@ -2123,8 +2123,8 @@ test panedwindow-18.17 {MoveSash, move up respects minsize, exludes pad} -setup } .p sash place 1 0 0 - - # Get the new sash coord; it should have moved as far as possible, + + # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 1 } -cleanup { @@ -2141,8 +2141,8 @@ test panedwindow-18.18 {MoveSash, move up, negative minsize becomes 0} -setup { } .p sash place 1 0 10 - - # Get the new sash coord; it should have moved as far as possible, + + # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { @@ -2241,10 +2241,10 @@ test panedwindow-19.6 {ComputeGeometry, reqwidth taken from widgets} -setup { deleteWindows } -result [list [list 60 60] [list 80 60]] -test panedwindow-19.7 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.7 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2282,7 +2282,7 @@ test panedwindow-19.9 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{20 0} {40 0}} -test panedwindow-19.10 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.10 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2303,10 +2303,10 @@ test panedwindow-19.10 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{11 3 20 20} {53 3 20 20} {95 3 20 20}} -test panedwindow-19.11 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.11 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2349,7 +2349,7 @@ test panedwindow-19.13 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{0 20} {0 40}} -test panedwindow-19.14 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.14 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2370,10 +2370,10 @@ test panedwindow-19.14 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{3 11 20 20} {3 53 20 20} {3 95 20 20}} -test panedwindow-19.15 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.15 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2411,7 +2411,7 @@ test panedwindow-19.17 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{23 0} {49 0}} -test panedwindow-19.18 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.18 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2432,10 +2432,10 @@ test panedwindow-19.18 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{11 3 20 20} {59 3 20 20} {107 3 20 20}} -test panedwindow-19.19 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.19 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2478,7 +2478,7 @@ test panedwindow-19.21 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{0 23} {0 49}} -test panedwindow-19.22 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.22 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2499,10 +2499,10 @@ test panedwindow-19.22 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{3 11 20 20} {3 59 20 20} {3 107 20 20}} -test panedwindow-19.23 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.23 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2540,7 +2540,7 @@ test panedwindow-19.25 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{20 0} {43 0}} -test panedwindow-19.26 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.26 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2561,10 +2561,10 @@ test panedwindow-19.26 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{11 3 20 20} {56 3 20 20} {101 3 20 20}} -test panedwindow-19.27 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.27 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2607,7 +2607,7 @@ test panedwindow-19.29 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{0 20} {0 43}} -test panedwindow-19.30 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.30 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2628,10 +2628,10 @@ test panedwindow-19.30 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{3 11 20 20} {3 56 20 20} {3 101 20 20}} -test panedwindow-19.31 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.31 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2669,7 +2669,7 @@ test panedwindow-19.33 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{21 0} {47 0}} -test panedwindow-19.34 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.34 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2690,10 +2690,10 @@ test panedwindow-19.34 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{11 3 20 20} {59 3 20 20} {107 3 20 20}} -test panedwindow-19.35 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.35 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2736,7 +2736,7 @@ test panedwindow-19.37 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{0 21} {0 47}} -test panedwindow-19.38 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.38 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 \ @@ -2757,10 +2757,10 @@ test panedwindow-19.38 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{3 11 20 20} {3 59 20 20} {3 107 20 20}} -test panedwindow-19.39 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.39 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -2798,7 +2798,7 @@ test panedwindow-19.41 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{25 0} {55 0}} -test panedwindow-19.42 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.42 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -2819,10 +2819,10 @@ test panedwindow-19.42 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{11 3 20 20} {63 3 20 20} {115 3 20 20}} -test panedwindow-19.43 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.43 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -2865,7 +2865,7 @@ test panedwindow-19.45 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{0 25} {0 55}} -test panedwindow-19.46 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.46 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -2886,10 +2886,10 @@ test panedwindow-19.46 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{3 11 20 20} {3 63 20 20} {3 115 20 20}} -test panedwindow-19.47 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.47 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -2927,7 +2927,7 @@ test panedwindow-19.49 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{28 0} {64 0}} -test panedwindow-19.50 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.50 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -2948,10 +2948,10 @@ test panedwindow-19.50 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{11 3 20 20} {69 3 20 20} {127 3 20 20}} -test panedwindow-19.51 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.51 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -2994,7 +2994,7 @@ test panedwindow-19.53 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{0 28} {0 64}} -test panedwindow-19.54 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.54 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -3015,10 +3015,10 @@ test panedwindow-19.54 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{3 11 20 20} {3 69 20 20} {3 127 20 20}} -test panedwindow-19.55 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.55 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -3056,7 +3056,7 @@ test panedwindow-19.57 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{25 0} {58 0}} -test panedwindow-19.58 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.58 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -3077,10 +3077,10 @@ test panedwindow-19.58 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{11 3 20 20} {66 3 20 20} {121 3 20 20}} -test panedwindow-19.59 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.59 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -3123,7 +3123,7 @@ test panedwindow-19.61 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{0 25} {0 58}} -test panedwindow-19.62 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.62 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -3144,10 +3144,10 @@ test panedwindow-19.62 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{3 11 20 20} {3 66 20 20} {3 121 20 20}} -test panedwindow-19.63 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.63 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -3185,7 +3185,7 @@ test panedwindow-19.65 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{26 0} {62 0}} -test panedwindow-19.66 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.66 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -3206,10 +3206,10 @@ test panedwindow-19.66 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{11 3 20 20} {69 3 20 20} {127 3 20 20}} -test panedwindow-19.67 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.67 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -3252,7 +3252,7 @@ test panedwindow-19.69 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{0 26} {0 62}} -test panedwindow-19.70 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.70 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 5 \ @@ -3273,10 +3273,10 @@ test panedwindow-19.70 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{3 11 20 20} {3 69 20 20} {3 127 20 20}} -test panedwindow-19.71 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.71 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3314,7 +3314,7 @@ test panedwindow-19.73 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{22 2} {42 2}} -test panedwindow-19.74 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.74 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3335,10 +3335,10 @@ test panedwindow-19.74 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{13 5 20 20} {55 5 20 20} {97 5 20 20}} -test panedwindow-19.75 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.75 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3381,7 +3381,7 @@ test panedwindow-19.77 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{2 22} {2 42}} -test panedwindow-19.78 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.78 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3402,10 +3402,10 @@ test panedwindow-19.78 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{5 13 20 20} {5 55 20 20} {5 97 20 20}} -test panedwindow-19.79 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.79 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3443,7 +3443,7 @@ test panedwindow-19.81 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{25 2} {51 2}} -test panedwindow-19.82 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.82 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3464,10 +3464,10 @@ test panedwindow-19.82 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{13 5 20 20} {61 5 20 20} {109 5 20 20}} -test panedwindow-19.83 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.83 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3510,7 +3510,7 @@ test panedwindow-19.85 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{2 25} {2 51}} -test panedwindow-19.86 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.86 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3531,10 +3531,10 @@ test panedwindow-19.86 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{5 13 20 20} {5 61 20 20} {5 109 20 20}} -test panedwindow-19.87 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.87 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3572,7 +3572,7 @@ test panedwindow-19.89 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{22 2} {45 2}} -test panedwindow-19.90 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.90 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3593,10 +3593,10 @@ test panedwindow-19.90 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{13 5 20 20} {58 5 20 20} {103 5 20 20}} -test panedwindow-19.91 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.91 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3639,7 +3639,7 @@ test panedwindow-19.93 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{2 22} {2 45}} -test panedwindow-19.94 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.94 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3660,10 +3660,10 @@ test panedwindow-19.94 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup } -cleanup { deleteWindows } -result {{5 13 20 20} {5 58 20 20} {5 103 20 20}} -test panedwindow-19.95 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.95 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3701,7 +3701,7 @@ test panedwindow-19.97 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{23 2} {49 2}} -test panedwindow-19.98 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.98 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3722,10 +3722,10 @@ test panedwindow-19.98 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{13 5 20 20} {61 5 20 20} {109 5 20 20}} -test panedwindow-19.99 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.99 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3768,7 +3768,7 @@ test panedwindow-19.101 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{2 23} {2 49}} -test panedwindow-19.102 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.102 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 0 \ @@ -3789,10 +3789,10 @@ test panedwindow-19.102 {ComputeGeometry/ArrangePanes, slave coords, vert} -setu } -cleanup { deleteWindows } -result {{5 13 20 20} {5 61 20 20} {5 109 20 20}} -test panedwindow-19.103 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.103 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -3830,7 +3830,7 @@ test panedwindow-19.105 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{27 2} {57 2}} -test panedwindow-19.106 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.106 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -3851,10 +3851,10 @@ test panedwindow-19.106 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{13 5 20 20} {65 5 20 20} {117 5 20 20}} -test panedwindow-19.107 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.107 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -3897,7 +3897,7 @@ test panedwindow-19.109 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{2 27} {2 57}} -test panedwindow-19.110 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.110 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -3918,10 +3918,10 @@ test panedwindow-19.110 {ComputeGeometry/ArrangePanes, slave coords, vert} -setu } -cleanup { deleteWindows } -result {{5 13 20 20} {5 65 20 20} {5 117 20 20}} -test panedwindow-19.111 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.111 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -3959,7 +3959,7 @@ test panedwindow-19.113 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{30 2} {66 2}} -test panedwindow-19.114 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.114 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -3980,10 +3980,10 @@ test panedwindow-19.114 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{13 5 20 20} {71 5 20 20} {129 5 20 20}} -test panedwindow-19.115 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.115 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4026,7 +4026,7 @@ test panedwindow-19.117 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{2 30} {2 66}} -test panedwindow-19.118 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.118 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4047,10 +4047,10 @@ test panedwindow-19.118 {ComputeGeometry/ArrangePanes, slave coords, vert} -setu } -cleanup { deleteWindows } -result {{5 13 20 20} {5 71 20 20} {5 129 20 20}} -test panedwindow-19.119 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.119 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4088,7 +4088,7 @@ test panedwindow-19.121 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{27 2} {60 2}} -test panedwindow-19.122 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.122 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4109,10 +4109,10 @@ test panedwindow-19.122 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{13 5 20 20} {68 5 20 20} {123 5 20 20}} -test panedwindow-19.123 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.123 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4155,7 +4155,7 @@ test panedwindow-19.125 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{2 27} {2 60}} -test panedwindow-19.126 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.126 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4176,10 +4176,10 @@ test panedwindow-19.126 {ComputeGeometry/ArrangePanes, slave coords, vert} -setu } -cleanup { deleteWindows } -result {{5 13 20 20} {5 68 20 20} {5 123 20 20}} -test panedwindow-19.127 {ComputeGeometry, one slave, reqsize set properly} -setup { +test panedwindow-19.127 {ComputeGeometry, one pane, reqsize set properly} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4217,7 +4217,7 @@ test panedwindow-19.129 {ComputeGeometry, sash coords} -setup { deleteWindows } -result {{28 2} {64 2}} -test panedwindow-19.130 {ComputeGeometry/ArrangePanes, slave coords} -setup { +test panedwindow-19.130 {ComputeGeometry/ArrangePanes, pane coords} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4238,10 +4238,10 @@ test panedwindow-19.130 {ComputeGeometry/ArrangePanes, slave coords} -setup { deleteWindows } -result {{13 5 20 20} {71 5 20 20} {129 5 20 20}} -test panedwindow-19.131 {ComputeGeometry, one slave, vertical} -setup { +test panedwindow-19.131 {ComputeGeometry, one pane, vertical} -setup { deleteWindows } -body { - # With just one slave, sashpad and sashwidth should not + # With just one pane, sashpad and sashwidth should not # affect the panedwindow's geometry, since no sash should # ever be drawn. panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4284,7 +4284,7 @@ test panedwindow-19.133 {ComputeGeometry, sash coords, vertical} -setup { deleteWindows } -result {{2 28} {2 64}} -test panedwindow-19.134 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup { +test panedwindow-19.134 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup { deleteWindows } -body { panedwindow .p -borderwidth 2 -sashpad 5 \ @@ -4317,7 +4317,7 @@ test panedwindow-20.1 {destroyed widgets are removed from panedwindow} -setup { } -cleanup { deleteWindows } -result {} -test panedwindow-20.2 {destroyed slave causes geometry recomputation} -setup { +test panedwindow-20.2 {destroyed pane causes geometry recomputation} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 2 @@ -4328,7 +4328,7 @@ test panedwindow-20.2 {destroyed slave causes geometry recomputation} -setup { } -cleanup { deleteWindows } -result 20 - + test panedwindow-21.1 {ArrangePanes, extra space is given to the last pane} -setup { deleteWindows @@ -4537,7 +4537,7 @@ test panedwindow-21.15 {ArrangePanes, last pane grows} -setup { } -result {50 150 1 1 211 50 150 1 89 300} -test panedwindow-22.1 {PanedWindowReqProc, react to slave geometry changes} -setup { +test panedwindow-22.1 {PanedWindowReqProc, react to pane geometry changes} -setup { deleteWindows } -body { # Basically just want to make sure that the PanedWindowReqProc is called @@ -4550,7 +4550,7 @@ test panedwindow-22.1 {PanedWindowReqProc, react to slave geometry changes} -set } -cleanup { deleteWindows } -result {40 80} -test panedwindow-22.2 {PanedWindowReqProc, react to slave geometry changes} -setup { +test panedwindow-22.2 {PanedWindowReqProc, react to pane geometry changes} -setup { deleteWindows } -body { panedwindow .p -orient horizontal -sashpad 0 -sashwidth 2 @@ -4824,7 +4824,7 @@ test panedwindow-23.21 {ConfigurePanes, -before, relocate existing windows} -set } -cleanup { deleteWindows } -result {.d .b .a .c} -test panedwindow-23.22 {ConfigurePanes, slave specified multiple times} -setup { +test panedwindow-23.22 {ConfigurePanes, pane specified multiple times} -setup { deleteWindows } -body { # This test should not cause a core dump @@ -4839,7 +4839,7 @@ test panedwindow-23.22 {ConfigurePanes, slave specified multiple times} -setup { } -cleanup { deleteWindows } -result {.a .b .c} -test panedwindow-23.23 {ConfigurePanes, slave specified multiple times} -setup { +test panedwindow-23.23 {ConfigurePanes, pane specified multiple times} -setup { deleteWindows } -body { # This test should not cause a core dump @@ -5146,7 +5146,7 @@ test panedwindow-25.1 {DestroyPanedWindow} -setup { } set result {} } -result {} -test panedwindow-25.2 {UnmapNotify and MapNotify events are propagated to slaves} -setup { +test panedwindow-25.2 {UnmapNotify and MapNotify events are propagated to panes} -setup { deleteWindows } -body { panedwindow .pw diff --git a/tests/place.test b/tests/place.test index 0a5e22f..d389be9 100644 --- a/tests/place.test +++ b/tests/place.test @@ -53,17 +53,17 @@ test place-1.3 {Tk_PlaceCmd procedure, "info" option} -setup { } -result {-in {.t.a b} -x 1 -relx 0.2 -y 2 -rely 0.2 -width {} -relwidth 0.3 -height 4 -relheight {} -anchor w -bordermode ignore} -test place-2.1 {ConfigureSlave procedure, -height option} -body { +test place-2.1 {ConfigureContent procedure, -height option} -body { place .t.f2 -height abcd } -returnCodes error -result {bad screen distance "abcd"} -test place-2.2 {ConfigureSlave procedure, -height option} -setup { +test place-2.2 {ConfigureContent procedure, -height option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -height 40 update winfo height .t.f2 } -result {40} -test place-2.3 {ConfigureSlave procedure, -height option} -setup { +test place-2.3 {ConfigureContent procedure, -height option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -height 120 @@ -74,17 +74,17 @@ test place-2.3 {ConfigureSlave procedure, -height option} -setup { } -result {60} -test place-3.1 {ConfigureSlave procedure, -relheight option} -body { +test place-3.1 {ConfigureContent procedure, -relheight option} -body { place .t.f2 -relheight abcd } -returnCodes error -result {expected floating-point number but got "abcd"} -test place-3.2 {ConfigureSlave procedure, -relheight option} -setup { +test place-3.2 {ConfigureContent procedure, -relheight option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relheight .5 update winfo height .t.f2 } -result {40} -test place-3.3 {ConfigureSlave procedure, -relheight option} -setup { +test place-3.3 {ConfigureContent procedure, -relheight option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relheight .8 @@ -95,30 +95,30 @@ test place-3.3 {ConfigureSlave procedure, -relheight option} -setup { } -result {60} -test place-4.1 {ConfigureSlave procedure, bad -in options} -setup { +test place-4.1 {ConfigureContent procedure, bad -in options} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f2 } -returnCodes error -result {can't place .t.f2 relative to itself} -test place-4.2 {ConfigureSlave procedure, bad -in option} -setup { +test place-4.2 {ConfigureContent procedure, bad -in option} -setup { place forget .t.f2 } -body { set result [list [winfo manager .t.f2]] catch {place .t.f2 -in .t.f2} lappend result [winfo manager .t.f2] } -result {{} {}} -test place-4.3 {ConfigureSlave procedure, bad -in option} -setup { +test place-4.3 {ConfigureContent procedure, bad -in option} -setup { place forget .t.f2 } -body { winfo manager .t.f2 place .t.f2 -in .t.f2 } -returnCodes error -result {can't place .t.f2 relative to itself} -test place-4.4 {ConfigureSlave procedure, bad -in option} -setup { +test place-4.4 {ConfigureContent procedure, bad -in option} -setup { place forget .t.f2 } -body { place .t.f2 -in . } -returnCodes error -result {can't place .t.f2 relative to .} -test place-4.5 {ConfigureSlave procedure, bad -in option} -setup { +test place-4.5 {ConfigureContent procedure, bad -in option} -setup { } -body { frame .t.f1 place .t.f1 -in .t.f1 @@ -139,17 +139,17 @@ test place-4.7 {prevent management loops} -setup { place .t.f3 -in .t.f1 } -returnCodes error -result {can't put .t.f3 inside .t.f1, would cause management loop} -test place-5.1 {ConfigureSlave procedure, -relwidth option} -body { +test place-5.1 {ConfigureContent procedure, -relwidth option} -body { place .t.f2 -relwidth abcd } -returnCodes error -result {expected floating-point number but got "abcd"} -test place-5.2 {ConfigureSlave procedure, -relwidth option} -setup { +test place-5.2 {ConfigureContent procedure, -relwidth option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relwidth .5 update winfo width .t.f2 } -result {75} -test place-5.3 {ConfigureSlave procedure, -relwidth option} -setup { +test place-5.3 {ConfigureContent procedure, -relwidth option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relwidth .8 @@ -159,17 +159,17 @@ test place-5.3 {ConfigureSlave procedure, -relwidth option} -setup { winfo width .t.f2 } -result {30} -test place-6.1 {ConfigureSlave procedure, -width option} -body { +test place-6.1 {ConfigureContent procedure, -width option} -body { place .t.f2 -width abcd } -returnCodes error -result {bad screen distance "abcd"} -test place-6.2 {ConfigureSlave procedure, -width option} -setup { +test place-6.2 {ConfigureContent procedure, -width option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -width 100 update winfo width .t.f2 } -result {100} -test place-6.3 {ConfigureSlave procedure, -width option} -setup { +test place-6.3 {ConfigureContent procedure, -width option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -width 120 @@ -267,7 +267,7 @@ if {[tk windowingsystem] == "win32"} { } } -test place-8.1 {MasterStructureProc, mapping and unmapping slaves} -setup { +test place-8.1 {PlaceStructureProc, mapping and unmapping content} -setup { place forget .t.f2 place forget .t.f } -body { @@ -283,7 +283,7 @@ test place-8.1 {MasterStructureProc, mapping and unmapping slaves} -setup { placeUpdate lappend result [winfo ismapped .t.f2] } -result {1 0 40 30 0 1} -test place-8.2 {MasterStructureProc, mapping and unmapping slaves} -setup { +test place-8.2 {PlaceStructureProc, mapping and unmapping content} -setup { place forget .t.f2 place forget .t.f update idletasks @@ -329,7 +329,7 @@ test place-9.5 {PlaceObjCmd} -setup { place badopt .foo } -cleanup { destroy .foo -} -returnCodes error -result {bad option "badopt": must be configure, forget, info, or slaves} +} -returnCodes error -result {bad option "badopt": must be configure, content, forget, info, or slaves} test place-9.6 {PlaceObjCmd, configure errors} -setup { destroy .foo } -body { @@ -380,17 +380,17 @@ test place-9.11 {PlaceObjCmd, info errors} -setup { } -cleanup { destroy .foo } -returnCodes error -result {wrong # args: should be "place info pathName"} -test place-9.12 {PlaceObjCmd, slaves errors} -setup { +test place-9.12 {PlaceObjCmd, content errors} -setup { destroy .foo } -body { frame .foo - place slaves .foo bar + place content .foo bar } -cleanup { destroy .foo -} -returnCodes error -result {wrong # args: should be "place slaves pathName"} +} -returnCodes error -result {wrong # args: should be "place content pathName"} -test place-10.1 {ConfigureSlave} -setup { +test place-10.1 {ConfigureContent} -setup { destroy .foo } -body { frame .foo @@ -398,7 +398,7 @@ test place-10.1 {ConfigureSlave} -setup { } -cleanup { destroy .foo } -returnCodes error -result {unknown option "-badopt"} -test place-10.2 {ConfigureSlave} -setup { +test place-10.2 {ConfigureContent} -setup { destroy .foo } -body { frame .foo @@ -406,7 +406,7 @@ test place-10.2 {ConfigureSlave} -setup { } -cleanup { destroy .foo } -returnCodes error -result {value for "-anchor" missing} -test place-10.3 {ConfigureSlave} -setup { +test place-10.3 {ConfigureContent} -setup { destroy .foo } -body { frame .foo @@ -414,7 +414,7 @@ test place-10.3 {ConfigureSlave} -setup { } -cleanup { destroy .foo } -returnCodes error -result {bad bordermode "j": must be inside, outside, or ignore} -test place-10.4 {ConfigureSlave} -setup { +test place-10.4 {ConfigureContent} -setup { destroy .foo } -body { frame .foo @@ -422,23 +422,23 @@ test place-10.4 {ConfigureSlave} -setup { } -cleanup { destroy .foo } -returnCodes error -result {value for "-y" missing} - -test place-11.1 {PlaceObjCmd, slaves command} -setup { + +test place-11.1 {PlaceObjCmd, content command} -setup { destroy .foo } -body { frame .foo - place slaves .foo + place content .foo } -cleanup { destroy .foo } -result {} -test place-11.2 {PlaceObjCmd, slaves command} -setup { +test place-11.2 {PlaceObjCmd, content command} -setup { destroy .foo .bar } -body { frame .foo frame .bar place .bar -in .foo - place slaves .foo + place content .foo } -cleanup { destroy .foo .bar } -result [list .bar] @@ -500,7 +500,7 @@ test place-14.1 {memory leak testing} -constraints memory -setup { return $res } } -body { - # Test all manners of forgetting a slave + # Test all manners of forgetting content frame .f frame .f.f stress { diff --git a/tests/safe.test b/tests/safe.test index 475d938..5a2cd26 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -28,23 +28,35 @@ namespace import -force tcltest::test # This probably means that tk wasn't installed properly. ## it indicates that something went wrong sourcing tk.tcl. -## Ensure that any changes that occured to tk.tcl will work or are properly +## Ensure that any changes that occurred to tk.tcl will work or are properly ## prevented in a safe interpreter. -- hobbs # The set of hidden commands is platform dependent: -set hidden_cmds {bell cd clipboard encoding exec exit fconfigure glob grab load menu open pwd selection socket source tcl:encoding:dirs toplevel unload wm} -lappend hidden_cmds {*}[apply {{} { +set hidden_cmds [list bell cd clipboard encoding exec exit \ + fconfigure glob grab load menu open pwd selection \ + socket source tcl:encoding:dirs toplevel unload wm] +if {[package vsatisfies [package provide Tcl] 8.7-]} { + lappend hidden_cmds file tcl:encoding:system tcl:file:tempdir foreach cmd { - atime attributes copy delete dirname executable exists extension - isdirectory isfile link lstat mkdir mtime nativename normalize owned - readable readlink rename rootname size stat tail tempfile type - volumes writable - } {lappend result tcl:file:$cmd}; return $result -}}] + cmdtype nameofexecutable + } {lappend hidden_cmds tcl:info:$cmd} + foreach cmd { + autopurge list purge status + } {lappend hidden_cmds tcl:process:$cmd} + foreach cmd { + lmkimg lmkzip mkimg mkkey mkzip mount mount_data unmount + } {lappend hidden_cmds tcl:zipfs:$cmd} +} +foreach cmd { + atime attributes copy delete dirname executable exists extension + isdirectory isfile link lstat mkdir mtime nativename normalize + owned readable readlink rename rootname size stat tail tempfile + type volumes writable +} {lappend hidden_cmds tcl:file:$cmd} if {[tk windowingsystem] ne "x11"} { - lappend hidden_cmds tk_chooseColor tk_chooseDirectory tk_getOpenFile \ - tk_getSaveFile tk_messageBox + lappend hidden_cmds tk_chooseColor tk_chooseDirectory \ + tk_getOpenFile tk_getSaveFile tk_messageBox } if {[llength [info commands send]]} { lappend hidden_cmds send @@ -182,12 +194,12 @@ test safe-4.2 {testing loadTk -use} -setup { destroy $w } -result {} -test safe-5.1 {loading Tk in safe interps without master's clearance} -body { +test safe-5.1 {loading Tk in safe interps without parent's clearance} -body { set i [safe::interpCreate] interp eval $i {load {} Tk} } -cleanup { safe::interpDelete $i -} -returnCodes error -result {not allowed} +} -returnCodes error -match glob -result {*not allowed} test safe-5.2 {multi-level Tk loading with clearance} -setup { set safeParent [safe::interpCreate] } -body { diff --git a/tests/safePrimarySelection.test b/tests/safePrimarySelection.test index 7cc31f4..8475ce3 100644 --- a/tests/safePrimarySelection.test +++ b/tests/safePrimarySelection.test @@ -16,9 +16,9 @@ tcltest::loadTestedCommands # ------------------------------------------------------------------------------ # - Tests 3.*, 6.* test that the fix for ticket de156e9efe implemented in branch # bug-de156e9efe has been applied and still works. They test that a Safe Base -# slave interpreter cannot write to the PRIMARY selection. -# - The other tests verify that the master interpreter and an unsafe slave CAN -# write to the PRIMARY selection, and therefore that the test scripts +# child interpreter cannot write to the PRIMARY selection. +# - The other tests verify that the parent interpreter and an child interpreter +# CAN write to the PRIMARY selection, and therefore that the test scripts # themselves are valid. # - A text, entry, ttk::entry, listbox, spinbox or ttk::spinbox widget can have # option -exportselection 1, meaning (in an unsafe interpreter) that a @@ -33,12 +33,12 @@ namespace eval ::_test_tmp {} # ------------------------------------------------------------------------------ # Proc ::_test_tmp::unsafeInterp # ------------------------------------------------------------------------------ -# Command that creates an unsafe child interpreter and tries to load Tk. +# Command that creates an child interpreter and tries to load Tk. # - This is necessary for loading Tk if the tests are done in the build # directory without installing Tk. In that case the usual auto_path loading # mechanism cannot work because the tk binary is not where pkgIndex.tcl says # it is. -# - This command is not needed for Safe Base slaves because safe::loadTk does +# - This command is not needed for Safe Base children because safe::loadTk does # something similar and works correctly. # - Based on scripts in winSend.test. # ------------------------------------------------------------------------------ @@ -208,11 +208,11 @@ set ::_test_tmp::script { } } -# Do this once for the master interpreter. +# Do this once for the parent interpreter. eval $::_test_tmp::script -test safePrimarySelection-1.1 {master interpreter, text, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.1 {parent interpreter, text, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -223,8 +223,8 @@ test safePrimarySelection-1.1 {master interpreter, text, no existing selection} ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-1.2 {master interpreter, entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.2 {parent interpreter, entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -235,8 +235,8 @@ test safePrimarySelection-1.2 {master interpreter, entry, no existing selection} ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-1.3 {master interpreter, ttk::entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.3 {parent interpreter, ttk::entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -247,8 +247,8 @@ test safePrimarySelection-1.3 {master interpreter, ttk::entry, no existing selec ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-1.4 {master interpreter, listbox, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.4 {parent interpreter, listbox, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -259,8 +259,8 @@ test safePrimarySelection-1.4 {master interpreter, listbox, no existing selectio ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-1.5 {master interpreter, spinbox as entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.5 {parent interpreter, spinbox as entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -271,8 +271,8 @@ test safePrimarySelection-1.5 {master interpreter, spinbox as entry, no existing ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-1.6 {master interpreter, spinbox spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.6 {parent interpreter, spinbox spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -283,8 +283,8 @@ test safePrimarySelection-1.6 {master interpreter, spinbox spun, no existing sel ::_test_tmp::clearPrimarySelection } -result {2} -test safePrimarySelection-1.7 {master interpreter, spinbox spun/selected/spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.7 {parent interpreter, spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -295,8 +295,8 @@ test safePrimarySelection-1.7 {master interpreter, spinbox spun/selected/spun, n ::_test_tmp::clearPrimarySelection } -result {3} -test safePrimarySelection-1.8 {master interpreter, ttk::spinbox as entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.8 {parent interpreter, ttk::spinbox as entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -307,8 +307,8 @@ test safePrimarySelection-1.8 {master interpreter, ttk::spinbox as entry, no exi ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-1.9 {master interpreter, ttk::spinbox spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.9 {parent interpreter, ttk::spinbox spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -319,8 +319,8 @@ test safePrimarySelection-1.9 {master interpreter, ttk::spinbox spun, no existin ::_test_tmp::clearPrimarySelection } -result {2} -test safePrimarySelection-1.10 {master interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-1.10 {parent interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { @@ -331,12 +331,12 @@ test safePrimarySelection-1.10 {master interpreter, ttk::spinbox spun/selected/s ::_test_tmp::clearPrimarySelection } -result {3} -test safePrimarySelection-2.1 {unsafe slave interpreter, text, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.1 {child interpreter, text, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryText @@ -348,12 +348,12 @@ test safePrimarySelection-2.1 {unsafe slave interpreter, text, no existing selec ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-2.2 {unsafe slave interpreter, entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.2 {child interpreter, entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryEntry @@ -365,12 +365,12 @@ test safePrimarySelection-2.2 {unsafe slave interpreter, entry, no existing sele ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-2.3 {unsafe slave interpreter, ttk::entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.3 {child interpreter, ttk::entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkEntry @@ -382,12 +382,12 @@ test safePrimarySelection-2.3 {unsafe slave interpreter, ttk::entry, no existing ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-2.4 {unsafe slave interpreter, listbox, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.4 {child interpreter, listbox, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryListbox @@ -399,12 +399,12 @@ test safePrimarySelection-2.4 {unsafe slave interpreter, listbox, no existing se ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-2.5 {unsafe slave interpreter, spinbox as entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.5 {child interpreter, spinbox as entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 1 @@ -416,12 +416,12 @@ test safePrimarySelection-2.5 {unsafe slave interpreter, spinbox as entry, no ex ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-2.6 {unsafe slave interpreter, spinbox spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.6 {child interpreter, spinbox spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 2 @@ -433,12 +433,12 @@ test safePrimarySelection-2.6 {unsafe slave interpreter, spinbox spun, no existi ::_test_tmp::clearPrimarySelection } -result {2} -test safePrimarySelection-2.7 {unsafe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.7 {child interpreter, spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 3 @@ -450,12 +450,12 @@ test safePrimarySelection-2.7 {unsafe slave interpreter, spinbox spun/selected/s ::_test_tmp::clearPrimarySelection } -result {3} -test safePrimarySelection-2.8 {unsafe slave interpreter, ttk::spinbox as entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.8 {child interpreter, ttk::spinbox as entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 1 @@ -467,12 +467,12 @@ test safePrimarySelection-2.8 {unsafe slave interpreter, ttk::spinbox as entry, ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-2.9 {unsafe slave interpreter, ttk::spinbox spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.9 {child interpreter, ttk::spinbox spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 2 @@ -484,12 +484,12 @@ test safePrimarySelection-2.9 {unsafe slave interpreter, ttk::spinbox spun, no e ::_test_tmp::clearPrimarySelection } -result {2} -test safePrimarySelection-2.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-2.10 {child interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 3 @@ -501,13 +501,13 @@ test safePrimarySelection-2.10 {unsafe slave interpreter, ttk::spinbox spun/sele ::_test_tmp::clearPrimarySelection } -result {3} -test safePrimarySelection-3.1 {IMPORTANT, safe slave interpreter, text, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.1 {IMPORTANT, safe interpreter, text, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -522,13 +522,13 @@ test safePrimarySelection-3.1 {IMPORTANT, safe slave interpreter, text, no exist ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-3.2 {IMPORTANT, safe slave interpreter, entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.2 {IMPORTANT, safe interpreter, entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -543,13 +543,13 @@ test safePrimarySelection-3.2 {IMPORTANT, safe slave interpreter, entry, no exis ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-3.3 {IMPORTANT, safe slave interpreter, ttk::entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.3 {IMPORTANT, safe interpreter, ttk::entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -564,13 +564,13 @@ test safePrimarySelection-3.3 {IMPORTANT, safe slave interpreter, ttk::entry, no ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-3.4 {IMPORTANT, safe slave interpreter, listbox, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.4 {IMPORTANT, safe interpreter, listbox, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -585,13 +585,13 @@ test safePrimarySelection-3.4 {IMPORTANT, safe slave interpreter, listbox, no ex ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-3.5 {IMPORTANT, safe slave interpreter, spinbox as entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.5 {IMPORTANT, safe interpreter, spinbox as entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -606,13 +606,13 @@ test safePrimarySelection-3.5 {IMPORTANT, safe slave interpreter, spinbox as ent ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-3.6 {IMPORTANT, safe slave interpreter, spinbox spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.6 {IMPORTANT, safe interpreter, spinbox spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -627,13 +627,13 @@ test safePrimarySelection-3.6 {IMPORTANT, safe slave interpreter, spinbox spun, ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-3.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.7 {IMPORTANT, safe interpreter, spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -648,13 +648,13 @@ test safePrimarySelection-3.7 {IMPORTANT, safe slave interpreter, spinbox spun/s ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-3.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.8 {IMPORTANT, safe interpreter, ttk::spinbox as entry, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -669,13 +669,13 @@ test safePrimarySelection-3.8 {IMPORTANT, safe slave interpreter, ttk::spinbox a ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-3.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.9 {IMPORTANT, safe interpreter, ttk::spinbox spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -690,13 +690,13 @@ test safePrimarySelection-3.9 {IMPORTANT, safe slave interpreter, ttk::spinbox s ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-3.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-3.10 {IMPORTANT, safe interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -711,8 +711,8 @@ test safePrimarySelection-3.10 {IMPORTANT, safe slave interpreter, ttk::spinbox ::_test_tmp::clearPrimarySelection } -result {----} -test safePrimarySelection-4.1 {master interpreter, text, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.1 {parent interpreter, text, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -723,8 +723,8 @@ test safePrimarySelection-4.1 {master interpreter, text, existing selection} -se ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-4.2 {master interpreter, entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.2 {parent interpreter, entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -735,8 +735,8 @@ test safePrimarySelection-4.2 {master interpreter, entry, existing selection} -s ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-4.3 {master interpreter, ttk::entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.3 {parent interpreter, ttk::entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -747,8 +747,8 @@ test safePrimarySelection-4.3 {master interpreter, ttk::entry, existing selectio ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-4.4 {master interpreter, listbox, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.4 {parent interpreter, listbox, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -759,8 +759,8 @@ test safePrimarySelection-4.4 {master interpreter, listbox, existing selection} ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-4.5 {master interpreter, spinbox as entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.5 {parent interpreter, spinbox as entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -771,8 +771,8 @@ test safePrimarySelection-4.5 {master interpreter, spinbox as entry, existing se ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-4.6 {master interpreter, spinbox spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.6 {parent interpreter, spinbox spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -783,8 +783,8 @@ test safePrimarySelection-4.6 {master interpreter, spinbox spun, existing select ::_test_tmp::clearPrimarySelection } -result {2} -test safePrimarySelection-4.7 {master interpreter, spinbox spun/selected/spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.7 {parent interpreter, spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -795,8 +795,8 @@ test safePrimarySelection-4.7 {master interpreter, spinbox spun/selected/spun, e ::_test_tmp::clearPrimarySelection } -result {3} -test safePrimarySelection-4.8 {master interpreter, ttk::spinbox as entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.8 {parent interpreter, ttk::spinbox as entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -807,8 +807,8 @@ test safePrimarySelection-4.8 {master interpreter, ttk::spinbox as entry, existi ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-4.9 {master interpreter, ttk::spinbox spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.9 {parent interpreter, ttk::spinbox spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -819,8 +819,8 @@ test safePrimarySelection-4.9 {master interpreter, ttk::spinbox spun, existing s ::_test_tmp::clearPrimarySelection } -result {2} -test safePrimarySelection-4.10 {master interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-4.10 {parent interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { @@ -831,12 +831,12 @@ test safePrimarySelection-4.10 {master interpreter, ttk::spinbox spun/selected/s ::_test_tmp::clearPrimarySelection } -result {3} -test safePrimarySelection-5.1 {unsafe slave interpreter, text, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.1 {child interpreter, text, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryText @@ -848,12 +848,12 @@ test safePrimarySelection-5.1 {unsafe slave interpreter, text, existing selectio ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-5.2 {unsafe slave interpreter, entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.2 {child interpreter, entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryEntry @@ -865,12 +865,12 @@ test safePrimarySelection-5.2 {unsafe slave interpreter, entry, existing selecti ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-5.3 {unsafe slave interpreter, ttk::entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.3 {child interpreter, ttk::entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkEntry @@ -882,12 +882,12 @@ test safePrimarySelection-5.3 {unsafe slave interpreter, ttk::entry, existing se ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-5.4 {unsafe slave interpreter, listbox, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.4 {child interpreter, listbox, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryListbox @@ -899,12 +899,12 @@ test safePrimarySelection-5.4 {unsafe slave interpreter, listbox, existing selec ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-5.5 {unsafe slave interpreter, spinbox as entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.5 {child interpreter, spinbox as entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 1 @@ -916,12 +916,12 @@ test safePrimarySelection-5.5 {unsafe slave interpreter, spinbox as entry, exist ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-5.6 {unsafe slave interpreter, spinbox spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.6 {child interpreter, spinbox spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 2 @@ -933,12 +933,12 @@ test safePrimarySelection-5.6 {unsafe slave interpreter, spinbox spun, existing ::_test_tmp::clearPrimarySelection } -result {2} -test safePrimarySelection-5.7 {unsafe slave interpreter, spinbox spun/selected/spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.7 {child interpreter, spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 3 @@ -950,12 +950,12 @@ test safePrimarySelection-5.7 {unsafe slave interpreter, spinbox spun/selected/s ::_test_tmp::clearPrimarySelection } -result {3} -test safePrimarySelection-5.8 {unsafe slave interpreter, ttk::spinbox as entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.8 {child interpreter, ttk::spinbox as entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 1 @@ -967,12 +967,12 @@ test safePrimarySelection-5.8 {unsafe slave interpreter, ttk::spinbox as entry, ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} -test safePrimarySelection-5.9 {unsafe slave interpreter, ttk::spinbox spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.9 {child interpreter, ttk::spinbox spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 2 @@ -984,12 +984,12 @@ test safePrimarySelection-5.9 {unsafe slave interpreter, ttk::spinbox spun, exis ::_test_tmp::clearPrimarySelection } -result {2} -test safePrimarySelection-5.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-5.10 {child interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { - set int2 slave2 + set int2 child2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 3 @@ -1001,13 +1001,13 @@ test safePrimarySelection-5.10 {unsafe slave interpreter, ttk::spinbox spun/sele ::_test_tmp::clearPrimarySelection } -result {3} -test safePrimarySelection-6.1 {IMPORTANT, safe slave interpreter, text, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.1 {IMPORTANT, safe interpreter, text, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -1022,13 +1022,13 @@ test safePrimarySelection-6.1 {IMPORTANT, safe slave interpreter, text, existing ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} -test safePrimarySelection-6.2 {IMPORTANT, safe slave interpreter, entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.2 {IMPORTANT, safe interpreter, entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -1043,13 +1043,13 @@ test safePrimarySelection-6.2 {IMPORTANT, safe slave interpreter, entry, existin ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} -test safePrimarySelection-6.3 {IMPORTANT, safe slave interpreter, ttk::entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.3 {IMPORTANT, safe interpreter, ttk::entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -1064,13 +1064,13 @@ test safePrimarySelection-6.3 {IMPORTANT, safe slave interpreter, ttk::entry, ex ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} -test safePrimarySelection-6.4 {IMPORTANT, safe slave interpreter, listbox, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.4 {IMPORTANT, safe interpreter, listbox, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -1085,13 +1085,13 @@ test safePrimarySelection-6.4 {IMPORTANT, safe slave interpreter, listbox, exist ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} -test safePrimarySelection-6.5 {IMPORTANT, safe slave interpreter, spinbox as entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.5 {IMPORTANT, safe interpreter, spinbox as entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -1106,13 +1106,13 @@ test safePrimarySelection-6.5 {IMPORTANT, safe slave interpreter, spinbox as ent ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} -test safePrimarySelection-6.6 {IMPORTANT, safe slave interpreter, spinbox spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.6 {IMPORTANT, safe interpreter, spinbox spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -1127,13 +1127,13 @@ test safePrimarySelection-6.6 {IMPORTANT, safe slave interpreter, spinbox spun, ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} -test safePrimarySelection-6.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.7 {IMPORTANT, safe interpreter, spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -1148,13 +1148,13 @@ test safePrimarySelection-6.7 {IMPORTANT, safe slave interpreter, spinbox spun/s ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} -test safePrimarySelection-6.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.8 {IMPORTANT, safe interpreter, ttk::spinbox as entry, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -1169,13 +1169,13 @@ test safePrimarySelection-6.8 {IMPORTANT, safe slave interpreter, ttk::spinbox a ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} -test safePrimarySelection-6.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.9 {IMPORTANT, safe interpreter, ttk::spinbox spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script @@ -1190,13 +1190,13 @@ test safePrimarySelection-6.9 {IMPORTANT, safe slave interpreter, ttk::spinbox s ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} -test safePrimarySelection-6.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { - catch {interp delete slave2} +test safePrimarySelection-6.10 {IMPORTANT, safe interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete child2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] - set int2 slave2 + set int2 child2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 8966f1f..097ab79 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands @@ -23,7 +23,7 @@ proc getTroughSize {w} { return [expr {[winfo height $w] - 2*[testmetrics cyvscroll $w]}] } else { return [expr {[winfo width $w] - 2*[testmetrics cxhscroll $w]}] - } + } } else { if {[tk windowingsystem] eq "x11"} { # Calculations here assume that the arrow area is a square. @@ -60,7 +60,7 @@ proc getTroughSize {w} { foreach {width height} [wm minsize .] { set height [expr {($height < 200) ? 200 : $height}] set width [expr {($width < 1) ? 1 : $width}] -} +} frame .f -height $height -width $width pack .f -side left @@ -341,7 +341,7 @@ test scrollbar-3.49 {ScrollbarWidgetCmd procedure, "identify" option} { test scrollbar-3.50.1 {ScrollbarWidgetCmd procedure, "identify" option} notAqua { .s identify 5 5 } {arrow1} -test scrollbar-3.50.1 {ScrollbarWidgetCmd procedure, "identify" option} aqua { +test scrollbar-3.50.2 {ScrollbarWidgetCmd procedure, "identify" option} aqua { # macOS scrollbars have no arrows nowadays .s identify 5 5 } {trough1} @@ -380,15 +380,15 @@ test scrollbar-3.59 {ScrollbarWidgetCmd procedure, "set" option} { set result } {0.0 0.3} test scrollbar-3.60 {ScrollbarWidgetCmd procedure, "set" option} { - .s set 1.1 .4 + .s set 1.1 .4 .s get } {1.0 1.0} test scrollbar-3.61 {ScrollbarWidgetCmd procedure, "set" option} { - .s set .5 -.3 + .s set .5 -.3 .s get } {0.5 0.5} test scrollbar-3.62 {ScrollbarWidgetCmd procedure, "set" option} { - .s set .5 87 + .s set .5 87 .s get } {0.5 1.0} test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} { @@ -412,15 +412,15 @@ test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3 jkl} msg] $msg } {1 {expected integer but got "jkl"}} test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} { - .s set -10 50 20 30 + .s set -10 50 20 30 .s get } {0 50 0 0} test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} { - .s set 100 -10 20 30 + .s set 100 -10 20 30 .s get } {100 0 20 30} test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} { - .s set 100 50 30 20 + .s set 100 50 30 20 .s get } {100 50 30 30} test scrollbar-3.71 {ScrollbarWidgetCmd procedure, "set" option} { @@ -499,7 +499,7 @@ test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua { .s identify 8 19 } {trough1} test scrollbar-6.14 {ScrollbarPosition procedure} win { - .s identify [expr {[winfo width .s] / 2}] 0 + .s identify [expr {[winfo width .s] / 2}] 0 } {arrow1} test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[testmetrics cyvscroll .s] - 1}] @@ -610,7 +610,7 @@ test scrollbar-6.41.2 {ScrollbarPosition procedure} aqua { } {trough2} test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} { .t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] - - 1}] [expr {[winfo height .t.s] / 2}] + - 1}] [expr {[winfo height .t.s] / 2}] } {slider} test scrollbar-6.44 {ScrollbarPosition procedure} unix { .t.s identify 100 18 @@ -759,7 +759,7 @@ test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destructi update ; # shall not trigger error invalid command name ".top.s" } -cleanup { destroy .top.s .top -} -result {} +} -result {} test scrollbar-11.2 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body { proc destroy_scrollbar {{y 0}} { if {[winfo exists .top.s]} { @@ -778,7 +778,7 @@ test scrollbar-11.2 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destructi update ; # shall not trigger error invalid command name ".top.s" } -cleanup { destroy .top.s .top -} -result {} +} -result {} catch {destroy .s} catch {destroy .t} diff --git a/tests/send.test b/tests/send.test index 403a207..7fdf0af 100644 --- a/tests/send.test +++ b/tests/send.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands diff --git a/tests/spinbox.test b/tests/spinbox.test index 3f55d7f..8d19a7e 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -17,7 +17,7 @@ proc scroll args { global scrollInfo set scrollInfo $args } -# For trace variable +# For trace variable proc override args { global x set x 12345 @@ -94,7 +94,7 @@ test spinbox-1.5 {configuration option: "bd"} -setup { .e cget -bd } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-1.6 {configuration option: "bd" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -138,7 +138,7 @@ test spinbox-1.9 {configuration option: "borderwidth"} -setup { .e cget -borderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.10 {configuration option: "borderwidth" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -282,7 +282,7 @@ test spinbox-1.22 {configuration option: "exportselection"} -setup { .e cget -exportselection } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.23 {configuration option: "exportselection" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -458,7 +458,7 @@ test spinbox-1.38 {configuration option: "highlightthickness"} -setup { .e cget -highlightthickness } -cleanup { destroy .e -} -result {6} +} -result 6 test spinbox-1.39 {configuration option: "highlightthickness" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -480,7 +480,7 @@ test spinbox-1.40 {configuration option: "highlightthickness"} -setup { .e cget -highlightthickness } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-1.41 {configuration option: "increment"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ @@ -536,7 +536,7 @@ test spinbox-1.45 {configuration option: "insertborderwidth"} -setup { .e cget -insertborderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.46 {configuration option: "insertborderwidth" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -558,7 +558,7 @@ test spinbox-1.47 {configuration option: "insertofftime"} -setup { .e cget -insertofftime } -cleanup { destroy .e -} -result {100} +} -result 100 test spinbox-1.48 {configuration option: "insertofftime" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -580,7 +580,7 @@ test spinbox-1.49 {configuration option: "insertontime"} -setup { .e cget -insertontime } -cleanup { destroy .e -} -result {100} +} -result 100 test spinbox-1.50 {configuration option: "insertontime" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -692,7 +692,7 @@ test spinbox-1.59 {configuration option: "repeatdelay"} -setup { .e cget -repeatdelay } -cleanup { destroy .e -} -result {500} +} -result 500 test spinbox-1.60 {configuration option: "repeatdelay" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -758,7 +758,7 @@ test spinbox-1.65 {configuration option: "selectborderwidth"} -setup { .e cget -selectborderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.66 {configuration option: "selectborderwidth" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -938,7 +938,7 @@ test spinbox-1.81 {configuration option: "width"} -setup { .e cget -width } -cleanup { destroy .e -} -result {402} +} -result 402 test spinbox-1.82 {configuration option: "width" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -960,7 +960,7 @@ test spinbox-1.83 {configuration option: "wrap"} -setup { .e cget -wrap } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.84 {configuration option: "wrap" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -1018,7 +1018,7 @@ test spinbox-2.5 {Tk_SpinboxCmd procedure} -body { test spinbox-3.1 {SpinboxWidgetCmd procedure} -setup { - spinbox .e + spinbox .e pack .e update } -body { @@ -1027,7 +1027,7 @@ test spinbox-3.1 {SpinboxWidgetCmd procedure} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e option ?arg ...?"} test spinbox-3.2 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1036,7 +1036,7 @@ test spinbox-3.2 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test spinbox-3.3 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1045,7 +1045,7 @@ test spinbox-3.3 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test spinbox-3.4 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e + spinbox .e pack .e update } -body { @@ -1054,7 +1054,7 @@ test spinbox-3.4 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { destroy .e } -returnCodes error -result {bad spinbox index "bogus"} test spinbox-3.5 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1063,7 +1063,7 @@ test spinbox-3.5 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { destroy .e } -result [list 5 5 0 $cy] -# Oryginaly the result was count using measurements +# Oryginaly the result was count using measurements # and metrics. It was changed to less verbose solution - the result is the one # that passes fonts constraint (this concerns tests 3.6, 3.7, 3.8, 3.10) test spinbox-3.6 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { @@ -1082,7 +1082,7 @@ test spinbox-3.6 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint test spinbox-3.7 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1095,7 +1095,7 @@ test spinbox-3.7 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint test spinbox-3.8 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1106,7 +1106,7 @@ test spinbox-3.8 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint destroy .e } -result {31 5 7 13} test spinbox-3.9 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1118,7 +1118,7 @@ test spinbox-3.9 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { test spinbox-3.10 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1128,82 +1128,82 @@ test spinbox-3.10 {SpinboxWidgetCmd procedure, "bbox" widget command} -constrain destroy .e } -result {{5 5 7 13} {12 5 7 13} {75 5 12 13} {122 5 7 13}} test spinbox-3.11 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { - spinbox .e + spinbox .e } -body { .e cget } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e cget option"} test spinbox-3.12 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { - spinbox .e + spinbox .e } -body { .e cget a b } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e cget option"} test spinbox-3.13 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { - spinbox .e + spinbox .e } -body { .e cget -gorp } -cleanup { destroy .e } -returnCodes error -result {unknown option "-gorp"} test spinbox-3.14 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { - spinbox .e + spinbox .e } -body { .e configure -bd 4 .e cget -bd } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-3.15 {SpinboxWidgetCmd procedure, "configure" widget command} -setup { - spinbox .e + spinbox .e pack .e update } -body { llength [.e configure] } -cleanup { destroy .e -} -result {49} +} -result 49 test spinbox-3.16 {SpinboxWidgetCmd procedure, "configure" widget command} -setup { - spinbox .e + spinbox .e } -body { .e configure -foo } -cleanup { destroy .e } -returnCodes error -result {unknown option "-foo"} test spinbox-3.17 {SpinboxWidgetCmd procedure, "configure" widget command} -setup { - spinbox .e + spinbox .e } -body { .e configure -bd 4 .e configure -bg #ffffff lindex [.e configure -bd] 4 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-3.18 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e delete } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e delete firstIndex ?lastIndex?"} test spinbox-3.19 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e delete a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e delete firstIndex ?lastIndex?"} test spinbox-3.20 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e delete foo } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "foo"} test spinbox-3.21 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e delete 0 bar } -cleanup { @@ -1212,27 +1212,27 @@ test spinbox-3.21 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { test spinbox-3.22 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e delete 2 4 .e get } -cleanup { destroy .e -} -result {014567890} +} -result 014567890 test spinbox-3.23 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert end "01234567890" .e delete 6 .e get } -cleanup { destroy .e -} -result {0123457890} +} -result 0123457890 test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update set x {} } -body { # UTF @@ -1253,18 +1253,18 @@ test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { test spinbox-3.25 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e delete 6 5 .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.26 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e configure -state disabled @@ -1273,11 +1273,11 @@ test spinbox-3.26 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.26.1 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e configure -state readonly @@ -1286,53 +1286,53 @@ test spinbox-3.26.1 {SpinboxWidgetCmd procedure, "delete" widget command} -setup .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.27 {SpinboxWidgetCmd procedure, "get" widget command} -setup { - spinbox .e + spinbox .e } -body { .e get foo } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e get"} test spinbox-3.28 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup { - spinbox .e + spinbox .e } -body { .e icursor } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e icursor pos"} test spinbox-3.29 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup { - spinbox .e + spinbox .e } -body { .e icursor foo } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "foo"} test spinbox-3.30 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert end "01234567890" .e icursor 4 .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-3.31 {SpinboxWidgetCmd procedure, "index" widget command} -setup { - spinbox .e + spinbox .e } -body { .e in } -cleanup { destroy .e } -returnCodes error -result {ambiguous option "in": must be bbox, cget, configure, delete, get, icursor, identify, index, insert, invoke, scan, selection, set, validate, or xview} test spinbox-3.32 {SpinboxWidgetCmd procedure, "index" widget command} -setup { - spinbox .e + spinbox .e } -body { .e index } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e index string"} test spinbox-3.33 {SpinboxWidgetCmd procedure, "index" widget command} -setup { - spinbox .e + spinbox .e } -body { .e index foo } -cleanup { @@ -1341,7 +1341,7 @@ test spinbox-3.33 {SpinboxWidgetCmd procedure, "index" widget command} -setup { test spinbox-3.34 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e pack .e - update + update } -body { .e index 0 } -cleanup { @@ -1350,7 +1350,7 @@ test spinbox-3.34 {SpinboxWidgetCmd procedure, "index" widget command} -setup { test spinbox-3.35 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e pack .e - update + update } -body { # UTF .e insert 0 abc\u4e4e\u0153def @@ -1359,21 +1359,21 @@ test spinbox-3.35 {SpinboxWidgetCmd procedure, "index" widget command} -setup { destroy .e } -result {3 4 8} test spinbox-3.36 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert a } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test spinbox-3.37 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test spinbox-3.38 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert foo Text } -cleanup { @@ -1382,7 +1382,7 @@ test spinbox-3.38 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { test spinbox-3.39 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e insert 3 xxx @@ -1393,7 +1393,7 @@ test spinbox-3.39 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { test spinbox-3.40 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e configure -state disabled @@ -1402,11 +1402,11 @@ test spinbox-3.40 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.40.1 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e configure -state readonly @@ -1415,16 +1415,16 @@ test spinbox-3.40.1 {SpinboxWidgetCmd procedure, "insert" widget command} -setup .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.41 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test spinbox-3.42 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { - spinbox .e + spinbox .e pack .e update } -body { @@ -1435,7 +1435,7 @@ test spinbox-3.42 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { test spinbox-3.43 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e - update + update } -body { .e scan a b c } -cleanup { @@ -1444,7 +1444,7 @@ test spinbox-3.43 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { test spinbox-3.44 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e - update + update } -body { .e scan foobar 20 } -cleanup { @@ -1453,7 +1453,7 @@ test spinbox-3.44 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { test spinbox-3.45 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e - update + update } -body { .e scan mark 20.1 } -cleanup { @@ -1464,7 +1464,7 @@ test spinbox-3.45 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { test spinbox-3.46 {SpinboxWidgetCmd procedure, "scan" widget command} -constraints { fonts } -setup { - spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1475,16 +1475,16 @@ test spinbox-3.46 {SpinboxWidgetCmd procedure, "scan" widget command} -constrain .e index @0 } -cleanup { destroy .e -} -result {2} +} -result 2 test spinbox-3.47 {SpinboxWidgetCmd procedure, "select" widget command} -setup { - spinbox .e + spinbox .e } -body { .e select } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection option ?index?"} test spinbox-3.48 {SpinboxWidgetCmd procedure, "select" widget command} -setup { - spinbox .e + spinbox .e } -body { .e select foo } -cleanup { @@ -1492,28 +1492,28 @@ test spinbox-3.48 {SpinboxWidgetCmd procedure, "select" widget command} -setup { } -returnCodes error -result {bad selection option "foo": must be adjust, clear, element, from, present, range, or to} test spinbox-3.49 {SpinboxWidgetCmd procedure, "select clear" widget command} -setup { - spinbox .e + spinbox .e } -body { .e select clear gorp } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection clear"} test spinbox-3.50 {SpinboxWidgetCmd procedure, "select clear" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert end "0123456789" .e select from 1 .e select to 4 update .e select clear - selection get + selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} test spinbox-3.50.1 {SpinboxWidgetCmd procedure, "select clear" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "0123456789" .e select from 1 @@ -1527,7 +1527,7 @@ test spinbox-3.50.1 {SpinboxWidgetCmd procedure, "select clear" widget command} } -result {.e} test spinbox-3.51 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { - spinbox .e + spinbox .e } -body { .e selection present foo } -cleanup { @@ -1536,7 +1536,7 @@ test spinbox-3.51 {SpinboxWidgetCmd procedure, "selection present" widget comman test spinbox-3.52 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end 0123456789 .e select from 3 @@ -1544,11 +1544,11 @@ test spinbox-3.52 {SpinboxWidgetCmd procedure, "selection present" widget comman .e selection present } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-3.53 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end 0123456789 .e select from 3 @@ -1557,11 +1557,11 @@ test spinbox-3.53 {SpinboxWidgetCmd procedure, "selection present" widget comman .e selection present } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-3.54 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end 0123456789 .e select from 3 @@ -1570,7 +1570,7 @@ test spinbox-3.54 {SpinboxWidgetCmd procedure, "selection present" widget comman .e selection present } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-3.55 {SpinboxWidgetCmd procedure, "selection adjust" widget command} -setup { spinbox .e } -body { @@ -1598,7 +1598,7 @@ test spinbox-3.57 {SpinboxWidgetCmd procedure, "selection adjust" widget command selection get } -cleanup { destroy .e -} -result {123} +} -result 123 test spinbox-3.58 {SpinboxWidgetCmd procedure, "selection adjust" widget command} -setup { spinbox .e pack .e @@ -1612,7 +1612,7 @@ test spinbox-3.58 {SpinboxWidgetCmd procedure, "selection adjust" widget command selection get } -cleanup { destroy .e -} -result {234} +} -result 234 test spinbox-3.59 {SpinboxWidgetCmd procedure, "selection from" widget command} -setup { spinbox .e } -body { @@ -1700,7 +1700,7 @@ test spinbox-3.64.2 {SpinboxWidgetCmd procedure, "selection" widget command} -se } -result {2 4} test spinbox-3.65 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1712,7 +1712,7 @@ test spinbox-3.65 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.053763 0.268817} test spinbox-3.66 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1721,7 +1721,7 @@ test spinbox-3.66 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {bad spinbox index "gorp"} test spinbox-3.67 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1735,7 +1735,7 @@ test spinbox-3.67 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.107527 0.322581} test spinbox-3.68 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1744,7 +1744,7 @@ test spinbox-3.68 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview moveto fraction"} test spinbox-3.69 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1753,7 +1753,7 @@ test spinbox-3.69 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {expected floating-point number but got "foo"} test spinbox-3.70 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1765,7 +1765,7 @@ test spinbox-3.70 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.505376 0.720430} test spinbox-3.71 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1776,7 +1776,7 @@ test spinbox-3.71 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview scroll number units|pages"} test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1787,7 +1787,7 @@ test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {expected integer but got "gorp"} test spinbox-3.73 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1800,7 +1800,7 @@ test spinbox-3.73 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.193548 0.408602} test spinbox-3.74 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1814,7 +1814,7 @@ test spinbox-3.74 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.397849 0.612903} test spinbox-3.75 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1822,13 +1822,13 @@ test spinbox-3.75 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { update .e xview 30 update - .e xview scroll 2 units + .e xview scroll 2 units .e index @0 } -cleanup { destroy .e -} -result {32} +} -result 32 test spinbox-3.76 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1836,13 +1836,13 @@ test spinbox-3.76 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { update .e xview 30 update - .e xview scroll -1 units + .e xview scroll -1 units .e index @0 } -cleanup { destroy .e -} -result {29} +} -result 29 test spinbox-3.77 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1853,7 +1853,7 @@ test spinbox-3.77 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {bad argument "foobars": must be units or pages} test spinbox-3.78 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1864,7 +1864,7 @@ test spinbox-3.78 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {unknown option "eat": must be moveto or scroll} test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1872,13 +1872,13 @@ test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { .e insert end "runs off the end of the window quite a bit." .e xview 0 update - .e xview -4 + .e xview -1 .e index @0 } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1888,9 +1888,9 @@ test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { .e index @0 } -cleanup { destroy .e -} -result {73} +} -result 73 test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1912,7 +1912,7 @@ test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { } -result {0.095745 0.106383 0.117021} test spinbox-3.82 {SpinboxWidgetCmd procedure} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1927,7 +1927,7 @@ test spinbox-5.1 {ConfigureSpinbox procedure, -textvariable} -body { .e get } -cleanup { destroy .e -} -result {12345} +} -result 12345 test spinbox-5.2 {ConfigureSpinbox procedure, -textvariable} -body { set x 12345 spinbox .e -textvariable x @@ -1983,14 +1983,14 @@ test spinbox-5.5 {ConfigureSpinbox procedure} -setup { destroy .e1 .e2 } -result {{This is so} {This is so} 1234} test spinbox-5.6 {ConfigureSpinbox procedure} -setup { - spinbox .e + spinbox .e pack .e } -body { .e insert end "0123456789" .e select from 1 .e select to 5 .e configure -exportselection 0 - selection get + selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} @@ -2002,14 +2002,14 @@ test spinbox-5.6.1 {ConfigureSpinbox procedure} -setup { .e select from 1 .e select to 5 .e configure -exportselection 0 - catch {selection get} + catch {selection get} list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 5} test spinbox-5.7 {ConfigureSpinbox procedure} -setup { - spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -width 4 -xscrollcommand scroll @@ -2027,7 +2027,7 @@ test spinbox-5.7 {ConfigureSpinbox procedure} -setup { test spinbox-5.8 {ConfigureSpinbox procedure} -constraints { fonts } -setup { - spinbox .e -borderwidth 2 -highlightthickness 2 + spinbox .e -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -width 0 -font {Helvetica -12} @@ -2082,7 +2082,7 @@ test spinbox-5.11 {ConfigureSpinbox procedure} -setup { test spinbox-6.1 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { - spinbox .e + spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 -highlightthickness 3 @@ -2095,7 +2095,7 @@ test spinbox-6.1 {SpinboxComputeGeometry procedure} -constraints { test spinbox-6.2 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { - spinbox .e + spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 -justify center \ @@ -2109,7 +2109,7 @@ test spinbox-6.2 {SpinboxComputeGeometry procedure} -constraints { test spinbox-6.3 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { - spinbox .e + spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 -justify right \ @@ -2121,7 +2121,7 @@ test spinbox-6.3 {SpinboxComputeGeometry procedure} -constraints { destroy .e } -result {3 4} test spinbox-6.4 {SpinboxComputeGeometry procedure} -setup { - spinbox .e + spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 5 @@ -2131,26 +2131,26 @@ test spinbox-6.4 {SpinboxComputeGeometry procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {6} +} -result 6 test spinbox-6.5 {SpinboxComputeGeometry procedure} -setup { spinbox .e -highlightthickness 2 pack .e } -body { - .e configure -font {Courier -12} -bd 2 -relief raised -width 5 + .e configure -font {Courier -12} -bd 2 -relief raised -width 5 .e insert end "01234567890" update .e xview 7 .e index @0 } -cleanup { destroy .e -} -result {6} +} -result 6 test spinbox-6.6 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { spinbox .e -highlightthickness 2 pack .e } -body { - .e configure -font {Courier -12} -bd 2 -relief raised -width 10 + .e configure -font {Courier -12} -bd 2 -relief raised -width 10 .e insert end "01234\t67890" update .e xview 3 @@ -2190,7 +2190,7 @@ test spinbox-6.9 {SpinboxComputeGeometry procedure} -constraints { spinbox .e -highlightthickness 2 pack .e } -body { - .e configure -font {Helvetica -24} -bd 3 -relief raised -width 0 + .e configure -font {Helvetica -24} -bd 3 -relief raised -width 0 update list [winfo reqwidth .e] [winfo reqheight .e] } -cleanup { @@ -2199,7 +2199,7 @@ test spinbox-6.9 {SpinboxComputeGeometry procedure} -constraints { test spinbox-7.1 {InsertChars procedure} -setup { - unset -nocomplain contents + unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e @@ -2217,8 +2217,8 @@ test spinbox-7.1 {InsertChars procedure} -setup { } -result {abXXXcde abXXXcde {0.000000 1.000000}} test spinbox-7.2 {InsertChars procedure} -setup { - unset -nocomplain contents - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + unset -nocomplain contents + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2290,7 +2290,7 @@ test spinbox-7.6 {InsertChars procedure} -setup { destroy .e } -result {2 6 2 5} test spinbox-7.7 {InsertChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -xscrollcommand scroll @@ -2300,9 +2300,9 @@ test spinbox-7.7 {InsertChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {7} +} -result 7 test spinbox-7.8 {InsertChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 0123456789 @@ -2311,9 +2311,9 @@ test spinbox-7.8 {InsertChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-7.9 {InsertChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "This is a very long string" @@ -2323,9 +2323,9 @@ test spinbox-7.9 {InsertChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {7} +} -result 7 test spinbox-7.10 {InsertChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "This is a very long string" @@ -2335,12 +2335,12 @@ test spinbox-7.10 {InsertChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-7.11 {InsertChars procedure} -constraints { fonts } -setup { - spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "xyzzy" @@ -2349,11 +2349,11 @@ test spinbox-7.11 {InsertChars procedure} -constraints { winfo reqwidth .e } -cleanup { destroy .e -} -result {70} +} -result 70 test spinbox-8.1 {DeleteChars procedure} -setup { - unset -nocomplain contents - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + unset -nocomplain contents + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2369,8 +2369,8 @@ test spinbox-8.1 {DeleteChars procedure} -setup { after cancel $timeout } -result {abe abe {0.000000 1.000000}} test spinbox-8.2 {DeleteChars procedure} -setup { - unset -nocomplain contents - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + unset -nocomplain contents + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2378,7 +2378,7 @@ test spinbox-8.2 {DeleteChars procedure} -setup { .e insert 0 abcde update idletasks set timeout [after 500 {set scrollInfo {-1000000 -1000000}}] - .e delete -2 2 + .e delete -1 2 vwait scrollInfo list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { @@ -2386,8 +2386,8 @@ test spinbox-8.2 {DeleteChars procedure} -setup { after cancel $timeout } -result {cde cde {0.000000 1.000000}} test spinbox-8.3 {DeleteChars procedure} -setup { - unset -nocomplain contents - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + unset -nocomplain contents + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2403,7 +2403,7 @@ test spinbox-8.3 {DeleteChars procedure} -setup { after cancel $timeout } -result {abc abc {0.000000 1.000000}} test spinbox-8.4 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2419,7 +2419,7 @@ test spinbox-8.4 {DeleteChars procedure} -setup { destroy .e } -result {1 6 1 5} test spinbox-8.5 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2435,7 +2435,7 @@ test spinbox-8.5 {DeleteChars procedure} -setup { destroy .e } -result {1 5 1 4} test spinbox-8.6 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2451,7 +2451,7 @@ test spinbox-8.6 {DeleteChars procedure} -setup { destroy .e } -result {1 2 1 5} test spinbox-8.7 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2465,7 +2465,7 @@ test spinbox-8.7 {DeleteChars procedure} -setup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test spinbox-8.8 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2481,7 +2481,7 @@ test spinbox-8.8 {DeleteChars procedure} -setup { destroy .e } -result {3 4 3 8} test spinbox-8.9 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 0123456789abcde @@ -2494,7 +2494,7 @@ test spinbox-8.9 {DeleteChars procedure} -setup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test spinbox-8.10 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2510,7 +2510,7 @@ test spinbox-8.10 {DeleteChars procedure} -setup { destroy .e } -result {3 5 5 8} test spinbox-8.11 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2526,7 +2526,7 @@ test spinbox-8.11 {DeleteChars procedure} -setup { destroy .e } -result {3 8 4 8} test spinbox-8.12 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2537,9 +2537,9 @@ test spinbox-8.12 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-8.13 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2550,9 +2550,9 @@ test spinbox-8.13 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-8.14 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2563,9 +2563,9 @@ test spinbox-8.14 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-8.15 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2576,9 +2576,9 @@ test spinbox-8.15 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-8.16 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2589,9 +2589,9 @@ test spinbox-8.16 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-8.17 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2602,9 +2602,9 @@ test spinbox-8.17 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-8.18 {DeleteChars procedure} -setup { - spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2614,7 +2614,7 @@ test spinbox-8.18 {DeleteChars procedure} -setup { winfo reqwidth .e } -cleanup { destroy .e -} -result {42} +} -result 42 test spinbox-9.1 {SpinboxValueChanged procedure} -setup { unset -nocomplain x @@ -2634,7 +2634,7 @@ test spinbox-10.1 {SpinboxSetValue procedure} -constraints fonts -body { set y ab spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 -width 0 pack .e - .e configure -textvariable x + .e configure -textvariable x .e configure -textvariable y update list [.e get] [winfo reqwidth .e] @@ -2643,7 +2643,7 @@ test spinbox-10.1 {SpinboxSetValue procedure} -constraints fonts -body { } -result {ab 35} test spinbox-10.2 {SpinboxSetValue procedure, updating selection} -setup { unset -nocomplain x - spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 + spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x @@ -2656,7 +2656,7 @@ test spinbox-10.2 {SpinboxSetValue procedure, updating selection} -setup { } -returnCodes error -result {selection isn't in widget .e} test spinbox-10.3 {SpinboxSetValue procedure, updating selection} -setup { unset -nocomplain x - spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 + spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x @@ -2669,7 +2669,7 @@ test spinbox-10.3 {SpinboxSetValue procedure, updating selection} -setup { } -result {4 7} test spinbox-10.4 {SpinboxSetValue procedure, updating selection} -setup { unset -nocomplain x - spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 + spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x @@ -2682,7 +2682,7 @@ test spinbox-10.4 {SpinboxSetValue procedure, updating selection} -setup { } -result {4 10} test spinbox-10.5 {SpinboxSetValue procedure, updating display position} -setup { unset -nocomplain x - spinbox .e -highlightthickness 2 -bd 2 + spinbox .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x @@ -2694,10 +2694,10 @@ test spinbox-10.5 {SpinboxSetValue procedure, updating display position} -setup .e index @0 } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup { unset -nocomplain x - spinbox .e -highlightthickness 2 -bd 2 + spinbox .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x @@ -2710,10 +2710,10 @@ test spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup .e index @0 } -cleanup { destroy .e -} -result {10} +} -result 10 test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup { unset -nocomplain x - spinbox .e -highlightthickness 2 -bd 2 + spinbox .e -highlightthickness 2 -bd 2 pack .e update } -body { @@ -2725,10 +2725,10 @@ test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup .e index insert } -cleanup { destroy .e -} -result {3} +} -result 3 test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup { unset -nocomplain x - spinbox .e -highlightthickness 2 -bd 2 + spinbox .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x @@ -2739,7 +2739,7 @@ test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup .e index insert } -cleanup { destroy .e -} -result {5} +} -result 5 test spinbox-11.1 {SpinboxEventProc procedure} -setup { spinbox .e -highlightthickness 2 -bd 2 -font {Helvetica -12} @@ -2783,9 +2783,9 @@ test spinbox-13.1 {GetSpinboxIndex procedure} -setup { .e index end } -cleanup { destroy .e -} -result {21} +} -result 21 test spinbox-13.2 {GetSpinboxIndex procedure} -body { - spinbox .e + spinbox .e .e index abogus } -cleanup { destroy .e @@ -2802,7 +2802,7 @@ test spinbox-13.3 {GetSpinboxIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-13.4 {GetSpinboxIndex procedure} -setup { spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e @@ -2815,7 +2815,7 @@ test spinbox-13.4 {GetSpinboxIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-13.5 {GetSpinboxIndex procedure} -setup { spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e @@ -2829,7 +2829,7 @@ test spinbox-13.5 {GetSpinboxIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {15} +} -result 15 test spinbox-13.6 {GetSpinboxIndex procedure} -setup { spinbox .e } -body { @@ -2848,7 +2848,7 @@ test spinbox-13.7 {GetSpinboxIndex procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {2} +} -result 2 test spinbox-13.8 {GetSpinboxIndex procedure} -setup { spinbox .e } -body { @@ -2871,7 +2871,7 @@ test spinbox-13.9 {GetSpinboxIndex procedure} -setup { } -result {1 6} test spinbox-13.10 {GetSpinboxIndex procedure} -constraints x11 -body { -# On unix, when selection is cleared, spinbox widget's internal +# On unix, when selection is cleared, spinbox widget's internal # selection range is reset. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken @@ -2891,7 +2891,7 @@ test spinbox-13.10 {GetSpinboxIndex procedure} -constraints x11 -body { test spinbox-13.11 {GetSpinboxIndex procedure} -constraints aquaOrWin32 -body { # On mac and pc, when selection is cleared, spinbox widget remembers -# last selected range. When selection ownership is restored to +# last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken @@ -2908,7 +2908,7 @@ test spinbox-13.11 {GetSpinboxIndex procedure} -constraints aquaOrWin32 -body { .e index sel.first } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-13.12 {GetSpinboxIndex procedure} -constraints x11 -body { # Previous settings: @@ -2963,7 +2963,7 @@ test spinbox-13.13 {GetSpinboxIndex procedure} -constraints win -body { test spinbox-13.14 {GetSpinboxIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, spinbox widget remembers -# last selected range. When selection ownership is restored to +# last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken @@ -2976,14 +2976,14 @@ test spinbox-13.14 {GetSpinboxIndex procedure} -constraints win -body { list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e - selection get + selection get } -cleanup { destroy .e } -returnCodes error -match glob -result {*} test spinbox-13.14.1 {GetSpinboxIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, spinbox widget remembers -# last selected range. When selection ownership is restored to +# last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken @@ -2995,9 +2995,9 @@ test spinbox-13.14.1 {GetSpinboxIndex procedure} -constraints win -body { .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: - selection clear .e - catch {selection get} - .e index sbogus + selection clear .e + catch {selection get} + .e index sbogus } -cleanup { destroy .e } -returnCodes error -match glob -result {*} @@ -3012,7 +3012,7 @@ test spinbox-13.15 {GetSpinboxIndex procedure} -body { test spinbox-13.16 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3020,10 +3020,10 @@ test spinbox-13.16 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @4 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-13.17 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3031,10 +3031,10 @@ test spinbox-13.17 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @11 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-13.18 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3042,10 +3042,10 @@ test spinbox-13.18 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @12 } -cleanup { destroy .e -} -result {5} +} -result 5 test spinbox-13.19 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3053,10 +3053,10 @@ test spinbox-13.19 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @[expr {[winfo width .e] - 6-11}] } -cleanup { destroy .e -} -result {8} +} -result 8 test spinbox-13.20 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3064,10 +3064,10 @@ test spinbox-13.20 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @[expr {[winfo width .e] - 5}] } -cleanup { destroy .e -} -result {9} +} -result 9 test spinbox-13.21 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3075,9 +3075,9 @@ test spinbox-13.21 {GetSpinboxIndex procedure} -body { .e index @1000 } -cleanup { destroy .e -} -result {9} +} -result 9 test spinbox-13.22 {GetSpinboxIndex procedure} -setup { - spinbox .e + spinbox .e pack .e update } -body { @@ -3087,18 +3087,18 @@ test spinbox-13.22 {GetSpinboxIndex procedure} -setup { } -returnCodes error -result {bad spinbox index "1xyz"} test spinbox-13.23 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update - .e index -10 + .e index -1 } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-13.24 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3106,10 +3106,10 @@ test spinbox-13.24 {GetSpinboxIndex procedure} -body { .e index 12 } -cleanup { destroy .e -} -result {12} +} -result 12 test spinbox-13.25 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3117,7 +3117,7 @@ test spinbox-13.25 {GetSpinboxIndex procedure} -body { .e index 49 } -cleanup { destroy .e -} -result {21} +} -result 21 # XXX Still need to write tests for SpinboxScanTo and SpinboxSelectTo. @@ -3137,13 +3137,13 @@ test spinbox-14.3 {SpinboxFetchSelection procedure} -setup { } } -body { spinbox .e - .e insert end $x + .e insert end $x .e select from 0 .e select to end string compare [selection get] $x } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-15.1 {SpinboxLostSelection} -body { spinbox .e @@ -3164,7 +3164,7 @@ test spinbox-16.1 {SpinboxVisibleRange procedure} -constraints fonts -body { spinbox .e -width 10 -font {Helvetica -12} pack .e update - .e insert 0 "............................." + .e insert 0 "............................." format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e @@ -3209,7 +3209,7 @@ test spinbox-17.3 {SpinboxUpdateScrollbar procedure} -body { update idletasks set timeout [after 500 {set scrollInfo {-1000000 -1000000}}] .e insert 0 abcdefghijklmnopqrs - .e xview + .e xview vwait scrollInfo format {%.6f %.6f} {*}$scrollInfo } -cleanup { @@ -3246,7 +3246,7 @@ test spinbox-18.1 {Spinbox widget vs hiding} -setup { set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 == $res2} -} -result {1} +} -result 1 ## ## Spinbox widget VALIDATION tests @@ -3600,7 +3600,7 @@ test spinbox-19.19 {spinbox widget validation} -setup { -background red -foreground white pack .e set ::e nextdata ;# previous settings - + .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] .e validate list [.e cget -validate] [.e get] $::vVals @@ -3625,7 +3625,7 @@ test spinbox-19.20 {spinbox widget validation} -setup { set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] ;# prev .e validate ;# previous settings - + .e configure -validate all set ::e testdata list [.e cget -validate] [.e get] $::e $::vVals @@ -3807,7 +3807,7 @@ test spinbox-22.1 {spinbox config, -from changes SF bug 559078} -body { set val } -cleanup { destroy .e -} -result {5} +} -result 5 test spinbox-22.2 {spinbox config, -from changes SF bug 559078} -body { set val 5 spinbox .e -from 1 -to 10 -textvariable val @@ -3815,7 +3815,7 @@ test spinbox-22.2 {spinbox config, -from changes SF bug 559078} -body { set val } -cleanup { destroy .e -} -result {5} +} -result 5 test spinbox-22.3 {spinbox config, -from changes SF bug 559078} -body { set val 5 spinbox .e -from 3 -to 10 -textvariable val @@ -3823,7 +3823,7 @@ test spinbox-22.3 {spinbox config, -from changes SF bug 559078} -body { set val } -cleanup { destroy .e -} -result {6} +} -result 6 test spinbox-23.1 {selection present while disabled, bug 637828} -body { spinbox .e diff --git a/tests/textDisp.test b/tests/textDisp.test index 0881102..44297a0 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test @@ -612,7 +612,7 @@ if {$tcl_platform(platform) == "windows"} { test textDisp-4.6 {UpdateDisplayInfo, tiny window} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size - # requested. The "overrideredirect" gets rid of the titlebar so + # requested. The "overrideredirect" gets rid of the titlebar so # the toplevel can shrink to the appropriate size. On Unix, setting # the overrideredirect on "." confuses the window manager and # causes subsequent tests to fail. @@ -644,7 +644,7 @@ set hlth [.t cget -highlightthickness] test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size - # requested. The "overrideredirect" gets rid of the titlebar so + # requested. The "overrideredirect" gets rid of the titlebar so # the toplevel can shrink to the appropriate size. On Unix, setting # the overrideredirect on "." confuses the window manager and # causes subsequent tests to fail. @@ -1912,7 +1912,7 @@ test textDisp-14.14 {TkTextXviewCmd procedure} { .t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n" .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto 0 - .t xview scroll 21 u + .t xview scroll 21 u set x [.t index @0,22] .t xview scroll -1 u lappend x [.t index @0,22] @@ -2369,7 +2369,7 @@ test textDisp-17.8 {TkTextScanCmd procedure} {textfonts} { .t xview moveto 0 .t scan mark 0 60 .t scan dragto 30 100 - .t scan dragto 25 95 + .t scan dragto 25 95 .t index @0,0 } {4.7} test textDisp-17.9 {TkTextScanCmd procedure} {textfonts} { @@ -2931,7 +2931,7 @@ test textDisp-20.1 {FindDLine} { list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \ [.t dlineinfo 58.0] } [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] -test textDisp-20.2 {FindDLine} { +test textDisp-20.2 {FindDLine} { .t yview 100.0 .t yview -pickplace 53.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21] @@ -2980,7 +2980,7 @@ test textDisp-21.4 {count -displaylines regression} { Use the Up (cursor) key to scroll up one line at a time. At the second press, the cursor either gets locked or jumps several lines. Connect with Tkcon. The command -.u count -displaylines \ +.u count -displaylines \ 3.10 2.173 should give answer -1; it gives me 5. @@ -3884,7 +3884,7 @@ test textDisp-29.2.5 {miscellaneous: can show last character} { set iWidth [lindex [.t2.t bbox end-2c] 2] .t2.t xview scroll 2 units set iWidth2 [lindex [.t2.t bbox end-2c] 2] - + if {($iWidth == $iWidth2) && $iWidth >= 2} { set result "correct" } else { diff --git a/tests/textIndex.test b/tests/textIndex.test index 612ade1..bd4e955 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test @@ -17,7 +17,7 @@ pack .t -expand 1 -fill both update .t debug on wm geometry . {} - + # The statements below reset the main window; it's needed if the window # manager is mwm to make mwm forget about a previous minimum size setting. @@ -74,7 +74,7 @@ test textIndex-1.9 {TkTextMakeByteIndex: shortcut for 0} {testtext} { testtext .t byteindex 3 80 } {3.5 5} test textIndex-1.10 {TkTextMakeByteIndex: verify index is in range} {testtext} { - # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) + # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) # one segment testtext .t byteindex 3 5 @@ -84,7 +84,7 @@ test textIndex-1.11 {TkTextMakeByteIndex: verify index is in range} {testtext} { # index += segPtr->size # Multiple segments, make sure add segment size to index. - .t mark set foo 3.2 + .t mark set foo 3.2 set x [testtext .t byteindex 3 7] .t mark unset foo set x @@ -117,7 +117,7 @@ test textIndex-1.16 {TkTextMakeByteIndex: UTF-8 characters} {testtext} { } {5.18 20} test textIndex-1.17 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \ {testtext} { - # ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) + # ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) # Wrong answer would be \xb9 (the 2nd byte of UTF rep of 0x4e4f). set x [testtext .t byteindex 5 2] @@ -125,7 +125,7 @@ test textIndex-1.17 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \ } {{5.2 4} y} test textIndex-1.18 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \ {testtext} { - # ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) + # ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) testtext .t byteindex 5 1 .t get insert } "\u4e4f" @@ -168,7 +168,7 @@ test textIndex-2.9 {TkTextMakeCharIndex: verify index is in range} { # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) # Multiple segments, make sure add segment size to index. - .t mark set foo 3.2 + .t mark set foo 3.2 set x [.t index 3.7] .t mark unset foo set x @@ -439,7 +439,7 @@ test textIndex-12.5 {TkTextIndexForwChars: find index} { test textIndex-12.6 {TkTextIndexForwChars: find index} { # for ( ; segPtr != NULL; segPtr = segPtr->nextPtr) # border condition: segPtr == NULL -> beginning of next line - + .t index {2.3 + 11 chars} } 3.0 test textIndex-12.7 {TkTextIndexForwChars: find index} { @@ -458,7 +458,7 @@ test textIndex-12.9 {TkTextIndexForwChars: find index} { .t image create 2.4 -image textimage set x [.t get {2.3 + 3 chars}] .t delete 2.4 - set x + set x } "f" test textIndex-12.10 {TkTextIndexForwChars: find index} { # dstPtr->byteIndex += segPtr->size - byteOffset @@ -588,11 +588,11 @@ test textIndex-14.11 {TkTextIndexBackChars: move to previous segment} { set x } 2.9 test textIndex-14.12 {TkTextIndexBackChars: move to previous line} { - # (lineIndex == 0) + # (lineIndex == 0) .t index {1.5 - 10 chars} } 1.0 test textIndex-14.13 {TkTextIndexBackChars: move to previous line} { - # not (lineIndex == 0) + # not (lineIndex == 0) .t index {2.5 - 10 chars} } 1.2 test textIndex-14.14 {TkTextIndexBackChars: move to previous line} { @@ -812,7 +812,7 @@ test textIndex-19.12.2 {Display lines} { } {1} test textIndex-19.13 {Display lines} { - destroy {*}[pack slaves .] + destroy {*}[pack content .] text .txt -height 1 -wrap word -yscroll ".sbar set" -width 400 scrollbar .sbar -command ".txt yview" grid .txt .sbar -sticky news diff --git a/tests/textWind.test b/tests/textWind.test index 8edd825..f2b5703 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -582,7 +582,7 @@ test textWind-6.1 {EmbWinRequestProc procedure} -setup { [list [expr {$padx+2*$fixedWidth+25}] [expr {$pady+((30-$fixedHeight)/2)}] $fixedWidth $fixedHeight]] -test textWind-7.1 {EmbWinLostSlaveProc procedure} -setup { +test textWind-7.1 {EmbWinLostContentProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -599,7 +599,7 @@ test textWind-7.1 {EmbWinLostSlaveProc procedure} -setup { 10x20+[expr {$padx+100}]+[expr {$pady+50}] \ [list [expr {$padx+2*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] -test textWind-7.2 {EmbWinLostSlaveProc procedure} -setup { +test textWind-7.2 {EmbWinLostContentProc procedure} -setup { .t delete 1.0 end destroy .t.f } -body { @@ -773,7 +773,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup .t delete 1.0 end proc bgerror args { global msg - if {[lsearch -exact $msg $args] == -1} { + if {[lsearch -exact $msg $args] < 0} { lappend msg $args } } @@ -860,7 +860,7 @@ test textWind-10.10 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { } -body { .t configure -wrap char .t insert 1.0 "Some sample text" - frame .f -width 125 -height 20 -bg $color -bd 2 -relief raised + frame .f -width [expr {($tWidth-12)*$fixedWidth-1}] -height 20 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f list [.t bbox .f] [.t bbox 1.13] } -cleanup { @@ -875,7 +875,7 @@ test textWind-10.11 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { } -body { .t configure -wrap char .t insert 1.0 "Some sample text" - frame .f -width 126 -height 20 -bg $color -bd 2 -relief raised + frame .f -width [expr {($tWidth-12)*$fixedWidth}] -height 20 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f update list [.t bbox .f] [.t bbox 1.13] @@ -891,15 +891,15 @@ test textWind-10.12 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { } -body { .t configure -wrap char .t insert 1.0 "Some sample text" - frame .f -width 127 -height 20 -bg $color -bd 2 -relief raised + frame .f -width [expr {($tWidth-12)*$fixedWidth+1}] -height 20 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f update list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f } -result [list \ - [list $padx [expr {$pady+$fixedHeight}] 127 20] \ - [list [expr {$padx+127}] [expr {$pady+$fixedHeight+((20-$fixedHeight)/2)}] $fixedWidth $fixedHeight]] + [list $padx [expr {$pady+$fixedHeight}] [expr {($tWidth-12)*$fixedWidth+1}] 20] \ + [list [expr {$padx+($tWidth-12)*$fixedWidth+1}] [expr {$pady+$fixedHeight+((20-$fixedHeight)/2)}] $fixedWidth $fixedHeight]] test textWind-10.13 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end @@ -907,7 +907,7 @@ test textWind-10.13 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { } -body { .t configure -wrap none .t insert 1.0 "Some sample text" - frame .f -width 130 -height 20 -bg $color -bd 2 -relief raised + frame .f -width [expr {($tWidth-12)*$fixedWidth+5}] -height 20 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f update list [.t bbox .f] [.t bbox 1.13] @@ -923,7 +923,7 @@ test textWind-10.14 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { } -body { .t configure -wrap none .t insert 1.0 "Some sample text" - frame .f -width 130 -height 220 -bg $color -bd 2 -relief raised + frame .f -width [expr {($tWidth-12)*$fixedWidth+5}] -height 220 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f update list [.t bbox .f] [.t bbox 1.13] diff --git a/tests/tk.test b/tests/tk.test index 748a6cf..30a36d9 100644 --- a/tests/tk.test +++ b/tests/tk.test @@ -157,7 +157,7 @@ test tk-6.5 {tk inactive} -body { update after 100 set i [tk inactive] - expr {$i == -1 || ( $i > 90 && $i < 200 )} + expr {$i < 0 || ( $i > 90 && $i < 200 )} } -result 1 test tk-7.1 {tk inactive in a safe interpreter} -body { diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl index f03cd56..a75172f 100644 --- a/tests/ttk/all.tcl +++ b/tests/ttk/all.tcl @@ -16,5 +16,5 @@ tcltest::configure -testdir [file normalize [file dirname [info script]]] tcltest::configure -loadfile \ [file join [file dirname [tcltest::testsDirectory]] constraints.tcl] tcltest::configure -singleproc 1 -tcltest::runAllTests - +set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)] +if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1} diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test index 15d365f..8b8c9b7 100644 --- a/tests/ttk/checkbutton.test +++ b/tests/ttk/checkbutton.test @@ -3,7 +3,8 @@ # package require Tk -package require tcltest ; namespace import -force tcltest::* +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test checkbutton-1.1 "Checkbutton check" -body { diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index 45fe0fc..ef77adb 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -2,8 +2,9 @@ # ttk::combobox widget tests # -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test combobox-1.0 "Combobox tests -- setup" -body { @@ -38,18 +39,18 @@ test combobox-2.3 "current -- change value" -body { .cb current } -result 1 -test combobox-2.4 "current -- value not in list" -body { +test combobox-2.4 "current -- value not in list" -body { .cb set "z" .cb current } -result -1 -test combobox-2.5 "current -- set to end index" -body { +test combobox-2.5 "current -- set to end index" -body { .cb configure -values [list a b c d e thelastone] .cb current end .cb get } -result thelastone -test combobox-2.6 "current -- set to unknown index" -body { +test combobox-2.6 "current -- set to unknown index" -body { .cb configure -values [list a b c d e] .cb current notanindex } -returnCodes error -result {Incorrect index notanindex} @@ -58,7 +59,7 @@ test combobox-2.end "Cleanup" -body { destroy .cb } test combobox-3 "Read postoffset value dynamically from current style" -body { ttk::combobox .cb -values [list a b c] -style "DerivedStyle.TCombobox" - pack .cb -expand true -fill both + pack .cb -expand true -fill both ttk::style configure DerivedStyle.TCombobox -postoffset [list 25 0 0 0] ttk::combobox::Post .cb expr {[winfo rootx .cb.popdown] - [winfo rootx .cb]} diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 2e5f43c..6524d71 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -2,8 +2,9 @@ # Tile package: entry widget tests # -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands variable scrollInfo @@ -84,7 +85,7 @@ test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body { -expand false -fill x update ; # no error lappend res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update -} -result {1} -cleanup {destroy .te .tsb} +} -result 1 -cleanup {destroy .te .tsb} test entry-2.2 "Initial scroll position" -body { ttk::entry .e -font fixed -width 5 -xscrollcommand scroll @@ -128,28 +129,28 @@ test entry-3.3 "xview" -body { .e insert end abcdefghijklmnopqrstuvwxyz .e xview end set result [.e index @0] -} -result {7} +} -result 7 test entry-3.4 "xview" -body { .e delete 0 end; .e insert end abcdefghijklmnopqrstuvwxyz .e xview moveto 1.0 set result [.e index @0] -} -result {7} +} -result 7 test entry-3.5 "xview" -body { .e delete 0 end; .e insert end abcdefghijklmnopqrstuvwxyz .e xview scroll 5 units set result [.e index @0] -} -result {5} +} -result 5 test entry-3.6 "xview" -body { .e delete 0 end; .e insert end [string repeat abcdefghijklmnopqrstuvwxyz 5] .e xview scroll 2 pages set result [.e index @0] -} -result {40} +} -result 40 test entry-3.last "Series 3 cleanup" -body { destroy .e diff --git a/tests/ttk/image.test b/tests/ttk/image.test index a55f7f8..ea0ab1d 100644 --- a/tests/ttk/image.test +++ b/tests/ttk/image.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test image-1.1 "Bad image element" -body { @@ -23,7 +24,7 @@ test image-2.0 "Deletion of displayed image (label)" -setup { } -cleanup { destroy .ttk_image20 } -result {} - + test image-2.1 "Deletion of displayed image (checkbutton)" -setup { image create photo test.image -width 10 -height 10 } -body { diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test index 28b4d2e..1f64d67 100644 --- a/tests/ttk/labelframe.test +++ b/tests/ttk/labelframe.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test labelframe-1.0 "Setup" -body { @@ -31,49 +32,49 @@ test labelframe-2.4 "Can't use nonexistent-windows as -labelwidget" -body { ### # See also series labelframe-4.x # -test labelframe-3.1 "Add child slave" -body { +test labelframe-3.1 "Add child content" -body { checkbutton .lf.cb -text "abcde" .lf configure -labelwidget .lf.cb list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] } -result [list 1 labelframe] -test labelframe-3.2 "Remove child slave" -body { +test labelframe-3.2 "Remove child content" -body { .lf configure -labelwidget {} list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] } -result [list 0 {}] -test labelframe-3.3 "Re-add child slave" -body { +test labelframe-3.3 "Re-add child content" -body { .lf configure -labelwidget .lf.cb list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] } -result [list 1 labelframe] -test labelframe-3.4 "Re-manage child slave" -body { +test labelframe-3.4 "Re-manage child content" -body { pack .lf.cb -side right list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] [.lf cget -labelwidget] } -result [list 1 pack {}] -test labelframe-3.5 "Re-add child slave" -body { +test labelframe-3.5 "Re-add child content" -body { .lf configure -labelwidget .lf.cb list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] } -result [list 1 labelframe] -test labelframe-3.6 "Destroy child slave" -body { +test labelframe-3.6 "Destroy child content" -body { destroy .lf.cb .lf cget -labelwidget } -result {} ### -# Re-run series labelframe-3.x with nonchild slaves. +# Re-run series labelframe-3.x with nonchild content. # # @@@ ODDITY, 14 Nov 2005: # @@@ labelframe-4.1 fails if .cb is a [checkbutton], # @@@ but seems to succeed if it's some other widget class. # @@@ I suspect a race condition; unable to track it down ATM. # -# @@@ FOLLOWUP: This *may* have been caused by a bug in ManagerIdleProc +# @@@ FOLLOWUP: This *may* have been caused by a bug in ManagerIdleProc # @@@ (see manager.c r1.11). There's still probably a race condition in here. # -test labelframe-4.1 "Add nonchild slave" -body { +test labelframe-4.1 "Add nonchild content" -body { checkbutton .cb -text "abcde" .lf configure -labelwidget .cb update @@ -81,32 +82,32 @@ test labelframe-4.1 "Add nonchild slave" -body { } -result [list 1 1 labelframe] -test labelframe-4.2 "Remove nonchild slave" -body { +test labelframe-4.2 "Remove nonchild content" -body { .lf configure -labelwidget {} update; list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb] } -result [list 0 0 {}] -test labelframe-4.3 "Re-add nonchild slave" -body { +test labelframe-4.3 "Re-add nonchild content" -body { .lf configure -labelwidget .cb list [update; winfo viewable .cb] [winfo manager .cb] } -result [list 1 labelframe] -test labelframe-4.4 "Re-manage nonchild slave" -body { +test labelframe-4.4 "Re-manage nonchild content" -body { pack .cb -side right list [update; winfo viewable .cb] \ [winfo manager .cb] \ [.lf cget -labelwidget] } -result [list 1 pack {}] -test labelframe-4.5 "Re-add nonchild slave" -body { +test labelframe-4.5 "Re-add nonchild content" -body { .lf configure -labelwidget .cb list [update; winfo viewable .cb] \ [winfo manager .cb] \ [.lf cget -labelwidget] } -result [list 1 labelframe .cb] -test labelframe-4.6 "Destroy nonchild slave" -body { +test labelframe-4.6 "Destroy nonchild content" -body { destroy .cb .lf cget -labelwidget } -result {} diff --git a/tests/ttk/layout.test b/tests/ttk/layout.test index 52f44b4..5dfce9b 100644 --- a/tests/ttk/layout.test +++ b/tests/ttk/layout.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test layout-1.1 "Size computations for mixed-orientation layouts" -body { diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test index ac63088..fbab6bd 100644 --- a/tests/ttk/notebook.test +++ b/tests/ttk/notebook.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test notebook-1.0 "Setup" -body { diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test index 7fe5c87..9d3cf77 100644 --- a/tests/ttk/panedwindow.test +++ b/tests/ttk/panedwindow.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands proc propagate-geometry {} { update idletasks } @@ -110,8 +111,8 @@ test panedwindow-2.end "Cleanup" -body { destroy .pw } # test panedwindow-3.0 "configure pane" -body { ttk::panedwindow .pw - .pw add [listbox .pw.lb1] - .pw add [listbox .pw.lb2] + .pw add [listbox .pw.lb1] + .pw add [listbox .pw.lb2] .pw pane 1 -weight 2 .pw pane 1 -weight } -result 2 @@ -253,7 +254,7 @@ test paned-propagation-setup "Setup." -body { frame .pw.f2 -width 100 -height 50 list [winfo reqwidth .pw.f1] [winfo reqheight .pw.f1] -} -result [list 100 50] +} -result [list 100 50] test paned-propagation-1 "Initial request size" -body { .pw add .pw.f1 @@ -262,7 +263,7 @@ test paned-propagation-1 "Initial request size" -body { list [winfo reqwidth .pw] [winfo reqheight .pw] } -result [list 100 105] -test paned-propagation-2 "Slave change before map" -body { +test paned-propagation-2 "Pane change before map" -body { .pw.f1 configure -width 200 -height 100 propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] @@ -274,13 +275,13 @@ test paned-propagation-3 "Map window" -body { list [winfo width .pw] [winfo height .pw] [.pw sashpos 0] } -result [list 200 155 100] -test paned-propagation-4 "Slave change after map, off-axis" -body { +test paned-propagation-4 "Pane change after map, off-axis" -body { .pw.f1 configure -width 100 ;# should be granted propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0] } -result [list 100 155 100] -test paned-propagation-5 "Slave change after map, on-axis" -body { +test paned-propagation-5 "Pane change after map, on-axis" -body { .pw.f1 configure -height 50 ;# should be denied propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0] diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test index b9add86..abdb55a 100644 --- a/tests/ttk/progressbar.test +++ b/tests/ttk/progressbar.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test index ba02954..09abcb8 100644 --- a/tests/ttk/radiobutton.test +++ b/tests/ttk/radiobutton.test @@ -3,7 +3,8 @@ # package require Tk -package require tcltest ; namespace import -force tcltest::* +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test radiobutton-1.1 "Radiobutton check" -body { diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test index 903328e..3c10853 100644 --- a/tests/ttk/scrollbar.test +++ b/tests/ttk/scrollbar.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}] @@ -18,8 +19,8 @@ test scrollbar-swapout-1 "Don't use core scrollbars on OSX..." \ } -body { ttk::scrollbar .sb -command "yadda" list [winfo class .sb] [.sb cget -command] -} -result [list TScrollbar yadda] -cleanup { - destroy .sb +} -result [list TScrollbar yadda] -cleanup { + destroy .sb } test scrollbar-swapout-2 "... regardless of whether -style ..." \ @@ -28,7 +29,7 @@ test scrollbar-swapout-2 "... regardless of whether -style ..." \ } -body { ttk::style layout Vertical.Custom.TScrollbar \ [ttk::style layout Vertical.TScrollbar] ; # See #1833339 - ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar + ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar list [winfo class .sb] [.sb cget -command] [.sb cget -style] } -result [list TScrollbar yadda Custom.TScrollbar] -cleanup { destroy .sb @@ -37,7 +38,7 @@ test scrollbar-swapout-2 "... regardless of whether -style ..." \ test scrollbar-swapout-3 "... or -class is specified." -constraints { coreScrollbar } -body { - ttk::scrollbar .sb -command "yadda" -class Custom.TScrollbar + ttk::scrollbar .sb -command "yadda" -class Custom.TScrollbar list [winfo class .sb] [.sb cget -command] } -result [list Custom.TScrollbar yadda] -cleanup { destroy .sb diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test index b86f053..cd3b2ce 100644 --- a/tests/ttk/spinbox.test +++ b/tests/ttk/spinbox.test @@ -3,7 +3,8 @@ # package require Tk -package require tcltest ; namespace import -force tcltest::* +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test spinbox-1.0 "Spinbox tests -- setup" -body { @@ -148,7 +149,7 @@ test spinbox-1.8.4 "-validate option: " -setup { set ::spinbox_test } -cleanup { destroy .sb -} -result {50} +} -result 50 test spinbox-2.0 "current command -- unset should be 0" -constraints nyi -setup { @@ -316,7 +317,7 @@ test spinbox-nostomp-3 "don't stomp on -variable (configure; -from/to)" -body { test spinbox-nostomp-4 "don't stomp on -variable (configure; -values)" -body { set SBV Apr - ttk::spinbox .sb + ttk::spinbox .sb .sb configure -textvariable SBV -values {Jan Feb Mar Apr May Jun Jul Aug} list $SBV [.sb get] } -cleanup { @@ -341,7 +342,7 @@ test spinbox-dieoctaldie-1 "Cope with leading zeros" -body { event generate .sb <<Decrement>>; lappend result $secs set result -} -result [list 07 08 09 10 11 10 09 08 07] -cleanup { +} -result [list 07 08 09 10 11 10 09 08 07] -cleanup { destroy .sb unset secs } diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test index 7f26e2f..e3cd383 100644 --- a/tests/ttk/treetags.test +++ b/tests/ttk/treetags.test @@ -1,6 +1,7 @@ package require Tk -package require tcltest ; namespace import -force tcltest::* +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands ### treeview tag invariants: @@ -105,7 +106,7 @@ test treetags-1.8 "tag names" -body { } -result [list tag1 tag2 tag3] test treetags-1.9 "tag names - tag added to item" -body { - $tv item item1 -tags tag4 + $tv item item1 -tags tag4 lsort [$tv tag names] } -result [list tag1 tag2 tag3 tag4] @@ -201,12 +202,12 @@ test treetags-3.4 "stomp tags in tag binding procedure" -body { set result [list] $tv tag bind rm1 <<Remove>> { lappend ::result rm1 [%W focus] <<Remove>> } $tv tag bind rm2 <<Remove>> { - lappend ::result rm2 [%W focus] <<Remove>> + lappend ::result rm2 [%W focus] <<Remove>> %W item [%W focus] -tags {tag1} } $tv tag bind rm3 <<Remove>> { lappend ::result rm3 [%W focus] <<Remove>> } - $tv item item1 -tags {rm1 rm2 rm3} + $tv item item1 -tags {rm1 rm2 rm3} $tv focus item1 event generate $tv <<Remove>> set result diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test index 0ad0443..51f20a5 100644 --- a/tests/ttk/treeview.test +++ b/tests/ttk/treeview.test @@ -3,8 +3,9 @@ # what it currently does) # -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands # consistencyCheck -- @@ -729,7 +730,7 @@ test treeview-3085489-2 "tag remove, no -tags" -setup { test treeview-368fa4561e "indicators cannot be clicked on leafs" -setup { pack [ttk::treeview .tv] - .tv insert {} end -id foo -text "<-- (1) Click the blank space to my left" + .tv insert {} end -id foo -text "<-- (1) Click the blank space to my left" update } -body { foreach {x y w h} [.tv bbox foo #0] {} @@ -748,7 +749,7 @@ test treeview-368fa4561e "indicators cannot be clicked on leafs" -setup { test treeview-ce470f20fd-1 "dragging further than the right edge of the treeview is allowed" -setup { pack [ttk::treeview .tv] - .tv heading #0 -text "Drag my right edge -->" + .tv heading #0 -text "Drag my right edge -->" update } -body { set res [.tv column #0 -width] @@ -818,7 +819,7 @@ test treeview-ce470f20fd-4 "changing -stretch resizes columns" -setup { update idletasks ; # redisplay treeview } -body { # only some columns are displayed (and in a different order than declared - # in -columns), a non-displayed column becomes stretchable --> nothing + # in -columns), a non-displayed column becomes stretchable --> nothing # happens set origTreeWidth [winfo width .tv] set res [list [.tv column bar -width] [.tv column colA -width]] diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test index aba3eba..16d4506 100644 --- a/tests/ttk/ttk.test +++ b/tests/ttk/ttk.test @@ -1,6 +1,7 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands proc skip args {} @@ -207,7 +208,7 @@ test ttk-2.8 "bug 3223850: button state disabled during click" -setup { set ttk28 {} pack [ttk::button .b -command {set ::ttk28 failed}] update -} -body { +} -body { bind .b <ButtonPress-1> {after 0 {.b configure -state disabled}} after 1 {event generate .b <ButtonPress-1>} after 20 {event generate .b <ButtonRelease-1>} diff --git a/tests/ttk/validate.test b/tests/ttk/validate.test index 417deac..5430903 100644 --- a/tests/ttk/validate.test +++ b/tests/ttk/validate.test @@ -3,8 +3,8 @@ ## Derived from core test suite entry-19.1 through entry-19.20 ## -package require Tk 8.5 -package require tcltest 2.1 +package require Tk +package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands @@ -161,7 +161,7 @@ test validate-1.18 {entry widget validation} -constraints coreEntry -body { list [.e cget -validate] $::vVals } -result {none {.e -1 -1 nextdata newdata {} all forced}} # DIFFERENCE: ttk::entry doesn't validate when setting linked -variable -# DIFFERENCE: ttk::entry doesn't disable validation +# DIFFERENCE: ttk::entry doesn't disable validation proc doval {W d i P s S v V} { set ::vVals [list $W $d $i $P $s $S $v $V] diff --git a/tests/ttk/vsapi.test b/tests/ttk/vsapi.test index bb88fef..ec4e9e7 100644 --- a/tests/ttk/vsapi.test +++ b/tests/ttk/vsapi.test @@ -1,12 +1,13 @@ # -*- tcl -*- # -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands testConstraint xpnative \ - [expr {[lsearch -exact [ttk::style theme names] xpnative] != -1}] + [expr {"xpnative" in [ttk::style theme names]}] test vsapi-1.1 "WINDOW WP_SMALLCLOSEBUTTON" -constraints {xpnative} -body { ttk::style element create smallclose vsapi \ diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test index 428e510..cd7f15f 100644 --- a/tests/unixEmbed.test +++ b/tests/unixEmbed.test @@ -16,7 +16,7 @@ namespace eval ::_test_tmp {} # ------------------------------------------------------------------------------ # Proc ::_test_tmp::testInterp # ------------------------------------------------------------------------------ -# Command that creates an unsafe child interpreter and tries to load Tk. +# Command that creates an child interpreter and tries to load Tk. # This code is borrowed from safePrimarySelection.test # This is necessary for loading Tktest if the tests are done in the build # directory without installing Tk. In that case the usual auto_path loading @@ -150,21 +150,21 @@ test unixEmbed-1.5a {TkpUseWindow procedure, creating Container records} -constr unix testembed } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 - slave alias w winfo id .f1 - slave eval { + child alias w winfo id .f1 + child eval { destroy [winfo child .] toplevel .t -use [w] list [testembed] [expr {[lindex [lindex [testembed all] 0] 0] - [w]}] } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {{{XXX {} {} .t}} 0} test unixEmbed-1.6 {TkpUseWindow procedure, creating Container records} -constraints { @@ -190,23 +190,23 @@ test unixEmbed-1.6a {TkpUseWindow procedure, creating Container records} -constr unix testembed } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 - slave alias w1 winfo id .f1 - slave alias w2 winfo id .f2 - slave eval { + child alias w1 winfo id .f1 + child alias w2 winfo id .f2 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] toplevel .t2 -use [w2] testembed } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {{XXX {} {} .t2} {XXX {} {} .t1}} test unixEmbed-1.7 {TkpUseWindow procedure, container and embedded in same app} -constraints { @@ -253,21 +253,21 @@ test unixEmbed-2.1a {EmbeddedEventProc procedure} -constraints { unix testembed } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] testembed } destroy .f1 update - slave eval { + child eval { testembed } } -cleanup { @@ -295,14 +295,14 @@ test unixEmbed-2.2a {EmbeddedEventProc procedure} -constraints { unix testembed } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] testembed @@ -310,7 +310,7 @@ test unixEmbed-2.2a {EmbeddedEventProc procedure} -constraints { testembed } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {} test unixEmbed-2.3 {EmbeddedEventProc procedure} -constraints { @@ -361,22 +361,22 @@ test unixEmbed-3.1 {ContainerEventProc procedure, detect creation} -constraints test unixEmbed-3.1a {ContainerEventProc procedure, detect creation} -constraints { unix testembed } -setup { - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 + child alias w1 winfo id .f1 set x [testembed] - slave eval { + child eval { destroy [winfo child .] toplevel .t1 -use [w1] wm withdraw .t1 } list $x [testembed] } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {{{XXX .f1 {} {}}} {{XXX .f1 {} {}}}} test unixEmbed-3.2 {ContainerEventProc procedure, set size on creation} -constraints { @@ -418,14 +418,14 @@ test unixEmbed-3.3a {ContainerEventProc procedure, disallow position changes} -c unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] -bd 2 -relief raised update @@ -434,7 +434,7 @@ test unixEmbed-3.3a {ContainerEventProc procedure, disallow position changes} -c wm geometry .t1 } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {200x200+0+0} test unixEmbed-3.4 {ContainerEventProc procedure, disallow position changes} -constraints { @@ -462,14 +462,14 @@ test unixEmbed-3.4a {ContainerEventProc procedure, disallow position changes} -c unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] update @@ -478,7 +478,7 @@ test unixEmbed-3.4a {ContainerEventProc procedure, disallow position changes} -c wm geometry .t1 } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {300x100+0+0} test unixEmbed-3.5 {ContainerEventProc procedure, geometry requests} -constraints { @@ -506,22 +506,22 @@ test unixEmbed-3.5a {ContainerEventProc procedure, geometry requests} -constrain unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] .t1 configure -width 300 -height 80 update } - list [winfo width .f1] [winfo height .f1] [slave eval {wm geometry .t1}] + list [winfo width .f1] [winfo height .f1] [child eval {wm geometry .t1}] } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {300 80 300x80+0+0} test unixEmbed-3.6 {ContainerEventProc procedure, map requests} -constraints { @@ -551,14 +551,14 @@ test unixEmbed-3.6a {ContainerEventProc procedure, map requests} -constraints { unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] set x unmapped @@ -569,7 +569,7 @@ test unixEmbed-3.6a {ContainerEventProc procedure, map requests} -constraints { set x } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {mapped} test unixEmbed-3.7 {ContainerEventProc procedure, destroy events} -constraints { @@ -599,16 +599,16 @@ test unixEmbed-3.7a {ContainerEventProc procedure, destroy events} -constraints unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 + child alias w1 winfo id .f1 bind .f1 <Destroy> {set x dead} set x alive - slave eval { + child eval { destroy [winfo child .] toplevel .t1 -use [w1] update @@ -617,7 +617,7 @@ test unixEmbed-3.7a {ContainerEventProc procedure, destroy events} -constraints update list $x [winfo exists .f1] } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {dead 0} @@ -648,14 +648,14 @@ test unixEmbed-4.1a {EmbedStructureProc procedure, configure events} -constraint unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] update @@ -664,7 +664,7 @@ test unixEmbed-4.1a {EmbedStructureProc procedure, configure events} -constraint winfo geometry .t1 } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {180x100+0+0} test unixEmbed-4.2 {EmbedStructureProc procedure, destroy events} -constraints { @@ -691,15 +691,15 @@ test unixEmbed-4.2a {EmbedStructureProc procedure, destroy events} -constraints unix testembed } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] } @@ -707,7 +707,7 @@ test unixEmbed-4.2a {EmbedStructureProc procedure, destroy events} -constraints destroy .f1 list $x [testembed] } -cleanup { - interp delete slave + interp delete child deleteWindows } -result "{{XXX .f1 {} {}}} {}" @@ -737,14 +737,14 @@ test unixEmbed-5.1a {EmbedFocusProc procedure, FocusIn events} -constraints { unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] bind .t1 <FocusIn> {lappend x "focus in %W"} @@ -754,9 +754,9 @@ test unixEmbed-5.1a {EmbedFocusProc procedure, FocusIn events} -constraints { } focus -force .f1 update - slave eval {set x} + child eval {set x} } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {{focus in .t1}} test unixEmbed-5.2 {EmbedFocusProc procedure, focusing on dead window} -constraints { @@ -785,14 +785,14 @@ test unixEmbed-5.2a {EmbedFocusProc procedure, focusing on dead window} -constra unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] update @@ -802,7 +802,7 @@ test unixEmbed-5.2a {EmbedFocusProc procedure, focusing on dead window} -constra focus -force .f1 update } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {} test unixEmbed-5.3 {EmbedFocusProc procedure, FocusOut events} -constraints { @@ -833,14 +833,14 @@ test unixEmbed-5.3a {EmbedFocusProc procedure, FocusOut events} -constraints { unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] set x {} @@ -850,12 +850,12 @@ test unixEmbed-5.3a {EmbedFocusProc procedure, FocusOut events} -constraints { } focus -force .f1 update - set x [slave eval {update; set x }] + set x [child eval {update; set x }] focus . update - list $x [slave eval {update; set x}] + list $x [child eval {update; set x}] } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}} @@ -885,14 +885,14 @@ test unixEmbed-6.1a {EmbedGeometryRequest procedure, window changes size} -const unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] update @@ -903,7 +903,7 @@ test unixEmbed-6.1a {EmbedGeometryRequest procedure, window changes size} -const list $x [winfo geom .t1] } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {{configure .t1 300 120} 300x120+0+0} test unixEmbed-6.2 {EmbedGeometryRequest procedure, window changes size} -constraints { @@ -931,15 +931,15 @@ test unixEmbed-6.2a {EmbedGeometryRequest procedure, window changes size} -const unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 place .f1 -width 200 -height 200 update - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] update @@ -950,7 +950,7 @@ test unixEmbed-6.2a {EmbedGeometryRequest procedure, window changes size} -const list $x [winfo geom .t1] } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {{configure .t1 200 200} 200x200+0+0} @@ -991,22 +991,22 @@ test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constrai unix notAqua } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { deleteWindows frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] } focus -force . bind . <KeyPress> {lappend x {key %A %E}} set x {} - set y [slave eval { + set y [child eval { update bind .t1 <KeyPress> {lappend y {key %A}} set y {} @@ -1016,7 +1016,7 @@ test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constrai update list $x $y } -cleanup { - interp delete slave + interp delete child deleteWindows bind . <KeyPress> {} } -result {{{key a 1}} {}} @@ -1054,14 +1054,14 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt unix } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] } @@ -1070,7 +1070,7 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt update bind . <KeyPress> {lappend x {key %A}} set x {} - set y [slave eval { + set y [child eval { update bind .t1 <KeyPress> {lappend y {key %A}} set y {} @@ -1080,7 +1080,7 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt update list $x $y } -cleanup { - interp delete slave + interp delete child deleteWindows bind . <KeyPress> {} } -result {{} {{key b}}} @@ -1113,30 +1113,30 @@ test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints { } -result {{{} .t1} .f1} test unixEmbed-8.1a {TkpClaimFocus procedure} -constraints unix -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -width 200 -height 50 pack .f1 .f2 update - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken } # This should clear focus from the application embedded in .f1 focus -force .f2 update - list [slave eval { + list [child eval { set x [list [focus]] focus .t1 update lappend x [focus] }] [focus] } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {{{} .t1} .f1} test unixEmbed-8.2 {TkpClaimFocus procedure} -constraints unix -setup { @@ -1211,14 +1211,14 @@ test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constrain unix testembed } -setup { deleteWindows - catch {interp delete slave} - ::_test_tmp::testInterp slave - load {} Tktest slave + catch {interp delete child} + ::_test_tmp::testInterp child + load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 - slave alias w1 winfo id .f1 - slave eval { + child alias w1 winfo id .f1 + child eval { destroy [winfo child .] toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken set x {} @@ -1227,7 +1227,7 @@ test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constrain lappend x [testembed] } } -cleanup { - interp delete slave + interp delete child deleteWindows } -result {{{XXX {} {} .t1}} {}} diff --git a/tests/unixFont.test b/tests/unixFont.test index 177dab5..eb2a23b 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -12,7 +12,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands diff --git a/tests/unixWm.test b/tests/unixWm.test index 39a68ae..10050de 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -1298,7 +1298,7 @@ test unixWm-37.3 {Tk_WmCmd procedure, "transient" option} {unix testwrapper} { destroy .t2 set result } {{} {} .t 0 {} {}} -test unixWm-37.4 {TkWmDeadWindow, destroy on master should clear transient} {unix testwrapper} { +test unixWm-37.4 {TkWmDeadWindow, destroy on toplevel should clear transient} {unix testwrapper} { destroy .t2 toplevel .t2 destroy .t3 @@ -1309,7 +1309,7 @@ test unixWm-37.4 {TkWmDeadWindow, destroy on master should clear transient} {uni update list [wm transient .t2] [testprop [testwrapper .t2] WM_TRANSIENT_FOR] } {{} {}} -test unixWm-37.5 {Tk_WmCmd procedure, "transient" option, create master wrapper} {unix testwrapper} { +test unixWm-37.5 {Tk_WmCmd procedure, "transient" option, create toplevel wrapper} {unix testwrapper} { destroy .t2 destroy .t3 toplevel .t2 -width 120 -height 300 @@ -1840,7 +1840,7 @@ test unixWm-50.3 { Tk_CoordsToWindow procedure, finding a toplevel with embedding } tempNotWin { deleteWindows - catch {interp delete slave} + catch {interp delete child} toplevel .t -width 300 -height 400 -bg blue wm geom .t +100+100 @@ -1848,10 +1848,10 @@ test unixWm-50.3 { place .t.f -x 150 -y 50 tkwait visibility .t.f update - interp create slave - load {} Tk slave - slave alias frameid winfo id .t.f - slave eval { + interp create child + load {} Tk child + child alias frameid winfo id .t.f + child eval { wm withdraw . toplevel .x -width 100 -height 80 -use [frameid] -bg yellow tkwait visibility .x @@ -1859,9 +1859,9 @@ test unixWm-50.3 { set x [winfo rootx .x] set y [winfo rooty .x] } - set result [list [slave eval {winfo containing [expr $x - 1] [expr $y + 50]}] \ - [slave eval {winfo containing $x [expr $y + 50]}]] - interp delete slave + set result [list [child eval {winfo containing [expr $x - 1] [expr $y + 50]}] \ + [child eval {winfo containing $x [expr $y + 50]}]] + interp delete child set x [winfo rootx .t] set y [winfo rooty .t] lappend result [winfo containing [expr $x + 200] [expr $y + 49]] \ @@ -1871,17 +1871,17 @@ test unixWm-50.3 { test unixWm-50.4 {Tk_CoordsToWindow procedure, window in other application} unix { destroy .t - catch {interp delete slave} + catch {interp delete child} toplevel .t -width 200 -height 200 -bg green wm geometry .t +100+100 tkwait visibility .t update - interp create slave - load {} Tk slave - slave eval {wm geometry . 200x200+100+100; tkwait visibility . ; update} + interp create child + load {} Tk child + child eval {wm geometry . 200x200+100+100; tkwait visibility . ; update} set result [list [winfo containing 200 200] \ - [slave eval {winfo containing 200 200}]] - interp delete slave + [child eval {winfo containing 200 200}]] + interp delete child set result } {{} .} test unixWm-50.5 {Tk_CoordsToWindow procedure, handling menubars} {unix testmenubar} { diff --git a/tests/winSend.test b/tests/winSend.test index 31c800e..d4860b4 100644 --- a/tests/winSend.test +++ b/tests/winSend.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands diff --git a/tests/wm.test b/tests/wm.test index fac02fe..1eda872 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -11,7 +11,7 @@ # Window manager tests that only work on a specific platform should be placed # in unixWm.test or winWm.test. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands @@ -1527,7 +1527,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body { test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ overrideredirect toplevel on unix} -constraints x11 -body { toplevel .t - tkwait visibility .t + tkwait visibility .t wm overrideredirect .t 1 raise . update @@ -1539,7 +1539,7 @@ test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \ overrideredirect toplevel on macOS or win} -constraints aquaOrWin32 -body { toplevel .t - tkwait visibility .t + tkwait visibility .t wm overrideredirect .t 1 raise . update @@ -1551,7 +1551,7 @@ test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \ test wm-stackorder-5.3 {An overrideredirect window\ can be explicitly lowered} -body { toplevel .t - tkwait visibility .t + tkwait visibility .t wm overrideredirect .t 1 lower .t update @@ -1608,9 +1608,9 @@ test wm-transient-1.3 {usage} -returnCodes error -body { } -result {bad window path name "foo"} deleteWindows test wm-transient-1.4 {usage} -returnCodes error -body { - toplevel .master + toplevel .top toplevel .subject - wm transient .subject .master + wm transient .subject .top wm iconify .subject } -cleanup { deleteWindows @@ -1634,11 +1634,11 @@ test wm-transient-1.6 {usage} -returnCodes error -body { deleteWindows } -result {can't make ".icon" a master: it is an icon for .top} test wm-transient-1.7 {usage} -returnCodes error -body { - toplevel .master - wm transient .master .master + toplevel .top + wm transient .top .top } -cleanup { deleteWindows -} -result {setting ".master" as master creates a transient/master cycle} +} -result {setting ".top" as master creates a transient/master cycle} test wm-transient-1.8 {usage} -returnCodes error -body { toplevel .t1 toplevel .t2 @@ -1650,73 +1650,73 @@ test wm-transient-1.8 {usage} -returnCodes error -body { deleteWindows } -result {setting ".t3" as master creates a transient/master cycle} test wm-transient-1.9 {usage} -returnCodes error -body { - toplevel .master - frame .master.f - wm transient .master .master.f + toplevel .top + frame .top.f + wm transient .top .top.f } -cleanup { deleteWindows -} -result {setting ".master" as master creates a transient/master cycle} +} -result {setting ".top" as master creates a transient/master cycle} -test wm-transient-2.1 {basic get/set of master} -setup { +test wm-transient-2.1 {basic get/set of toplevel} -setup { set results [list] } -body { - toplevel .master + toplevel .top toplevel .subject lappend results [wm transient .subject] - wm transient .subject .master + wm transient .subject .top lappend results [wm transient .subject] wm transient .subject {} lappend results [wm transient .subject] } -cleanup { deleteWindows -} -result {{} .master {}} -test wm-transient-2.2 {first toplevel parent of non-toplevel master is used} -body { - toplevel .master - frame .master.f +} -result {{} .top {}} +test wm-transient-2.2 {first toplevel parent of non-toplevel container window is used} -body { + toplevel .top + frame .top.f toplevel .subject - wm transient .subject .master.f + wm transient .subject .top.f wm transient .subject } -cleanup { deleteWindows -} -result {.master} +} -result {.top} test wm-transient-3.1 {transient toplevel is withdrawn - when mapped if master is withdrawn} -body { - toplevel .master - wm withdraw .master + when mapped if toplevel is withdrawn} -body { + toplevel .top + wm withdraw .top update toplevel .subject - wm transient .subject .master + wm transient .subject .top update list [wm state .subject] [winfo ismapped .subject] } -cleanup { deleteWindows } -result {withdrawn 0} test wm-transient-3.2 {already mapped transient toplevel - takes on withdrawn state of master} -body { - toplevel .master - wm withdraw .master + takes on withdrawn state of toplevel} -body { + toplevel .top + wm withdraw .top update toplevel .subject update - wm transient .subject .master + wm transient .subject .top update list [wm state .subject] [winfo ismapped .subject] } -cleanup { deleteWindows } -result {withdrawn 0} -test wm-transient-3.3 {withdraw/deiconify on the master +test wm-transient-3.3 {withdraw/deiconify on the toplevel also does a withdraw/deiconify on the transient} -setup { set results [list] } -body { - toplevel .master + toplevel .top toplevel .subject update - wm transient .subject .master - wm withdraw .master + wm transient .subject .top + wm withdraw .top update lappend results [wm state .subject] [winfo ismapped .subject] - wm deiconify .master + wm deiconify .top update lappend results [wm state .subject] [winfo ismapped .subject] } -cleanup { @@ -1724,43 +1724,43 @@ test wm-transient-3.3 {withdraw/deiconify on the master } -result {withdrawn 0 normal 1} test wm-transient-4.1 {transient toplevel is withdrawn - when mapped if master is iconic} -body { - toplevel .master - wm iconify .master + when mapped if toplevel is iconic} -body { + toplevel .top + wm iconify .top update toplevel .subject - wm transient .subject .master + wm transient .subject .top update list [wm state .subject] [winfo ismapped .subject] } -cleanup { deleteWindows } -result {withdrawn 0} test wm-transient-4.2 {already mapped transient toplevel - is withdrawn if master is iconic} -body { - toplevel .master + is withdrawn if toplevel is iconic} -body { + toplevel .top raiseDelay - wm iconify .master + wm iconify .top update idletasks toplevel .subject update idletasks - wm transient .subject .master + wm transient .subject .top update idletasks list [wm state .subject] [winfo ismapped .subject] } -cleanup { deleteWindows } -result {withdrawn 0} -test wm-transient-4.3 {iconify/deiconify on the master +test wm-transient-4.3 {iconify/deiconify on the toplevel does a withdraw/deiconify on the transient} -setup { set results [list] } -body { - toplevel .master + toplevel .top toplevel .subject update idletasks - wm transient .subject .master - wm iconify .master + wm transient .subject .top + wm iconify .top update idletasks lappend results [wm state .subject] [winfo ismapped .subject] - wm deiconify .master + wm deiconify .top update idletasks lappend results [wm state .subject] [winfo ismapped .subject] } -cleanup { @@ -1771,53 +1771,53 @@ test wm-transient-5.1 {an error during transient command should not cause the map/unmap binding to be deleted} -setup { set results [list] } -body { - toplevel .master + toplevel .top toplevel .subject update - wm transient .subject .master + wm transient .subject .top # Expect a bad window path error here lappend results [catch {wm transient .subject .bad}] - wm withdraw .master + wm withdraw .top update lappend results [wm state .subject] - wm deiconify .master + wm deiconify .top update lappend results [wm state .subject] } -cleanup { deleteWindows } -result {1 withdrawn normal} -test wm-transient-5.2 {remove transient property when master +test wm-transient-5.2 {remove transient property when toplevel is destroyed} -body { - toplevel .master + toplevel .top toplevel .subject - wm transient .subject .master + wm transient .subject .top update - destroy .master + destroy .top update wm transient .subject } -cleanup { deleteWindows } -result {} test wm-transient-5.3 {remove transient property from window - that had never been mapped when master is destroyed} -body { - toplevel .master + that had never been mapped when toplevel is destroyed} -body { + toplevel .top toplevel .subject - wm transient .subject .master - destroy .master + wm transient .subject .top + destroy .top wm transient .subject } -cleanup { deleteWindows } -result {} test wm-transient-6.1 {a withdrawn transient does not track - state changes in the master} -body { - toplevel .master + state changes in the toplevel} -body { + toplevel .top toplevel .subject update - wm transient .subject .master + wm transient .subject .top wm withdraw .subject - wm withdraw .master - wm deiconify .master + wm withdraw .top + wm deiconify .top # idle handler should not map the transient update wm state .subject @@ -1825,24 +1825,24 @@ test wm-transient-6.1 {a withdrawn transient does not track deleteWindows } -result {withdrawn} test wm-transient-6.2 {a withdrawn transient does not track - state changes in the master} -setup { + state changes in the toplevel} -setup { set results [list] } -body { - toplevel .master + toplevel .top toplevel .subject update - wm transient .subject .master + wm transient .subject .top wm withdraw .subject - wm withdraw .master - wm deiconify .master + wm withdraw .top + wm deiconify .top # idle handler should not map the transient update lappend results [wm state .subject] wm deiconify .subject lappend results [wm state .subject] - wm withdraw .master + wm withdraw .top lappend results [wm state .subject] - wm deiconify .master + wm deiconify .top # idle handler should map transient update lappend results [wm state .subject] @@ -1850,15 +1850,15 @@ test wm-transient-6.2 {a withdrawn transient does not track deleteWindows } -result {withdrawn normal withdrawn normal} test wm-transient-6.3 {a withdrawn transient does not track - state changes in the master} -body { - toplevel .master + state changes in the toplevel} -body { + toplevel .top toplevel .subject update # withdraw before making window a transient wm withdraw .subject - wm transient .subject .master - wm withdraw .master - wm deiconify .master + wm transient .subject .top + wm withdraw .top + wm deiconify .top # idle handler should not map the transient update wm state .subject @@ -1866,7 +1866,7 @@ test wm-transient-6.3 {a withdrawn transient does not track deleteWindows } -result {withdrawn} -# wm-transient-7.*: See SF Tk Bug #592201 "wm transient fails with two masters" +# wm-transient-7.*: See SF Tk Bug #592201 "wm transient fails with two toplevels" # wm-transient-7.3 through 7.5 all caused panics on Unix in Tk 8.4b1. # 7.1 and 7.2 added to catch (potential) future errors. # @@ -1880,16 +1880,16 @@ test wm-transient-7.1 {Destroying transient} -body { } -cleanup { deleteWindows } -test wm-transient-7.2 {Destroying master} -body { - toplevel .t +test wm-transient-7.2 {Destroying toplevel} -body { + toplevel .top toplevel .transient - wm transient .transient .t - destroy .t + wm transient .transient .top + destroy .top wm transient .transient } -cleanup { deleteWindows } -result {} -test wm-transient-7.3 {Reassign transient, destroy old master} -body { +test wm-transient-7.3 {Reassign transient, destroy old toplevel} -body { toplevel .t1 toplevel .t2 toplevel .transient @@ -1901,7 +1901,7 @@ test wm-transient-7.3 {Reassign transient, destroy old master} -body { } -cleanup { deleteWindows } -test wm-transient-7.4 {Reassign transient, destroy new master} -body { +test wm-transient-7.4 {Reassign transient, destroy new toplevel} -body { toplevel .t1 toplevel .t2 toplevel .transient @@ -1930,8 +1930,8 @@ test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -setup { deleteWindows set result {} } -body { - # Verifies that transients stay on top of their masters, even if they were - # made transients when those masters were withdrawn. + # Verifies that transients stay on top of their toplevels, even if they were + # made transients when those toplevels were withdrawn. toplevel .t1; wm withdraw .t1; update toplevel .t2; wm transient .t2 .t1; update lappend result [winfo ismapped .t1] [winfo ismapped .t2] diff --git a/unix/Makefile.in b/unix/Makefile.in index 74c17bb..86ea005 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -634,8 +634,8 @@ $(TKTEST_EXE): $(TKTEST_OBJS) $(TK_LIB_FILE) $(MAKE) tktest-real LIB_RUNTIME_DIR="`pwd`:$(TCL_BIN_DIR)" tktest-real: ${TK_STUB_LIB_FILE} - ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} @TK_BUILD_LIB_SPEC@ \ - $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o $(TKTEST_EXE) + ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) @TK_BUILD_LIB_SPEC@ $(WISH_LIBS) \ + ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} $(CC_SEARCH_FLAGS) -o $(TKTEST_EXE) # # FIXME: This xttest rule seems to be broken in a number of ways. It should # # use CC_SEARCH_FLAGS, it does not include the shared lib location logic from @@ -1531,7 +1531,7 @@ rpm: all # # Target to create a proper Tk distribution from information in the -# master source directory. DISTDIR must be defined to indicate where +# source directory. DISTDIR must be defined to indicate where # to put the distribution. DISTDIR must be an absolute path name. # diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index aa54897..fc8b4f2 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -1057,7 +1057,7 @@ GetTearoffEntryGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { - if (menuPtr->menuType != MASTER_MENU) { + if (menuPtr->menuType != MAIN_MENU) { *heightPtr = 0; *widthPtr = 0; } else { @@ -1281,7 +1281,7 @@ DrawTearoffEntry( int segmentWidth, maxX; Tk_3DBorder border; - if (menuPtr->menuType != MASTER_MENU) { + if (menuPtr->menuType != MAIN_MENU) { return; } diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 47a0aad..09ff558 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -167,8 +167,6 @@ #define TkpButtonSetDefaults() {} #define TkpDestroyButton(butPtr) {} -#define TkpWillDrawWidget(tkwin) 0 -#define TkpRedrawWidget(tkwin) #define TkSelUpdateClipboard(a,b) {} #ifndef __CYGWIN__ #define TkSetPixmapColormap(p,c) {} diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 2c9e9dd..f1d1fe0 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -27,8 +27,8 @@ typedef struct ProtocolHandler { /* Next in list of protocol handlers for the * same top-level window, or NULL for end of * list. */ - Tcl_Interp *interp; /* Interpreter in which to invoke command. */ - char command[1]; /* Tcl command to invoke when a client message + Tcl_Interp *interp; /* Interpreter in which to invoke command. */ + char command[TKFLEXARRAY]; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE @@ -82,7 +82,7 @@ typedef struct TkWmInfo { * (corresponds to hints.window_group). * Malloc-ed. Note: this field doesn't get * updated if leader is destroyed. */ - TkWindow *masterPtr; /* Master window for TRANSIENT_FOR property, + TkWindow *containerPtr; /* Container window for TRANSIENT_FOR property, * or NULL. */ Tk_Window icon; /* Window to use as icon for this window, or * NULL. */ @@ -259,7 +259,7 @@ typedef struct TkWmInfo { * window (controlled by "wm resizable" command). * WM_WITHDRAWN - non-zero means that this window has explicitly * been withdrawn. If it's a transient, it should - * not mirror state changes in the master. + * not mirror state changes in the container. */ #define WM_NEVER_MAPPED 1 @@ -571,7 +571,7 @@ TkWmNewWindow( memset(wmPtr, 0, sizeof(WmInfo)); wmPtr->winPtr = winPtr; wmPtr->reparent = None; - wmPtr->masterPtr = NULL; + wmPtr->containerPtr = NULL; wmPtr->numTransients = 0; wmPtr->hints.flags = InputHint | StateHint; wmPtr->hints.input = True; @@ -684,12 +684,12 @@ TkWmMapWindow( UpdateTitle(winPtr); UpdatePhotoIcon(winPtr); - if (wmPtr->masterPtr != NULL) { + if (wmPtr->containerPtr != NULL) { /* - * Don't map a transient if the master is not mapped. + * Don't map a transient if the container is not mapped. */ - if (!Tk_IsMapped(wmPtr->masterPtr)) { + if (!Tk_IsMapped(wmPtr->containerPtr)) { wmPtr->withdrawn = 1; wmPtr->hints.initial_state = WithdrawnState; } @@ -700,7 +700,7 @@ TkWmMapWindow( */ XSetTransientForHint(winPtr->display, wmPtr->wrapperPtr->window, - wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window); + wmPtr->containerPtr->wmInfoPtr->wrapperPtr->window); } wmPtr->flags |= WM_UPDATE_SIZE_HINTS; @@ -909,16 +909,16 @@ TkWmDeadWindow( } /* - * Reset all transient windows whose master is the dead window. + * Reset all transient windows whose container is the dead window. */ for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; wmPtr2 = wmPtr2->nextPtr) { - if (wmPtr2->masterPtr == winPtr) { + if (wmPtr2->containerPtr == winPtr) { wmPtr->numTransients--; - Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr, + Tk_DeleteEventHandler((Tk_Window) wmPtr2->containerPtr, StructureNotifyMask, WmWaitMapProc, wmPtr2->winPtr); - wmPtr2->masterPtr = NULL; + wmPtr2->containerPtr = NULL; if (!(wmPtr2->flags & WM_NEVER_MAPPED)) { XDeleteProperty(winPtr->display, wmPtr2->wrapperPtr->window, Tk_InternAtom((Tk_Window) winPtr, "WM_TRANSIENT_FOR")); @@ -933,19 +933,19 @@ TkWmDeadWindow( } /* ASSERT: numTransients == 0 [Bug 1789819] */ - if (wmPtr->masterPtr != NULL) { - wmPtr2 = wmPtr->masterPtr->wmInfoPtr; + if (wmPtr->containerPtr != NULL) { + wmPtr2 = wmPtr->containerPtr->wmInfoPtr; /* - * If we had a master, tell them that we aren't tied to them anymore + * If we had a container, tell them that we aren't tied to them anymore */ if (wmPtr2 != NULL) { wmPtr2->numTransients--; } - Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr, + Tk_DeleteEventHandler((Tk_Window) wmPtr->containerPtr, StructureNotifyMask, WmWaitMapProc, winPtr); - wmPtr->masterPtr = NULL; + wmPtr->containerPtr = NULL; } ckfree(wmPtr); winPtr->wmInfoPtr = NULL; @@ -2220,7 +2220,7 @@ WmIconifyCmd( NULL); return TCL_ERROR; } - if (wmPtr->masterPtr != NULL) { + if (wmPtr->containerPtr != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": it is a transient", winPtr->pathName)); @@ -3408,7 +3408,7 @@ WmStateCmd( "OVERRIDE_REDIRECT", NULL); return TCL_ERROR; } - if (wmPtr->masterPtr != NULL) { + if (wmPtr->containerPtr != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": it is a transient", winPtr->pathName)); @@ -3532,7 +3532,7 @@ WmTransientCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - TkWindow *masterPtr = wmPtr->masterPtr, *w; + TkWindow *containerPtr = wmPtr->containerPtr, *w; WmInfo *wmPtr2; if ((objc != 3) && (objc != 4)) { @@ -3540,20 +3540,20 @@ WmTransientCmd( return TCL_ERROR; } if (objc == 3) { - if (masterPtr != NULL) { - Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) masterPtr)); + if (containerPtr != NULL) { + Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) containerPtr)); } return TCL_OK; } if (Tcl_GetString(objv[3])[0] == '\0') { - if (masterPtr != NULL) { + if (containerPtr != NULL) { /* - * If we had a master, tell them that we aren't tied to them + * If we had a container, tell them that we aren't tied to them * anymore */ - masterPtr->wmInfoPtr->numTransients--; - Tk_DeleteEventHandler((Tk_Window) masterPtr, StructureNotifyMask, + containerPtr->wmInfoPtr->numTransients--; + Tk_DeleteEventHandler((Tk_Window) containerPtr, StructureNotifyMask, WmWaitMapProc, winPtr); /* @@ -3563,22 +3563,22 @@ WmTransientCmd( */ } - wmPtr->masterPtr = NULL; + wmPtr->containerPtr = NULL; } else { - Tk_Window masterWin; + Tk_Window container; - if (TkGetWindowFromObj(interp, tkwin, objv[3], &masterWin)!=TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[3], &container)!=TCL_OK) { return TCL_ERROR; } - masterPtr = (TkWindow *) masterWin; - while (!Tk_TopWinHierarchy(masterPtr)) { + containerPtr = (TkWindow *) container; + while (!Tk_TopWinHierarchy(containerPtr)) { /* - * Ensure that the master window is actually a Tk toplevel. + * Ensure that the container window is actually a Tk toplevel. */ - masterPtr = masterPtr->parentPtr; + containerPtr = containerPtr->parentPtr; } - Tk_MakeWindowExist((Tk_Window) masterPtr); + Tk_MakeWindowExist((Tk_Window) containerPtr); if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3588,7 +3588,7 @@ WmTransientCmd( return TCL_ERROR; } - wmPtr2 = masterPtr->wmInfoPtr; + wmPtr2 = containerPtr->wmInfoPtr; if (wmPtr2->wrapperPtr == NULL) { CreateWrapper(wmPtr2); } @@ -3601,39 +3601,39 @@ WmTransientCmd( return TCL_ERROR; } - for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL; - w = (TkWindow *)w->wmInfoPtr->masterPtr) { + for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; + w = (TkWindow *)w->wmInfoPtr->containerPtr) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "setting \"%s\" as master creates a transient/master cycle", - Tk_PathName(masterPtr))); + Tk_PathName(containerPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } } - if (masterPtr != wmPtr->masterPtr) { + if (containerPtr != wmPtr->containerPtr) { /* - * Remove old master map/unmap binding before setting the new - * master. The event handler will ensure that transient states - * reflect the state of the master. + * Remove old container map/unmap binding before setting the new + * container. The event handler will ensure that transient states + * reflect the state of the container. */ - if (wmPtr->masterPtr != NULL) { - wmPtr->masterPtr->wmInfoPtr->numTransients--; - Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr, + if (wmPtr->containerPtr != NULL) { + wmPtr->containerPtr->wmInfoPtr->numTransients--; + Tk_DeleteEventHandler((Tk_Window) wmPtr->containerPtr, StructureNotifyMask, WmWaitMapProc, winPtr); } - masterPtr->wmInfoPtr->numTransients++; - Tk_CreateEventHandler((Tk_Window) masterPtr, + containerPtr->wmInfoPtr->numTransients++; + Tk_CreateEventHandler((Tk_Window) containerPtr, StructureNotifyMask, WmWaitMapProc, winPtr); - wmPtr->masterPtr = masterPtr; + wmPtr->containerPtr = containerPtr; } } if (!(wmPtr->flags & WM_NEVER_MAPPED)) { - if (wmPtr->masterPtr != NULL && !Tk_IsMapped(wmPtr->masterPtr)) { + if (wmPtr->containerPtr != NULL && !Tk_IsMapped(wmPtr->containerPtr)) { if (TkpWmSetState(winPtr, WithdrawnState) == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "couldn't send withdraw message to window manager", @@ -3642,10 +3642,10 @@ WmTransientCmd( return TCL_ERROR; } } else { - if (wmPtr->masterPtr != NULL) { + if (wmPtr->containerPtr != NULL) { XSetTransientForHint(winPtr->display, wmPtr->wrapperPtr->window, - wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window); + wmPtr->containerPtr->wmInfoPtr->wrapperPtr->window); } else { XDeleteProperty(winPtr->display, wmPtr->wrapperPtr->window, Tk_InternAtom((Tk_Window) winPtr,"WM_TRANSIENT_FOR")); @@ -3721,7 +3721,7 @@ WmUpdateGeom( /* * Invoked when a MapNotify or UnmapNotify event is delivered for a toplevel - * that is the master of a transient toplevel. + * that is the container of a transient toplevel. */ static void @@ -3730,9 +3730,9 @@ WmWaitMapProc( XEvent *eventPtr) /* Information about event. */ { TkWindow *winPtr = clientData; - TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr; + TkWindow *containerPtr = winPtr->wmInfoPtr->containerPtr; - if (masterPtr == NULL) { + if (containerPtr == NULL) { return; } diff --git a/win/Makefile.in b/win/Makefile.in index 43f9c81..c561f61 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -140,9 +140,9 @@ SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE) STATIC_LIBRARIES = $(TK_LIB_FILE) WISH = wish$(VER)${EXESUFFIX} -TKTEST = tktest${EXEEXT} -CAT32 = cat32$(EXEEXT) -MAN2TCL = man2tcl$(EXEEXT) +TKTEST = tktest.exe +CAT32 = cat32.exe +MAN2TCL = man2tcl.exe @SET_MAKE@ @@ -184,7 +184,6 @@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ @LDFLAGS_DEFAULT@ LDFLAGS_CONSOLE = @LDFLAGS_CONSOLE@ LDFLAGS_WINDOW = @LDFLAGS_WINDOW@ -EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ STLIB_LD = @STLIB_LD@ SHLIB_LD = @SHLIB_LD@ @@ -706,7 +705,7 @@ tkWindow.$(OBJEXT): configure Makefile depend: cleanhelp: - $(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl${EXEEXT} + $(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl.exe clean: cleanhelp $(RM) *.lib *.a *.exp *.dll *.res *.${OBJEXT} *~ \#* TAGS a.out diff --git a/win/rules.vc b/win/rules.vc index d4765b9..6dca6d9 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -514,7 +514,7 @@ CFG_ENCODING = \"cp1252\" # information about supported compiler options etc.
#
# Tcl itself will always use the nmakehlp.c program which is
-# in its own source. This is the "master" copy and kept updated.
+# in its own source. It will be kept updated there.
#
# Extensions built against an installed Tcl will use the installed
# copy of Tcl's nmakehlp.c if there is one and their own version
@@ -1669,7 +1669,7 @@ default-shell: default-setup $(PROJECT) !ifdef RCFILE
# Note: don't use $** in below rule because there may be other dependencies
-# and only the "master" rc must be passed to the resource compiler
+# and only the "main" rc must be passed to the resource compiler
$(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc
$(RESCMD) $(RCDIR)\$(PROJECT).rc
@@ -1723,7 +1723,7 @@ DISABLE_IMPLICIT_RULES = 0 !if !$(DISABLE_IMPLICIT_RULES)
# Implicit rule definitions - only for building library objects. For stubs and
-# main application, the master makefile should define explicit rules.
+# main application, the makefile should define explicit rules.
{$(ROOT)}.c{$(TMP_DIR)}.obj::
$(CCPKGCMD) @<<
diff --git a/win/stubs.c b/win/stubs.c index 884186c..faeac08 100644 --- a/win/stubs.c +++ b/win/stubs.c @@ -1,4 +1,4 @@ -#include "tk.h" +#include "tkInt.h" /* * Undocumented Xlib internal function @@ -8,6 +8,8 @@ int _XInitImageFuncPtrs( XImage *image) { + (void)image; + return Success; } @@ -21,6 +23,9 @@ XSetWMClientMachine( Window w, XTextProperty *text_prop) { + (void)display; + (void)w; + (void)text_prop; } Status @@ -29,7 +34,11 @@ XStringListToTextProperty( int count, XTextProperty *text_prop_return) { - return (Status) 0; + (void)list; + (void)count; + (void)text_prop_return; + + return Success; } /* @@ -47,54 +56,36 @@ XChangeProperty( _Xconst unsigned char *data, int nelements) { - return Success; -} + (void)display; + (void)w; + (void)property; + (void)type; + (void)format; + (void)mode; + (void)data; + (void)nelements; -Cursor -XCreateGlyphCursor( - Display *display, - Font source_font, - Font mask_font, - unsigned int source_char, - unsigned int mask_char, - XColor _Xconst *foreground_color, - XColor _Xconst *background_color) -{ - return 1; + return Success; } XIC XCreateIC(XIM xim, ...) { + (void)xim; return NULL; } -Cursor -XCreatePixmapCursor( - Display *display, - Pixmap source, - Pixmap mask, - XColor *foreground_color, - XColor *background_color, - unsigned int x, - unsigned int y) -{ - return (Cursor) NULL; -} - int XDeleteProperty( Display *display, Window w, Atom property) { - return Success; -} + (void)display; + (void)w; + (void)property; -void -XDestroyIC( - XIC ic) -{ + return Success; } Bool @@ -102,6 +93,9 @@ XFilterEvent( XEvent *event, Window window) { + (void)event; + (void)window; + return 0; } @@ -110,6 +104,9 @@ XForceScreenSaver( Display *display, int mode) { + (void)display; + (void)mode; + return Success; } @@ -118,6 +115,9 @@ XFreeCursor( Display *display, Cursor cursor) { + (void)display; + (void)cursor; + return Success; } @@ -125,6 +125,8 @@ GContext XGContextFromGC( GC gc) { + (void)gc; + return (GContext) NULL; } @@ -133,6 +135,9 @@ XGetAtomName( Display *display, Atom atom) { + (void)display; + (void)atom; + return NULL; } @@ -142,6 +147,10 @@ XGetWindowAttributes( Window w, XWindowAttributes *window_attributes_return) { + (void)display; + (void)w; + (void)window_attributes_return; + return Success; } @@ -152,7 +161,12 @@ XGetWMColormapWindows( Window **windows_return, int *count_return) { - return (Status) 0; + (void)display; + (void)w; + (void)windows_return; + (void)count_return; + + return Success; } int @@ -161,6 +175,10 @@ XIconifyWindow( Window w, int screen_number) { + (void)display; + (void)w; + (void)screen_number; + return Success; } @@ -170,6 +188,10 @@ XListHosts( int *nhosts_return, Bool *state_return) { + (void)display; + (void)nhosts_return; + (void)state_return; + return NULL; } @@ -181,6 +203,12 @@ XLookupColor( XColor *exact_def_return, XColor *screen_def_return) { + (void)display; + (void)colormap; + (void)color_name; + (void)exact_def_return; + (void)screen_def_return; + return Success; } @@ -189,6 +217,9 @@ XNextEvent( Display *display, XEvent *event_return) { + (void)display; + (void)event_return; + return Success; } @@ -197,6 +228,9 @@ XPutBackEvent( Display *display, XEvent *event) { + (void)display; + (void)event; + return Success; } @@ -207,6 +241,11 @@ XQueryColors( XColor *defs_in_out, int ncolors) { + (void)display; + (void)colormap; + (void)defs_in_out; + (void)ncolors; + return Success; } @@ -219,6 +258,13 @@ XQueryTree( Window **children_return, unsigned int *nchildren_return) { + (void)display; + (void)w; + (void)root_return; + (void)parent_return; + (void)children_return; + (void)nchildren_return; + return Success; } @@ -226,6 +272,8 @@ int XRefreshKeyboardMapping( XMappingEvent *event_map) { + (void)event_map; + return Success; } @@ -234,6 +282,9 @@ XRootWindow( Display *display, int screen_number) { + (void)display; + (void)screen_number; + return (Window) NULL; } @@ -243,6 +294,10 @@ XSelectInput( Window w, long event_mask) { + (void)display; + (void)w; + (void)event_mask; + return Success; } @@ -254,6 +309,12 @@ XSendEvent( long event_mask, XEvent *event_send) { + (void)display; + (void)w; + (void)propagate; + (void)event_mask; + (void)event_send; + return Success; } @@ -264,6 +325,11 @@ XSetCommand( char **argv, int argc) { + (void)display; + (void)w; + (void)argv; + (void)argc; + return Success; } @@ -271,6 +337,8 @@ XErrorHandler XSetErrorHandler( XErrorHandler handler) { + (void)handler; + return NULL; } @@ -280,6 +348,10 @@ XSetIconName( Window w, _Xconst char *icon_name) { + (void)display; + (void)w; + (void)icon_name; + return Success; } @@ -289,6 +361,10 @@ XSetWindowBackground( Window w, unsigned long background_pixel) { + (void)display; + (void)w; + (void)background_pixel; + return Success; } @@ -298,6 +374,10 @@ XSetWindowBackgroundPixmap( Window w, Pixmap background_pixmap) { + (void)display; + (void)w; + (void)background_pixmap; + return Success; } @@ -307,6 +387,10 @@ XSetWindowBorder( Window w, unsigned long border_pixel) { + (void)display; + (void)w; + (void)border_pixel; + return Success; } @@ -316,6 +400,10 @@ XSetWindowBorderPixmap( Window w, Pixmap border_pixmap) { + (void)display; + (void)w; + (void)border_pixmap; + return Success; } @@ -325,6 +413,10 @@ XSetWindowBorderWidth( Window w, unsigned int width) { + (void)display; + (void)w; + (void)width; + return Success; } @@ -334,6 +426,10 @@ XSetWindowColormap( Window w, Colormap colormap) { + (void)display; + (void)w; + (void)colormap; + return Success; } @@ -348,6 +444,15 @@ XTranslateCoordinates( int *dest_y_return, Window *child_return) { + (void)display; + (void)src_w; + (void)dest_w; + (void)src_x; + (void)src_y; + (void)dest_x_return; + (void)dest_y_return; + (void)child_return; + return 0; } @@ -358,6 +463,11 @@ XWindowEvent( long event_mask, XEvent *event_return) { + (void)display; + (void)w; + (void)event_mask; + (void)event_return; + return Success; } @@ -367,6 +477,10 @@ XWithdrawWindow( Window w, int screen_number) { + (void)display; + (void)w; + (void)screen_number; + return Success; } @@ -379,6 +493,13 @@ XmbLookupString( KeySym *keysym_return, Status *status_return) { + (void)ic; + (void)event; + (void)buffer_return; + (void)bytes_buffer; + (void)keysym_return; + (void)status_return; + return Success; } @@ -389,7 +510,7 @@ XGetWindowProperty( Atom property, long long_offset, long long_length, - Bool delete, + Bool del, Atom req_type, Atom *actual_type_return, int *actual_format_return, @@ -397,6 +518,14 @@ XGetWindowProperty( unsigned long *bytes_after_return, unsigned char **prop_return) { + (void)display; + (void)w; + (void)property; + (void)long_offset; + (void)long_length; + (void)del; + (void)req_type; + *actual_type_return = None; *actual_format_return = 0; *nitems_return = 0; @@ -413,6 +542,8 @@ int XFlush( Display *display) { + (void)display; + return 0; } @@ -420,6 +551,8 @@ int XGrabServer( Display *display) { + (void)display; + return 0; } @@ -427,6 +560,8 @@ int XUngrabServer( Display *display) { + (void)display; + return 0; } @@ -453,6 +588,8 @@ XSynchronize( Display *display, Bool onoff) { + (void)onoff; + display->request++; return NULL; } @@ -462,6 +599,8 @@ XSync( Display *display, Bool discard) { + (void)discard; + display->request++; return 0; } @@ -472,3 +611,16 @@ XVisualIDFromVisual( { return visual->visualid; } + +int +XOffsetRegion( + Region rgn, + int dx, + int dy) +{ + (void)rgn; + (void)dx; + (void)dy; + + return 0; +} diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 7967a61..1e1403f 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -654,8 +654,8 @@ TkpGetFontFamilies( static int CALLBACK WinFontFamilyEnumProc( ENUMLOGFONTW *lfPtr, /* Logical-font data. */ - NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */ - int fontType, /* Type of font (not used). */ + TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */ + TCL_UNUSED(int), /* Type of font (not used). */ LPARAM lParam) /* Result object to hold result. */ { WCHAR *faceName = lfPtr->elfLogFont.lfFaceName; @@ -1016,7 +1016,7 @@ TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ - int numBytes, /* Maximum number of bytes to consider from + TCL_UNUSED(int), /* Maximum number of bytes to consider from * source string in all. */ int rangeStart, /* Index of first byte to measure. */ int rangeLength, /* Length of range to measure in bytes. */ @@ -1038,8 +1038,6 @@ TkpMeasureCharsInContext( int *lengthPtr) /* Filled with x-location just after the * terminating character. */ { - (void) numBytes; /*unused*/ - return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength, maxLength, flags, lengthPtr); } @@ -1065,7 +1063,7 @@ Tk_DrawChars( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ - Tk_Font tkfont, /* Font in which characters will be drawn; + TCL_UNUSED(Tk_Font), /* Font in which characters will be drawn; * must be the same as font used in GC. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters @@ -1212,7 +1210,7 @@ TkDrawAngledChars( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ - Tk_Font tkfont, /* Font in which characters will be drawn; + TCL_UNUSED(Tk_Font), /* Font in which characters will be drawn; * must be the same as font used in GC. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters @@ -1390,7 +1388,7 @@ TkpDrawCharsInContext( * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ - int numBytes, /* Number of bytes in string. */ + TCL_UNUSED(int), /* Number of bytes in string. */ int rangeStart, /* Index of first byte to draw. */ int rangeLength, /* Length of range to draw in bytes. */ int x, int y) /* Coordinates at which to place origin of the @@ -1398,7 +1396,6 @@ TkpDrawCharsInContext( * drawing. */ { int widthUntilStart; - (void) numBytes; /*unused*/ Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart); Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart, @@ -1498,9 +1495,9 @@ MultiFontTextOut( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); - familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y, + familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y, (WCHAR *)Tcl_DStringValue(&runString), - Tcl_DStringLength(&runString)>>familyPtr->isWideFont); + Tcl_DStringLength(&runString) >> familyPtr->isWideFont); familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, @@ -1520,7 +1517,7 @@ MultiFontTextOut( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); - familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y, + familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); Tcl_DStringFree(&runString); @@ -1771,7 +1768,7 @@ AllocFontFamily( HDC hdc, /* HDC in which font can be selected. */ HFONT hFont, /* Screen font whose FontFamily is to be * returned. */ - int base) /* Non-zero if this font family is to be used + TCL_UNUSED(int)) /* Non-zero if this font family is to be used * in the base font of a font object. */ { Tk_Uid faceName; @@ -2069,8 +2066,8 @@ FindSubFontForChar( static int CALLBACK WinFontCanUseProc( ENUMLOGFONTW *lfPtr, /* Logical-font data. */ - NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */ - int fontType, /* Type of font (not used). */ + TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */ + TCL_UNUSED(int), /* Type of font (not used). */ LPARAM lParam) /* Result object to hold result. */ { int ch; @@ -2606,10 +2603,10 @@ FamilyOrAliasExists( static int CALLBACK WinFontExistProc( - ENUMLOGFONTW *lfPtr, /* Logical-font data. */ - NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */ - int fontType, /* Type of font (not used). */ - LPARAM lParam) /* EnumFontData to hold result. */ + TCL_UNUSED(ENUMLOGFONTW *), /* Logical-font data. */ + TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */ + TCL_UNUSED(int), /* Type of font (not used). */ + TCL_UNUSED(LPARAM)) /* EnumFontData to hold result. */ { return 0; } diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 6c55164..67894c7 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -1689,7 +1689,7 @@ GetTearoffEntryGeometry( (void)mePtr; (void)tkfont; - if (menuPtr->menuType != MASTER_MENU) { + if (menuPtr->menuType != MAIN_MENU) { *heightPtr = 0; } else { *heightPtr = fmPtr->linespace; @@ -2597,7 +2597,7 @@ DrawTearoffEntry( (void)tkfont; (void)fmPtr; - if (menuPtr->menuType != MASTER_MENU) { + if (menuPtr->menuType != MAIN_MENU) { return; } diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 9829af5..4311b09 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -91,11 +91,15 @@ * See ticket [916c1095438eae56]: GetVersionExW triggers warnings */ #if defined(_MSC_VER) +# pragma warning(disable:4146) # pragma warning(disable:4267) # pragma warning(disable:4244) # pragma warning(disable:4311) # pragma warning(disable:4312) # pragma warning(disable:4996) +#if !defined(_WIN64) +# pragma warning(disable:4305) +#endif #endif /* @@ -125,11 +129,4 @@ #define TkpCreateNativeBitmap(display, source) None #define TkpGetNativeAppBitmap(display, name, w, h) None -/* - * Other functions not used under Windows - */ - -#define TkpWillDrawWidget(tkwin) 0 -#define TkpRedrawWidget(tkwin) - #endif /* _WINPORT */ diff --git a/win/tkWinWm.c b/win/tkWinWm.c index f7ba611..ff83ad2 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -57,8 +57,8 @@ typedef struct ProtocolHandler { /* Next in list of protocol handlers for the * same top-level window, or NULL for end of * list. */ - Tcl_Interp *interp; /* Interpreter in which to invoke command. */ - char command[1]; /* Tcl command to invoke when a client message + Tcl_Interp *interp; /* Interpreter in which to invoke command. */ + char command[TKFLEXARRAY]; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE @@ -177,7 +177,7 @@ typedef struct TkWmInfo { * (corresponds to hints.window_group). * Malloc-ed. Note: this field doesn't get * updated if leader is destroyed. */ - TkWindow *masterPtr; /* Master window for TRANSIENT_FOR property, + TkWindow *containerPtr; /* Container window for TRANSIENT_FOR property, * or NULL. */ Tk_Window icon; /* Window to use as icon for this window, or * NULL. */ @@ -315,7 +315,7 @@ typedef struct TkWmInfo { * window (controlled by "wm resizable" command). * WM_WITHDRAWN - Non-zero means that this window has explicitly * been withdrawn. If it's a transient, it should - * not mirror state changes in the master. + * not mirror state changes in the container. * WM_FULLSCREEN - Non-zero means that this window has been placed * in the full screen mode. It should be mapped at * 0,0 and be the width and height of the screen. @@ -2054,7 +2054,7 @@ UpdateWrapper( */ parentHWND = GetDesktopWindow(); - if (wmPtr->masterPtr) { + if (wmPtr->containerPtr) { wmPtr->style |= WS_CHILD; } else { wmPtr->style |= WS_POPUP; @@ -2062,10 +2062,10 @@ UpdateWrapper( } else if (wmPtr->flags & WM_FULLSCREEN) { wmPtr->style = WM_FULLSCREEN_STYLE; wmPtr->exStyle = EX_FULLSCREEN_STYLE; - } else if (wmPtr->masterPtr) { + } else if (wmPtr->containerPtr) { wmPtr->style = WM_TRANSIENT_STYLE; wmPtr->exStyle = EX_TRANSIENT_STYLE; - parentHWND = Tk_GetHWND(Tk_WindowId(wmPtr->masterPtr)); + parentHWND = Tk_GetHWND(Tk_WindowId(wmPtr->containerPtr)); if (! ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) && (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE))) { wmPtr->style |= WS_THICKFRAME; @@ -2204,7 +2204,7 @@ UpdateWrapper( if (wmPtr->numTransients > 0) { /* * Unset the current wrapper as the parent for all transient - * children for whom this is the master + * children for whom this is the container */ WmInfo *wmPtr2; @@ -2213,7 +2213,7 @@ UpdateWrapper( state = 0; for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; wmPtr2 = wmPtr2->nextPtr) { - if (wmPtr2->masterPtr == winPtr + if (wmPtr2->containerPtr == winPtr && !(wmPtr2->flags & WM_NEVER_MAPPED)) { childStateInfo[state++] = wmPtr2->hints.initial_state; SetParent(TkWinGetHWND(wmPtr2->winPtr->window), NULL); @@ -2292,7 +2292,7 @@ UpdateWrapper( if (childStateInfo) { if (wmPtr->numTransients > 0) { /* - * Reset all transient children for whom this is the master. + * Reset all transient children for whom this is the container. */ WmInfo *wmPtr2; @@ -2300,7 +2300,7 @@ UpdateWrapper( state = 0; for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; wmPtr2 = wmPtr2->nextPtr) { - if (wmPtr2->masterPtr == winPtr + if (wmPtr2->containerPtr == winPtr && !(wmPtr2->flags & WM_NEVER_MAPPED)) { UpdateWrapper(wmPtr2->winPtr); TkpWmSetState(wmPtr2->winPtr, childStateInfo[state++]); @@ -2365,10 +2365,10 @@ TkWmMapWindow( if (wmPtr->flags & WM_NEVER_MAPPED) { /* - * Don't map a transient if the master is not mapped. + * Don't map a transient if the container is not mapped. */ - if (wmPtr->masterPtr != NULL && !Tk_IsMapped(wmPtr->masterPtr)) { + if (wmPtr->containerPtr != NULL && !Tk_IsMapped(wmPtr->containerPtr)) { wmPtr->hints.initial_state = WithdrawnState; return; } @@ -2610,17 +2610,17 @@ TkWmDeadWindow( } /* - * Reset all transient windows whose master is the dead window. + * Reset all transient windows whose container is the dead window. */ for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; wmPtr2 = wmPtr2->nextPtr) { - if (wmPtr2->masterPtr == winPtr) { + if (wmPtr2->containerPtr == winPtr) { wmPtr->numTransients--; - Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr, + Tk_DeleteEventHandler((Tk_Window) wmPtr2->containerPtr, VisibilityChangeMask|StructureNotifyMask, WmWaitVisibilityOrMapProc, wmPtr2->winPtr); - wmPtr2->masterPtr = NULL; + wmPtr2->containerPtr = NULL; if ((wmPtr2->wrapper != NULL) && !(wmPtr2->flags & (WM_NEVER_MAPPED))) { UpdateWrapper(wmPtr2->winPtr); @@ -2670,20 +2670,20 @@ TkWmDeadWindow( if (wmPtr->flags & WM_UPDATE_PENDING) { Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr); } - if (wmPtr->masterPtr != NULL) { - wmPtr2 = wmPtr->masterPtr->wmInfoPtr; + if (wmPtr->containerPtr != NULL) { + wmPtr2 = wmPtr->containerPtr->wmInfoPtr; /* - * If we had a master, tell them that we aren't tied to them anymore. + * If we had a container, tell them that we aren't tied to them anymore. */ if (wmPtr2 != NULL) { wmPtr2->numTransients--; } - Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr, + Tk_DeleteEventHandler((Tk_Window) wmPtr->containerPtr, VisibilityChangeMask|StructureNotifyMask, WmWaitVisibilityOrMapProc, winPtr); - wmPtr->masterPtr = NULL; + wmPtr->containerPtr = NULL; } if (wmPtr->crefObj != NULL) { Tcl_DecrRefCount(wmPtr->crefObj); @@ -4154,7 +4154,7 @@ WmIconifyCmd( NULL); return TCL_ERROR; } - if (wmPtr->masterPtr != NULL) { + if (wmPtr->containerPtr != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": it is a transient", winPtr->pathName)); @@ -5403,7 +5403,7 @@ WmStateCmd( "OVERRIDE_REDIRECT", NULL); return TCL_ERROR; } - if (wmPtr->masterPtr != NULL) { + if (wmPtr->containerPtr != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": it is a transient", winPtr->pathName)); @@ -5549,7 +5549,7 @@ WmTransientCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - TkWindow *masterPtr = wmPtr->masterPtr, **masterPtrPtr = &masterPtr, *w; + TkWindow *containerPtr = wmPtr->containerPtr, **containerPtrPtr = &containerPtr, *w; WmInfo *wmPtr2; if ((objc != 3) && (objc != 4)) { @@ -5557,38 +5557,38 @@ WmTransientCmd( return TCL_ERROR; } if (objc == 3) { - if (masterPtr != NULL) { - Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) masterPtr)); + if (containerPtr != NULL) { + Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) containerPtr)); } return TCL_OK; } if (Tcl_GetString(objv[3])[0] == '\0') { - if (masterPtr != NULL) { + if (containerPtr != NULL) { /* - * If we had a master, tell them that we aren't tied to them + * If we had a container, tell them that we aren't tied to them * anymore. */ - masterPtr->wmInfoPtr->numTransients--; - Tk_DeleteEventHandler((Tk_Window) masterPtr, + containerPtr->wmInfoPtr->numTransients--; + Tk_DeleteEventHandler((Tk_Window) containerPtr, VisibilityChangeMask|StructureNotifyMask, WmWaitVisibilityOrMapProc, winPtr); } - wmPtr->masterPtr = NULL; + wmPtr->containerPtr = NULL; } else { if (TkGetWindowFromObj(interp, tkwin, objv[3], - (Tk_Window *) masterPtrPtr) != TCL_OK) { + (Tk_Window *) containerPtrPtr) != TCL_OK) { return TCL_ERROR; } - while (!Tk_TopWinHierarchy(masterPtr)) { + while (!Tk_TopWinHierarchy(containerPtr)) { /* - * Ensure that the master window is actually a Tk toplevel. + * Ensure that the container window is actually a Tk toplevel. */ - masterPtr = masterPtr->parentPtr; + containerPtr = containerPtr->parentPtr; } - Tk_MakeWindowExist((Tk_Window) masterPtr); + Tk_MakeWindowExist((Tk_Window) containerPtr); if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -5598,7 +5598,7 @@ WmTransientCmd( return TCL_ERROR; } - wmPtr2 = masterPtr->wmInfoPtr; + wmPtr2 = containerPtr->wmInfoPtr; if (wmPtr2->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -5607,42 +5607,42 @@ WmTransientCmd( Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } - for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL; - w = (TkWindow *)w->wmInfoPtr->masterPtr) { + for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; + w = (TkWindow *)w->wmInfoPtr->containerPtr) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "setting \"%s\" as master creates a transient/master cycle", - Tk_PathName(masterPtr))); + Tk_PathName(containerPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } } - if (masterPtr != wmPtr->masterPtr) { + if (containerPtr != wmPtr->containerPtr) { /* - * Remove old master map/unmap binding before setting the new - * master. The event handler will ensure that transient states - * reflect the state of the master. + * Remove old container map/unmap binding before setting the new + * container. The event handler will ensure that transient states + * reflect the state of the container. */ - if (wmPtr->masterPtr != NULL) { - wmPtr->masterPtr->wmInfoPtr->numTransients--; - Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr, + if (wmPtr->containerPtr != NULL) { + wmPtr->containerPtr->wmInfoPtr->numTransients--; + Tk_DeleteEventHandler((Tk_Window) wmPtr->containerPtr, VisibilityChangeMask|StructureNotifyMask, WmWaitVisibilityOrMapProc, winPtr); } - masterPtr->wmInfoPtr->numTransients++; - Tk_CreateEventHandler((Tk_Window) masterPtr, + containerPtr->wmInfoPtr->numTransients++; + Tk_CreateEventHandler((Tk_Window) containerPtr, VisibilityChangeMask|StructureNotifyMask, WmWaitVisibilityOrMapProc, winPtr); - wmPtr->masterPtr = masterPtr; + wmPtr->containerPtr = containerPtr; } } if (!((wmPtr->flags & WM_NEVER_MAPPED) && !(winPtr->flags & TK_EMBEDDED))) { - if (wmPtr->masterPtr != NULL - && !Tk_IsMapped(wmPtr->masterPtr)) { + if (wmPtr->containerPtr != NULL + && !Tk_IsMapped(wmPtr->containerPtr)) { TkpWmSetState(winPtr, WithdrawnState); } else { UpdateWrapper(winPtr); @@ -5728,9 +5728,9 @@ WmWaitVisibilityOrMapProc( XEvent *eventPtr) /* Information about event. */ { TkWindow *winPtr = (TkWindow *)clientData; - TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr; + TkWindow *containerPtr = winPtr->wmInfoPtr->containerPtr; - if (masterPtr == NULL) + if (containerPtr == NULL) return; if (eventPtr->type == MapNotify) { @@ -5742,7 +5742,7 @@ WmWaitVisibilityOrMapProc( } if (eventPtr->type == VisibilityNotify) { - int state = masterPtr->wmInfoPtr->hints.initial_state; + int state = containerPtr->wmInfoPtr->hints.initial_state; if ((state == NormalState) || (state == ZoomState)) { state = winPtr->wmInfoPtr->hints.initial_state; diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index b0468fd..bd066fc 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -686,8 +686,8 @@ TTK_LAYOUT("TButton", TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Combobox.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Combobox.focus", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, + TTK_GROUP("Combobox.focus", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 436fe00..22b371c 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -923,8 +923,8 @@ TTK_LAYOUT("TButton", TTK_LAYOUT("TMenubutton", TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Menubutton.button", TTK_PACK_RIGHT|TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.button", TTK_FILL_BOTH, + TTK_GROUP("Menubutton.padding", TTK_FILL_X, TTK_NODE("Menubutton.label", 0)))) TTK_LAYOUT("Horizontal.TScrollbar", @@ -942,14 +942,14 @@ TTK_LAYOUT("Vertical.TScrollbar", TTK_NODE("Vertical.Scrollbar.grip", 0)))) TTK_LAYOUT("Horizontal.TScale", - TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Horizontal.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Scale.focus", TTK_FILL_BOTH, + TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Scale.track", TTK_FILL_X) TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) ))) TTK_LAYOUT("Vertical.TScale", - TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Vertical.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Scale.focus", TTK_FILL_BOTH, + TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Scale.track", TTK_FILL_Y) TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) ))) diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h index 91aab57..1977939 100644 --- a/xlib/X11/Xlib.h +++ b/xlib/X11/Xlib.h @@ -331,7 +331,7 @@ typedef struct _XImage { unsigned long blue_mask; XPointer obdata; /* hook for the object routines to hang on */ #if defined(MAC_OSX_TK) - int pixelpower; /* n such that pixels are 2^n x 2^n blocks*/ + int pixelpower; /* No longer used. */ #endif struct funcs { /* image manipulation routines */ struct _XImage *(*create_image)(); @@ -16,7 +16,6 @@ #if !defined(MAC_OSX_TK) # include <X11/Xlib.h> -# define gcCacheSize 0 # define TkpInitGCCache(gc) # define TkpFreeGCCache(gc) # define TkpGetGCCache(gc) @@ -26,11 +25,19 @@ # include <X11/X.h> # define Cursor XCursor # define Region XRegion -# define gcCacheSize sizeof(TkpGCCache) #endif #undef TkSetRegion +#define MAX_DASH_LIST_SIZE 10 +typedef struct { + XGCValues gc; + char dash[MAX_DASH_LIST_SIZE]; +#ifdef MAC_OSX_TK + TkpGCCache cache; +#endif +} XGCValuesWithCache; + /* *---------------------------------------------------------------------- * @@ -51,12 +58,8 @@ static TkpClipMask *AllocClipMask(GC gc) { TkpClipMask *clip_mask = (TkpClipMask*) gc->clip_mask; if (clip_mask == NULL) { - clip_mask = ckalloc(sizeof(TkpClipMask)); + clip_mask = (TkpClipMask *)ckalloc(sizeof(TkpClipMask)); gc->clip_mask = (Pixmap) clip_mask; -#ifdef MAC_OSX_TK - } else if (clip_mask->type == TKP_CLIP_REGION) { - TkpReleaseRegion(clip_mask->value.region); -#endif } return clip_mask; } @@ -79,12 +82,7 @@ static TkpClipMask *AllocClipMask(GC gc) { static void FreeClipMask(GC gc) { if (gc->clip_mask != None) { -#ifdef MAC_OSX_TK - if (((TkpClipMask*) gc->clip_mask)->type == TKP_CLIP_REGION) { - TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region); - } -#endif - ckfree(gc->clip_mask); + ckfree((char *)gc->clip_mask); gc->clip_mask = None; } } @@ -113,6 +111,7 @@ XCreateGC( XGCValues *values) { GC gp; + (void)d; /* * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars @@ -121,9 +120,7 @@ XCreateGC( * initialization. */ -#define MAX_DASH_LIST_SIZE 10 - - gp = ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize); + gp = (GC)ckalloc(sizeof(XGCValuesWithCache)); if (!gp) { return NULL; } @@ -144,11 +141,11 @@ XCreateGC( InitField(fill_style, GCFillStyle, FillSolid); InitField(fill_rule, GCFillRule, WindingRule); InitField(arc_mode, GCArcMode, ArcPieSlice); - InitField(tile, GCTile, None); - InitField(stipple, GCStipple, None); + InitField(tile, GCTile, 0); + InitField(stipple, GCStipple, 0); InitField(ts_x_origin, GCTileStipXOrigin, 0); InitField(ts_y_origin, GCTileStipYOrigin, 0); - InitField(font, GCFont, None); + InitField(font, GCFont, 0); InitField(subwindow_mode, GCSubwindowMode, ClipByChildren); InitField(graphics_exposures, GCGraphicsExposures, True); InitField(clip_x_origin, GCClipXOrigin, 0); @@ -186,8 +183,7 @@ XCreateGC( TkpGCCache* TkpGetGCCache(GC gc) { - return (gc ? (TkpGCCache*)(((char*) gc) + sizeof(XGCValues) + - MAX_DASH_LIST_SIZE) : NULL); + return (gc ? &((XGCValuesWithCache *)gc)->cache : NULL); } #endif @@ -268,6 +264,8 @@ int XFreeGC( Display *d, GC gc) { + (void)d; + if (gc != NULL) { FreeClipMask(gc); TkpFreeGCCache(gc); @@ -299,6 +297,8 @@ XSetForeground( GC gc, unsigned long foreground) { + (void)display; + gc->foreground = foreground; return Success; } @@ -309,6 +309,8 @@ XSetBackground( GC gc, unsigned long background) { + (void)display; + gc->background = background; return Success; } @@ -322,6 +324,7 @@ XSetDashes( int n) { char *p = &(gc->dashes); + (void)display; #ifdef TkWinDeleteBrush TkWinDeleteBrush(gc->fgBrush); @@ -344,6 +347,8 @@ XSetFunction( GC gc, int function) { + (void)display; + gc->function = function; return Success; } @@ -354,6 +359,8 @@ XSetFillRule( GC gc, int fill_rule) { + (void)display; + gc->fill_rule = fill_rule; return Success; } @@ -364,6 +371,8 @@ XSetFillStyle( GC gc, int fill_style) { + (void)display; + gc->fill_style = fill_style; return Success; } @@ -374,6 +383,8 @@ XSetTSOrigin( GC gc, int x, int y) { + (void)display; + gc->ts_x_origin = x; gc->ts_y_origin = y; return Success; @@ -385,6 +396,8 @@ XSetFont( GC gc, Font font) { + (void)display; + gc->font = font; return Success; } @@ -395,6 +408,8 @@ XSetArcMode( GC gc, int arc_mode) { + (void)display; + gc->arc_mode = arc_mode; return Success; } @@ -405,6 +420,8 @@ XSetStipple( GC gc, Pixmap stipple) { + (void)display; + gc->stipple = stipple; return Success; } @@ -418,6 +435,8 @@ XSetLineAttributes( int cap_style, int join_style) { + (void)display; + gc->line_width = line_width; gc->line_style = line_style; gc->cap_style = cap_style; @@ -432,6 +451,8 @@ XSetClipOrigin( int clip_x_origin, int clip_y_origin) { + (void)display; + gc->clip_x_origin = clip_x_origin; gc->clip_y_origin = clip_y_origin; return Success; @@ -464,6 +485,8 @@ TkSetRegion( GC gc, TkRegion r) { + (void)display; + if (r == NULL) { Tcl_Panic("must not pass NULL to TkSetRegion for compatibility with X11; use XSetClipMask instead"); } else { @@ -471,9 +494,6 @@ TkSetRegion( clip_mask->type = TKP_CLIP_REGION; clip_mask->value.region = r; -#ifdef MAC_OSX_TK - TkpRetainRegion(r); -#endif } return Success; } @@ -484,6 +504,8 @@ XSetClipMask( GC gc, Pixmap pixmap) { + (void)display; + if (pixmap == None) { FreeClipMask(gc); } else { @@ -542,6 +564,7 @@ XDrawPoints( int mode) { int res = Success; + (void)mode; while (npoints-- > 0) { res = XDrawLine(display, d, gc, @@ -561,6 +584,12 @@ XDrawSegments( XSegment *segments, int nsegments) { + (void)display; + (void)d; + (void)gc; + (void)segments; + (void)nsegments; + return BadDrawable; } #endif @@ -572,6 +601,10 @@ XFetchBuffer( int *nbytes_return, int buffer) { + (void)display; + (void)nbytes_return; + (void)buffer; + return (char *) 0; } @@ -581,7 +614,11 @@ XFetchName( Window w, char **window_name_return) { - return (Status) 0; + (void)display; + (void)w; + (void)window_name_return; + + return Success; } Atom * @@ -590,32 +627,25 @@ XListProperties( Window w, int *num_prop_return) { + (void)display; + (void)w; + (void)num_prop_return; + return (Atom *) 0; } -void +int XMapRaised( Display *display, Window w) { -} + (void)display; + (void)w; -void -XPutImage( - Display *display, - Drawable d, - GC gc, - XImage *image, - int src_x, - int src_y, - int dest_x, - int dest_y, - unsigned int width, - unsigned int height) -{ + return Success; } -void +int XQueryTextExtents( Display *display, XID font_ID, @@ -626,9 +656,19 @@ XQueryTextExtents( int *font_descent_return, XCharStruct *overall_return) { + (void)display; + (void)font_ID; + (void)string; + (void)nchars; + (void)direction_return; + (void)font_ascent_return; + (void)font_descent_return; + (void)overall_return; + + return Success; } -void +int XReparentWindow( Display *display, Window w, @@ -636,29 +676,297 @@ XReparentWindow( int x, int y) { + (void)display; + (void)w; + (void)parent; + (void)x; + (void)y; + + return BadWindow; } -void -XRotateBuffers( +int +XUndefineCursor( Display *display, - int rotate) + Window w) +{ + (void)display; + (void)w; + + return Success; +} + +XVaNestedList +XVaCreateNestedList( + int unused, ...) +{ + (void)unused; + return NULL; +} + +char * +XSetICValues( + XIC xic, ...) +{ + (void)xic; + return NULL; +} + +char * +XGetICValues( + XIC xic, ...) { + (void)xic; + return NULL; } void -XStoreBuffer( +XSetICFocus( + XIC xic) +{ + (void)xic; +} + +Window +XCreateWindow( Display *display, - _Xconst char *bytes, - int nbytes, - int buffer) + Window parent, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned int border_width, + int depth, + unsigned int clazz, + Visual *visual, + unsigned long value_mask, + XSetWindowAttributes *attributes) +{ + (void)display; + (void)parent; + (void)x; + (void)y; + (void)width; + (void)height; + (void)border_width; + (void)depth; + (void)clazz; + (void)visual; + (void)value_mask; + (void)attributes; + + return 0; +} + +int +XPointInRegion( + Region rgn, + int x, + int y) +{ + (void)rgn; + (void)x; + (void)y; + + return 0; +} + +int +XUnionRegion( + Region srca, + Region srcb, + Region dr_return) { + (void)srca; + (void)srcb; + (void)dr_return; + + return 0; } +Region +XPolygonRegion( + XPoint *pts, + int n, + int rule) +{ + (void)pts; + (void)n; + (void)rule; + + return 0; +} +#endif + void -XUndefineCursor( +XDestroyIC( + XIC ic) +{ + (void)ic; +} + +Cursor +XCreatePixmapCursor( Display *display, - Window w) + Pixmap source, + Pixmap mask, + XColor *foreground_color, + XColor *background_color, + unsigned int x, + unsigned int y) +{ + (void)display; + (void)source; + (void)mask; + (void)foreground_color; + (void)background_color; + (void)x; + (void)y; + + return (Cursor) NULL; +} + +Cursor +XCreateGlyphCursor( + Display *display, + Font source_font, + Font mask_font, + unsigned int source_char, + unsigned int mask_char, + XColor _Xconst *foreground_color, + XColor _Xconst *background_color) { + (void)display; + (void)source_font; + (void)mask_font; + (void)source_char; + (void)mask_char; + (void)foreground_color; + (void)background_color; + + return (Cursor) NULL; +} + +#if 0 +XFontSet +XCreateFontSet( + Display *display /* display */, + _Xconst char *base_font_name_list /* base_font_name_list */, + char ***missing_charset_list /* missing_charset_list */, + int *missing_charset_count /* missing_charset_count */, + char **def_string /* def_string */ +) { + (void)display; + (void)base_font_name_list; + (void)missing_charset_list; + (void)missing_charset_count; + (void)def_string; + + return (XFontSet)0; +} + +void +XFreeFontSet( + Display *display, /* display */ + XFontSet fontset /* font_set */ +) { + (void)display; + (void)fontset; +} + +void +XFreeStringList( + char **list /* list */ +) { + (void)list; +} + +Status +XCloseIM( + XIM im /* im */ +) { + (void)im; + + return Success; +} + +Bool +XRegisterIMInstantiateCallback( + Display *dpy /* dpy */, + struct _XrmHashBucketRec *rdb /* rdb */, + char *res_name /* res_name */, + char *res_class /* res_class */, + XIDProc callback /* callback */, + XPointer client_data /* client_data */ +) { + (void)dpy; + (void)rdb; + (void)res_name; + (void)res_class; + (void)callback; + (void)client_data; + + return False; +} + +Bool +XUnregisterIMInstantiateCallback( + Display *dpy /* dpy */, + struct _XrmHashBucketRec *rdb /* rdb */, + char *res_name /* res_name */, + char *res_class /* res_class */, + XIDProc callback /* callback */, + XPointer client_data /* client_data */ +) { + (void)dpy; + (void)rdb; + (void)res_name; + (void)res_class; + (void)callback; + (void)client_data; + + return False; +} + +char * +XSetLocaleModifiers( + const char *modifier_list /* modifier_list */ +) { + (void)modifier_list; + + return NULL; +} + +XIM XOpenIM( + Display *dpy /* dpy */, + struct _XrmHashBucketRec *rdb /* rdb */, + char *res_name /* res_name */, + char *res_class /* res_class */ +) { + (void)dpy; + (void)rdb; + (void)res_name; + (void)res_class; + + return NULL; +} + +char * +XGetIMValues( + XIM im /* im */, ... +) { + (void)im; + + return NULL; +} + +char * +XSetIMValues( + XIM im /* im */, ... +) { + (void)im; + + return NULL; } #endif |