From 21e5079881531ebceefe721e59d840825dcbaa62 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 3 Dec 2020 08:28:20 +0000 Subject: 'grep -q "Failed' should be followed by single tab. Try to fix mingw-gcc build --- .github/workflows/mac-build.yml | 2 +- .github/workflows/win-build.yml | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index fb546a7..c06afce 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -102,7 +102,7 @@ jobs: echo "::error::Failure during Test" exit 1 } - cat out-classic.txt out-ttk.txt | grep -q "Failed[[:space:]][[:space:]]*[1-9]" && { + cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { echo "::error::Failure during Test" exit 1 } diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 504037d..317bfc9 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -60,7 +60,7 @@ jobs: echo "::error::Failure during Test" exit 1 } - cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { + cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { echo "::error::Failure during Test" exit 1 } @@ -141,15 +141,8 @@ jobs: } - name: Run Tests run: | - make test-classic | tee out-classic.txt || { + make test-classic | tee out-classic.txt || echo "::error::Failure during Test" + make test-ttk | tee out-ttk.txt || echo "::error::Failure during Test" + cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { echo "::error::Failure during Test" - exit 1 - } - make test-ttk | tee out-ttk.txt || { - echo "::error::Failure during Test" - exit 1 - } - cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { - echo "::error::Failure during Test" - exit 1 } -- cgit v0.12 From 7bbd536cdea0e0d4bcdef049f8bc2ff964fa3445 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 Dec 2020 09:31:57 +0000 Subject: Backport some "github actions" improvements from 8.6 --- .github/workflows/linux-build.yml | 16 ++++++---------- .github/workflows/win-build.yml | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index adb8d43..f9178e4 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -38,7 +38,6 @@ jobs: sudo apt-get install tcl8.5-dev libxss-dev mkdir "$HOME/install" touch tk/doc/man.macros tk/generic/tkStubInit.c - echo "TEST_INSTALL_DIR=$HOME/install" >> $GITHUB_ENV echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.5" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV @@ -50,7 +49,7 @@ jobs: OPTS: ${{ matrix.compiler }}-${{ matrix.symbols }}${{ matrix.disables }} - name: Configure (symbols=${{ matrix.symbols }} opts=${{ matrix.disables }}) run: | - ./configure $CFGOPT "--prefix=$TEST_INSTALL_DIR" || { + ./configure $CFGOPT "--prefix=$HOME/install" || { cat config.log echo "::error::Failure during Configure" exit 1 @@ -123,7 +122,6 @@ jobs: sudo apt-get install tcl8.5-dev libxss-dev xvfb mkdir "$HOME/install" touch tk/doc/man.macros tk/generic/tkStubInit.c - echo "TEST_INSTALL_DIR=$HOME/install" >> $GITHUB_ENV echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.5" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV working-directory: "." @@ -132,7 +130,7 @@ jobs: COMPILER: ${{ matrix.compiler }} - name: Configure (symbols=${{ matrix.symbols }}) run: | - ./configure $CFGOPT "--prefix=$TEST_INSTALL_DIR" || { + ./configure $CFGOPT "--prefix=$HOME/install" || { cat config.log echo "::error::Failure during Configure" exit 1 @@ -145,15 +143,13 @@ jobs: } - name: Run Tests run: | - xvfb-run --auto-servernum make test-classic | tee out-classic.txt || { + xvfb-run --auto-servernum make test-classic | tee out-classic.txt + xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt + grep -q "Failed 0" out-classic.txt || { echo "::error::Failure during Test" exit 1 } - xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt || { - echo "::error::Failure during Test" - exit 1 - } - cat out-classic.txt out-ttk.txt | grep -q "Failed 0" || { + grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 317bfc9..483d21b 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -60,7 +60,11 @@ jobs: echo "::error::Failure during Test" exit 1 } - cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { + grep -q "Failed 0" out-classic.txt || { + echo "::error::Failure during Test" + exit 1 + } + grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } @@ -141,8 +145,13 @@ jobs: } - name: Run Tests run: | - make test-classic | tee out-classic.txt || echo "::error::Failure during Test" - make test-ttk | tee out-ttk.txt || echo "::error::Failure during Test" - cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { + make test-classic | tee out-classic.txt + make test-ttk | tee out-ttk.txt + grep -q "Failed 0" out-classic.txt || { echo "::error::Failure during Test" + exit 1 + } + grep -q "Failed 0" out-ttk.txt || { + echo "::error::Failure during Test" + exit 1 } -- cgit v0.12 From 58588c714b254c02cfb6f20f808d935673b90cb1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 Dec 2020 10:07:45 +0000 Subject: Fix warnings seen on MS-VC6 PSDK 2003SP1: C:\test\tk8.6.11_rc0\win\..\win\tkWinFont.c(1500) : warning C4761: integral size mismatch in argument; conversion supplied --- win/tkWinFont.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 1e1403f..c7520a5 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -1495,7 +1495,7 @@ MultiFontTextOut( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); - familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y, + familyPtr->textOutProc(hdc, x-(double)(tm.tmOverhang/2), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); familyPtr->getTextExtentPoint32Proc(hdc, @@ -1517,7 +1517,7 @@ MultiFontTextOut( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); - familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y, + familyPtr->textOutProc(hdc, x-(double)(tm.tmOverhang/2), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); Tcl_DStringFree(&runString); -- cgit v0.12 From 0bb310366d8c74f3e467949ccd797bc7dadd7d0c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 Dec 2020 10:55:29 +0000 Subject: Better warning fix for Windows (slightly better rounding behavior) --- win/tkWinFont.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/tkWinFont.c b/win/tkWinFont.c index c7520a5..5eed32c 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -1495,7 +1495,7 @@ MultiFontTextOut( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); - familyPtr->textOutProc(hdc, x-(double)(tm.tmOverhang/2), y, + familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); familyPtr->getTextExtentPoint32Proc(hdc, @@ -1517,7 +1517,7 @@ MultiFontTextOut( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); - familyPtr->textOutProc(hdc, x-(double)(tm.tmOverhang/2), y, + familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); Tcl_DStringFree(&runString); -- cgit v0.12 From 063b218f2d7e9b7e05452b79c520f312da3b8490 Mon Sep 17 00:00:00 2001 From: marc_culler Date: Mon, 14 Dec 2020 23:50:14 +0000 Subject: Fix [80e4c6f695]: progress bars are weird on macOS 11.0. --- generic/ttk/ttkProgress.c | 9 +++++---- macosx/ttkMacOSXTheme.c | 27 ++++++++++++++------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index ae945ae..42da84d 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -102,7 +102,6 @@ static void AnimateProgressProc(ClientData clientData) Progressbar *pb = (Progressbar *)clientData; pb->progress.timer = 0; - if (AnimationEnabled(pb)) { int phase = 0; Tcl_GetIntFromObj(NULL, pb->progress.phaseObj, &phase); @@ -110,9 +109,11 @@ static void AnimateProgressProc(ClientData clientData) /* * Update -phase: */ + ++phase; - if (pb->progress.maxPhase) - phase %= pb->progress.maxPhase; + if (phase > pb->progress.maxPhase) { + phase = 0; + } Tcl_DecrRefCount(pb->progress.phaseObj); pb->progress.phaseObj = Tcl_NewIntObj(phase); Tcl_IncrRefCount(pb->progress.phaseObj); @@ -120,9 +121,9 @@ static void AnimateProgressProc(ClientData clientData) /* * Reschedule: */ + pb->progress.timer = Tcl_CreateTimerHandler( pb->progress.period, AnimateProgressProc, clientData); - TtkRedisplayWidget(&pb->core); } } diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 17982b6..37f84cd 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -2290,15 +2290,20 @@ static void PbarElementDraw( Ttk_State state) { PbarElement *pbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL, phase = 0; - double value = 0, maximum = 100, factor; + int orientation = TTK_ORIENT_HORIZONTAL, phase = 0, kind; + double value = 100, maximum = 100, factor = 1; CGRect bounds; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation); - Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); - Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum); - Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); - factor = RangeToFactor(maximum); + kind = !strcmp("indeterminate", Tcl_GetString(pbar->modeObj)) ? + kThemeIndeterminateBar : kThemeProgressBar; + if (kind == kThemeIndeterminateBar) { + Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); + } else { + Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); + Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum); + factor = RangeToFactor(maximum); + } /* * HIThemeTrackDrawInfo uses 2-byte alignment; assigning to a separate @@ -2308,19 +2313,15 @@ static void PbarElementDraw( bounds = BoxToRect(d, b); HIThemeTrackDrawInfo info = { .version = 0, - .kind = - (!strcmp("indeterminate", - Tcl_GetString(pbar->modeObj)) && value) ? - kThemeIndeterminateBar : kThemeProgressBar, + .kind = kind, .bounds = bounds, .min = 0, .max = maximum * factor, .value = value * factor, .attributes = kThemeTrackShowThumb | - (orientation == TTK_ORIENT_HORIZONTAL ? - kThemeTrackHorizontal : 0), + (orientation == TTK_ORIENT_HORIZONTAL ? kThemeTrackHorizontal : 0), .enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state), - .trackInfo.progress.phase = phase, + .trackInfo.progress.phase = phase }; BEGIN_DRAWING(d) -- cgit v0.12 From f5b9400c1c5f2c33f7955084a81435348792cd6b Mon Sep 17 00:00:00 2001 From: marc_culler Date: Tue, 15 Dec 2020 15:38:40 +0000 Subject: Fine tune the Big Sur behavior. --- library/ttk/aquaTheme.tcl | 2 +- macosx/ttkMacOSXTheme.c | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index 51c3e49..3ccdd70 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -99,7 +99,7 @@ namespace eval ttk::theme::aqua { } # Enable animation for ttk::progressbar widget: - ttk::style configure TProgressbar -period 100 -maxphase 255 + ttk::style configure TProgressbar -period 100 -maxphase 120 # For Aqua, labelframe labels should appear outside the border, # with a 14 pixel inset and 4 pixels spacing between border and label diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 37f84cd..a723408 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -2291,18 +2291,35 @@ static void PbarElementDraw( { PbarElement *pbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL, phase = 0, kind; - double value = 100, maximum = 100, factor = 1; + + /* + * Using 1000 as the maximum should give better than 1 pixel + * resolution for most progress bars. + */ + + int ivalue, imaximum = 1000; CGRect bounds; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation); kind = !strcmp("indeterminate", Tcl_GetString(pbar->modeObj)) ? - kThemeIndeterminateBar : kThemeProgressBar; + kThemeIndeterminateBar : kThemeProgressBar; if (kind == kThemeIndeterminateBar) { Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); + + /* + * On macOS 11 the fraction of an indeterminate progress bar which is + * traversed by the oscillating thumb is value / maximum. The phase + * determines the position of the moving thumb in that range and is + * apparently expected to vary between 0 and 120. On earlier systems + * it is unclear how the phase is used in generating the animation. + */ + + ivalue = imaximum; } else { + double value, maximum; Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum); - factor = RangeToFactor(maximum); + ivalue = (value / maximum)*1000; } /* @@ -2316,14 +2333,13 @@ static void PbarElementDraw( .kind = kind, .bounds = bounds, .min = 0, - .max = maximum * factor, - .value = value * factor, + .max = imaximum, + .value = ivalue, .attributes = kThemeTrackShowThumb | (orientation == TTK_ORIENT_HORIZONTAL ? kThemeTrackHorizontal : 0), .enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state), .trackInfo.progress.phase = phase }; - BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { bounds = BoxToRect(d, b); -- cgit v0.12