From f32cb454d68308c1ad941d43f3eaca29db6ada49 Mon Sep 17 00:00:00 2001 From: marc_culler Date: Sun, 11 Oct 2020 15:10:15 +0000 Subject: Fix [27fb5991be]: toplevel is not restored correctly after exiting fullscreen. --- macosx/tkMacOSXWindowEvent.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index ae5190f..ca7f526 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -970,14 +970,6 @@ ConfigureRestrictProc( TkWindow *winPtr = TkMacOSXGetTkWindow(w); Tk_Window tkwin = (Tk_Window)winPtr; - /* - * See ticket [1fa8c3ed8d]. This may not be needed for macOSX 11. - */ - - if(![NSApp isDrawing]) { - return; - } - if (![self inLiveResize] && [w respondsToSelector: @selector (tkLayoutChanged)]) { [(TKWindow *)w tkLayoutChanged]; @@ -1021,11 +1013,15 @@ ConfigureRestrictProc( TkMacOSXUpdateClipRgn(winPtr); /* - * Generate and process expose events to redraw the window. + * Generate and process expose events to redraw the window. To avoid + * crashes, only do this if we are being called from drawRect. See + * ticket [1fa8c3ed8d]. */ - [self generateExposeEvents: [self bounds]]; - + if([NSApp isDrawing] || [self inLiveResize]) { + [self generateExposeEvents: [self bounds]]; + } + /* * Finally, unlock the main autoreleasePool. */ -- cgit v0.12 From 9a1a8cdddc762590ba680992219159244f63d945 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 11 Oct 2020 16:40:39 +0000 Subject: 3 more select-* testcases which sometimes fail on Travis' Ubuntu environment Eliminate the use of TCL_CFGVAL_ENCODING, it isn't actually needed. Run all test-cases with system encoding set to "utf-8", so we get consistant behavior with or without TIP #587 --- tests/all.tcl | 3 ++- tests/select.test | 6 +++--- tests/ttk/all.tcl | 3 ++- unix/tkUnixRFont.c | 6 +----- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/all.tcl b/tests/all.tcl index 3b6b75f..46721a2 100644 --- a/tests/all.tcl +++ b/tests/all.tcl @@ -4,7 +4,7 @@ # tests. Execute it by invoking "source all.tcl" when running tktest # in this directory. # -# Copyright (c) 1998-1999 by Scriptics Corporation. +# Copyright © 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -17,4 +17,5 @@ tcltest::configure -loadfile \ [file join [tcltest::testsDirectory] constraints.tcl] tcltest::configure -singleproc 1 set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)] +encoding system utf-8 if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1} diff --git a/tests/select.test b/tests/select.test index c412fc0..31d6494 100644 --- a/tests/select.test +++ b/tests/select.test @@ -896,7 +896,7 @@ test select-9.1 {SelCvtToX and SelCvtFromX procedures} -setup { test select-9.2 {SelCvtToX and SelCvtFromX procedures} -setup { setup setupbg -} -constraints x11 -body { +} -constraints {x11 failsOnUbuntu} -body { set selValue "1024 0xffff 2048 -2 " set selInfo "" selection handle -selection PRIMARY -format INTEGER -type TEST \ @@ -1022,7 +1022,7 @@ test select-10.4 {ConvertSelection procedure} -constraints { lappend result $selInfo } -result {{selection owner didn't respond} {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000 STRING 0 4000 STRING 4000 4000}} test select-10.5 {ConvertSelection procedure, reentrancy issues} -constraints { - x11 + x11 failsOnUbuntu } -setup { setup setupbg @@ -1060,7 +1060,7 @@ test select-10.6 {ConvertSelection procedure, reentrancy issues} -constraints { ############################################################################## # testing reentrancy -test select-11.1 {TkSelPropProc procedure} -constraints x11 -setup { +test select-11.1 {TkSelPropProc procedure} -constraints {x11 failsOnUbuntu} -setup { setup setupbg } -body { diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl index a75172f..8a75ba7 100644 --- a/tests/ttk/all.tcl +++ b/tests/ttk/all.tcl @@ -4,7 +4,7 @@ # tests. Execute it by invoking "source all.tcl" when running tktest # in this directory. # -# Copyright (c) 2007 by the Tk developers. +# Copyright © 2007 by the Tk developers. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -17,4 +17,5 @@ tcltest::configure -loadfile \ [file join [file dirname [tcltest::testsDirectory]] constraints.tcl] tcltest::configure -singleproc 1 set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)] +encoding system utf-8 if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1} diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index f57eaa5..340b5a9 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -61,10 +61,6 @@ static Tcl_ThreadDataKey dataKey; * the TIP 59 configuration database. */ -#ifndef TCL_CFGVAL_ENCODING -#define TCL_CFGVAL_ENCODING "ascii" -#endif - static int utf8ToUcs4(const char *source, FcChar32 *c, int numBytes) { if (numBytes >= 6) { @@ -82,7 +78,7 @@ TkpFontPkgInit( { 0,0 } }; - Tcl_RegisterConfig(mainPtr->interp, "tk", cfg, TCL_CFGVAL_ENCODING); + Tcl_RegisterConfig(mainPtr->interp, "tk", cfg, "utf-8"); } static XftFont * -- cgit v0.12 From ad0d8ceeb439f7151ce2378527b87cf81e17d1bd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 13 Oct 2020 13:05:57 +0000 Subject: Protect ttk::spinbox::Spin against empty lsearch result. Discovered when running against Tcl's "empty-not-found" branch. Some formatting --- library/ttk/spinbox.tcl | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl index 33936d9..8aba5e1 100644 --- a/library/ttk/spinbox.tcl +++ b/library/ttk/spinbox.tcl @@ -32,7 +32,7 @@ proc ttk::spinbox::Motion {w x y} { variable State ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" - && [$w instate {!readonly !disabled}] + && [$w instate {!readonly !disabled}] } { ttk::setCursor $w text } else { @@ -46,16 +46,16 @@ proc ttk::spinbox::Press {w x y} { if {[$w instate disabled]} { return } focus $w switch -glob -- [$w identify $x $y] { - *textarea { ttk::entry::Press $w $x } + *textarea { ttk::entry::Press $w $x } *rightarrow - - *uparrow { ttk::Repeatedly event generate $w <> } + *uparrow { ttk::Repeatedly event generate $w <> } *leftarrow - - *downarrow { ttk::Repeatedly event generate $w <> } + *downarrow { ttk::Repeatedly event generate $w <> } *spinbutton { if {$y * 2 >= [winfo height $w]} { - set event <> + set event <> } else { - set event <> + set event <> } ttk::Repeatedly event generate $w $event } @@ -69,7 +69,7 @@ proc ttk::spinbox::DoubleClick {w x y} { if {[$w instate disabled]} { return } switch -glob -- [$w identify $x $y] { - *textarea { SelectAll $w } + *textarea { SelectAll $w } * { Press $w $x $y } } } @@ -140,25 +140,26 @@ proc ttk::spinbox::Spin {w dir} { if {[$w instate disabled]} { return } if {![info exists State($w,values.length)]} { - set State($w,values.index) -1 - set State($w,values.last) {} + set State($w,values.index) -1 + set State($w,values.last) {} } set State($w,values) [$w cget -values] set State($w,values.length) [llength $State($w,values)] if {$State($w,values.length) > 0} { - set value [$w get] - set current $State($w,values.index) - if {$value ne $State($w,values.last)} { - set current [lsearch -exact $State($w,values) $value] - } - set State($w,values.index) [Adjust $w [expr {$current + $dir}] 0 \ - [expr {$State($w,values.length) - 1}]] - set State($w,values.last) [lindex $State($w,values) $State($w,values.index)] - $w set $State($w,values.last) + set value [$w get] + set current $State($w,values.index) + if {$value ne $State($w,values.last)} { + set current [lsearch -exact $State($w,values) $value] + if {$current < 0} {set current -1} + } + set State($w,values.index) [Adjust $w [expr {$current + $dir}] 0 \ + [expr {$State($w,values.length) - 1}]] + set State($w,values.last) [lindex $State($w,values) $State($w,values.index)] + $w set $State($w,values.last) } else { - if {[catch { - set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}] + if {[catch { + set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}] }]} { set v [$w cget -from] } @@ -176,7 +177,7 @@ proc ttk::spinbox::FormatValue {w val} { if {$fmt eq ""} { # Try to guess a suitable -format based on -increment. set delta [expr {abs([$w cget -increment])}] - if {0 < $delta && $delta < 1} { + if {0 < $delta && $delta < 1} { # NB: This guesses wrong if -increment has more than 1 # significant digit itself, e.g., -increment 0.25 set nsd [expr {int(ceil(-log10($delta)))}] -- cgit v0.12