summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-10-25 21:06:25 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-10-25 21:06:25 (GMT)
commit0d5336db012f45753abace489f18f0ca299c6961 (patch)
treeb1bf3280a9046df99226158978502eeb26f5b0a3 /unix
parente97381a6d921de403516d5b761539a450f4af83c (diff)
parent1320b8a2a9c1269a345d44d673a7a35707fbbe9c (diff)
downloadtk-core-tip-626.zip
tk-core-tip-626.tar.gz
tk-core-tip-626.tar.bz2
Merge 9.0core-tip-626
Diffstat (limited to 'unix')
-rw-r--r--unix/Makefile.in34
-rwxr-xr-xunix/configure436
-rw-r--r--unix/configure.ac116
-rwxr-xr-xunix/installManPage4
-rw-r--r--unix/tcl.m4241
-rw-r--r--unix/tk.spec2
-rw-r--r--unix/tkAppInit.c4
-rw-r--r--unix/tkConfig.h.in34
-rw-r--r--unix/tkUnix3d.c2
-rw-r--r--unix/tkUnixButton.c90
-rw-r--r--unix/tkUnixCursor.c2
-rw-r--r--unix/tkUnixDefault.h2
-rw-r--r--unix/tkUnixEmbed.c40
-rw-r--r--unix/tkUnixFont.c39
-rw-r--r--unix/tkUnixInit.c3
-rw-r--r--unix/tkUnixInt.h1
-rw-r--r--unix/tkUnixKey.c4
-rw-r--r--unix/tkUnixMenu.c12
-rw-r--r--unix/tkUnixMenubu.c63
-rw-r--r--unix/tkUnixPrint.c526
-rw-r--r--unix/tkUnixRFont.c21
-rw-r--r--unix/tkUnixScale.c124
-rw-r--r--unix/tkUnixScrlbr.c48
-rw-r--r--unix/tkUnixSend.c22
-rw-r--r--unix/tkUnixSysTray.c140
-rw-r--r--unix/tkUnixWm.c70
26 files changed, 1298 insertions, 782 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in
index a157615..2319180 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -266,8 +266,8 @@ TCL_STUB_FLAGS = @TCL_STUB_FLAGS@
# Libraries to use when linking. This definition is determined by the
# configure script.
-LIBS = @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@
-WISH_LIBS = $(TCL_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ @EXTRA_WISH_LIBS@
+LIBS = @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ @CUPS_LIBS@
+WISH_LIBS = $(TCL_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ @CUPS_LIBS@ @EXTRA_WISH_LIBS@
# The symbols below provide support for dynamic loading and shared
# libraries. See configure.ac for a description of what the
@@ -299,6 +299,10 @@ REZ_SWITCHES = @REZ_FLAGS@ -i $(GENERIC_DIR) -i $(TCL_GENERIC_DIR)
XFT_CFLAGS = @XFT_CFLAGS@
XFT_LIBS = @XFT_LIBS@
+# support for libcups
+CUPS_CFLAGS = @CUPS_CFLAGS@
+CUPS_LIBS = @CUPS_LIBS@
+
#----------------------------------------------------------------
# The information below is modified by the configure script when
# Makefile is generated from Makefile.in. You shouldn't normally
@@ -394,15 +398,16 @@ X11_OBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \
tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o tkIcu.o \
tkUnixFocus.o $(FONT_OBJS) tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
- tkUnixSend.o tkUnixSysNotify.o tkUnixSysTray.o tkUnixWm.o tkUnixXId.o
+ tkUnixSend.o tkUnixSysNotify.o tkUnixSysTray.o tkUnixWm.o tkUnixXId.o \
+ tkUnixPrint.o
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 tkMacOSXFileTypes.o tkMacOSXFont.o tkMacOSXHLEvents.o \
- tkMacOSXImage.o tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o \
+ tkMacOSXImage.o tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o \
tkMacOSXMenu.o tkMacOSXMenubutton.o tkMacOSXMenus.o \
- tkMacOSXMouseEvent.o tkMacOSXNotify.o tkMacOSXPrint.o tkMacOSXRegion.o \
+ tkMacOSXMouseEvent.o tkMacOSXNotify.o tkMacOSXPrint.o tkMacOSXRegion.o \
tkMacOSXScrlbr.o tkMacOSXSend.o tkMacOSXServices.o \
tkMacOSXSubwindows.o tkMacOSXSysTray.o tkMacOSXWindowEvent.o tkMacOSXWm.o \
tkMacOSXXStubs.o tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o \
@@ -516,7 +521,8 @@ X11_SRCS = \
$(UNIX_DIR)/tkUnixScale.c $(UNIX_DIR)/tkUnixScrlbr.c \
$(UNIX_DIR)/tkUnixSelect.c $(UNIX_DIR)/tkUnixSend.c \
$(UNIX_DIR)/tkUnixSysNotify $(UNIX_DIR)/tkUnixSysTray.c \
- $(UNIX_DIR)/tkUnixWm.c $(UNIX_DIR)/tkUnixXId.c
+ $(UNIX_DIR)/tkUnixWm.c $(UNIX_DIR)/tkUnixXId.c \
+ $(UNIX_DIR)/tkUnixPrint.c
AQUA_SRCS = \
$(MAC_OSX_DIR)/tkMacOSXBitmap.c $(MAC_OSX_DIR)/tkMacOSXButton.c \
@@ -642,7 +648,7 @@ ${LIB_FILE}: ${STUB_LIB_FILE} @LIB_RSRC_FILE@ ${OBJS} ${TK_ZIP_FILE}
if test "x$(MACHER)" = "x" ; then \
cat ${TK_ZIP_FILE} >> ${LIB_FILE}; \
else $(MACHER) append ${LIB_FILE} ${TK_ZIP_FILE} /tmp/macher_output; \
- mv /tmp/macher_output ${LIB_FILE}; chmod u+x ${LIB_FILE}; \
+ mv /tmp/macher_output ${LIB_FILE}; chmod u+x ${LIB_FILE}; \
fi; \
${NATIVE_ZIP} -A ${LIB_FILE} \
|| echo 'ignore zip-error by adjust sfx process (not executable?)'; \
@@ -684,7 +690,7 @@ ${WISH_EXE}: $(TK_STUB_LIB_FILE) $(WISH_OBJS) $(TK_LIB_FILE) @APP_RSRC_FILE@
if test "x$(MACHER)" = "x" ; then \
cat ${TK_ZIP_FILE} >> ${WISH_EXE}; \
else $(MACHER) append ${WISH_EXE} ${TK_ZIP_FILE} /tmp/macher_output; \
- mv /tmp/macher_output ${LIB_FILE}; chmod u+x ${LIB_FILE}; \
+ mv /tmp/macher_output ${LIB_FILE}; chmod u+x ${LIB_FILE}; \
fi; \
${NATIVE_ZIP} -A ${WISH_EXE} \
|| echo 'ignore zip-error by adjust sfx process (not executable?)'; \
@@ -1330,6 +1336,9 @@ tkUnixMenu.o: $(UNIX_DIR)/tkUnixMenu.c
tkUnixMenubu.o: $(UNIX_DIR)/tkUnixMenubu.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixMenubu.c
+tkUnixPrint.o: $(UNIX_DIR)/tkUnixPrint.c
+ $(CC) -c $(CC_SWITCHES) $(CUPS_CFLAGS) $(UNIX_DIR)/tkUnixPrint.c
+
tkUnixScale.o: $(UNIX_DIR)/tkUnixScale.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixScale.c
@@ -1730,15 +1739,10 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC
$(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/GNUmakefile $(MAC_OSX_DIR)/README \
$(MAC_OSX_DIR)/*.icns $(MAC_OSX_DIR)/*.tiff \
$(MAC_OSX_DIR)/*.[ch] $(MAC_OSX_DIR)/*.in \
- $(MAC_OSX_DIR)/*.ac $(MAC_OSX_DIR)/*.xcconfig \
- $(MAC_OSX_DIR)/*.sdef \
+ $(MAC_OSX_DIR)/*.ac $(MAC_OSX_DIR)/*.sdef \
$(DISTDIR)/macosx
$(DIST_INSTALL_SCRIPT) $(MAC_OSX_DIR)/configure $(DISTDIR)/macosx
$(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/macosx
- $(INSTALL_DATA_DIR) $(DISTDIR)/macosx/Tk.xcodeproj
- $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/Tk.xcodeproj/project.pbxproj \
- $(MAC_OSX_DIR)/Tk.xcodeproj/default.pbxuser \
- $(DISTDIR)/macosx/Tk.xcodeproj
$(INSTALL_DATA_DIR) $(DISTDIR)/compat
$(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms \
$(TOP_DIR)/compat/stdbool.h $(DISTDIR)/compat
@@ -1806,7 +1810,7 @@ alldist: dist
# This target creates the HTML folder for Tcl & Tk and places it
# in DISTDIR/html. It uses the tcltk-man2html.tcl tool from
# the Tcl group's tool workspace. It depends on the Tcl & Tk being
-# in directories called tcl8.3 & tk8.3 up two directories from the
+# in directories called tcl9.0 & tk9.0 up two directories from the
# TOOL_DIR.
#
diff --git a/unix/configure b/unix/configure
index ff77a98..4b7b43d 100755
--- a/unix/configure
+++ b/unix/configure
@@ -696,6 +696,8 @@ ZIP_PROG
MACHER_PROG
EXEEXT_FOR_BUILD
CC_FOR_BUILD
+CUPS_LIBS
+CUPS_CFLAGS
UNIX_FONT_OBJS
XFT_LIBS
XFT_CFLAGS
@@ -811,6 +813,7 @@ enable_symbols
enable_aqua
with_x
enable_xft
+enable_libcups
enable_xss
enable_framework
enable_zipfs
@@ -1464,6 +1467,7 @@ Optional Features:
--enable-symbols build with debugging symbols (default: off)
--enable-aqua=yes|no use Aqua windowingsystem on Mac OS X (default: no)
--enable-xft use freetype/fontconfig/xft (default: on)
+ --enable-libcups use libcups (default: on)
--enable-xss use XScreenSaver for activity timer (default: on)
--enable-framework package shared libraries in MacOSX frameworks
(default: off)
@@ -2603,7 +2607,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
TK_VERSION=9.0
TK_MAJOR_VERSION=9
TK_MINOR_VERSION=0
-TK_PATCH_LEVEL="b3"
+TK_PATCH_LEVEL=".1"
VERSION=${TK_VERSION}
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
@@ -2743,11 +2747,11 @@ printf "%s\n" "found ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
printf %s "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... " >&6; }
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: loading" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: loading" >&5
printf "%s\n" "loading" >&6; }
. "${TCL_BIN_DIR}/tclConfig.sh"
else
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
printf "%s\n" "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
fi
@@ -2758,9 +2762,9 @@ printf "%s\n" "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
# instead of TCL_BUILD_LIB_SPEC since it will work with both an
# installed and uninstalled version of Tcl.
if test -f "${TCL_BIN_DIR}/Makefile" ; then
- TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
- TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
- TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
+ TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
+ TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
+ TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
elif test "`uname -s`" = "Darwin"; then
# If Tcl was built as a framework, attempt to use the libraries
# from the framework at the given location so that linking works
@@ -4610,7 +4614,7 @@ then :
;;
*)
# Make sure only first arg gets _r
- CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'`
+ CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'`
;;
esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using $CC for compiling with threads" >&5
@@ -5184,19 +5188,19 @@ fi
if test "$do64bit" = yes
then :
- if test "$GCC" = yes
+ if test "$GCC" = yes
then :
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported by gcc" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported by gcc" >&5
printf "%s\n" "$as_me: WARNING: 64bit mode not supported by gcc" >&2;}
else case e in #(
e)
- do64bit_ok=yes
- SHLIB_LD="ld -64 -shared -rdata_shared"
- CFLAGS="$CFLAGS -64"
- LDFLAGS_ARCH="-64"
- ;;
+ do64bit_ok=yes
+ SHLIB_LD="ld -64 -shared -rdata_shared"
+ CFLAGS="$CFLAGS -64"
+ LDFLAGS_ARCH="-64"
+ ;;
esac
fi
@@ -5519,46 +5523,6 @@ fi
esac
fi
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -single_module flag" >&5
-printf %s "checking if ld accepts -single_module flag... " >&6; }
-if test ${tcl_cv_ld_single_module+y}
-then :
- printf %s "(cached) " >&6
-else case e in #(
- e)
- hold_ldflags=$LDFLAGS
- LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main (void)
-{
-int i;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
- tcl_cv_ld_single_module=yes
-else case e in #(
- e) tcl_cv_ld_single_module=no ;;
-esac
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
- conftest$ac_exeext conftest.$ac_ext
- LDFLAGS=$hold_ldflags ;;
-esac
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_single_module" >&5
-printf "%s\n" "$tcl_cv_ld_single_module" >&6; }
- if test $tcl_cv_ld_single_module = yes
-then :
-
- SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
-
-fi
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
@@ -5681,7 +5645,7 @@ then :
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
- done
+ done
fi
LIBS=$hold_libs ;;
esac
@@ -5746,7 +5710,7 @@ then :
printf "%s\n" "#define NO_COREFOUNDATION_64 1" >>confdefs.h
- LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
+ LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
fi
@@ -5767,11 +5731,11 @@ printf "%s\n" "#define _OE_SOCKETS 1" >>confdefs.h
if test "$SHARED_BUILD" = 1
then :
- SHLIB_LD='${CC} -shared'
+ SHLIB_LD='${CC} -shared'
else case e in #(
e)
- SHLIB_LD='${CC} -non_shared'
+ SHLIB_LD='${CC} -non_shared'
;;
esac
fi
@@ -6114,7 +6078,7 @@ esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
- LDFLAGS=$hold_ldflags ;;
+ LDFLAGS=$hold_ldflags ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_Bexport" >&5
@@ -6232,37 +6196,37 @@ fi
if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""
then :
- LIB_SUFFIX=${SHARED_LIB_SUFFIX}
- MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
- if test "${SHLIB_SUFFIX}" = ".dll"
+ LIB_SUFFIX=${SHARED_LIB_SUFFIX}
+ MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
+ if test "${SHLIB_SUFFIX}" = ".dll"
then :
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"'
- DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"'
+ DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
else case e in #(
e)
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
- ;;
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
+ ;;
esac
fi
else case e in #(
e)
- LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
+ LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
- if test "$RANLIB" = ""
+ if test "$RANLIB" = ""
then :
- MAKE_LIB='$(STLIB_LD) $@ ${OBJS}'
+ MAKE_LIB='$(STLIB_LD) $@ ${OBJS}'
else case e in #(
e)
- MAKE_LIB='${STLIB_LD} $@ ${OBJS} ; ${RANLIB} $@'
- ;;
+ MAKE_LIB='${STLIB_LD} $@ ${OBJS} ; ${RANLIB} $@'
+ ;;
esac
fi
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
;;
esac
fi
@@ -6271,11 +6235,11 @@ fi
if test "$RANLIB" = ""
then :
- MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS}'
+ MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS}'
else case e in #(
e)
- MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS} ; ${RANLIB} $@'
+ MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS} ; ${RANLIB} $@'
;;
esac
fi
@@ -6287,7 +6251,7 @@ fi
if test "x${TCL_LIBS}" = x
then :
- TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"
+ TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"
fi
@@ -6724,15 +6688,15 @@ else case e in #(
# See if we could use long anyway Note that we substitute in the
# type that is our current guess for a 64-bit type inside this check
# program, so it should be modified only carefully...
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
switch (0) {
- case 1: case (sizeof(long long)==sizeof(long)): ;
- }
+ case 1: case (sizeof(long long)==sizeof(long)): ;
+ }
;
return 0;
}
@@ -6878,7 +6842,7 @@ int
main (void)
{
struct dirent64 *p; DIR64 d = opendir64(".");
- p = readdir64(d); rewinddir64(d); closedir64(d);
+ p = readdir64(d); rewinddir64(d); closedir64(d);
;
return 0;
}
@@ -6945,8 +6909,8 @@ esac
fi
if test "x${tcl_cv_type_off64_t}" = "xyes" && \
- test "x${ac_cv_func_lseek64}" = "xyes" && \
- test "x${ac_cv_func_open64}" = "xyes" ; then
+ test "x${ac_cv_func_lseek64}" = "xyes" && \
+ test "x${ac_cv_func_open64}" = "xyes" ; then
printf "%s\n" "#define HAVE_TYPE_OFF64_T 1" >>confdefs.h
@@ -7215,11 +7179,11 @@ fi
if test "$TCL_PREFIX" != "$prefix"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING:
- Different --prefix selected for Tk and Tcl!
- [package require tk] may not work correctly in tclsh." >&5
+ Different --prefix selected for Tk and Tcl!
+ [package require tk] may not work correctly in tclsh." >&5
printf "%s\n" "$as_me: WARNING:
- Different --prefix selected for Tk and Tcl!
- [package require tk] may not work correctly in tclsh." >&2;}
+ Different --prefix selected for Tk and Tcl!
+ [package require tk] may not work correctly in tclsh." >&2;}
fi
#--------------------------------------------------------------------
@@ -7794,102 +7758,6 @@ then :
fi
- if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if weak import is available" >&5
-printf %s "checking if weak import is available... " >&6; }
-if test ${tcl_cv_cc_weak_import+y}
-then :
- printf %s "(cached) " >&6
-else case e in #(
- e)
- hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
- #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
- #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
- #endif
- #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020
- #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
- #endif
- int rand(void) __attribute__((weak_import));
-
-int
-main (void)
-{
-rand();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
- tcl_cv_cc_weak_import=yes
-else case e in #(
- e) tcl_cv_cc_weak_import=no ;;
-esac
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
- conftest$ac_exeext conftest.$ac_ext
- CFLAGS=$hold_cflags ;;
-esac
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_weak_import" >&5
-printf "%s\n" "$tcl_cv_cc_weak_import" >&6; }
- if test $tcl_cv_cc_weak_import = yes; then
-
-printf "%s\n" "#define HAVE_WEAK_IMPORT 1" >>confdefs.h
-
- fi
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if Darwin SUSv3 extensions are available" >&5
-printf %s "checking if Darwin SUSv3 extensions are available... " >&6; }
-if test ${tcl_cv_cc_darwin_c_source+y}
-then :
- printf %s "(cached) " >&6
-else case e in #(
- e)
- hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
- #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
- #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
- #endif
- #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050
- #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050
- #endif
- #define _DARWIN_C_SOURCE 1
- #include <sys/cdefs.h>
-
-int
-main (void)
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"
-then :
- tcl_cv_cc_darwin_c_source=yes
-else case e in #(
- e) tcl_cv_cc_darwin_c_source=no ;;
-esac
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
- CFLAGS=$hold_cflags ;;
-esac
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_darwin_c_source" >&5
-printf "%s\n" "$tcl_cv_cc_darwin_c_source" >&6; }
- if test $tcl_cv_cc_darwin_c_source = yes; then
-
-printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h
-
- fi
- fi
else
tk_aqua=no
fi
@@ -7900,10 +7768,10 @@ printf "%s\n" "#define MAC_OSX_TK 1" >>confdefs.h
LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore -framework Security -framework CoreGraphics"
if test -d /System/Library/Frameworks/UserNotifications.framework; then
- LIBS="$LIBS -framework UserNotifications"
+ LIBS="$LIBS -framework UserNotifications"
fi
if test -d "/System/Library/Frameworks/UniformTypeIdentifiers.framework"; then
- LIBS="$LIBS -weak_framework UniformTypeIdentifiers"
+ LIBS="$LIBS -weak_framework UniformTypeIdentifiers"
fi
EXTRA_CC_SWITCHES='-x objective-c'
TK_WINDOWINGSYSTEM=AQUA
@@ -8613,7 +8481,7 @@ printf "%s\n" "$as_me: WARNING: Can't find xft configuration, or xft is unusable
XFT_CFLAGS=""
XFT_LIBS=""
else
- enable_xft=yes
+ enable_xft=yes
fi
fi
if test $enable_xft = "yes" ; then
@@ -8630,6 +8498,66 @@ printf "%s\n" "#define HAVE_XFT 1" >>confdefs.h
fi
#--------------------------------------------------------------------
+# Check for libcups support
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use libcups" >&5
+printf %s "checking whether to use libcups... " >&6; }
+ # Check whether --enable-libcups was given.
+if test ${enable_libcups+y}
+then :
+ enableval=$enable_libcups; enable_libcups=$enableval
+else case e in #(
+ e) enable_libcups="default" ;;
+esac
+fi
+
+ CUPS_CFLAGS=""
+ CUPS_LIBS=""
+ if test "$enable_libcups" = "no" ; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_libcups" >&5
+printf "%s\n" "$enable_libcups" >&6; }
+ else
+ found_cups=`cups-config 2>/dev/null`
+ if test "$found_cups" = ""; then
+ found_cups=no
+ else
+ found_cups=yes
+ CUPS_CFLAGS="-DHAVE_CUPS"
+ CUPS_LIBS=`cups-config --libs`
+ fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $found_cups" >&5
+printf "%s\n" "$found_cups" >&6; }
+ if test "$found_cups" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $CUPS_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $CUPS_LIBS $XLIBSW"
+ ac_fn_c_check_header_compile "$LINENO" "cups/cups.h" "ac_cv_header_cups_cups_h" "#include <cups/cups.h>
+"
+if test "x$ac_cv_header_cups_cups_h" = xyes
+then :
+
+else case e in #(
+ e)
+ found_cups=no
+ CUPS_CFLAGS=""
+ CUPS_LIBS=""
+ ;;
+esac
+fi
+
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ fi
+
+
+fi
+
+
+#--------------------------------------------------------------------
# XXX Do this last.
# It might modify XLIBSW which could affect other tests.
#
@@ -8950,8 +8878,8 @@ printf "%s\n" "#define TK_FRAMEWORK 1" >>confdefs.h
LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
if test "${libdir}" = '${exec_prefix}/lib'; then
- # override libdir default
- libdir="/Library/Frameworks"
+ # override libdir default
+ libdir="/Library/Frameworks"
fi
if test ${TCL_MAJOR_VERSION} = 8 ; then
TK_LIB_FILE="Tk"
@@ -8994,7 +8922,7 @@ printf "%s\n" "#define TK_FRAMEWORK 1" >>confdefs.h
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)/" && $(INSTALL_DATA_DIR) "$(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"
@@ -9035,28 +8963,28 @@ if test "$tcl_ok" = "yes" -a "x$enable_framework" != "xyes"; then
# Put a plausible default for CC_FOR_BUILD in Makefile.
if test -z "$CC_FOR_BUILD"; then
if test "x$cross_compiling" = "xno"; then
- CC_FOR_BUILD='$(CC)'
+ CC_FOR_BUILD='$(CC)'
else
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5
printf %s "checking for gcc... " >&6; }
- if test ${ac_cv_path_cc+y}
+ if test ${ac_cv_path_cc+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
- search_path=`echo ${PATH} | sed -e 's/:/ /g'`
- for dir in $search_path ; do
- for j in `ls -r $dir/gcc 2> /dev/null` \
- `ls -r $dir/gcc 2> /dev/null` ; do
- if test x"$ac_cv_path_cc" = x ; then
- if test -f "$j" ; then
- ac_cv_path_cc=$j
- break
- fi
- fi
- done
- done
- ;;
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+ ;;
esac
fi
@@ -9076,17 +9004,17 @@ then :
printf %s "(cached) " >&6
else case e in #(
e) rm -f conftest*
- echo 'int main () { return 0; }' > conftest.c
- bfd_cv_build_exeext=
- ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
- *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- rm -f conftest*
- test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no ;;
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5
@@ -9114,25 +9042,25 @@ else case e in #(
e)
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
- for j in `ls -r $dir/macher 2> /dev/null` \
- `ls -r $dir/macher 2> /dev/null` ; do
- if test x"$ac_cv_path_macher" = x ; then
- if test -f "$j" ; then
- ac_cv_path_macher=$j
- break
- fi
- fi
- done
+ for j in `ls -r $dir/macher 2> /dev/null` \
+ `ls -r $dir/macher 2> /dev/null` ; do
+ if test x"$ac_cv_path_macher" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_macher=$j
+ break
+ fi
+ fi
+ done
done
;;
esac
fi
if test -f "$ac_cv_path_macher" ; then
- MACHER_PROG="$ac_cv_path_macher"
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MACHER_PROG" >&5
+ MACHER_PROG="$ac_cv_path_macher"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MACHER_PROG" >&5
printf "%s\n" "$MACHER_PROG" >&6; }
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found macher in environment" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found macher in environment" >&5
printf "%s\n" "Found macher in environment" >&6; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zip" >&5
@@ -9144,37 +9072,37 @@ else case e in #(
e)
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
- for j in `ls -r $dir/zip 2> /dev/null` \
- `ls -r $dir/zip 2> /dev/null` ; do
- if test x"$ac_cv_path_zip" = x ; then
- if test -f "$j" ; then
- ac_cv_path_zip=$j
- break
- fi
- fi
- done
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
done
;;
esac
fi
if test -f "$ac_cv_path_zip" ; then
- ZIP_PROG="$ac_cv_path_zip"
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5
+ ZIP_PROG="$ac_cv_path_zip"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5
printf "%s\n" "$ZIP_PROG" >&6; }
- ZIP_PROG_OPTIONS="-rq"
- ZIP_PROG_VFSSEARCH="*"
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5
+ ZIP_PROG_OPTIONS="-rq"
+ ZIP_PROG_VFSSEARCH="*"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5
printf "%s\n" "Found INFO Zip in environment" >&6; }
- # Use standard arguments for zip
+ # Use standard arguments for zip
else
- # It is not an error if an installed version of Zip can't be located.
- # We can use the locally distributed minizip instead
- ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
- ZIP_PROG_OPTIONS="-o -r"
- ZIP_PROG_VFSSEARCH="*"
- ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH. Building minizip" >&5
+ # It is not an error if an installed version of Zip can't be located.
+ # We can use the locally distributed minizip instead
+ ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
+ ZIP_PROG_OPTIONS="-o -r"
+ ZIP_PROG_VFSSEARCH="*"
+ ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH. Building minizip" >&5
printf "%s\n" "No zip found on PATH. Building minizip" >&6; }
fi
@@ -10450,12 +10378,12 @@ printf "%s\n" "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
"Tk.framework":C) n=Tk &&
- f=$n.framework && v=Versions/$VERSION &&
- rm -rf $f && mkdir -p $f/$v/Resources &&
- ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
- ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
- if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
- unset n f v
+ f=$n.framework && v=Versions/$VERSION &&
+ rm -rf $f && mkdir -p $f/$v/Resources &&
+ ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
+ ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
+ if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
+ unset n f v
;;
esac
diff --git a/unix/configure.ac b/unix/configure.ac
index 3bacf8b..0e30571 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -26,7 +26,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [
TK_VERSION=9.0
TK_MAJOR_VERSION=9
TK_MINOR_VERSION=0
-TK_PATCH_LEVEL="b3"
+TK_PATCH_LEVEL=".1"
VERSION=${TK_VERSION}
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
@@ -141,8 +141,8 @@ fi
if test "$TCL_PREFIX" != "$prefix"; then
AC_MSG_WARN([
- Different --prefix selected for Tk and Tcl!
- [[package require tk]] may not work correctly in tclsh.])
+ Different --prefix selected for Tk and Tcl!
+ [[package require tk]] may not work correctly in tclsh.])
fi
#--------------------------------------------------------------------
@@ -236,44 +236,6 @@ if test "`uname -s`" = "Darwin" ; then
LDFLAGS=$hold_ldflags])
fi
AC_CHECK_HEADERS(AvailabilityMacros.h)
- if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
- AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [
- hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
- #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
- #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
- #endif
- #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020
- #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
- #endif
- int rand(void) __attribute__((weak_import));
- ]], [[rand();]])],
- [tcl_cv_cc_weak_import=yes],[tcl_cv_cc_weak_import=no])
- CFLAGS=$hold_cflags])
- if test $tcl_cv_cc_weak_import = yes; then
- AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?])
- fi
- AC_CACHE_CHECK([if Darwin SUSv3 extensions are available],
- tcl_cv_cc_darwin_c_source, [
- hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
- #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
- #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
- #endif
- #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050
- #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050
- #endif
- #define _DARWIN_C_SOURCE 1
- #include <sys/cdefs.h>
- ]], [[]])],[tcl_cv_cc_darwin_c_source=yes],[tcl_cv_cc_darwin_c_source=no])
- CFLAGS=$hold_cflags])
- if test $tcl_cv_cc_darwin_c_source = yes; then
- AC_DEFINE(_DARWIN_C_SOURCE, 1,
- [Are Darwin SUSv3 extensions available?])
- fi
- fi
else
tk_aqua=no
fi
@@ -282,15 +244,15 @@ if test $tk_aqua = yes; then
AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?])
LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore -framework Security -framework CoreGraphics"
if test -d /System/Library/Frameworks/UserNotifications.framework; then
- LIBS="$LIBS -framework UserNotifications"
+ LIBS="$LIBS -framework UserNotifications"
fi
if test -d "/System/Library/Frameworks/UniformTypeIdentifiers.framework"; then
- LIBS="$LIBS -weak_framework UniformTypeIdentifiers"
+ LIBS="$LIBS -weak_framework UniformTypeIdentifiers"
fi
EXTRA_CC_SWITCHES='-x objective-c'
TK_WINDOWINGSYSTEM=AQUA
if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then
- AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?])
+ AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?])
fi
else
#--------------------------------------------------------------------
@@ -452,7 +414,7 @@ if test $tk_aqua = no; then
XFT_CFLAGS=""
XFT_LIBS=""
else
- enable_xft=yes
+ enable_xft=yes
fi
fi
if test $enable_xft = "yes" ; then
@@ -467,6 +429,52 @@ if test $tk_aqua = no; then
fi
#--------------------------------------------------------------------
+# Check for libcups support
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ AC_MSG_CHECKING([whether to use libcups])
+ AC_ARG_ENABLE(libcups,
+ AS_HELP_STRING([--enable-libcups],
+ [use libcups (default: on)]),
+ [enable_libcups=$enableval], [enable_libcups="default"])
+ CUPS_CFLAGS=""
+ CUPS_LIBS=""
+ if test "$enable_libcups" = "no" ; then
+ AC_MSG_RESULT([$enable_libcups])
+ else
+ found_cups=`cups-config 2>/dev/null`
+ dnl make sure package configurator (cups-config)
+ dnl says that libcups is present.
+ if test "$found_cups" = ""; then
+ found_cups=no
+ else
+ found_cups=yes
+ CUPS_CFLAGS="-DHAVE_CUPS"
+ CUPS_LIBS=`cups-config --libs`
+ fi
+ AC_MSG_RESULT([$found_cups])
+ dnl make sure that compiling against CUPS header file doesn't bomb
+ if test "$found_cups" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $CUPS_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $CUPS_LIBS $XLIBSW"
+ AC_CHECK_HEADER(cups/cups.h, [], [
+ found_cups=no
+ CUPS_CFLAGS=""
+ CUPS_LIBS=""
+ ],[#include <cups/cups.h>])
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ fi
+ AC_SUBST(CUPS_CFLAGS)
+ AC_SUBST(CUPS_LIBS)
+fi
+
+
+#--------------------------------------------------------------------
# XXX Do this last.
# It might modify XLIBSW which could affect other tests.
#
@@ -584,17 +592,17 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
# Construct a fake local framework structure to make linking with
# '-framework Tk' and running of tktest work
AC_CONFIG_COMMANDS([Tk.framework], [n=Tk &&
- f=$n.framework && v=Versions/$VERSION &&
- rm -rf $f && mkdir -p $f/$v/Resources &&
- ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
- ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
- if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
- unset n f v
+ f=$n.framework && v=Versions/$VERSION &&
+ rm -rf $f && mkdir -p $f/$v/Resources &&
+ ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
+ ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
+ if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
+ unset n f v
], VERSION=${TK_VERSION} && tk_aqua=${tk_aqua})
LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
if test "${libdir}" = '${exec_prefix}/lib'; then
- # override libdir default
- libdir="/Library/Frameworks"
+ # override libdir default
+ libdir="/Library/Frameworks"
fi
if test ${TCL_MAJOR_VERSION} = 8 ; then
TK_LIB_FILE="Tk"
@@ -637,7 +645,7 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
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)/" && $(INSTALL_DATA_DIR) "$(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"
diff --git a/unix/installManPage b/unix/installManPage
index 1e29bb0..f2e2f53 100755
--- a/unix/installManPage
+++ b/unix/installManPage
@@ -12,8 +12,8 @@ Suffix=""
while true; do
case $1 in
- -s | --symlinks ) Sym="-s " ;;
- -z | --compress ) Gzip=$2; shift ;;
+ -s | --symlinks ) Sym="-s " ;;
+ -z | --compress ) Gzip=$2; shift ;;
-e | --extension ) Gz=$2; shift ;;
-x | --suffix ) Suffix=$2; shift ;;
-*) cat <<EOF
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 7b84923..f968bd2 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -287,10 +287,10 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
- AC_MSG_RESULT([loading])
+ AC_MSG_RESULT([loading])
. "${TCL_BIN_DIR}/tclConfig.sh"
else
- AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
+ AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
fi
# If the TCL_BIN_DIR is the build directory (not the install directory),
@@ -300,9 +300,9 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
# instead of TCL_BUILD_LIB_SPEC since it will work with both an
# installed and uninstalled version of Tcl.
if test -f "${TCL_BIN_DIR}/Makefile" ; then
- TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
- TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
- TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
+ TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
+ TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
+ TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
elif test "`uname -s`" = "Darwin"; then
# If Tcl was built as a framework, attempt to use the libraries
# from the framework at the given location so that linking works
@@ -360,10 +360,10 @@ AC_DEFUN([SC_LOAD_TKCONFIG], [
AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
- AC_MSG_RESULT([loading])
+ AC_MSG_RESULT([loading])
. "${TK_BIN_DIR}/tkConfig.sh"
else
- AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
+ AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
fi
# If the TK_BIN_DIR is the build directory (not the install directory),
@@ -373,9 +373,9 @@ AC_DEFUN([SC_LOAD_TKCONFIG], [
# instead of TK_BUILD_LIB_SPEC since it will work with both an
# installed and uninstalled version of Tcl.
if test -f "${TK_BIN_DIR}/Makefile" ; then
- TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
- TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
- TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
+ TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
+ TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
+ TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
elif test "`uname -s`" = "Darwin"; then
# If Tk was built as a framework, attempt to use the libraries
# from the framework at the given location so that linking works
@@ -990,7 +990,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
;;
*)
# Make sure only first arg gets _r
- CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
+ CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
;;
esac
AC_MSG_RESULT([Using $CC for compiling with threads])
@@ -1249,14 +1249,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# Check to enable 64-bit flags for compiler/linker
AS_IF([test "$do64bit" = yes], [
- AS_IF([test "$GCC" = yes], [
- AC_MSG_WARN([64bit mode not supported by gcc])
- ], [
- do64bit_ok=yes
- SHLIB_LD="ld -64 -shared -rdata_shared"
- CFLAGS="$CFLAGS -64"
- LDFLAGS_ARCH="-64"
- ])
+ AS_IF([test "$GCC" = yes], [
+ AC_MSG_WARN([64bit mode not supported by gcc])
+ ], [
+ do64bit_ok=yes
+ SHLIB_LD="ld -64 -shared -rdata_shared"
+ CFLAGS="$CFLAGS -64"
+ LDFLAGS_ARCH="-64"
+ ])
])
;;
Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
@@ -1424,15 +1424,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
fat_32_64=yes])
])
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
- AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
- hold_ldflags=$LDFLAGS
- LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_single_module=yes],
- [tcl_cv_ld_single_module=no])
- LDFLAGS=$hold_ldflags])
- AS_IF([test $tcl_cv_ld_single_module = yes], [
- SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
- ])
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
@@ -1485,7 +1476,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AS_IF([test "$fat_32_64" = yes], [
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
- done])
+ done])
LIBS=$hold_libs])
AS_IF([test $tcl_cv_lib_corefoundation = yes], [
LIBS="$LIBS -framework CoreFoundation"
@@ -1508,7 +1499,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AS_IF([test $tcl_cv_lib_corefoundation_64 = no], [
AC_DEFINE(NO_COREFOUNDATION_64, 1,
[Is Darwin CoreFoundation unavailable for 64-bit?])
- LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
+ LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
])
])
])
@@ -1523,9 +1514,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# Digital OSF/1
SHLIB_CFLAGS=""
AS_IF([test "$SHARED_BUILD" = 1], [
- SHLIB_LD='${CC} -shared'
+ SHLIB_LD='${CC} -shared'
], [
- SHLIB_LD='${CC} -non_shared'
+ SHLIB_LD='${CC} -non_shared'
])
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
@@ -1722,7 +1713,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-Bexport"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_Bexport=yes],[tcl_cv_ld_Bexport=no])
- LDFLAGS=$hold_ldflags])
+ LDFLAGS=$hold_ldflags])
AS_IF([test $tcl_cv_ld_Bexport = yes], [
LDFLAGS="$LDFLAGS -Wl,-Bexport"
])
@@ -1798,30 +1789,30 @@ dnl # preprocessing tests use only CPPFLAGS.
DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
- LIB_SUFFIX=${SHARED_LIB_SUFFIX}
- MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
- AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"'
- DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
- ], [
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
- ])
+ LIB_SUFFIX=${SHARED_LIB_SUFFIX}
+ MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
+ AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"'
+ DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
+ ], [
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
+ ])
], [
- LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
-
- AS_IF([test "$RANLIB" = ""], [
- MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
- ], [
- MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
- ])
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
+ LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
+
+ AS_IF([test "$RANLIB" = ""], [
+ MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
+ ], [
+ MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
+ ])
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
])
# Stub lib does not depend on shared/static configuration
AS_IF([test "$RANLIB" = ""], [
- MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
+ MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
], [
- MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
+ MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
])
INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
@@ -1829,7 +1820,7 @@ dnl # preprocessing tests use only CPPFLAGS.
# The trick here is that we don't want to change the value of TCL_LIBS if
# it is already set when tclConfig.sh had been loaded by Tk.
AS_IF([test "x${TCL_LIBS}" = x], [
- TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"])
+ TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"])
AC_SUBST(TCL_LIBS)
# See if the compiler supports casting to a union type.
@@ -1931,7 +1922,6 @@ dnl # preprocessing tests use only CPPFLAGS.
# Results:
#
# Defines some of the following vars:
-# NO_STRING_H
# NO_SYS_WAIT_H
# NO_DLFCN_H
# HAVE_SYS_PARAM_H
@@ -1944,13 +1934,6 @@ AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
- # See also memmove check below for a place where NO_STRING_H can be
- # set and why.
-
- if test $tcl_ok = 0; then
- AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
- fi
-
AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
@@ -2352,9 +2335,9 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [
# See if we could use long anyway Note that we substitute in the
# type that is our current guess for a 64-bit type inside this check
# program, so it should be modified only carefully...
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) {
- case 1: case (sizeof(long long)==sizeof(long)): ;
- }]])],[tcl_cv_type_64bit="long long"],[])])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) {
+ case 1: case (sizeof(long long)==sizeof(long)): ;
+ }]])],[tcl_cv_type_64bit="long long"],[])])
if test "${tcl_cv_type_64bit}" = none ; then
AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?])
AC_MSG_RESULT([yes])
@@ -2389,7 +2372,7 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [
AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <dirent.h>]], [[struct dirent64 *p; DIR64 d = opendir64(".");
- p = readdir64(d); rewinddir64(d); closedir64(d);]])],
+ p = readdir64(d); rewinddir64(d); closedir64(d);]])],
[tcl_cv_DIR64=yes], [tcl_cv_DIR64=no])])
if test "x${tcl_cv_DIR64}" = "xyes" ; then
AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?])
@@ -2404,8 +2387,8 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [
dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
dnl functions lseek64 and open64 are defined.
if test "x${tcl_cv_type_off64_t}" = "xyes" && \
- test "x${ac_cv_func_lseek64}" = "xyes" && \
- test "x${ac_cv_func_open64}" = "xyes" ; then
+ test "x${ac_cv_func_lseek64}" = "xyes" && \
+ test "x${ac_cv_func_open64}" = "xyes" ; then
AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
AC_MSG_RESULT([yes])
else
@@ -2907,7 +2890,7 @@ AC_DEFUN([SC_TCL_IPV6],[
]])
if test "x$NEED_FAKE_RFC2553" = "x1"; then
AC_DEFINE([NEED_FAKE_RFC2553], 1,
- [Use compat implementation of getaddrinfo() and friends])
+ [Use compat implementation of getaddrinfo() and friends])
AC_LIBOBJ([fake-rfc2553])
AC_CHECK_FUNC(strlcpy)
fi
@@ -2930,23 +2913,23 @@ dnl Get a default for CC_FOR_BUILD to put into Makefile.
AC_DEFUN([AX_CC_FOR_BUILD],[# Put a plausible default for CC_FOR_BUILD in Makefile.
if test -z "$CC_FOR_BUILD"; then
if test "x$cross_compiling" = "xno"; then
- CC_FOR_BUILD='$(CC)'
+ CC_FOR_BUILD='$(CC)'
else
- AC_MSG_CHECKING([for gcc])
- AC_CACHE_VAL(ac_cv_path_cc, [
- search_path=`echo ${PATH} | sed -e 's/:/ /g'`
- for dir in $search_path ; do
- for j in `ls -r $dir/gcc 2> /dev/null` \
- `ls -r $dir/gcc 2> /dev/null` ; do
- if test x"$ac_cv_path_cc" = x ; then
- if test -f "$j" ; then
- ac_cv_path_cc=$j
- break
- fi
- fi
- done
- done
- ])
+ AC_MSG_CHECKING([for gcc])
+ AC_CACHE_VAL(ac_cv_path_cc, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
fi
fi
AC_SUBST(CC_FOR_BUILD)
@@ -2957,18 +2940,18 @@ AC_DEFUN([AX_CC_FOR_BUILD],[# Put a plausible default for CC_FOR_BUILD in Makefi
else
OBJEXT_FOR_BUILD='.no'
AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
- [rm -f conftest*
- echo 'int main () { return 0; }' > conftest.c
- bfd_cv_build_exeext=
- ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
- *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- rm -f conftest*
- test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+ [rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
EXEEXT_FOR_BUILD=""
test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
fi
@@ -3004,52 +2987,52 @@ AC_DEFUN([SC_ZIPFS_SUPPORT], [
AC_CACHE_VAL(ac_cv_path_macher, [
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
- for j in `ls -r $dir/macher 2> /dev/null` \
- `ls -r $dir/macher 2> /dev/null` ; do
- if test x"$ac_cv_path_macher" = x ; then
- if test -f "$j" ; then
- ac_cv_path_macher=$j
- break
- fi
- fi
- done
+ for j in `ls -r $dir/macher 2> /dev/null` \
+ `ls -r $dir/macher 2> /dev/null` ; do
+ if test x"$ac_cv_path_macher" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_macher=$j
+ break
+ fi
+ fi
+ done
done
])
if test -f "$ac_cv_path_macher" ; then
- MACHER_PROG="$ac_cv_path_macher"
- AC_MSG_RESULT([$MACHER_PROG])
- AC_MSG_RESULT([Found macher in environment])
+ MACHER_PROG="$ac_cv_path_macher"
+ AC_MSG_RESULT([$MACHER_PROG])
+ AC_MSG_RESULT([Found macher in environment])
fi
AC_MSG_CHECKING([for zip])
AC_CACHE_VAL(ac_cv_path_zip, [
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
- for j in `ls -r $dir/zip 2> /dev/null` \
- `ls -r $dir/zip 2> /dev/null` ; do
- if test x"$ac_cv_path_zip" = x ; then
- if test -f "$j" ; then
- ac_cv_path_zip=$j
- break
- fi
- fi
- done
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
done
])
if test -f "$ac_cv_path_zip" ; then
- ZIP_PROG="$ac_cv_path_zip"
- AC_MSG_RESULT([$ZIP_PROG])
- ZIP_PROG_OPTIONS="-rq"
- ZIP_PROG_VFSSEARCH="*"
- AC_MSG_RESULT([Found INFO Zip in environment])
- # Use standard arguments for zip
+ ZIP_PROG="$ac_cv_path_zip"
+ AC_MSG_RESULT([$ZIP_PROG])
+ ZIP_PROG_OPTIONS="-rq"
+ ZIP_PROG_VFSSEARCH="*"
+ AC_MSG_RESULT([Found INFO Zip in environment])
+ # Use standard arguments for zip
else
- # It is not an error if an installed version of Zip can't be located.
- # We can use the locally distributed minizip instead
- ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
- ZIP_PROG_OPTIONS="-o -r"
- ZIP_PROG_VFSSEARCH="*"
- ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
- AC_MSG_RESULT([No zip found on PATH. Building minizip])
+ # It is not an error if an installed version of Zip can't be located.
+ # We can use the locally distributed minizip instead
+ ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
+ ZIP_PROG_OPTIONS="-o -r"
+ ZIP_PROG_VFSSEARCH="*"
+ ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
+ AC_MSG_RESULT([No zip found on PATH. Building minizip])
fi
AC_SUBST(MACHER_PROG)
AC_SUBST(ZIP_PROG)
diff --git a/unix/tk.spec b/unix/tk.spec
index abb352f..248b38a 100644
--- a/unix/tk.spec
+++ b/unix/tk.spec
@@ -4,7 +4,7 @@
Name: tk
Summary: Tk graphical toolkit for the Tcl scripting language.
-Version: 9.0b3
+Version: 9.0.1
Release: 2
License: BSD
Group: Development/Languages
diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c
index c427ac1..09db8e0 100644
--- a/unix/tkAppInit.c
+++ b/unix/tkAppInit.c
@@ -35,7 +35,7 @@
#undef STATIC_BUILD
#include "tk.h"
#include "tkPort.h"
-#if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7
+#if (TCL_MAJOR_VERSION < 9) && defined(TCL_MINOR_VERSION) && (TCL_MINOR_VERSION < 7)
# define Tcl_LibraryInitProc Tcl_PackageInitProc
# define Tcl_StaticLibrary Tcl_StaticPackage
#endif
@@ -107,7 +107,7 @@ main(
{
#ifdef TK_LOCAL_MAIN_HOOK
TK_LOCAL_MAIN_HOOK(&argc, &argv);
-#elif (TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION > 6)
+#elif TCL_MAJOR_VERSION > 8 || !defined(TCL_MINOR_VERSION) || TCL_MINOR_VERSION > 6
/* This doesn't work with Tcl 8.6 */
TclZipfs_AppHook(&argc, &argv);
#endif
diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in
index ffc0e06..695fb3a 100644
--- a/unix/tkConfig.h.in
+++ b/unix/tkConfig.h.in
@@ -19,28 +19,28 @@
/* Compiler support for module scope symbols */
#undef HAVE_HIDDEN
-/* Define to 1 if the system has the type `intptr_t'. */
+/* Define to 1 if the system has the type 'intptr_t'. */
#undef HAVE_INTPTR_T
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-/* Define to 1 if you have the `Xft' library (-lXft). */
+/* Define to 1 if you have the 'Xft' library (-lXft). */
#undef HAVE_LIBXFT
-/* Define to 1 if you have the `lseek64' function. */
+/* Define to 1 if you have the 'lseek64' function. */
#undef HAVE_LSEEK64
-/* Define to 1 if you have the `open64' function. */
+/* Define to 1 if you have the 'open64' function. */
#undef HAVE_OPEN64
-/* Define to 1 if you have the `posix_spawnattr_setflags' function. */
+/* Define to 1 if you have the 'posix_spawnattr_setflags' function. */
#undef HAVE_POSIX_SPAWNATTR_SETFLAGS
-/* Define to 1 if you have the `posix_spawnp' function. */
+/* Define to 1 if you have the 'posix_spawnp' function. */
#undef HAVE_POSIX_SPAWNP
-/* Define to 1 if you have the `posix_spawn_file_actions_adddup2' function. */
+/* Define to 1 if you have the 'posix_spawn_file_actions_adddup2' function. */
#undef HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
/* Does struct password have a pw_gecos field? */
@@ -82,18 +82,15 @@
/* Is off64_t in <sys/types.h>? */
#undef HAVE_TYPE_OFF64_T
-/* Define to 1 if the system has the type `uintptr_t'. */
+/* Define to 1 if the system has the type 'uintptr_t'. */
#undef HAVE_UINTPTR_T
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* Define to 1 if you have the `vfork' function. */
+/* Define to 1 if you have the 'vfork' function. */
#undef HAVE_VFORK
-/* Is weak import available? */
-#undef HAVE_WEAK_IMPORT
-
/* Have we turned on XFT (antialiased fonts)? */
#undef HAVE_XFT
@@ -139,7 +136,7 @@
/* Is this a static build? */
#undef STATIC_BUILD
-/* Define to 1 if all of the C90 standard headers exist (not just the ones
+/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
@@ -189,9 +186,6 @@
/* Are we building with zipfs enabled? */
#undef ZIPFS_BUILD
-/* Are Darwin SUSv3 extensions available? */
-#undef _DARWIN_C_SOURCE
-
/* Add the _FILE_OFFSET_BITS flag when building */
#undef _FILE_OFFSET_BITS
@@ -219,25 +213,25 @@
/* Do we want to use the XOPEN network library? */
#undef _XOPEN_SOURCE_EXTENDED
-/* Define to 1 if type `char' is unsigned and your compiler does not
+/* Define to 1 if type 'char' is unsigned and your compiler does not
predefine this macro. */
#ifndef __CHAR_UNSIGNED__
# undef __CHAR_UNSIGNED__
#endif
-/* Define to `__inline__' or `__inline' if that's what the C compiler
+/* Define to '__inline__' or '__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
-/* Define to `int' if <sys/types.h> does not define. */
+/* Define to 'int' if <sys/types.h> does not define. */
#undef mode_t
/* Define as a signed integer type capable of holding a process identifier. */
#undef pid_t
-/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* Define as 'unsigned int' if <stddef.h> doesn't define. */
#undef size_t
diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c
index f977624..55e58c3 100644
--- a/unix/tkUnix3d.c
+++ b/unix/tkUnix3d.c
@@ -446,7 +446,7 @@ TkpGetShadows(
if (borderPtr->shadow == None) {
borderPtr->shadow = Tk_GetBitmap(NULL, tkwin,
- Tk_GetUid("gray50"));
+ "gray50");
if (borderPtr->shadow == None) {
Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border");
}
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index 8ba2df3..765ddb4 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -449,6 +449,7 @@ TkpDisplayButton(
int imageXOffset = 0, imageYOffset = 0;
/* image information that will be used to
* restrict disabled pixmap as well */
+ int padX, padY, borderWidth, highlightWidth;
butPtr->flags &= ~REDRAW_PENDING;
if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
@@ -533,10 +534,10 @@ TkpDisplayButton(
imageWidth = width;
imageHeight = height;
- Tk_GetPixelsFromObj(NULL, tkwin, butPtr->padXPtr, &butPtr->padX);
- Tk_GetPixelsFromObj(NULL, tkwin, butPtr->padYPtr, &butPtr->padY);
- Tk_GetPixelsFromObj(NULL, tkwin, butPtr->borderWidthPtr, &butPtr->borderWidth);
- Tk_GetPixelsFromObj(NULL, tkwin, butPtr->highlightWidthPtr, &butPtr->highlightWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->padXObj, &padX);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->padYObj, &padY);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->highlightWidthObj, &highlightWidth);
haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0);
@@ -554,11 +555,11 @@ TkpDisplayButton(
*/
if (butPtr->compound == COMPOUND_TOP) {
- textYOffset = height + butPtr->padY;
+ textYOffset = height + padY;
} else {
- imageYOffset = butPtr->textHeight + butPtr->padY;
+ imageYOffset = butPtr->textHeight + padY;
}
- fullHeight = height + butPtr->textHeight + butPtr->padY;
+ fullHeight = height + butPtr->textHeight + padY;
fullWidth = (width > butPtr->textWidth ? width :
butPtr->textWidth);
textXOffset = (fullWidth - butPtr->textWidth)/2;
@@ -571,11 +572,11 @@ TkpDisplayButton(
*/
if (butPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + butPtr->padX;
+ textXOffset = width + padX;
} else {
- imageXOffset = butPtr->textWidth + butPtr->padX;
+ imageXOffset = butPtr->textWidth + padX;
}
- fullWidth = butPtr->textWidth + butPtr->padX + width;
+ fullWidth = butPtr->textWidth + padX + width;
fullHeight = (height > butPtr->textHeight ? height :
butPtr->textHeight);
textYOffset = (fullHeight - butPtr->textHeight)/2;
@@ -599,7 +600,7 @@ TkpDisplayButton(
break;
}
- TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
+ TkComputeAnchor(butPtr->anchor, tkwin, padX, padY,
butPtr->indicatorSpace + fullWidth, fullHeight, &x, &y);
x += butPtr->indicatorSpace;
@@ -709,7 +710,7 @@ TkpDisplayButton(
}
y += height/2;
} else {
- TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
+ TkComputeAnchor(butPtr->anchor, tkwin, padX, padY,
butPtr->indicatorSpace + butPtr->textWidth,
butPtr->textHeight, &x, &y);
@@ -730,7 +731,7 @@ TkpDisplayButton(
if ((butPtr->type == TYPE_CHECK_BUTTON || butPtr->type == TYPE_RADIO_BUTTON)
&& butPtr->indicatorOn
- && butPtr->indicatorDiameter > 2 * butPtr->borderWidth) {
+ && butPtr->indicatorDiameter > 2 * borderWidth) {
TkBorder *selBorder = (TkBorder *) butPtr->selectBorder;
XColor *selColor = NULL;
int btype = (butPtr->type == TYPE_CHECK_BUTTON ?
@@ -792,7 +793,7 @@ TkpDisplayButton(
*/
if (relief != TK_RELIEF_FLAT) {
- int inset = butPtr->highlightWidth;
+ int inset = highlightWidth;
if (butPtr->defaultState == DEFAULT_ACTIVE) {
/*
@@ -833,9 +834,9 @@ TkpDisplayButton(
Tk_Draw3DRectangle(tkwin, pixmap, border, inset, inset,
Tk_Width(tkwin) - 2 * inset, Tk_Height(tkwin) - 2 * inset,
- butPtr->borderWidth, relief);
+ borderWidth, relief);
}
- if (butPtr->highlightWidth > 0) {
+ if (highlightWidth > 0) {
if (butPtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap);
} else {
@@ -849,10 +850,10 @@ TkpDisplayButton(
*/
if (butPtr->defaultState == DEFAULT_NORMAL) {
- TkDrawInsetFocusHighlight(tkwin, gc, butPtr->highlightWidth,
+ TkDrawInsetFocusHighlight(tkwin, gc, highlightWidth,
pixmap, 5);
} else {
- Tk_DrawFocusHighlight(tkwin, gc, butPtr->highlightWidth, pixmap);
+ Tk_DrawFocusHighlight(tkwin, gc, highlightWidth, pixmap);
}
}
@@ -892,13 +893,18 @@ TkpComputeButtonGeometry(
int width, height, avgWidth, txtWidth, txtHeight;
int haveImage = 0, haveText = 0;
Tk_FontMetrics fm;
+ int padX, padY, borderWidth, highlightWidth, wrapLength;
+ int butPtrWidth, butPtrHeight;
- Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->highlightWidthPtr, &butPtr->highlightWidth);
- Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->borderWidthPtr, &butPtr->borderWidth);
- Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padXPtr, &butPtr->padX);
- Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padYPtr, &butPtr->padY);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->highlightWidthObj, &highlightWidth);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padXObj, &padX);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padYObj, &padY);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->wrapLengthObj, &wrapLength);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->widthObj, &butPtrWidth);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->heightObj, &butPtrHeight);
- butPtr->inset = butPtr->highlightWidth + butPtr->borderWidth;
+ butPtr->inset = highlightWidth + borderWidth;
/*
* Leave room for the default ring if needed.
@@ -927,7 +933,7 @@ TkpComputeButtonGeometry(
Tk_FreeTextLayout(butPtr->textLayout);
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- Tcl_GetString(butPtr->textPtr), TCL_INDEX_NONE, butPtr->wrapLength,
+ Tcl_GetString(butPtr->textPtr), TCL_INDEX_NONE, wrapLength,
butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
txtWidth = butPtr->textWidth;
@@ -952,7 +958,7 @@ TkpComputeButtonGeometry(
* Image is above or below text.
*/
- height += txtHeight + butPtr->padY;
+ height += txtHeight + padY;
width = (width > txtWidth ? width : txtWidth);
break;
case COMPOUND_LEFT:
@@ -961,7 +967,7 @@ TkpComputeButtonGeometry(
* Image is left or right of text.
*/
- width += txtWidth + butPtr->padX;
+ width += txtWidth + padX;
height = (height > txtHeight ? height : txtHeight);
break;
case COMPOUND_CENTER:
@@ -975,11 +981,11 @@ TkpComputeButtonGeometry(
case COMPOUND_NONE:
break;
}
- if (butPtr->width > 0) {
- width = butPtr->width;
+ if (butPtrWidth > 0) {
+ width = butPtrWidth;
}
- if (butPtr->height > 0) {
- height = butPtr->height;
+ if (butPtrHeight > 0) {
+ height = butPtrHeight;
}
if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
@@ -991,15 +997,15 @@ TkpComputeButtonGeometry(
}
}
- width += 2 * butPtr->padX;
- height += 2 * butPtr->padY;
+ width += 2 * padX;
+ height += 2 * padY;
} else {
if (haveImage) {
- if (butPtr->width > 0) {
- width = butPtr->width;
+ if (butPtrWidth > 0) {
+ width = butPtrWidth;
}
- if (butPtr->height > 0) {
- height = butPtr->height;
+ if (butPtrHeight > 0) {
+ height = butPtrHeight;
}
if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
@@ -1014,11 +1020,11 @@ TkpComputeButtonGeometry(
width = txtWidth;
height = txtHeight;
- if (butPtr->width > 0) {
- width = butPtr->width * avgWidth;
+ if (butPtrWidth > 0) {
+ width = butPtrWidth * avgWidth;
}
- if (butPtr->height > 0) {
- height = butPtr->height * fm.linespace;
+ if (butPtrHeight > 0) {
+ height = butPtrHeight * fm.linespace;
}
if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
butPtr->indicatorDiameter = fm.linespace;
@@ -1035,8 +1041,8 @@ TkpComputeButtonGeometry(
*/
if ((butPtr->image == NULL) && (butPtr->bitmap == None)) {
- width += 2 * butPtr->padX;
- height += 2 * butPtr->padY;
+ width += 2 * padX;
+ height += 2 * padY;
}
if ((butPtr->type == TYPE_BUTTON) && !Tk_StrictMotif(butPtr->tkwin)) {
width += 2;
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c
index 55d1a08..80dfa86 100644
--- a/unix/tkUnixCursor.c
+++ b/unix/tkUnixCursor.c
@@ -311,7 +311,7 @@ TkGetCursorByName(
if (!inTkTable && Tcl_IsSafe(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't get cursor from a file in a safe interpreter",
+ "cannot get cursor from a file in a safe interpreter",
TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "SAFE", "CURSOR_FILE", NULL);
cursorPtr = NULL;
diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h
index 16fdcc6..eccd2c1 100644
--- a/unix/tkUnixDefault.h
+++ b/unix/tkUnixDefault.h
@@ -490,7 +490,7 @@
#define DEF_TEXT_PADX "1"
#define DEF_TEXT_PADY "1"
#define DEF_TEXT_RELIEF "sunken"
-#define DEF_TEXT_INACTIVE_SELECT_COLOR SELECT_BG
+#define DEF_TEXT_INACTIVE_SELECT_BG_COLOR SELECT_BG
#define DEF_TEXT_SELECT_COLOR SELECT_BG
#define DEF_TEXT_SELECT_MONO BLACK
#define DEF_TEXT_SELECT_BD_COLOR "0"
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index 6215671..a8765bd 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -107,7 +107,7 @@ Tk_UseWindow(
Container *containerPtr;
XWindowAttributes parentAtts;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->window != None) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -139,7 +139,7 @@ Tk_UseWindow(
handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
EmbedErrorProc, &anyError);
if (!XGetWindowAttributes(winPtr->display, parent, &parentAtts)) {
- anyError = 1;
+ anyError = 1;
}
XSync(winPtr->display, False);
Tk_DeleteErrorHandler(handler);
@@ -218,7 +218,7 @@ Tk_MakeWindow(
Container *containerPtr;
TkWindow *winPtr = (TkWindow *) tkwin;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_EMBEDDED) {
/*
@@ -274,7 +274,7 @@ Tk_MakeContainer(
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Register the window as a container so that, for example, we can find
@@ -400,7 +400,7 @@ ContainerEventProc(
Container *containerPtr;
Tk_ErrorHandler errHandler;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Ignore any X protocol errors that happen in this function (almost any
@@ -505,13 +505,13 @@ EmbedStructureProc(
Tk_ErrorHandler errHandler;
if (eventPtr->type == ConfigureNotify) {
- /*
- * Send a ConfigureNotify to the embedded application.
- */
+ /*
+ * Send a ConfigureNotify to the embedded application.
+ */
- if (containerPtr->embeddedPtr != NULL) {
- TkDoConfigureNotify(containerPtr->embeddedPtr);
- }
+ if (containerPtr->embeddedPtr != NULL) {
+ TkDoConfigureNotify(containerPtr->embeddedPtr);
+ }
if (containerPtr->wrapper != None) {
/*
@@ -715,10 +715,10 @@ Tk_GetOtherWindow(
{
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (containerPtr = tsdPtr->firstContainerPtr;
- containerPtr != NULL;
+ containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
if ((Tk_Window)containerPtr->embeddedPtr == tkwin) {
return (Tk_Window)containerPtr->parentPtr;
@@ -761,7 +761,7 @@ TkpRedirectKeyEvent(
Container *containerPtr;
Window saved;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* First, find the top-level window corresponding to winPtr.
@@ -833,7 +833,7 @@ TkpClaimFocus(
XEvent event;
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(topLevelPtr->flags & TK_EMBEDDED)) {
return;
@@ -885,7 +885,7 @@ TkpTestembedCmd(
char buffer[50];
Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
(void)dummy;
if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) {
@@ -923,7 +923,7 @@ TkpTestembedCmd(
Tcl_DStringAppendElement(&dString,
containerPtr->parentPtr->pathName);
}
- /* Wrapper */
+ /* Wrapper */
if (containerPtr->wrapper == None) {
Tcl_DStringAppendElement(&dString, "");
} else if (all) {
@@ -971,7 +971,7 @@ EmbedWindowDeleted(
{
Container *containerPtr, *prevPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Find the Container structure for this window work. Delete the
@@ -1030,10 +1030,10 @@ TkUnixContainerId(
{
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (containerPtr = tsdPtr->firstContainerPtr;
- containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
+ containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
return containerPtr->parent;
}
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index da75d0f..6ff53cf 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -242,6 +242,33 @@ static int SeenName(const char *name, Tcl_DString *dsPtr);
/*
*-------------------------------------------------------------------------
*
+ * XLoadQueryFontNoXError --
+ *
+ * This function is XLoadQueryFont wrapped in a NULL error handler.
+ * It is a temporary workaround for ticket [36e379c01b],
+ * "macOS Ventura, X11 build with XQuartz: crash in XLoadQueryFont",
+ * which actually is issue #216 in XQuartz:
+ * https://github.com/XQuartz/XQuartz/issues/216
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static XFontStruct *
+XLoadQueryFontNoXError(Display *display, char *name)
+{
+ XFontStruct *fontStructPtr = NULL;
+ Tk_ErrorHandler handler;
+
+ /* 45 is the major opcode of X_OpenFont */
+ handler = Tk_CreateErrorHandler(display, BadValue, 45, -1, NULL, NULL);
+ fontStructPtr = XLoadQueryFont(display, name);
+ Tk_DeleteErrorHandler(handler);
+ return fontStructPtr;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
* FontPkgCleanup --
*
* This function is called when an application is created. It initializes
@@ -490,7 +517,7 @@ TkpGetNativeFont(
return NULL;
}
- fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), name);
+ fontStructPtr = XLoadQueryFontNoXError(Tk_Display(tkwin), (char *)name);
if (fontStructPtr == NULL) {
/*
* Handle all names that look like XLFDs here. Otherwise, when
@@ -745,7 +772,7 @@ void
TkpGetFontAttrsForChar(
Tk_Window tkwin, /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
- int c, /* Character of interest */
+ int c, /* Character of interest */
TkFontAttributes *faPtr) /* Output: Font attributes */
{
FontAttributes atts;
@@ -2603,11 +2630,11 @@ GetScreenFont(
snprintf(buf, sizeof(buf), "%.200s-%d-*-*-*-*-*%s", nameList[bestIdx[1]],
(int)(-wantPtr->fa.size+0.5), rest);
*str = '-';
- fontStructPtr = XLoadQueryFont(display, buf);
+ fontStructPtr = XLoadQueryFontNoXError(display, buf);
bestScore[1] = INT_MAX;
}
if (fontStructPtr == NULL) {
- fontStructPtr = XLoadQueryFont(display, nameList[bestIdx[0]]);
+ fontStructPtr = XLoadQueryFontNoXError(display, nameList[bestIdx[0]]);
if (fontStructPtr == NULL) {
/*
* This shouldn't happen because the font name is one of the names
@@ -2647,9 +2674,9 @@ GetSystemFont(
{
XFontStruct *fontStructPtr;
- fontStructPtr = XLoadQueryFont(display, "fixed");
+ fontStructPtr = XLoadQueryFontNoXError(display, "fixed");
if (fontStructPtr == NULL) {
- fontStructPtr = XLoadQueryFont(display, "*");
+ fontStructPtr = XLoadQueryFontNoXError(display, "*");
if (fontStructPtr == NULL) {
Tcl_Panic("TkpGetFontFromAttributes: cannot get any font");
}
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c
index 34b67fc..f11263f 100644
--- a/unix/tkUnixInit.c
+++ b/unix/tkUnixInit.c
@@ -44,6 +44,7 @@ TkpInit(
Tktray_Init(interp);
(void)SysNotify_Init (interp);
Icu_Init(interp);
+ Cups_Init(interp);
return TCL_OK;
}
@@ -147,7 +148,7 @@ GetLibraryPath(
"com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX,
tkLibPath);
if (tkLibPath[0] != '\0') {
- Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
}
return foundInFramework;
}
diff --git a/unix/tkUnixInt.h b/unix/tkUnixInt.h
index 5429236..f46212e 100644
--- a/unix/tkUnixInt.h
+++ b/unix/tkUnixInt.h
@@ -26,6 +26,7 @@
MODULE_SCOPE int Tktray_Init (Tcl_Interp* interp);
MODULE_SCOPE int SysNotify_Init (Tcl_Interp* interp);
+MODULE_SCOPE int Cups_Init (Tcl_Interp* interp);
#endif /* _TKUNIXINT */
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index 933a690..f98f011 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -160,7 +160,7 @@ TkpGetString(
Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
- &kePtr->keysym, &status);
+ &kePtr->keysym, &status);
/*
* If the buffer wasn't big enough, grow the buffer and try again.
@@ -309,7 +309,7 @@ TkpGetKeySym(
*/
if (eventPtr->xkey.keycode > 0xff) {
- return NoSymbol;
+ return NoSymbol;
}
/*
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 2ed2e49..3460840 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -353,13 +353,13 @@ GetMenuIndicatorGeometry(
}
}
} else {
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthObj,
&borderWidth);
*heightPtr = 0;
*widthPtr = borderWidth;
}
} else {
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthObj,
&borderWidth);
*heightPtr = 0;
*widthPtr = borderWidth;
@@ -444,7 +444,7 @@ DrawMenuEntryBackground(
|| (menuPtr->postedCascade != mePtr))) {
relief = TK_RELIEF_FLAT;
} else {
- Tk_GetReliefFromObj(NULL, menuPtr->activeReliefPtr, &relief);
+ relief = menuPtr->activeRelief;
}
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
@@ -501,7 +501,7 @@ DrawMenuEntryAccelerator(
return;
}
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthObj,
&borderWidth);
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
&activeBorderWidth);
@@ -1121,7 +1121,7 @@ TkpComputeMenubarGeometry(
maxWindowWidth = 0x7FFFFFF;
}
currentRowHeight = 0;
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthObj,
&borderWidth);
x = y = borderWidth;
lastRowBreak = 0;
@@ -1695,7 +1695,7 @@ TkpComputeStandardMenuGeometry(
return;
}
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthObj,
&borderWidth);
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
&activeBorderWidth);
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index c9a33aa..a1f3aa3 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -74,6 +74,8 @@ TkpDisplayMenuButton(
/* Image information that will be used to
* restrict disabled pixmap as well */
int haveImage = 0, haveText = 0;
+ int padX, padY;
+ int mbPtrBorderWidth, highlightWidth;
mbPtr->flags &= ~REDRAW_PENDING;
if ((mbPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
@@ -123,6 +125,8 @@ TkpDisplayMenuButton(
fullWidth = 0;
fullHeight = 0;
+ Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->padXObj, &padX);
+ Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->padYObj, &padY);
if (mbPtr->compound != COMPOUND_NONE && haveImage && haveText) {
switch ((enum compound) mbPtr->compound) {
case COMPOUND_TOP:
@@ -132,11 +136,11 @@ TkpDisplayMenuButton(
*/
if (mbPtr->compound == COMPOUND_TOP) {
- textYOffset = height + mbPtr->padY;
+ textYOffset = height + padY;
} else {
- imageYOffset = mbPtr->textHeight + mbPtr->padY;
+ imageYOffset = mbPtr->textHeight + padY;
}
- fullHeight = height + mbPtr->textHeight + mbPtr->padY;
+ fullHeight = height + mbPtr->textHeight + padY;
fullWidth = (width > mbPtr->textWidth ? width : mbPtr->textWidth);
textXOffset = (fullWidth - mbPtr->textWidth)/2;
imageXOffset = (fullWidth - width)/2;
@@ -148,11 +152,11 @@ TkpDisplayMenuButton(
*/
if (mbPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + mbPtr->padX;
+ textXOffset = width + padX;
} else {
- imageXOffset = mbPtr->textWidth + mbPtr->padX;
+ imageXOffset = mbPtr->textWidth + padX;
}
- fullWidth = mbPtr->textWidth + mbPtr->padX + width;
+ fullWidth = mbPtr->textWidth + padX + width;
fullHeight = (height > mbPtr->textHeight ? height :
mbPtr->textHeight);
textYOffset = (fullHeight - mbPtr->textHeight)/2;
@@ -211,7 +215,7 @@ TkpDisplayMenuButton(
XSetClipOrigin(mbPtr->display, gc, 0, 0);
}
} else {
- TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
+ TkComputeAnchor(mbPtr->anchor, tkwin, padX, padY,
mbPtr->textWidth + mbPtr->indicatorWidth,
mbPtr->textHeight, &x, &y);
Tk_DrawTextLayout(mbPtr->display, pixmap, gc, mbPtr->textLayout,
@@ -272,20 +276,22 @@ TkpDisplayMenuButton(
* border.
*/
+ Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->borderWidthObj, &mbPtrBorderWidth);
+ Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->highlightWidthObj, &highlightWidth);
if (mbPtr->relief != TK_RELIEF_FLAT) {
Tk_Draw3DRectangle(tkwin, pixmap, border,
- mbPtr->highlightWidth, mbPtr->highlightWidth,
- Tk_Width(tkwin) - 2*mbPtr->highlightWidth,
- Tk_Height(tkwin) - 2*mbPtr->highlightWidth,
- mbPtr->borderWidth, mbPtr->relief);
+ highlightWidth, highlightWidth,
+ Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth,
+ mbPtrBorderWidth, mbPtr->relief);
}
- if (mbPtr->highlightWidth > 0) {
+ if (highlightWidth > 0) {
if (mbPtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(mbPtr->highlightColorPtr, pixmap);
} else {
gc = Tk_GCForColor(mbPtr->highlightBgColorPtr, pixmap);
}
- Tk_DrawFocusHighlight(tkwin, gc, mbPtr->highlightWidth, pixmap);
+ Tk_DrawFocusHighlight(tkwin, gc, highlightWidth, pixmap);
}
/*
@@ -347,8 +353,15 @@ TkpComputeMenuButtonGeometry(
int avgWidth, txtWidth, txtHeight;
int haveImage = 0, haveText = 0;
Tk_FontMetrics fm;
+ int borderWidth, highlightWidth, wrapLength;
+ int padX, padY;
- mbPtr->inset = mbPtr->highlightWidth + mbPtr->borderWidth;
+ Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->padXObj, &padX);
+ Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->padYObj, &padY);
+ Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->highlightWidthObj, &highlightWidth);
+ Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->wrapLengthObj, &wrapLength);
+ mbPtr->inset = highlightWidth + borderWidth;
width = 0;
height = 0;
@@ -367,8 +380,8 @@ TkpComputeMenuButtonGeometry(
if (haveImage == 0 || mbPtr->compound != COMPOUND_NONE) {
Tk_FreeTextLayout(mbPtr->textLayout);
- mbPtr->textLayout = Tk_ComputeTextLayout(mbPtr->tkfont, mbPtr->text,
- TCL_INDEX_NONE, mbPtr->wrapLength, mbPtr->justify, 0, &mbPtr->textWidth,
+ mbPtr->textLayout = Tk_ComputeTextLayout(mbPtr->tkfont, mbPtr->textObj ? Tcl_GetString(mbPtr->textObj) : "",
+ TCL_INDEX_NONE, wrapLength, mbPtr->justify, 0, &mbPtr->textWidth,
&mbPtr->textHeight);
txtWidth = mbPtr->textWidth;
txtHeight = mbPtr->textHeight;
@@ -392,7 +405,7 @@ TkpComputeMenuButtonGeometry(
* Image is above or below text.
*/
- height += txtHeight + mbPtr->padY;
+ height += txtHeight + padY;
width = (width > txtWidth ? width : txtWidth);
break;
case COMPOUND_LEFT:
@@ -401,7 +414,7 @@ TkpComputeMenuButtonGeometry(
* Image is left or right of text.
*/
- width += txtWidth + mbPtr->padX;
+ width += txtWidth + padX;
height = (height > txtHeight ? height : txtHeight);
break;
case COMPOUND_CENTER:
@@ -421,8 +434,8 @@ TkpComputeMenuButtonGeometry(
if (mbPtr->height > 0) {
height = mbPtr->height;
}
- width += 2*mbPtr->padX;
- height += 2*mbPtr->padY;
+ width += 2 * padX;
+ height += 2 * padY;
} else {
if (haveImage) {
if (mbPtr->width > 0) {
@@ -444,8 +457,8 @@ TkpComputeMenuButtonGeometry(
}
if (! haveImage) {
- width += 2*mbPtr->padX;
- height += 2*mbPtr->padY;
+ width += 2 * padX;
+ height += 2 * padY;
}
if (mbPtr->indicatorOn) {
@@ -453,15 +466,15 @@ TkpComputeMenuButtonGeometry(
pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin));
mbPtr->indicatorHeight= (INDICATOR_HEIGHT * pixels)/(10*mm);
mbPtr->indicatorWidth = (INDICATOR_WIDTH * pixels)/(10*mm)
- + 2*mbPtr->indicatorHeight;
+ + 2 * mbPtr->indicatorHeight;
width += mbPtr->indicatorWidth;
} else {
mbPtr->indicatorHeight = 0;
mbPtr->indicatorWidth = 0;
}
- Tk_GeometryRequest(mbPtr->tkwin, (int) (width + 2*mbPtr->inset),
- (int) (height + 2*mbPtr->inset));
+ Tk_GeometryRequest(mbPtr->tkwin, (int) (width + 2 * mbPtr->inset),
+ (int) (height + 2 * mbPtr->inset));
Tk_SetInternalBorder(mbPtr->tkwin, mbPtr->inset);
}
diff --git a/unix/tkUnixPrint.c b/unix/tkUnixPrint.c
new file mode 100644
index 0000000..830f580
--- /dev/null
+++ b/unix/tkUnixPrint.c
@@ -0,0 +1,526 @@
+/*
+ * tkUnixPrint.c --
+ *
+ * tkUnixPrint.c implements a "::tk::print::cups" Tcl command which
+ * interfaces the libcups2 API with the [tk print] command.
+ *
+ * Copyright © 2024 Emiliano Gavilán.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkUnixInt.h"
+
+#ifdef HAVE_CUPS
+#include <cups/cups.h>
+
+typedef int (CupsSubCmdOp)(Tcl_Interp *, int, Tcl_Obj *const []);
+
+static Tcl_ObjCmdProc Cups_Cmd;
+static CupsSubCmdOp DefaultPrinterOp;
+static CupsSubCmdOp GetPrintersOp;
+static CupsSubCmdOp PrintOp;
+static Tcl_ArgvGenFuncProc ParseEnumOptions;
+static Tcl_ArgvGenFuncProc ParseOptions;
+static Tcl_ArgvGenFuncProc ParseMargins;
+static Tcl_ArgvGenFuncProc ParseNup;
+static cups_dest_t* GetPrinterFromObj(Tcl_Obj *);
+
+static cups_dest_t *
+GetPrinterFromObj(Tcl_Obj *nameObj)
+{
+ cups_dest_t *printer;
+ Tcl_Size len;
+ const char *nameStr = Tcl_GetStringFromObj(nameObj, &len);
+ char *p;
+ char *name, *instance = NULL;
+ Tcl_DString ds;
+
+ Tcl_DStringInit(&ds);
+ name = Tcl_DStringAppend(&ds, nameStr, len);
+ p = strchr(name, '/');
+ if (p) {
+ *p = '\0';
+ instance = p+1;
+ }
+
+ printer = cupsGetNamedDest(CUPS_HTTP_DEFAULT, name, instance);
+ Tcl_DStringFree(&ds);
+
+ return printer;
+}
+
+static int
+Cups_Cmd(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ static const struct CupsCmds {
+ const char *subcmd;
+ CupsSubCmdOp *subCmd;
+ } cupsCmds[] = {
+ {"defaultprinter" , DefaultPrinterOp},
+ {"getprinters" , GetPrintersOp},
+ {"print" , PrintOp},
+ {NULL, NULL}
+ };
+ int index;
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?arg ...?");
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetIndexFromObjStruct(interp, objv[1], cupsCmds,
+ sizeof(struct CupsCmds), "subcommand", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ return cupsCmds[index].subCmd(interp, objc, objv);
+}
+
+static int
+DefaultPrinterOp(
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ cups_dest_t *printer;
+ Tcl_Obj *resultObj;
+
+ printer = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
+ if (printer) {
+ if (printer->instance) {
+ resultObj = Tcl_ObjPrintf("%s/%s", printer->name,
+ printer->instance);
+ } else {
+ resultObj = Tcl_NewStringObj(printer->name, -1);
+ }
+ Tcl_SetObjResult(interp, resultObj);
+ }
+
+ cupsFreeDests(1, printer);
+ return TCL_OK;
+}
+
+static int
+GetPrintersOp(
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ cups_dest_t *dests;
+ cups_option_t *option;
+ int num_dests, i, j;
+ Tcl_Obj *keyPtr, *optPtr, *resultObj;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ return TCL_ERROR;
+ }
+
+ num_dests = cupsGetDests2(CUPS_HTTP_DEFAULT, &dests);
+ resultObj = Tcl_NewObj();
+
+ for (i = 0; i < num_dests; i++) {
+ if (dests[i].instance)
+ keyPtr = Tcl_ObjPrintf("%s/%s", dests[i].name, dests[i].instance);
+ else
+ keyPtr = Tcl_NewStringObj(dests[i].name, -1);
+
+ option = dests[i].options;
+ optPtr = Tcl_NewObj();
+ for(j = 0; j < dests[i].num_options; j++) {
+ Tcl_DictObjPut(NULL, optPtr,
+ Tcl_NewStringObj(option[j].name, -1),
+ Tcl_NewStringObj(option[j].value, -1));
+ }
+
+ Tcl_DictObjPut(NULL, resultObj, keyPtr, optPtr);
+ }
+
+ cupsFreeDests(num_dests, dests);
+ Tcl_SetObjResult(interp, resultObj);
+ return TCL_OK;
+}
+
+/* Information needed for parsing */
+struct CupsOptions {
+ const char *name;
+ const char *cupsName;
+};
+
+static const struct CupsOptions colormodeOpts[] = {
+ {"auto", CUPS_PRINT_COLOR_MODE_AUTO},
+ {"color", CUPS_PRINT_COLOR_MODE_COLOR},
+ {"monochrome", CUPS_PRINT_COLOR_MODE_MONOCHROME},
+ {NULL, NULL}
+};
+
+static const struct CupsOptions formatOpts[] = {
+ {"auto", CUPS_FORMAT_AUTO},
+ {"pdf", CUPS_FORMAT_PDF},
+ {"postscript", CUPS_FORMAT_POSTSCRIPT},
+ {"text", CUPS_FORMAT_TEXT},
+ {NULL, NULL}
+};
+
+static const struct CupsOptions mediaOpts[] = {
+ {"a4", CUPS_MEDIA_A4},
+ {"legal", CUPS_MEDIA_LEGAL},
+ {"letter", CUPS_MEDIA_LETTER},
+ {NULL, NULL}
+};
+
+static const struct CupsOptions orientationOpts[] = {
+ {"portrait", CUPS_ORIENTATION_PORTRAIT},
+ {"landscape", CUPS_ORIENTATION_LANDSCAPE},
+ {NULL, NULL}
+};
+
+enum {PARSECOLORMODE, PARSEFORMAT, PARSEMEDIA, PARSEORIENTATION};
+
+static const struct ParseData {
+ const char *message;
+ const struct CupsOptions *optionTable;
+} parseData[] = {
+ {"colormode", colormodeOpts},
+ {"format", formatOpts},
+ {"media", mediaOpts},
+ {"orientation", orientationOpts},
+ {NULL, NULL}
+};
+
+static int
+PrintOp(
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ cups_dest_t *printer;
+ cups_dinfo_t *info;
+ int result = TCL_OK;
+ int job_id;
+
+ /* variables for Tcl_ParseArgsObjv */
+ Tcl_Obj *const *parseObjv;
+ Tcl_Size count;
+
+ /* options related vaiables */
+ cups_option_t *options = NULL;
+ int num_options = 0;
+ int copies = 0, pprint = 0;
+ const char *media = NULL, *color = NULL, *orient = NULL, *format = NULL,
+ *nup = NULL, *title = NULL;
+ Tcl_Obj *marginsObj = NULL, *optionsObj = NULL;
+ double tzoom = 1.0;
+
+ /* Data to print
+ * this is a binary buffer, since it can contain data such as
+ * jpg or compressed pdf which might contain any bytes.
+ * USE [encoding convertto] with a proper encoding when passing
+ * text data to print.
+ */
+ const unsigned char *buffer; Tcl_Size buflen;
+
+ const Tcl_ArgvInfo argTable[] = {
+ {TCL_ARGV_GENFUNC, "-colormode", ParseEnumOptions, &color,
+ "color mode", (void *)&parseData[PARSECOLORMODE]},
+ {TCL_ARGV_INT , "-copies", NULL, &copies,
+ "number of copies", NULL},
+ {TCL_ARGV_GENFUNC, "-format", ParseEnumOptions, &format,
+ "data format", (void *)&parseData[PARSEFORMAT]},
+ {TCL_ARGV_GENFUNC, "-margins", ParseMargins, &marginsObj,
+ "media page size", NULL},
+ {TCL_ARGV_GENFUNC, "-media", ParseEnumOptions, &media,
+ "media page size", (void *)&parseData[PARSEMEDIA]},
+ {TCL_ARGV_GENFUNC, "-nup", ParseNup, &nup,
+ "pages per sheet", NULL},
+ {TCL_ARGV_GENFUNC, "-options", ParseOptions, &optionsObj,
+ "generic options", NULL},
+ {TCL_ARGV_GENFUNC, "-orientation", ParseEnumOptions, &orient,
+ "page orientation", (void *)&parseData[PARSEORIENTATION]},
+ {TCL_ARGV_CONSTANT, "-prettyprint", (void *)1, &pprint,
+ "print header", NULL},
+ {TCL_ARGV_STRING, "-title", NULL, &title,
+ "job title", NULL},
+ {TCL_ARGV_FLOAT, "-tzoom", NULL, &tzoom,
+ "text zoom", NULL},
+ TCL_ARGV_TABLE_END
+ };
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "printer data ?-opt arg ...?");
+ return TCL_ERROR;
+ }
+
+ printer = GetPrinterFromObj(objv[2]);
+ if (!printer) {
+ Tcl_SetObjResult(interp,
+ Tcl_ObjPrintf("unknown printer or class \"%s\"",
+ Tcl_GetString(objv[2])));
+ return TCL_ERROR;
+ }
+
+ /* T_PAO discards the first arg, but we have 4 before the options */
+ parseObjv = objv+3;
+ count = objc-3;
+
+ if (Tcl_ParseArgsObjv(interp, argTable, &count, parseObjv, NULL)!=TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (copies < 0 || copies > 100) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("copies must be an integer"
+ "between 0 and 100", -1));
+ cupsFreeDests(1, printer);
+ return TCL_ERROR;
+ }
+ if (tzoom < 0.5 || tzoom > 2.0) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("tzoom must be a number"
+ "between 0.5 and 2.0", -1));
+ cupsFreeDests(1, printer);
+ return TCL_ERROR;
+ }
+
+/* Add options */
+ if (copies != 0) {
+ char copiesbuf[4];
+
+ snprintf(copiesbuf, 4, "%d", copies);
+ num_options = cupsAddOption(CUPS_COPIES, copiesbuf,
+ num_options, &options);
+ }
+ if (color) {
+ num_options = cupsAddOption(CUPS_PRINT_COLOR_MODE, color,
+ num_options, &options);
+ }
+ if (media) {
+ num_options = cupsAddOption(CUPS_MEDIA, media,
+ num_options, &options);
+ }
+ if (nup) {
+ num_options = cupsAddOption(CUPS_NUMBER_UP, nup,
+ num_options, &options);
+ }
+ if (orient) {
+ num_options = cupsAddOption(CUPS_ORIENTATION, orient,
+ num_options, &options);
+ }
+ if (pprint) {
+ num_options = cupsAddOption("prettyprint", "yes",
+ num_options, &options);
+ }
+ if (marginsObj) {
+ Tcl_Size n;
+ Tcl_Obj **listArr;
+
+ Tcl_ListObjGetElements(NULL, marginsObj, &n, &listArr);
+ num_options = cupsAddOption("page-top", Tcl_GetString(listArr[0]),
+ num_options, &options);
+ num_options = cupsAddOption("page-left", Tcl_GetString(listArr[1]),
+ num_options, &options);
+ num_options = cupsAddOption("page-bottom", Tcl_GetString(listArr[2]),
+ num_options, &options);
+ num_options = cupsAddOption("page-right", Tcl_GetString(listArr[3]),
+ num_options, &options);
+ }
+ if (optionsObj) {
+ Tcl_DictSearch search;
+ int done = 0;
+ Tcl_Obj *key, *value;
+
+ for (Tcl_DictObjFirst(interp, optionsObj, &search, &key, &value, &done)
+ ; !done ; Tcl_DictObjNext(&search, &key, &value, &done))
+ {
+ num_options = cupsAddOption(Tcl_GetString(key),
+ Tcl_GetString(value), num_options, &options);
+ }
+ }
+ /* prettyprint mess with the default values if set, so we force it */
+ if (tzoom != 1.0 || pprint) {
+ char cpibuf[TCL_DOUBLE_SPACE + 1];
+ char lpibuf[TCL_DOUBLE_SPACE + 1];
+
+ Tcl_PrintDouble(interp, 10.0 / tzoom, cpibuf);
+ Tcl_PrintDouble(interp, 6.0 / tzoom, lpibuf);
+ num_options = cupsAddOption("cpi", cpibuf,
+ num_options, &options);
+ num_options = cupsAddOption("lpi", lpibuf,
+ num_options, &options);
+ }
+
+ /* set title and format */
+ if (!title) {
+ title = "Tk print job";
+ }
+ if (!format) {
+ format = CUPS_FORMAT_AUTO;
+ }
+
+ info = cupsCopyDestInfo(CUPS_HTTP_DEFAULT, printer);
+
+ if (cupsCreateDestJob(CUPS_HTTP_DEFAULT, printer, info, &job_id,
+ title, num_options, options) != IPP_STATUS_OK) {
+
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("Error creating job: \"%s\"",
+ cupsLastErrorString()));
+ result = TCL_ERROR;
+ goto cleanup;
+ }
+
+ buffer = Tcl_GetByteArrayFromObj(objv[3], &buflen);
+
+ if (cupsStartDestDocument(CUPS_HTTP_DEFAULT, printer, info, job_id,
+ "(stdin)", format, 0, NULL, 1) != HTTP_STATUS_CONTINUE) {
+ // Can't start document
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("Error starting document: \"%s\"",
+ cupsLastErrorString()));
+ result = TCL_ERROR;
+ goto cleanup;
+ }
+
+ if (cupsWriteRequestData(CUPS_HTTP_DEFAULT,(char *) buffer, buflen) !=
+ HTTP_STATUS_CONTINUE) {
+ // some error ocurred
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("Error writing data: \"%s\"",
+ cupsLastErrorString()));
+ result = TCL_ERROR;
+ goto cleanup;
+ }
+
+ if (cupsFinishDestDocument(CUPS_HTTP_DEFAULT, printer, info) ==
+ IPP_STATUS_OK) {
+ // all OK
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(job_id));
+ } else {
+ // some error ocurred
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("Error finishing document: \"%s\"",
+ cupsLastErrorString()));
+ result = TCL_ERROR;
+ goto cleanup;
+ }
+
+cleanup:
+ cupsFreeDestInfo(info);
+ cupsFreeOptions(num_options, options);
+ cupsFreeDests(1, printer);
+ return result;
+}
+
+static Tcl_Size
+ParseEnumOptions(
+ void *clientData,
+ Tcl_Interp *interp,
+ TCL_UNUSED(Tcl_Size),
+ Tcl_Obj *const *objv,
+ void *dstPtr)
+{
+ int index;
+ const char **dest = (const char **) dstPtr;
+ struct ParseData *pdata = (struct ParseData *)clientData;
+
+ if (Tcl_GetIndexFromObjStruct(interp, objv[0], pdata->optionTable,
+ sizeof(struct CupsOptions), pdata->message, 0, &index) != TCL_OK) {
+ return -1;
+ }
+
+ *dest = pdata->optionTable[index].cupsName;
+ return 1;
+}
+
+static Tcl_Size
+ParseOptions(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(Tcl_Size),
+ Tcl_Obj *const *objv,
+ void *dstPtr)
+{
+ Tcl_Obj **objPtr = (Tcl_Obj **) dstPtr;
+ Tcl_Size n;
+
+ /* check for a valid dictionary */
+ if (Tcl_DictObjSize(NULL, objv[0], &n) != TCL_OK) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("options must be a proper"
+ "dictionary", -1));
+ return -1;
+ }
+
+ *objPtr = objv[0];
+ return 1;
+}
+
+static Tcl_Size
+ParseMargins(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(Tcl_Size),
+ Tcl_Obj *const *objv,
+ void *dstPtr)
+{
+ Tcl_Obj **objPtr = (Tcl_Obj **) dstPtr;
+ Tcl_Obj **listArr;
+ Tcl_Size n;
+ int i;
+
+ if (Tcl_ListObjGetElements(NULL, objv[0], &n, &listArr) != TCL_OK ||
+ n != 4 ||
+ Tcl_GetIntFromObj(NULL, listArr[0], &i) != TCL_OK ||
+ Tcl_GetIntFromObj(NULL, listArr[1], &i) != TCL_OK ||
+ Tcl_GetIntFromObj(NULL, listArr[2], &i) != TCL_OK ||
+ Tcl_GetIntFromObj(NULL, listArr[3], &i) != TCL_OK
+ ) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("margins must be a list "
+ "of four integers: top left bottom right" , -1));
+ return -1;
+ }
+
+ *objPtr = objv[0];
+ return 1;
+}
+
+static Tcl_Size
+ParseNup(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(Tcl_Size),
+ Tcl_Obj *const *objv,
+ void *dstPtr)
+{
+ const char **nup = (const char **) dstPtr;
+ int n;
+
+ if (Tcl_GetIntFromObj(NULL, objv[0], &n) != TCL_OK ||
+ (n != 1 && n != 2 && n != 4 && n != 6 && n != 9 && n != 16)
+ ) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong number-up value: "
+ "should be 1, 2, 4, 6, 9 or 16", -1));
+ return -1;
+ }
+
+ *nup = Tcl_GetString(objv[0]);
+ return 1;
+}
+#endif /*HAVE_CUPS*/
+
+int
+#ifdef HAVE_CUPS
+Cups_Init(Tcl_Interp *interp)
+{
+ Tcl_Namespace *ns;
+ ns = Tcl_FindNamespace(interp, "::tk::print", NULL, TCL_GLOBAL_ONLY);
+ if (!ns)
+ ns = Tcl_CreateNamespace(interp, "::tk::print", NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::cups", Cups_Cmd, NULL, NULL);
+ Tcl_Export(interp, ns, "cups", 0);
+#else
+Cups_Init(TCL_UNUSED(Tcl_Interp *))
+{
+ /* Do nothing */
+#endif
+ return TCL_OK;
+}
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index a99c57b..d3253e4 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -361,7 +361,7 @@ InitFont(
errorFlag = 0;
handler = Tk_CreateErrorHandler(Tk_Display(tkwin),
- -1, -1, -1, InitFontErrorProc, (void *) &errorFlag);
+ -1, -1, -1, InitFontErrorProc, (void *)&errorFlag);
ftFont = GetFont(fontPtr, 0, 0.0);
if ((ftFont == NULL) || errorFlag) {
Tk_DeleteErrorHandler(handler);
@@ -403,7 +403,7 @@ InitFont(
fPtr->underlinePos = fPtr->fm.descent / 2;
handler = Tk_CreateErrorHandler(Tk_Display(tkwin),
- -1, -1, -1, InitFontErrorProc, (void *) &errorFlag);
+ -1, -1, -1, InitFontErrorProc, (void *)&errorFlag);
errorFlag = 0;
Tk_MeasureChars((Tk_Font) fPtr, "I", 1, -1, 0, &iWidth);
Tk_DeleteErrorHandler(handler);
@@ -786,7 +786,8 @@ Tk_MeasureChars(
LOCK;
XftTextExtents32(fontPtr->display, ftFont, &c, 1, &extents);
UNLOCK;
- } else {
+ }
+ if (errorFlag) {
extents.xOff = 0;
errorFlag = 0;
}
@@ -955,7 +956,7 @@ Tk_DrawChars(
XftGlyphFontSpec specs[NUM_SPEC];
XGlyphInfo metrics;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (fontPtr->ftDraw == 0) {
DEBUG(("Switch to drawable 0x%lx\n", drawable));
@@ -1088,7 +1089,7 @@ TkDrawAngledChars(
XftColor *xftcolor;
int xStart = x, yStart = y;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
#ifdef XFT_HAS_FIXED_ROTATED_PLACEMENT
int clen, nglyph;
FT_UInt glyphs[NUM_SPEC];
@@ -1169,10 +1170,10 @@ TkDrawAngledChars(
* at once (or whole blocks with same font), this requires a
* dynamic 'glyphs' array. In case of overflow the array has to
* be divided until the maximal string will fit. (GC)
- * Given the resolution of current displays though, this should
- * not be a huge issue since NUM_SPEC is 1024 and thus able to
- * cover about 6000 pixels for a 6 pixel wide font (which is
- * a very small barely readable font)
+ * Given the resolution of current displays though, this should
+ * not be a huge issue since NUM_SPEC is 1024 and thus able to
+ * cover about 6000 pixels for a 6 pixel wide font (which is
+ * a very small barely readable font)
*/
LOCK;
@@ -1428,7 +1429,7 @@ TkUnixSetXftClipRegion(
Region clipRegion) /* The clipping region to install. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->clipRegion = clipRegion;
}
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index 8f4d23b..69bcb27 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -114,17 +114,21 @@ DisplayVerticalScale(
int x, y, width, height, shadowWidth;
double tickValue, tickInterval = scalePtr->tickInterval;
Tk_3DBorder sliderBorder;
+ int scaleWidth, borderWidth, sliderLength;
/*
* Display the information from left to right across the window.
*/
+ Tk_GetPixelsFromObj(NULL, tkwin, scalePtr->widthObj, &scaleWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, scalePtr->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, scalePtr->sliderLengthObj, &sliderLength);
if (!(scalePtr->flags & REDRAW_OTHER)) {
drawnAreaPtr->x = scalePtr->vertTickRightX;
drawnAreaPtr->y = scalePtr->inset;
- drawnAreaPtr->width = scalePtr->vertTroughX + scalePtr->width
- + 2*scalePtr->borderWidth - scalePtr->vertTickRightX;
- drawnAreaPtr->height -= 2*scalePtr->inset;
+ drawnAreaPtr->width = scalePtr->vertTroughX + scaleWidth
+ + 2 * borderWidth - scalePtr->vertTickRightX;
+ drawnAreaPtr->height -= 2 * scalePtr->inset;
}
Tk_Fill3DRectangle(tkwin, drawable, scalePtr->bgBorder,
drawnAreaPtr->x, drawnAreaPtr->y, drawnAreaPtr->width,
@@ -187,33 +191,33 @@ DisplayVerticalScale(
Tk_Draw3DRectangle(tkwin, drawable,
scalePtr->bgBorder, scalePtr->vertTroughX, scalePtr->inset,
- scalePtr->width + 2*scalePtr->borderWidth,
- Tk_Height(tkwin) - 2*scalePtr->inset, scalePtr->borderWidth,
+ scaleWidth + 2 * borderWidth,
+ Tk_Height(tkwin) - 2 * scalePtr->inset, borderWidth,
TK_RELIEF_SUNKEN);
XFillRectangle(scalePtr->display, drawable, scalePtr->troughGC,
- scalePtr->vertTroughX + scalePtr->borderWidth,
- scalePtr->inset + scalePtr->borderWidth,
- (unsigned) scalePtr->width,
- (unsigned) (Tk_Height(tkwin) - 2*scalePtr->inset
- - 2*scalePtr->borderWidth));
+ scalePtr->vertTroughX + borderWidth,
+ scalePtr->inset + borderWidth,
+ (unsigned) scaleWidth,
+ (unsigned) (Tk_Height(tkwin) - 2 * scalePtr->inset
+ - 2 * borderWidth));
if (scalePtr->state == STATE_ACTIVE) {
sliderBorder = scalePtr->activeBorder;
} else {
sliderBorder = scalePtr->bgBorder;
}
- width = scalePtr->width;
- height = scalePtr->sliderLength/2;
- x = scalePtr->vertTroughX + scalePtr->borderWidth;
+ width = scaleWidth;
+ height = sliderLength / 2;
+ x = scalePtr->vertTroughX + borderWidth;
y = TkScaleValueToPixel(scalePtr, scalePtr->value) - height;
- shadowWidth = scalePtr->borderWidth/2;
+ shadowWidth = borderWidth / 2;
if (shadowWidth == 0) {
shadowWidth = 1;
}
Tk_Draw3DRectangle(tkwin, drawable, sliderBorder, x, y, width,
- 2*height, shadowWidth, scalePtr->sliderRelief);
+ 2 * height, shadowWidth, scalePtr->sliderRelief);
x += shadowWidth;
y += shadowWidth;
- width -= 2*shadowWidth;
+ width -= 2 * shadowWidth;
height -= shadowWidth;
Tk_Fill3DRectangle(tkwin, drawable, sliderBorder, x, y, width,
height, shadowWidth, scalePtr->sliderRelief);
@@ -224,13 +228,14 @@ DisplayVerticalScale(
* Draw the label to the right of the scale.
*/
- if ((scalePtr->flags & REDRAW_OTHER) && (scalePtr->labelLength != 0)) {
+ if ((scalePtr->flags & REDRAW_OTHER) && (scalePtr->labelObj != NULL)) {
Tk_FontMetrics fm;
+ Tcl_Size labelLength;
+ const char *label = Tcl_GetStringFromObj(scalePtr->labelObj, &labelLength);
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
- scalePtr->tkfont, scalePtr->label,
- scalePtr->labelLength, scalePtr->vertLabelX,
+ scalePtr->tkfont, label, labelLength, scalePtr->vertLabelX,
scalePtr->inset + (3 * fm.ascent) / 2);
}
}
@@ -329,17 +334,21 @@ DisplayHorizontalScale(
int x, y, width, height, shadowWidth;
double tickInterval = scalePtr->tickInterval;
Tk_3DBorder sliderBorder;
+ int scaleWidth, borderWidth, sliderLength;
/*
* Display the information from bottom to top across the window.
*/
+ Tk_GetPixelsFromObj(NULL, tkwin, scalePtr->widthObj, &scaleWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, scalePtr->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, scalePtr->sliderLengthObj, &sliderLength);
if (!(scalePtr->flags & REDRAW_OTHER)) {
drawnAreaPtr->x = scalePtr->inset;
drawnAreaPtr->y = scalePtr->horizValueY;
drawnAreaPtr->width -= 2*scalePtr->inset;
- drawnAreaPtr->height = scalePtr->horizTroughY + scalePtr->width
- + 2*scalePtr->borderWidth - scalePtr->horizValueY;
+ drawnAreaPtr->height = scalePtr->horizTroughY + scaleWidth
+ + 2 * borderWidth - scalePtr->horizValueY;
}
Tk_Fill3DRectangle(tkwin, drawable, scalePtr->bgBorder,
drawnAreaPtr->x, drawnAreaPtr->y, drawnAreaPtr->width,
@@ -410,25 +419,25 @@ DisplayHorizontalScale(
y = scalePtr->horizTroughY;
Tk_Draw3DRectangle(tkwin, drawable,
scalePtr->bgBorder, scalePtr->inset, y,
- Tk_Width(tkwin) - 2*scalePtr->inset,
- scalePtr->width + 2*scalePtr->borderWidth,
- scalePtr->borderWidth, TK_RELIEF_SUNKEN);
+ Tk_Width(tkwin) - 2 * scalePtr->inset,
+ scaleWidth + 2 * borderWidth,
+ borderWidth, TK_RELIEF_SUNKEN);
XFillRectangle(scalePtr->display, drawable, scalePtr->troughGC,
- scalePtr->inset + scalePtr->borderWidth,
- y + scalePtr->borderWidth,
- (unsigned) (Tk_Width(tkwin) - 2*scalePtr->inset
- - 2*scalePtr->borderWidth),
- (unsigned) scalePtr->width);
+ scalePtr->inset + borderWidth,
+ y + borderWidth,
+ (unsigned) (Tk_Width(tkwin) - 2 * scalePtr->inset
+ - 2 * borderWidth),
+ (unsigned) scaleWidth);
if (scalePtr->state == STATE_ACTIVE) {
sliderBorder = scalePtr->activeBorder;
} else {
sliderBorder = scalePtr->bgBorder;
}
- width = scalePtr->sliderLength/2;
- height = scalePtr->width;
+ width = sliderLength / 2;
+ height = scaleWidth;
x = TkScaleValueToPixel(scalePtr, scalePtr->value) - width;
- y += scalePtr->borderWidth;
- shadowWidth = scalePtr->borderWidth/2;
+ y += borderWidth;
+ shadowWidth = borderWidth / 2;
if (shadowWidth == 0) {
shadowWidth = 1;
}
@@ -447,13 +456,14 @@ DisplayHorizontalScale(
* Draw the label at the top of the scale.
*/
- if ((scalePtr->flags & REDRAW_OTHER) && (scalePtr->labelLength != 0)) {
+ if ((scalePtr->flags & REDRAW_OTHER) && (scalePtr->labelObj != NULL)) {
Tk_FontMetrics fm;
+ Tcl_Size labelLength;
+ const char *label = Tcl_GetStringFromObj(scalePtr->labelObj, &labelLength);
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
- scalePtr->tkfont, scalePtr->label,
- scalePtr->labelLength, scalePtr->inset + fm.ascent/2,
+ scalePtr->tkfont, label, labelLength, scalePtr->inset + fm.ascent/2,
scalePtr->horizLabelY + fm.ascent);
}
}
@@ -554,9 +564,10 @@ TkpDisplayScale(
char string[TCL_DOUBLE_SPACE];
XRectangle drawnArea;
Tcl_DString buf;
+ int highlightWidth, borderWidth;
scalePtr->flags &= ~REDRAW_PENDING;
- if ((scalePtr->tkwin == NULL) || !Tk_IsMapped(scalePtr->tkwin)) {
+ if ((tkwin == NULL) || !Tk_IsMapped(tkwin)) {
goto done;
}
@@ -565,14 +576,14 @@ TkpDisplayScale(
*/
Tcl_Preserve(scalePtr);
- if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
+ if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->commandObj != NULL)) {
Tcl_Preserve(interp);
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, TCL_INDEX_NONE);
+ Tcl_DStringAppend(&buf, Tcl_GetString(scalePtr->commandObj), TCL_INDEX_NONE);
Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE);
Tcl_DStringAppend(&buf, string, TCL_INDEX_NONE);
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
@@ -624,15 +635,17 @@ TkpDisplayScale(
* vertical scales: border and traversal highlight.
*/
+ Tk_GetPixelsFromObj(NULL, tkwin, scalePtr->highlightWidthObj, &highlightWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, scalePtr->borderWidthObj, &borderWidth);
if (scalePtr->flags & REDRAW_OTHER) {
if (scalePtr->relief != TK_RELIEF_FLAT) {
Tk_Draw3DRectangle(tkwin, pixmap, scalePtr->bgBorder,
- scalePtr->highlightWidth, scalePtr->highlightWidth,
- Tk_Width(tkwin) - 2*scalePtr->highlightWidth,
- Tk_Height(tkwin) - 2*scalePtr->highlightWidth,
- scalePtr->borderWidth, scalePtr->relief);
+ highlightWidth, highlightWidth,
+ Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth,
+ borderWidth, scalePtr->relief);
}
- if (scalePtr->highlightWidth > 0) {
+ if (highlightWidth > 0) {
GC gc;
if (scalePtr->flags & GOT_FOCUS) {
@@ -641,7 +654,7 @@ TkpDisplayScale(
gc = Tk_GCForColor(
Tk_3DBorderColor(scalePtr->highlightBorder), pixmap);
}
- Tk_DrawFocusHighlight(tkwin, gc, scalePtr->highlightWidth, pixmap);
+ Tk_DrawFocusHighlight(tkwin, gc, highlightWidth, pixmap);
}
}
@@ -684,12 +697,15 @@ TkpScaleElement(
TkScale *scalePtr, /* Widget record for scale. */
int x, int y) /* Coordinates within scalePtr's window. */
{
- int sliderFirst;
+ int sliderFirst, width, borderWidth, sliderLength;
+ Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->widthObj, &width);
+ Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->sliderLengthObj, &sliderLength);
if (scalePtr->orient == ORIENT_VERTICAL) {
if ((x < scalePtr->vertTroughX)
- || (x >= (scalePtr->vertTroughX + 2*scalePtr->borderWidth +
- scalePtr->width))) {
+ || (x >= (scalePtr->vertTroughX + 2 * borderWidth +
+ width))) {
return OTHER;
}
if ((y < scalePtr->inset)
@@ -697,19 +713,19 @@ TkpScaleElement(
return OTHER;
}
sliderFirst = TkScaleValueToPixel(scalePtr, scalePtr->value)
- - scalePtr->sliderLength/2;
+ - sliderLength/2;
if (y < sliderFirst) {
return TROUGH1;
}
- if (y < sliderFirst + scalePtr->sliderLength) {
+ if (y < sliderFirst + sliderLength) {
return SLIDER;
}
return TROUGH2;
}
if ((y < scalePtr->horizTroughY)
- || (y >= (scalePtr->horizTroughY + 2*scalePtr->borderWidth +
- scalePtr->width))) {
+ || (y >= (scalePtr->horizTroughY + 2 * borderWidth +
+ width))) {
return OTHER;
}
if ((x < scalePtr->inset)
@@ -717,11 +733,11 @@ TkpScaleElement(
return OTHER;
}
sliderFirst = TkScaleValueToPixel(scalePtr, scalePtr->value)
- - scalePtr->sliderLength/2;
+ - sliderLength / 2;
if (x < sliderFirst) {
return TROUGH1;
}
- if (x < sliderFirst + scalePtr->sliderLength) {
+ if (x < sliderFirst + sliderLength) {
return SLIDER;
}
return TROUGH2;
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c
index 65166e4..8a198f6 100644
--- a/unix/tkUnixScrlbr.c
+++ b/unix/tkUnixScrlbr.c
@@ -102,6 +102,7 @@ TkpDisplayScrollbar(
XPoint points[7];
Tk_3DBorder border;
int relief, width, elementBorderWidth;
+ int borderWidth, highlightWidth;
Pixmap pixmap;
if ((scrollPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
@@ -109,13 +110,15 @@ TkpDisplayScrollbar(
}
if (scrollPtr->vertical) {
- width = Tk_Width(tkwin) - 2*scrollPtr->inset;
+ width = Tk_Width(tkwin) - 2 * scrollPtr->inset;
} else {
- width = Tk_Height(tkwin) - 2*scrollPtr->inset;
+ width = Tk_Height(tkwin) - 2 * scrollPtr->inset;
}
- elementBorderWidth = scrollPtr->elementBorderWidth;
- if (elementBorderWidth < 0) {
- elementBorderWidth = scrollPtr->borderWidth;
+ Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->borderWidthObj, &borderWidth);
+ if (scrollPtr->elementBorderWidthObj) {
+ Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->elementBorderWidthObj, &elementBorderWidth);
+ } else {
+ elementBorderWidth = borderWidth;
}
/*
@@ -128,7 +131,8 @@ TkpDisplayScrollbar(
pixmap = Tk_GetPixmap(scrollPtr->display, Tk_WindowId(tkwin),
Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
- if (scrollPtr->highlightWidth > 0) {
+ Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->highlightWidthObj, &highlightWidth);
+ if (highlightWidth > 0) {
GC gc;
if (scrollPtr->flags & GOT_FOCUS) {
@@ -136,18 +140,18 @@ TkpDisplayScrollbar(
} else {
gc = Tk_GCForColor(scrollPtr->highlightBgColorPtr, pixmap);
}
- Tk_DrawFocusHighlight(tkwin, gc, scrollPtr->highlightWidth, pixmap);
+ Tk_DrawFocusHighlight(tkwin, gc, highlightWidth, pixmap);
}
Tk_Draw3DRectangle(tkwin, pixmap, scrollPtr->bgBorder,
- scrollPtr->highlightWidth, scrollPtr->highlightWidth,
- Tk_Width(tkwin) - 2*scrollPtr->highlightWidth,
- Tk_Height(tkwin) - 2*scrollPtr->highlightWidth,
- scrollPtr->borderWidth, scrollPtr->relief);
+ highlightWidth, highlightWidth,
+ Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth,
+ borderWidth, scrollPtr->relief);
XFillRectangle(scrollPtr->display, pixmap,
((UnixScrollbar*)scrollPtr)->troughGC,
scrollPtr->inset, scrollPtr->inset,
- (unsigned) (Tk_Width(tkwin) - 2*scrollPtr->inset),
- (unsigned) (Tk_Height(tkwin) - 2*scrollPtr->inset));
+ (unsigned) (Tk_Width(tkwin) - 2 * scrollPtr->inset),
+ (unsigned) (Tk_Height(tkwin) - 2 * scrollPtr->inset));
/*
* Draw the top or left arrow. The coordinates of the polygon points
@@ -282,8 +286,11 @@ TkpComputeScrollbarGeometry(
* changed. */
{
int width, fieldLength;
+ int borderWidth, highlightWidth;
- scrollPtr->inset = scrollPtr->highlightWidth + scrollPtr->borderWidth;
+ Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->borderWidthObj, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->highlightWidthObj, &highlightWidth);
+ scrollPtr->inset = highlightWidth + borderWidth;
width = (scrollPtr->vertical) ? Tk_Width(scrollPtr->tkwin)
: Tk_Height(scrollPtr->tkwin);
@@ -291,10 +298,10 @@ TkpComputeScrollbarGeometry(
* Next line assumes that the arrow area is a square.
*/
- scrollPtr->arrowLength = width - 2*scrollPtr->inset + 1;
+ scrollPtr->arrowLength = width - 2 * scrollPtr->inset + 1;
fieldLength = (scrollPtr->vertical ? Tk_Height(scrollPtr->tkwin)
: Tk_Width(scrollPtr->tkwin))
- - 2*(scrollPtr->arrowLength + scrollPtr->inset);
+ - 2 * (scrollPtr->arrowLength + scrollPtr->inset);
if (fieldLength < 0) {
fieldLength = 0;
}
@@ -328,15 +335,16 @@ TkpComputeScrollbarGeometry(
* window, if any). Then arrange for the window to be redisplayed.
*/
+ Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->widthObj, &width);
if (scrollPtr->vertical) {
Tk_GeometryRequest(scrollPtr->tkwin,
- scrollPtr->width + 2*scrollPtr->inset,
- 2*(scrollPtr->arrowLength + scrollPtr->borderWidth
+ width + 2 * scrollPtr->inset,
+ 2 * (scrollPtr->arrowLength + borderWidth
+ scrollPtr->inset));
} else {
Tk_GeometryRequest(scrollPtr->tkwin,
- 2*(scrollPtr->arrowLength + scrollPtr->borderWidth
- + scrollPtr->inset), scrollPtr->width + 2*scrollPtr->inset);
+ 2 * (scrollPtr->arrowLength + borderWidth
+ + scrollPtr->inset), width + 2 * scrollPtr->inset);
}
Tk_SetInternalBorder(scrollPtr->tkwin, scrollPtr->inset);
}
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index ecc9566..a06d4af 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -309,7 +309,7 @@ RegOpen(
XDeleteProperty(dispPtr->display,
RootWindow(dispPtr->display, 0),
dispPtr->registryProperty);
- XSync(dispPtr->display, False);
+ XSync(dispPtr->display, False);
}
Tk_DeleteErrorHandler(handler);
@@ -523,7 +523,7 @@ RegClose(
Tk_ErrorHandler handler;
handler = Tk_CreateErrorHandler(regPtr->dispPtr->display, -1, -1, -1,
- NULL, NULL);
+ NULL, NULL);
if (regPtr->modified) {
if (!regPtr->locked && !localData.sendDebug) {
@@ -1991,14 +1991,14 @@ TkpTestsendCmd(
return TCL_ERROR;
}
if (index == TESTSEND_BOGUS) {
- handler = Tk_CreateErrorHandler(winPtr->dispPtr->display, -1, -1, -1,
- NULL, NULL);
+ handler = Tk_CreateErrorHandler(winPtr->dispPtr->display, -1, -1, -1,
+ NULL, NULL);
XChangeProperty(winPtr->dispPtr->display,
RootWindow(winPtr->dispPtr->display, 0),
winPtr->dispPtr->registryProperty, XA_INTEGER, 32,
PropModeReplace,
(unsigned char *) "This is bogus information", 6);
- Tk_DeleteErrorHandler(handler);
+ Tk_DeleteErrorHandler(handler);
} else if (index == TESTSEND_PROP) {
int result, actualFormat;
unsigned long length, bytesAfter;
@@ -2037,10 +2037,10 @@ TkpTestsendCmd(
XFree(property);
}
} else if (Tcl_GetString(objv[4])[0] == 0) {
- handler = Tk_CreateErrorHandler(winPtr->dispPtr->display,
- -1, -1, -1, NULL, NULL);
+ handler = Tk_CreateErrorHandler(winPtr->dispPtr->display,
+ -1, -1, -1, NULL, NULL);
XDeleteProperty(winPtr->dispPtr->display, w, propName);
- Tk_DeleteErrorHandler(handler);
+ Tk_DeleteErrorHandler(handler);
} else {
Tcl_DString tmp;
@@ -2051,12 +2051,12 @@ TkpTestsendCmd(
*p = 0;
}
}
- handler = Tk_CreateErrorHandler(winPtr->dispPtr->display,
- -1, -1, -1, NULL, NULL);
+ handler = Tk_CreateErrorHandler(winPtr->dispPtr->display,
+ -1, -1, -1, NULL, NULL);
XChangeProperty(winPtr->dispPtr->display, w, propName, XA_STRING,
8, PropModeReplace, (unsigned char*)Tcl_DStringValue(&tmp),
p-Tcl_DStringValue(&tmp));
- Tk_DeleteErrorHandler(handler);
+ Tk_DeleteErrorHandler(handler);
Tcl_DStringFree(&tmp);
}
} else if (index == TESTSEND_SERIAL) {
diff --git a/unix/tkUnixSysTray.c b/unix/tkUnixSysTray.c
index 3375472..b3fc5bb 100644
--- a/unix/tkUnixSysTray.c
+++ b/unix/tkUnixSysTray.c
@@ -90,8 +90,8 @@ TKU_AddInput(
{
XWindowAttributes xswa;
TKU_NO_BAD_WINDOW_BEGIN(dpy)
- XGetWindowAttributes(dpy,win,&xswa);
- XSelectInput(dpy,win,xswa.your_event_mask|add_to_mask);
+ XGetWindowAttributes(dpy,win,&xswa);
+ XSelectInput(dpy,win,xswa.your_event_mask|add_to_mask);
TKU_NO_BAD_WINDOW_END
}
@@ -190,8 +190,8 @@ typedef struct {
int requestedWidth, requestedHeight;
int visible; /* whether XEMBED_MAPPED should be set */
int docked; /* whether an icon should be docked */
- char *imageString, /* option: -image as string */
- *classString; /* option: -class as string */
+ Tcl_Obj *imageObj; /* option: -image */
+ Tcl_Obj *classObj; /* option: -class */
} DockIcon;
/*
@@ -261,9 +261,9 @@ TrayIconObjectCmd(
int msgid;
enum {XWC_CONFIGURE = 0, XWC_CGET, XWC_BALLOON, XWC_CANCEL,
- XWC_BBOX, XWC_DOCKED, XWC_ORIENTATION};
+ XWC_BBOX, XWC_DOCKED, XWC_ORIENTATION};
const char *st_wcmd[] = {"configure", "cget", "balloon", "cancel",
- "bbox", "docked", "orientation", NULL};
+ "bbox", "docked", "orientation", NULL};
long timeout = 0;
Tcl_Obj* optionValue;
@@ -273,7 +273,7 @@ TrayIconObjectCmd(
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[1], st_wcmd,
- "subcommand", TCL_EXACT, &wcmd) != TCL_OK) {
+ "subcommand", TCL_EXACT, &wcmd) != TCL_OK) {
return TCL_ERROR;
}
@@ -287,7 +287,7 @@ TrayIconObjectCmd(
return TCL_ERROR;
}
optionValue = Tk_GetOptionValue(interp,(char*)icon,
- icon->options,objv[2],icon->tkwin);
+ icon->options,objv[2],icon->tkwin);
if (optionValue) {
Tcl_SetObjResult(interp,optionValue);
return TCL_OK;
@@ -323,11 +323,11 @@ TrayIconObjectCmd(
case XWC_BBOX:
if (icon->drawingWin) {
XGetWindowAttributes(Tk_Display(icon->drawingWin),
- TKU_XID(icon->drawingWin), &xwa);
+ TKU_XID(icon->drawingWin), &xwa);
XTranslateCoordinates(Tk_Display(icon->drawingWin),
- TKU_XID(icon->drawingWin), xwa.root, 0,0,
- &icon->x, &icon->y, &bogus);
+ TKU_XID(icon->drawingWin), xwa.root, 0,0,
+ &icon->x, &icon->y, &bogus);
bbox[0] = icon->x;
bbox[1] = icon->y;
bbox[2] = bbox[0] + icon->width - 1;
@@ -540,15 +540,15 @@ CheckArgbVisual(
Colormap cmap = None;
TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin))
- XGetWindowProperty(Tk_Display(icon->tkwin),
- icon->trayManager,
- icon->a_NET_SYSTEM_TRAY_VISUAL,
- /* offset */ 0,
- /* length */ 1,
- /* delete */ False,
- /* type */ XA_VISUALID,
- &retType, &retFormat, &retNitems,
- &retBytesAfter, &retProp);
+ XGetWindowProperty(Tk_Display(icon->tkwin),
+ icon->trayManager,
+ icon->a_NET_SYSTEM_TRAY_VISUAL,
+ /* offset */ 0,
+ /* length */ 1,
+ /* delete */ False,
+ /* type */ XA_VISUALID,
+ &retType, &retFormat, &retNitems,
+ &retBytesAfter, &retProp);
TKU_NO_BAD_WINDOW_END
if (retType == XA_VISUALID &&
retNitems == 1 &&
@@ -557,7 +557,7 @@ CheckArgbVisual(
snprintf(numeric,256,"%ld",*(long*)retProp);
XFree(retProp);
match = Tk_GetVisual(icon->interp, icon->tkwin,
- numeric, &depth, &cmap);
+ numeric, &depth, &cmap);
}
if (match&& depth == 32 &&
match->red_mask == 0xFF0000UL &&
@@ -602,16 +602,16 @@ CreateTrayIconWindow(
* the docs.
*/
tkwin = icon->drawingWin = Tk_CreateWindow(icon->interp, icon->tkwin,
- Tk_Name(icon->tkwin), "");
+ Tk_Name(icon->tkwin), "");
if (tkwin) {
- Tk_SetClass(icon->drawingWin,icon->classString);
+ Tk_SetClass(icon->drawingWin, Tcl_GetString(icon->classObj));
Tk_CreateEventHandler(icon->drawingWin,ExposureMask|StructureNotifyMask|
- ButtonPressMask|ButtonReleaseMask|
- EnterWindowMask|LeaveWindowMask|PointerMotionMask,
- TrayIconEvent, icon);
+ ButtonPressMask|ButtonReleaseMask|
+ EnterWindowMask|LeaveWindowMask|PointerMotionMask,
+ TrayIconEvent, icon);
if(icon->bestVisual) {
Tk_SetWindowVisual(icon->drawingWin,icon->bestVisual,
- 32,icon->bestColormap);
+ 32,icon->bestColormap);
icon->flags |= ICON_FLAG_ARGB32;
Tk_SetWindowBackground(tkwin, 0);
} else {
@@ -667,11 +667,11 @@ DockToManager(
static const
Tk_OptionSpec IconOptionSpec[] = {
{TK_OPTION_STRING,"-image","image","Image",
- NULL, TCL_INDEX_NONE, offsetof(DockIcon, imageString),
+ NULL, offsetof(DockIcon, imageObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, NULL,
ICON_CONF_IMAGE | ICON_CONF_REDISPLAY},
{TK_OPTION_STRING,"-class","class","Class",
- "TrayIcon", TCL_INDEX_NONE, offsetof(DockIcon, classString),
+ "TrayIcon", offsetof(DockIcon, classObj), TCL_INDEX_NONE,
0, NULL, ICON_CONF_CLASS},
{TK_OPTION_BOOLEAN,"-docked","docked","Docked",
"1", TCL_INDEX_NONE, offsetof(DockIcon, docked), 0, NULL,
@@ -709,7 +709,7 @@ TrayIconRequestSize(
{
if (icon->drawingWin) {
if (icon->requestedWidth != w ||
- icon->requestedHeight != h) {
+ icon->requestedHeight != h) {
Tk_SetMinimumRequestSize(icon->drawingWin,w,h);
Tk_GeometryRequest(icon->drawingWin,w,h);
Tk_SetGrid(icon->drawingWin,1,1,w,h);
@@ -898,21 +898,21 @@ DisplayIcon(
*/
if (icon->offscreenPixmap == None) {
icon->offscreenPixmap = Tk_GetPixmap(Tk_Display(icon->drawingWin),
- Tk_WindowId(icon->drawingWin), w, h, 32);
+ Tk_WindowId(icon->drawingWin), w, h, 32);
}
if (!icon->photo) {
- icon->photo = Tk_FindPhoto(icon->interp, icon->imageString);
+ icon->photo = Tk_FindPhoto(icon->interp, Tcl_GetString(icon->imageObj));
}
if (!icon->photo && !icon->imageVisualInstance) {
Tcl_InterpState saved
= Tcl_SaveInterpState(icon->interp, TCL_OK);
icon->imageVisualInstance = Tk_GetImage(icon->interp,icon->drawingWin,
- icon->imageString, IgnoreImageChange, NULL);
+ Tcl_GetString(icon->imageObj), IgnoreImageChange, NULL);
Tcl_RestoreInterpState(icon->interp,saved);
}
if (icon->photo && !icon->offscreenImage) {
icon->offscreenImage = XGetImage(Tk_Display(icon->drawingWin),
- icon->offscreenPixmap, 0, 0, w, h, AllPlanes, ZPixmap);
+ icon->offscreenPixmap, 0, 0, w, h, AllPlanes, ZPixmap);
}
if (icon->offscreenGC == None) {
XGCValues gcv;
@@ -921,7 +921,7 @@ DisplayIcon(
gcv.foreground = 0;
gcv.background = 0;
icon->offscreenGC = Tk_GetGC(icon->drawingWin,
- GCFunction|GCPlaneMask|GCForeground|GCBackground, &gcv);
+ GCFunction|GCPlaneMask|GCForeground|GCBackground, &gcv);
}
if (icon->flags & ICON_FLAG_DIRTY_EDGES) {
XClearWindow(Tk_Display(icon->drawingWin), TKU_XID(icon->drawingWin));
@@ -967,16 +967,16 @@ DisplayIcon(
0,0,w,h);
if (icon->imageVisualInstance) {
Tk_RedrawImage(icon->imageVisualInstance,
- 0,0,w,h,
- icon->offscreenPixmap,
- 0,0);
+ 0,0,w,h,
+ icon->offscreenPixmap,
+ 0,0);
}
}
XCopyArea(Tk_Display(icon->drawingWin),
- icon->offscreenPixmap,
- TKU_XID(icon->drawingWin),
- icon->offscreenGC,
- imgx,imgy,outw,outh,outx,outy);
+ icon->offscreenPixmap,
+ TKU_XID(icon->drawingWin),
+ icon->offscreenGC,
+ imgx,imgy,outw,outh,outx,outy);
} else {
/* Non-argb redraw: clear window and draw an image over it.
For photos it gives a correct alpha blending with a parent
@@ -984,10 +984,10 @@ DisplayIcon(
work with lxpanel fancy backgrounds).
*/
XClearWindow(Tk_Display(icon->drawingWin),
- TKU_XID(icon->drawingWin));
+ TKU_XID(icon->drawingWin));
if (icon->image && icon->visible) {
Tk_RedrawImage(icon->image,imgx,imgy,outw,outh,
- TKU_XID(icon->drawingWin), outx, outy);
+ TKU_XID(icon->drawingWin), outx, outy);
}
}
}
@@ -1086,7 +1086,7 @@ TrayIconWrapperEvent(
to check for reparent-to-root is to ask for this root
first */
XGetWindowAttributes(ev->xreparent.display,
- ev->xreparent.window, &attr);
+ ev->xreparent.window, &attr);
if (attr.root == ev->xreparent.parent) {
/* upon reparent to root, */
if (icon->drawingWin) {
@@ -1098,7 +1098,7 @@ TrayIconWrapperEvent(
}
} /* Reparenting into some other embedder is theoretically possible,
* and everything would just work in this case.
- */
+ */
break;
}
}
@@ -1156,7 +1156,7 @@ TrayIconEvent(
case ConfigureNotify:
Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconConfigure"), NULL);
if (icon->width != ev->xconfigure.width ||
- icon->height != ev->xconfigure.height) {
+ icon->height != ev->xconfigure.height) {
icon->width = ev->xconfigure.width;
icon->height = ev->xconfigure.height;
icon->flags |= ICON_FLAG_DIRTY_EDGES;
@@ -1280,10 +1280,10 @@ PostBalloon(
ev.xclient.data.l[4] = ++icon->msgid;
TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin))
XSendEvent(dpy, icon->myManager , True, StructureNotifyMask|SubstructureNotifyMask, &ev);
- XSync(dpy, False);
+ XSync(dpy, False);
- /* Sending message elements */
- while (length>0) {
+ /* Sending message elements */
+ while (length>0) {
ev.type = ClientMessage;
ev.xclient.window = icon->wrapper;
ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_MESSAGE_DATA;
@@ -1294,7 +1294,7 @@ PostBalloon(
XSync(dpy,False);
utf8msg += 20;
length -= 20;
- }
+ }
TKU_NO_BAD_WINDOW_END;
return icon->msgid;
}
@@ -1340,7 +1340,7 @@ CancelBalloon(
ev.xclient.data.l[2] =msgid;
TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin))
XSendEvent(dpy, icon->myManager , True,
- StructureNotifyMask|SubstructureNotifyMask, &ev);
+ StructureNotifyMask|SubstructureNotifyMask, &ev);
TKU_NO_BAD_WINDOW_END
}
@@ -1418,7 +1418,7 @@ TrayIconUpdate(
*/
if (mask & ICON_CONF_CLASS) {
if (icon->drawingWin)
- Tk_SetClass(icon->drawingWin,Tk_GetUid(icon->classString));
+ Tk_SetClass(icon->drawingWin,Tk_GetUid(Tcl_GetString(icon->classObj)));
}
/*
* First, ensure right icon visibility.
@@ -1431,8 +1431,8 @@ TrayIconUpdate(
*/
if (mask & ICON_CONF_XEMBED) {
if (icon->myManager == None &&
- icon->trayManager != None &&
- icon->docked) {
+ icon->trayManager != None &&
+ icon->docked) {
CheckArgbVisual(icon);
if (icon->drawingWin &&
((icon->bestVisual && !(icon->flags & ICON_FLAG_ARGB32)) ||
@@ -1451,8 +1451,8 @@ TrayIconUpdate(
}
}
if (icon->myManager != None &&
- icon->drawingWin != NULL &&
- !icon->docked) {
+ icon->drawingWin != NULL &&
+ !icon->docked) {
Tk_DestroyWindow(icon->drawingWin);
icon->drawingWin = NULL;
icon->myManager = None;
@@ -1501,7 +1501,7 @@ TrayIconConfigureMethod(
if (objc <= 1 && !(addflags & ICON_CONF_FIRST_TIME)) {
Tcl_Obj* info = Tk_GetOptionInfo(interp, (char*)icon, icon->options,
- objc? objv[0] : NULL, icon->tkwin);
+ objc? objv[0] : NULL, icon->tkwin);
if (info) {
Tcl_SetObjResult(interp,info);
return TCL_OK;
@@ -1511,15 +1511,15 @@ TrayIconConfigureMethod(
}
if (Tk_SetOptions(interp, icon,icon->options,objc,objv,
- icon->tkwin,&saved,&mask) != TCL_OK) {
+ icon->tkwin,&saved,&mask) != TCL_OK) {
return TCL_ERROR; /* msg by Tk_SetOptions */
}
mask |= addflags;
/* now check option validity */
if (mask & ICON_CONF_IMAGE) {
- if (icon->imageString) {
- newImage = Tk_GetImage(interp, icon->tkwin, icon->imageString,
- TrayIconImageChanged, icon);
+ if (icon->imageObj) {
+ newImage = Tk_GetImage(interp, icon->tkwin, Tcl_GetString(icon->imageObj),
+ TrayIconImageChanged, icon);
if (!newImage) {
Tk_RestoreSavedOptions(&saved);
return TCL_ERROR; /* msg by Tk_GetImage */
@@ -1608,23 +1608,23 @@ TrayIconCreateCmd(
* because it's not really shown.
*/
icon->tkwin = Tk_CreateWindowFromPath(interp, mainWindow,
- Tcl_GetString(objv[1]),"");
+ Tcl_GetString(objv[1]),"");
if (icon->tkwin == NULL) {
goto handleErrors;
}
/* Subscribe to StructureNotify */
TKU_AddInput(Tk_Display(icon->tkwin),
- RootWindowOfScreen(Tk_Screen(icon->tkwin)),StructureNotifyMask);
+ RootWindowOfScreen(Tk_Screen(icon->tkwin)),StructureNotifyMask);
TKU_AddInput(Tk_Display(icon->tkwin),
- RootWindow(Tk_Display(icon->tkwin),0),StructureNotifyMask);
+ RootWindow(Tk_Display(icon->tkwin),0),StructureNotifyMask);
/* Spec says "screen 0" not "default", but... */
TKU_AddInput(Tk_Display(icon->tkwin),
- DefaultRootWindow(Tk_Display(icon->tkwin)),StructureNotifyMask);
+ DefaultRootWindow(Tk_Display(icon->tkwin)),StructureNotifyMask);
/* Early tracking of DestroyNotify is essential */
Tk_CreateEventHandler(icon->tkwin,StructureNotifyMask,
- UserIconEvent, icon);
+ UserIconEvent, icon);
/* Now try setting options */
icon->options = Tk_CreateOptionTable(interp,IconOptionSpec);
@@ -1653,13 +1653,13 @@ TrayIconCreateCmd(
if (objc>3) {
if (TrayIconConfigureMethod(icon, interp, objc-2, objv+2,
- ICON_CONF_XEMBED|ICON_CONF_IMAGE|ICON_CONF_FIRST_TIME) != TCL_OK) {
+ ICON_CONF_XEMBED|ICON_CONF_IMAGE|ICON_CONF_FIRST_TIME) != TCL_OK) {
goto handleErrors;
}
}
icon->widgetCmd = Tcl_CreateObjCommand2(interp, Tcl_GetString(objv[1]),
- TrayIconObjectCmd, icon, TrayIconDeleteProc);
+ TrayIconObjectCmd, icon, TrayIconDeleteProc);
/* Sometimes a command just can't be created... */
if (!icon->widgetCmd) {
@@ -1706,7 +1706,7 @@ Tktray_Init(
Tcl_Interp *interp)
{
Tcl_CreateObjCommand2(interp, "::tk::systray::_systray",
- TrayIconCreateCmd, Tk_MainWindow(interp), NULL);
+ TrayIconCreateCmd, Tk_MainWindow(interp), NULL);
return TCL_OK;
}
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 56d59ce..fc83324 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -1829,10 +1829,10 @@ WmForgetCmd(
~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
RemapWindows(winPtr, winPtr->parentPtr);
- /*
- * Make sure wm no longer manages this window
- */
- Tk_ManageGeometry(frameWin, NULL, NULL);
+ /*
+ * Make sure wm no longer manages this window
+ */
+ Tk_ManageGeometry(frameWin, NULL, NULL);
/*
* Flags (above) must be cleared before calling TkMapTopFrame (below).
@@ -2492,7 +2492,7 @@ WmIconphotoCmd(
if (photo == NULL) {
ckfree(iconPropertyData);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "failed to create an iconphoto with image \"%s\"",
+ "failed to create an iconphoto with image \"%s\"",
Tcl_GetString(objv[i])));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "IMAGE", NULL);
return TCL_ERROR;
@@ -5847,9 +5847,9 @@ static int PointInWindow(
{
XWindowChanges changes = wmPtr->winPtr->changes;
return (x >= changes.x &&
- x < changes.x + changes.width &&
- y >= changes.y - wmPtr->menuHeight &&
- y < changes.y + changes.height);
+ x < changes.x + changes.width &&
+ y >= changes.y - wmPtr->menuHeight &&
+ y < changes.y + changes.height);
}
Tk_Window
@@ -5922,38 +5922,38 @@ Tk_CoordsToWindow(
}
for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
wmPtr = wmPtr->nextPtr) {
- if (wmPtr->winPtr->mainPtr == NULL) {
- continue;
- }
+ if (wmPtr->winPtr->mainPtr == NULL) {
+ continue;
+ }
if (child == wmPtr->reparent) {
- if (PointInWindow(x, y, wmPtr)) {
- goto gotToplevel;
- } else {
+ if (PointInWindow(x, y, wmPtr)) {
+ goto gotToplevel;
+ } else {
- /*
- * Return NULL if the point is in the title bar or border.
- */
+ /*
+ * Return NULL if the point is in the title bar or border.
+ */
- return NULL;
- }
+ return NULL;
+ }
}
if (wmPtr->wrapperPtr != NULL) {
if (child == wmPtr->wrapperPtr->window) {
goto gotToplevel;
} else if (wmPtr->winPtr->flags & TK_EMBEDDED &&
- Tk_GetOtherWindow((Tk_Window)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;
- }
+ Tk_GetOtherWindow((Tk_Window)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;
}
@@ -6050,11 +6050,11 @@ Tk_CoordsToWindow(
childY = y;
goto gotToplevel;
} else {
- winPtr = nextPtr;
- }
+ winPtr = nextPtr;
+ }
}
if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) {
- return NULL;
+ return NULL;
}
return (Tk_Window) winPtr;
}