From 32a561c08576d3913b7d2b459739e58ee7d8f91a Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 2 Nov 2019 10:32:04 +0000 Subject: Fix [b3b56ae8dc]: ttk widgets overwrite user-set -cursor option. Case of the ttk::treeview. --- library/ttk/cursors.tcl | 9 +++++++-- library/ttk/treeview.tcl | 12 +++++++++++- tests/ttk/ttk.test | 13 +++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl index 75f7791..dacc494 100644 --- a/library/ttk/cursors.tcl +++ b/library/ttk/cursors.tcl @@ -140,8 +140,13 @@ proc ttk::cursor {name} { proc ttk::setCursor {w name} { variable Cursors - if {[$w cget -cursor] ne $Cursors($name)} { - $w configure -cursor $Cursors($name) + if {[info exists Cursors($name)]} { + set cursorname $Cursors($name) + } else { + set cursorname $name + } + if {[$w cget -cursor] ne $cursorname} { + $w configure -cursor $cursorname } } diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index df188b7..75ed9be 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -102,7 +102,17 @@ proc ttk::treeview::Keynav {w dir} { # Sets cursor, active element ... # proc ttk::treeview::Motion {w x y} { - set cursor {} + variable State + + if {![info exists State(userConfCursor)]} { + set State(userConfCursor) [$w cget -cursor] + } + # the user could have changed the configured cursor + if {[$w cget -cursor] ne [ttk::cursor hresize]} { + set State(userConfCursor) [$w cget -cursor] + } + + set cursor $State(userConfCursor) set activeHeading {} switch -- [$w identify region $x $y] { diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test index ed1c31c..aba3eba 100644 --- a/tests/ttk/ttk.test +++ b/tests/ttk/ttk.test @@ -507,6 +507,19 @@ test ttk-12.2 "-cursor option" -body { .b cget -cursor } -result arrow +test ttk-12.2.1 "-cursor option, widget doesn't overwrite it" -setup { + ttk::treeview .tr + pack .tr + update +} -body { + .tr configure -cursor X_cursor + event generate .tr + update + .tr cget -cursor +} -cleanup { + destroy .tr +} -result {X_cursor} + test ttk-12.3 "-borderwidth frame option" -body { destroy .t toplevel .t -- cgit v0.12 From 0e62c201c749c1c240f1c79f01ddbabf8a308d74 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 2 Nov 2019 13:51:28 +0000 Subject: Fix [b3b56ae8dc]: ttk widgets overwrite user-set -cursor option. Case of the ttk::combobox, ttk::spinbox and ttk::panedwindow. --- library/ttk/combobox.tcl | 10 +++++++++- library/ttk/panedwindow.tcl | 23 +++++++++++++++++++++-- library/ttk/spinbox.tcl | 10 +++++++++- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 1355a04..30a1599 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -149,12 +149,20 @@ proc ttk::combobox::Drag {w x} { # Set cursor. # proc ttk::combobox::Motion {w x y} { + variable State + if {![info exists State(userConfCursor)]} { + set State(userConfCursor) [$w cget -cursor] + } + # the user could have changed the configured cursor + if {[$w cget -cursor] ne [ttk::cursor text]} { + set State(userConfCursor) [$w cget -cursor] + } if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { ttk::setCursor $w text } else { - ttk::setCursor $w "" + ttk::setCursor $w $State(userConfCursor) } } diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index a2e073b..e23c506 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -62,13 +62,32 @@ proc ttk::panedwindow::Release {w x y} { # proc ttk::panedwindow::ResetCursor {w} { variable State + + if {![info exists State(userConfCursor)]} { + set State(userConfCursor) [$w cget -cursor] + } + # the user could have changed the configured cursor + if {[$w cget -cursor] ni [list [ttk::cursor hresize] [ttk::cursor vresize]]} { + set State(userConfCursor) [$w cget -cursor] + } + if {!$State(pressed)} { - ttk::setCursor $w {} + ttk::setCursor $w $State(userConfCursor) } } proc ttk::panedwindow::SetCursor {w x y} { - set cursor "" + variable State + + if {![info exists State(userConfCursor)]} { + set State(userConfCursor) [$w cget -cursor] + } + # the user could have changed the configured cursor + if {[$w cget -cursor] ni [list [ttk::cursor hresize] [ttk::cursor vresize]]} { + set State(userConfCursor) [$w cget -cursor] + } + + set cursor $State(userConfCursor) if {[llength [$w identify $x $y]]} { # Assume we're over a sash. switch -- [$w cget -orient] { diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl index 90a1572..b6ed126 100644 --- a/library/ttk/spinbox.tcl +++ b/library/ttk/spinbox.tcl @@ -29,12 +29,20 @@ ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W] # Sets cursor. # proc ttk::spinbox::Motion {w x y} { + variable State + if {![info exists State(userConfCursor)]} { + set State(userConfCursor) [$w cget -cursor] + } + # the user could have changed the configured cursor + if {[$w cget -cursor] ne [ttk::cursor text]} { + set State(userConfCursor) [$w cget -cursor] + } if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { ttk::setCursor $w text } else { - ttk::setCursor $w "" + ttk::setCursor $w $State(userConfCursor) } } -- cgit v0.12 From 5b8024c00ad7e34076fe6cfa5facb94dfebb6bcb Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 2 Nov 2019 14:28:16 +0000 Subject: Factorize common code into ttk::saveCursor --- library/ttk/combobox.tcl | 8 +------- library/ttk/cursors.tcl | 17 +++++++++++++++++ library/ttk/panedwindow.tcl | 18 ++++-------------- library/ttk/spinbox.tcl | 8 +------- library/ttk/treeview.tcl | 8 +------- 5 files changed, 24 insertions(+), 35 deletions(-) diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 30a1599..2770142 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -150,13 +150,7 @@ proc ttk::combobox::Drag {w x} { # proc ttk::combobox::Motion {w x y} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ne [ttk::cursor text]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl index dacc494..f1f9fa1 100644 --- a/library/ttk/cursors.tcl +++ b/library/ttk/cursors.tcl @@ -150,6 +150,23 @@ proc ttk::setCursor {w name} { } } +## ttk::saveCursor $w $saveVar $excludeList -- +# Set variable $saveVar to the -cursor value from widget $w, +# if either: +# a. $saveVar does not yet exist +# b. the currently user-specified cursor for $w is not in +# $excludeList + +proc ttk::saveCursor {w saveVar excludeList} { + upvar $saveVar sv + if {![info exists sv]} { + set sv [$w cget -cursor] + } + if {[$w cget -cursor] ni $excludeList} { + set sv [$w cget -cursor] + } +} + ## Interactive test harness: # proc ttk::CursorSampler {f} { diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index e23c506..ba47003 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -63,13 +63,8 @@ proc ttk::panedwindow::Release {w x y} { proc ttk::panedwindow::ResetCursor {w} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ni [list [ttk::cursor hresize] [ttk::cursor vresize]]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) \ + [list [ttk::cursor hresize] [ttk::cursor vresize]] if {!$State(pressed)} { ttk::setCursor $w $State(userConfCursor) @@ -79,13 +74,8 @@ proc ttk::panedwindow::ResetCursor {w} { proc ttk::panedwindow::SetCursor {w x y} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ni [list [ttk::cursor hresize] [ttk::cursor vresize]]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) \ + [list [ttk::cursor hresize] [ttk::cursor vresize]] set cursor $State(userConfCursor) if {[llength [$w identify $x $y]]} { diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl index b6ed126..9728755 100644 --- a/library/ttk/spinbox.tcl +++ b/library/ttk/spinbox.tcl @@ -30,13 +30,7 @@ ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W] # proc ttk::spinbox::Motion {w x y} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ne [ttk::cursor text]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index 75ed9be..81ba27e 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -104,13 +104,7 @@ proc ttk::treeview::Keynav {w dir} { proc ttk::treeview::Motion {w x y} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ne [ttk::cursor hresize]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) [ttk::cursor hresize] set cursor $State(userConfCursor) set activeHeading {} -- cgit v0.12 From 5c654e6af241121d283142dd9cc95c9130fcef19 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 8 Dec 2019 21:43:17 +0000 Subject: Fix [b094cb4aa9]: ttk::treeview steadily enlarges width when repeatedly configuring -show. See the ticket for a detailed explanation. --- win/ttkWinXPTheme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 1375bb6..d23d047 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1029,7 +1029,7 @@ static ElementInfo ElementInfoTable[] = { { "Menubutton.dropdown", &GenericElementSpec, L"TOOLBAR", TP_SPLITBUTTONDROPDOWN,toolbutton_statemap, NOPAD,0 }, { "Treeview.field", &GenericElementSpec, L"TREEVIEW", - TVP_TREEITEM, treeview_statemap, PAD(1, 1, 1, 1), 0 }, + TVP_TREEITEM, treeview_statemap, PAD(1, 1, 1, 1), IGNORE_THEMESIZE }, { "Treeitem.indicator", &TreeIndicatorElementSpec, L"TREEVIEW", TVP_GLYPH, tvpglyph_statemap, PAD(1,1,6,0), PAD_MARGINS }, { "Treeheading.border", &GenericElementSpec, L"HEADER", -- cgit v0.12 From ba899d2d6fecea1e6ac5870217b565d44a874722 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 10 Dec 2019 20:58:44 +0000 Subject: Fix [02a69449b5]: Wrong database names for tk::spinbox --- generic/tkEntry.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 161e581..4fa13fb 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -191,15 +191,15 @@ static const Tk_OptionSpec sbOptSpec[] = { NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0}, - {TK_OPTION_BORDER, "-buttonbackground", "Button.background", "Background", + {TK_OPTION_BORDER, "-buttonbackground", "buttonBackground", "Background", DEF_BUTTON_BG_COLOR, -1, Tk_Offset(Spinbox, buttonBorder), 0, DEF_BUTTON_BG_MONO, 0}, - {TK_OPTION_CURSOR, "-buttoncursor", "Button.cursor", "Cursor", + {TK_OPTION_CURSOR, "-buttoncursor", "buttonCursor", "Cursor", DEF_BUTTON_CURSOR, -1, Tk_Offset(Spinbox, bCursor), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_RELIEF, "-buttondownrelief", "Button.relief", "Relief", + {TK_OPTION_RELIEF, "-buttondownrelief", "buttonDownRelief", "Relief", DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, bdRelief), 0, 0, 0}, - {TK_OPTION_RELIEF, "-buttonuprelief", "Button.relief", "Relief", + {TK_OPTION_RELIEF, "-buttonuprelief", "buttonUpRelief", "Relief", DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, buRelief), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_SPINBOX_CMD, -1, Tk_Offset(Spinbox, command), -- cgit v0.12 From 04d138c167f126414371d8702a819cdb63ace694 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 16 Dec 2019 14:38:32 +0000 Subject: Sync tcl.m4 with version in Tcl --- win/configure | 15 ++++++++++++--- win/tcl.m4 | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/win/configure b/win/configure index 887c837..a1e742f 100755 --- a/win/configure +++ b/win/configure @@ -3469,14 +3469,14 @@ echo "${ECHO_T}$ac_cv_cross" >&6 if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" + CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; *) - CC="i686-w64-mingw32-gcc" + CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -3725,10 +3725,19 @@ echo "$as_me: error: ${CC} does not support the -shared option. CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wdeclaration-after-statement" + CFLAGS_WARNING="-Wall" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + ;; + esac + # Specify the CC output file names based on the target name CC_OBJNAME="-o \$@" CC_EXENAME="-o \$@" diff --git a/win/tcl.m4 b/win/tcl.m4 index 477b582..8cab825 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -583,14 +583,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" + CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; *) - CC="i686-w64-mingw32-gcc" + CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -727,10 +727,19 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wdeclaration-after-statement" + CFLAGS_WARNING="-Wall" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + ;; + esac + # Specify the CC output file names based on the target name CC_OBJNAME="-o \[$]@" CC_EXENAME="-o \[$]@" -- cgit v0.12