Import Tk 8.6.10
This commit is contained in:
@@ -35,6 +35,7 @@ bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
datarootdir = @datarootdir@
|
||||
runstatedir = @runstatedir@
|
||||
mandir = @mandir@
|
||||
|
||||
# The following definition can be set to non-null for special systems
|
||||
@@ -395,10 +396,11 @@ AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \
|
||||
tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \
|
||||
tkMacOSXDialog.o tkMacOSXDraw.o tkMacOSXEmbed.o tkMacOSXEntry.o \
|
||||
tkMacOSXEvent.o tkMacOSXFont.o tkMacOSXHLEvents.o tkMacOSXImage.o \
|
||||
tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o tkMacOSXMenu.o \
|
||||
tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o \
|
||||
tkMacOSXMenu.o \
|
||||
tkMacOSXMenubutton.o tkMacOSXMenus.o tkMacOSXMouseEvent.o \
|
||||
tkMacOSXNotify.o tkMacOSXRegion.o tkMacOSXScrlbr.o tkMacOSXSend.o \
|
||||
tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \
|
||||
tkMacOSXServices.o tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \
|
||||
tkMacOSXWm.o tkMacOSXXStubs.o \
|
||||
tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o tkUnixScale.o \
|
||||
xcolors.o xdraw.o xgc.o ximage.o xutil.o \
|
||||
@@ -521,10 +523,12 @@ AQUA_SRCS = \
|
||||
$(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXHLEvents.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXImage.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXInit.c $(MAC_OSX_DIR)/tkMacOSXKeyboard.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXKeyEvent.c $(MAC_OSX_DIR)/tkMacOSXMenu.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXKeyEvent.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXMenu.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXMenubutton.c $(MAC_OSX_DIR)/tkMacOSXMenus.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(MAC_OSX_DIR)/tkMacOSXNotify.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXRegion.c $(MAC_OSX_DIR)/tkMacOSXScrlbr.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXServices.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXSend.c $(MAC_OSX_DIR)/tkMacOSXSubwindows.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXTest.c $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c \
|
||||
$(MAC_OSX_DIR)/tkMacOSXWm.c $(MAC_OSX_DIR)/tkMacOSXXStubs.c \
|
||||
@@ -1313,6 +1317,9 @@ tkMacOSXScrlbr.o: $(MAC_OSX_DIR)/tkMacOSXScrlbr.c
|
||||
tkMacOSXSend.o: $(MAC_OSX_DIR)/tkMacOSXSend.c
|
||||
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSend.c
|
||||
|
||||
tkMacOSXServices.o: $(MAC_OSX_DIR)/tkMacOSXServices.c
|
||||
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXServices.c
|
||||
|
||||
tkMacOSXSubwindows.o: $(MAC_OSX_DIR)/tkMacOSXSubwindows.c
|
||||
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSubwindows.c
|
||||
|
||||
@@ -1564,7 +1571,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(M
|
||||
cp -p $(GENERIC_DIR)/*.decls $(DISTDIR)/generic
|
||||
cp -p $(GENERIC_DIR)/README $(DISTDIR)/generic
|
||||
cp -p $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog \
|
||||
$(TOP_DIR)/ChangeLog.2??? $(TOP_DIR)/README \
|
||||
$(TOP_DIR)/ChangeLog.2??? $(TOP_DIR)/README.md \
|
||||
$(TOP_DIR)/license.terms $(DISTDIR)
|
||||
rm -f $(DISTDIR)/generic/blt*.[ch]
|
||||
mkdir $(DISTDIR)/generic/ttk
|
||||
|
||||
@@ -6,11 +6,11 @@ versions of Tk. This directory also contains source files for Tk that are
|
||||
specific to UNIX.
|
||||
|
||||
The information in this file is maintained at:
|
||||
http://www.tcl.tk/doc/howto/compile.html
|
||||
https://www.tcl-lang.org//doc/howto/compile.html
|
||||
|
||||
For information on platforms where Tcl/Tk is known to compile, along with any
|
||||
porting notes for getting it to work on those platforms, see:
|
||||
http://www.tcl.tk/software/tcltk/platforms.html
|
||||
https://www.tcl-lang.org//software/tcltk/platforms.html
|
||||
|
||||
The rest of this file contains instructions on how to do this. The release
|
||||
should compile and run either "out of the box" or with trivial changes on any
|
||||
|
||||
32
unix/configure
vendored
32
unix/configure
vendored
@@ -1338,7 +1338,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
TK_VERSION=8.6
|
||||
TK_MAJOR_VERSION=8
|
||||
TK_MINOR_VERSION=6
|
||||
TK_PATCH_LEVEL=".9"
|
||||
TK_PATCH_LEVEL=".10"
|
||||
VERSION=${TK_VERSION}
|
||||
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
|
||||
|
||||
@@ -1415,7 +1415,6 @@ echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >
|
||||
for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
|
||||
`ls -d /Library/Frameworks 2>/dev/null` \
|
||||
`ls -d /Network/Library/Frameworks 2>/dev/null` \
|
||||
`ls -d /System/Library/Frameworks 2>/dev/null` \
|
||||
; do
|
||||
if test -f "$i/Tcl.framework/tclConfig.sh" ; then
|
||||
ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
|
||||
@@ -1432,6 +1431,7 @@ echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >
|
||||
`ls -d /usr/local/lib 2>/dev/null` \
|
||||
`ls -d /usr/contrib/lib 2>/dev/null` \
|
||||
`ls -d /usr/pkg/lib 2>/dev/null` \
|
||||
`ls -d /usr/lib/tcl8.6 2>/dev/null` \
|
||||
`ls -d /usr/lib 2>/dev/null` \
|
||||
`ls -d /usr/lib64 2>/dev/null` \
|
||||
`ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
|
||||
@@ -4294,6 +4294,9 @@ echo "$as_me: WARNING: can't find uname command" >&2;}
|
||||
if test "`uname -s`" = "AIX" ; then
|
||||
tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
|
||||
fi
|
||||
if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
|
||||
tcl_cv_sys_version=NetBSD-Debian
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -5682,13 +5685,6 @@ fi
|
||||
SHLIB_SUFFIX=".dylib"
|
||||
DL_OBJS="tclLoadDyld.o"
|
||||
DL_LIBS=""
|
||||
# Don't use -prebind when building for Mac OS X 10.4 or later only:
|
||||
if test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \
|
||||
"`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then
|
||||
|
||||
LDFLAGS="$LDFLAGS -prebind"
|
||||
fi
|
||||
|
||||
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
|
||||
echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5
|
||||
echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6
|
||||
@@ -9461,7 +9457,7 @@ ac_x_header_dirs='
|
||||
/usr/openwin/share/include'
|
||||
|
||||
if test "$ac_x_includes" = no; then
|
||||
# Guess where to find include files, by looking for Intrinsic.h.
|
||||
# Guess where to find include files, by looking for Xlib.h.
|
||||
# First, try using that file with no special directory specified.
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
@@ -9469,7 +9465,7 @@ _ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/Xlib.h>
|
||||
_ACEOF
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
|
||||
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
|
||||
@@ -9496,7 +9492,7 @@ else
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
for ac_dir in $ac_x_header_dirs; do
|
||||
if test -r "$ac_dir/X11/Intrinsic.h"; then
|
||||
if test -r "$ac_dir/X11/Xlib.h"; then
|
||||
ac_x_includes=$ac_dir
|
||||
break
|
||||
fi
|
||||
@@ -9510,18 +9506,18 @@ if test "$ac_x_libraries" = no; then
|
||||
# See if we find them without any special options.
|
||||
# Don't add to $LIBS permanently.
|
||||
ac_save_LIBS=$LIBS
|
||||
LIBS="-lXt $LIBS"
|
||||
LIBS="-lX11 $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/Xlib.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
XtMalloc (0)
|
||||
XrmInitialize ()
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -10013,8 +10009,8 @@ echo "${ECHO_T}$enable_xft" >&6
|
||||
XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no"
|
||||
if test "$found_xft" = "no" ; then
|
||||
found_xft=yes
|
||||
XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no"
|
||||
XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no"
|
||||
XFT_CFLAGS=`pkg-config --cflags xft fontconfig 2>/dev/null` || found_xft="no"
|
||||
XFT_LIBS=`pkg-config --libs xft fontconfig 2>/dev/null` || found_xft="no"
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $found_xft" >&5
|
||||
echo "${ECHO_T}$found_xft" >&6
|
||||
@@ -10938,7 +10934,7 @@ if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
|
||||
TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
|
||||
fi
|
||||
|
||||
TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
|
||||
test -z "$TK_LIBRARY" && TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
|
||||
PRIVATE_INCLUDE_DIR='$(includedir)'
|
||||
HTML_DIR='$(DISTDIR)/html'
|
||||
TK_PKG_DIR='tk$(VERSION)'
|
||||
|
||||
@@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [
|
||||
TK_VERSION=8.6
|
||||
TK_MAJOR_VERSION=8
|
||||
TK_MINOR_VERSION=6
|
||||
TK_PATCH_LEVEL=".9"
|
||||
TK_PATCH_LEVEL=".10"
|
||||
VERSION=${TK_VERSION}
|
||||
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
|
||||
|
||||
@@ -470,8 +470,8 @@ if test $tk_aqua = no; then
|
||||
XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no"
|
||||
if test "$found_xft" = "no" ; then
|
||||
found_xft=yes
|
||||
XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no"
|
||||
XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no"
|
||||
XFT_CFLAGS=`pkg-config --cflags xft fontconfig 2>/dev/null` || found_xft="no"
|
||||
XFT_LIBS=`pkg-config --libs xft fontconfig 2>/dev/null` || found_xft="no"
|
||||
fi
|
||||
AC_MSG_RESULT([$found_xft])
|
||||
dnl make sure that compiling against Xft header file doesn't bomb
|
||||
@@ -663,7 +663,7 @@ if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
|
||||
TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
|
||||
fi
|
||||
|
||||
TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
|
||||
test -z "$TK_LIBRARY" && TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
|
||||
PRIVATE_INCLUDE_DIR='$(includedir)'
|
||||
HTML_DIR='$(DISTDIR)/html'
|
||||
TK_PKG_DIR='tk$(VERSION)'
|
||||
|
||||
@@ -92,12 +92,20 @@ case $ManPage in
|
||||
exit 2 ;;
|
||||
esac
|
||||
|
||||
Name=`basename $ManPage .$Section`
|
||||
SrcDir=`dirname $ManPage`
|
||||
|
||||
########################################################################
|
||||
### Process Page to Create Target Pages
|
||||
###
|
||||
|
||||
Specials="FindPhoto FontId MeasureChar"
|
||||
for n in $Specials; do
|
||||
if [ "$Name" = "$n" ] ; then
|
||||
Names="$n $Names"
|
||||
fi
|
||||
done
|
||||
|
||||
First=""
|
||||
for Target in $Names; do
|
||||
Target=$Target.$Section$Suffix
|
||||
@@ -106,7 +114,7 @@ for Target in $Names; do
|
||||
First=$Target
|
||||
sed -e "/man\.macros/r $SrcDir/man.macros" -e "/man\.macros/d" \
|
||||
$ManPage > $Dir/$First
|
||||
chmod 444 $Dir/$First
|
||||
chmod 644 $Dir/$First
|
||||
$Gzip $Dir/$First
|
||||
else
|
||||
ln $SymOrLoc$First$Gz $Dir/$Target$Gz
|
||||
|
||||
49
unix/tcl.m4
49
unix/tcl.m4
@@ -77,7 +77,6 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
|
||||
for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
|
||||
`ls -d /Library/Frameworks 2>/dev/null` \
|
||||
`ls -d /Network/Library/Frameworks 2>/dev/null` \
|
||||
`ls -d /System/Library/Frameworks 2>/dev/null` \
|
||||
; do
|
||||
if test -f "$i/Tcl.framework/tclConfig.sh" ; then
|
||||
ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
|
||||
@@ -94,6 +93,7 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
|
||||
`ls -d /usr/local/lib 2>/dev/null` \
|
||||
`ls -d /usr/contrib/lib 2>/dev/null` \
|
||||
`ls -d /usr/pkg/lib 2>/dev/null` \
|
||||
`ls -d /usr/lib/tcl8.6 2>/dev/null` \
|
||||
`ls -d /usr/lib 2>/dev/null` \
|
||||
`ls -d /usr/lib64 2>/dev/null` \
|
||||
`ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
|
||||
@@ -210,7 +210,6 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
|
||||
for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
|
||||
`ls -d /Library/Frameworks 2>/dev/null` \
|
||||
`ls -d /Network/Library/Frameworks 2>/dev/null` \
|
||||
`ls -d /System/Library/Frameworks 2>/dev/null` \
|
||||
; do
|
||||
if test -f "$i/Tk.framework/tkConfig.sh" ; then
|
||||
ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
|
||||
@@ -227,6 +226,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
|
||||
`ls -d /usr/local/lib 2>/dev/null` \
|
||||
`ls -d /usr/contrib/lib 2>/dev/null` \
|
||||
`ls -d /usr/pkg/lib 2>/dev/null` \
|
||||
`ls -d /usr/lib/tk8.6 2>/dev/null` \
|
||||
`ls -d /usr/lib 2>/dev/null` \
|
||||
`ls -d /usr/lib64 2>/dev/null` \
|
||||
`ls -d /usr/local/lib/tk8.6 2>/dev/null` \
|
||||
@@ -928,6 +928,9 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [
|
||||
if test "`uname -s`" = "AIX" ; then
|
||||
tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
|
||||
fi
|
||||
if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
|
||||
tcl_cv_sys_version=NetBSD-Debian
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
@@ -1602,10 +1605,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
|
||||
SHLIB_SUFFIX=".dylib"
|
||||
DL_OBJS="tclLoadDyld.o"
|
||||
DL_LIBS=""
|
||||
# Don't use -prebind when building for Mac OS X 10.4 or later only:
|
||||
AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
|
||||
"`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
|
||||
LDFLAGS="$LDFLAGS -prebind"])
|
||||
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
|
||||
AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
|
||||
tcl_cv_ld_search_paths_first, [
|
||||
@@ -2683,7 +2682,20 @@ AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
|
||||
AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [
|
||||
# Avoids picking hidden internal symbol from libc
|
||||
SC_TCL_GETHOSTBYADDR_R_DECL
|
||||
|
||||
if test "$tcl_cv_api_gethostbyaddr_r" = yes; then
|
||||
SC_TCL_GETHOSTBYADDR_R_TYPE
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_DECL], [AC_CHECK_DECLS(gethostbyaddr_r, [
|
||||
tcl_cv_api_gethostbyaddr_r=yes],[tcl_cv_api_gethostbyaddr_r=no],[#include <netdb.h>])
|
||||
])
|
||||
|
||||
AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_TYPE], [AC_CHECK_FUNC(gethostbyaddr_r, [
|
||||
AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
|
||||
AC_TRY_COMPILE([
|
||||
#include <netdb.h>
|
||||
@@ -2744,14 +2756,27 @@ AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
|
||||
# Results:
|
||||
#
|
||||
# Might define the following vars:
|
||||
# HAVE_GETHOSTBYADDR_R
|
||||
# HAVE_GETHOSTBYADDR_R_3
|
||||
# HAVE_GETHOSTBYADDR_R_5
|
||||
# HAVE_GETHOSTBYADDR_R_6
|
||||
# HAVE_GETHOSTBYNAME_R
|
||||
# HAVE_GETHOSTBYNAME_R_3
|
||||
# HAVE_GETHOSTBYNAME_R_5
|
||||
# HAVE_GETHOSTBYNAME_R_6
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
|
||||
AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [
|
||||
# Avoids picking hidden internal symbol from libc
|
||||
SC_TCL_GETHOSTBYNAME_R_DECL
|
||||
|
||||
if test "$tcl_cv_api_gethostbyname_r" = yes; then
|
||||
SC_TCL_GETHOSTBYNAME_R_TYPE
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_DECL], [AC_CHECK_DECLS(gethostbyname_r, [
|
||||
tcl_cv_api_gethostbyname_r=yes],[tcl_cv_api_gethostbyname_r=no],[#include <netdb.h>])
|
||||
])
|
||||
|
||||
AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_TYPE], [AC_CHECK_FUNC(gethostbyname_r, [
|
||||
AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
|
||||
AC_TRY_COMPILE([
|
||||
#include <netdb.h>
|
||||
|
||||
@@ -7,7 +7,7 @@ includedir=@includedir@
|
||||
|
||||
Name: The Tk Toolkit
|
||||
Description: Tk is a cross-platform graphical user interface toolkit, the standard GUI not only for Tcl, but for many other dynamic languages as well.
|
||||
URL: http://www.tcl.tk/
|
||||
URL: https://www.tcl-lang.org/
|
||||
Version: @TK_VERSION@@TK_PATCH_LEVEL@
|
||||
Requires: tcl >= 8.6
|
||||
Libs: -L${libdir} @TK_LIB_FLAG@ @TK_STUB_LIB_FLAG@
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
Name: tk
|
||||
Summary: Tk graphical toolkit for the Tcl scripting language.
|
||||
Version: 8.6.9
|
||||
Version: 8.6.10
|
||||
Release: 2
|
||||
License: BSD
|
||||
Group: Development/Languages
|
||||
Source: http://prdownloads.sourceforge.net/tcl/tk%{version}-src.tar.gz
|
||||
URL: http://www.tcl.tk/
|
||||
URL: https://www.tcl-lang.org/
|
||||
Buildroot: /var/tmp/%{name}%{version}
|
||||
Buildrequires: XFree86-devel tcl >= %version
|
||||
Requires: tcl >= %version
|
||||
|
||||
@@ -48,7 +48,7 @@ TkpGetBorder(void)
|
||||
{
|
||||
UnixBorder *borderPtr = ckalloc(sizeof(UnixBorder));
|
||||
|
||||
borderPtr->solidGC = None;
|
||||
borderPtr->solidGC = NULL;
|
||||
return (TkBorder *) borderPtr;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ TkpFreeBorder(
|
||||
UnixBorder *unixBorderPtr = (UnixBorder *) borderPtr;
|
||||
Display *display = DisplayOfScreen(borderPtr->screen);
|
||||
|
||||
if (unixBorderPtr->solidGC != None) {
|
||||
if (unixBorderPtr->solidGC != NULL) {
|
||||
Tk_FreeGC(display, unixBorderPtr->solidGC);
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ Tk_3DVerticalBevel(
|
||||
GC left, right;
|
||||
Display *display = Tk_Display(tkwin);
|
||||
|
||||
if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT)) {
|
||||
if ((borderPtr->lightGC == NULL) && (relief != TK_RELIEF_FLAT)) {
|
||||
TkpGetShadows(borderPtr, tkwin);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ Tk_3DVerticalBevel(
|
||||
(unsigned) width, (unsigned) height);
|
||||
} else if (relief == TK_RELIEF_SOLID) {
|
||||
UnixBorder *unixBorderPtr = (UnixBorder *) borderPtr;
|
||||
if (unixBorderPtr->solidGC == None) {
|
||||
if (unixBorderPtr->solidGC == NULL) {
|
||||
XGCValues gcValues;
|
||||
|
||||
gcValues.foreground = BlackPixelOfScreen(borderPtr->screen);
|
||||
@@ -216,11 +216,11 @@ Tk_3DHorizontalBevel(
|
||||
Display *display = Tk_Display(tkwin);
|
||||
int bottom, halfway, x1, x2, x1Delta, x2Delta;
|
||||
UnixBorder *unixBorderPtr = (UnixBorder *) borderPtr;
|
||||
GC topGC = None, bottomGC = None;
|
||||
GC topGC = NULL, bottomGC = NULL;
|
||||
/* Initializations needed only to prevent
|
||||
* compiler warnings. */
|
||||
|
||||
if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT) &&
|
||||
if ((borderPtr->lightGC == NULL) && (relief != TK_RELIEF_FLAT) &&
|
||||
(relief != TK_RELIEF_SOLID)) {
|
||||
TkpGetShadows(borderPtr, tkwin);
|
||||
}
|
||||
@@ -246,7 +246,7 @@ Tk_3DHorizontalBevel(
|
||||
bottomGC = borderPtr->darkGC;
|
||||
break;
|
||||
case TK_RELIEF_SOLID:
|
||||
if (unixBorderPtr->solidGC == None) {
|
||||
if (unixBorderPtr->solidGC == NULL) {
|
||||
XGCValues gcValues;
|
||||
|
||||
gcValues.foreground = BlackPixelOfScreen(borderPtr->screen);
|
||||
@@ -344,7 +344,7 @@ TkpGetShadows(
|
||||
int r, g, b;
|
||||
XGCValues gcValues;
|
||||
|
||||
if (borderPtr->lightGC != None) {
|
||||
if (borderPtr->lightGC != NULL) {
|
||||
return;
|
||||
}
|
||||
stressed = TkpCmapStressed(tkwin, borderPtr->colormap);
|
||||
@@ -443,7 +443,7 @@ TkpGetShadows(
|
||||
}
|
||||
|
||||
if (borderPtr->shadow == None) {
|
||||
borderPtr->shadow = Tk_GetBitmap((Tcl_Interp *) NULL, tkwin,
|
||||
borderPtr->shadow = Tk_GetBitmap(NULL, tkwin,
|
||||
Tk_GetUid("gray50"));
|
||||
if (borderPtr->shadow == None) {
|
||||
Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border");
|
||||
|
||||
@@ -85,7 +85,7 @@ TkpFreeColor(
|
||||
*/
|
||||
|
||||
visual = tkColPtr->visual;
|
||||
if ((visual->class != StaticGray) && (visual->class != StaticColor)
|
||||
if ((visual->c_class != StaticGray) && (visual->c_class != StaticColor)
|
||||
&& (tkColPtr->color.pixel != BlackPixelOfScreen(screen))
|
||||
&& (tkColPtr->color.pixel != WhitePixelOfScreen(screen))) {
|
||||
Tk_ErrorHandler handler;
|
||||
@@ -157,7 +157,7 @@ TkpGetColor(
|
||||
}
|
||||
if (strlen(name) > 99) {
|
||||
/* Don't bother to parse this. [Bug 2809525]*/
|
||||
return (TkColor *) NULL;
|
||||
return NULL;
|
||||
} else if (XAllocNamedColor(display, colormap, name, &screen, &color) != 0) {
|
||||
DeleteStressedCmap(display, colormap);
|
||||
} else {
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
#define ACTIVE_BG "#ececec"
|
||||
#define SELECT_BG "#c3c3c3"
|
||||
#define TROUGH "#b3b3b3"
|
||||
#define CHECK_INDICATOR WHITE
|
||||
#define MENU_INDICATOR BLACK
|
||||
#define INDICATOR WHITE
|
||||
#define DISABLED "#a3a3a3"
|
||||
|
||||
/*
|
||||
@@ -79,7 +78,7 @@
|
||||
#define DEF_LABCHKRAD_RELIEF "flat"
|
||||
#define DEF_BUTTON_REPEAT_DELAY "0"
|
||||
#define DEF_BUTTON_REPEAT_INTERVAL "0"
|
||||
#define DEF_BUTTON_SELECT_COLOR CHECK_INDICATOR
|
||||
#define DEF_BUTTON_SELECT_COLOR INDICATOR
|
||||
#define DEF_BUTTON_SELECT_MONO BLACK
|
||||
#define DEF_BUTTON_SELECT_IMAGE ((char *) NULL)
|
||||
#define DEF_BUTTON_STATE "normal"
|
||||
@@ -244,7 +243,7 @@
|
||||
#define DEF_MENU_ENTRY_ACTIVE_FG ((char *) NULL)
|
||||
#define DEF_MENU_ENTRY_ACCELERATOR ((char *) NULL)
|
||||
#define DEF_MENU_ENTRY_BG ((char *) NULL)
|
||||
#define DEF_MENU_ENTRY_BITMAP None
|
||||
#define DEF_MENU_ENTRY_BITMAP NULL
|
||||
#define DEF_MENU_ENTRY_COLUMN_BREAK "0"
|
||||
#define DEF_MENU_ENTRY_COMMAND ((char *) NULL)
|
||||
#define DEF_MENU_ENTRY_COMPOUND "none"
|
||||
@@ -284,7 +283,7 @@
|
||||
#define DEF_MENU_FG BLACK
|
||||
#define DEF_MENU_POST_COMMAND ""
|
||||
#define DEF_MENU_RELIEF "raised"
|
||||
#define DEF_MENU_SELECT_COLOR MENU_INDICATOR
|
||||
#define DEF_MENU_SELECT_COLOR BLACK
|
||||
#define DEF_MENU_SELECT_MONO BLACK
|
||||
#define DEF_MENU_TAKE_FOCUS "0"
|
||||
#define DEF_MENU_TEAROFF "1"
|
||||
@@ -514,6 +513,14 @@
|
||||
|
||||
#define DEF_CANVTEXT_FONT "TkDefaultFont"
|
||||
|
||||
/*
|
||||
* Defaults for canvas items
|
||||
* (arcs, bitmaps, lines, polygons, rectangles, and ovals):
|
||||
*/
|
||||
|
||||
#define DEF_CANVBMAP_FG BLACK
|
||||
#define DEF_CANVITEM_OUTLINE BLACK
|
||||
|
||||
/*
|
||||
* Defaults for toplevels (most of the defaults for frames also apply
|
||||
* to toplevels):
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef struct Container {
|
||||
* process. */
|
||||
} Container;
|
||||
|
||||
typedef struct ThreadSpecificData {
|
||||
typedef struct {
|
||||
Container *firstContainerPtr;
|
||||
/* First in list of all containers managed by
|
||||
* this process. */
|
||||
@@ -503,7 +503,15 @@ EmbedStructureProc(
|
||||
Tk_ErrorHandler errHandler;
|
||||
|
||||
if (eventPtr->type == ConfigureNotify) {
|
||||
/*
|
||||
* Send a ConfigureNotify to the embedded application.
|
||||
*/
|
||||
|
||||
if (containerPtr->embeddedPtr != None) {
|
||||
TkDoConfigureNotify(containerPtr->embeddedPtr);
|
||||
}
|
||||
if (containerPtr->wrapper != None) {
|
||||
|
||||
/*
|
||||
* Ignore errors, since the embedded application could have
|
||||
* deleted its window.
|
||||
@@ -873,6 +881,7 @@ TkpTestembedCmd(
|
||||
Container *containerPtr;
|
||||
Tcl_DString dString;
|
||||
char buffer[50];
|
||||
Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
@@ -884,30 +893,45 @@ TkpTestembedCmd(
|
||||
Tcl_DStringInit(&dString);
|
||||
for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
|
||||
containerPtr = containerPtr->nextPtr) {
|
||||
if (containerPtr->embeddedPtr != NULL) {
|
||||
embeddedInterp = containerPtr->embeddedPtr->mainPtr->interp;
|
||||
}
|
||||
if (containerPtr->parentPtr != NULL) {
|
||||
parentInterp = containerPtr->parentPtr->mainPtr->interp;
|
||||
}
|
||||
if (embeddedInterp != interp && parentInterp != interp) {
|
||||
continue;
|
||||
}
|
||||
Tcl_DStringStartSublist(&dString);
|
||||
/* Parent id */
|
||||
if (containerPtr->parent == None) {
|
||||
Tcl_DStringAppendElement(&dString, "");
|
||||
} else if (all) {
|
||||
sprintf(buffer, "0x%x", (int) containerPtr->parent);
|
||||
sprintf(buffer, "0x%lx", containerPtr->parent);
|
||||
Tcl_DStringAppendElement(&dString, buffer);
|
||||
} else {
|
||||
Tcl_DStringAppendElement(&dString, "XXX");
|
||||
}
|
||||
if (containerPtr->parentPtr == NULL) {
|
||||
/* Parent pathName */
|
||||
if (containerPtr->parentPtr == NULL ||
|
||||
parentInterp != interp) {
|
||||
Tcl_DStringAppendElement(&dString, "");
|
||||
} else {
|
||||
Tcl_DStringAppendElement(&dString,
|
||||
containerPtr->parentPtr->pathName);
|
||||
}
|
||||
/* Wrapper */
|
||||
if (containerPtr->wrapper == None) {
|
||||
Tcl_DStringAppendElement(&dString, "");
|
||||
} else if (all) {
|
||||
sprintf(buffer, "0x%x", (int) containerPtr->wrapper);
|
||||
sprintf(buffer, "0x%lx", containerPtr->wrapper);
|
||||
Tcl_DStringAppendElement(&dString, buffer);
|
||||
} else {
|
||||
Tcl_DStringAppendElement(&dString, "XXX");
|
||||
}
|
||||
if (containerPtr->embeddedPtr == NULL) {
|
||||
/* Embedded window pathName */
|
||||
if (containerPtr->embeddedPtr == NULL ||
|
||||
embeddedInterp != interp) {
|
||||
Tcl_DStringAppendElement(&dString, "");
|
||||
} else {
|
||||
Tcl_DStringAppendElement(&dString,
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* the current thread.
|
||||
*/
|
||||
|
||||
typedef struct ThreadSpecificData {
|
||||
typedef struct {
|
||||
int initialized;
|
||||
} ThreadSpecificData;
|
||||
static Tcl_ThreadDataKey dataKey;
|
||||
@@ -166,7 +166,7 @@ TkpOpenDisplay(
|
||||
if (display == NULL) {
|
||||
/*fprintf(stderr,"event=%d error=%d major=%d minor=%d reason=%d\nDisabling xkb\n",
|
||||
event, error, major, minor, reason);*/
|
||||
display = XOpenDisplay(displayNameStr);
|
||||
display = XOpenDisplay(displayNameStr);
|
||||
} else {
|
||||
use_xkb = TK_DISPLAY_USE_XKB;
|
||||
/*fprintf(stderr, "Using xkb %d.%d\n", major, minor);*/
|
||||
@@ -186,6 +186,31 @@ TkpOpenDisplay(
|
||||
#endif
|
||||
Tcl_CreateFileHandler(ConnectionNumber(display), TCL_READABLE,
|
||||
DisplayFileProc, dispPtr);
|
||||
|
||||
/*
|
||||
* Observed weird WidthMMOfScreen() in X on Wayland on a
|
||||
* Fedora 30/i386 running in a VM. Fallback to 75 dpi,
|
||||
* otherwise many other strange things may happen later.
|
||||
* See: [https://core.tcl-lang.org/tk/tktview?name=a01b6f7227]
|
||||
*/
|
||||
if (WidthMMOfScreen(DefaultScreenOfDisplay(display)) <= 0) {
|
||||
int mm;
|
||||
|
||||
mm = WidthOfScreen(DefaultScreenOfDisplay(display)) * (25.4 / 75.0);
|
||||
WidthMMOfScreen(DefaultScreenOfDisplay(display)) = mm;
|
||||
}
|
||||
if (HeightMMOfScreen(DefaultScreenOfDisplay(display)) <= 0) {
|
||||
int mm;
|
||||
|
||||
mm = HeightOfScreen(DefaultScreenOfDisplay(display)) * (25.4 / 75.0);
|
||||
HeightMMOfScreen(DefaultScreenOfDisplay(display)) = mm;
|
||||
}
|
||||
|
||||
/*
|
||||
* Key map info must be available immediately, because of "send event".
|
||||
*/
|
||||
TkpInitKeymapInfo(dispPtr);
|
||||
|
||||
return dispPtr;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ static const char *const encodingList[] = {
|
||||
|
||||
#define FONTMAP_SHIFT 10
|
||||
|
||||
#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
|
||||
#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
|
||||
#define FONTMAP_PAGES (0x30000 / FONTMAP_BITSPERPAGE)
|
||||
|
||||
typedef struct FontFamily {
|
||||
struct FontFamily *nextPtr; /* Next in list of all known font families. */
|
||||
@@ -153,7 +153,7 @@ typedef struct FontAttributes {
|
||||
TkXLFDAttributes xa;
|
||||
} FontAttributes;
|
||||
|
||||
typedef struct ThreadSpecificData {
|
||||
typedef struct {
|
||||
FontFamily *fontFamilyList; /* The list of font families that are
|
||||
* currently loaded. As screen fonts are
|
||||
* loaded, this list grows to hold information
|
||||
@@ -171,7 +171,7 @@ static Tcl_ThreadDataKey dataKey;
|
||||
* encodings into the names expected by the Tcl encoding package.
|
||||
*/
|
||||
|
||||
static EncodingAlias encodingAliases[] = {
|
||||
static const EncodingAlias encodingAliases[] = {
|
||||
{"gb2312-raw", "gb2312*"},
|
||||
{"big5", "big5*"},
|
||||
{"cns11643-1", "cns11643*-1"},
|
||||
@@ -186,14 +186,7 @@ static EncodingAlias encodingAliases[] = {
|
||||
{"tis620", "tis620*"},
|
||||
{"ksc5601", "ksc5601*"},
|
||||
{"dingbats", "*dingbats"},
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
{"unicode", "iso10646-1"},
|
||||
#else
|
||||
/*
|
||||
* ucs-2be is needed if native order isn't BE.
|
||||
*/
|
||||
{"ucs-2be", "iso10646-1"},
|
||||
#endif
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -246,7 +239,6 @@ static unsigned RankAttributes(FontAttributes *wantPtr,
|
||||
static void ReleaseFont(UnixFont *fontPtr);
|
||||
static void ReleaseSubFont(Display *display, SubFont *subFontPtr);
|
||||
static int SeenName(const char *name, Tcl_DString *dsPtr);
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
static int Ucs2beToUtfProc(ClientData clientData, const char*src,
|
||||
int srcLen, int flags, Tcl_EncodingState*statePtr,
|
||||
char *dst, int dstLen, int *srcReadPtr,
|
||||
@@ -255,7 +247,6 @@ static int UtfToUcs2beProc(ClientData clientData, const char*src,
|
||||
int srcLen, int flags, Tcl_EncodingState*statePtr,
|
||||
char *dst, int dstLen, int *srcReadPtr,
|
||||
int *dstWrotePtr, int *dstCharsPtr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
@@ -320,18 +311,13 @@ TkpFontPkgInit(
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
Tcl_EncodingType type;
|
||||
SubFont dummy;
|
||||
int i;
|
||||
Tcl_Encoding ucs2;
|
||||
|
||||
if (tsdPtr->controlFamily.encoding == NULL) {
|
||||
type.encodingName = "X11ControlChars";
|
||||
type.toUtfProc = ControlUtfProc;
|
||||
type.fromUtfProc = ControlUtfProc;
|
||||
type.freeProc = NULL;
|
||||
type.clientData = NULL;
|
||||
type.nullSize = 0;
|
||||
|
||||
Tcl_EncodingType type = {"X11ControlChars", ControlUtfProc, ControlUtfProc, NULL, NULL, 0};
|
||||
tsdPtr->controlFamily.refCount = 2;
|
||||
tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type);
|
||||
tsdPtr->controlFamily.isTwoByteFont = 0;
|
||||
@@ -343,20 +329,18 @@ TkpFontPkgInit(
|
||||
FontMapInsert(&dummy, i + 0x80);
|
||||
}
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
/*
|
||||
* UCS-2BE is unicode (UCS-2) in big-endian format. Define this if
|
||||
* native order isn't BE. It is used in iso10646 fonts.
|
||||
* if it doesn't exist yet. It is used in iso10646 fonts.
|
||||
*/
|
||||
|
||||
type.encodingName = "ucs-2be";
|
||||
type.toUtfProc = Ucs2beToUtfProc;
|
||||
type.fromUtfProc = UtfToUcs2beProc;
|
||||
type.freeProc = NULL;
|
||||
type.clientData = NULL;
|
||||
type.nullSize = 2;
|
||||
Tcl_CreateEncoding(&type);
|
||||
#endif
|
||||
ucs2 = Tcl_GetEncoding(NULL, "ucs-2be");
|
||||
if (ucs2 == NULL) {
|
||||
Tcl_EncodingType ucs2type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2};
|
||||
Tcl_CreateEncoding(&ucs2type);
|
||||
} else {
|
||||
Tcl_FreeEncoding(ucs2);
|
||||
}
|
||||
Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL);
|
||||
}
|
||||
}
|
||||
@@ -428,15 +412,15 @@ ControlUtfProc(
|
||||
}
|
||||
src += TkUtfToUniChar(src, &ch);
|
||||
dst[0] = '\\';
|
||||
if (((size_t) ch < sizeof(mapChars)) && (mapChars[ch] != 0)) {
|
||||
if (((size_t)ch < sizeof(mapChars)) && (mapChars[ch] != 0)) {
|
||||
dst[1] = mapChars[ch];
|
||||
dst += 2;
|
||||
} else if (ch < 256) {
|
||||
} else if ((size_t)ch < 256) {
|
||||
dst[1] = 'x';
|
||||
dst[2] = hexChars[(ch >> 4) & 0xf];
|
||||
dst[3] = hexChars[ch & 0xf];
|
||||
dst += 4;
|
||||
} else if (ch < 0x10000) {
|
||||
} else if ((size_t)ch < 0x10000) {
|
||||
dst[1] = 'u';
|
||||
dst[2] = hexChars[(ch >> 12) & 0xf];
|
||||
dst[3] = hexChars[(ch >> 8) & 0xf];
|
||||
@@ -459,14 +443,12 @@ ControlUtfProc(
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
* Ucs2beToUtfProc --
|
||||
*
|
||||
* Convert from UCS-2BE (big-endian 16-bit Unicode) to UTF-8.
|
||||
* This is only defined on LE machines.
|
||||
*
|
||||
* Results:
|
||||
* Returns TCL_OK if conversion was successful.
|
||||
@@ -515,6 +497,11 @@ Ucs2beToUtfProc(
|
||||
result = TCL_CONVERT_MULTIBYTE;
|
||||
srcLen--;
|
||||
}
|
||||
/* If last code point is a high surrogate, we cannot handle that yet */
|
||||
if ((srcLen >= 2) && ((src[srcLen - 2] & 0xFC) == 0xD8)) {
|
||||
result = TCL_CONVERT_MULTIBYTE;
|
||||
srcLen -= 2;
|
||||
}
|
||||
|
||||
srcStart = src;
|
||||
srcEnd = src + srcLen;
|
||||
@@ -533,7 +520,7 @@ Ucs2beToUtfProc(
|
||||
* UCS-2BE. We know this is an LE->BE swap.
|
||||
*/
|
||||
|
||||
dst += Tcl_UniCharToUtf(htons(*((short *)src)), dst);
|
||||
dst += TkUniCharToUtf(htons(*((short *)src)), dst);
|
||||
src += 2 /* sizeof(UCS-2) */;
|
||||
}
|
||||
|
||||
@@ -589,7 +576,11 @@ UtfToUcs2beProc(
|
||||
{
|
||||
const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
|
||||
int result, numChars;
|
||||
Tcl_UniChar ch;
|
||||
Tcl_UniChar *chPtr = (Tcl_UniChar *)statePtr;
|
||||
|
||||
if (flags & TCL_ENCODING_START) {
|
||||
*statePtr = 0;
|
||||
}
|
||||
|
||||
srcStart = src;
|
||||
srcEnd = src + srcLen;
|
||||
@@ -608,15 +599,14 @@ UtfToUcs2beProc(
|
||||
* If there is more string to follow, this will ensure that the
|
||||
* last UTF-8 character in the source buffer hasn't been cut off.
|
||||
*/
|
||||
|
||||
result = TCL_CONVERT_MULTIBYTE;
|
||||
break;
|
||||
}
|
||||
if (dst > dstEnd) {
|
||||
result = TCL_CONVERT_NOSPACE;
|
||||
break;
|
||||
}
|
||||
src += Tcl_UtfToUniChar(src, &ch);
|
||||
}
|
||||
src += Tcl_UtfToUniChar(src, chPtr);
|
||||
|
||||
/*
|
||||
* Ensure big-endianness (store big bits first).
|
||||
@@ -624,15 +614,15 @@ UtfToUcs2beProc(
|
||||
* sure to work in char* for Tcl_UtfToUniChar alignment. [Bug 1122671]
|
||||
*/
|
||||
|
||||
*dst++ = (ch >> 8);
|
||||
*dst++ = (ch & 0xFF);
|
||||
|
||||
*dst++ = (char)(*chPtr >> 8);
|
||||
*dst++ = (char)*chPtr;
|
||||
}
|
||||
*srcReadPtr = src - srcStart;
|
||||
*dstWrotePtr = dst - dstStart;
|
||||
*dstCharsPtr = numChars;
|
||||
return result;
|
||||
}
|
||||
#endif /* WORDS_BIGENDIAN */
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
@@ -1986,11 +1976,11 @@ FindSubFontForChar(
|
||||
SubFont *subFontPtr;
|
||||
Tcl_DString ds;
|
||||
|
||||
if (FontMapLookup(&fontPtr->subFontArray[0], ch)) {
|
||||
return &fontPtr->subFontArray[0];
|
||||
if (ch < 0 || ch > 0x30000) {
|
||||
ch = 0xfffd;
|
||||
}
|
||||
|
||||
for (i = 1; i < fontPtr->numSubFonts; i++) {
|
||||
for (i = 0; i < fontPtr->numSubFonts; i++) {
|
||||
if (FontMapLookup(&fontPtr->subFontArray[i], ch)) {
|
||||
return &fontPtr->subFontArray[i];
|
||||
}
|
||||
@@ -2140,6 +2130,9 @@ FontMapLookup(
|
||||
{
|
||||
int row, bitOffset;
|
||||
|
||||
if (ch < 0 || ch >= 0x30000) {
|
||||
return 0;
|
||||
}
|
||||
row = ch >> FONTMAP_SHIFT;
|
||||
if (subFontPtr->fontMap[row] == NULL) {
|
||||
FontMapLoadPage(subFontPtr, row);
|
||||
@@ -2180,12 +2173,14 @@ FontMapInsert(
|
||||
{
|
||||
int row, bitOffset;
|
||||
|
||||
row = ch >> FONTMAP_SHIFT;
|
||||
if (subFontPtr->fontMap[row] == NULL) {
|
||||
FontMapLoadPage(subFontPtr, row);
|
||||
if (ch >= 0 && ch < 0x30000) {
|
||||
row = ch >> FONTMAP_SHIFT;
|
||||
if (subFontPtr->fontMap[row] == NULL) {
|
||||
FontMapLoadPage(subFontPtr, row);
|
||||
}
|
||||
bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
|
||||
subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
|
||||
}
|
||||
bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
|
||||
subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3015,10 +3010,10 @@ static const char *
|
||||
GetEncodingAlias(
|
||||
const char *name) /* The name to look up. */
|
||||
{
|
||||
EncodingAlias *aliasPtr;
|
||||
const EncodingAlias *aliasPtr;
|
||||
|
||||
for (aliasPtr = encodingAliases; aliasPtr->aliasPattern != NULL; ) {
|
||||
if (Tcl_StringMatch(name, aliasPtr->aliasPattern)) {
|
||||
if (Tcl_StringCaseMatch(name, aliasPtr->aliasPattern, 0)) {
|
||||
return aliasPtr->realName;
|
||||
}
|
||||
aliasPtr++;
|
||||
|
||||
@@ -208,7 +208,7 @@ TkpGetString(
|
||||
Tcl_DStringValue(&buf)[len] = '\0';
|
||||
|
||||
if (len == 1) {
|
||||
len = Tcl_UniCharToUtf((unsigned char) Tcl_DStringValue(&buf)[0],
|
||||
len = TkUniCharToUtf((unsigned char) Tcl_DStringValue(&buf)[0],
|
||||
Tcl_DStringValue(dsPtr));
|
||||
Tcl_DStringSetLength(dsPtr, len);
|
||||
} else {
|
||||
|
||||
@@ -857,11 +857,7 @@ DrawMenuUnderline(
|
||||
if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
|
||||
int len;
|
||||
|
||||
/*
|
||||
* Do the unicode call just to prevent overruns.
|
||||
*/
|
||||
|
||||
Tcl_GetUnicodeFromObj(mePtr->labelPtr, &len);
|
||||
len = Tcl_GetCharLength(mePtr->labelPtr);
|
||||
if (mePtr->underline < len) {
|
||||
int activeBorderWidth, leftEdge;
|
||||
const char *label, *start, *end;
|
||||
@@ -889,7 +885,10 @@ DrawMenuUnderline(
|
||||
*
|
||||
* TkpPostMenu --
|
||||
*
|
||||
* Posts a menu on the screen
|
||||
* Posts a menu on the screen so that the top left corner of the
|
||||
* specified entry is located at the point (x, y) in screen coordinates.
|
||||
* If the entry parameter is negative, the upper left corner of the
|
||||
* menu itself is placed at the point.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
@@ -904,9 +903,104 @@ int
|
||||
TkpPostMenu(
|
||||
Tcl_Interp *interp,
|
||||
TkMenu *menuPtr,
|
||||
int x, int y)
|
||||
int x, int y, int index)
|
||||
{
|
||||
return TkPostTearoffMenu(interp, menuPtr, x, y);
|
||||
return TkpPostTearoffMenu(interp, menuPtr, x, y, index);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TkpPostTearoffMenu --
|
||||
*
|
||||
* Posts a tearoff menu on the screen so that the top left corner of the
|
||||
* specified entry is located at the point (x, y) in screen coordinates.
|
||||
* If the index parameter is negative, the upper left corner of the menu
|
||||
* itself is placed at the point. On unix this is called when posting
|
||||
* any menu. Adjusts the menu's position so that it fits on the screen,
|
||||
* and maps and raises the menu.
|
||||
*
|
||||
* Results:
|
||||
* Returns a standard Tcl Error.
|
||||
*
|
||||
* Side effects:
|
||||
* The menu is posted.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
TkpPostTearoffMenu(
|
||||
Tcl_Interp *interp, /* The interpreter of the menu */
|
||||
TkMenu *menuPtr, /* The menu we are posting */
|
||||
int x, int y, int index) /* The root X,Y coordinates where the
|
||||
* specified entry will be posted */
|
||||
{
|
||||
int vRootX, vRootY, vRootWidth, vRootHeight;
|
||||
int result;
|
||||
|
||||
if (index >= menuPtr->numEntries) {
|
||||
index = menuPtr->numEntries - 1;
|
||||
}
|
||||
if (index >= 0) {
|
||||
y -= menuPtr->entries[index]->y;
|
||||
}
|
||||
|
||||
TkActivateMenuEntry(menuPtr, -1);
|
||||
TkRecomputeMenu(menuPtr);
|
||||
result = TkPostCommand(menuPtr);
|
||||
if (result != TCL_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* The post commands could have deleted the menu, which means we are dead
|
||||
* and should go away.
|
||||
*/
|
||||
|
||||
if (menuPtr->tkwin == NULL) {
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adjust the position of the menu if necessary to keep it visible on the
|
||||
* screen. There are two special tricks to make this work right:
|
||||
*
|
||||
* 1. If a virtual root window manager is being used then the coordinates
|
||||
* are in the virtual root window of menuPtr's parent; since the menu
|
||||
* uses override-redirect mode it will be in the *real* root window for
|
||||
* the screen, so we have to map the coordinates from the virtual root
|
||||
* (if any) to the real root. Can't get the virtual root from the menu
|
||||
* itself (it will never be seen by the wm) so use its parent instead
|
||||
* (it would be better to have an an option that names a window to use
|
||||
* for this...).
|
||||
* 2. The menu may not have been mapped yet, so its current size might be
|
||||
* the default 1x1. To compute how much space it needs, use its
|
||||
* requested size, not its actual size.
|
||||
*/
|
||||
|
||||
Tk_GetVRootGeometry(Tk_Parent(menuPtr->tkwin), &vRootX, &vRootY,
|
||||
&vRootWidth, &vRootHeight);
|
||||
vRootWidth -= Tk_ReqWidth(menuPtr->tkwin);
|
||||
if (x > vRootX + vRootWidth) {
|
||||
x = vRootX + vRootWidth;
|
||||
}
|
||||
if (x < vRootX) {
|
||||
x = vRootX;
|
||||
}
|
||||
vRootHeight -= Tk_ReqHeight(menuPtr->tkwin);
|
||||
if (y > vRootY + vRootHeight) {
|
||||
y = vRootY + vRootHeight;
|
||||
}
|
||||
if (y < vRootY) {
|
||||
y = vRootY;
|
||||
}
|
||||
Tk_MoveToplevelWindow(menuPtr->tkwin, x, y);
|
||||
if (!Tk_IsMapped(menuPtr->tkwin)) {
|
||||
Tk_MapWindow(menuPtr->tkwin);
|
||||
}
|
||||
TkWmRestackToplevel((TkWindow *) menuPtr->tkwin, Above, NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1721,7 +1815,6 @@ TkpComputeStandardMenuGeometry(
|
||||
}
|
||||
windowWidth = x + indicatorSpace + labelWidth + accelWidth
|
||||
+ 2 * activeBorderWidth + borderWidth;
|
||||
|
||||
windowHeight += borderWidth;
|
||||
|
||||
/*
|
||||
|
||||
@@ -92,7 +92,7 @@ TkpDisplayMenuButton(
|
||||
border = mbPtr->normalBorder;
|
||||
}
|
||||
|
||||
if (mbPtr->image != None) {
|
||||
if (mbPtr->image != NULL) {
|
||||
Tk_SizeOfImage(mbPtr->image, &width, &height);
|
||||
haveImage = 1;
|
||||
} else if (mbPtr->bitmap != None) {
|
||||
@@ -358,7 +358,7 @@ TkpComputeMenuButtonGeometry(
|
||||
txtHeight = 0;
|
||||
avgWidth = 0;
|
||||
|
||||
if (mbPtr->image != None) {
|
||||
if (mbPtr->image != NULL) {
|
||||
Tk_SizeOfImage(mbPtr->image, &width, &height);
|
||||
haveImage = 1;
|
||||
} else if (mbPtr->bitmap != None) {
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef struct {
|
||||
* the information isn't retrievable from the GC.
|
||||
*/
|
||||
|
||||
typedef struct ThreadSpecificData {
|
||||
typedef struct {
|
||||
Region clipRegion; /* The clipping region, or None. */
|
||||
} ThreadSpecificData;
|
||||
static Tcl_ThreadDataKey dataKey;
|
||||
@@ -69,7 +69,7 @@ void
|
||||
TkpFontPkgInit(
|
||||
TkMainInfo *mainPtr) /* The application being created. */
|
||||
{
|
||||
static Tcl_Config cfg[] = {
|
||||
static const Tcl_Config cfg[] = {
|
||||
{ "fontsystem", "xft" },
|
||||
{ 0,0 }
|
||||
};
|
||||
@@ -937,7 +937,7 @@ Tk_DrawChars(
|
||||
|
||||
doUnderlineStrikeout:
|
||||
if (tsdPtr->clipRegion != None) {
|
||||
XftDrawSetClip(fontPtr->ftDraw, None);
|
||||
XftDrawSetClip(fontPtr->ftDraw, NULL);
|
||||
}
|
||||
if (fontPtr->font.fa.underline != 0) {
|
||||
XFillRectangle(display, drawable, gc, xStart,
|
||||
@@ -1183,7 +1183,7 @@ TkDrawAngledChars(
|
||||
|
||||
doUnderlineStrikeout:
|
||||
if (tsdPtr->clipRegion != None) {
|
||||
XftDrawSetClip(fontPtr->ftDraw, None);
|
||||
XftDrawSetClip(fontPtr->ftDraw, NULL);
|
||||
}
|
||||
if (fontPtr->font.fa.underline || fontPtr->font.fa.overstrike) {
|
||||
XPoint points[5];
|
||||
|
||||
@@ -24,11 +24,13 @@
|
||||
static void DisplayHorizontalScale(TkScale *scalePtr,
|
||||
Drawable drawable, XRectangle *drawnAreaPtr);
|
||||
static void DisplayHorizontalValue(TkScale *scalePtr,
|
||||
Drawable drawable, double value, int top);
|
||||
Drawable drawable, double value, int top,
|
||||
const char *format);
|
||||
static void DisplayVerticalScale(TkScale *scalePtr,
|
||||
Drawable drawable, XRectangle *drawnAreaPtr);
|
||||
static void DisplayVerticalValue(TkScale *scalePtr,
|
||||
Drawable drawable, double value, int rightEdge);
|
||||
Drawable drawable, double value, int rightEdge,
|
||||
const char *format);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -150,11 +152,11 @@ DisplayVerticalScale(
|
||||
for (tickValue = scalePtr->fromValue; ;
|
||||
tickValue += tickInterval) {
|
||||
/*
|
||||
* The TkRoundToResolution call gets rid of accumulated
|
||||
* The TkRoundValueToResolution call gets rid of accumulated
|
||||
* round-off errors, if any.
|
||||
*/
|
||||
|
||||
tickValue = TkRoundToResolution(scalePtr, tickValue);
|
||||
tickValue = TkRoundValueToResolution(scalePtr, tickValue);
|
||||
if (scalePtr->toValue >= scalePtr->fromValue) {
|
||||
if (tickValue > scalePtr->toValue) {
|
||||
break;
|
||||
@@ -165,7 +167,7 @@ DisplayVerticalScale(
|
||||
}
|
||||
}
|
||||
DisplayVerticalValue(scalePtr, drawable, tickValue,
|
||||
scalePtr->vertTickRightX);
|
||||
scalePtr->vertTickRightX, scalePtr->tickFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,7 +178,7 @@ DisplayVerticalScale(
|
||||
|
||||
if (scalePtr->showValue) {
|
||||
DisplayVerticalValue(scalePtr, drawable, scalePtr->value,
|
||||
scalePtr->vertValueRightX);
|
||||
scalePtr->vertValueRightX, scalePtr->valueFormat);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -228,8 +230,8 @@ DisplayVerticalScale(
|
||||
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
|
||||
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
|
||||
scalePtr->tkfont, scalePtr->label,
|
||||
scalePtr->labelLength, scalePtr->vertLabelX,
|
||||
scalePtr->inset + (3*fm.ascent)/2);
|
||||
scalePtr->labelLength, scalePtr->vertLabelX,
|
||||
scalePtr->inset + (3 * fm.ascent) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,8 +263,9 @@ DisplayVerticalValue(
|
||||
double value, /* Y-coordinate of number to display,
|
||||
* specified in application coords, not in
|
||||
* pixels (we'll compute pixels). */
|
||||
int rightEdge) /* X-coordinate of right edge of text,
|
||||
int rightEdge, /* X-coordinate of right edge of text,
|
||||
* specified in pixels. */
|
||||
const char *format) /* Format string to use for the value */
|
||||
{
|
||||
register Tk_Window tkwin = scalePtr->tkwin;
|
||||
int y, width, length;
|
||||
@@ -271,8 +274,8 @@ DisplayVerticalValue(
|
||||
|
||||
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
|
||||
y = TkScaleValueToPixel(scalePtr, value) + fm.ascent/2;
|
||||
if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format, value) < 0) {
|
||||
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
|
||||
if (snprintf(valueString, TCL_DOUBLE_SPACE, format, value) < 0) {
|
||||
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
|
||||
}
|
||||
length = (int) strlen(valueString);
|
||||
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
|
||||
@@ -282,10 +285,10 @@ DisplayVerticalValue(
|
||||
* the window.
|
||||
*/
|
||||
|
||||
if ((y - fm.ascent) < (scalePtr->inset + SPACING)) {
|
||||
if (y - fm.ascent < scalePtr->inset + SPACING) {
|
||||
y = scalePtr->inset + SPACING + fm.ascent;
|
||||
}
|
||||
if ((y + fm.descent) > (Tk_Height(tkwin) - scalePtr->inset - SPACING)) {
|
||||
if (y + fm.descent > Tk_Height(tkwin) - scalePtr->inset - SPACING) {
|
||||
y = Tk_Height(tkwin) - scalePtr->inset - SPACING - fm.descent;
|
||||
}
|
||||
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
|
||||
@@ -324,7 +327,7 @@ DisplayHorizontalScale(
|
||||
{
|
||||
register Tk_Window tkwin = scalePtr->tkwin;
|
||||
int x, y, width, height, shadowWidth;
|
||||
double tickValue, tickInterval = scalePtr->tickInterval;
|
||||
double tickInterval = scalePtr->tickInterval;
|
||||
Tk_3DBorder sliderBorder;
|
||||
|
||||
/*
|
||||
@@ -348,7 +351,7 @@ DisplayHorizontalScale(
|
||||
|
||||
if (tickInterval != 0) {
|
||||
char valueString[TCL_DOUBLE_SPACE];
|
||||
double ticks, maxTicks;
|
||||
double ticks, maxTicks, tickValue;
|
||||
|
||||
/*
|
||||
* Ensure that we will only draw enough of the tick values such
|
||||
@@ -358,23 +361,23 @@ DisplayHorizontalScale(
|
||||
|
||||
ticks = fabs((scalePtr->toValue - scalePtr->fromValue)
|
||||
/ tickInterval);
|
||||
if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format,
|
||||
scalePtr->fromValue) < 0) {
|
||||
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
|
||||
}
|
||||
if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->tickFormat,
|
||||
scalePtr->fromValue) < 0) {
|
||||
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
|
||||
}
|
||||
maxTicks = (double) Tk_Width(tkwin)
|
||||
/ (double) Tk_TextWidth(scalePtr->tkfont, valueString, -1);
|
||||
if (ticks > maxTicks) {
|
||||
tickInterval *= (ticks / maxTicks);
|
||||
tickInterval *= ticks / maxTicks;
|
||||
}
|
||||
for (tickValue = scalePtr->fromValue; ;
|
||||
tickValue += tickInterval) {
|
||||
tickValue = scalePtr->fromValue;
|
||||
while (1) {
|
||||
/*
|
||||
* The TkRoundToResolution call gets rid of accumulated
|
||||
* The TkRoundValueToResolution call gets rid of accumulated
|
||||
* round-off errors, if any.
|
||||
*/
|
||||
|
||||
tickValue = TkRoundToResolution(scalePtr, tickValue);
|
||||
tickValue = TkRoundValueToResolution(scalePtr, tickValue);
|
||||
if (scalePtr->toValue >= scalePtr->fromValue) {
|
||||
if (tickValue > scalePtr->toValue) {
|
||||
break;
|
||||
@@ -385,7 +388,8 @@ DisplayHorizontalScale(
|
||||
}
|
||||
}
|
||||
DisplayHorizontalValue(scalePtr, drawable, tickValue,
|
||||
scalePtr->horizTickY);
|
||||
scalePtr->horizTickY, scalePtr->tickFormat);
|
||||
tickValue += tickInterval;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -396,7 +400,7 @@ DisplayHorizontalScale(
|
||||
|
||||
if (scalePtr->showValue) {
|
||||
DisplayHorizontalValue(scalePtr, drawable, scalePtr->value,
|
||||
scalePtr->horizValueY);
|
||||
scalePtr->horizValueY, scalePtr->valueFormat);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -449,8 +453,8 @@ DisplayHorizontalScale(
|
||||
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
|
||||
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
|
||||
scalePtr->tkfont, scalePtr->label,
|
||||
scalePtr->labelLength, scalePtr->inset + fm.ascent/2,
|
||||
scalePtr->horizLabelY + fm.ascent);
|
||||
scalePtr->labelLength, scalePtr->inset + fm.ascent/2,
|
||||
scalePtr->horizLabelY + fm.ascent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,8 +486,9 @@ DisplayHorizontalValue(
|
||||
double value, /* X-coordinate of number to display,
|
||||
* specified in application coords, not in
|
||||
* pixels (we'll compute pixels). */
|
||||
int top) /* Y-coordinate of top edge of text, specified
|
||||
int top, /* Y-coordinate of top edge of text, specified
|
||||
* in pixels. */
|
||||
const char *format) /* Format string to use for the value */
|
||||
{
|
||||
register Tk_Window tkwin = scalePtr->tkwin;
|
||||
int x, y, length, width;
|
||||
@@ -493,8 +498,8 @@ DisplayHorizontalValue(
|
||||
x = TkScaleValueToPixel(scalePtr, value);
|
||||
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
|
||||
y = top + fm.ascent;
|
||||
if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format, value) < 0) {
|
||||
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
|
||||
if (snprintf(valueString, TCL_DOUBLE_SPACE, format, value) < 0) {
|
||||
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
|
||||
}
|
||||
length = (int) strlen(valueString);
|
||||
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
|
||||
@@ -504,8 +509,8 @@ DisplayHorizontalValue(
|
||||
* the window.
|
||||
*/
|
||||
|
||||
x -= (width)/2;
|
||||
if (x < (scalePtr->inset + SPACING)) {
|
||||
x -= width / 2;
|
||||
if (x < scalePtr->inset + SPACING) {
|
||||
x = scalePtr->inset + SPACING;
|
||||
}
|
||||
|
||||
@@ -562,10 +567,10 @@ TkpDisplayScale(
|
||||
Tcl_Preserve(scalePtr);
|
||||
if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
|
||||
Tcl_Preserve(interp);
|
||||
if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format,
|
||||
scalePtr->value) < 0) {
|
||||
string[TCL_DOUBLE_SPACE - 1] = '\0';
|
||||
}
|
||||
if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->valueFormat,
|
||||
scalePtr->value) < 0) {
|
||||
string[TCL_DOUBLE_SPACE - 1] = '\0';
|
||||
}
|
||||
Tcl_DStringInit(&buf);
|
||||
Tcl_DStringAppend(&buf, scalePtr->command, -1);
|
||||
Tcl_DStringAppend(&buf, " ", -1);
|
||||
@@ -634,7 +639,7 @@ TkpDisplayScale(
|
||||
gc = Tk_GCForColor(scalePtr->highlightColorPtr, pixmap);
|
||||
} else {
|
||||
gc = Tk_GCForColor(
|
||||
Tk_3DBorderColor(scalePtr->highlightBorder), pixmap);
|
||||
Tk_3DBorderColor(scalePtr->highlightBorder), pixmap);
|
||||
}
|
||||
Tk_DrawFocusHighlight(tkwin, gc, scalePtr->highlightWidth, pixmap);
|
||||
}
|
||||
@@ -696,7 +701,7 @@ TkpScaleElement(
|
||||
if (y < sliderFirst) {
|
||||
return TROUGH1;
|
||||
}
|
||||
if (y < (sliderFirst+scalePtr->sliderLength)) {
|
||||
if (y < sliderFirst + scalePtr->sliderLength) {
|
||||
return SLIDER;
|
||||
}
|
||||
return TROUGH2;
|
||||
@@ -716,7 +721,7 @@ TkpScaleElement(
|
||||
if (x < sliderFirst) {
|
||||
return TROUGH1;
|
||||
}
|
||||
if (x < (sliderFirst+scalePtr->sliderLength)) {
|
||||
if (x < sliderFirst + scalePtr->sliderLength) {
|
||||
return SLIDER;
|
||||
}
|
||||
return TROUGH2;
|
||||
|
||||
@@ -65,8 +65,8 @@ TkpCreateScrollbar(
|
||||
{
|
||||
UnixScrollbar *scrollPtr = ckalloc(sizeof(UnixScrollbar));
|
||||
|
||||
scrollPtr->troughGC = None;
|
||||
scrollPtr->copyGC = None;
|
||||
scrollPtr->troughGC = NULL;
|
||||
scrollPtr->copyGC = NULL;
|
||||
|
||||
Tk_CreateEventHandler(tkwin,
|
||||
ExposureMask|StructureNotifyMask|FocusChangeMask,
|
||||
@@ -366,10 +366,10 @@ TkpDestroyScrollbar(
|
||||
{
|
||||
UnixScrollbar *unixScrollPtr = (UnixScrollbar *)scrollPtr;
|
||||
|
||||
if (unixScrollPtr->troughGC != None) {
|
||||
if (unixScrollPtr->troughGC != NULL) {
|
||||
Tk_FreeGC(scrollPtr->display, unixScrollPtr->troughGC);
|
||||
}
|
||||
if (unixScrollPtr->copyGC != None) {
|
||||
if (unixScrollPtr->copyGC != NULL) {
|
||||
Tk_FreeGC(scrollPtr->display, unixScrollPtr->copyGC);
|
||||
}
|
||||
}
|
||||
@@ -406,11 +406,11 @@ TkpConfigureScrollbar(
|
||||
|
||||
gcValues.foreground = scrollPtr->troughColorPtr->pixel;
|
||||
new = Tk_GetGC(scrollPtr->tkwin, GCForeground, &gcValues);
|
||||
if (unixScrollPtr->troughGC != None) {
|
||||
if (unixScrollPtr->troughGC != NULL) {
|
||||
Tk_FreeGC(scrollPtr->display, unixScrollPtr->troughGC);
|
||||
}
|
||||
unixScrollPtr->troughGC = new;
|
||||
if (unixScrollPtr->copyGC == None) {
|
||||
if (unixScrollPtr->copyGC == NULL) {
|
||||
gcValues.graphics_exposures = False;
|
||||
unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin,
|
||||
GCGraphicsExposures, &gcValues);
|
||||
|
||||
@@ -21,7 +21,7 @@ typedef struct ConvertInfo {
|
||||
* offset of the next chunk of data to
|
||||
* transfer. */
|
||||
Tcl_EncodingState state; /* The encoding state needed across chunks. */
|
||||
char buffer[TCL_UTF_MAX]; /* A buffer to hold part of a UTF character
|
||||
char buffer[4]; /* A buffer to hold part of a UTF character
|
||||
* that is split across chunks.*/
|
||||
} ConvertInfo;
|
||||
|
||||
@@ -68,7 +68,7 @@ typedef struct IncrInfo {
|
||||
* currently pending. */
|
||||
} IncrInfo;
|
||||
|
||||
typedef struct ThreadSpecificData {
|
||||
typedef struct {
|
||||
IncrInfo *pendingIncrs; /* List of all incr structures currently
|
||||
* active. */
|
||||
} ThreadSpecificData;
|
||||
@@ -446,7 +446,7 @@ TkSelPropProc(
|
||||
* Preserve any left-over bytes.
|
||||
*/
|
||||
|
||||
if (srcLen > TCL_UTF_MAX) {
|
||||
if (srcLen > 3) {
|
||||
Tcl_Panic("selection conversion left too many bytes unconverted");
|
||||
}
|
||||
memcpy(incrPtr->converts[i].buffer, src, (size_t) srcLen+1);
|
||||
|
||||
@@ -97,7 +97,7 @@ typedef struct PendingCommand {
|
||||
* NULL means end of list. */
|
||||
} PendingCommand;
|
||||
|
||||
typedef struct ThreadSpecificData {
|
||||
typedef struct {
|
||||
PendingCommand *pendingCommands;
|
||||
/* List of all commands currently being waited
|
||||
* for. */
|
||||
|
||||
110
unix/tkUnixWm.c
110
unix/tkUnixWm.c
@@ -980,18 +980,18 @@ TkWmSetClass(
|
||||
|
||||
if (winPtr->classUid != NULL) {
|
||||
XClassHint *classPtr;
|
||||
Tcl_DString name, class;
|
||||
Tcl_DString name, ds;
|
||||
|
||||
Tcl_UtfToExternalDString(NULL, winPtr->nameUid, -1, &name);
|
||||
Tcl_UtfToExternalDString(NULL, winPtr->classUid, -1, &class);
|
||||
Tcl_UtfToExternalDString(NULL, winPtr->classUid, -1, &ds);
|
||||
classPtr = XAllocClassHint();
|
||||
classPtr->res_name = Tcl_DStringValue(&name);
|
||||
classPtr->res_class = Tcl_DStringValue(&class);
|
||||
classPtr->res_class = Tcl_DStringValue(&ds);
|
||||
XSetClassHint(winPtr->display, winPtr->wmInfoPtr->wrapperPtr->window,
|
||||
classPtr);
|
||||
XFree((char *) classPtr);
|
||||
Tcl_DStringFree(&name);
|
||||
Tcl_DStringFree(&class);
|
||||
Tcl_DStringFree(&ds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1871,6 +1871,7 @@ WmFrameCmd(
|
||||
{
|
||||
register WmInfo *wmPtr = winPtr->wmInfoPtr;
|
||||
Window window;
|
||||
char buf[TCL_INTEGER_SPACE];
|
||||
|
||||
if (objc != 3) {
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "window");
|
||||
@@ -1880,7 +1881,8 @@ WmFrameCmd(
|
||||
if (window == None) {
|
||||
window = Tk_WindowId((Tk_Window) winPtr);
|
||||
}
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%x", (unsigned) window));
|
||||
sprintf(buf, "0x%" TCL_Z_MODIFIER "x", (size_t)window);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2444,7 +2446,11 @@ WmIconphotoCmd(
|
||||
for (i = 3 + isDefault; i < objc; i++) {
|
||||
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
|
||||
if (photo == NULL) {
|
||||
Tcl_Free((char *) iconPropertyData);
|
||||
ckfree((char *) iconPropertyData);
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"failed to create an iconphoto with image \"%s\"",
|
||||
Tcl_GetString(objv[i])));
|
||||
Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "IMAGE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tk_PhotoGetSize(photo, &width, &height);
|
||||
@@ -3266,6 +3272,8 @@ WmStackorderCmd(
|
||||
ckfree(windows);
|
||||
Tcl_SetObjResult(interp, resultObj);
|
||||
return TCL_OK;
|
||||
} else {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else {
|
||||
Tk_Window relWin;
|
||||
@@ -3524,7 +3532,7 @@ WmTransientCmd(
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
register WmInfo *wmPtr = winPtr->wmInfoPtr;
|
||||
TkWindow *masterPtr = wmPtr->masterPtr;
|
||||
TkWindow *masterPtr = wmPtr->masterPtr, *w;
|
||||
WmInfo *wmPtr2;
|
||||
|
||||
if ((objc != 3) && (objc != 4)) {
|
||||
@@ -3593,12 +3601,18 @@ WmTransientCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (masterPtr == winPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"can't make \"%s\" its own master", Tk_PathName(winPtr)));
|
||||
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (masterPtr != wmPtr->masterPtr) {
|
||||
for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL;
|
||||
w = (TkWindow *)w->wmInfoPtr->masterPtr) {
|
||||
if (w == winPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"setting \"%s\" as master creates a transient/master cycle",
|
||||
Tk_PathName(masterPtr)));
|
||||
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (masterPtr != wmPtr->masterPtr) {
|
||||
/*
|
||||
* Remove old master map/unmap binding before setting the new
|
||||
* master. The event handler will ensure that transient states
|
||||
@@ -5785,6 +5799,18 @@ Tk_GetRootCoords(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int PointInWindow(
|
||||
int x,
|
||||
int y,
|
||||
WmInfo *wmPtr)
|
||||
{
|
||||
XWindowChanges changes = wmPtr->winPtr->changes;
|
||||
return (x >= changes.x &&
|
||||
x < changes.x + changes.width &&
|
||||
y >= changes.y - wmPtr->menuHeight &&
|
||||
y < changes.y + changes.height);
|
||||
}
|
||||
|
||||
Tk_Window
|
||||
Tk_CoordsToWindow(
|
||||
int rootX, int rootY, /* Coordinates of point in root window. If a
|
||||
@@ -5855,13 +5881,38 @@ Tk_CoordsToWindow(
|
||||
}
|
||||
for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
|
||||
wmPtr = wmPtr->nextPtr) {
|
||||
if (wmPtr->reparent == child) {
|
||||
goto gotToplevel;
|
||||
if (wmPtr->winPtr->mainPtr == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (child == wmPtr->reparent) {
|
||||
if (PointInWindow(x, y, wmPtr)) {
|
||||
goto gotToplevel;
|
||||
} else {
|
||||
|
||||
/*
|
||||
* Return NULL if the point is in the title bar or border.
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (wmPtr->wrapperPtr != NULL) {
|
||||
if (child == wmPtr->wrapperPtr->window) {
|
||||
goto gotToplevel;
|
||||
}
|
||||
} else if (wmPtr->winPtr->flags & TK_EMBEDDED &&
|
||||
TkpGetOtherWindow(wmPtr->winPtr) == NULL) {
|
||||
|
||||
/*
|
||||
* This toplevel is embedded in a window belonging to
|
||||
* a different application.
|
||||
*/
|
||||
|
||||
int rx, ry;
|
||||
Tk_GetRootCoords((Tk_Window) wmPtr->winPtr, &rx, &ry);
|
||||
childX -= rx;
|
||||
childY -= ry;
|
||||
goto gotToplevel;
|
||||
}
|
||||
} else if (child == wmPtr->winPtr->window) {
|
||||
goto gotToplevel;
|
||||
}
|
||||
@@ -5883,9 +5934,6 @@ Tk_CoordsToWindow(
|
||||
handler = NULL;
|
||||
}
|
||||
winPtr = wmPtr->winPtr;
|
||||
if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 3: at this point winPtr and wmPtr refer to the toplevel that
|
||||
@@ -5942,27 +5990,30 @@ Tk_CoordsToWindow(
|
||||
if (nextPtr == NULL) {
|
||||
break;
|
||||
}
|
||||
winPtr = nextPtr;
|
||||
x -= winPtr->changes.x;
|
||||
y -= winPtr->changes.y;
|
||||
if ((winPtr->flags & TK_CONTAINER)
|
||||
&& (winPtr->flags & TK_BOTH_HALVES)) {
|
||||
x -= nextPtr->changes.x;
|
||||
y -= nextPtr->changes.y;
|
||||
if ((nextPtr->flags & TK_CONTAINER)
|
||||
&& (nextPtr->flags & TK_BOTH_HALVES)) {
|
||||
/*
|
||||
* The window containing the point is a container, and the
|
||||
* embedded application is in this same process. Switch over to
|
||||
* the toplevel for the embedded application and start processing
|
||||
* that toplevel from scratch.
|
||||
*/
|
||||
|
||||
winPtr = TkpGetOtherWindow(winPtr);
|
||||
winPtr = TkpGetOtherWindow(nextPtr);
|
||||
if (winPtr == NULL) {
|
||||
return NULL;
|
||||
return (Tk_Window) nextPtr;
|
||||
}
|
||||
wmPtr = winPtr->wmInfoPtr;
|
||||
childX = x;
|
||||
childY = y;
|
||||
goto gotToplevel;
|
||||
}
|
||||
} else {
|
||||
winPtr = nextPtr;
|
||||
}
|
||||
}
|
||||
if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) {
|
||||
return NULL;
|
||||
}
|
||||
return (Tk_Window) winPtr;
|
||||
}
|
||||
@@ -6387,6 +6438,9 @@ TkWmStackorderToplevel(
|
||||
TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
|
||||
|
||||
window_ptr = windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *));
|
||||
if (windows == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Special cases: If zero or one toplevels were mapped there is no need to
|
||||
|
||||
Reference in New Issue
Block a user