summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-25 06:22:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-25 06:22:49 (GMT)
commitaa8237ea926f3a1b19e4501879e6d32f6e0b7e6c (patch)
tree0287aef747309d28559d4928e30a91509a91ef5b
parent5e2225d853694bed068a250b19d22a5dea0abcf3 (diff)
parent0002267094b97b5f01bf6e4a69ba6e1e150a35eb (diff)
downloadtk-aa8237ea926f3a1b19e4501879e6d32f6e0b7e6c.zip
tk-aa8237ea926f3a1b19e4501879e6d32f6e0b7e6c.tar.gz
tk-aa8237ea926f3a1b19e4501879e6d32f6e0b7e6c.tar.bz2
Merge trunk
-rw-r--r--.travis.yml2
-rw-r--r--doc/grid.n2
-rw-r--r--generic/nanosvg.h19
-rw-r--r--generic/tkMenu.c5
-rw-r--r--library/demos/cscroll.tcl12
-rw-r--r--library/text.tcl7
-rw-r--r--macosx/tkMacOSXInit.c106
-rw-r--r--tests/imgSVGnano.test13
-rw-r--r--tests/menu.test8
-rwxr-xr-xunix/configure49
10 files changed, 148 insertions, 75 deletions
diff --git a/.travis.yml b/.travis.yml
index d1f6356..fa7f58a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ addons:
- gcc-mingw-w64-i686
- gcc-mingw-w64-x86-64
- gcc-multilib
- - tcl-dev
+ - tcl8.6-dev
- libx11-dev
- xvfb
homebrew:
diff --git a/doc/grid.n b/doc/grid.n
index 4fff2a8..004c71e 100644
--- a/doc/grid.n
+++ b/doc/grid.n
@@ -303,7 +303,7 @@ row or column, or the largest column or row with a \fB\-minsize\fR,
.TP
\fBgrid content fI\window\fR ?\fI\-option value\fR?
.
-If no options are supplied, a list of all of the content in \window\fR
+If no options are supplied, a list of all of the content in \fIwindow\fR
is returned, most recently managed first.
\fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which
causes only the content in the row (or column) specified by \fIvalue\fR
diff --git a/generic/nanosvg.h b/generic/nanosvg.h
index 7bb13d2..47a2c83 100644
--- a/generic/nanosvg.h
+++ b/generic/nanosvg.h
@@ -1670,25 +1670,32 @@ static int nsvg__parseRotate(float* xform, const char* str)
static void nsvg__parseTransform(float* xform, const char* str)
{
float t[6];
+ int len;
nsvg__xformIdentity(xform);
while (*str)
{
if (strncmp(str, "matrix", 6) == 0)
- str += nsvg__parseMatrix(t, str);
+ len = nsvg__parseMatrix(t, str);
else if (strncmp(str, "translate", 9) == 0)
- str += nsvg__parseTranslate(t, str);
+ len = nsvg__parseTranslate(t, str);
else if (strncmp(str, "scale", 5) == 0)
- str += nsvg__parseScale(t, str);
+ len = nsvg__parseScale(t, str);
else if (strncmp(str, "rotate", 6) == 0)
- str += nsvg__parseRotate(t, str);
+ len = nsvg__parseRotate(t, str);
else if (strncmp(str, "skewX", 5) == 0)
- str += nsvg__parseSkewX(t, str);
+ len = nsvg__parseSkewX(t, str);
else if (strncmp(str, "skewY", 5) == 0)
- str += nsvg__parseSkewY(t, str);
+ len = nsvg__parseSkewY(t, str);
else{
++str;
continue;
}
+ if (len != 0) {
+ str += len;
+ } else {
+ ++str;
+ continue;
+ }
nsvg__xformPremultiply(xform, t);
}
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 3b648ff..0a297a6 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -2128,7 +2128,8 @@ GetMenuIndex(
const char *string;
if (TkGetIntForIndex(objPtr, menuPtr->numEntries - 1, lastOK, indexPtr) == TCL_OK) {
- if (*indexPtr != TCL_INDEX_NONE) {
+ /* TCL_INDEX_NONE is only accepted if it does not result from a negative number */
+ if (*indexPtr != TCL_INDEX_NONE || Tcl_GetString(objPtr)[0] != '-') {
if (*indexPtr >= menuPtr->numEntries) {
*indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1);
}
@@ -2360,7 +2361,7 @@ MenuAddOrInsert(
}
if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad index \"%s\"", Tcl_GetString(indexPtr)));
+ "bad menu entry index \"%s\"", Tcl_GetString(indexPtr)));
Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL);
return TCL_ERROR;
}
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index 186ee48..52a9e1a 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -97,23 +97,23 @@ if {[package vsatisfies [package provide Tk] 8.7-]} {
# The following code ensure equal +/- behaviour.
bind $c <MouseWheel> {
if {%D >= 0} {
- %W yview scroll [expr {-%D/30}] units
+ %W yview scroll [expr {%D/-30}] units
} else {
- %W yview scroll [expr {(29-%D)/30}] units
+ %W yview scroll [expr {(%D-29)/-30}] units
}
}
bind $c <Option-MouseWheel> {
- %W yview scroll [expr {-(%D / 3)}] units
+ %W yview scroll [expr {%D/-3}] units
}
bind $c <Shift-MouseWheel> {
if {%D >= 0} {
- %W xview scroll [expr {-%D/30}] units
+ %W xview scroll [expr {%D/-30}] units
} else {
- %W xview scroll [expr {(29-%D)/30}] units
+ %W xview scroll [expr {(%D-29)/-30}] units
}
}
bind $c <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-(%D / 3)}] units
+ %W xview scroll [expr {%D/-3}] units
}
}
diff --git a/library/text.tcl b/library/text.tcl
index 7f56c0b..24dd6d2 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -522,12 +522,7 @@ proc ::tk::TextButton1 {w x y} {
} else {
$w mark gravity $anchorname left
}
- # Allow focus in any case on Windows, because that will let the
- # selection be displayed even for state disabled text widgets.
- if {[tk windowingsystem] eq "win32" \
- || [$w cget -state] eq "normal"} {
- focus $w
- }
+ focus $w
if {[$w cget -autoseparators]} {
$w edit separator
}
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 2601d6b..bda5f46 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -14,10 +14,9 @@
*/
#include "tkMacOSXPrivate.h"
-
-#include <sys/stat.h>
#include <dlfcn.h>
#include <objc/objc-auto.h>
+#include <sys/stat.h>
static char tkLibPath[PATH_MAX + 1] = "";
@@ -284,17 +283,20 @@ TkpInit(
if (!initialized) {
struct stat st;
+ Bool shouldOpenConsole = NO;
+ Bool stdinIsNullish = (!isatty(0) &&
+ (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)));
/*
* Initialize/check OS version variable for runtime checks.
*/
- initialized = 1;
-
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
# error Mac OS X 10.6 required
#endif
+ initialized = 1;
+
#ifdef TK_FRAMEWORK
/*
* When Tk is in a framework, force tcl_findLibrary to look in the
@@ -312,16 +314,6 @@ TkpInit(
#endif
/*
- * FIXME: Close stdin & stdout for remote debugging otherwise we will
- * fight with gdb for stdin & stdout
- */
-
- if (getenv("XCNOSTDIN") != NULL) {
- close(0);
- close(1);
- }
-
- /*
* Instantiate our NSApplication object. This needs to be done before
* we check whether to open a console window.
*/
@@ -376,48 +368,52 @@ TkpInit(
Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT);
/*
- * If we don't have a TTY or stdin is a special character file of
- * length 0, (e.g. /dev/null, which is what Finder sets when double
- * clicking Wish) then use the Tk based console interpreter.
+ * Decide whether to open a console window. If the TK_CONSOLE
+ * environment variable is not defined we only show the console if
+ * stdin is not a tty and there is no startup script.
*/
- if (!isatty(0) && (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0))) {
- if (getenv("TK_CONSOLE")) {
- Tk_InitConsoleChannels(interp);
- Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
- Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
- Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
-
- /*
- * Only show the console if we don't have a startup script and
- * tcl_interactive hasn't been set already.
- */
-
- if (Tcl_GetStartupScript(NULL) == NULL) {
- const char *intvar = Tcl_GetVar2(interp,
- "tcl_interactive", NULL, TCL_GLOBAL_ONLY);
-
- if (intvar == NULL) {
- Tcl_SetVar2(interp, "tcl_interactive", NULL, "1",
- TCL_GLOBAL_ONLY);
- }
- }
- if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
- } else {
-
- /*
- * When launched as a macOS application with no console,
- * redirect stderr and stdout to /dev/null. This avoids waiting
- * forever for those files to become writable if the underlying
- * Tcl program tries to write to them with a puts command.
- */
-
- FILE *null = fopen("/dev/null", "w");
- dup2(fileno(null), STDOUT_FILENO);
- dup2(fileno(null), STDERR_FILENO);
+ if (getenv("TK_CONSOLE")) {
+ shouldOpenConsole = YES;
+ } else if (stdinIsNullish && Tcl_GetStartupScript(NULL) == NULL) {
+ const char *intvar = Tcl_GetVar2(interp, "tcl_interactive",
+ NULL, TCL_GLOBAL_ONLY);
+ if (intvar == NULL) {
+ Tcl_SetVar2(interp, "tcl_interactive", NULL, "1",
+ TCL_GLOBAL_ONLY);
+ }
+ shouldOpenConsole = YES;
+ }
+ if (shouldOpenConsole) {
+ Tk_InitConsoleChannels(interp);
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
+ if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
+ return TCL_ERROR;
}
+ } else if (stdinIsNullish) {
+
+ /*
+ * When launched as a macOS application with no console,
+ * redirect stderr and stdout to /dev/null. This avoids waiting
+ * forever for those files to become writable if the underlying
+ * Tcl program tries to write to them with a puts command.
+ */
+
+ FILE *null = fopen("/dev/null", "w");
+ dup2(fileno(null), STDOUT_FILENO);
+ dup2(fileno(null), STDERR_FILENO);
+ }
+
+ /*
+ * FIXME: Close stdin & stdout for remote debugging if XCNOSTDIN is
+ * set. Otherwise we will fight with gdb for stdin & stdout
+ */
+
+ if (getenv("XCNOSTDIN") != NULL) {
+ close(0);
+ close(1);
}
/*
@@ -445,6 +441,10 @@ TkpInit(
}
}
+ /*
+ * Initialization steps that are needed for all interpreters.
+ */
+
if (tkLibPath[0] != '\0') {
Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
}
diff --git a/tests/imgSVGnano.test b/tests/imgSVGnano.test
index df827b2..3bee035 100644
--- a/tests/imgSVGnano.test
+++ b/tests/imgSVGnano.test
@@ -222,6 +222,19 @@ test imgSVGnano-5.0 {image without any of "width", "height" and "viewbox"} -bod
rename foo ""
} -result {foo}
+test imgSVGnano-5.1 {bug ea665e08f3 - too many values in parameters of the transform attribute} -body {
+ # shall not loop endlessly
+ image create photo foo -data\
+ {<?xml version="1.0"?><!DOCTYPE svg PUBLIC\
+ "-//W3C//DTD SVG 1.0//EN\"\
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\
+ <svg xmlns="http://www.w3.org/2000/svg">\
+ <circle cx="6.5cm" cy="2cm" r="100" transform="skewX(1 1)"/>\
+ </g></svg>}
+} -cleanup {
+ rename foo ""
+} -result {foo}
+
};# end of namespace svgnano
namespace delete svgnano
diff --git a/tests/menu.test b/tests/menu.test
index 03e0dab..55315bd 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -1858,6 +1858,14 @@ test menu-3.70 {MenuWidgetCmd procedure, "xposition" option} -setup {
} -cleanup {
destroy .m1
} -result {}
+test menu-3.71 {MenuWidgetCmd procedure, "index end" option, bug [f3cd942e9e]} -setup {
+ destroy .m1
+} -body {
+ menu .m1
+ list [.m1 index "end"]
+} -cleanup {
+ destroy .m1
+} -result none
test menu-4.1 {TkInvokeMenu: disabled} -setup {
diff --git a/unix/configure b/unix/configure
index 13c36a9..c535fe8 100755
--- a/unix/configure
+++ b/unix/configure
@@ -663,6 +663,9 @@ TK_MAJOR_VERSION
TK_VERSION
TK_DEMO_DIR
DEMO_DIR
+UNIX_LIBNOTIFY_OBJS
+LIBNOTIFY_LIBS
+LIBNOTIFY_CFLAGS
UNIX_FONT_OBJS
XFT_LIBS
XFT_CFLAGS
@@ -778,6 +781,7 @@ enable_symbols
enable_aqua
with_x
enable_xft
+enable_libnotify
enable_xss
enable_framework
'
@@ -1421,6 +1425,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-libnotify use libnotify (default: on)
--enable-xss use XScreenSaver for activity timer (default: on)
--enable-framework package shared libraries in MacOSX frameworks
(default: off)
@@ -7817,6 +7822,50 @@ $as_echo "#define HAVE_XFT 1" >>confdefs.h
fi
#--------------------------------------------------------------------
+# Check for libnotify.
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use libnotify" >&5
+$as_echo_n "checking whether to use libnotify... " >&6; }
+ # Check whether --enable-libnotify was given.
+if test "${enable_libnotify+set}" = set; then :
+ enableval=$enable_libnotify; enable_libnotify=$enableval
+else
+ enable_libfnotify="default"
+fi
+
+ LIBNOTIFY_CFLAGS=""
+ LIBNOTIFY_LIBS=""
+ if test "$enable_libnotify" = "no" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_libnotify" >&5
+$as_echo "$enable_libnotify" >&6; }
+ else
+ found_libnotify="yes"
+ LIBNOTIFY_CFLAGS=`pkg-config --cflags libnotify 2>/dev/null` || found_libnotify="no"
+ LIBNOTIFY_LIBS=`pkg-config --libs libnotify 2>/dev/null` || found_libnotify="no"
+ if test "$found_libnotify" = "no" ; then
+ found_libnotify=yes
+ LIBNOTIFY_CFLAGS=`pkg-config --cflags libnotify 2>/dev/null` || found_libnotify="no"
+ LIBNOTIFY_LIBS=`pkg-config --libs libnotify 2>/dev/null` || found_libnotify="no"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found_libnotify" >&5
+$as_echo "$found_libnotify" >&6; }
+ fi
+ if test $enable_libnotify = "yes" ; then
+ UNIX_LIBNOTIFY_OBJS=tkUnixSysNotify.o
+
+$as_echo "#define HAVE_LIBNOTIFY 1" >>confdefs.h
+
+ else
+ UNIX_LIBNOTIFY_OBJS=""
+ fi
+
+
+
+fi
+
+#--------------------------------------------------------------------
# XXX Do this last.
# It might modify XLIBSW which could affect other tests.
#