summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-08-31 12:41:48 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-08-31 12:41:48 (GMT)
commit3f2bd047306169e148056331830dfb214349fb71 (patch)
tree2b5a0b3cbfc5581e6d160bfd15c479799e692d07 /unix
parente60c6c5d7af1eb749f10bb6e36aefcf3e21c1e1d (diff)
parent31c2a87428c8648983c3500fc9dc48bfb99c873e (diff)
downloadtk-3f2bd047306169e148056331830dfb214349fb71.zip
tk-3f2bd047306169e148056331830dfb214349fb71.tar.gz
tk-3f2bd047306169e148056331830dfb214349fb71.tar.bz2
merge trunk
Diffstat (limited to 'unix')
-rw-r--r--unix/Makefile.in11
-rwxr-xr-xunix/configure22
-rw-r--r--unix/configure.in38
-rw-r--r--unix/install-sh6
-rw-r--r--unix/tk.spec2
-rw-r--r--unix/tkConfig.sh.in2
-rw-r--r--unix/tkUnix.c34
-rw-r--r--unix/tkUnixColor.c21
-rw-r--r--unix/tkUnixConfig.c2
-rw-r--r--unix/tkUnixCursor.c82
-rw-r--r--unix/tkUnixEmbed.c82
-rw-r--r--unix/tkUnixEvent.c2
-rw-r--r--unix/tkUnixFont.c4
-rw-r--r--unix/tkUnixKey.c30
-rw-r--r--unix/tkUnixRFont.c4
-rw-r--r--unix/tkUnixSelect.c110
-rw-r--r--unix/tkUnixSend.c42
-rw-r--r--unix/tkUnixWm.c524
-rw-r--r--unix/tkUnixXId.c2
19 files changed, 565 insertions, 455 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 366805a..2de275c 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -362,7 +362,7 @@ TEXT_OBJS = tkText.o tkTextBTree.o tkTextDisp.o tkTextImage.o tkTextIndex.o \
tkTextMark.o tkTextTag.o tkTextWind.o
# either tkUnixFont.o (default) or tkUnixRFont.o (if --enable-xft)
-#
+#
FONT_OBJS = @UNIX_FONT_OBJS@
GENERIC_OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkBusy.o \
@@ -635,7 +635,7 @@ tktest-real: ${TK_STUB_LIB_FILE}
# # 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
# # tktest, and it is not clear where this test.o object file comes from.
-#
+#
# xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE) ${TK_STUB_LIB_FILE}
# ${CC} ${CFLAGS} ${LDFLAGS} test.o tkTest.o tkSquare.o \
# @TK_BUILD_LIB_SPEC@ ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} \
@@ -772,13 +772,13 @@ install-libraries: libraries
else true; \
fi; \
done;
- @echo "Installing library files to $(SCRIPT_INSTALL_DIR)/";
+ @echo "Installing Tk library files to $(SCRIPT_INSTALL_DIR)/";
@for i in $(TOP_DIR)/library/*.tcl $(TOP_DIR)/library/tclIndex \
$(UNIX_DIR)/tkAppInit.c; \
do \
$(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \
done;
- @echo "Installing library ttk files to $(SCRIPT_INSTALL_DIR)/ttk/";
+ @echo "Installing Ttk library files to $(SCRIPT_INSTALL_DIR)/ttk/";
@for i in $(TOP_DIR)/library/ttk/*.tcl; \
do \
if [ -f $$i ] ; then \
@@ -825,7 +825,7 @@ install-demos:
chmod 755 "$(DEMO_INSTALL_DIR)/$$i"; \
fi; \
done;
- @echo "Installing demo images to $(DEMO_INSTALL_DIR)/images/";
+ @echo "Installing demo image files to $(DEMO_INSTALL_DIR)/images/";
@for i in $(TOP_DIR)/library/demos/images/*; \
do \
if [ -f $$i ] ; then \
@@ -1554,7 +1554,6 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(M
$(UNIX_DIR)/README $(UNIX_DIR)/installManPage \
$(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(DISTDIR)/unix
chmod 775 $(DISTDIR)/unix/configure $(DISTDIR)/unix/configure.in
- chmod +x $(DISTDIR)/unix/install-sh
mkdir $(DISTDIR)/bitmaps
@(cd $(TOP_DIR); for i in bitmaps/* ; do \
if [ -f $$i ] ; then \
diff --git a/unix/configure b/unix/configure
index c6209ac..0877847 100755
--- a/unix/configure
+++ b/unix/configure
@@ -11197,23 +11197,23 @@ _ACEOF
HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk"
EXTRA_INSTALL="install-private-headers html-tk"
EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html'
- EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
+ EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
if test $tk_aqua != no; then
if test $tk_aqua = yes; then
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done'
else
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"'
fi
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'/" && $(INSTALL_DATA_DIR) "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"'
bindir="${libdir}/Resources/Wish.app/Contents/MacOS"
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/../" && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources/" && $(INSTALL_DATA_DIR) "$(BIN_INSTALL_DIR)/../Resources"'
if test $tk_aqua = yes; then
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources/" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"'
else
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources" && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources" && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources/" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
fi
fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
@@ -11224,7 +11224,7 @@ _ACEOF
EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
else
if test $tk_aqua = yes; then
- EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)" && mkdir -p "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done'
+ EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done'
fi
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
@@ -11251,7 +11251,7 @@ if test $tk_aqua = carbon; then
REZ=/Developer/Tools/Rez
REZ_FLAGS='-d "SystemSevenOrLater=1" -useDF -ro'
if test "$SHARED_BUILD" = 0; then
- EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) "$(LIB_INSTALL_DIR)"'
+ EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)/" && $(INSTALL_DATA) $(TK_RSRC_FILE) "$(LIB_INSTALL_DIR)"'
TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd | sed -e 's/ /\\\\ /g'`/\${TK_RSRC_FILE}"
WISH_BUILD_LIB_SPEC="$WISH_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd | sed -e 's/ /\\\\ /g'`/\${TK_RSRC_FILE}"
TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
diff --git a/unix/configure.in b/unix/configure.in
index 5759e04..bfe145c 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -218,7 +218,7 @@ AC_CHECK_TYPE([intptr_t], [
for tcl_cv_intptr_t in "int" "long" "long long" none; do
if test "$tcl_cv_intptr_t" != none; then
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
- [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])],
+ [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])],
[tcl_ok=yes], [tcl_ok=no])
test "$tcl_ok" = yes && break; fi
done])
@@ -234,7 +234,7 @@ AC_CHECK_TYPE([uintptr_t], [
none; do
if test "$tcl_cv_uintptr_t" != none; then
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
- [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])],
+ [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])],
[tcl_ok=yes], [tcl_ok=no])
test "$tcl_ok" = yes && break; fi
done])
@@ -307,7 +307,7 @@ if test "`uname -s`" = "Darwin" ; then
done
CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
- AC_TRY_LINK([#include <X11/Xlib.h>], [XrmInitialize();],
+ AC_TRY_LINK([#include <X11/Xlib.h>], [XrmInitialize();],
tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no)
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
@@ -396,7 +396,7 @@ else
# autoconf macro will return an include directory that contains
# no include files, so double-check its result just to be safe.
#--------------------------------------------------------------------
-
+
SC_PATH_X
TK_WINDOWINGSYSTEM=X11
fi
@@ -616,7 +616,7 @@ eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
eval "TK_LIB_FILE=libtk${LIB_SUFFIX}"
# tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
-# since on some platforms TK_LIB_FILE contains shell escapes.
+# since on some platforms TK_LIB_FILE contains shell escapes.
eval "TK_LIB_FILE=${TK_LIB_FILE}"
@@ -684,35 +684,35 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk"
EXTRA_INSTALL="install-private-headers html-tk"
- EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html'
- EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
+ EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html'
+ EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
if test $tk_aqua != no; then
if test $tk_aqua = yes; then
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done'
else
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"'
fi
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'/" && $(INSTALL_DATA_DIR) "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"'
bindir="${libdir}/Resources/Wish.app/Contents/MacOS"
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/../" && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources/" && $(INSTALL_DATA_DIR) "$(BIN_INSTALL_DIR)/../Resources"'
if test $tk_aqua = yes; then
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources/" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"'
else
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources" && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources" && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources/" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
fi
fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
- # Don't use AC_DEFINE for the following as the framework version define
- # needs to go into the Makefile even when using autoheader, so that we
+ # Don't use AC_DEFINE for the following as the framework version define
+ # needs to go into the Makefile even when using autoheader, so that we
# can pick up a potential make override of VERSION. Also, don't put this
# into CFLAGS as it should not go into tkConfig.sh
EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
else
if test $tk_aqua = yes; then
- EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)" && mkdir -p "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done'
+ EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done'
fi
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
@@ -739,7 +739,7 @@ if test $tk_aqua = carbon; then
REZ=/Developer/Tools/Rez
REZ_FLAGS='-d "SystemSevenOrLater=1" -useDF -ro'
if test "$SHARED_BUILD" = 0; then
- EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) "$(LIB_INSTALL_DIR)"'
+ EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)/" && $(INSTALL_DATA) $(TK_RSRC_FILE) "$(LIB_INSTALL_DIR)"'
TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd | sed -e 's/ /\\\\ /g'`/\${TK_RSRC_FILE}"
WISH_BUILD_LIB_SPEC="$WISH_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd | sed -e 's/ /\\\\ /g'`/\${TK_RSRC_FILE}"
TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
diff --git a/unix/install-sh b/unix/install-sh
index 5975819..7c34c3f 100644
--- a/unix/install-sh
+++ b/unix/install-sh
@@ -120,7 +120,7 @@ Options:
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
- -S $stripprog installed files.
+ -S $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
@@ -156,8 +156,8 @@ while test $# -ne 0; do
-s) stripcmd=$stripprog;;
--S) stripcmd="$stripprog $2"
- shift;;
+ -S) stripcmd="$stripprog $2"
+ shift;;
-t) dst_arg=$2
shift;;
diff --git a/unix/tk.spec b/unix/tk.spec
index 88a3007..29b72bb 100644
--- a/unix/tk.spec
+++ b/unix/tk.spec
@@ -32,7 +32,7 @@ CFLAGS="%optflags" ./configure \
--prefix=%{directory} \
--exec-prefix=%{directory} \
--libdir=%{directory}/%{_lib}
-make
+make
%install
cd unix
diff --git a/unix/tkConfig.sh.in b/unix/tkConfig.sh.in
index 1b96f37..bb85ad0 100644
--- a/unix/tkConfig.sh.in
+++ b/unix/tkConfig.sh.in
@@ -1,5 +1,5 @@
# tkConfig.sh --
-#
+#
# This shell script (for sh) is generated automatically by Tk's
# configure script. It will create shell variables for most of
# the configuration options discovered by the configure script.
diff --git a/unix/tkUnix.c b/unix/tkUnix.c
index 841a1b7..c6fff82 100644
--- a/unix/tkUnix.c
+++ b/unix/tkUnix.c
@@ -13,7 +13,14 @@
#include "tkInt.h"
#ifdef HAVE_XSS
-#include <X11/extensions/scrnsaver.h>
+# include <X11/extensions/scrnsaver.h>
+# ifdef __APPLE__
+/* Support for weak-linked libXss. */
+# define HaveXSSLibrary() (XScreenSaverQueryInfo != NULL)
+# else
+/* Other platforms always link libXss. */
+# define HaveXSSLibrary() (1)
+# endif
#endif
/*
@@ -26,7 +33,7 @@
* server" command.
*
* Results:
- * None.
+ * Sets the interpreter result.
*
* Side effects:
* None.
@@ -41,14 +48,11 @@ TkGetServerInfo(
Tk_Window tkwin) /* Token for window; this selects a particular
* display and server. */
{
- char buffer[8 + TCL_INTEGER_SPACE * 2];
- char buffer2[TCL_INTEGER_SPACE];
-
- sprintf(buffer, "X%dR%d ", ProtocolVersion(Tk_Display(tkwin)),
- ProtocolRevision(Tk_Display(tkwin)));
- sprintf(buffer2, " %d", VendorRelease(Tk_Display(tkwin)));
- Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)),
- buffer2, (char *) NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("X%dR%d %s %d",
+ ProtocolVersion(Tk_Display(tkwin)),
+ ProtocolRevision(Tk_Display(tkwin)),
+ ServerVendor(Tk_Display(tkwin)),
+ VendorRelease(Tk_Display(tkwin))));
}
/*
@@ -207,13 +211,9 @@ Tk_GetUserInactiveTime(
* on some buggy versions of XFree86.
*/
- if (
-#ifdef __APPLE__
- XScreenSaverQueryInfo != NULL && /* Support for weak-linked libXss. */
-#endif
- XScreenSaverQueryExtension(dpy, &eventBase, &errorBase) &&
- XScreenSaverQueryVersion(dpy, &major, &minor)) {
-
+ if (HaveXSSLibrary()
+ && XScreenSaverQueryExtension(dpy, &eventBase, &errorBase)
+ && XScreenSaverQueryVersion(dpy, &major, &minor)) {
XScreenSaverInfo *info = XScreenSaverAllocInfo();
if (info == NULL) {
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c
index 9bfe8bb..43500ad 100644
--- a/unix/tkUnixColor.c
+++ b/unix/tkUnixColor.c
@@ -136,6 +136,25 @@ TkpGetColor(
if (*name != '#') {
XColor screen;
+ if (((*name - 'A') & 0xdf) < sizeof(tkWebColors)/sizeof(tkWebColors[0])) {
+ if (!((name[0] - 'G') & 0xdf) && !((name[1] - 'R') & 0xdf)
+ && !((name[2] - 'A') & 0xdb) && !((name[3] - 'Y') & 0xdf)
+ && !name[4]) {
+ name = "#808080808080";
+ goto gotWebColor;
+ } else {
+ const char *p = tkWebColors[((*name - 'A') & 0x1f)];
+ if (p) {
+ const char *q = name;
+ while (!((*p - *(++q)) & 0xdf)) {
+ if (!*p++) {
+ name = p;
+ goto gotWebColor;
+ }
+ }
+ }
+ }
+ }
if (strlen(name) > 99) {
/* Don't bother to parse this. [Bug 2809525]*/
return (TkColor *) NULL;
@@ -155,6 +174,7 @@ TkpGetColor(
FindClosestColor(tkwin, &screen, &color);
}
} else {
+ gotWebColor:
if (TkParseColor(display, colormap, name, &color) == 0) {
return NULL;
}
@@ -420,6 +440,7 @@ TkpCmapStressed(
return 0;
}
+
/*
* Local Variables:
* mode: c
diff --git a/unix/tkUnixConfig.c b/unix/tkUnixConfig.c
index bb39127..3584494 100644
--- a/unix/tkUnixConfig.c
+++ b/unix/tkUnixConfig.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkUnixConfig.c --
*
* This module implements the Unix system defaults for the configuration
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c
index bbf5206..5266bde 100644
--- a/unix/tkUnixCursor.c
+++ b/unix/tkUnixCursor.c
@@ -182,7 +182,7 @@ static const struct TkCursorName {
static Cursor CreateCursorFromTableOrFile(Tcl_Interp *interp,
Tk_Window tkwin, int argc, const char **argv,
const struct TkCursorName *tkCursorPtr);
-
+
/*
*----------------------------------------------------------------------
*
@@ -275,8 +275,9 @@ TkGetCursorByName(
bg.red = bg.green = bg.blue = 65535;
} else {
if (TkParseColor(display, Tk_Colormap(tkwin), argv[1], &fg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", argv[1],
- "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "invalid color name \"%s\"", argv[1]));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL);
goto cleanup;
}
if (argc == 2) {
@@ -284,8 +285,9 @@ TkGetCursorByName(
maskIndex = namePtr->shape;
} else if (TkParseColor(display, Tk_Colormap(tkwin), argv[2],
&bg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", argv[2],
- "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "invalid color name \"%s\"", argv[2]));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL);
goto cleanup;
}
}
@@ -293,7 +295,9 @@ TkGetCursorByName(
if (dispPtr->cursorFont == None) {
dispPtr->cursorFont = XLoadFont(display, CURSORFONT);
if (dispPtr->cursorFont == None) {
- Tcl_SetResult(interp, "couldn't load cursor font", TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "couldn't load cursor font", -1));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "FONT", NULL);
goto cleanup;
}
}
@@ -306,8 +310,10 @@ TkGetCursorByName(
*/
if (!inTkTable && Tcl_IsSafe(interp)) {
- Tcl_AppendResult(interp, "can't get cursor from a file in",
- " a safe interpreter", NULL);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "can't get cursor from a file in a safe interpreter",
+ -1));
+ Tcl_SetErrorCode(interp, "TK", "SAFE", "CURSOR_FILE", NULL);
cursorPtr = NULL;
goto cleanup;
}
@@ -347,10 +353,11 @@ TkGetCursorByName(
if (argv) {
ckfree(argv);
}
- Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad cursor spec \"%s\"", string));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "CURSOR", NULL);
return NULL;
}
-
+
/*
*----------------------------------------------------------------------
*
@@ -419,8 +426,9 @@ CreateCursorFromTableOrFile(
data = TkGetBitmapData(NULL, tkCursorPtr->data, NULL,
&width, &height, &xHot, &yHot);
if (data == NULL) {
- Tcl_AppendResult(interp, "error reading bitmap data for \"",
- argv[0], "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "error reading bitmap data for \"%s\"", argv[0]));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "BITMAP_DATA", NULL);
goto cleanup;
}
@@ -430,20 +438,22 @@ CreateCursorFromTableOrFile(
if (TkReadBitmapFile(display, drawable, &argv[0][1],
(unsigned *) &width, (unsigned *) &height,
&source, &xHot, &yHot) != BitmapSuccess) {
- Tcl_AppendResult(interp, "cleanup reading bitmap file \"",
- &argv[0][1], "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "cleanup reading bitmap file \"%s\"", &argv[0][1]));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "BITMAP_FILE", NULL);
goto cleanup;
}
}
if ((xHot < 0) || (yHot < 0) || (xHot >= width) || (yHot >= height)) {
if (inTkTable) {
- Tcl_AppendResult(interp, "bad hot spot in bitmap data for \"",
- argv[0], "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad hot spot in bitmap data for \"%s\"", argv[0]));
} else {
- Tcl_AppendResult(interp, "bad hot spot in bitmap file \"",
- &argv[0][1], "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad hot spot in bitmap file \"%s\"", &argv[0][1]));
}
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "HOTSPOT", NULL);
goto cleanup;
}
@@ -457,8 +467,9 @@ CreateCursorFromTableOrFile(
} else if (argc == 2) {
fgColor = argv[1];
if (TkParseColor(display, Tk_Colormap(tkwin), fgColor, &fg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"",
- fgColor, "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "invalid color name \"%s\"", fgColor));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL);
goto cleanup;
}
if (inTkTable) {
@@ -476,13 +487,15 @@ CreateCursorFromTableOrFile(
bgColor = argv[3];
}
if (TkParseColor(display, Tk_Colormap(tkwin), fgColor, &fg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"",
- fgColor, "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "invalid color name \"%s\"", fgColor));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL);
goto cleanup;
}
if (TkParseColor(display, Tk_Colormap(tkwin), bgColor, &bg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"",
- bgColor, "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "invalid color name \"%s\"", bgColor));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL);
goto cleanup;
}
}
@@ -511,8 +524,9 @@ CreateCursorFromTableOrFile(
data = TkGetBitmapData(NULL, tkCursorPtr->mask, NULL,
&maskWidth, &maskHeight, &dummy1, &dummy2);
if (data == NULL) {
- Tcl_AppendResult(interp, "error reading bitmap mask data for \"",
- argv[0], "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "error reading bitmap mask data for \"%s\"", argv[0]));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "MASK_DATA", NULL);
goto cleanup;
}
@@ -524,15 +538,17 @@ CreateCursorFromTableOrFile(
if (TkReadBitmapFile(display, drawable, argv[1],
(unsigned int *) &maskWidth, (unsigned int *) &maskHeight,
&mask, &dummy1, &dummy2) != BitmapSuccess) {
- Tcl_AppendResult(interp, "cleanup reading bitmap file \"",
- argv[1], "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "cleanup reading bitmap file \"%s\"", argv[1]));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "MASK_FILE", NULL);
goto cleanup;
}
}
if ((maskWidth != width) || (maskHeight != height)) {
- Tcl_SetResult(interp, "source and mask bitmaps have different sizes",
- TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "source and mask bitmaps have different sizes", -1));
+ Tcl_SetErrorCode(interp, "TK", "CURSOR", "SIZE_MATCH", NULL);
goto cleanup;
}
@@ -548,7 +564,7 @@ CreateCursorFromTableOrFile(
}
return cursor;
}
-
+
/*
*----------------------------------------------------------------------
*
@@ -598,7 +614,7 @@ TkCreateCursorFromData(
}
return (TkCursor *) cursorPtr;
}
-
+
/*
*----------------------------------------------------------------------
*
@@ -625,7 +641,7 @@ TkpFreeCursor(
XFreeCursor(unixCursorPtr->display, (Cursor) unixCursorPtr->info.cursor);
Tk_FreeXId(unixCursorPtr->display, (XID) unixCursorPtr->info.cursor);
}
-
+
/*
* Local Variables:
* mode: c
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index bd5c512..8a4c368 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -106,12 +106,13 @@ TkpUseWindow(
Tk_ErrorHandler handler;
Container *containerPtr;
XWindowAttributes parentAtts;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->window != None) {
- Tcl_AppendResult(interp,
- "can't modify container after widget is created", NULL);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "can't modify container after widget is created", -1));
+ Tcl_SetErrorCode(interp, "TK", "EMBED", "POST_CREATE", NULL);
return TCL_ERROR;
}
if (Tcl_GetInt(interp, string, &id) != TCL_OK) {
@@ -120,12 +121,12 @@ TkpUseWindow(
parent = (Window) id;
usePtr = (TkWindow *) Tk_IdToWindow(winPtr->display, parent);
- if (usePtr != NULL) {
- if (!(usePtr->flags & TK_CONTAINER)) {
- Tcl_AppendResult(interp, "window \"", usePtr->pathName,
- "\" doesn't have -container option set", NULL);
- return TCL_ERROR;
- }
+ if (usePtr != NULL && !(usePtr->flags & TK_CONTAINER)) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "window \"%s\" doesn't have -container option set",
+ usePtr->pathName));
+ Tcl_SetErrorCode(interp, "TK", "EMBED", "CONTAINER", NULL);
+ return TCL_ERROR;
}
/*
@@ -145,8 +146,9 @@ TkpUseWindow(
Tk_DeleteErrorHandler(handler);
if (anyError) {
if (interp != NULL) {
- Tcl_AppendResult(interp, "couldn't create child of window \"",
- string, "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "couldn't create child of window \"%s\"", string));
+ Tcl_SetErrorCode(interp, "TK", "EMBED", "NO_TARGET", NULL);
}
return TCL_ERROR;
}
@@ -215,7 +217,7 @@ TkpMakeWindow(
* the window is to be created. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_EMBEDDED) {
@@ -271,7 +273,7 @@ TkpMakeContainer(
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -331,7 +333,7 @@ EmbedErrorProc(
XErrorEvent *errEventPtr) /* Points to information about error (not
* used). */
{
- int *iPtr = (int *) clientData;
+ int *iPtr = clientData;
*iPtr = 1;
return 0;
@@ -361,7 +363,7 @@ EmbeddedEventProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
if (eventPtr->type == DestroyNotify) {
EmbedWindowDeleted(winPtr);
@@ -393,10 +395,10 @@ ContainerEventProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
Container *containerPtr;
Tk_ErrorHandler errHandler;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -498,7 +500,7 @@ EmbedStructureProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = (Container *) clientData;
+ Container *containerPtr = clientData;
Tk_ErrorHandler errHandler;
if (eventPtr->type == ConfigureNotify) {
@@ -545,7 +547,7 @@ EmbedFocusProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = (Container *) clientData;
+ Container *containerPtr = clientData;
Tk_ErrorHandler errHandler;
Display *display;
@@ -703,7 +705,7 @@ TkpGetOtherWindow(
* window. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (containerPtr = tsdPtr->firstContainerPtr;
@@ -749,7 +751,7 @@ TkpRedirectKeyEvent(
{
Container *containerPtr;
Window saved;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -821,7 +823,7 @@ TkpClaimFocus(
{
XEvent event;
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(topLevelPtr->flags & TK_EMBEDDED)) {
@@ -872,7 +874,7 @@ TkpTestembedCmd(
Container *containerPtr;
Tcl_DString dString;
char buffer[50];
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((argc > 1) && (strcmp(argv[1], "all") == 0)) {
@@ -942,7 +944,7 @@ EmbedWindowDeleted(
* deleted. */
{
Container *containerPtr, *prevPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1000,7 +1002,7 @@ TkUnixContainerId(
TkWindow *winPtr) /* Tk's structure for an embedded window. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (containerPtr = tsdPtr->firstContainerPtr;
@@ -1132,8 +1134,7 @@ TkpMakeTransparentWindowExist(
* TkpCreateBusy --
*
* Construct the platform-specific parts of a busy window. Note that this
- * postpones the actual creation of the window resource until later. The
- * GetParent() function is a helper for this.
+ * postpones the actual creation of the window resource until later.
*
* Results:
* None.
@@ -1144,22 +1145,6 @@ TkpMakeTransparentWindowExist(
*----------------------------------------------------------------------
*/
-static inline Window
-GetParent(
- Display *display,
- Window window)
-{
- Window root, parent;
- Window *dummy;
- unsigned int count;
-
- if (XQueryTree(display, window, &root, &parent, &dummy, &count) > 0) {
- XFree(dummy);
- return parent;
- }
- return None;
-}
-
void
TkpCreateBusy(
Tk_FakeWin *winPtr,
@@ -1168,6 +1153,9 @@ TkpCreateBusy(
Tk_Window tkParent,
TkBusy busy)
{
+ Window root, parent, *dummy;
+ unsigned int count;
+
if (winPtr->flags & TK_REPARENTED) {
/*
* This works around a bug in the implementation of menubars for
@@ -1177,7 +1165,13 @@ TkpCreateBusy(
* by determining the parent via the native API calls.
*/
- *parentPtr = GetParent(Tk_Display(tkRef), Tk_WindowId(tkRef));
+ if (XQueryTree(Tk_Display(tkRef), Tk_WindowId(tkRef), &root,
+ &parent, &dummy, &count) > 0) {
+ XFree(dummy);
+ *parentPtr = parent;
+ } else {
+ *parentPtr = None;
+ }
} else {
*parentPtr = Tk_WindowId(tkParent);
}
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index 0987129..4d0ccfa 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -646,7 +646,7 @@ OpenIM(
}
if ((XGetIMValues(dispPtr->inputMethod, XNQueryInputStyle, &stylePtr,
- (void *) NULL) != NULL) || (stylePtr == NULL)) {
+ NULL) != NULL) || (stylePtr == NULL)) {
goto error;
}
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 136d69f..a4998aa 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -587,7 +587,7 @@ UtfToUcs2beProc(
srcStart = src;
srcEnd = src + srcLen;
srcClose = srcEnd;
- if ((flags & TCL_ENCODING_END) == 0) {
+ if (!(flags & TCL_ENCODING_END)) {
srcClose -= TCL_UTF_MAX;
}
@@ -1648,7 +1648,7 @@ InitFont(
pageMap = fontPtr->subFontArray[0].fontMap[0];
for (i = 0; i < 256; i++) {
if ((minHi > 0) || (i < minLo) || (i > maxLo)
- || (((pageMap[i>>3] >> (i&7)) & 1) == 0)) {
+ || !((pageMap[i>>3] >> (i&7)) & 1)) {
n = 0;
} else if (fontStructPtr->per_char == NULL) {
n = fontStructPtr->max_bounds.width;
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index 7461d75..d07f13a 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -11,6 +11,7 @@
*/
#include "tkInt.h"
+#include <X11/XKBlib.h>
/*
* Prototypes for local functions defined in this file:
@@ -63,9 +64,9 @@ Tk_SetCaretPos(
spot.x = dispPtr->caret.x;
spot.y = dispPtr->caret.y + dispPtr->caret.height;
- preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, (void *) NULL);
+ preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
XSetICValues(winPtr->inputContext, XNPreeditAttributes, preedit_attr,
- (void *) NULL);
+ NULL);
XFree(preedit_attr);
}
#endif
@@ -144,7 +145,7 @@ TkpGetString(
Tcl_DStringInit(&buf);
Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
- Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
+ Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
&kePtr->keysym, &status);
/*
@@ -210,8 +211,8 @@ TkpGetString(
/*
* When mapping from a keysym to a keycode, need information about the
- * modifier state that should be used so that when they call XKeycodeToKeysym
- * taking into account the xkey.state, they will get back the original keysym.
+ * modifier state to be used so that when they call XkbKeycodeToKeysym taking
+ * into account the xkey.state, they will get back the original keysym.
*/
void
@@ -230,7 +231,7 @@ TkpSetKeycodeAndState(
keycode = XKeysymToKeycode(display, keySym);
if (keycode != 0) {
for (state = 0; state < 4; state++) {
- if (XKeycodeToKeysym(display, keycode, state) == keySym) {
+ if (XkbKeycodeToKeysym(display, keycode, 0, state) == keySym){
if (state & 1) {
eventPtr->xkey.state |= ShiftMask;
}
@@ -276,7 +277,7 @@ TkpGetKeySym(
TkKeyEvent* kePtr = (TkKeyEvent*) eventPtr;
#ifdef TK_USE_INPUT_METHODS
- /*
+ /*
* If input methods are active, we may already have determined a keysym.
* Return it.
*/
@@ -320,7 +321,8 @@ TkpGetKeySym(
&& (eventPtr->xkey.state & LockMask))) {
index += 1;
}
- sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, index);
+ sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, 0,
+ index);
/*
* Special handling: if the key was shifted because of Lock, but lock is
@@ -334,8 +336,8 @@ TkpGetKeySym(
|| ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
|| ((sym >= XK_Ooblique) && (sym <= XK_Thorn)))) {
index &= ~1;
- sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
- index);
+ sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
+ 0, index);
}
}
@@ -345,8 +347,8 @@ TkpGetKeySym(
*/
if ((index & 1) && (sym == NoSymbol)) {
- sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
- index & ~1);
+ sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
+ 0, index & ~1);
}
return sym;
}
@@ -395,7 +397,7 @@ TkpInitKeymapInfo(
if (*codePtr == 0) {
continue;
}
- keysym = XKeycodeToKeysym(dispPtr->display, *codePtr, 0);
+ keysym = XkbKeycodeToKeysym(dispPtr->display, *codePtr, 0, 0);
if (keysym == XK_Shift_Lock) {
dispPtr->lockUsage = LU_SHIFT;
break;
@@ -421,7 +423,7 @@ TkpInitKeymapInfo(
if (*codePtr == 0) {
continue;
}
- keysym = XKeycodeToKeysym(dispPtr->display, *codePtr, 0);
+ keysym = XkbKeycodeToKeysym(dispPtr->display, *codePtr, 0, 0);
if (keysym == XK_Mode_switch) {
dispPtr->modeModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
}
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index 4203ff9..ab2ed4a 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -123,7 +123,7 @@ GetFont(
FC_FAMILY, FcTypeString, "sans",
FC_SIZE, FcTypeDouble, 12.0,
FC_MATRIX, FcTypeMatrix, &mat,
- (void *) NULL);
+ NULL);
}
if (!ftFont) {
/*
@@ -936,7 +936,7 @@ TkDrawAngledChars(
nglyph = 0;
currentFtFont = NULL;
originX = originY = 0; /* lint */
-
+
while (numBytes > 0 && x <= maxCoord && x >= minCoord && y <= maxCoord
&& y >= minCoord) {
XftFont *ftFont;
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 172d5ca..4bb462e 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -243,7 +243,7 @@ TkSelPropProc(
long buffer[TK_SEL_WORDS_AT_ONCE];
TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display);
Tk_ErrorHandler errorHandler;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -552,12 +552,12 @@ TkSelEventProc(
break;
}
if (eventPtr->xselection.property == None) {
- Tcl_SetResult(retrPtr->interp, NULL, TCL_STATIC);
- Tcl_AppendResult(retrPtr->interp,
+ Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf(
+ "%s selection doesn't exist or form \"%s\" not defined",
Tk_GetAtomName(tkwin, retrPtr->selection),
- " selection doesn't exist or form \"",
- Tk_GetAtomName(tkwin, retrPtr->target),
- "\" not defined", NULL);
+ Tk_GetAtomName(tkwin, retrPtr->target)));
+ Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION",
+ "NONE", NULL);
retrPtr->result = TCL_ERROR;
return;
}
@@ -574,8 +574,9 @@ TkSelEventProc(
return;
}
if (bytesAfter != 0) {
- Tcl_SetResult(retrPtr->interp, "selection property too large",
- TCL_STATIC);
+ Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj(
+ "selection property too large", -1));
+ Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "SIZE",NULL);
retrPtr->result = TCL_ERROR;
XFree(propInfo);
return;
@@ -583,13 +584,13 @@ TkSelEventProc(
if ((type == XA_STRING) || (type == dispPtr->textAtom)
|| (type == dispPtr->compoundTextAtom)) {
Tcl_Encoding encoding;
- if (format != 8) {
- char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf,
+ if (format != 8) {
+ Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf(
"bad format for string selection: wanted \"8\", got \"%d\"",
- format);
- Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
+ format));
+ Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT",
+ NULL);
retrPtr->result = TCL_ERROR;
return;
}
@@ -631,12 +632,11 @@ TkSelEventProc(
char *propData = propInfo;
if (format != 8) {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf,
+ Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf(
"bad format for string selection: wanted \"8\", got \"%d\"",
- format);
- Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
+ format));
+ Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT",
+ NULL);
retrPtr->result = TCL_ERROR;
return;
}
@@ -673,11 +673,11 @@ TkSelEventProc(
Tcl_DString ds;
if (format != 32 && format != 8) {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf, "bad format for selection: wanted \"32\" or "
- "\"8\", got \"%d\"", format);
- Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf(
+ "bad format for selection: wanted \"32\" or "
+ "\"8\", got \"%d\"", format));
+ Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT",
+ NULL);
retrPtr->result = TCL_ERROR;
return;
}
@@ -735,7 +735,7 @@ static void
SelTimeoutProc(
ClientData clientData) /* Information about retrieval in progress. */
{
- register TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *) clientData;
+ register TkSelRetrievalInfo *retrPtr = clientData;
/*
* Make sure that the retrieval is still in progress. Then see how long
@@ -753,8 +753,9 @@ SelTimeoutProc(
* selection return.
*/
- Tcl_SetResult(retrPtr->interp, "selection owner didn't respond",
- TCL_STATIC);
+ Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj(
+ "selection owner didn't respond", -1));
+ Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "IGNORED", NULL);
retrPtr->result = TCL_ERROR;
} else {
retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc,
@@ -805,7 +806,7 @@ ConvertSelection(
Tk_ErrorHandler errorHandler;
TkSelectionInfo *infoPtr;
TkSelInProgress ip;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1,
@@ -874,7 +875,7 @@ ConvertSelection(
}
goto refuse;
}
- incr.numConversions /= 2; /* Two atoms per conversion. */
+ incr.numConversions /= 2; /* Two atoms per conversion. */
}
/*
@@ -967,8 +968,9 @@ ConvertSelection(
* allows us to pass our utf-8 information untouched.
*/
- XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type, 8,
- PropModeReplace, (unsigned char *) buffer, numItems);
+ XChangeProperty(reply.xsel.display, reply.xsel.requestor,
+ property, type, 8, PropModeReplace,
+ (unsigned char *) buffer, numItems);
} else if ((type == XA_STRING)
|| (type == winPtr->dispPtr->compoundTextAtom)) {
Tcl_DString ds;
@@ -986,8 +988,9 @@ ConvertSelection(
encoding = Tcl_GetEncoding(NULL, "iso2022");
}
Tcl_UtfToExternalDString(encoding, (char *) buffer, -1, &ds);
- XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type, 8,
- PropModeReplace, (unsigned char *) Tcl_DStringValue(&ds),
+ XChangeProperty(reply.xsel.display, reply.xsel.requestor,
+ property, type, 8, PropModeReplace,
+ (unsigned char *) Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds));
if (encoding) {
Tcl_FreeEncoding(encoding);
@@ -1000,9 +1003,9 @@ ConvertSelection(
goto refuse;
}
format = 32;
- XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type,
- format, PropModeReplace, (unsigned char *) propPtr,
- numItems);
+ XChangeProperty(reply.xsel.display, reply.xsel.requestor,
+ property, type, format, PropModeReplace,
+ (unsigned char *) propPtr, numItems);
ckfree(propPtr);
}
}
@@ -1014,7 +1017,8 @@ ConvertSelection(
*/
if (incr.numIncrs > 0) {
- XSelectInput(reply.xsel.display, reply.xsel.requestor, PropertyChangeMask);
+ XSelectInput(reply.xsel.display, reply.xsel.requestor,
+ PropertyChangeMask);
incr.timeout = Tcl_CreateTimerHandler(1000, IncrTimeoutProc, &incr);
incr.idleTime = 0;
incr.reqWindow = reply.xsel.requestor;
@@ -1023,8 +1027,8 @@ ConvertSelection(
tsdPtr->pendingIncrs = &incr;
}
if (multiple) {
- XChangeProperty(reply.xsel.display, reply.xsel.requestor, reply.xsel.property,
- XA_ATOM, 32, PropModeReplace,
+ XChangeProperty(reply.xsel.display, reply.xsel.requestor,
+ reply.xsel.property, XA_ATOM, 32, PropModeReplace,
(unsigned char *) incr.multAtoms,
(int) incr.numConversions*2);
} else {
@@ -1052,7 +1056,7 @@ ConvertSelection(
}
Tcl_DeleteTimerHandler(incr.timeout);
errorHandler = Tk_CreateErrorHandler(winPtr->display,
- -1, -1,-1, (int (*)()) NULL, NULL);
+ -1, -1, -1, (int (*)()) NULL, NULL);
XSelectInput(reply.xsel.display, reply.xsel.requestor, 0L);
Tk_DeleteErrorHandler(errorHandler);
if (tsdPtr->pendingIncrs == &incr) {
@@ -1114,7 +1118,7 @@ SelRcvIncrProc(
ClientData clientData, /* Information about retrieval. */
register XEvent *eventPtr) /* X PropertyChange event. */
{
- register TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *) clientData;
+ register TkSelRetrievalInfo *retrPtr = clientData;
char *propInfo, **propInfoPtr = &propInfo;
Atom type;
int format, result;
@@ -1135,8 +1139,9 @@ SelRcvIncrProc(
return;
}
if (bytesAfter != 0) {
- Tcl_SetResult(retrPtr->interp, "selection property too large",
- TCL_STATIC);
+ Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj(
+ "selection property too large", -1));
+ Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "SIZE", NULL);
retrPtr->result = TCL_ERROR;
goto done;
}
@@ -1150,12 +1155,11 @@ SelRcvIncrProc(
Tcl_DString *dstPtr, temp;
if (format != 8) {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf,
+ Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf(
"bad format for string selection: wanted \"8\", got \"%d\"",
- format);
- Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
+ format));
+ Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT",
+ NULL);
retrPtr->result = TCL_ERROR;
goto done;
}
@@ -1257,11 +1261,11 @@ SelRcvIncrProc(
Tcl_DString ds;
if (format != 32 && format != 8) {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf, "bad format for selection: wanted \"32\" or "
- "\"8\", got \"%d\"", format);
- Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf(
+ "bad format for selection: wanted \"32\" or "
+ "\"8\", got \"%d\"", format));
+ Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT",
+ NULL);
retrPtr->result = TCL_ERROR;
goto done;
}
@@ -1362,7 +1366,7 @@ IncrTimeoutProc(
* retrieval for which we are selection
* owner. */
{
- register IncrInfo *incrPtr = (IncrInfo *) clientData;
+ register IncrInfo *incrPtr = clientData;
incrPtr->idleTime++;
if (incrPtr->idleTime >= 5) {
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index be53ec6..54c3cf2 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -984,15 +984,19 @@ Tk_SendCmd(
i++;
break;
} else {
- Tcl_AppendResult(interp, "bad option \"", argv[i],
- "\": must be -async, -displayof, or --", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad option \"%s\": must be -async, -displayof, or --",
+ argv[i]));
+ Tcl_SetErrorCode(interp, "TK", "SEND", "OPTION", NULL);
return TCL_ERROR;
}
}
if (argc < (i+2)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ?-option value ...? interpName arg ?arg ...?\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("wrong # args: should be "
+ "\"%s ?-option value ...? interpName arg ?arg ...?\"",
+ argv[0]));
+ Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
return TCL_ERROR;
}
destName = argv[i];
@@ -1067,7 +1071,10 @@ Tk_SendCmd(
commWindow = RegFindName(regPtr, destName);
RegClose(regPtr);
if (commWindow == None) {
- Tcl_AppendResult(interp, "no application named \"",destName,"\"",NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "no application named \"%s\"", destName));
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "APPLICATION", destName,
+ NULL);
return TCL_ERROR;
}
@@ -1190,12 +1197,10 @@ Tk_SendCmd(
ckfree(pending.errorInfo);
}
if (pending.errorCode != NULL) {
- Tcl_Obj *errorObjPtr = Tcl_NewStringObj(pending.errorCode, -1);
-
- Tcl_SetObjErrorCode(interp, errorObjPtr);
+ Tcl_SetObjErrorCode(interp, Tcl_NewStringObj(pending.errorCode, -1));
ckfree(pending.errorCode);
}
- Tcl_SetResult(interp, pending.result, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(pending.result, -1));
ckfree(pending.result);
return pending.code;
}
@@ -1228,6 +1233,7 @@ TkGetInterpNames(
{
TkWindow *winPtr = (TkWindow *) tkwin;
NameRegistry *regPtr;
+ Tcl_Obj *resultObj = Tcl_NewObj();
char *p;
/*
@@ -1262,7 +1268,8 @@ TkGetInterpNames(
* The application still exists; add its name to the result.
*/
- Tcl_AppendElement(interp, entryName);
+ Tcl_ListObjAppendElement(NULL, resultObj,
+ Tcl_NewStringObj(entryName, -1));
} else {
int count;
@@ -1285,6 +1292,7 @@ TkGetInterpNames(
}
}
RegClose(regPtr);
+ Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
}
@@ -1349,11 +1357,8 @@ SendInit(
* for it.
*/
- dispPtr->commTkwin = Tk_CreateWindow(interp, (Tk_Window) NULL,
- "_comm", DisplayString(dispPtr->display));
- if (dispPtr->commTkwin == NULL) {
- Tcl_Panic("Tk_CreateWindow failed in SendInit!");
- }
+ dispPtr->commTkwin = (Tk_Window) TkAllocWindow(dispPtr,
+ DefaultScreen(dispPtr->display), NULL);
Tcl_Preserve(dispPtr->commTkwin);
atts.override_redirect = True;
Tk_ChangeWindowAttributes(dispPtr->commTkwin,
@@ -1989,7 +1994,7 @@ TkpTestsendCmd(
*p = '\n';
}
}
- Tcl_SetResult(interp, property, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(property, -1));
}
if (property != NULL) {
XFree(property);
@@ -2013,10 +2018,7 @@ TkpTestsendCmd(
Tcl_DStringFree(&tmp);
}
} else if (strcmp(argv[1], "serial") == 0) {
- char buf[TCL_INTEGER_SPACE];
-
- sprintf(buf, "%d", localData.sendSerial+1);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(localData.sendSerial+1));
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
"\": must be bogus, prop, or serial", NULL);
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 48d9021..3362081 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -41,6 +41,7 @@ typedef struct ProtocolHandler {
/*
* Data for [wm attributes] command:
*/
+
typedef struct {
double alpha; /* Transparency; 0.0=transparent, 1.0=opaque */
int topmost; /* Flag: true=>stay-on-top */
@@ -277,6 +278,22 @@ typedef struct TkWmInfo {
#define WM_WITHDRAWN 0x4000
/*
+ * Wrapper for XGetWindowProperty and XChangeProperty to make them a *bit*
+ * less verbose.
+ */
+
+#define GetWindowProperty(wrapperPtr, atom, length, type, typePtr, formatPtr, numItemsPtr, bytesAfterPtr, itemsPtr) \
+ (XGetWindowProperty((wrapperPtr)->display, (wrapperPtr)->window, \
+ (atom), 0, (long) (length), False, (type), \
+ (typePtr), (formatPtr), (numItemsPtr), (bytesAfterPtr), \
+ (unsigned char **) (itemsPtr)) == Success)
+#define SetWindowProperty(wrapperPtr, atomName, type, width, data, length) \
+ XChangeProperty((wrapperPtr)->display, (wrapperPtr)->window, \
+ Tk_InternAtom((Tk_Window) wrapperPtr, (atomName)), \
+ (type), (width), PropModeReplace, (unsigned char *) (data), \
+ (int) (length))
+
+/*
* This module keeps a list of all top-level windows, primarily to simplify
* the job of Tk_CoordsToWindow. The list is called firstWmPtr and is stored
* in the TkDisplay structure.
@@ -697,7 +714,6 @@ TkWmMapWindow(
if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
&textProp) != 0) {
unsigned long pid = (unsigned long) getpid();
- Atom atom;
XSetWMClientMachine(winPtr->display,
wmPtr->wrapperPtr->window, &textProp);
@@ -710,10 +726,8 @@ TkWmMapWindow(
* _NET_WM_PID requires that to be set too.
*/
- atom = Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_PID");
- XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
- atom, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *) &pid, 1);
+ SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_PID",
+ XA_CARDINAL, 32, &pid, 1);
}
Tcl_DStringFree(&ds);
}
@@ -1041,9 +1055,8 @@ Tk_WmObjCmd(
return TCL_ERROR;
}
if (objc == 2) {
- Tcl_SetResult(interp,
- ((dispPtr->flags & TK_DISPLAY_WM_TRACING) ? "on" : "off"),
- TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
+ dispPtr->flags & TK_DISPLAY_WM_TRACING));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing) != TCL_OK) {
@@ -1072,8 +1085,10 @@ Tk_WmObjCmd(
winPtr = (TkWindow *) targetWin;
if (!Tk_IsTopLevel(winPtr) &&
(index != WMOPT_MANAGE) && (index != WMOPT_FORGET)) {
- Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't a top-level window", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "window \"%s\" isn't a top-level window", winPtr->pathName));
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TOPLEVEL", winPtr->pathName,
+ NULL);
return TCL_ERROR;
}
@@ -1183,12 +1198,13 @@ WmAspectCmd(
}
if (objc == 3) {
if (wmPtr->sizeHintsFlags & PAspect) {
- char buf[TCL_INTEGER_SPACE * 4];
+ Tcl_Obj *results[4];
- sprintf(buf, "%d %d %d %d", wmPtr->minAspect.x,
- wmPtr->minAspect.y, wmPtr->maxAspect.x,
- wmPtr->maxAspect.y);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ results[0] = Tcl_NewIntObj(wmPtr->minAspect.x);
+ results[1] = Tcl_NewIntObj(wmPtr->minAspect.y);
+ results[2] = Tcl_NewIntObj(wmPtr->maxAspect.x);
+ results[3] = Tcl_NewIntObj(wmPtr->maxAspect.y);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
}
@@ -1203,8 +1219,9 @@ WmAspectCmd(
}
if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
(denom2 <= 0)) {
- Tcl_SetResult(interp, "aspect number can't be <= 0",
- TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "aspect number can't be <= 0", -1));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "ASPECT", NULL);
return TCL_ERROR;
}
wmPtr->minAspect.x = numer1;
@@ -1263,10 +1280,8 @@ WmSetAttribute(
}
opacity = 0xFFFFFFFFul * wmPtr->reqState.alpha;
- XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
- Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_WINDOW_OPACITY"),
- XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opacity,
- 1L);
+ SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_WINDOW_OPACITY",
+ XA_CARDINAL, 32, &opacity, 1L);
wmPtr->attributes.alpha = wmPtr->reqState.alpha;
break;
@@ -1450,7 +1465,8 @@ WmClientCmd(
}
if (objc == 3) {
if (wmPtr->clientMachine != NULL) {
- Tcl_SetResult(interp, wmPtr->clientMachine, TCL_STATIC);
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj(wmPtr->clientMachine, -1));
}
return TCL_OK;
}
@@ -1492,9 +1508,8 @@ WmClientCmd(
* be set too.
*/
- XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
- Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_PID"),
- XA_CARDINAL,32, PropModeReplace, (unsigned char*)&pid, 1);
+ SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_PID", XA_CARDINAL,
+ 32, &pid, 1);
}
Tcl_DStringFree(&ds);
}
@@ -1530,8 +1545,7 @@ WmColormapwindowsCmd(
Window *cmapList;
TkWindow *winPtr2;
int count, i, windowObjc, gotToplevel;
- Tcl_Obj **windowObjv;
- char buffer[20];
+ Tcl_Obj **windowObjv, *resultObj;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?windowList?");
@@ -1546,6 +1560,7 @@ WmColormapwindowsCmd(
wmPtr->wrapperPtr->window, &cmapList, &count) == 0) {
return TCL_OK;
}
+ resultObj = Tcl_NewObj();
for (i = 0; i < count; i++) {
if ((i == (count-1))
&& (wmPtr->flags & WM_ADDED_TOPLEVEL_COLORMAP)) {
@@ -1554,13 +1569,15 @@ WmColormapwindowsCmd(
winPtr2 = (TkWindow *)
Tk_IdToWindow(winPtr->display, cmapList[i]);
if (winPtr2 == NULL) {
- sprintf(buffer, "0x%lx", cmapList[i]);
- Tcl_AppendElement(interp, buffer);
+ Tcl_ListObjAppendElement(NULL, resultObj,
+ Tcl_ObjPrintf("0x%lx", cmapList[i]));
} else {
- Tcl_AppendElement(interp, winPtr2->pathName);
+ Tcl_ListObjAppendElement(NULL, resultObj,
+ Tcl_NewStringObj(winPtr2->pathName, -1));
}
}
XFree((char *) cmapList);
+ Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
}
if (Tcl_ListObjGetElements(interp, objv[3], &windowObjc, &windowObjv)
@@ -1638,7 +1655,8 @@ WmCommandCmd(
if (wmPtr->cmdArgv != NULL) {
char *arg = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
- Tcl_SetResult(interp, arg, TCL_DYNAMIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(arg, -1));
+ ckfree(arg);
}
return TCL_OK;
}
@@ -1700,13 +1718,17 @@ WmDeiconifyCmd(
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't deiconify ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't deiconify %s: it is an icon for %s",
+ Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor)));
+ Tcl_SetErrorCode(interp, "TK", "WM", "DEICONIFY", "ICON", NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
- Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
- ": it is an embedded window", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't deiconify %s: it is an embedded window",
+ winPtr->pathName));
+ Tcl_SetErrorCode(interp, "TK", "WM", "DEICONIFY", "EMBEDDED", NULL);
return TCL_ERROR;
}
wmPtr->flags &= ~WM_WITHDRAWN;
@@ -1751,8 +1773,8 @@ WmFocusmodelCmd(
return TCL_ERROR;
}
if (objc == 3) {
- Tcl_SetResult(interp, (wmPtr->hints.input ? "passive" : "active"),
- TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ wmPtr->hints.input ? "passive" : "active", -1));
return TCL_OK;
}
@@ -1844,7 +1866,6 @@ WmFrameCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Window window;
- char buf[TCL_INTEGER_SPACE];
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -1854,8 +1875,7 @@ WmFrameCmd(
if (window == None) {
window = Tk_WindowId((Tk_Window) winPtr);
}
- sprintf(buf, "0x%x", (unsigned) window);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%x", (unsigned) window));
return TCL_OK;
}
@@ -1894,8 +1914,6 @@ WmGeometryCmd(
return TCL_ERROR;
}
if (objc == 3) {
- char buf[16 + TCL_INTEGER_SPACE * 4];
-
xSign = (wmPtr->flags & WM_NEGATIVE_X) ? '-' : '+';
ySign = (wmPtr->flags & WM_NEGATIVE_Y) ? '-' : '+';
if (wmPtr->gridWin != NULL) {
@@ -1907,9 +1925,8 @@ WmGeometryCmd(
width = winPtr->changes.width;
height = winPtr->changes.height;
}
- sprintf(buf, "%dx%d%c%d%c%d", width, height, xSign, wmPtr->x,
- ySign, wmPtr->y);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("%dx%d%c%d%c%d",
+ width, height, xSign, wmPtr->x, ySign, wmPtr->y));
return TCL_OK;
}
argv3 = Tcl_GetString(objv[3]);
@@ -1957,12 +1974,13 @@ WmGridCmd(
}
if (objc == 3) {
if (wmPtr->sizeHintsFlags & PBaseSize) {
- char buf[TCL_INTEGER_SPACE * 4];
+ Tcl_Obj *results[4];
- sprintf(buf, "%d %d %d %d", wmPtr->reqGridWidth,
- wmPtr->reqGridHeight, wmPtr->widthInc,
- wmPtr->heightInc);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ results[0] = Tcl_NewIntObj(wmPtr->reqGridWidth);
+ results[1] = Tcl_NewIntObj(wmPtr->reqGridHeight);
+ results[2] = Tcl_NewIntObj(wmPtr->widthInc);
+ results[3] = Tcl_NewIntObj(wmPtr->heightInc);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
}
@@ -1989,19 +2007,27 @@ WmGridCmd(
return TCL_ERROR;
}
if (reqWidth < 0) {
- Tcl_SetResult(interp, "baseWidth can't be < 0", TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "baseWidth can't be < 0", -1));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL);
return TCL_ERROR;
}
if (reqHeight < 0) {
- Tcl_SetResult(interp, "baseHeight can't be < 0", TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "baseHeight can't be < 0", -1));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL);
return TCL_ERROR;
}
if (widthInc <= 0) {
- Tcl_SetResult(interp, "widthInc can't be <= 0", TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "widthInc can't be <= 0", -1));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL);
return TCL_ERROR;
}
if (heightInc <= 0) {
- Tcl_SetResult(interp, "heightInc can't be <= 0", TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "heightInc can't be <= 0", -1));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL);
return TCL_ERROR;
}
Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc,
@@ -2049,7 +2075,7 @@ WmGroupCmd(
}
if (objc == 3) {
if (wmPtr->hints.flags & WindowGroupHint) {
- Tcl_SetResult(interp, wmPtr->leaderName, TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, -1));
}
return TCL_OK;
}
@@ -2123,10 +2149,9 @@ WmIconbitmapCmd(
}
if (objc == 3) {
if (wmPtr->hints.flags & IconPixmapHint) {
- Tcl_SetResult(interp, (char *)
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
Tk_NameOfBitmap(winPtr->display,
- wmPtr->hints.icon_pixmap),
- TCL_STATIC);
+ wmPtr->hints.icon_pixmap), -1));
}
return TCL_OK;
}
@@ -2181,29 +2206,38 @@ WmIconifyCmd(
return TCL_ERROR;
}
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": override-redirect flag is set", NULL);
+ 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;
}
if (wmPtr->masterPtr != NULL) {
- Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": it is a transient", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't iconify \"%s\": it is a transient",
+ winPtr->pathName));
+ Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "TRANSIENT", NULL);
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't iconify %s: it is an icon for %s",
+ winPtr->pathName, Tk_PathName(wmPtr->iconFor)));
+ Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
- Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an embedded window", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't iconify %s: it is an embedded window",
+ winPtr->pathName));
+ Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL);
return TCL_ERROR;
}
if (TkpWmSetState(winPtr, IconicState) == 0) {
- Tcl_SetResult(interp,
- "couldn't send iconify message to window manager",
- TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "couldn't send iconify message to window manager", -1));
+ Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -2244,9 +2278,9 @@ WmIconmaskCmd(
}
if (objc == 3) {
if (wmPtr->hints.flags & IconMaskHint) {
- Tcl_SetResult(interp, (char *)
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_mask),
- TCL_STATIC);
+ -1));
}
return TCL_OK;
}
@@ -2302,9 +2336,9 @@ WmIconnameCmd(
return TCL_ERROR;
}
if (objc == 3) {
- Tcl_SetResult(interp,
- ((wmPtr->iconName != NULL) ? wmPtr->iconName : ""),
- TCL_STATIC);
+ if (wmPtr->iconName != NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->iconName, -1));
+ }
return TCL_OK;
} else {
if (wmPtr->iconName != NULL) {
@@ -2373,8 +2407,10 @@ WmIconphotoCmd(
for (i = 3 + isDefault; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
if (photo == NULL) {
- Tcl_AppendResult(interp, "can't use \"", Tcl_GetString(objv[i]),
- "\" as iconphoto: not a photo image", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't use \"%s\" as iconphoto: not a photo image",
+ Tcl_GetString(objv[i])));
+ Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "PHOTO", NULL);
return TCL_ERROR;
}
Tk_PhotoGetSize(photo, &width, &height);
@@ -2498,11 +2534,11 @@ WmIconpositionCmd(
}
if (objc == 3) {
if (wmPtr->hints.flags & IconPositionHint) {
- char buf[TCL_INTEGER_SPACE * 2];
+ Tcl_Obj *results[2];
- sprintf(buf, "%d %d", wmPtr->hints.icon_x,
- wmPtr->hints.icon_y);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ results[0] = Tcl_NewIntObj(wmPtr->hints.icon_x);
+ results[1] = Tcl_NewIntObj(wmPtr->hints.icon_y);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
}
return TCL_OK;
}
@@ -2584,15 +2620,18 @@ WmIconwindowCmd(
return TCL_ERROR;
}
if (!Tk_IsTopLevel(tkwin2)) {
- Tcl_AppendResult(interp, "can't use ", Tcl_GetString(objv[3]),
- " as icon window: not at top level", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't use %s as icon window: not at top level",
+ Tcl_GetString(objv[3])));
+ Tcl_SetErrorCode(interp, "TK", "WM", "ICONWINDOW", "INNER", NULL);
return TCL_ERROR;
}
wmPtr2 = ((TkWindow *) tkwin2)->wmInfoPtr;
if (wmPtr2->iconFor != NULL) {
- Tcl_AppendResult(interp, Tcl_GetString(objv[3]),
- " is already an icon for ", Tk_PathName(wmPtr2->iconFor),
- NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "%s is already an icon for %s",
+ Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
+ Tcl_SetErrorCode(interp, "TK", "WM", "ICONWINDOW", "ICON", NULL);
return TCL_ERROR;
}
if (wmPtr->icon != NULL) {
@@ -2625,9 +2664,10 @@ WmIconwindowCmd(
if (XWithdrawWindow(Tk_Display(tkwin2),
Tk_WindowId(wmPtr2->wrapperPtr),
Tk_ScreenNumber(tkwin2)) == 0) {
- Tcl_SetResult(interp,
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't send withdraw message to window manager",
- TCL_STATIC);
+ -1));
+ Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL);
return TCL_ERROR;
}
WaitForMapNotify((TkWindow *) tkwin2, 0);
@@ -2667,9 +2707,10 @@ WmManageCmd(
if (!Tk_IsTopLevel(frameWin)) {
if (!Tk_IsManageable(frameWin)) {
- Tcl_AppendResult(interp, "window \"", Tk_PathName(frameWin),
- "\" is not manageable: must be a frame, labelframe or "
- "toplevel", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "window \"%s\" is not manageable: must be a frame,"
+ " labelframe or toplevel", Tk_PathName(frameWin)));
+ Tcl_SetErrorCode(interp, "TK", "WM", "MANAGE", NULL);
return TCL_ERROR;
}
TkFocusSplit(winPtr);
@@ -2731,11 +2772,12 @@ WmMaxsizeCmd(
return TCL_ERROR;
}
if (objc == 3) {
- char buf[TCL_INTEGER_SPACE * 2];
+ Tcl_Obj *results[2];
GetMaxSize(wmPtr, &width, &height);
- sprintf(buf, "%d %d", width, height);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ results[0] = Tcl_NewIntObj(width);
+ results[1] = Tcl_NewIntObj(height);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
@@ -2789,10 +2831,11 @@ WmMinsizeCmd(
return TCL_ERROR;
}
if (objc == 3) {
- char buf[TCL_INTEGER_SPACE * 2];
+ Tcl_Obj *results[2];
- sprintf(buf, "%d %d", wmPtr->minWidth, wmPtr->minHeight);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ results[0] = Tcl_NewIntObj(wmPtr->minWidth);
+ results[1] = Tcl_NewIntObj(wmPtr->minHeight);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
@@ -2901,11 +2944,14 @@ WmPositionfromCmd(
return TCL_ERROR;
}
if (objc == 3) {
+ const char *sourceStr = "";
+
if (wmPtr->sizeHintsFlags & USPosition) {
- Tcl_SetResult(interp, "user", TCL_STATIC);
+ sourceStr = "user";
} else if (wmPtr->sizeHintsFlags & PPosition) {
- Tcl_SetResult(interp, "program", TCL_STATIC);
+ sourceStr = "program";
}
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, -1));
return TCL_OK;
}
if (*Tcl_GetString(objv[3]) == '\0') {
@@ -2968,11 +3014,14 @@ WmProtocolCmd(
* Return a list of all defined protocols for the window.
*/
+ Tcl_Obj *resultObj = Tcl_NewObj();
+
for (protPtr = wmPtr->protPtr; protPtr != NULL;
protPtr = protPtr->nextPtr) {
- Tcl_AppendElement(interp,
- Tk_GetAtomName((Tk_Window) winPtr, protPtr->protocol));
+ Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
+ Tk_GetAtomName((Tk_Window)winPtr, protPtr->protocol),-1));
}
+ Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
}
protocol = Tk_InternAtom((Tk_Window) winPtr, Tcl_GetString(objv[3]));
@@ -2984,7 +3033,8 @@ WmProtocolCmd(
for (protPtr = wmPtr->protPtr; protPtr != NULL;
protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
- Tcl_SetResult(interp, protPtr->command, TCL_STATIC);
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj(protPtr->command, -1));
return TCL_OK;
}
}
@@ -2996,8 +3046,9 @@ WmProtocolCmd(
*/
if (strcmp(Tcl_GetString(objv[3]), "_NET_WM_PING") == 0) {
- Tcl_SetResult(interp, "may not alter handling of that protocol",
- TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "may not alter handling of that protocol", -1));
+ Tcl_SetErrorCode(interp, "TK", "WM", "PROTOCOL", "RESERVED", NULL);
return TCL_ERROR;
}
@@ -3066,12 +3117,11 @@ WmResizableCmd(
return TCL_ERROR;
}
if (objc == 3) {
- char buf[TCL_INTEGER_SPACE * 2];
+ Tcl_Obj *results[2];
- sprintf(buf, "%d %d",
- (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
- (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ results[0] = Tcl_NewBooleanObj(!(wmPtr->flags&WM_WIDTH_NOT_RESIZABLE));
+ results[1] = Tcl_NewBooleanObj(!(wmPtr->flags&WM_HEIGHT_NOT_RESIZABLE));
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
if ((Tcl_GetBooleanFromObj(interp, objv[3], &width) != TCL_OK)
@@ -3130,11 +3180,14 @@ WmSizefromCmd(
return TCL_ERROR;
}
if (objc == 3) {
+ const char *sourceStr = "";
+
if (wmPtr->sizeHintsFlags & USSize) {
- Tcl_SetResult(interp, "user", TCL_STATIC);
+ sourceStr = "user";
} else if (wmPtr->sizeHintsFlags & PSize) {
- Tcl_SetResult(interp, "program", TCL_STATIC);
+ sourceStr = "program";
}
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, -1));
return TCL_OK;
}
@@ -3198,11 +3251,15 @@ WmStackorderCmd(
if (objc == 3) {
windows = TkWmStackorderToplevel(winPtr);
if (windows != NULL) {
+ Tcl_Obj *resultObj = Tcl_NewObj();
+
/* ASSERT: true [Bug 1789819]*/
for (window_ptr = windows; *window_ptr ; window_ptr++) {
- Tcl_AppendElement(interp, (*window_ptr)->pathName);
+ Tcl_ListObjAppendElement(NULL, resultObj,
+ Tcl_NewStringObj((*window_ptr)->pathName, -1));
}
ckfree(windows);
+ Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
}
} else {
@@ -3216,20 +3273,24 @@ WmStackorderCmd(
winPtr2 = (TkWindow *) relWin;
if (!Tk_IsTopLevel(winPtr2)) {
- Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't a top-level window", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "window \"%s\" isn't a top-level window",
+ winPtr2->pathName));
+ Tcl_SetErrorCode(interp, "TK", "WM", "STACK", "TOPLEVEL", NULL);
return TCL_ERROR;
}
if (!Tk_IsMapped(winPtr)) {
- Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't mapped", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "window \"%s\" isn't mapped", winPtr->pathName));
+ Tcl_SetErrorCode(interp, "TK", "WM", "STACK", "MAPPED", NULL);
return TCL_ERROR;
}
if (!Tk_IsMapped(winPtr2)) {
- Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't mapped", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "window \"%s\" isn't mapped", winPtr2->pathName));
+ Tcl_SetErrorCode(interp, "TK", "WM", "STACK", "MAPPED", NULL);
return TCL_ERROR;
}
@@ -3239,9 +3300,10 @@ WmStackorderCmd(
*/
windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
-
if (windows == NULL) {
- Tcl_AppendResult(interp, "TkWmStackorderToplevel failed", NULL);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "TkWmStackorderToplevel failed", -1));
+ Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL);
return TCL_ERROR;
}
@@ -3309,9 +3371,10 @@ WmStateCmd(
}
if (objc == 4) {
if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't change state of ",
- Tcl_GetString(objv[2]), ": it is an icon for ",
- Tk_PathName(wmPtr->iconFor), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't change state of %s: it is an icon for %s",
+ Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor)));
+ Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "ICON", NULL);
return TCL_ERROR;
}
@@ -3325,42 +3388,53 @@ WmStateCmd(
(void) TkpWmSetState(winPtr, NormalState);
} else if (index == OPT_ICONIC) {
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": override-redirect flag is set", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't iconify \"%s\": override-redirect flag is set",
+ winPtr->pathName));
+ Tcl_SetErrorCode(interp, "TK", "WM", "STATE",
+ "OVERRIDE_REDIRECT", NULL);
return TCL_ERROR;
}
if (wmPtr->masterPtr != NULL) {
- Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": it is a transient", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't iconify \"%s\": it is a transient",
+ winPtr->pathName));
+ Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "TRANSIENT",
+ NULL);
return TCL_ERROR;
}
if (TkpWmSetState(winPtr, IconicState) == 0) {
- Tcl_SetResult(interp,
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't send iconify message to window manager",
- TCL_STATIC);
+ -1));
+ Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL);
return TCL_ERROR;
}
} else { /* OPT_WITHDRAWN */
wmPtr->flags |= WM_WITHDRAWN;
if (TkpWmSetState(winPtr, WithdrawnState) == 0) {
- Tcl_SetResult(interp,
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't send withdraw message to window manager",
- TCL_STATIC);
+ -1));
+ Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL);
return TCL_ERROR;
}
}
} else {
+ const char *state;
+
if (wmPtr->iconFor != NULL) {
- Tcl_SetResult(interp, "icon", TCL_STATIC);
+ state = "icon";
} else if (wmPtr->withdrawn) {
- Tcl_SetResult(interp, "withdrawn", TCL_STATIC);
+ state = "withdrawn";
} else if (Tk_IsMapped((Tk_Window) winPtr)
|| ((wmPtr->flags & WM_NEVER_MAPPED)
&& (wmPtr->hints.initial_state == NormalState))) {
- Tcl_SetResult(interp, "normal", TCL_STATIC);
+ state = "normal";
} else {
- Tcl_SetResult(interp, "iconic", TCL_STATIC);
+ state = "iconic";
}
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(state, -1));
}
return TCL_OK;
}
@@ -3399,10 +3473,11 @@ WmTitleCmd(
return TCL_ERROR;
}
if (objc == 3) {
- Tcl_SetResult(interp, (char *)
- ((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid),
- TCL_STATIC);
- return TCL_OK;
+ if (wmPtr->title) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->title, -1));
+ } else {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->nameUid, -1));
+ }
} else {
if (wmPtr->title != NULL) {
ckfree(wmPtr->title);
@@ -3493,9 +3568,10 @@ WmTransientCmd(
Tk_MakeWindowExist((Tk_Window) masterPtr);
if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[2]),
- "\" a transient: it is an icon for ",
- Tk_PathName(wmPtr->iconFor), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't make \"%s\" a transient: it is an icon for %s",
+ Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor)));
+ Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
return TCL_ERROR;
}
@@ -3505,15 +3581,17 @@ WmTransientCmd(
}
if (wmPtr2->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[3]),
- "\" a master: it is an icon for ",
- Tk_PathName(wmPtr2->iconFor), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't make \"%s\" a master: it is an icon for %s",
+ Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
+ Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
return TCL_ERROR;
}
if (masterPtr == winPtr) {
- Tcl_AppendResult(interp, "can't make \"", Tk_PathName(winPtr),
- "\" its own master", NULL);
+ 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) {
/*
@@ -3538,9 +3616,10 @@ WmTransientCmd(
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
if (wmPtr->masterPtr != NULL && !Tk_IsMapped(wmPtr->masterPtr)) {
if (TkpWmSetState(winPtr, WithdrawnState) == 0) {
- Tcl_SetResult(interp,
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't send withdraw message to window manager",
- TCL_STATIC);
+ -1));
+ Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL);
return TCL_ERROR;
}
} else {
@@ -3589,15 +3668,17 @@ WmWithdrawCmd(
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't withdraw ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't withdraw %s: it is an icon for %s",
+ Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor)));
+ Tcl_SetErrorCode(interp, "TK", "WM", "WITHDRAW", "ICON", NULL);
return TCL_ERROR;
}
wmPtr->flags |= WM_WITHDRAWN;
if (TkpWmSetState(winPtr, WithdrawnState) == 0) {
- Tcl_SetResult(interp,
- "couldn't send withdraw message to window manager",
- TCL_STATIC);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "couldn't send withdraw message to window manager", -1));
+ Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -4052,6 +4133,8 @@ ReparentEvent(
unsigned dummy;
Tk_ErrorHandler handler;
TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
+ Atom WM_ROOT = Tk_InternAtom((Tk_Window) wrapperPtr, "__WM_ROOT");
+ Atom SWM_ROOT = Tk_InternAtom((Tk_Window) wrapperPtr, "__SWM_ROOT");
/*
* Identify the root window for wrapperPtr. This is tricky because of
@@ -4065,15 +4148,11 @@ ReparentEvent(
wmPtr->vRoot = None;
handler = Tk_CreateErrorHandler(wrapperPtr->display, -1,-1,-1, NULL,NULL);
vrPtrPtr = &virtualRootPtr; /* Silence GCC warning */
- if (((XGetWindowProperty(wrapperPtr->display, wrapperPtr->window,
- Tk_InternAtom((Tk_Window) wrapperPtr, "__WM_ROOT"), 0, (long) 1,
- False, XA_WINDOW, &actualType, &actualFormat, &numItems,
- &bytesAfter, (unsigned char **) vrPtrPtr) == Success)
+ if ((GetWindowProperty(wrapperPtr, WM_ROOT, 1, XA_WINDOW,
+ &actualType, &actualFormat, &numItems, &bytesAfter, vrPtrPtr)
&& (actualType == XA_WINDOW))
- || ((XGetWindowProperty(wrapperPtr->display, wrapperPtr->window,
- Tk_InternAtom((Tk_Window) wrapperPtr, "__SWM_ROOT"), 0, (long) 1,
- False, XA_WINDOW, &actualType, &actualFormat, &numItems,
- &bytesAfter, (unsigned char **) vrPtrPtr) == Success)
+ || (GetWindowProperty(wrapperPtr, SWM_ROOT, 1, XA_WINDOW,
+ &actualType, &actualFormat, &numItems, &bytesAfter, vrPtrPtr)
&& (actualType == XA_WINDOW))) {
if ((actualFormat == 32) && (numItems == 1)) {
vRoot = wmPtr->vRoot = *virtualRootPtr;
@@ -4285,11 +4364,9 @@ PropertyEvent(
unsigned char *propertyValue = 0;
long maxLength = 1024;
- if (XGetWindowProperty(
- wrapperPtr->display, wrapperPtr->window, _NET_WM_STATE,
- 0l, maxLength, False, XA_ATOM,
+ if (GetWindowProperty(wrapperPtr, _NET_WM_STATE, maxLength, XA_ATOM,
&actualType, &actualFormat, &numItems, &bytesAfter,
- &propertyValue) == Success) {
+ &propertyValue)) {
CheckNetWmState(wmPtr, (Atom *) propertyValue, (int) numItems);
XFree(propertyValue);
}
@@ -4590,7 +4667,7 @@ UpdateGeometryInfo(
if (((width != winPtr->changes.width)
|| (height != winPtr->changes.height))
&& (wmPtr->gridWin == NULL)
- && ((wmPtr->sizeHintsFlags & (PMinSize|PMaxSize)) == 0)) {
+ && !(wmPtr->sizeHintsFlags & (PMinSize|PMaxSize))) {
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
}
if (wmPtr->flags & WM_UPDATE_SIZE_HINTS) {
@@ -4848,10 +4925,8 @@ UpdateTitle(
Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
- XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
- Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_NAME"),
- XA_UTF8_STRING, 8, PropModeReplace,
- (const unsigned char *) string, (signed int) strlen(string));
+ SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_NAME", XA_UTF8_STRING, 8,
+ string, strlen(string));
/*
* Set icon name:
@@ -4863,11 +4938,8 @@ UpdateTitle(
Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
- XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
- Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_ICON_NAME"),
- XA_UTF8_STRING, 8, PropModeReplace,
- (const unsigned char *) wmPtr->iconName,
- (signed int) strlen(wmPtr->iconName));
+ SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_ICON_NAME",
+ XA_UTF8_STRING, 8, wmPtr->iconName, strlen(wmPtr->iconName));
}
}
@@ -4898,14 +4970,8 @@ UpdatePhotoIcon(
size = winPtr->dispPtr->iconDataSize;
}
if (data != NULL) {
- /*
- * Set icon:
- */
-
- XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
- Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_ICON"),
- XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *) data, size);
+ SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_ICON", XA_CARDINAL, 32,
+ data, size);
}
}
@@ -5046,11 +5112,10 @@ UpdateNetWmState(
atoms[numAtoms++] = Tk_InternAtom(tkwin, "_NET_WM_STATE_FULLSCREEN");
}
- XChangeProperty(Tk_Display(tkwin), wmPtr->wrapperPtr->window,
- Tk_InternAtom(tkwin, "_NET_WM_STATE"), XA_ATOM, 32,
- PropModeReplace, (unsigned char *) atoms, numAtoms);
+ SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_STATE", XA_ATOM, 32, atoms,
+ numAtoms);
}
-
+
/*
*----------------------------------------------------------------------
*
@@ -5348,25 +5413,26 @@ UpdateHints(
*
* SetNetWmType --
*
- * Set the extended window manager hints for a toplevel window
- * to the types provided. The specification states that this
- * may be a list of window types in preferred order. To permit
- * for future type definitions, the set of names is unconstrained
- * and names are converted to upper-case and appended to
- * "_NET_WM_WINDOW_TYPE_" before being converted to an Atom.
+ * Set the extended window manager hints for a toplevel window to the
+ * types provided. The specification states that this may be a list of
+ * window types in preferred order. To permit for future type
+ * definitions, the set of names is unconstrained and names are converted
+ * to upper-case and appended to "_NET_WM_WINDOW_TYPE_" before being
+ * converted to an Atom.
*
*----------------------------------------------------------------------
*/
static int
-SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr)
+SetNetWmType(
+ TkWindow *winPtr,
+ Tcl_Obj *typePtr)
{
- Atom typeAtom, *atoms = NULL;
+ Atom *atoms = NULL;
WmInfo *wmPtr;
- TkWindow *wrapperPtr;
Tcl_Obj **objv;
int objc, n;
- Tk_Window tkwin = (Tk_Window)winPtr;
+ Tk_Window tkwin = (Tk_Window) winPtr;
Tcl_Interp *interp = Tk_Interp(tkwin);
if (TCL_OK != Tcl_ListObjGetElements(interp, typePtr, &objc, &objv)) {
@@ -5401,11 +5467,9 @@ SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr)
if (wmPtr->wrapperPtr == NULL) {
CreateWrapper(wmPtr);
}
- wrapperPtr = wmPtr->wrapperPtr;
- typeAtom = Tk_InternAtom(tkwin, "_NET_WM_WINDOW_TYPE");
- XChangeProperty(Tk_Display(tkwin), wrapperPtr->window, typeAtom,
- XA_ATOM, 32, PropModeReplace, (unsigned char *) atoms, objc);
+ SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_WINDOW_TYPE", XA_ATOM, 32,
+ atoms, objc);
ckfree(atoms);
return TCL_OK;
@@ -5416,22 +5480,22 @@ SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr)
*
* GetNetWmType --
*
- * Read the extended window manager type hint from a window
- * and return as a list of names suitable for use with
- * SetNetWmType.
+ * Read the extended window manager type hint from a window and return as
+ * a list of names suitable for use with SetNetWmType.
*
*----------------------------------------------------------------------
*/
static Tcl_Obj *
-GetNetWmType(TkWindow *winPtr)
+GetNetWmType(
+ TkWindow *winPtr)
{
Atom typeAtom, actualType, *atoms;
int actualFormat;
unsigned long n, count, bytesAfter;
unsigned char *propertyValue = NULL;
long maxLength = 1024;
- Tk_Window tkwin = (Tk_Window)winPtr;
+ Tk_Window tkwin = (Tk_Window) winPtr;
TkWindow *wrapperPtr;
Tcl_Obj *typePtr;
Tcl_Interp *interp;
@@ -5446,13 +5510,12 @@ GetNetWmType(TkWindow *winPtr)
wrapperPtr = winPtr->wmInfoPtr->wrapperPtr;
typeAtom = Tk_InternAtom(tkwin, "_NET_WM_WINDOW_TYPE");
- if (Success == XGetWindowProperty(wrapperPtr->display,
- wrapperPtr->window, typeAtom, 0L, maxLength, False,
- XA_ATOM, &actualType, &actualFormat, &count,
- &bytesAfter, &propertyValue)) {
- atoms = (Atom *)propertyValue;
+ if (GetWindowProperty(wrapperPtr, typeAtom, maxLength, XA_ATOM,
+ &actualType, &actualFormat, &count, &bytesAfter, &propertyValue)){
+ atoms = (Atom *) propertyValue;
for (n = 0; n < count; ++n) {
const char *name = Tk_GetAtomName(tkwin, atoms[n]);
+
if (strncmp("_NET_WM_WINDOW_TYPE_", name, 20) == 0) {
Tcl_ExternalToUtfDString(NULL, name+20, -1, &ds);
Tcl_UtfToLower(Tcl_DStringValue(&ds));
@@ -5570,7 +5633,7 @@ ParseGeometry(
* them.
*/
- if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
+ if (!(wmPtr->sizeHintsFlags & (USPosition|PPosition))) {
wmPtr->sizeHintsFlags |= USPosition;
flags |= WM_UPDATE_SIZE_HINTS;
}
@@ -5596,7 +5659,9 @@ ParseGeometry(
return TCL_OK;
error:
- Tcl_AppendResult(interp, "bad geometry specifier \"", string, "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad geometry specifier \"%s\"", string));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "GEOMETRY", NULL);
return TCL_ERROR;
}
@@ -6067,7 +6132,7 @@ Tk_MoveToplevelWindow(
wmPtr->y = y;
wmPtr->flags |= WM_MOVE_PENDING;
wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
- if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
+ if (!(wmPtr->sizeHintsFlags & (USPosition|PPosition))) {
wmPtr->sizeHintsFlags |= USPosition;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
}
@@ -6138,10 +6203,8 @@ UpdateWmProtocols(
*(atomPtr++) = protPtr->protocol;
}
}
- XChangeProperty(wmPtr->winPtr->display, wmPtr->wrapperPtr->window,
- Tk_InternAtom((Tk_Window) wmPtr->winPtr, "WM_PROTOCOLS"),
- XA_ATOM, 32, PropModeReplace, (unsigned char *) arrayPtr,
- atomPtr-arrayPtr);
+ SetWindowProperty(wmPtr->wrapperPtr, "WM_PROTOCOLS", XA_ATOM, 32,
+ arrayPtr, atomPtr-arrayPtr);
ckfree(arrayPtr);
}
@@ -6331,7 +6394,7 @@ TkWmStackorderToplevel(
goto done;
case 1:
hPtr = Tcl_FirstHashEntry(&table, &search);
- windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
+ windows[0] = Tcl_GetHashValue(hPtr);
windows[1] = NULL;
goto done;
}
@@ -6349,13 +6412,16 @@ TkWmStackorderToplevel(
for (i = 0; i < numChildren; i++) {
hPtr = Tcl_FindHashEntry(&table, (char *) children[i]);
if (hPtr != NULL) {
- childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
+ childWinPtr = Tcl_GetHashValue(hPtr);
*window_ptr++ = childWinPtr;
}
}
- /* ASSERT: window_ptr - windows == table.numEntries
+
+ /*
+ * ASSERT: window_ptr - windows == table.numEntries
* (#matched toplevel windows == #children) [Bug 1789819]
*/
+
*window_ptr = NULL;
if (numChildren) {
XFree((char *) children);
@@ -6757,7 +6823,14 @@ TkSetTransientFor(Tk_Window tkwin, Tk_Window parent)
if (parent == None) {
parent = Tk_Parent(tkwin);
while (!Tk_IsTopLevel(parent))
- parent = Tk_Parent(tkwin);
+ parent = Tk_Parent(parent);
+ }
+ /*
+ * Prevent crash due to incomplete initialization, or other problems.
+ * [Bugs 3554026, 3561016]
+ */
+ if (((TkWindow *)parent)->wmInfoPtr->wrapperPtr == NULL) {
+ CreateWrapper(((TkWindow *)parent)->wmInfoPtr);
}
XSetTransientForHint(Tk_Display(tkwin),
((TkWindow *)tkwin)->wmInfoPtr->wrapperPtr->window,
@@ -7302,14 +7375,13 @@ TkpWmSetState(
*
* RemapWindows
*
- * Adjust parent/child relation ships of
- * the given window hierarchy.
+ * Adjust parent/child relationships of the given window hierarchy.
*
* Results:
- * none
+ * None
*
* Side effects:
- * keeps windowing system (X11) happy
+ * Keeps windowing system (X11) happy
*
*----------------------------------------------------------------------
*/
diff --git a/unix/tkUnixXId.c b/unix/tkUnixXId.c
index cbc0a5d..819b7aa 100644
--- a/unix/tkUnixXId.c
+++ b/unix/tkUnixXId.c
@@ -35,7 +35,7 @@ Tk_FreeXId(
XID xid) /* Identifier that is no longer in use. */
{
/*
- * This does nothing, because the XC-MISC extension takes care of
+ * This does nothing, because the XC-MISC extension takes care of
* freeing XIDs for us. It has been a standard X11 extension for
* about 15 years as of 2008. Keith Packard and another X.org
* developer suggested that we remove the previous code that used: