From 381d1e050c4e92292956bbcd87b46a7631a4b568 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 29 Sep 2020 21:15:34 +0000 Subject: Fix [0008d6a6b3]: Mouse pointer position reported in non-existing window --- generic/tkCmds.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 193c3d6..f782144 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1623,7 +1623,12 @@ Tk_WinfoObjCmd( } tkwin = Tk_CoordsToWindow(x, y, tkwin); if (tkwin != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin),-1)); + string = Tk_PathName(tkwin); + winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); + Tcl_ResetResult(interp); + if (winPtr && !(winPtr->flags & TK_ALREADY_DEAD)) { + Tcl_SetObjResult(interp, Tcl_NewStringObj(string, -1)); + } } break; case WIN_INTERPS: -- cgit v0.12 From e883cc84772de84b5cbb175808ecad82d5112a04 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Sep 2020 09:45:02 +0000 Subject: Fix safe-1.2 testcase when running Tcl version < 8.6.7 (That's when tcl:encoding:dirs became hidden) --- tests/safe.test | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/safe.test b/tests/safe.test index 5a2cd26..3a3b029 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -35,7 +35,10 @@ namespace import -force tcltest::test set hidden_cmds [list bell cd clipboard encoding exec exit \ fconfigure glob grab load menu open pwd selection \ - socket source tcl:encoding:dirs toplevel unload wm] + socket source toplevel unload wm] +if {[package vsatisfies [package provide Tcl] 8.6.7-]} { + lappend hidden_cmds tcl:encoding:dirs +} if {[package vsatisfies [package provide Tcl] 8.7-]} { lappend hidden_cmds file tcl:encoding:system tcl:file:tempdir foreach cmd { -- cgit v0.12 From 2cfcf649ca494a8a1a8b733fa9fbe9b033d7dfdd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Sep 2020 10:30:45 +0000 Subject: Mark 10 testcases with failsOnUbuntuNoXft. They fail on Ubuntu if Tk is compiled with --disable-xft --- tests/entry.test | 5 +- tests/font.test | 433 +++++++++++++++++++++++++------------------------ tests/fontchooser.test | 5 +- tests/spinbox.test | 5 +- tests/textTag.test | 7 +- tests/unixFont.test | 3 +- 6 files changed, 236 insertions(+), 222 deletions(-) diff --git a/tests/entry.test b/tests/entry.test index 0146dbf..f1d61b2 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -11,6 +11,9 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] + # For xscrollcommand set scrollInfo {} proc scroll args { @@ -2311,7 +2314,7 @@ test entry-8.17 {DeleteChars procedure} -setup { } -cleanup { destroy .e } -result 4 -test entry-8.18 {DeleteChars procedure} -setup { +test entry-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup { entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e diff --git a/tests/font.test b/tests/font.test index 352139a..0f4c8de 100644 --- a/tests/font.test +++ b/tests/font.test @@ -15,6 +15,7 @@ tcltest::loadTestedCommands testConstraint fullutf [expr {[format %c 0x010000] != "\uFFFD"}] testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] set defaultfontlist [font names] @@ -62,9 +63,9 @@ test font-1.1 {TkFontPkgInit} -setup { } -body { interp create foo foo eval { - load {} Tk - wm geometry . +0+0 - update + load {} Tk + wm geometry . +0+0 + update } interp delete foo } -result {} @@ -78,25 +79,25 @@ test font-2.1 {TkFontPkgFree} -setup { # Makes sure that named font was visible only to child interp. foo eval { - load {} Tk - wm geometry . +0+0 - button .b -font {times 16} -text "hi" - pack .b - font create wiggles -family courier -underline 1 - update + load {} Tk + wm geometry . +0+0 + button .b -font {times 16} -text "hi" + pack .b + font create wiggles -family courier -underline 1 + update } lappend x [catch {font configure wiggles} msg; set msg] # Tests cancelling the idle handler for TheWorldHasChanged, # because app goes away before idle serviced. foo eval { - .b config -font wiggles - font config wiggles -size 24 - destroy . + .b config -font wiggles + font config wiggles -size 24 + destroy . } lappend x [foo eval {catch {font families} msg; set msg}] } -cleanup { - interp delete foo + interp delete foo } -result {{named font "wiggles" doesn't exist} {can't invoke "font" command: application has been destroyed}} @@ -195,7 +196,7 @@ test font-5.4 {font command: configure: get all options} -setup { font create xyz -family xyz lindex [font configure xyz] 1 } -cleanup { - font delete xyz + font delete xyz } -result xyz test font-5.5 {font command: configure: get one option} -setup { clearnondefaultfonts @@ -203,9 +204,9 @@ test font-5.5 {font command: configure: get one option} -setup { # (objc == 4) so objPtr = objv[3] font create xyz -family xyz font configure xyz -family - getnondefaultfonts + getnondefaultfonts } -cleanup { - font delete xyz + font delete xyz } -result xyz test font-5.6 {font command: configure: update existing font} -setup { catch {font delete xyz} @@ -216,7 +217,7 @@ test font-5.6 {font command: configure: update existing font} -setup { update font configure xyz -family } -cleanup { - font delete xyz + font delete xyz } -result xyz test font-5.7 {font command: configure: bad option} -setup { catch {font delete xyz} @@ -224,7 +225,7 @@ test font-5.7 {font command: configure: bad option} -setup { font create xyz font configure xyz -style } -cleanup { - font delete xyz + font delete xyz } -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike} @@ -244,7 +245,7 @@ test font-6.2 {font command: create: name specified} -setup { font create xyz getnondefaultfonts } -cleanup { - font delete xyz + font delete xyz } -result {xyz} test font-6.3 {font command: create: name not really specified} -setup { clearnondefaultfonts @@ -286,7 +287,7 @@ test font-6.7 {font command: create: already exists} -setup { font create xyz font create xyz } -cleanup { - font delete xyz + font delete xyz } -returnCodes error -result {named font "xyz" already exists} test font-7.1 {font command: delete: arguments} -body { @@ -295,7 +296,7 @@ test font-7.1 {font command: delete: arguments} -body { } -returnCodes error -result {wrong # args: should be "font delete fontname ?fontname ...?"} test font-7.2 {font command: delete: loop test} -setup { clearnondefaultfonts - set x {} + set x {} } -body { # for (i = 2; i < objc; i++) font create a -underline 1 @@ -311,7 +312,7 @@ test font-7.2 {font command: delete: loop test} -setup { } -result {{a b c d e} d} test font-7.3 {font command: delete: loop test} -setup { clearnondefaultfonts - set x {} + set x {} } -body { # (namedHashPtr == NULL) in middle of loop font create a -underline 1 @@ -344,7 +345,7 @@ test font-7.5 {font command: delete: mark for later deletion} -setup { font actual xyz font configure xyz } -cleanup { - destroy .t.f + destroy .t.f } -returnCodes error -result {named font "xyz" doesn't exist} test font-7.6 {font command: delete: mark for later deletion} -setup { destroy .t.f @@ -358,7 +359,7 @@ test font-7.6 {font command: delete: mark for later deletion} -setup { font delete xyz font actual xyz catch {font configure xyz} - .t.f cget -font + .t.f cget -font } -cleanup { destroy .t.f } -result xyz @@ -516,7 +517,7 @@ test font-12.1 {UpdateDependantFonts procedure: no users} -setup { font create xyz font configure xyz -family times } -cleanup { - font delete xyz + font delete xyz } -result {} test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup { destroy .t.f @@ -535,21 +536,21 @@ test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup { set b2 [winfo reqwidth .t.f] expr {$a1==$b1 && $a2==$b2} } -cleanup { - destroy .t.f + destroy .t.f font delete xyz } -result {1} test font-13.1 {CreateNamedFont: new named font} -setup { catch {font delete xyz} - set x {} + set x {} } -body { # not (new == 0) lappend x [getnondefaultfonts] font create xyz lappend x [getnondefaultfonts] } -cleanup { - font delete xyz + font delete xyz } -result {{} xyz} test font-13.2 {CreateNamedFont: named font already exists} -setup { catch {font delete xyz} @@ -558,7 +559,7 @@ test font-13.2 {CreateNamedFont: named font already exists} -setup { font create xyz font create xyz } -cleanup { - font delete xyz + font delete xyz } -returnCodes error -result {named font "xyz" already exists} test font-13.3 {CreateNamedFont: named font already exists} -setup { catch {font delete xyz} @@ -567,7 +568,7 @@ test font-13.3 {CreateNamedFont: named font already exists} -setup { font create xyz font create xyz } -cleanup { - font delete xyz + font delete xyz } -returnCodes error -result {named font "xyz" already exists} test font-13.4 {CreateNamedFont: recreate "deleted" font} -setup { destroy .t.f @@ -582,8 +583,8 @@ test font-13.4 {CreateNamedFont: recreate "deleted" font} -setup { font create xyz -family courier font configure xyz -family } -cleanup { - font delete xyz - destroy .t.f + font delete xyz + destroy .t.f } -result {courier} @@ -592,7 +593,7 @@ test font-14.1 {Tk_GetFont procedure} -body { test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints { - testfont + testfont } -setup { destroy .b1 .b2 } -body { @@ -605,7 +606,7 @@ test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints { destroy .b1 .b2 } -result {{1 0}} test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints { - testfont + testfont } -setup { destroy .b1 .b2 set result {} @@ -620,7 +621,7 @@ test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints { destroy .b2 } -result {{} {{1 1}}} test font-15.3 {Tk_AllocFontFromObj - reuse existing font} -constraints { - testfont + testfont } -setup { destroy .b1 .b2 set result {} @@ -643,7 +644,7 @@ test font-15.4 {Tk_AllocFontFromObj procedure: bump ref count} -setup { .t.f config -font {-family fixed} lindex [font actual {-family fixed}] 0 } -cleanup { - destroy .t.f + destroy .t.f } -result {-family} test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup { destroy .t.f @@ -655,7 +656,7 @@ test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup { font create xyz .t.f config -font xyz } -cleanup { - destroy .t.f + destroy .t.f font delete xyz } -result {} test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} -setup { @@ -666,7 +667,7 @@ test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} -setup { # not (namedHashPtr != NULL) .t.f config -font {times 20} } -cleanup { - destroy .t.f + destroy .t.f } -result {-family} -result {} test font-15.7 {Tk_AllocFontFromObj procedure: get native font} -constraints { unix @@ -710,7 +711,7 @@ test font-15.11 {Tk_AllocFontFromObj procedure: get attribute font} -body { lindex [font actual {plan 9}] 0 } -result {-family} test font-15.12 {Tk_AllocFontFromObj procedure: setup tab width} -setup { - destroy .l + destroy .l } -body { # Tk_MeasureChars(fontPtr, "0", ...) label .l -bd 0 -padx 0 -highlightthickness 0 -font $fixed -text "a\tb" @@ -719,7 +720,7 @@ test font-15.12 {Tk_AllocFontFromObj procedure: setup tab width} -setup { set res2 [expr [font measure $fixed "0"]*9] expr {$res1 eq $res2} } -cleanup { - destroy .l + destroy .l } -result 1 test font-15.13 {Tk_AllocFontFromObj procedure: underline position} -setup { destroy .t.f @@ -730,7 +731,7 @@ test font-15.13 {Tk_AllocFontFromObj procedure: underline position} -setup { .t.f config -text "underline" -font "times -8 underline" update } -cleanup { - destroy .t.f + destroy .t.f } -result {} @@ -742,7 +743,7 @@ test font-16.1 {Tk_NameOfFont procedure} -setup { .t.f config -font -family\ fixed .t.f cget -font } -cleanup { - destroy .t.f + destroy .t.f } -result {-family fixed} @@ -1450,20 +1451,20 @@ test font-21.66 {Tk_PostscriptFontName procedure: exhaustive} -constraints { test font-22.1 {Tk_TextWidth procedure} -setup { - destroy .t.l + destroy .t.l } -body { - label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ - -text "0" -font "Courier -12" - pack .t.l - set ax [winfo reqwidth .t.l] + label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ + -text "0" -font "Courier -12" + pack .t.l + set ax [winfo reqwidth .t.l] expr {[font measure [.t.l cget -font] "000"] eq $ax*3} } -cleanup { - destroy .t.l + destroy .t.l } -result 1 test font-23.1 {Tk_UnderlineChars procedure} -setup { - destroy .t.t + destroy .t.t } -body { text .t.t .t.t insert 1.0 abc\tdefg @@ -1471,7 +1472,7 @@ test font-23.1 {Tk_UnderlineChars procedure} -setup { .t.t tag add sel 1.0 end update } -cleanup { - destroy .t.t + destroy .t.t } -result {} @@ -1488,27 +1489,27 @@ test font-24.1 {Tk_ComputeTextLayout: empty string} -body { } -result {} test font-24.2 {Tk_ComputeTextLayout: simple string} -body { .t.l config -text "000" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ - [expr {[winfo reqheight .t.l] eq $ay}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ + [expr {[winfo reqheight .t.l] eq $ay}] } -result {1 1} test font-24.3 {Tk_ComputeTextLayout: find special chars} -body { .t.l config -text "000\n000" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] } -result {1 1} test font-24.4 {Tk_ComputeTextLayout: calls Tk_MeasureChars} -body { .t.l config -text "000\n000" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] } -result {1 1} test font-24.5 {Tk_ComputeTextLayout: break line} -body { .t.l config -text "000\t00000" -wrap [expr 9 * $ax] - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] } -cleanup { .t.l config -wrap 0 } -result {1 1} @@ -1517,26 +1518,26 @@ test font-24.6 {Tk_ComputeTextLayout: normal ended on special char} -body { } -result {} test font-24.7 {Tk_ComputeTextLayout: special char was \n} -body { .t.l config -text "000\n0000" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] } -result {1 1} test font-24.8 {Tk_ComputeTextLayout: special char was \t} -body { .t.l config -text "000\t00" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] \ - [expr {[winfo reqheight .t.l] eq $ay}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] \ + [expr {[winfo reqheight .t.l] eq $ay}] } -result {1 1} test font-24.9 {Tk_ComputeTextLayout: tab didn't cause break} -body { set x {} .t.l config -text "000\t000" - update + update lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 11}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] .t.l config -text "000\t000" -wrap [expr 100 * $ax] - update + update lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 11}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] return $x } -cleanup { .t.l config -wrap 0 @@ -1544,13 +1545,13 @@ test font-24.9 {Tk_ComputeTextLayout: tab didn't cause break} -body { test font-24.10 {Tk_ComputeTextLayout: tab caused break} -body { set x {} .t.l config -text "000\t" - update + update lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] .t.l config -text "000\t00" -wrap [expr $ax * 6] - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] return $x } -cleanup { .t.l config -wrap 0 @@ -1558,13 +1559,13 @@ test font-24.10 {Tk_ComputeTextLayout: tab caused break} -body { test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} -body { set x {} .t.l config -text "000 000" -wrap [expr {$ax * 5}] - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] .t.l config -text "000 " - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] return $x } -cleanup { .t.l config -wrap 0 @@ -1572,44 +1573,44 @@ test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} -body { test font-24.12 {Tk_ComputeTextLayout: append non-printing spaces to chunk} -body { set x {} .t.l config -text "000 0000" -wrap [expr {$ax * 5}] - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] .t.l config -text "000\t00 0000" -wrap [expr {$ax * 12}] - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] return $x } -cleanup { .t.l config -wrap 0 } -result {1 1 1 1} test font-24.13 {Tk_ComputeTextLayout: many lines -> realloc line array} -body { .t.l config -text "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" - update - list [expr {[winfo reqwidth .t.l] eq 1}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 129}]}] + update + list [expr {[winfo reqwidth .t.l] eq 1}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 129}]}] } -result {1 1} test font-24.14 {Tk_ComputeTextLayout: text ended with \n} -body { set x {} - .t.l config -text "0000" - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] - .t.l config -text "0000\n" - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] - return $x + .t.l config -text "0000" + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] + .t.l config -text "0000\n" + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + set x } -result {1 1 1 1} destroy .t.l test font-24.15 {Tk_ComputeTextLayout: justification} -setup { set x {} - destroy .t.c - canvas .t.c -closeenough 0 - .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" - pack .t.c - update + destroy .t.c + canvas .t.c -closeenough 0 + .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" + pack .t.c + update } -body { csetup "000\n00000" .t.c itemconfig text -just left @@ -1621,7 +1622,7 @@ test font-24.15 {Tk_ComputeTextLayout: justification} -setup { .t.c itemconfig text -just left return $x } -cleanup { - destroy .t.c + destroy .t.c } -result {2 1 0} @@ -1633,7 +1634,7 @@ test font-25.1 {Tk_FreeTextLayout procedure} -setup { .t.f config -text foo .t.f config -text boo } -cleanup { - destroy .t.f + destroy .t.f } -result {} @@ -1650,7 +1651,7 @@ test font-26.1 {Tk_DrawTextLayout procedure: auto-detect last char} -setup { } -body { .t.f config -text foo } -cleanup { - destroy .t.f + destroy .t.f } -result {} test font-26.2 {Tk_DrawTextLayout procedure: multiple chunks} -body { csetup "000\t00\n000" @@ -1795,110 +1796,110 @@ pack .t.c update test font-30.1 {Tk_DistanceToTextLayout procedure: loop once} -body { csetup "000\n000\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x 0 -y 0 return $x } -cleanup { - bind all {} + bind all {} } -result {0} test font-30.2 {Tk_DistanceToTextLayout procedure: loop multiple} -body { csetup "000\n000\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x $ax -y $ay return $x } -cleanup { - bind all {} + bind all {} } -result {5} test font-30.3 {Tk_DistanceToTextLayout procedure: loop to end} -body { csetup "000\n0\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x [expr $ax*2] -y $ay return $x } -cleanup { - bind all {} + bind all {} } -result {} test font-30.4 {Tk_DistanceToTextLayout procedure: hit a special char (tab)} -body { csetup "000\t000\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x [expr $ax*6] -y 0 return $x } -cleanup { - bind all {} + bind all {} } -result {3} test font-30.5 {Tk_DistanceToTextLayout procedure: ignore newline} -body { csetup "000\n0\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x [expr $ax*2] -y $ay return $x } -cleanup { - bind all {} + bind all {} } -result {} test font-30.6 {Tk_DistanceToTextLayout procedure: ignore spaces at eol} -body { csetup "000\n000 000000000" .t.c itemconfig text -width [expr $ax*10] - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x [expr $ax*5] -y $ay .t.c itemconfig text -width 0 return $x } -cleanup { - bind all {} + bind all {} } -result {} .t.c itemconfig text -justify center test font-30.7 {Tk_DistanceToTextLayout procedure: on left side} -body { csetup "0\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x 0 -y 0 return $x } -cleanup { - bind all {} + bind all {} } -result {} test font-30.8 {Tk_DistanceToTextLayout procedure: on right side} -body { csetup "0\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x [expr $ax*2] -y 0 return $x } -cleanup { - bind all {} + bind all {} } -result {} test font-30.9 {Tk_DistanceToTextLayout procedure: inside line} -body { csetup "0\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x $ax -y 0 return $x } -cleanup { - bind all {} + bind all {} } -result {0} test font-30.10 {Tk_DistanceToTextLayout procedure: above line} -body { csetup "0\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x 0 -y 0 return $x } -cleanup { - bind all {} + bind all {} } -result {} test font-30.11 {Tk_DistanceToTextLayout procedure: below line} -body { csetup "000\n0" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x 0 -y $ay @@ -1908,7 +1909,7 @@ test font-30.11 {Tk_DistanceToTextLayout procedure: below line} -body { } -result {} test font-30.12 {Tk_DistanceToTextLayout procedure: in line} -body { csetup "0\n000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x $ax -y $ay @@ -1919,13 +1920,13 @@ test font-30.12 {Tk_DistanceToTextLayout procedure: in line} -body { .t.c itemconfig text -justify left test font-30.13 {Tk_DistanceToTextLayout procedure: exact hit} -body { csetup "000" - .t.c bind all {lappend x [.t.c index current @%x,%y]} + .t.c bind all {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c event generate .t.c -x $ax -y 0 return $x } -cleanup { - bind all {} + bind all {} } -result {1} destroy .t.c @@ -1977,11 +1978,11 @@ destroy .t.c test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setup { - destroy .t.c - canvas .t.c -closeenough 0 - .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" - pack .t.c - update + destroy .t.c + canvas .t.c -closeenough 0 + .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" + pack .t.c + update } -body { # If there were a whole bunch of returns or tabs in a row, then the # temporary buffer could overflow and write on the stack. @@ -1994,7 +1995,7 @@ test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setu set i [string first "(qwerty" $x] string range $x $i [expr {$i + 278}] } -cleanup { - destroy .t.c + destroy .t.c } -result {(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)] [(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)] [()] @@ -2052,85 +2053,85 @@ test font-34.2 {ConfigAttributesObj procedure: arguments} -setup { test font-34.3 {ConfigAttributesObj procedure: family} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -family xyz - lappend x [font config xyz -family] - font config xyz -family times - lappend x [font config xyz -family] + font create xyz -family xyz + lappend x [font config xyz -family] + font config xyz -family times + lappend x [font config xyz -family] } -cleanup { font delete xyz } -result {xyz times} test font-34.4 {ConfigAttributesObj procedure: size} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -size 20 - lappend x [font config xyz -size] - font config xyz -size 40 - lappend x [font config xyz -size] + font create xyz -size 20 + lappend x [font config xyz -size] + font config xyz -size 40 + lappend x [font config xyz -size] } -cleanup { - font delete xyz + font delete xyz } -result {20 40} test font-34.5 {ConfigAttributesObj procedure: weight} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -weight normal - lappend x [font config xyz -weight] - font config xyz -weight bold - lappend x [font config xyz -weight] + font create xyz -weight normal + lappend x [font config xyz -weight] + font config xyz -weight bold + lappend x [font config xyz -weight] } -cleanup { - font delete xyz + font delete xyz } -result {normal bold} test font-34.6 {ConfigAttributesObj procedure: slant} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -slant roman - lappend x [font config xyz -slant] - font config xyz -slant italic - lappend x [font config xyz -slant] + font create xyz -slant roman + lappend x [font config xyz -slant] + font config xyz -slant italic + lappend x [font config xyz -slant] } -cleanup { - font delete xyz + font delete xyz } -result {roman italic} test font-34.7 {ConfigAttributesObj procedure: underline} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -underline 0 - lappend x [font config xyz -underline] - font config xyz -underline 1 - lappend x [font config xyz -underline] + font create xyz -underline 0 + lappend x [font config xyz -underline] + font config xyz -underline 1 + lappend x [font config xyz -underline] } -cleanup { - font delete xyz + font delete xyz } -result {0 1} test font-34.8 {ConfigAttributesObj procedure: overstrike} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -overstrike 0 - lappend x [font config xyz -overstrike] - font config xyz -overstrike 1 - lappend x [font config xyz -overstrike] + font create xyz -overstrike 0 + lappend x [font config xyz -overstrike] + font config xyz -overstrike 1 + lappend x [font config xyz -overstrike] } -cleanup { - font delete xyz + font delete xyz } -result {0 1} test font-34.9 {ConfigAttributesObj procedure: size} -body { - font create xyz -size xyz + font create xyz -size xyz } -returnCodes error -result {expected integer but got "xyz"} test font-34.10 {ConfigAttributesObj procedure: weight} -body { - font create xyz -weight xyz + font create xyz -weight xyz } -returnCodes error -result {bad -weight value "xyz": must be normal, or bold} test font-34.11 {ConfigAttributesObj procedure: slant} -body { - font create xyz -slant xyz + font create xyz -slant xyz } -returnCodes error -result {bad -slant value "xyz": must be roman, or italic} test font-34.12 {ConfigAttributesObj procedure: underline} -body { - font create xyz -underline xyz + font create xyz -underline xyz } -returnCodes error -result {expected boolean value but got "xyz"} test font-34.13 {ConfigAttributesObj procedure: overstrike} -body { - font create xyz -overstrike xyz + font create xyz -overstrike xyz } -returnCodes error -result {expected boolean value but got "xyz"} @@ -2141,7 +2142,7 @@ test font-35.1 {GetAttributeInfoObj procedure: one attribute} -setup { font create xyz -family xyz font config xyz -family } -cleanup { - font delete xyz + font delete xyz } -result {xyz} @@ -2152,7 +2153,7 @@ test font-36.1 {GetAttributeInfoObj procedure: unknown attribute} -setup { font create xyz font config xyz -xyz } -cleanup { - font delete xyz + font delete xyz } -returnCodes { error } -result {bad option "-xyz": must be -family, -size, -weight, -slant, -underline, or -overstrike} @@ -2165,60 +2166,60 @@ test font-37.1 {GetAttributeInfoObj procedure: all attributes} -setup { font create xyz -family xyz font config xyz } -cleanup { - font delete xyz + font delete xyz } -result {-family xyz -size 0 -weight normal -slant roman -underline 0 -overstrike 0} test font-37.2 {GetAttributeInfo procedure: family} -setup { catch {font delete xyz} } -body { - font create xyz -family xyz - font config xyz -family + font create xyz -family xyz + font config xyz -family } -cleanup { - font delete xyz + font delete xyz } -result {xyz} test font-37.3 {GetAttributeInfo procedure: size} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -size 20 - font config xyz -size + font create xyz -size 20 + font config xyz -size } -cleanup { - font delete xyz + font delete xyz } -result {20} test font-37.4 {GetAttributeInfo procedure: weight} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -weight normal - font config xyz -weight + font create xyz -weight normal + font config xyz -weight } -cleanup { - font delete xyz + font delete xyz } -result {normal} test font-37.5 {GetAttributeInfo procedure: slant} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -slant italic - font config xyz -slant + font create xyz -slant italic + font config xyz -slant } -cleanup { - font delete xyz + font delete xyz } -result {italic} test font-37.6 {GetAttributeInfo procedure: underline} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -underline yes - font config xyz -underline + font create xyz -underline yes + font config xyz -underline } -cleanup { - font delete xyz + font delete xyz } -result {1} test font-37.7 {GetAttributeInfo procedure: overstrike} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -overstrike no - font config xyz -overstrike + font create xyz -overstrike no + font config xyz -overstrike } -cleanup { - font delete xyz + font delete xyz } -result {0} @@ -2257,7 +2258,7 @@ test font-38.10 {ParseFontNameObj procedure: arguments} -body { font actual {times xyz xyz} } -returnCodes error -result {expected integer but got "xyz"} test font-38.11 {ParseFontNameObj procedure: stylelist loop} -constraints { - unixOrWin + unixOrWin failsOnUbuntuNoXft } -body { lrange [font actual {times 12 bold italic overstrike underline}] 4 end } -result {-weight bold -slant italic -underline 1 -overstrike 1} @@ -2339,21 +2340,21 @@ test font-43.1 {FieldSpecified procedure: specified vs. non-specified} -body { } -result [font actual {times 0} -family] -test font-44.1 {TkFontGetPixels: size < 0} -setup { - set oldscale [tk scaling] +test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntuNoXft -setup { + set oldscale [tk scaling] } -body { - tk scaling 0.5 + tk scaling 0.5 font actual {times -12} -size } -cleanup { - tk scaling $oldscale + tk scaling $oldscale } -result {24} -test font-44.2 {TkFontGetPoints: size >= 0} -constraints noExceed -setup { - set oldscale [tk scaling] +test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed failsOnUbuntuNoXft} -setup { + set oldscale [tk scaling] } -body { - tk scaling 0.5 + tk scaling 0.5 font actual {times 12} -size } -cleanup { - tk scaling $oldscale + tk scaling $oldscale } -result {12} @@ -2375,12 +2376,12 @@ test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed} -body { test font-46.1 {font actual, with character, no option, no --} -body { - font actual {times 10} a + font actual {times 10} a } -match glob -result [list -family [font actual {times 10} -family] -size *\ -slant roman -underline 0 -overstrike 0] test font-46.2 {font actual, with character introduced by --} -body { - font actual {times 10} -- - + font actual {times 10} -- - } -match glob -result [list -family [font actual {times 10} -family] -size *\ -slant roman -underline 0 -overstrike 0] diff --git a/tests/fontchooser.test b/tests/fontchooser.test index 3fbc01f..0efe619 100644 --- a/tests/fontchooser.test +++ b/tests/fontchooser.test @@ -6,6 +6,9 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] + # the following helper functions are related to the functions used # in winDialog.test where they are used to send messages to the win32 # dialog (hence the wierdness). @@ -179,7 +182,7 @@ test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body { expr {$::testfont ne {}} } -result {1} -test fontchooser-4.4 {fontchooser -font} -constraints scriptImpl -body { +test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl failsOnUbuntuNoXft} -body { start { tk::fontchooser::Configure -command ApplyFont -font {times 14 bold} tk::fontchooser::Show diff --git a/tests/spinbox.test b/tests/spinbox.test index 8d19a7e..4cc1238 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -11,6 +11,9 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] + # For xscrollcommand set scrollInfo {} proc scroll args { @@ -2603,7 +2606,7 @@ test spinbox-8.17 {DeleteChars procedure} -setup { } -cleanup { destroy .e } -result 4 -test spinbox-8.18 {DeleteChars procedure} -setup { +test spinbox-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup { spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e diff --git a/tests/textTag.test b/tests/textTag.test index ba7be87..6a7fc86 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -11,6 +11,9 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] + destroy .t text .t -width 20 -height 10 testConstraint haveCourier12 [expr {[catch { @@ -1695,7 +1698,7 @@ test textTag-16.5 {TkTextPickCurrent procedure} -constraints { } -result {3.2} test textTag-16.6 {TkTextPickCurrent procedure} -constraints { - haveCourier12 + haveCourier12 failsOnUbuntuNoXft } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end @@ -1715,7 +1718,7 @@ test textTag-16.6 {TkTextPickCurrent procedure} -constraints { } -result {3.1} test textTag-16.7 {TkTextPickCurrent procedure} -constraints { - haveCourier12 + haveCourier12 failsOnUbuntuNoXft } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end diff --git a/tests/unixFont.test b/tests/unixFont.test index 9a8f864..973d4d9 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -17,6 +17,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] if {[tk windowingsystem] eq "x11"} { set xlsf [auto_execok xlsfonts] @@ -116,7 +117,7 @@ test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11 test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed failsOnUbuntu} { lindex [font actual {-family courier}] 1 } {courier} -test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} x11 { +test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 failsOnUbuntuNoXft} { lindex [font actual {-family courier -size 37}] 3 } {37} test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 { -- cgit v0.12 From af62bb859761fb78877f2b623732d200a2c07c5f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Sep 2020 21:24:50 +0000 Subject: Fix [59cba33c6d]: win: theme detection in TkWinGetPlatformTheme() likely broken --- win/tkWinX.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/tkWinX.c b/win/tkWinX.c index 8616369..df8c004 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -358,12 +358,12 @@ TkWinGetPlatformTheme(void) * TK_THEME_WIN_CLASSIC could be set even when running under XP if the * windows classic theme was selected. */ - if (os.dwMajorVersion == 5 && os.dwMinorVersion == 1) { + if (os.dwMajorVersion == 5 && os.dwMinorVersion >= 1) { HKEY hKey; LPCWSTR szSubKey = L"Control Panel\\Appearance"; LPCWSTR szCurrent = L"Current"; DWORD dwSize = 200; - char pBuffer[200]; + WCHAR pBuffer[200]; memset(pBuffer, 0, dwSize); if (RegOpenKeyExW(HKEY_CURRENT_USER, szSubKey, 0L, @@ -372,7 +372,7 @@ TkWinGetPlatformTheme(void) } else { RegQueryValueExW(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize); RegCloseKey(hKey); - if (strcmp(pBuffer, "Windows Standard") == 0) { + if (wcscmp(pBuffer, L"Windows Standard") == 0) { tkWinTheme = TK_THEME_WIN_CLASSIC; } else { tkWinTheme = TK_THEME_WIN_XP; -- cgit v0.12 From 32fd820c915bae23b016062081b921b3feec4ca8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Sep 2020 22:07:41 +0000 Subject: If Tk is compiled with -DTK_NO_DEPRECATED, disable some testcases which fail because of that --- generic/tkPkgConfig.c | 3 +++ tests/bind.test | 5 ++++- tests/pkgconfig.test | 4 +++- tests/scrollbar.test | 17 +++++++++-------- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c index fe084bf..ed8fb0b 100644 --- a/generic/tkPkgConfig.c +++ b/generic/tkPkgConfig.c @@ -100,6 +100,9 @@ static const Tcl_Config cfg[] = { {"profiled", CFG_PROFILED}, {"64bit", CFG_64}, {"optimized", CFG_OPTIMIZED}, +#ifdef TK_NO_DEPRECATED + {"nodeprecated", "1"}, +#endif {"mem_debug", CFG_MEMDEBUG}, {"fontsystem", CFG_FONTSYSTEM}, diff --git a/tests/bind.test b/tests/bind.test index 152fe3e..29f8873 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -13,6 +13,9 @@ eval tcltest::configure $argv tcltest::loadTestedCommands tk useinputmethods 0 +testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}] + + toplevel .t -width 100 -height 50 wm geom .t +0+0 update idletasks @@ -6017,7 +6020,7 @@ test bind-28.9 {keysym names, Eth -> ETH} -body { } -cleanup { destroy .t.f } -result {} -test bind-28.10 {keysym names, Ooblique -> Oslash} -body { +test bind-28.10 {keysym names, Ooblique -> Oslash} -constraints nodeprecated -body { frame .t.f -class Test -width 150 -height 100 bind .t.f foo bind .t.f diff --git a/tests/pkgconfig.test b/tests/pkgconfig.test index e080b91..f07ca0f 100644 --- a/tests/pkgconfig.test +++ b/tests/pkgconfig.test @@ -18,7 +18,9 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands -test pkgconfig-1.1 {query keys} nonwin { +testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}] + +test pkgconfig-1.1 {query keys} nodeprecated { lsort [::tk::pkgconfig list] } [list \ 64bit bindir,install bindir,runtime debug demodir,install demodir,runtime \ diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 20ac275..86e742e 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -12,6 +12,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}] proc scroll args { global scrollInfo @@ -316,7 +317,7 @@ destroy .t test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} { list [catch {.s get a} msg] $msg } {1 {wrong # args: should be ".s get"}} -test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} { +test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} nodeprecated { .s set 100 10 13 14 .s get } {100 10 13 14} @@ -401,27 +402,27 @@ test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} { } set result } {0.4 0.4} -test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { list [catch {.s set abc def ghi jkl} msg] $msg } {1 {expected integer but got "abc"}} -test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { list [catch {.s set 1 def ghi jkl} msg] $msg } {1 {expected integer but got "def"}} -test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { list [catch {.s set 1 2 ghi jkl} msg] $msg } {1 {expected integer but got "ghi"}} -test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { list [catch {.s set 1 2 3 jkl} msg] $msg } {1 {expected integer but got "jkl"}} -test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { .s set -10 50 20 30 .s get } {0 50 0 0} -test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { .s set 100 -10 20 30 .s get } {100 0 20 30} -test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { .s set 100 50 30 20 .s get } {100 50 30 30} -- cgit v0.12 From 279143927533f7cdd980e4d1d239303cbc9e8a5a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 1 Oct 2020 08:55:52 +0000 Subject: Expression for contraint failsOnUbuntuNoXft was reverse .... --- tests/entry.test | 2 +- tests/font.test | 2 +- tests/fontchooser.test | 2 +- tests/spinbox.test | 2 +- tests/textTag.test | 4 ++-- tests/unixFont.test | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/entry.test b/tests/entry.test index f1d61b2..4463b9b 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -12,7 +12,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] -testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] # For xscrollcommand set scrollInfo {} diff --git a/tests/font.test b/tests/font.test index 0f4c8de..89780ba 100644 --- a/tests/font.test +++ b/tests/font.test @@ -15,7 +15,7 @@ tcltest::loadTestedCommands testConstraint fullutf [expr {[format %c 0x010000] != "\uFFFD"}] testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] -testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] set defaultfontlist [font names] diff --git a/tests/fontchooser.test b/tests/fontchooser.test index 0efe619..3ec7309 100644 --- a/tests/fontchooser.test +++ b/tests/fontchooser.test @@ -7,7 +7,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] -testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] # the following helper functions are related to the functions used # in winDialog.test where they are used to send messages to the win32 diff --git a/tests/spinbox.test b/tests/spinbox.test index 4cc1238..28d90d7 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -12,7 +12,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] -testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] # For xscrollcommand set scrollInfo {} diff --git a/tests/textTag.test b/tests/textTag.test index 6a7fc86..038150f 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -12,7 +12,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] -testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] destroy .t text .t -width 20 -height 10 @@ -1602,7 +1602,7 @@ test textTag-16.1 {TkTextPickCurrent procedure} -constraints { } -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3} test textTag-16.2 {TkTextPickCurrent procedure} -constraints { - haveCourier12 + haveCourier12 failsOnUbuntuNoXft } -setup { .t tag delete {*}[.t tag names] wm geometry . +200+200 ; update diff --git a/tests/unixFont.test b/tests/unixFont.test index 973d4d9..86fb5bf 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -17,7 +17,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] -testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || ([catch {tk::pkgconfig get fontsystem} fs] || ($fs ne "xft"))}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] if {[tk windowingsystem] eq "x11"} { set xlsf [auto_execok xlsfonts] -- cgit v0.12 From 231368f73de8a15b94a1cd60793e52c8d6f6d052 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 1 Oct 2020 09:05:38 +0000 Subject: Duplicate testconstraint failsOnUbuntu --- tests/textDisp.test | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/textDisp.test b/tests/textDisp.test index d54eb62..39d50d0 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -103,8 +103,6 @@ wm positionfrom . user wm deiconify . updateText -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] - # Some window managers (like olwm under SunOS 4.1.3) misbehave in a way # that tends to march windows off the top and left of the screen. If # this happens, some tests will fail because parts of the window will -- cgit v0.12 From fecbf2b8553ba43518eba229753b0efc12aabd28 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 1 Oct 2020 14:49:14 +0000 Subject: Fix some gcc warnings (when using -Wshadow, deprecated XKeycodeToKeysym(), XScreenSaverQueryInfo weak symbol on MacOS) --- generic/tkFont.c | 16 ++++++++-------- generic/tkMenu.c | 4 +--- generic/tkOldConfig.c | 2 -- generic/tkPlace.c | 22 +++++++++++----------- generic/tkUtil.c | 2 +- unix/tkUnix.c | 2 +- unix/tkUnixKey.c | 7 +++++++ 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/generic/tkFont.c b/generic/tkFont.c index 3aed702..3e4044f 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -740,7 +740,7 @@ Tk_FontObjCmd( } case FONT_METRICS: { Tk_Font tkfont; - int skip, index, i; + int skip, i; const TkFontMetrics *fmPtr; static const char *const switches[] = { "-ascent", "-descent", "-linespace", "-fixed", NULL @@ -1973,7 +1973,7 @@ Tk_ComputeTextLayout( int *heightPtr) /* Filled with height of string. */ { TkFont *fontPtr = (TkFont *) tkfont; - const char *start, *end, *special; + const char *start, *endp, *special; int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight; int baseline, height, curX, newX, maxWidth, *lineLengths; TextLayout *layoutPtr; @@ -2021,12 +2021,12 @@ Tk_ComputeTextLayout( curX = 0; - end = TkUtfAtIndex(string, numChars); + endp = TkUtfAtIndex(string, numChars); special = string; flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES; flags |= TK_WHOLE_WORDS | TK_AT_LEAST_ONE; - for (start = string; start < end; ) { + for (start = string; start < endp; ) { if (start >= special) { /* * Find the next special character in the string. @@ -2037,7 +2037,7 @@ Tk_ComputeTextLayout( * whitespace set. */ - for (special = start; special < end; special++) { + for (special = start; special < endp; special++) { if (!(flags & TK_IGNORE_NEWLINES)) { if ((*special == '\n') || (*special == '\r')) { break; @@ -2071,7 +2071,7 @@ Tk_ComputeTextLayout( } } - if ((start == special) && (special < end)) { + if ((start == special) && (special < endp)) { /* * Handle the special character. * @@ -2088,7 +2088,7 @@ Tk_ComputeTextLayout( start++; curX = newX; flags &= ~TK_AT_LEAST_ONE; - if ((start < end) && + if ((start < endp) && ((wrapLength <= 0) || (newX <= wrapLength))) { /* * More chars can still fit on this line. @@ -2110,7 +2110,7 @@ Tk_ComputeTextLayout( * Consume all extra spaces at end of line. */ - while ((start < end) && isspace(UCHAR(*start))) { /* INTL: ISO space */ + while ((start < endp) && isspace(UCHAR(*start))) { /* INTL: ISO space */ if (!(flags & TK_IGNORE_NEWLINES)) { if ((*start == '\n') || (*start == '\r')) { break; diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 638139a..1cd7a16 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -1623,7 +1623,6 @@ ConfigureMenu( } } else if ((menuListPtr->numEntries > 0) && (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) { - int i; Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry); @@ -1819,7 +1818,6 @@ PostProcessEntry( if ((mePtr->type == CHECK_BUTTON_ENTRY) || (mePtr->type == RADIO_BUTTON_ENTRY)) { Tcl_Obj *valuePtr; - const char *name; if (mePtr->namePtr == NULL) { if (mePtr->labelPtr == NULL) { @@ -2732,7 +2730,7 @@ CloneMenu( && (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) { TkMenu *newMenuPtr = menuRefPtr->menuPtr; Tcl_Obj *newObjv[3]; - int i, numElements; + int numElements; /* * Now put this newly created menu into the parent menu's instance diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index d01da95..7bb02b4 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -863,8 +863,6 @@ FormatConfigValue( result = buffer; break; case TK_CONFIG_WINDOW: { - Tk_Window tkwin; - tkwin = *((Tk_Window *) ptr); if (tkwin != NULL) { result = Tk_PathName(tkwin); diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 4cff85f..47ceee2 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -666,10 +666,10 @@ ConfigureContent( goto scheduleLayout; } else if (mask & IN_MASK) { /* -in changed */ - Tk_Window tkwin; + Tk_Window win; Tk_Window ancestor; - tkwin = contentPtr->inTkwin; + win = contentPtr->inTkwin; /* * Make sure that the new container is either the logical parent of the @@ -677,19 +677,19 @@ ConfigureContent( * aren't the same. */ - for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = win; ; ancestor = Tk_Parent(ancestor)) { if (ancestor == Tk_Parent(contentPtr->tkwin)) { break; } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to %s", - Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(win))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); goto error; } } - if (contentPtr->tkwin == tkwin) { + if (contentPtr->tkwin == win) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to itself", Tk_PathName(contentPtr->tkwin))); @@ -701,22 +701,22 @@ ConfigureContent( * Check for management loops. */ - for (container = (TkWindow *)tkwin; container != NULL; + for (container = (TkWindow *)win; container != NULL; container = (TkWindow *)TkGetContainer(container)) { if (container == (TkWindow *)contentPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", - Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(win))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } } - if (tkwin != Tk_Parent(contentPtr->tkwin)) { - ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; + if (win != Tk_Parent(contentPtr->tkwin)) { + ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)win; } if ((contentPtr->containerPtr != NULL) - && (contentPtr->containerPtr->tkwin == tkwin)) { + && (contentPtr->containerPtr->tkwin == win)) { /* * Re-using same old container. Nothing to do. */ @@ -729,7 +729,7 @@ ConfigureContent( Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } UnlinkContent(contentPtr); - containerWin = tkwin; + containerWin = win; } /* diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 17ba443..00ac7be 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -1133,7 +1133,7 @@ TkMakeEnsemble( dictObj = Tcl_NewObj(); for (i = 0; map[i].name != NULL ; ++i) { - Tcl_Obj *nameObj, *fqdnObj; + Tcl_Obj *fqdnObj; nameObj = Tcl_NewStringObj(map[i].name, -1); fqdnObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), diff --git a/unix/tkUnix.c b/unix/tkUnix.c index c6fff82..2de6e98 100644 --- a/unix/tkUnix.c +++ b/unix/tkUnix.c @@ -16,7 +16,7 @@ # include # ifdef __APPLE__ /* Support for weak-linked libXss. */ -# define HaveXSSLibrary() (XScreenSaverQueryInfo != NULL) +# define HaveXSSLibrary() (&XScreenSaverQueryInfo != NULL) # else /* Other platforms always link libXss. */ # define HaveXSSLibrary() (1) diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c index 4e150f7..d55fde0 100644 --- a/unix/tkUnixKey.c +++ b/unix/tkUnixKey.c @@ -12,6 +12,13 @@ #include "tkInt.h" +#ifdef __GNUC__ +/* + * We know that XKeycodeToKeysym is deprecated, nothing we can do about it. + */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + /* ** Bug [3607830]: Before using Xkb, it must be initialized. TkpOpenDisplay ** does this and sets the USE_XKB flag if xkb is supported. -- cgit v0.12 From c398d6bf2cc0c663cf503457d334bb99bee735f7 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 1 Oct 2020 19:49:17 +0000 Subject: Another possible fix (but this does not match the documentation for in bind.n). --- generic/tkCmds.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/generic/tkCmds.c b/generic/tkCmds.c index f782144..b8b1d3e 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1623,12 +1623,7 @@ Tk_WinfoObjCmd( } tkwin = Tk_CoordsToWindow(x, y, tkwin); if (tkwin != NULL) { - string = Tk_PathName(tkwin); - winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); - Tcl_ResetResult(interp); - if (winPtr && !(winPtr->flags & TK_ALREADY_DEAD)) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(string, -1)); - } + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin),-1)); } break; case WIN_INTERPS: @@ -1694,10 +1689,7 @@ Tk_WinfoObjCmd( winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); Tcl_ResetResult(interp); - alive = 1; - if ((winPtr == NULL) || (winPtr->flags & TK_ALREADY_DEAD)) { - alive = 0; - } + alive = (winPtr != NULL); Tcl_SetObjResult(interp, Tcl_NewBooleanObj(alive)); break; } -- cgit v0.12 From 30699869c5cf8459e81c4bcedbe819d6887a02cb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 2 Oct 2020 15:07:23 +0000 Subject: Fix more warnings, related to -Wshadow, now in MacOSX code --- macosx/tkMacOSXColor.c | 10 +- macosx/tkMacOSXCursor.c | 268 +++++++++++++++++++------------------- macosx/tkMacOSXDialog.c | 10 +- macosx/tkMacOSXFont.c | 59 ++++----- macosx/tkMacOSXKeyboard.c | 3 +- macosx/tkMacOSXMenu.c | 84 ++++++------ macosx/tkMacOSXPrivate.h | 8 +- macosx/ttkMacOSXTheme.c | 324 +++++++++++++++++++++++----------------------- 8 files changed, 391 insertions(+), 375 deletions(-) diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 208fc8b..5f549b1 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -31,7 +31,7 @@ static NSAppearance *lightAqua = nil; static NSAppearance *darkAqua = nil; #endif static NSColorSpace* sRGB = NULL; -static CGFloat windowBackground[4] = +static const CGFloat WINDOWBACKGROUND[4] = {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0}; void initColorTable() @@ -92,9 +92,9 @@ void initColorTable() for (key in [systemColorList allKeys]) { int length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; char *name; - entry = ckalloc(sizeof(SystemColorDatum)); + entry = (SystemColorDatum *)ckalloc(sizeof(SystemColorDatum)); bzero(entry, sizeof(SystemColorDatum)); - name = ckalloc(length + 1); + name = (char *)ckalloc(length + 1); strcpy(name, key.UTF8String); name[0] = toupper(name[0]); if (!strcmp(name, "WindowBackgroundColor")) { @@ -124,7 +124,7 @@ void initColorTable() */ numSystemColors = index; - systemColorIndex = ckalloc(numSystemColors * sizeof(SystemColorDatum*)); + systemColorIndex = (SystemColorDatum **)ckalloc(numSystemColors * sizeof(SystemColorDatum *)); for (hPtr = Tcl_FirstHashEntry(&systemColors, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); @@ -297,7 +297,7 @@ GetRGBA( if ([NSApp macOSVersion] < 101400) { for (int i = 0; i < 3; i++) { - rgba[i] = windowBackground[i]; + rgba[i] = WINDOWBACKGROUND[i]; } } else { bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB]; diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 894a44d..4b2de7f 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -54,131 +54,131 @@ struct CursorName { #define MacXCursorData(n) ((id)tkMacOSXXCursors[TK_MAC_XCURSOR_##n]) static const struct CursorName cursorNames[] = { - {"none", NONE, nil}, - {"arrow", SELECTOR, @"arrowCursor"}, - {"top_left_arrow", SELECTOR, @"arrowCursor"}, - {"left_ptr", SELECTOR, @"arrowCursor"}, - {"copyarrow", SELECTOR, @"dragCopyCursor", @"_copyDragCursor"}, - {"aliasarrow", SELECTOR, @"dragLinkCursor", @"_linkDragCursor"}, - {"contextualmenuarrow", SELECTOR, @"contextualMenuCursor"}, - {"movearrow", SELECTOR, @"_moveCursor"}, - {"ibeam", SELECTOR, @"IBeamCursor"}, - {"text", SELECTOR, @"IBeamCursor"}, - {"xterm", SELECTOR, @"IBeamCursor"}, - {"cross", SELECTOR, @"crosshairCursor"}, - {"crosshair", SELECTOR, @"crosshairCursor"}, - {"cross-hair", SELECTOR, @"crosshairCursor"}, - {"tcross", SELECTOR, @"crosshairCursor"}, - {"hand", SELECTOR, @"openHandCursor"}, - {"openhand", SELECTOR, @"openHandCursor"}, - {"closedhand", SELECTOR, @"closedHandCursor"}, - {"fist", SELECTOR, @"closedHandCursor"}, - {"pointinghand", SELECTOR, @"pointingHandCursor"}, - {"resize", SELECTOR, @"arrowCursor"}, - {"resizeleft", SELECTOR, @"resizeLeftCursor"}, - {"resizeright", SELECTOR, @"resizeRightCursor"}, - {"resizeleftright", SELECTOR, @"resizeLeftRightCursor"}, - {"resizeup", SELECTOR, @"resizeUpCursor"}, - {"resizedown", SELECTOR, @"resizeDownCursor"}, - {"resizeupdown", SELECTOR, @"resizeUpDownCursor"}, - {"resizebottomleft", SELECTOR, @"_bottomLeftResizeCursor"}, - {"resizetopleft", SELECTOR, @"_topLeftResizeCursor"}, - {"resizebottomright", SELECTOR, @"_bottomRightResizeCursor"}, - {"resizetopright", SELECTOR, @"_topRightResizeCursor"}, - {"notallowed", SELECTOR, @"operationNotAllowedCursor"}, - {"poof", SELECTOR, @"disappearingItemCursor"}, - {"wait", SELECTOR, @"busyButClickableCursor"}, - {"spinning", SELECTOR, @"busyButClickableCursor"}, - {"countinguphand", SELECTOR, @"busyButClickableCursor"}, - {"countingdownhand", SELECTOR, @"busyButClickableCursor"}, - {"countingupanddownhand", SELECTOR, @"busyButClickableCursor"}, + {"none", NONE, nil, nil, {0, 0}}, + {"arrow", SELECTOR, @"arrowCursor", nil, {0, 0}}, + {"top_left_arrow", SELECTOR, @"arrowCursor", nil, {0, 0}}, + {"left_ptr", SELECTOR, @"arrowCursor", nil, {0, 0}}, + {"copyarrow", SELECTOR, @"dragCopyCursor", @"_copyDragCursor", {0, 0}}, + {"aliasarrow", SELECTOR, @"dragLinkCursor", @"_linkDragCursor", {0, 0}}, + {"contextualmenuarrow", SELECTOR, @"contextualMenuCursor", nil, {0, 0}}, + {"movearrow", SELECTOR, @"_moveCursor", nil, {0, 0}}, + {"ibeam", SELECTOR, @"IBeamCursor", nil, {0, 0}}, + {"text", SELECTOR, @"IBeamCursor", nil, {0, 0}}, + {"xterm", SELECTOR, @"IBeamCursor", nil, {0, 0}}, + {"cross", SELECTOR, @"crosshairCursor", nil, {0, 0}}, + {"crosshair", SELECTOR, @"crosshairCursor", nil, {0, 0}}, + {"cross-hair", SELECTOR, @"crosshairCursor", nil, {0, 0}}, + {"tcross", SELECTOR, @"crosshairCursor", nil, {0, 0}}, + {"hand", SELECTOR, @"openHandCursor", nil, {0, 0}}, + {"openhand", SELECTOR, @"openHandCursor", nil, {0, 0}}, + {"closedhand", SELECTOR, @"closedHandCursor", nil, {0, 0}}, + {"fist", SELECTOR, @"closedHandCursor", nil, {0, 0}}, + {"pointinghand", SELECTOR, @"pointingHandCursor", nil, {0, 0}}, + {"resize", SELECTOR, @"arrowCursor", nil, {0, 0}}, + {"resizeleft", SELECTOR, @"resizeLeftCursor", nil, {0, 0}}, + {"resizeright", SELECTOR, @"resizeRightCursor", nil, {0, 0}}, + {"resizeleftright", SELECTOR, @"resizeLeftRightCursor", nil, {0, 0}}, + {"resizeup", SELECTOR, @"resizeUpCursor", nil, {0, 0}}, + {"resizedown", SELECTOR, @"resizeDownCursor", nil, {0, 0}}, + {"resizeupdown", SELECTOR, @"resizeUpDownCursor", nil, {0, 0}}, + {"resizebottomleft", SELECTOR, @"_bottomLeftResizeCursor", nil, {0, 0}}, + {"resizetopleft", SELECTOR, @"_topLeftResizeCursor", nil, {0, 0}}, + {"resizebottomright", SELECTOR, @"_bottomRightResizeCursor", nil, {0, 0}}, + {"resizetopright", SELECTOR, @"_topRightResizeCursor", nil, {0, 0}}, + {"notallowed", SELECTOR, @"operationNotAllowedCursor", nil, {0, 0}}, + {"poof", SELECTOR, @"disappearingItemCursor", nil, {0, 0}}, + {"wait", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, + {"spinning", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, + {"countinguphand", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, + {"countingdownhand", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, + {"countingupanddownhand", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, {"help", IMAGENAMED, @"NSHelpCursor", nil, {8, 8}}, -// {"hand", IMAGEBITMAP, MacCursorData(hand)}, - {"bucket", IMAGEBITMAP, MacCursorData(bucket)}, - {"cancel", IMAGEBITMAP, MacCursorData(cancel)}, -// {"resize", IMAGEBITMAP, MacCursorData(resize)}, - {"eyedrop", IMAGEBITMAP, MacCursorData(eyedrop)}, - {"eyedrop-full", IMAGEBITMAP, MacCursorData(eyedrop_full)}, - {"zoom-in", IMAGEBITMAP, MacCursorData(zoom_in)}, - {"zoom-out", IMAGEBITMAP, MacCursorData(zoom_out)}, - {"X_cursor", IMAGEBITMAP, MacXCursorData(X_cursor)}, -// {"arrow", IMAGEBITMAP, MacXCursorData(arrow)}, - {"based_arrow_down", IMAGEBITMAP, MacXCursorData(based_arrow_down)}, - {"based_arrow_up", IMAGEBITMAP, MacXCursorData(based_arrow_up)}, - {"boat", IMAGEBITMAP, MacXCursorData(boat)}, - {"bogosity", IMAGEBITMAP, MacXCursorData(bogosity)}, - {"bottom_left_corner", IMAGEBITMAP, MacXCursorData(bottom_left_corner)}, - {"bottom_right_corner", IMAGEBITMAP, MacXCursorData(bottom_right_corner)}, - {"bottom_side", IMAGEBITMAP, MacXCursorData(bottom_side)}, - {"bottom_tee", IMAGEBITMAP, MacXCursorData(bottom_tee)}, - {"box_spiral", IMAGEBITMAP, MacXCursorData(box_spiral)}, - {"center_ptr", IMAGEBITMAP, MacXCursorData(center_ptr)}, - {"circle", IMAGEBITMAP, MacXCursorData(circle)}, - {"clock", IMAGEBITMAP, MacXCursorData(clock)}, - {"coffee_mug", IMAGEBITMAP, MacXCursorData(coffee_mug)}, -// {"cross", IMAGEBITMAP, MacXCursorData(cross)}, - {"cross_reverse", IMAGEBITMAP, MacXCursorData(cross_reverse)}, -// {"crosshair", IMAGEBITMAP, MacXCursorData(crosshair)}, - {"diamond_cross", IMAGEBITMAP, MacXCursorData(diamond_cross)}, - {"dot", IMAGEBITMAP, MacXCursorData(dot)}, - {"dotbox", IMAGEBITMAP, MacXCursorData(dotbox)}, - {"double_arrow", IMAGEBITMAP, MacXCursorData(double_arrow)}, - {"draft_large", IMAGEBITMAP, MacXCursorData(draft_large)}, - {"draft_small", IMAGEBITMAP, MacXCursorData(draft_small)}, - {"draped_box", IMAGEBITMAP, MacXCursorData(draped_box)}, - {"exchange", IMAGEBITMAP, MacXCursorData(exchange)}, - {"fleur", IMAGEBITMAP, MacXCursorData(fleur)}, - {"gobbler", IMAGEBITMAP, MacXCursorData(gobbler)}, - {"gumby", IMAGEBITMAP, MacXCursorData(gumby)}, - {"hand1", IMAGEBITMAP, MacXCursorData(hand1)}, - {"hand2", IMAGEBITMAP, MacXCursorData(hand2)}, - {"heart", IMAGEBITMAP, MacXCursorData(heart)}, - {"icon", IMAGEBITMAP, MacXCursorData(icon)}, - {"iron_cross", IMAGEBITMAP, MacXCursorData(iron_cross)}, -// {"left_ptr", IMAGEBITMAP, MacXCursorData(left_ptr)}, - {"left_side", IMAGEBITMAP, MacXCursorData(left_side)}, - {"left_tee", IMAGEBITMAP, MacXCursorData(left_tee)}, - {"leftbutton", IMAGEBITMAP, MacXCursorData(leftbutton)}, - {"ll_angle", IMAGEBITMAP, MacXCursorData(ll_angle)}, - {"lr_angle", IMAGEBITMAP, MacXCursorData(lr_angle)}, - {"man", IMAGEBITMAP, MacXCursorData(man)}, - {"middlebutton", IMAGEBITMAP, MacXCursorData(middlebutton)}, - {"mouse", IMAGEBITMAP, MacXCursorData(mouse)}, - {"pencil", IMAGEBITMAP, MacXCursorData(pencil)}, - {"pirate", IMAGEBITMAP, MacXCursorData(pirate)}, - {"plus", IMAGEBITMAP, MacXCursorData(plus)}, - {"question_arrow", IMAGEBITMAP, MacXCursorData(question_arrow)}, - {"right_ptr", IMAGEBITMAP, MacXCursorData(right_ptr)}, - {"right_side", IMAGEBITMAP, MacXCursorData(right_side)}, - {"right_tee", IMAGEBITMAP, MacXCursorData(right_tee)}, - {"rightbutton", IMAGEBITMAP, MacXCursorData(rightbutton)}, - {"rtl_logo", IMAGEBITMAP, MacXCursorData(rtl_logo)}, - {"sailboat", IMAGEBITMAP, MacXCursorData(sailboat)}, - {"sb_down_arrow", IMAGEBITMAP, MacXCursorData(sb_down_arrow)}, - {"sb_h_double_arrow", IMAGEBITMAP, MacXCursorData(sb_h_double_arrow)}, - {"sb_left_arrow", IMAGEBITMAP, MacXCursorData(sb_left_arrow)}, - {"sb_right_arrow", IMAGEBITMAP, MacXCursorData(sb_right_arrow)}, - {"sb_up_arrow", IMAGEBITMAP, MacXCursorData(sb_up_arrow)}, - {"sb_v_double_arrow", IMAGEBITMAP, MacXCursorData(sb_v_double_arrow)}, - {"shuttle", IMAGEBITMAP, MacXCursorData(shuttle)}, - {"sizing", IMAGEBITMAP, MacXCursorData(sizing)}, - {"spider", IMAGEBITMAP, MacXCursorData(spider)}, - {"spraycan", IMAGEBITMAP, MacXCursorData(spraycan)}, - {"star", IMAGEBITMAP, MacXCursorData(star)}, - {"target", IMAGEBITMAP, MacXCursorData(target)}, -// {"tcross", IMAGEBITMAP, MacXCursorData(tcross)}, -// {"top_left_arrow", IMAGEBITMAP, MacXCursorData(top_left_arrow)}, - {"top_left_corner", IMAGEBITMAP, MacXCursorData(top_left_corner)}, - {"top_right_corner", IMAGEBITMAP, MacXCursorData(top_right_corner)}, - {"top_side", IMAGEBITMAP, MacXCursorData(top_side)}, - {"top_tee", IMAGEBITMAP, MacXCursorData(top_tee)}, - {"trek", IMAGEBITMAP, MacXCursorData(trek)}, - {"ul_angle", IMAGEBITMAP, MacXCursorData(ul_angle)}, - {"umbrella", IMAGEBITMAP, MacXCursorData(umbrella)}, - {"ur_angle", IMAGEBITMAP, MacXCursorData(ur_angle)}, - {"watch", IMAGEBITMAP, MacXCursorData(watch)}, -// {"xterm", IMAGEBITMAP, MacXCursorData(xterm)}, - {NULL} +// {"hand", IMAGEBITMAP, MacCursorData(hand), nil, {0, 0}}, + {"bucket", IMAGEBITMAP, MacCursorData(bucket), nil, {0, 0}}, + {"cancel", IMAGEBITMAP, MacCursorData(cancel), nil, {0, 0}}, +// {"resize", IMAGEBITMAP, MacCursorData(resize), nil, {0, 0}}, + {"eyedrop", IMAGEBITMAP, MacCursorData(eyedrop), nil, {0, 0}}, + {"eyedrop-full", IMAGEBITMAP, MacCursorData(eyedrop_full), nil, {0, 0}}, + {"zoom-in", IMAGEBITMAP, MacCursorData(zoom_in), nil, {0, 0}}, + {"zoom-out", IMAGEBITMAP, MacCursorData(zoom_out), nil, {0, 0}}, + {"X_cursor", IMAGEBITMAP, MacXCursorData(X_cursor), nil, {0, 0}}, +// {"arrow", IMAGEBITMAP, MacXCursorData(arrow), nil, {0, 0}}, + {"based_arrow_down", IMAGEBITMAP, MacXCursorData(based_arrow_down), nil, {0, 0}}, + {"based_arrow_up", IMAGEBITMAP, MacXCursorData(based_arrow_up), nil, {0, 0}}, + {"boat", IMAGEBITMAP, MacXCursorData(boat), nil, {0, 0}}, + {"bogosity", IMAGEBITMAP, MacXCursorData(bogosity), nil, {0, 0}}, + {"bottom_left_corner", IMAGEBITMAP, MacXCursorData(bottom_left_corner), nil, {0, 0}}, + {"bottom_right_corner", IMAGEBITMAP, MacXCursorData(bottom_right_corner), nil, {0, 0}}, + {"bottom_side", IMAGEBITMAP, MacXCursorData(bottom_side), nil, {0, 0}}, + {"bottom_tee", IMAGEBITMAP, MacXCursorData(bottom_tee), nil, {0, 0}}, + {"box_spiral", IMAGEBITMAP, MacXCursorData(box_spiral), nil, {0, 0}}, + {"center_ptr", IMAGEBITMAP, MacXCursorData(center_ptr), nil, {0, 0}}, + {"circle", IMAGEBITMAP, MacXCursorData(circle), nil, {0, 0}}, + {"clock", IMAGEBITMAP, MacXCursorData(clock), nil, {0, 0}}, + {"coffee_mug", IMAGEBITMAP, MacXCursorData(coffee_mug), nil, {0, 0}}, +// {"cross", IMAGEBITMAP, MacXCursorData(cross), nil, {0, 0}}, + {"cross_reverse", IMAGEBITMAP, MacXCursorData(cross_reverse), nil, {0, 0}}, +// {"crosshair", IMAGEBITMAP, MacXCursorData(crosshair), nil, {0, 0}}, + {"diamond_cross", IMAGEBITMAP, MacXCursorData(diamond_cross), nil, {0, 0}}, + {"dot", IMAGEBITMAP, MacXCursorData(dot), nil, {0, 0}}, + {"dotbox", IMAGEBITMAP, MacXCursorData(dotbox), nil, {0, 0}}, + {"double_arrow", IMAGEBITMAP, MacXCursorData(double_arrow), nil, {0, 0}}, + {"draft_large", IMAGEBITMAP, MacXCursorData(draft_large), nil, {0, 0}}, + {"draft_small", IMAGEBITMAP, MacXCursorData(draft_small), nil, {0, 0}}, + {"draped_box", IMAGEBITMAP, MacXCursorData(draped_box), nil, {0, 0}}, + {"exchange", IMAGEBITMAP, MacXCursorData(exchange), nil, {0, 0}}, + {"fleur", IMAGEBITMAP, MacXCursorData(fleur), nil, {0, 0}}, + {"gobbler", IMAGEBITMAP, MacXCursorData(gobbler), nil, {0, 0}}, + {"gumby", IMAGEBITMAP, MacXCursorData(gumby), nil, {0, 0}}, + {"hand1", IMAGEBITMAP, MacXCursorData(hand1), nil, {0, 0}}, + {"hand2", IMAGEBITMAP, MacXCursorData(hand2), nil, {0, 0}}, + {"heart", IMAGEBITMAP, MacXCursorData(heart), nil, {0, 0}}, + {"icon", IMAGEBITMAP, MacXCursorData(icon), nil, {0, 0}}, + {"iron_cross", IMAGEBITMAP, MacXCursorData(iron_cross), nil, {0, 0}}, +// {"left_ptr", IMAGEBITMAP, MacXCursorData(left_ptr), nil, {0, 0}}, + {"left_side", IMAGEBITMAP, MacXCursorData(left_side), nil, {0, 0}}, + {"left_tee", IMAGEBITMAP, MacXCursorData(left_tee), nil, {0, 0}}, + {"leftbutton", IMAGEBITMAP, MacXCursorData(leftbutton), nil, {0, 0}}, + {"ll_angle", IMAGEBITMAP, MacXCursorData(ll_angle), nil, {0, 0}}, + {"lr_angle", IMAGEBITMAP, MacXCursorData(lr_angle), nil, {0, 0}}, + {"man", IMAGEBITMAP, MacXCursorData(man), nil, {0, 0}}, + {"middlebutton", IMAGEBITMAP, MacXCursorData(middlebutton), nil, {0, 0}}, + {"mouse", IMAGEBITMAP, MacXCursorData(mouse), nil, {0, 0}}, + {"pencil", IMAGEBITMAP, MacXCursorData(pencil), nil, {0, 0}}, + {"pirate", IMAGEBITMAP, MacXCursorData(pirate), nil, {0, 0}}, + {"plus", IMAGEBITMAP, MacXCursorData(plus), nil, {0, 0}}, + {"question_arrow", IMAGEBITMAP, MacXCursorData(question_arrow), nil, {0, 0}}, + {"right_ptr", IMAGEBITMAP, MacXCursorData(right_ptr), nil, {0, 0}}, + {"right_side", IMAGEBITMAP, MacXCursorData(right_side), nil, {0, 0}}, + {"right_tee", IMAGEBITMAP, MacXCursorData(right_tee), nil, {0, 0}}, + {"rightbutton", IMAGEBITMAP, MacXCursorData(rightbutton), nil, {0, 0}}, + {"rtl_logo", IMAGEBITMAP, MacXCursorData(rtl_logo), nil, {0, 0}}, + {"sailboat", IMAGEBITMAP, MacXCursorData(sailboat), nil, {0, 0}}, + {"sb_down_arrow", IMAGEBITMAP, MacXCursorData(sb_down_arrow), nil, {0, 0}}, + {"sb_h_double_arrow", IMAGEBITMAP, MacXCursorData(sb_h_double_arrow), nil, {0, 0}}, + {"sb_left_arrow", IMAGEBITMAP, MacXCursorData(sb_left_arrow), nil, {0, 0}}, + {"sb_right_arrow", IMAGEBITMAP, MacXCursorData(sb_right_arrow), nil, {0, 0}}, + {"sb_up_arrow", IMAGEBITMAP, MacXCursorData(sb_up_arrow), nil, {0, 0}}, + {"sb_v_double_arrow", IMAGEBITMAP, MacXCursorData(sb_v_double_arrow), nil, {0, 0}}, + {"shuttle", IMAGEBITMAP, MacXCursorData(shuttle), nil, {0, 0}}, + {"sizing", IMAGEBITMAP, MacXCursorData(sizing), nil, {0, 0}}, + {"spider", IMAGEBITMAP, MacXCursorData(spider), nil, {0, 0}}, + {"spraycan", IMAGEBITMAP, MacXCursorData(spraycan), nil, {0, 0}}, + {"star", IMAGEBITMAP, MacXCursorData(star), nil, {0, 0}}, + {"target", IMAGEBITMAP, MacXCursorData(target), nil, {0, 0}}, +// {"tcross", IMAGEBITMAP, MacXCursorData(tcross), nil, {0, 0}}, +// {"top_left_arrow", IMAGEBITMAP, MacXCursorData(top_left_arrow), nil, {0, 0}}, + {"top_left_corner", IMAGEBITMAP, MacXCursorData(top_left_corner), nil, {0, 0}}, + {"top_right_corner", IMAGEBITMAP, MacXCursorData(top_right_corner), nil, {0, 0}}, + {"top_side", IMAGEBITMAP, MacXCursorData(top_side), nil, {0, 0}}, + {"top_tee", IMAGEBITMAP, MacXCursorData(top_tee), nil, {0, 0}}, + {"trek", IMAGEBITMAP, MacXCursorData(trek), nil, {0, 0}}, + {"ul_angle", IMAGEBITMAP, MacXCursorData(ul_angle), nil, {0, 0}}, + {"umbrella", IMAGEBITMAP, MacXCursorData(umbrella), nil, {0, 0}}, + {"ur_angle", IMAGEBITMAP, MacXCursorData(ur_angle), nil, {0, 0}}, + {"watch", IMAGEBITMAP, MacXCursorData(watch), nil, {0, 0}}, +// {"xterm", IMAGEBITMAP, MacXCursorData(xterm), nil, {0, 0}}, + {NULL, 0, nil, nil, {0, 0}} }; /* @@ -375,7 +375,7 @@ FindCursorByName( TkCursor * TkGetCursorByName( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - Tk_Window tkwin, /* Window in which cursor will be used. */ + TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry * for details on legal syntax. */ { @@ -390,7 +390,7 @@ TkGetCursorByName( if (Tcl_SplitList(interp, string, &argc, &argv) == TCL_OK) { if (argc) { - macCursorPtr = ckalloc(sizeof(TkMacOSXCursor)); + macCursorPtr = (TkMacOSXCursor *)ckalloc(sizeof(TkMacOSXCursor)); macCursorPtr->info.cursor = (Tk_Cursor) macCursorPtr; macCursorPtr->macCursor = nil; macCursorPtr->type = 0; @@ -429,13 +429,15 @@ TkGetCursorByName( TkCursor * TkCreateCursorFromData( - Tk_Window tkwin, /* Window in which cursor will be used. */ - const char *source, /* Bitmap data for cursor shape. */ - const char *mask, /* Bitmap data for cursor mask. */ - int width, int height, /* Dimensions of cursor. */ - int xHot, int yHot, /* Location of hot-spot in cursor. */ - XColor fgColor, /* Foreground color for cursor. */ - XColor bgColor) /* Background color for cursor. */ + TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ + TCL_UNUSED(const char *), /* Bitmap data for cursor shape. */ + TCL_UNUSED(const char *), /* Bitmap data for cursor mask. */ + TCL_UNUSED(int), /* Dimensions of cursor. */ + TCL_UNUSED(int), + TCL_UNUSED(int), /* Location of hot-spot in cursor. */ + TCL_UNUSED(int), + TCL_UNUSED(XColor), /* Foreground color for cursor. */ + TCL_UNUSED(XColor)) /* Background color for cursor. */ { return NULL; } diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index c2b1b15..42cb4a5 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -870,15 +870,15 @@ Tk_GetOpenFileObjCmd( selectedFilterIndex = filterInfo.fileTypeIndex; // The preselection from the typevariable selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { - NSUInteger i; + NSUInteger j; - for (i = 0; i < [filterInfo.fileTypeNames count]; i++) { - if (filterCompatible(extension, i)) { - selectedFilterIndex = i; + for (j = 0; j < [filterInfo.fileTypeNames count]; j++) { + if (filterCompatible(extension, j)) { + selectedFilterIndex = j; break; } } - if (i == selectedFilterIndex) { + if (j == selectedFilterIndex) { selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { selectedFilter = @""; diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index f7b87dc..34dc8c2 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -56,25 +56,25 @@ struct SystemFontMapEntry { #define ThemeFont(n, ...) { kTheme##n##Font, "system" #n "Font", ##__VA_ARGS__ } static const struct SystemFontMapEntry systemFontMap[] = { ThemeFont(System, "TkDefaultFont", "TkIconFont"), - ThemeFont(EmphasizedSystem, "TkCaptionFont"), + ThemeFont(EmphasizedSystem, "TkCaptionFont", NULL), ThemeFont(SmallSystem, "TkHeadingFont", "TkTooltipFont"), - ThemeFont(SmallEmphasizedSystem), - ThemeFont(Application, "TkTextFont"), - ThemeFont(Label, "TkSmallCaptionFont"), - ThemeFont(Views), - ThemeFont(MenuTitle), - ThemeFont(MenuItem, "TkMenuFont"), - ThemeFont(MenuItemMark), - ThemeFont(MenuItemCmdKey), - ThemeFont(WindowTitle), - ThemeFont(PushButton), - ThemeFont(UtilityWindowTitle), - ThemeFont(AlertHeader), - ThemeFont(Toolbar), - ThemeFont(MiniSystem), - { kThemeSystemFontDetail, "systemDetailSystemFont" }, - { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont" }, - { -1, NULL } + ThemeFont(SmallEmphasizedSystem, NULL, NULL), + ThemeFont(Application, "TkTextFont", NULL), + ThemeFont(Label, "TkSmallCaptionFont", NULL), + ThemeFont(Views, NULL, NULL), + ThemeFont(MenuTitle, NULL, NULL), + ThemeFont(MenuItem, "TkMenuFont", NULL), + ThemeFont(MenuItemMark, NULL, NULL), + ThemeFont(MenuItemCmdKey, NULL, NULL), + ThemeFont(WindowTitle, NULL, NULL), + ThemeFont(PushButton, NULL, NULL), + ThemeFont(UtilityWindowTitle, NULL, NULL), + ThemeFont(AlertHeader, NULL, NULL), + ThemeFont(Toolbar, NULL, NULL), + ThemeFont(MiniSystem, NULL, NULL), + { kThemeSystemFontDetail, "systemDetailSystemFont", NULL, NULL }, + { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont", NULL, NULL }, + { -1, NULL, NULL, NULL } }; #undef ThemeFont @@ -162,7 +162,7 @@ static int CreateNamedSystemFont(Tcl_Interp *interp, * our string's unicode characters. */ char *p; - unsigned int index; + NSUInteger index; Tcl_DStringInit(&_ds); Tcl_DStringSetLength(&_ds, 3 * [_string length]); @@ -550,7 +550,7 @@ TkpFontPkgInit( TkFont * TkpGetNativeFont( - Tk_Window tkwin, /* For display where font will be used. */ + TCL_UNUSED(Tk_Window), /* For display where font will be used. */ const char *name) /* Platform-specific font name. */ { MacFont *fontPtr = NULL; @@ -569,7 +569,7 @@ TkpGetNativeFont( ctFont = CTFontCreateUIFontForLanguage( HIThemeGetUIFontType(themeFontId), 0, NULL); if (ctFont) { - fontPtr = ckalloc(sizeof(MacFont)); + fontPtr = (MacFont *)ckalloc(sizeof(MacFont)); InitFont((NSFont*) ctFont, NULL, fontPtr); } @@ -637,7 +637,7 @@ TkpGetFontFromAttributes( Tcl_Panic("Could not determine NSFont from TkFontAttributes"); } if (tkFontPtr == NULL) { - fontPtr = ckalloc(sizeof(MacFont)); + fontPtr = (MacFont *)ckalloc(sizeof(MacFont)); } else { fontPtr = (MacFont *) tkFontPtr; TkpDeleteFont(tkFontPtr); @@ -699,7 +699,7 @@ TkpDeleteFont( void TkpGetFontFamilies( Tcl_Interp *interp, /* Interp to hold result. */ - Tk_Window tkwin) /* For display to query. */ + TCL_UNUSED(Tk_Window)) /* For display to query. */ { Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL); NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies]; @@ -772,7 +772,7 @@ TkpGetSubFonts( void TkpGetFontAttrsForChar( - Tk_Window tkwin, /* Window on the font's display */ + TCL_UNUSED(Tk_Window), /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes* faPtr) /* Output: Font attributes */ @@ -1162,7 +1162,7 @@ TkpDrawCharsInContext( void TkpDrawAngledCharsInContext( - Display *display, /* Display on which to draw. */ + TCL_UNUSED(Display *), /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must @@ -1206,6 +1206,7 @@ TkpDrawAngledCharsInContext( if (!string) { return; } + context = drawingContext.context; fg = TkMacOSXCreateCGColor(gc, gc->foreground); attributes = [fontPtr->nsAttributes mutableCopy]; @@ -1325,8 +1326,8 @@ TkMacOSXNSFontAttributesForFont( int TkMacOSXIsCharacterMissing( - Tk_Font tkfont, /* The font we are looking in. */ - unsigned int searchChar) /* The character we are looking for. */ + TCL_UNUSED(Tk_Font), /* The font we are looking in. */ + TCL_UNUSED(unsigned int)) /* The character we are looking for. */ { return 0; } @@ -1365,8 +1366,8 @@ TkMacOSXFontDescriptionForNSFontAndNSFontAttributes( NSStrikethroughStyleAttributeName]; objv[i++] = Tcl_NewStringObj(familyName, -1); - objv[i++] = Tcl_NewIntObj([nsFont pointSize]); -#define S(s) Tcl_NewStringObj(STRINGIFY(s),(int)(sizeof(STRINGIFY(s))-1)) + objv[i++] = Tcl_NewWideIntObj([nsFont pointSize]); +#define S(s) Tcl_NewStringObj(STRINGIFY(s), (sizeof(STRINGIFY(s))-1)) objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal); objv[i++] = (traits & NSItalicFontMask) ? S(italic) : S(roman); if ([underline respondsToSelector:@selector(intValue)] && diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 378c30e..b9bf3be 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -151,6 +151,7 @@ static int KeyDataToUnicode(UniChar *uniChars, int maxChars, @implementation TKApplication(TKKeyboard) - (void) keyboardChanged: (NSNotification *) notification { + (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #else @@ -662,7 +663,7 @@ XKeysymToKeycode( macKC.x.keychar = (unsigned int) data; hPtr = Tcl_FindHashEntry(&unichar2xvirtual, INT2PTR(macKC.x.keychar)); if (hPtr != NULL) { - unsigned long data = (unsigned long) Tcl_GetHashValue(hPtr); + data = (unsigned long) Tcl_GetHashValue(hPtr); macKC.x.xvirtual = (unsigned int) data; } } diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 8005517..3d5a996 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -36,19 +36,19 @@ #define SPECIALMENU(n, f) {.name = "." #n, .len = sl(#n) + 1, \ .flag = ENTRY_##f##_MENU } static const struct { - const char *name; const size_t len; const int flag; + const char *name; size_t len; int flag; } specialMenus[] = { SPECIALMENU(help, HELP), SPECIALMENU(apple, APPLE), SPECIALMENU(window, WINDOWS), - {NULL} + {NULL, 0, 0} }; #undef SPECIALMENU #define MODIFIER(n, f) {.name = #n, .len = sl(#n), .mask = f } static const struct { - const char *name; const size_t len; const NSUInteger mask; -} modifiers[] = { + const char *name; size_t len; NSUInteger mask; +} allModifiers[] = { MODIFIER(Control, NSControlKeyMask), MODIFIER(Ctrl, NSControlKeyMask), MODIFIER(Option, NSAlternateKeyMask), @@ -58,13 +58,13 @@ static const struct { MODIFIER(Command, NSCommandKeyMask), MODIFIER(Cmd, NSCommandKeyMask), MODIFIER(Meta, NSCommandKeyMask), - {NULL} + {NULL, 0, 0} }; #undef MODIFIER #define ACCEL(n, c) {.name = #n, .len = sl(#n), .ch = c } static const struct { - const char *name; const size_t len; const UniChar ch; + const char *name; size_t len; UniChar ch; } specialAccelerators[] = { ACCEL(PageUp, NSPageUpFunctionKey), ACCEL(PageDown, NSPageDownFunctionKey), @@ -86,7 +86,7 @@ static const struct { ACCEL(Help, NSHelpFunctionKey), ACCEL(Power, 0x233d), ACCEL(Eject, 0xf804), - {NULL} + {NULL, 0, 0} }; #undef ACCEL #undef sl @@ -348,6 +348,8 @@ TKBackgroundLoop *backgroundLoop = nil; - (BOOL) menuHasKeyEquivalent: (NSMenu *) menu forEvent: (NSEvent *) event target: (id *) target action: (SEL *) action { + (void)menu; + /* * Use lowercaseString when comparing keyEquivalents since the notion of * a shifted upper case letter does not make much sense. @@ -404,6 +406,8 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuWillOpen: (NSMenu *) menu { + (void)menu; + if (_tkMenu) { //RecursivelyClearActiveMenu(_tkMenu); GenerateMenuSelectEvent((TKMenu *)[self supermenu], @@ -413,6 +417,8 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuDidClose: (NSMenu *) menu { + (void)menu; + if (_tkMenu) { RecursivelyClearActiveMenu(_tkMenu); } @@ -420,6 +426,8 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menu: (NSMenu *) menu willHighlightItem: (NSMenuItem *) item { + (void)menu; + if (_tkMenu) { GenerateMenuSelectEvent(self, item); } @@ -428,6 +436,7 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuNeedsUpdate: (NSMenu *) menu { TkMenu *menuPtr = (TkMenu *) _tkMenu; + (void)menu; if (menuPtr) { Tcl_Interp *interp = menuPtr->interp; @@ -453,6 +462,7 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuBeginTracking: (NSNotification *) notification { + (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -468,6 +478,7 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuEndTracking: (NSNotification *) notification { + (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -701,7 +712,6 @@ TkpConfigureMenuEntry( image = TkMacOSXGetNSImageFromBitmap(mePtr->menuPtr->display, bitmap, gc, imageWidth, imageHeight); if (gc->foreground == defaultFg) { - // Use a semantic foreground color by default [image setTemplate:YES]; } } @@ -857,7 +867,7 @@ TkpDestroyMenuEntry( int TkpPostMenu( - Tcl_Interp *interp, /* The interpreter this menu lives in */ + TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, /* The screen coordinates where the top left * corner of the menu, or of the specified @@ -954,7 +964,7 @@ TkpPostMenu( int TkpPostTearoffMenu( - Tcl_Interp *interp, /* The interpreter this menu lives in */ + TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The screen coordinates where the top left * corner of the menu, or of the specified @@ -1217,18 +1227,18 @@ ParseAccelerator( *maskPtr = 0; while (1) { i = 0; - while (modifiers[i].name) { - int l = modifiers[i].len; + while (allModifiers[i].name) { + int l = allModifiers[i].len; - if (!strncasecmp(accel, modifiers[i].name, l) && + if (!strncasecmp(accel, allModifiers[i].name, l) && (accel[l] == '-' || accel[l] == '+')) { - *maskPtr |= modifiers[i].mask; + *maskPtr |= allModifiers[i].mask; accel += l+1; break; } i++; } - if (!modifiers[i].name || !*accel) { + if (!allModifiers[i].name || !*accel) { break; } } @@ -1452,14 +1462,14 @@ TkpComputeStandardMenuGeometry( } } else { NSUInteger modifMask = [menuItem keyEquivalentModifierMask]; - int i = 0; + int j = 0; - while (modifiers[i].name) { - if (modifMask & modifiers[i].mask) { - modifMask &= ~modifiers[i].mask; + while (allModifiers[j].name) { + if (modifMask & allModifiers[j].mask) { + modifMask &= ~allModifiers[j].mask; modifierWidth += modifierCharWidth; } - i++; + j++; } accelWidth = [[menuItem keyEquivalent] sizeWithAttributes: TkMacOSXNSFontAttributesForFont(tkfont)].width; @@ -1763,8 +1773,8 @@ TkpMenuThreadInit(void) void TkpMenuNotifyToplevelCreate( - Tcl_Interp *interp, /* The interp the menu lives in. */ - const char *menuName) /* The name of the menu to reconfigure. */ + TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */ + TCL_UNUSED(const char *)) /* The name of the menu to reconfigure. */ { /* * Nothing to do. @@ -1792,8 +1802,8 @@ TkpMenuNotifyToplevelCreate( void TkpInitializeMenuBindings( - Tcl_Interp *interp, /* The interpreter to set. */ - Tk_BindingTable bindingTable) + TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */ + TCL_UNUSED(Tk_BindingTable)) /* The table to add to. */ { /* @@ -1846,17 +1856,17 @@ TkpComputeMenubarGeometry( void TkpDrawMenuEntry( - TkMenuEntry *mePtr, /* The entry to draw */ - Drawable d, /* What to draw into */ - Tk_Font tkfont, /* Precalculated font for menu */ - const Tk_FontMetrics *menuMetricsPtr, + TCL_UNUSED(TkMenuEntry *), /* The entry to draw */ + TCL_UNUSED(Drawable), /* What to draw into */ + TCL_UNUSED(Tk_Font), /* Precalculated font for menu */ + TCL_UNUSED(const Tk_FontMetrics *), /* Precalculated metrics for menu */ - int x, /* X-coordinate of topleft of entry */ - int y, /* Y-coordinate of topleft of entry */ - int width, /* Width of the entry rectangle */ - int height, /* Height of the current rectangle */ - int strictMotif, /* Boolean flag */ - int drawArrow) /* Whether or not to draw the cascade arrow + TCL_UNUSED(int), /* X-coordinate of topleft of entry */ + TCL_UNUSED(int), /* Y-coordinate of topleft of entry */ + TCL_UNUSED(int), /* Width of the entry rectangle */ + TCL_UNUSED(int), /* Height of the current rectangle */ + TCL_UNUSED(int), /* Boolean flag */ + TCL_UNUSED(int)) /* Whether or not to draw the cascade arrow * for cascade items. */ { } @@ -1905,7 +1915,7 @@ TkMacOSXPreprocessMenu(void) int TkMacOSXUseMenuID( - short macID) /* The id to take out of the table */ + TCL_UNUSED(short)) /* The id to take out of the table */ { return TCL_OK; } @@ -1928,8 +1938,8 @@ TkMacOSXUseMenuID( int TkMacOSXDispatchMenuEvent( - int menuID, /* The menu id of the menu we are invoking */ - int index) /* The one-based index of the item that was + TCL_UNUSED(int), /* The menu id of the menu we are invoking */ + TCL_UNUSED(int)) /* The one-based index of the item that was * selected. */ { return TCL_ERROR; diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 8cb3e15..4c07557 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -103,11 +103,11 @@ * debug message in case of failure. */ #define ChkErr(f, ...) ({ \ - OSStatus err = f(__VA_ARGS__); \ - if (err != noErr) { \ - TkMacOSXDbgOSErr(f, err); \ + OSStatus err_ = f(__VA_ARGS__); \ + if (err_ != noErr) { \ + TkMacOSXDbgOSErr(f, err_); \ } \ - err;}) + err_;}) #else /* TK_MAC_DEBUG */ #define TKLog(f, ...) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 87ec507..1e7797d 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -169,7 +169,7 @@ static inline CGRect BoxToRect( */ static Ttk_StateTable ThemeStateTable[] = { - {kThemeStateActive, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND}, + {kThemeStateActive, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeStateUnavailable, TTK_STATE_DISABLED, 0}, {kThemeStatePressed, TTK_STATE_PRESSED, 0}, {kThemeStateInactive, TTK_STATE_BACKGROUND, 0}, @@ -232,11 +232,11 @@ static CGRect NormalizeButtonBounds( * support Dark Mode anyway. */ -static CGFloat windowBackground[4] = { +static const CGFloat WINDOWBACKGROUND[4] = { 235.0 / 255, 235.0 / 255, 235.0 / 255, 1.0 }; -static CGFloat whiteRGBA[4] = {1.0, 1.0, 1.0, 1.0}; -static CGFloat blackRGBA[4] = {0.0, 0.0, 0.0, 1.0}; +static const CGFloat WHITERGBA[4] = {1.0, 1.0, 1.0, 1.0}; +static const CGFloat BLACKRGBA[4] = {0.0, 0.0, 0.0, 1.0}; /*---------------------------------------------------------------------- * GetBackgroundColor -- @@ -276,7 +276,7 @@ static void GetBackgroundColor( [windowColor getComponents: rgba]; } else { for (int i = 0; i < 4; i++) { - rgba[i] = windowBackground[i]; + rgba[i] = WINDOWBACKGROUND[i]; } } } @@ -314,7 +314,7 @@ static void DrawDownArrow( CGRect bounds, CGFloat inset, CGFloat size, - CGFloat *rgba) + const CGFloat *rgba) { CGFloat x, y; @@ -336,7 +336,7 @@ static void DrawUpArrow( CGRect bounds, CGFloat inset, CGFloat size, - CGFloat *rgba) + const CGFloat *rgba) { CGFloat x, y; @@ -406,7 +406,7 @@ static void DrawUpDownArrows( CGRect bounds, CGFloat inset, CGFloat size, - CGFloat *rgba) + const CGFloat *rgba) { CGFloat x, y; @@ -633,9 +633,9 @@ static void DrawListHeader( arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16; arrowBounds.size.width = 16; if (state & TTK_STATE_ALTERNATE) { - DrawUpArrow(context, arrowBounds, 3, 8, blackRGBA); + DrawUpArrow(context, arrowBounds, 3, 8, BLACKRGBA); } else if (state & TTK_STATE_SELECTED) { - DrawDownArrow(context, arrowBounds, 3, 8, blackRGBA); + DrawDownArrow(context, arrowBounds, 3, 8, BLACKRGBA); } } } @@ -757,9 +757,9 @@ static void DrawDarkButton( darkSelectedGradient, 2); } if (kind == kThemePopupButton) { - DrawUpDownArrows(context, arrowBounds, 3, 7, whiteRGBA); + DrawUpDownArrows(context, arrowBounds, 3, 7, WHITERGBA); } else { - DrawDownArrow(context, arrowBounds, 4, 8, whiteRGBA); + DrawDownArrow(context, arrowBounds, 4, 8, WHITERGBA); } } @@ -818,7 +818,7 @@ static void DrawDarkIncDecButton( darkSelectedGradient, 2); CGContextRestoreGState(context); } - DrawUpDownArrows(context, bounds, 3, 5, whiteRGBA); + DrawUpDownArrows(context, bounds, 3, 5, WHITERGBA); HighlightButtonBorder(context, bounds); } @@ -1245,9 +1245,9 @@ static void DrawDarkListHeader( arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16; arrowBounds.size.width = 16; if (state & TTK_STATE_ALTERNATE) { - DrawUpArrow(context, arrowBounds, 3, 8, whiteRGBA); + DrawUpArrow(context, arrowBounds, 3, 8, WHITERGBA); } else if (state & TTK_STATE_SELECTED) { - DrawDownArrow(context, arrowBounds, 3, 8, whiteRGBA); + DrawDownArrow(context, arrowBounds, 3, 8, WHITERGBA); } } } @@ -1277,7 +1277,7 @@ static ThemeButtonParams ListHeaderParams = {kThemeListHeaderButton, kThemeMetricListHeaderHeight}; static Ttk_StateTable ButtonValueTable[] = { - {kThemeButtonOff, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND}, + {kThemeButtonOff, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeButtonMixed, TTK_STATE_ALTERNATE, 0}, {kThemeButtonOn, TTK_STATE_SELECTED, 0}, {kThemeButtonOff, 0, 0} @@ -1306,7 +1306,7 @@ static Ttk_StateTable ButtonAdornmentTable[] = { static inline HIThemeButtonDrawInfo computeButtonDrawInfo( ThemeButtonParams *params, Ttk_State state, - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { /* @@ -1342,13 +1342,13 @@ static inline HIThemeButtonDrawInfo computeButtonDrawInfo( static void ButtonElementMinSize( void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { - ThemeButtonParams *params = clientData; + ThemeButtonParams *params = (ThemeButtonParams *)clientData; if (params->heightMetric != NoThemeMetric) { ChkErr(GetThemeMetric, params->heightMetric, minHeight); @@ -1420,7 +1420,7 @@ static void ButtonElementSize( static void ButtonElementDraw( void *clientData, - void *elementRecord, + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1510,25 +1510,25 @@ static Ttk_ElementSpec ButtonElementSpec = { /* Tab position logic, c.f. ttkNotebook.c TabState() */ static Ttk_StateTable TabStyleTable[] = { - {kThemeTabFrontInactive, TTK_STATE_SELECTED | TTK_STATE_BACKGROUND}, - {kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND}, - {kThemeTabFrontUnavailable, TTK_STATE_DISABLED | TTK_STATE_SELECTED}, - {kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED}, - {kThemeTabFront, TTK_STATE_SELECTED}, - {kThemeTabNonFrontPressed, TTK_STATE_PRESSED}, - {kThemeTabNonFront, 0} + {kThemeTabFrontInactive, TTK_STATE_SELECTED | TTK_STATE_BACKGROUND, 0}, + {kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND, 0}, + {kThemeTabFrontUnavailable, TTK_STATE_DISABLED | TTK_STATE_SELECTED, 0}, + {kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED, 0}, + {kThemeTabFront, TTK_STATE_SELECTED, 0}, + {kThemeTabNonFrontPressed, TTK_STATE_PRESSED, 0}, + {kThemeTabNonFront, 0, 0} }; static Ttk_StateTable TabAdornmentTable[] = { - {kHIThemeTabAdornmentNone, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB}, - {kHIThemeTabAdornmentTrailingSeparator, TTK_STATE_FIRST_TAB}, - {kHIThemeTabAdornmentNone, TTK_STATE_LAST_TAB}, - {kHIThemeTabAdornmentTrailingSeparator, 0}, + {kHIThemeTabAdornmentNone, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabAdornmentTrailingSeparator, TTK_STATE_FIRST_TAB, 0}, + {kHIThemeTabAdornmentNone, TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabAdornmentTrailingSeparator, 0, 0}, }; static Ttk_StateTable TabPositionTable[] = { - {kHIThemeTabPositionOnly, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB}, - {kHIThemeTabPositionFirst, TTK_STATE_FIRST_TAB}, - {kHIThemeTabPositionLast, TTK_STATE_LAST_TAB}, - {kHIThemeTabPositionMiddle, 0}, + {kHIThemeTabPositionOnly, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabPositionFirst, TTK_STATE_FIRST_TAB, 0}, + {kHIThemeTabPositionLast, TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabPositionMiddle, 0, 0}, }; /* @@ -1572,10 +1572,10 @@ static Ttk_StateTable TabPositionTable[] = { */ static void TabElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), int *minHeight, Ttk_Padding *paddingPtr) { @@ -1585,8 +1585,8 @@ static void TabElementSize( } static void TabElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1626,19 +1626,19 @@ static Ttk_ElementSpec TabElementSpec = { */ static void PaneElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, - int *minHeight, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), + TCL_UNUSED(int *), Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(9, 5, 9, 9); } static void PaneElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1687,19 +1687,19 @@ static Ttk_ElementSpec PaneElementSpec = { */ static void GroupElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, - int *minHeight, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), + TCL_UNUSED(int *), Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(4); } static void GroupElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1748,22 +1748,22 @@ static Ttk_ElementOptionSpec EntryElementOptions[] = { Tk_Offset(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND}, {"-fieldbackground", TK_OPTION_BORDER, Tk_Offset(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND}, - {0} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void EntryElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, - int *minHeight, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), + TCL_UNUSED(int *), Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(7, 5, 7, 6); } static void EntryElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, @@ -1875,9 +1875,9 @@ static Ttk_ElementSpec EntryElementSpec = { static Ttk_Padding ComboboxPadding = {4, 2, 20, 2}; static void ComboboxElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) @@ -1888,8 +1888,8 @@ static void ComboboxElementSize( } static void ComboboxElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1953,12 +1953,12 @@ static Ttk_ElementSpec ComboboxElementSpec = { static Ttk_Padding SpinbuttonMargins = {0, 0, 2, 0}; static void SpinButtonUpElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { SInt32 s; @@ -1969,8 +1969,8 @@ static void SpinButtonUpElementSize( } static void SpinButtonUpElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2010,12 +2010,12 @@ static Ttk_ElementSpec SpinButtonUpElementSpec = { SpinButtonUpElementDraw }; static void SpinButtonDownElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { SInt32 s; @@ -2026,8 +2026,8 @@ static void SpinButtonDownElementSize( } static void SpinButtonDownElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2104,21 +2104,21 @@ typedef struct { } TrackElement; static Ttk_ElementOptionSpec TrackElementOptions[] = { - {"-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, fromObj)}, - {"-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, toObj)}, - {"-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, valueObj)}, - {"-orient", TK_OPTION_STRING, Tk_Offset(TrackElement, orientObj)}, - {0, 0, 0} + {"-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, fromObj), NULL}, + {"-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, toObj), NULL}, + {"-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, valueObj), NULL}, + {"-orient", TK_OPTION_STRING, Tk_Offset(TrackElement, orientObj), NULL}, + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void TrackElementSize( void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { - TrackElementData *data = clientData; + TrackElementData *data = (TrackElementData *)clientData; SInt32 size = 24; /* reasonable default ... */ ChkErr(GetThemeMetric, data->thicknessMetric, &size); @@ -2137,6 +2137,7 @@ static void TrackElementDraw( TrackElement *elem = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; double from = 0, to = 100, value = 0, factor; + CGRect bounds; Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from); @@ -2149,7 +2150,7 @@ static void TrackElementDraw( * bounds variable avoids UBSan (-fsanitize=alignment) complaints. */ - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); HIThemeTrackDrawInfo info = { .version = 0, .kind = data->kind, @@ -2175,7 +2176,7 @@ static void TrackElementDraw( } BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB components: darkTrack @@ -2209,12 +2210,12 @@ static Ttk_ElementSpec TrackElementSpec = { */ static void SliderElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { *minWidth = *minHeight = 24; } @@ -2254,15 +2255,15 @@ static Ttk_ElementOptionSpec PbarElementOptions[] = { Tk_Offset(PbarElement, phaseObj), "0"}, {"-mode", TK_OPTION_STRING, Tk_Offset(PbarElement, modeObj), "determinate"}, - {0, 0, 0, 0} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void PbarElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { SInt32 size = 24; /* @@@ Check HIG for correct default */ @@ -2271,7 +2272,7 @@ static void PbarElementSize( } static void PbarElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, @@ -2281,6 +2282,7 @@ static void PbarElementDraw( PbarElement *pbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL, phase = 0; double value = 0, maximum = 100, factor; + CGRect bounds; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); @@ -2293,7 +2295,7 @@ static void PbarElementDraw( * bounds variable avoids UBSan (-fsanitize=alignment) complaints. */ - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); HIThemeTrackDrawInfo info = { .version = 0, .kind = @@ -2313,7 +2315,7 @@ static void PbarElementDraw( BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB components: darkTrack @@ -2349,12 +2351,12 @@ typedef struct static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { {"-orient", TK_OPTION_STRING, Tk_Offset(ScrollbarElement, orientObj), "horizontal"}, - {0, 0, 0, 0} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void TroughElementSize( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) @@ -2393,12 +2395,12 @@ static CGFloat darkActiveThumb[4] = { 158.0 / 255, 158.0 / 255, 159.0 / 255, 1.0 }; static void TroughElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, - Ttk_State state) + TCL_UNUSED(Ttk_State)) { ScrollbarElement *scrollbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; @@ -2435,12 +2437,12 @@ static Ttk_ElementSpec TroughElementSpec = { TroughElementDraw }; static void ThumbElementSize( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { ScrollbarElement *scrollbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; @@ -2456,7 +2458,7 @@ static void ThumbElementSize( } static void ThumbElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, @@ -2571,12 +2573,12 @@ static Ttk_ElementSpec ThumbElementSpec = { ThumbElementDraw }; static void ArrowElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { if ([NSApp macOSVersion] < 100800) { *minHeight = *minWidth = 14; @@ -2602,19 +2604,19 @@ static Ttk_ElementSpec ArrowElementSpec = { */ static void SeparatorElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { *minWidth = *minHeight = 1; } static void SeparatorElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2654,12 +2656,12 @@ static const ThemeGrowDirection sizegripGrowDirection = kThemeGrowRight | kThemeGrowDown; static void SizegripElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { HIThemeGrowBoxDrawInfo info = { .version = 0, @@ -2676,9 +2678,9 @@ static void SizegripElementSize( } static void SizegripElementDraw( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), Drawable d, Ttk_Box b, unsigned int state) @@ -2753,8 +2755,8 @@ static Ttk_ElementSpec SizegripElementSpec = { */ static void FillElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2791,7 +2793,7 @@ static void BackgroundElementDraw( void *elementRecord, Tk_Window tkwin, Drawable d, - Ttk_Box b, + TCL_UNUSED(Ttk_Box), unsigned int state) { FillElementDraw(clientData, elementRecord, tkwin, d, Ttk_WinBox(tkwin), @@ -2828,12 +2830,12 @@ static Ttk_ElementSpec BackgroundElementSpec = { */ static void ToolbarBackgroundElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, - Ttk_Box b, - Ttk_State state) + TCL_UNUSED(Ttk_Box), + TCL_UNUSED(Ttk_State)) { ThemeBrush brush = kThemeBrushToolbarBackground; CGRect bounds = BoxToRect(d, Ttk_WinBox(tkwin)); @@ -2867,16 +2869,16 @@ typedef struct { static Ttk_ElementOptionSpec FieldElementOptions[] = { {"-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement, backgroundObj), "white"}, - {NULL, 0, 0, NULL} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void FieldElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, - Ttk_State state) + TCL_UNUSED(Ttk_State)) { FieldElement *e = elementRecord; Tk_3DBorder backgroundPtr = @@ -2904,28 +2906,28 @@ static Ttk_ElementSpec FieldElementSpec = { */ static Ttk_StateTable TreeHeaderValueTable[] = { - {kThemeButtonOn, TTK_STATE_ALTERNATE}, - {kThemeButtonOn, TTK_STATE_SELECTED}, - {kThemeButtonOff, 0} + {kThemeButtonOn, TTK_STATE_ALTERNATE, 0}, + {kThemeButtonOn, TTK_STATE_SELECTED, 0}, + {kThemeButtonOff, 0, 0} }; static Ttk_StateTable TreeHeaderAdornmentTable[] = { {kThemeAdornmentHeaderButtonSortUp, - TTK_STATE_ALTERNATE | TTK_TREEVIEW_STATE_SORTARROW}, + TTK_STATE_ALTERNATE | TTK_TREEVIEW_STATE_SORTARROW, 0}, {kThemeAdornmentDefault, - TTK_STATE_SELECTED | TTK_TREEVIEW_STATE_SORTARROW}, - {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_ALTERNATE}, - {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_SELECTED}, - {kThemeAdornmentFocus, TTK_STATE_FOCUS}, - {kThemeAdornmentNone, 0} + TTK_STATE_SELECTED | TTK_TREEVIEW_STATE_SORTARROW, 0}, + {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_ALTERNATE, 0}, + {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_SELECTED, 0}, + {kThemeAdornmentFocus, TTK_STATE_FOCUS, 0}, + {kThemeAdornmentNone, 0, 0} }; static void TreeAreaElementSize ( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, - int *minHeight, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), + TCL_UNUSED(int *), Ttk_Padding *paddingPtr) { @@ -2964,7 +2966,7 @@ static void TreeHeaderElementSize( static void TreeHeaderElementDraw( void *clientData, - void *elementRecord, + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -3020,12 +3022,12 @@ static Ttk_StateTable DisclosureValueTable[] = { {kThemeDisclosureRight, 0, 0}, }; static void DisclosureElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { SInt32 s; @@ -3036,8 +3038,8 @@ static void DisclosureElementSize( } static void DisclosureElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, -- cgit v0.12 From 40174136d5d646395c582fb62ee167c984c101a1 Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 2 Oct 2020 19:49:57 +0000 Subject: Backout code changes, improve documentation. --- doc/bind.n | 3 ++- generic/tkCmds.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/bind.n b/doc/bind.n index 87940e8..db89eae 100644 --- a/doc/bind.n +++ b/doc/bind.n @@ -283,7 +283,8 @@ it is destroyed. When the \fBDestroy\fR event is delivered to a widget, it is in a .QW half-dead -state: the widget still exists, but most operations on it will fail. +state: the widget still exists, but most operations on it will behave +in an undefined manner, and/or return arbitrary results. .RE .IP "\fBFocusIn\fR, \fBFocusOut\fR" 5 The \fBFocusIn\fR and \fBFocusOut\fR events are generated diff --git a/generic/tkCmds.c b/generic/tkCmds.c index b8b1d3e..193c3d6 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1689,7 +1689,10 @@ Tk_WinfoObjCmd( winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); Tcl_ResetResult(interp); - alive = (winPtr != NULL); + alive = 1; + if ((winPtr == NULL) || (winPtr->flags & TK_ALREADY_DEAD)) { + alive = 0; + } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(alive)); break; } -- cgit v0.12 From 4aac16b3acabf0ecbe29c13ca92830022105f23e Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 4 Oct 2020 19:31:08 +0000 Subject: Remove duplicate line introduced in [c1f5badf]. That line had already been added in [07ff4144] when dealing with geometry management loops. --- generic/tkGeometry.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 5ecac0e..013347b 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -426,7 +426,6 @@ Tk_MaintainGeometry( ((TkWindow *)window)->maintainerPtr = (TkWindow *)container; - ((TkWindow *)window)->maintainerPtr = (TkWindow *)container; if (container == Tk_Parent(window)) { /* * If the window is a direct descendant of the container, don't bother @@ -574,7 +573,6 @@ Tk_UnmaintainGeometry( ((TkWindow *)window)->maintainerPtr = NULL; - ((TkWindow *)window)->maintainerPtr = NULL; if (container == Tk_Parent(window)) { /* * If the window is a direct descendant of the container, -- cgit v0.12 From 91500fc2feafa36fe71ce1453075b73386d16e34 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 5 Oct 2020 07:40:06 +0000 Subject: Let Travis builds fail when X11 tests on Ubuntu fail --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index da271b1..f52dc1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,7 @@ jobs: - make install - make test-classic >out-classic.txt - cat out-classic.txt + - grep -q "Failed 0" out-classic.txt - make test-ttk >out-ttk.txt - cat out-ttk.txt - grep -q "Failed 0" out-ttk.txt -- cgit v0.12 From 121af720bc29f65b64fcdcf520cb2d00368eb258 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 5 Oct 2020 07:56:33 +0000 Subject: Fix many warnings related to the -Wshadow gcc compiler flag --- generic/tkCanvArc.c | 46 ++++++++++----------- generic/tkCanvLine.c | 61 ++++++++++++--------------- generic/tkCanvPoly.c | 29 +++++++------ generic/tkCanvText.c | 30 +++++++------- generic/tkCanvas.c | 75 +++++++++++++++------------------ generic/tkGrid.c | 33 +++++++-------- generic/tkImage.c | 2 - generic/tkImgPPM.c | 23 +++++------ generic/tkImgPhoto.c | 59 +++++++++++++------------- generic/tkPanedWindow.c | 85 +++++++++++++++++++------------------- generic/tkScrollbar.c | 16 +++---- generic/tkTest.c | 103 +++++++++++++++++++--------------------------- generic/tkText.c | 8 ++-- generic/tkTextBTree.c | 12 ++---- generic/tkTextWind.c | 2 - generic/ttk/ttkNotebook.c | 10 ++--- unix/tkUnixButton.c | 14 +++---- unix/tkUnixMenu.c | 75 ++++++++++++++++----------------- unix/tkUnixMenubu.c | 8 ++-- unix/tkUnixSelect.c | 58 +++++++++++++------------- 20 files changed, 346 insertions(+), 403 deletions(-) diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index c93b95a..ccfe116 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -352,8 +352,8 @@ ArcCoords( objs[2] = Tcl_NewDoubleObj(arcPtr->bbox[2]); objs[3] = Tcl_NewDoubleObj(arcPtr->bbox[3]); Tcl_SetObjResult(interp, Tcl_NewListObj(4, objs)); - } else if ((objc == 1)||(objc == 4)) { - if (objc==1) { + } else if ((objc == 1) || (objc == 4)) { + if (objc == 1) { if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; @@ -510,7 +510,7 @@ ConfigureArc( if (arcPtr->disabledFillStipple!=None) { stipple = arcPtr->disabledFillStipple; } - } + } if (arcPtr->style == ARC_STYLE) { newGC = NULL; @@ -576,11 +576,11 @@ ConfigureArc( static void DeleteArc( - Tk_Canvas canvas, /* Info about overall canvas. */ + TCL_UNUSED(Tk_Canvas), /* Info about overall canvas. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { - ArcItem *arcPtr = (ArcItem *) itemPtr; + ArcItem *arcPtr = (ArcItem *)itemPtr; Tk_DeleteOutline(display, &(arcPtr->outline)); if (arcPtr->numOutlinePoints != 0) { @@ -626,7 +626,6 @@ DeleteArc( *-------------------------------------------------------------- */ - /* ARGSUSED */ static void ComputeArcBbox( Tk_Canvas canvas, /* Canvas that contains item. */ @@ -663,13 +662,13 @@ ComputeArcBbox( */ if (arcPtr->bbox[1] > arcPtr->bbox[3]) { - double tmp = arcPtr->bbox[3]; + tmp = arcPtr->bbox[3]; arcPtr->bbox[3] = arcPtr->bbox[1]; arcPtr->bbox[1] = tmp; } if (arcPtr->bbox[0] > arcPtr->bbox[2]) { - double tmp = arcPtr->bbox[2]; + tmp = arcPtr->bbox[2]; arcPtr->bbox[2] = arcPtr->bbox[0]; arcPtr->bbox[0] = tmp; @@ -678,7 +677,7 @@ ComputeArcBbox( ComputeArcOutline(canvas,arcPtr); /* - * To compute the bounding box, start with the the bbox formed by the two + * To compute the bounding box, start with the bbox formed by the two * endpoints of the arc. Then add in the center of the arc's oval (if * relevant) and the 3-o'clock, 6-o'clock, 9-o'clock, and 12-o'clock * positions, if they are relevant. @@ -769,8 +768,10 @@ DisplayArc( Tk_Item *itemPtr, /* Item to be displayed. */ Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ - int x, int y, /* Describes region of canvas that must be */ - int width, int height) /* redisplayed (not used). */ + TCL_UNUSED(int), /* Describes region of canvas that must be */ + TCL_UNUSED(int), /* redisplayed (not used). */ + TCL_UNUSED(int), + TCL_UNUSED(int)) { ArcItem *arcPtr = (ArcItem *) itemPtr; short x1, y1, x2, y2; @@ -942,7 +943,6 @@ DisplayArc( *-------------------------------------------------------------- */ - /* ARGSUSED */ static double ArcToPoint( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1107,7 +1107,6 @@ ArcToPoint( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int ArcToArea( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1447,7 +1446,7 @@ ComputeArcOutline( */ if (arcPtr->numOutlinePoints == 0) { - arcPtr->outlinePtr = ckalloc(26 * sizeof(double)); + arcPtr->outlinePtr = (double *)ckalloc(26 * sizeof(double)); arcPtr->numOutlinePoints = 22; } outlinePtr = arcPtr->outlinePtr; @@ -1461,7 +1460,7 @@ ComputeArcOutline( * curved arc segment, which are marked with X's in the figure below: * * - * * * * + * * * * * * * * * * * * * * * * * @@ -1814,7 +1813,7 @@ ArcToPostscript( Tcl_Interp *interp, /* Leave Postscript or error message here. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ - int prepass) /* 1 means this is a prepass to collect font + TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { @@ -2028,17 +2027,16 @@ ArcToPostscript( static int StyleParseProc( - ClientData clientData, /* some flags.*/ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { int c; size_t length; - - register Style *stylePtr = (Style *) (widgRec + offset); + Style *stylePtr = (Style *) (widgRec + offset); if (value == NULL || *value == 0) { *stylePtr = PIESLICE_STYLE; @@ -2092,15 +2090,15 @@ StyleParseProc( static const char * StylePrintProc( - ClientData clientData, /* Ignored. */ - Tk_Window tkwin, /* Ignored. */ + TCL_UNUSED(void *), /* Ignored. */ + TCL_UNUSED(Tk_Window), /* Ignored. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ - Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with + TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { - register Style *stylePtr = (Style *) (widgRec + offset); + Style *stylePtr = (Style *) (widgRec + offset); if (*stylePtr == ARC_STYLE) { return "arc"; diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index 7e74942..ba7753e 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -406,7 +406,7 @@ LineCoords( numPoints = objc/2; if (linePtr->numPoints != numPoints) { - coordPtr = ckalloc(sizeof(double) * objc); + coordPtr = (double *)ckalloc(sizeof(double) * objc); if (linePtr->coordPtr != NULL) { ckfree(linePtr->coordPtr); } @@ -602,7 +602,7 @@ ConfigureLine( static void DeleteLine( - Tk_Canvas canvas, /* Info about overall canvas widget. */ + TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { @@ -706,7 +706,7 @@ ComputeLineBbox( tsoffset = &linePtr->outline.tsoffset; if (tsoffset->flags & TK_OFFSET_INDEX) { - double *coordPtr = linePtr->coordPtr + coordPtr = linePtr->coordPtr + (tsoffset->flags & ~TK_OFFSET_INDEX); if (tsoffset->flags <= 0) { @@ -830,9 +830,10 @@ DisplayLine( Tk_Item *itemPtr, /* Item to be displayed. */ Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ - int x, int y, int width, int height) - /* Describes region of canvas that must be - * redisplayed (not used). */ + TCL_UNUSED(int), /* Describes region of canvas that must be */ + TCL_UNUSED(int), /* redisplayed (not used). */ + TCL_UNUSED(int), + TCL_UNUSED(int)) { LineItem *linePtr = (LineItem *) itemPtr; XPoint staticPoints[MAX_STATIC_POINTS*3]; @@ -875,7 +876,7 @@ DisplayLine( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * 3 * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * 3 * sizeof(XPoint)); } if ((linePtr->smooth) && (linePtr->numPoints > 2)) { @@ -984,7 +985,7 @@ LineInsert( linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0]; linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1]; } - newCoordPtr = ckalloc(sizeof(double) * (length + objc)); + newCoordPtr = (double *)ckalloc(sizeof(double) * (length + objc)); for (i=0; icoordPtr[i]; } @@ -1319,7 +1320,6 @@ LineDeleteCoords( *-------------------------------------------------------------- */ - /* ARGSUSED */ static double LineToPoint( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1365,7 +1365,7 @@ LineToPoint( if (numPoints <= MAX_STATIC_POINTS) { linePoints = staticSpace; } else { - linePoints = ckalloc(2 * numPoints * sizeof(double)); + linePoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, linePoints); @@ -1547,7 +1547,6 @@ LineToPoint( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int LineToArea( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1600,7 +1599,7 @@ LineToArea( if (numPoints <= MAX_STATIC_POINTS) { linePoints = staticSpace; } else { - linePoints = ckalloc(2 * numPoints * sizeof(double)); + linePoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, linePoints); @@ -1695,8 +1694,6 @@ ScaleLine( linePtr->firstArrowPtr = NULL; } if (linePtr->lastArrowPtr != NULL) { - int i; - i = 2*(linePtr->numPoints-1); linePtr->coordPtr[i] = linePtr->lastArrowPtr[0]; linePtr->coordPtr[i+1] = linePtr->lastArrowPtr[1]; @@ -1873,12 +1870,11 @@ TranslateLine( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int ParseArrowShape( - ClientData clientData, /* Not used. */ + TCL_UNUSED(void *), /* Not used. */ Tcl_Interp *interp, /* Used for error reporting. */ - Tk_Window tkwin, /* Not used. */ + TCL_UNUSED(Tk_Window), /* Not used. */ const char *value, /* Textual specification of arrow shape. */ char *recordPtr, /* Pointer to item record in which to store * arrow information. */ @@ -1942,14 +1938,13 @@ ParseArrowShape( *-------------------------------------------------------------- */ - /* ARGSUSED */ static const char * PrintArrowShape( - ClientData clientData, /* Not used. */ - Tk_Window tkwin, /* Window associated with linePtr's widget. */ + TCL_UNUSED(void *), /* Not used. */ + TCL_UNUSED(Tk_Window), /* Window associated with linePtr's widget. */ char *recordPtr, /* Pointer to item record containing current * shape information. */ - int offset, /* Offset of arrow information in record. */ + TCL_UNUSED(int), /* Offset of arrow information in record. */ Tcl_FreeProc **freeProcPtr) /* Store address of function to call to free * string here. */ { @@ -1982,17 +1977,16 @@ PrintArrowShape( static int ArrowParseProc( - ClientData clientData, /* some flags.*/ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { int c; size_t length; - - register Arrows *arrowPtr = (Arrows *) (widgRec + offset); + Arrows *arrowPtr = (Arrows *) (widgRec + offset); if (value == NULL || *value == 0) { *arrowPtr = ARROWS_NONE; @@ -2050,15 +2044,15 @@ ArrowParseProc( static const char * ArrowPrintProc( - ClientData clientData, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), /* Ignored. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ - Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with + TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { - register Arrows *arrowPtr = (Arrows *) (widgRec + offset); + Arrows *arrowPtr = (Arrows *) (widgRec + offset); switch (*arrowPtr) { case ARROWS_FIRST: @@ -2092,7 +2086,6 @@ ArrowPrintProc( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int ConfigureArrows( Tk_Canvas canvas, /* Canvas in which arrows will be displayed @@ -2153,7 +2146,7 @@ ConfigureArrows( if (linePtr->arrow != ARROWS_LAST) { poly = linePtr->firstArrowPtr; if (poly == NULL) { - poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double)); + poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double)); poly[0] = poly[10] = linePtr->coordPtr[0]; poly[1] = poly[11] = linePtr->coordPtr[1]; linePtr->firstArrowPtr = poly; @@ -2197,7 +2190,7 @@ ConfigureArrows( coordPtr = linePtr->coordPtr + 2*(linePtr->numPoints-2); poly = linePtr->lastArrowPtr; if (poly == NULL) { - poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double)); + poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double)); poly[0] = poly[10] = coordPtr[2]; poly[1] = poly[11] = coordPtr[3]; linePtr->lastArrowPtr = poly; @@ -2254,7 +2247,7 @@ LineToPostscript( Tcl_Interp *interp, /* Leave Postscript or error message here. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ - int prepass) /* 1 means this is a prepass to collect font + TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { @@ -2366,7 +2359,7 @@ LineToPostscript( linePtr->numPoints, linePtr->splineSteps, NULL, NULL); pointPtr = staticPoints; if (numPoints > MAX_STATIC_POINTS) { - pointPtr = ckalloc(numPoints * 2 * sizeof(double)); + pointPtr = (double *)ckalloc(numPoints * 2 * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr); diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index a537846..513613d 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -376,7 +376,7 @@ PolygonCoords( * another point to close the polygon. */ - polyPtr->coordPtr = ckalloc(sizeof(double) * (objc+2)); + polyPtr->coordPtr = (double *)ckalloc(sizeof(double) * (objc+2)); polyPtr->pointsAllocated = numPoints+1; } for (i = objc-1; i >= 0; i--) { @@ -564,7 +564,7 @@ ConfigurePolygon( static void DeletePolygon( - Tk_Canvas canvas, /* Info about overall canvas widget. */ + TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { @@ -825,7 +825,7 @@ TkFillPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint)); } for (i=0, pPtr=pointPtr ; istate; @@ -971,7 +972,7 @@ DisplayPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL); @@ -998,7 +999,7 @@ DisplayPolygon( * * PolygonInsert -- * - * Insert coords into a polugon item at a given index. + * Insert coords into a polygon item at a given index. * * Results: * None. @@ -1038,7 +1039,7 @@ PolygonInsert( while (beforeThis < 0) { beforeThis += length; } - newCoordPtr = ckalloc(sizeof(double) * (length + 2 + objc)); + newCoordPtr = (double *)ckalloc(sizeof(double) * (length + 2 + objc)); for (i=0; icoordPtr[i]; } @@ -1240,7 +1241,6 @@ PolygonDeleteCoords( *-------------------------------------------------------------- */ - /* ARGSUSED */ static double PolygonToPoint( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1288,7 +1288,7 @@ PolygonToPoint( if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = ckalloc(2 * numPoints * sizeof(double)); + polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); @@ -1430,7 +1430,6 @@ PolygonToPoint( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int PolygonToArea( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1497,7 +1496,7 @@ PolygonToArea( if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = ckalloc(2 * numPoints * sizeof(double)); + polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); @@ -1667,7 +1666,7 @@ ScalePolygon( static int GetPolygonIndex( Tcl_Interp *interp, /* Used for error reporting. */ - Tk_Canvas canvas, /* Canvas containing item. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in @@ -1797,7 +1796,7 @@ PolygonToPostscript( Tcl_Interp *interp, /* Leave Postscript or error message here. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ - int prepass) /* 1 means this is a prepass to collect font + TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 9a27efc..0945857 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -1031,8 +1031,8 @@ TextInsert( return; } - newStr = ckalloc(textPtr->numBytes + byteCount + 1); - memcpy(newStr, text, (size_t) byteIndex); + newStr = (char *)ckalloc(textPtr->numBytes + byteCount + 1); + memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, string); strcpy(newStr + byteIndex + byteCount, text + byteIndex); @@ -1112,8 +1112,8 @@ TextDeleteChars( byteCount = TkUtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); - newStr = ckalloc(textPtr->numBytes + 1 - byteCount); - memcpy(newStr, text, (size_t) byteIndex); + newStr = (char *)ckalloc(textPtr->numBytes + 1 - byteCount); + memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, text + byteIndex + byteCount); ckfree(text); @@ -1267,7 +1267,6 @@ TextToArea( *-------------------------------------------------------------- */ - /* ARGSUSED */ static void ScaleText( Tk_Canvas canvas, /* Canvas containing rectangle. */ @@ -1338,7 +1337,7 @@ TranslateText( static int GetTextIndex( Tcl_Interp *interp, /* Used for error reporting. */ - Tk_Canvas canvas, /* Canvas containing item. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular character in @@ -1354,13 +1353,13 @@ GetTextIndex( c = string[0]; - if ((c == 'e') && (strncmp(string, "end", (unsigned) length) == 0)) { + if ((c == 'e') && (strncmp(string, "end", length) == 0)) { *indexPtr = textPtr->numChars; } else if ((c == 'i') - && (strncmp(string, "insert", (unsigned) length) == 0)) { + && (strncmp(string, "insert", length) == 0)) { *indexPtr = textPtr->insertPos; } else if ((c == 's') && (length >= 5) - && (strncmp(string, "sel.first", (unsigned) length) == 0)) { + && (strncmp(string, "sel.first", length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "selection isn't in item", -1)); @@ -1369,7 +1368,7 @@ GetTextIndex( } *indexPtr = textInfoPtr->selectFirst; } else if ((c == 's') && (length >= 5) - && (strncmp(string, "sel.last", (unsigned) length) == 0)) { + && (strncmp(string, "sel.last", length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "selection isn't in item", -1)); @@ -1379,7 +1378,7 @@ GetTextIndex( *indexPtr = textInfoPtr->selectLast; } else if (c == '@') { int x, y; - double tmp, c = textPtr->cosine, s = textPtr->sine; + double tmp, cs = textPtr->cosine, s = textPtr->sine; char *end; const char *p; @@ -1398,7 +1397,7 @@ GetTextIndex( x -= (int) textPtr->drawOrigin[0]; y -= (int) textPtr->drawOrigin[1]; *indexPtr = Tk_PointToChar(textPtr->textLayout, - (int) (x*c - y*s), (int) (y*c + x*s)); + (int) (x*cs - y*s), (int) (y*cs + x*s)); } else if (Tcl_GetIntFromObj(NULL, obj, indexPtr) == TCL_OK) { if (*indexPtr < 0) { *indexPtr = 0; @@ -1435,10 +1434,9 @@ GetTextIndex( *-------------------------------------------------------------- */ - /* ARGSUSED */ static void SetTextCursor( - Tk_Canvas canvas, /* Record describing canvas widget. */ + TCL_UNUSED(Tk_Canvas), /* Record describing canvas widget. */ Tk_Item *itemPtr, /* Text item in which cursor position is to be * set. */ int index) /* Character index of character just before @@ -1477,7 +1475,7 @@ SetTextCursor( static int GetSelText( - Tk_Canvas canvas, /* Canvas containing selection. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing selection. */ Tk_Item *itemPtr, /* Text item containing selection. */ int offset, /* Byte offset within selection of first * character to be returned. */ @@ -1608,7 +1606,7 @@ TextToPostscript( Tcl_GetString(Tcl_GetObjResult(interp))); } - x = 0; y = 0; justify = NULL; /* lint. */ + x = 0; y = 0; justify = NULL; switch (textPtr->anchor) { case TK_ANCHOR_NW: x = 0; y = 0; break; case TK_ANCHOR_N: x = 1; y = 0; break; diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index c63520b..2ce5e50 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -517,7 +517,7 @@ ItemDisplay( canvasPtr->display, pixmap, screenX1, screenY1, width, height); } -static inline int +static int ItemIndex( TkCanvas *canvasPtr, Tk_Item *itemPtr, @@ -638,7 +638,7 @@ Tk_CanvasObjCmd( int argc, /* Number of arguments. */ Tcl_Obj *const argv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkCanvas *canvasPtr; Tk_Window newWin; @@ -662,7 +662,7 @@ Tk_CanvasObjCmd( * pointers). */ - canvasPtr = ckalloc(sizeof(TkCanvas)); + canvasPtr = (TkCanvas *)ckalloc(sizeof(TkCanvas)); canvasPtr->tkwin = newWin; canvasPtr->display = Tk_Display(newWin); canvasPtr->interp = interp; @@ -788,7 +788,7 @@ CanvasWidgetCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; int c, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent * compiler warning. */ @@ -835,7 +835,7 @@ CanvasWidgetCmd( Tcl_Preserve(canvasPtr); result = TCL_OK; - switch ((enum options) index) { + switch ((enum options)index) { case CANV_ADDTAG: if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "tag searchCommand ?arg ...?"); @@ -897,7 +897,7 @@ CanvasWidgetCmd( break; } case CANV_BIND: { - ClientData object; + void *object; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?sequence? ?command?"); @@ -948,9 +948,9 @@ CanvasWidgetCmd( Tcl_HashEntry *entryPtr; entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, - (char *) INT2PTR(searchPtr->id)); + INT2PTR(searchPtr->id)); if (entryPtr != NULL) { - itemPtr = Tcl_GetHashValue(entryPtr); + itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr); object = itemPtr; } @@ -1185,7 +1185,6 @@ CanvasWidgetCmd( tmpObj = Tcl_NewListObj(2, objv+4); FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) { - int index; int x1, x2, y1, y2; int dontRedraw1, dontRedraw2; @@ -1238,7 +1237,6 @@ CanvasWidgetCmd( case CANV_CREATE: { Tk_ItemType *typePtr; Tk_ItemType *matchPtr = NULL; - Tk_Item *itemPtr; int isNew = 0; Tcl_HashEntry *entryPtr; const char *arg; @@ -1297,9 +1295,8 @@ CanvasWidgetCmd( } typePtr = matchPtr; - itemPtr = ckalloc(typePtr->itemSize); - itemPtr->id = canvasPtr->nextId; - canvasPtr->nextId++; + itemPtr = (Tk_Item *)ckalloc(typePtr->itemSize); + itemPtr->id = canvasPtr->nextId++; itemPtr->tagPtr = itemPtr->staticTagSpace; itemPtr->tagSpace = TK_TAG_SPACE; itemPtr->numTags = 0; @@ -1315,7 +1312,7 @@ CanvasWidgetCmd( itemPtr->nextPtr = NULL; entryPtr = Tcl_CreateHashEntry(&canvasPtr->idTable, - (char *) INT2PTR(itemPtr->id), &isNew); + INT2PTR(itemPtr->id), &isNew); Tcl_SetHashValue(entryPtr, itemPtr); itemPtr->prevPtr = canvasPtr->lastItemPtr; canvasPtr->hotPtr = itemPtr; @@ -1394,7 +1391,7 @@ CanvasWidgetCmd( ckfree(itemPtr->tagPtr); } entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, - (char *) INT2PTR(itemPtr->id)); + INT2PTR(itemPtr->id)); Tcl_DeleteHashEntry(entryPtr); if (itemPtr->nextPtr != NULL) { itemPtr->nextPtr->prevPtr = itemPtr->prevPtr; @@ -1531,7 +1528,6 @@ CanvasWidgetCmd( } break; case CANV_ICURSOR: { - int index; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId index"); @@ -1556,7 +1552,6 @@ CanvasWidgetCmd( break; } case CANV_INDEX: { - int index; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId string"); @@ -1656,7 +1651,6 @@ CanvasWidgetCmd( } break; case CANV_LOWER: { - Tk_Item *itemPtr; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?belowThis?"); @@ -1941,7 +1935,7 @@ CanvasWidgetCmd( break; } case CANV_SELECT: { - int index, optionindex; + int optionindex; static const char *const optionStrings[] = { "adjust", "clear", "from", "item", "to", NULL }; @@ -2413,7 +2407,7 @@ static void CanvasWorldChanged( ClientData instanceData) /* Information about widget. */ { - TkCanvas *canvasPtr = instanceData; + TkCanvas *canvasPtr = (TkCanvas *)instanceData; Tk_Item *itemPtr; itemPtr = canvasPtr->firstItemPtr; @@ -2451,7 +2445,7 @@ static void DisplayCanvas( ClientData clientData) /* Information about widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; Tk_Item *itemPtr; Pixmap pixmap; @@ -2705,7 +2699,7 @@ CanvasEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; if (eventPtr->type == Expose) { int x, y; @@ -2795,7 +2789,7 @@ static void CanvasCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; /* @@ -3287,7 +3281,7 @@ NextItem( static SearchUids * GetStaticUids(void) { - SearchUids *searchUids = + SearchUids *searchUids = (SearchUids *) Tcl_GetThreadData(&dataKey, sizeof(SearchUids)); if (searchUids->allUid == NULL) { @@ -3326,7 +3320,7 @@ TagSearchExprInit( TagSearchExpr *expr = *exprPtrPtr; if (expr == NULL) { - expr = ckalloc(sizeof(TagSearchExpr)); + expr = (TagSearchExpr *)ckalloc(sizeof(TagSearchExpr)); expr->allocated = 0; expr->uids = NULL; expr->next = NULL; @@ -3407,7 +3401,7 @@ TagSearchScan( * Allocate primary search struct on first call. */ - *searchPtrPtr = searchPtr = ckalloc(sizeof(TagSearch)); + *searchPtrPtr = searchPtr = (TagSearch *)ckalloc(sizeof(TagSearch)); searchPtr->expr = NULL; /* @@ -3415,7 +3409,7 @@ TagSearchScan( */ searchPtr->rewritebufferAllocated = 100; - searchPtr->rewritebuffer = ckalloc(searchPtr->rewritebufferAllocated); + searchPtr->rewritebuffer = (char *)ckalloc(searchPtr->rewritebufferAllocated); } TagSearchExprInit(&searchPtr->expr); @@ -3432,7 +3426,7 @@ TagSearchScan( if ((unsigned) searchPtr->stringLength >= searchPtr->rewritebufferAllocated) { searchPtr->rewritebufferAllocated = searchPtr->stringLength + 100; - searchPtr->rewritebuffer = + searchPtr->rewritebuffer = (char *) ckrealloc(searchPtr->rewritebuffer, searchPtr->rewritebufferAllocated); } @@ -3615,10 +3609,10 @@ TagSearchScanExpr( if (expr->index >= expr->allocated-1) { expr->allocated += 15; if (expr->uids) { - expr->uids = ckrealloc(expr->uids, + expr->uids = (Tk_Uid *)ckrealloc(expr->uids, expr->allocated * sizeof(Tk_Uid)); } else { - expr->uids = ckalloc(expr->allocated * sizeof(Tk_Uid)); + expr->uids = (Tk_Uid *)ckalloc(expr->allocated * sizeof(Tk_Uid)); } } @@ -4028,9 +4022,9 @@ TagSearchFirst( if ((itemPtr == NULL) || (itemPtr->id != searchPtr->id) || (lastPtr == NULL) || (lastPtr->nextPtr != itemPtr)) { entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable, - (char *) INT2PTR(searchPtr->id)); + INT2PTR(searchPtr->id)); if (entryPtr != NULL) { - itemPtr = Tcl_GetHashValue(entryPtr); + itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr); lastPtr = itemPtr->prevPtr; } else { lastPtr = itemPtr = NULL; @@ -4249,7 +4243,7 @@ DoItem( Tk_Uid *newTagPtr; itemPtr->tagSpace += 5; - newTagPtr = ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); + newTagPtr = (Tk_Uid *)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); memcpy((void *) newTagPtr, itemPtr->tagPtr, itemPtr->numTags * sizeof(Tk_Uid)); if (itemPtr->tagPtr != itemPtr->staticTagSpace) { @@ -5123,8 +5117,8 @@ CanvasDoEvent( * processed. */ { #define NUM_STATIC 3 - ClientData staticObjects[NUM_STATIC]; - ClientData *objectPtr; + void *staticObjects[NUM_STATIC]; + void **objectPtr; int numObjects, i; Tk_Item *itemPtr; #ifndef USE_OLD_TAG_SEARCH @@ -5250,7 +5244,7 @@ static void CanvasBlinkProc( ClientData clientData) /* Pointer to record describing entry. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; if (!canvasPtr->textInfo.gotFocus || (canvasPtr->insertOffTime == 0)) { return; @@ -5406,7 +5400,7 @@ CanvasFetchSelection( * not including terminating NULL * character. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; return ItemSelection(canvasPtr, canvasPtr->textInfo.selItemPtr, offset, buffer, maxBytes); @@ -5434,7 +5428,7 @@ static void CanvasLostSelection( ClientData clientData) /* Information about entry widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.selItemPtr); canvasPtr->textInfo.selItemPtr = NULL; @@ -5763,19 +5757,18 @@ CanvasSetOrigin( *---------------------------------------------------------------------- */ -/* ARGSUSED */ static const char ** TkGetStringsFromObjs( int objc, Tcl_Obj *const objv[]) { - register int i; + int i; const char **argv; if (objc <= 0) { return NULL; } - argv = ckalloc((objc+1) * sizeof(char *)); + argv = (const char **)ckalloc((objc+1) * sizeof(char *)); for (i = 0; i < objc; i++) { argv[i] = Tcl_GetString(objv[i]); } diff --git a/generic/tkGrid.c b/generic/tkGrid.c index c222417..785bc7f 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -339,7 +339,7 @@ Tk_GridObjCmd( static const char *const optionStrings[] = { "anchor", "bbox", "columnconfigure", "configure", "content", "forget", "info", "location", "propagate", - "remove", "rowconfigure", "size", "slaves", NULL + "remove", "rowconfigure", "size", "slaves", NULL }; enum options { GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE, @@ -384,8 +384,8 @@ Tk_GridObjCmd( return GridPropagateCommand(tkwin, interp, objc, objv); case GRID_SIZE: return GridSizeCommand(tkwin, interp, objc, objv); - case GRID_CONTENT: case GRID_SLAVES: + case GRID_CONTENT: return GridContentCommand(tkwin, interp, objc, objv); /* @@ -1236,7 +1236,7 @@ GridRowColumnConfigureCommand( if (slotPtr != NULL) { if (slotType == ROW) { - int last = containerPtr->containerDataPtr->rowMax - 1; + last = containerPtr->containerDataPtr->rowMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) @@ -1245,7 +1245,7 @@ GridRowColumnConfigureCommand( } containerPtr->containerDataPtr->rowMax = last+1; } else { - int last = containerPtr->containerDataPtr->columnMax - 1; + last = containerPtr->containerDataPtr->columnMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) @@ -1733,10 +1733,9 @@ ArrangeGrid( containerPtr->flags &= ~REQUESTED_RELAYOUT; /* - * If the container has no content anymore, then don't do anything at all: - * just leave the container's size as-is. Otherwise there is no way to - * "relinquish" control over the container so another geometry manager can - * take over. + * If the container has no content anymore, then don't change the container size. + * Otherwise there is no way to "relinquish" control over the container + * so another geometry manager can take over. */ if (containerPtr->contentPtr == NULL) { @@ -1820,7 +1819,6 @@ ArrangeGrid( for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort; contentPtr = contentPtr->nextPtr) { int x, y; /* Top left coordinate */ - int width, height; /* Slot or content size */ int col = contentPtr->column; int row = contentPtr->row; @@ -1931,7 +1929,7 @@ ResolveConstraints( int uniformGroups; /* Number of currently used uniform groups. */ int uniformGroupsAlloced; /* Size of allocated space for uniform * groups. */ - int weight, minSize; + int minSize; int prevGrow, accWeight, grow; /* @@ -2060,6 +2058,7 @@ ResolveConstraints( for (slot = 0; slot < gridCount; slot++) { if (layoutPtr[slot].uniform != NULL) { + int weight; for (start = 0; start < uniformGroups; start++) { if (uniformGroupPtr[start].group == layoutPtr[slot].uniform) { break; @@ -2112,7 +2111,7 @@ ResolveConstraints( for (start = 0; start < uniformGroups; start++) { if (uniformGroupPtr[start].group == layoutPtr[slot].uniform) { - weight = layoutPtr[slot].weight; + int weight = layoutPtr[slot].weight; weight = weight > 0 ? weight : 1; layoutPtr[slot].minSize = uniformGroupPtr[start].minSize * weight; @@ -2702,7 +2701,7 @@ InitContainerData( Gridder *containerPtr) { if (containerPtr->containerDataPtr == NULL) { - GridContainer *gridPtr = containerPtr->containerDataPtr = + GridContainer *gridPtr = containerPtr->containerDataPtr = (GridContainer *) ckalloc(sizeof(GridContainer)); size_t size = sizeof(SlotInfo) * TYPICAL_SIZE; @@ -2989,7 +2988,7 @@ ConfigureContent( * If the stored container does not exist, just ignore it. */ - struct Gridder *contentPtr = GetGrid(content); + contentPtr = GetGrid(content); if (contentPtr->in != NULL) { if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent) == TCL_OK) { @@ -3129,7 +3128,7 @@ ConfigureContent( for (defaultColumnSpan = 1; j + defaultColumnSpan < numWindows; defaultColumnSpan++) { - const char *string = Tcl_GetString(objv[j + defaultColumnSpan]); + string = Tcl_GetString(objv[j + defaultColumnSpan]); if (*string != REL_HORIZ) { break; @@ -3431,9 +3430,9 @@ ConfigureContent( int lastRow, lastColumn; /* Implied end of table. */ string = Tcl_GetString(objv[j]); - firstChar = string[0]; + firstChar = string[0]; - if (firstChar == '.') { + if (firstChar == '.') { lastWindow = string; numSkip = 0; } @@ -3456,7 +3455,7 @@ ConfigureContent( */ for (width = 1; width + j < numWindows; width++) { - const char *string = Tcl_GetString(objv[j+width]); + string = Tcl_GetString(objv[j+width]); if (*string != REL_VERT) { break; diff --git a/generic/tkImage.c b/generic/tkImage.c index 763c65b..d42ed7d 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -361,8 +361,6 @@ Tk_ImageObjCmd( objc -= firstOption; args = (Tcl_Obj **) objv; if (oldimage) { - int i; - args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *)); for (i = 0; i < objc; i++) { args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]); diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index 89d4387..fed1ca7 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -94,13 +94,13 @@ static int ReadPPMStringHeader(Tcl_Obj *dataObj, int *widthPtr, static int FileMatchPPM( Tcl_Channel chan, /* The image file, open for reading. */ - const char *fileName, /* The name of the image file. */ - Tcl_Obj *format, /* User-specified format string, or NULL. */ + TCL_UNUSED(const char *), /* The name of the image file. */ + TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here if the file is a valid raw PPM * file. */ - Tcl_Interp *interp) /* unused */ + TCL_UNUSED(Tcl_Interp *)) /* unused */ { int dummy; @@ -131,7 +131,7 @@ FileReadPPM( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Channel chan, /* The image file, open for reading. */ const char *fileName, /* The name of the image file. */ - Tcl_Obj *format, /* User-specified format string, or NULL. */ + TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */ Tk_PhotoHandle imageHandle, /* The photo image to write into. */ int destX, int destY, /* Coordinates of top-left pixel in photo * image to be written to. */ @@ -211,7 +211,7 @@ FileReadPPM( nLines = 1; } nBytes = nLines * block.pitch; - pixelPtr = ckalloc(nBytes); + pixelPtr = (unsigned char *)ckalloc(nBytes); block.pixelPtr = pixelPtr + srcX * block.pixelSize; for (h = height; h > 0; h -= nLines) { @@ -281,7 +281,7 @@ static int FileWritePPM( Tcl_Interp *interp, const char *fileName, - Tcl_Obj *format, + TCL_UNUSED(Tcl_Obj *), Tk_PhotoImageBlock *blockPtr) { Tcl_Channel chan; @@ -368,7 +368,7 @@ FileWritePPM( static int StringWritePPM( Tcl_Interp *interp, - Tcl_Obj *format, + TCL_UNUSED(Tcl_Obj *), Tk_PhotoImageBlock *blockPtr) { int w, h, size, greenOffset, blueOffset; @@ -444,12 +444,12 @@ StringWritePPM( static int StringMatchPPM( Tcl_Obj *dataObj, /* The image data. */ - Tcl_Obj *format, /* User-specified format string, or NULL. */ + TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here if the file is a valid raw PPM * file. */ - Tcl_Interp *interp) /* unused */ + TCL_UNUSED(Tcl_Interp *)) /* unused */ { int dummy; @@ -479,7 +479,7 @@ static int StringReadPPM( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Obj *dataObj, /* The image data. */ - Tcl_Obj *format, /* User-specified format string, or NULL. */ + TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */ Tk_PhotoHandle imageHandle, /* The photo image to write into. */ int destX, int destY, /* Coordinates of top-left pixel in photo * image to be written to. */ @@ -578,7 +578,7 @@ StringReadPPM( nLines = 1; } nBytes = nLines * block.pitch; - pixelPtr = ckalloc(nBytes); + pixelPtr = (unsigned char *)ckalloc(nBytes); block.pixelPtr = pixelPtr + srcX * block.pixelSize; for (h = height; h > 0; h -= nLines) { @@ -600,7 +600,6 @@ StringReadPPM( *p = (((int) *dataBuffer) * 255)/maxIntensity; } } else { - unsigned char *p; unsigned int value; for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2) { diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index afbf7b0..8f5295f 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -216,10 +216,10 @@ static const char * GetExtension(const char *path); static void PhotoFormatThreadExitProc( - ClientData clientData) /* not used */ + TCL_UNUSED(void *)) /* not used */ { Tk_PhotoImageFormat *freePtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); while (tsdPtr->oldFormatList != NULL) { @@ -262,14 +262,14 @@ Tk_CreateOldPhotoImageFormat( * by caller. */ { Tk_PhotoImageFormat *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat)); + copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; @@ -283,21 +283,21 @@ Tk_CreatePhotoImageFormat( * by caller. */ { Tk_PhotoImageFormat *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat)); + copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; if (isupper((unsigned char) *formatPtr->name)) { copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; } else { /* for compatibility with aMSN: make a copy of formatPtr->name */ - char *name = ckalloc(strlen(formatPtr->name) + 1); + char *name = (char *)ckalloc(strlen(formatPtr->name) + 1); strcpy(name, formatPtr->name); copyPtr->name = name; copyPtr->nextPtr = tsdPtr->formatList; @@ -330,7 +330,7 @@ ImgPhotoCreate( int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ - const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */ + TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it @@ -342,7 +342,7 @@ ImgPhotoCreate( * Allocate and initialize the photo image model record. */ - modelPtr = ckalloc(sizeof(PhotoModel)); + modelPtr = (PhotoModel *)ckalloc(sizeof(PhotoModel)); memset(modelPtr, 0, sizeof(PhotoModel)); modelPtr->tkMaster = model; modelPtr->interp = interp; @@ -413,7 +413,7 @@ ImgPhotoCmd( int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -818,7 +818,7 @@ ImgPhotoCmd( } /* - * Extract the value of the desired pixel and format it as a string. + * Extract the value of the desired pixel and format it as a list. */ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; @@ -1797,7 +1797,7 @@ ImgPhotoConfigureModel( Tk_PhotoImageFormat *imageFormat; const char **args; - args = ckalloc((objc + 1) * sizeof(char *)); + args = (const char **)ckalloc((objc + 1) * sizeof(char *)); for (i = 0, j = 0; i < objc; i++,j++) { args[j] = Tcl_GetString(objv[i]); length = objv[i]->length; @@ -2138,7 +2138,7 @@ ImgPhotoDelete( ClientData modelData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { - PhotoModel *modelPtr = modelData; + PhotoModel *modelPtr = (PhotoModel *)modelData; PhotoInstance *instancePtr; while ((instancePtr = modelPtr->instancePtr) != NULL) { @@ -2190,7 +2190,7 @@ ImgPhotoCmdDeletedProc( ClientData clientData) /* Pointer to PhotoModel structure for * image. */ { - PhotoModel *modelPtr = clientData; + PhotoModel *modelPtr = (PhotoModel *)clientData; modelPtr->imageCmd = NULL; if (modelPtr->tkMaster != NULL) { @@ -2263,7 +2263,7 @@ ImgPhotoSetSize( if (newPixSize == 0) { newPix32 = NULL; } else { - newPix32 = attemptckalloc(newPixSize); + newPix32 = (unsigned char *)attemptckalloc(newPixSize); if (newPix32 == NULL) { return TCL_ERROR; } @@ -2426,7 +2426,7 @@ MatchFileFormat( { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; @@ -2566,7 +2566,7 @@ MatchStringFormat( { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; @@ -2724,7 +2724,7 @@ Tk_PhotoPutBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoModel *modelPtr = (PhotoModel *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -2786,7 +2786,7 @@ Tk_PhotoPutBlock( unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + sourceBlock.width * sourceBlock.pixelSize; - sourceBlock.pixelPtr = attemptckalloc(cpyLen); + sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -3077,10 +3077,10 @@ Tk_PhotoPutBlock( */ if (!(modelPtr->flags & COMPLEX_ALPHA)) { - register int x1; + int x1; for (x1=x ; x1pix32 + (y*modelPtr->width + x1)*4; newAlpha = destLinePtr[3]; @@ -3162,8 +3162,8 @@ Tk_PhotoPutZoomedBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoModel *modelPtr = (PhotoModel *) handle; - register Tk_PhotoImageBlock sourceBlock; + PhotoModel *modelPtr = (PhotoModel *) handle; + Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; int wLeft, hLeft, wCopy, hCopy, blockWid, blockHt; @@ -3232,7 +3232,7 @@ Tk_PhotoPutZoomedBlock( unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + sourceBlock.width * sourceBlock.pixelSize; - sourceBlock.pixelPtr = attemptckalloc(cpyLen); + sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -3837,7 +3837,7 @@ ImgGetPhoto( blueOffset = blockPtr->offset[2] - blockPtr->offset[0]; if (((optPtr->options & OPT_BACKGROUND) && alphaOffset) || ((optPtr->options & OPT_GRAYSCALE) && (greenOffset||blueOffset))) { - int newPixelSize,x,y; + int newPixelSize; unsigned char *srcPtr, *destPtr; char *data; @@ -3850,7 +3850,7 @@ ImgGetPhoto( if (blockPtr->height > (int)((UINT_MAX/newPixelSize)/blockPtr->width)) { return NULL; } - data = attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height); + data = (char *)attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height); if (data == NULL) { return NULL; } @@ -4058,7 +4058,7 @@ Tk_PhotoGetImage( /* *-------------------------------------------------------------- * - * TkPostscriptPhoto -- + * ImgPostscriptPhoto -- * * This function is called to output the contents of a photo image in * Postscript by calling the Tk_PostscriptPhoto function. @@ -4076,11 +4076,11 @@ static int ImgPhotoPostscript( ClientData clientData, /* Handle for the photo image. */ Tcl_Interp *interp, /* Interpreter. */ - Tk_Window tkwin, /* (unused) */ + TCL_UNUSED(Tk_Window), /* (unused) */ Tk_PostscriptInfo psInfo, /* Postscript info. */ int x, int y, /* First pixel to output. */ int width, int height, /* Width and height of area. */ - int prepass) /* (unused) */ + TCL_UNUSED(int)) /* (unused) */ { Tk_PhotoImageBlock block; @@ -4195,5 +4195,6 @@ Tk_PhotoSetSize_Panic( * mode: c * c-basic-offset: 4 * fill-column: 78 + * tab-width: 8 * End: */ diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index fec9448..06a42d4 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -13,8 +13,8 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#include "default.h" #include "tkInt.h" +#include "default.h" /* * Flag values for "sticky"ness. The 16 combinations subsume the packer's @@ -383,7 +383,7 @@ static const Tk_OptionSpec paneOptionSpecs[] = { int Tk_PanedWindowObjCmd( - ClientData clientData, /* NULL. */ + TCL_UNUSED(ClientData), /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ @@ -437,7 +437,7 @@ Tk_PanedWindowObjCmd( * Allocate and initialize the widget record. */ - pwPtr = ckalloc(sizeof(PanedWindow)); + pwPtr = (PanedWindow *)ckalloc(sizeof(PanedWindow)); memset((void *)pwPtr, 0, (sizeof(PanedWindow))); pwPtr->tkwin = tkwin; pwPtr->display = Tk_Display(tkwin); @@ -535,7 +535,7 @@ PanedWindowWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; int result = TCL_OK; static const char *const optionStrings[] = { "add", "cget", "configure", "forget", "identify", "panecget", @@ -604,7 +604,6 @@ PanedWindowWidgetObjCmd( break; case PW_FORGET: { - int i; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?"); @@ -903,7 +902,7 @@ ConfigurePanes( * structures may already have existed, some may be new. */ - inserts = ckalloc(sizeof(Pane *) * (firstOptionArg - 2)); + inserts = (Pane **)ckalloc(sizeof(Pane *) * (firstOptionArg - 2)); insertIndex = 0; /* @@ -970,7 +969,7 @@ ConfigurePanes( * out with their "natural" dimensions. */ - panePtr = ckalloc(sizeof(Pane)); + panePtr = (Pane *)ckalloc(sizeof(Pane)); memset(panePtr, 0, sizeof(Pane)); Tk_InitOptions(interp, (char *)panePtr, pwPtr->paneOpts, pwPtr->tkwin); @@ -1010,8 +1009,8 @@ ConfigurePanes( */ i = sizeof(Pane *) * (pwPtr->numPanes + numNewPanes); - newPanes = ckalloc(i); - memset(newPanes, 0, (size_t) i); + newPanes = (Pane **)ckalloc(i); + memset(newPanes, 0, i); if (index == -1) { /* * If none of the existing panes have to be moved, just copy the old @@ -1249,7 +1248,7 @@ ConfigurePanedWindow( Tk_SavedOptions savedOptions; int typemask = 0; - if (Tk_SetOptions(interp, (char *) pwPtr, pwPtr->optionTable, objc, objv, + if (Tk_SetOptions(interp, (char *)pwPtr, pwPtr->optionTable, objc, objv, pwPtr->tkwin, &savedOptions, &typemask) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; @@ -1295,7 +1294,7 @@ PanedWindowWorldChanged( { XGCValues gcValues; GC newGC; - PanedWindow *pwPtr = instanceData; + PanedWindow *pwPtr = (PanedWindow *)instanceData; /* * Allocated a graphics context for drawing the paned window widget @@ -1352,7 +1351,7 @@ PanedWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; int i; if (eventPtr->type == Expose) { @@ -1405,7 +1404,7 @@ static void PanedWindowCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; /* * This function could be invoked either because the window was destroyed @@ -1442,7 +1441,7 @@ static void DisplayPanedWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; Pane *panePtr; Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; @@ -1484,10 +1483,10 @@ DisplayPanedWindow( */ if (horizontal) { - sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderWidth(tkwin)); + sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderLeft(tkwin)); sashWidth = pwPtr->sashWidth; } else { - sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderWidth(tkwin)); + sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderLeft(tkwin)); sashHeight = pwPtr->sashWidth; } @@ -1627,10 +1626,10 @@ static void PanedWindowReqProc( ClientData clientData, /* Paned window's information about window * that got new preferred geometry. */ - Tk_Window tkwin) /* Other Tk-related information about the + TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { - Pane *panePtr = clientData; + Pane *panePtr = (Pane *)clientData; PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; if (Tk_IsMapped(pwPtr->tkwin)) { @@ -1673,9 +1672,9 @@ static void PanedWindowLostPaneProc( ClientData clientData, /* Grid structure for the pane that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the pane. */ + TCL_UNUSED(Tk_Window)) /* Tk's handle for the pane. */ { - register Pane *panePtr = clientData; + Pane *panePtr = (Pane *)clientData; PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; if (pwPtr->tkwin != Tk_Parent(panePtr->tkwin)) { @@ -1714,8 +1713,8 @@ ArrangePanes( ClientData clientData) /* Structure describing parent whose panes * are to be re-layed out. */ { - register PanedWindow *pwPtr = clientData; - register Pane *panePtr; + PanedWindow *pwPtr = (PanedWindow *)clientData; + Pane *panePtr; int i, newPaneWidth, newPaneHeight, paneX, paneY; int paneWidth, paneHeight, paneSize, paneMinSize; int doubleBw; @@ -1754,7 +1753,7 @@ ArrangePanes( */ paneDynSize = paneDynMinSize = 0; - internalBW = Tk_InternalBorderWidth(pwPtr->tkwin); + internalBW = Tk_InternalBorderLeft(pwPtr->tkwin); pwHeight = Tk_Height(pwPtr->tkwin) - (2 * internalBW); pwWidth = Tk_Width(pwPtr->tkwin) - (2 * internalBW); x = y = internalBW; @@ -2014,9 +2013,9 @@ ArrangePanes( static void Unlink( - register Pane *panePtr) /* Window to unlink. */ + Pane *panePtr) /* Window to unlink. */ { - register PanedWindow *containerPtr; + PanedWindow *containerPtr; int i, j; containerPtr = panePtr->containerPtr; @@ -2160,7 +2159,7 @@ PaneStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - Pane *panePtr = clientData; + Pane *panePtr = (Pane *)clientData; PanedWindow *pwPtr = panePtr->containerPtr; if (eventPtr->type == DestroyNotify) { @@ -2200,7 +2199,7 @@ ComputeGeometry( pwPtr->flags |= REQUESTED_RELAYOUT; - x = y = internalBw = Tk_InternalBorderWidth(pwPtr->tkwin); + x = y = internalBw = Tk_InternalBorderLeft(pwPtr->tkwin); reqWidth = reqHeight = 0; /* @@ -2370,7 +2369,7 @@ ComputeGeometry( static void DestroyOptionTables( ClientData clientData, /* Pointer to the OptionTables struct */ - Tcl_Interp *interp) /* Pointer to the calling interp */ + TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */ { ckfree(clientData); } @@ -2394,8 +2393,8 @@ DestroyOptionTables( static Tcl_Obj * GetSticky( - ClientData clientData, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *recordPtr, /* Pointer to widget record. */ int internalOffset) /* Offset within *recordPtr containing the * sticky value. */ @@ -2442,9 +2441,9 @@ GetSticky( static int SetSticky( - ClientData clientData, + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interp; may be used for errors. */ - Tk_Window tkwin, /* Window for which option is being set. */ + TCL_UNUSED(Tk_Window), /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. * We use a pointer to the pointer because we * may need to return a value (NULL). */ @@ -2521,8 +2520,8 @@ SetSticky( static void RestoreSticky( - ClientData clientData, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *internalPtr, /* Pointer to storage for value. */ char *oldInternalPtr) /* Pointer to old value. */ { @@ -2754,7 +2753,7 @@ ProxyWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; if (eventPtr->type == Expose) { if (pwPtr->proxywin != NULL &&!(pwPtr->flags & PROXY_REDRAW_PENDING)) { @@ -2786,7 +2785,7 @@ static void DisplayProxyWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; Pixmap pixmap; Tk_Window tkwin = pwPtr->proxywin; pwPtr->flags &= ~PROXY_REDRAW_PENDING; @@ -2906,7 +2905,7 @@ PanedWindowProxyCommand( return TCL_ERROR; } - internalBW = Tk_InternalBorderWidth(pwPtr->tkwin); + internalBW = Tk_InternalBorderLeft(pwPtr->tkwin); if (pwPtr->orient == ORIENT_HORIZONTAL) { if (x < 0) { x = 0; @@ -2915,10 +2914,10 @@ PanedWindowProxyCommand( if (x > pwWidth) { x = pwWidth; } - y = Tk_InternalBorderWidth(pwPtr->tkwin); + y = Tk_InternalBorderLeft(pwPtr->tkwin); sashWidth = pwPtr->sashWidth; sashHeight = Tk_Height(pwPtr->tkwin) - - (2 * Tk_InternalBorderWidth(pwPtr->tkwin)); + (2 * Tk_InternalBorderLeft(pwPtr->tkwin)); } else { if (y < 0) { y = 0; @@ -2927,10 +2926,10 @@ PanedWindowProxyCommand( if (y > pwHeight) { y = pwHeight; } - x = Tk_InternalBorderWidth(pwPtr->tkwin); + x = Tk_InternalBorderLeft(pwPtr->tkwin); sashHeight = pwPtr->sashWidth; sashWidth = Tk_Width(pwPtr->tkwin) - - (2 * Tk_InternalBorderWidth(pwPtr->tkwin)); + (2 * Tk_InternalBorderLeft(pwPtr->tkwin)); } if (sashWidth < 1) { @@ -3066,7 +3065,7 @@ PanedWindowIdentifyCoords( } else { sashHeight = Tk_ReqHeight(pwPtr->tkwin); } - sashHeight -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin); + sashHeight -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin); if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) { sashWidth = pwPtr->handleSize; lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2; @@ -3094,7 +3093,7 @@ PanedWindowIdentifyCoords( } else { sashWidth = Tk_ReqWidth(pwPtr->tkwin); } - sashWidth -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin); + sashWidth -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin); lpad = rpad = 0; } diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 9a85532..8c80846 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -127,8 +127,8 @@ Tk_ScrollbarObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = clientData; - register TkScrollbar *scrollPtr; + Tk_Window tkwin = (Tk_Window)clientData; + TkScrollbar *scrollPtr; Tk_Window newWin; if (objc < 2) { @@ -223,7 +223,7 @@ ScrollbarWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; int result = TCL_OK; int length, cmdIndex; static const char *const commandNames[] = { @@ -308,7 +308,7 @@ ScrollbarWidgetObjCmd( break; } case COMMAND_DELTA: { - int xDelta, yDelta, pixels, length; + int xDelta, yDelta, pixels; double fraction; if (objc != 4) { @@ -337,7 +337,7 @@ ScrollbarWidgetObjCmd( break; } case COMMAND_FRACTION: { - int x, y, pos, length; + int x, y, pos; double fraction; if (objc != 4) { @@ -521,7 +521,7 @@ ScrollbarWidgetObjCmd( static int ConfigureScrollbar( Tcl_Interp *interp, /* Used for error reporting. */ - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ @@ -584,7 +584,7 @@ TkScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkScrollbarEventuallyRedraw(scrollPtr); @@ -649,7 +649,7 @@ static void ScrollbarCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; Tk_Window tkwin = scrollPtr->tkwin; /* diff --git a/generic/tkTest.c b/generic/tkTest.c index 3c17407..1fa821c 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -244,7 +244,7 @@ Tktest_Init( */ if (Tcl_PkgProvideEx(interp, "Tktest", TK_PATCH_LEVEL, NULL) == TCL_ERROR) { - return TCL_ERROR; + return TCL_ERROR; } Tcl_CreateObjCommand(interp, "square", SquareObjCmd, NULL, NULL); @@ -324,10 +324,9 @@ Tktest_Init( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestbitmapObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -359,10 +358,9 @@ TestbitmapObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestborderObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(ClientData), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -394,10 +392,9 @@ TestborderObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcolorObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -428,10 +425,9 @@ TestcolorObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcursorObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -457,19 +453,18 @@ TestcursorObjCmd( * A standard Tcl result. * * Side effects: - * All the intepreters created by previous calls to "testnewapp" get + * All the interpreters created by previous calls to "testnewapp" get * deleted. * *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestdeleteappsObjCmd( - ClientData clientData, /* Main window for application. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument strings. */ + TCL_UNUSED(void *), /* Main window for application. */ + TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument strings. */ { NewApp *nextPtr; @@ -500,7 +495,6 @@ TestdeleteappsObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestobjconfigObjCmd( ClientData clientData, /* Main window for application. */ @@ -639,7 +633,6 @@ TestobjconfigObjCmd( {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_OptionTable optionTable; - Tk_Window tkwin; optionTable = Tk_CreateOptionTable(interp, typesSpecs); tables[index] = optionTable; @@ -650,7 +643,7 @@ TestobjconfigObjCmd( } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(TypesRecord)); + recordPtr = (TypesRecord *)ckalloc(sizeof(TypesRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -695,7 +688,6 @@ TestobjconfigObjCmd( case CHAIN1: { ExtensionWidgetRecord *recordPtr; - Tk_Window tkwin; Tk_OptionTable optionTable; tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, @@ -707,7 +699,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, baseSpecs); tables[index] = optionTable; - recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); + recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -748,7 +740,6 @@ TestobjconfigObjCmd( {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, (ClientData) baseSpecs, 0} }; - Tk_Window tkwin; Tk_OptionTable optionTable; tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, @@ -760,7 +751,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, extensionSpecs); tables[index] = optionTable; - recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); + recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -917,7 +908,6 @@ TestobjconfigObjCmd( {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_OptionTable optionTable; - Tk_Window tkwin; optionTable = Tk_CreateOptionTable(interp, internalSpecs); tables[index] = optionTable; @@ -1072,7 +1062,7 @@ TestobjconfigObjCmd( Tk_Offset(ContentRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; - Tk_Window tkwin = Tk_CreateWindowFromPath(interp, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { @@ -1080,7 +1070,7 @@ TestobjconfigObjCmd( } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(ContentRecord)); + recordPtr = (ContentRecord *)ckalloc(sizeof(ContentRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, contentSpecs); @@ -1133,7 +1123,6 @@ TestobjconfigObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TrivialConfigObjCmd( ClientData clientData, /* Main window for application. */ @@ -1245,7 +1234,7 @@ static void TrivialCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; Tk_Window tkwin = headerPtr->tkwin; if (tkwin != NULL) { @@ -1257,8 +1246,8 @@ TrivialCmdDeletedProc( * here. */ - Tk_FreeConfigOptions((char *) clientData, - headerPtr->optionTable, (Tk_Window) NULL); + Tk_FreeConfigOptions((char *)clientData, + headerPtr->optionTable, NULL); Tcl_EventuallyFree(clientData, TCL_DYNAMIC); } } @@ -1284,11 +1273,11 @@ TrivialEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; if (eventPtr->type == DestroyNotify) { if (headerPtr->tkwin != NULL) { - Tk_FreeConfigOptions((char *) clientData, + Tk_FreeConfigOptions((char *)clientData, headerPtr->optionTable, headerPtr->tkwin); headerPtr->optionTable = NULL; headerPtr->tkwin = NULL; @@ -1316,7 +1305,6 @@ TrivialEventProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestfontObjCmd( ClientData clientData, /* Main window for application. */ @@ -1330,7 +1318,7 @@ TestfontObjCmd( Tk_Window tkwin; Tk_Font tkfont; - tkwin = (Tk_Window) clientData; + tkwin = (Tk_Window)clientData; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option fontName"); @@ -1376,7 +1364,6 @@ TestfontObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ImageCreate( Tcl_Interp *interp, /* Interpreter for application containing @@ -1385,7 +1372,7 @@ ImageCreate( int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument strings for options (doesn't * include image name or type). */ - const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ + TCL_UNUSED(const Tk_ImageType *), /* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it @@ -1410,14 +1397,14 @@ ImageCreate( varName = Tcl_GetString(objv[i+1]); } - timPtr = ckalloc(sizeof(TImageModel)); + timPtr = (TImageModel *)ckalloc(sizeof(TImageModel)); timPtr->model = model; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; - timPtr->imageName = ckalloc(strlen(name) + 1); + timPtr->imageName = (char *)ckalloc(strlen(name) + 1); strcpy(timPtr->imageName, name); - timPtr->varName = ckalloc(strlen(varName) + 1); + timPtr->varName = (char *)ckalloc(strlen(varName) + 1); strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; @@ -1442,7 +1429,6 @@ ImageCreate( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ImageObjCmd( ClientData clientData, /* Main window for application. */ @@ -1450,7 +1436,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageModel *timPtr = (TImageModel *) clientData; + TImageModel *timPtr = (TImageModel *)clientData; int x, y, width, height; if (objc < 2) { @@ -1505,7 +1491,7 @@ ImageGet( * used. */ ClientData clientData) /* Pointer to TImageModel for image. */ { - TImageModel *timPtr = (TImageModel *) clientData; + TImageModel *timPtr = (TImageModel *)clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -1514,7 +1500,7 @@ ImageGet( Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - instPtr = ckalloc(sizeof(TImageInstance)); + instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance)); instPtr->modelPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; @@ -1553,7 +1539,7 @@ ImageDisplay( /* Coordinates in drawable corresponding to * imageX and imageY. */ { - TImageInstance *instPtr = (TImageInstance *) clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; /* * The purpose of the test image type is to track the calls to an image @@ -1637,7 +1623,7 @@ ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { - TImageInstance *instPtr = (TImageInstance *) clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200]; sprintf(buffer, "%s free", instPtr->modelPtr->imageName); @@ -1671,7 +1657,7 @@ ImageDelete( * this function is called, no more instances * exist. */ { - TImageModel *timPtr = (TImageModel *) clientData; + TImageModel *timPtr = (TImageModel *)clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); @@ -1702,7 +1688,6 @@ ImageDelete( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestmakeexistObjCmd( ClientData clientData, /* Main window for application. */ @@ -1710,7 +1695,7 @@ TestmakeexistObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = (Tk_Window)clientData; int i; Tk_Window tkwin; @@ -1743,7 +1728,6 @@ TestmakeexistObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestmenubarObjCmd( @@ -1753,7 +1737,7 @@ TestmenubarObjCmd( Tcl_Obj *const objv[]) /* Argument strings. */ { #ifdef __UNIX__ - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = (Tk_Window)clientData; Tk_Window tkwin, menubar; if (objc < 2) { @@ -1813,7 +1797,7 @@ TestmenubarObjCmd( #if defined(_WIN32) static int TestmetricsObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -1858,7 +1842,6 @@ TestmetricsObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestpropObjCmd( ClientData clientData, /* Main window for application. */ @@ -1866,7 +1849,7 @@ TestpropObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = (Tk_Window)clientData; int result, actualFormat; unsigned long bytesAfter, length, value; Atom actualType, propName; @@ -1937,7 +1920,6 @@ TestpropObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestwrapperObjCmd( ClientData clientData, /* Main window for application. */ @@ -1953,7 +1935,7 @@ TestwrapperObjCmd( return TCL_ERROR; } - tkwin = (Tk_Window) clientData; + tkwin = (Tk_Window)clientData; winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[1]), tkwin); if (winPtr == NULL) { return TCL_ERROR; @@ -1990,17 +1972,16 @@ TestwrapperObjCmd( * CustomOptionSet Sets option value to new setting. * CustomOptionGet Creates a new Tcl_Obj. * CustomOptionRestore Resets option value to original value. - * CustomOptionFree Free storage for internal rep of - * option. + * CustomOptionFree Free storage for internal rep of option. * *---------------------------------------------------------------------- */ static int CustomOptionSet( - ClientData clientData, + TCL_UNUSED(void *), Tcl_Interp *interp, - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), Tcl_Obj **value, char *recordPtr, int internalOffset, @@ -2045,7 +2026,7 @@ CustomOptionSet( if (internalPtr != NULL) { if (*value != NULL) { string = Tcl_GetString(*value); - newStr = ckalloc((*value)->length + 1); + newStr = (char *)ckalloc((*value)->length + 1); strcpy(newStr, string); } else { newStr = NULL; @@ -2059,8 +2040,8 @@ CustomOptionSet( static Tcl_Obj * CustomOptionGet( - ClientData clientData, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *recordPtr, int internalOffset) { diff --git a/generic/tkText.c b/generic/tkText.c index 5996688..c41fc67 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -701,7 +701,7 @@ TextWidgetObjCmd( { TkText *textPtr = (TkText *)clientData; int result = TCL_OK; - int index; + int idx; static const char *const optionStrings[] = { "bbox", "cget", "compare", "configure", "count", "debug", "delete", @@ -724,12 +724,12 @@ TextWidgetObjCmd( } if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, - sizeof(char *), "option", 0, &index) != TCL_OK) { + sizeof(char *), "option", 0, &idx) != TCL_OK) { return TCL_ERROR; } textPtr->refCount++; - switch ((enum options) index) { + switch ((enum options) idx) { case TEXT_BBOX: { int x, y, width, height; const TkTextIndex *indexPtr; @@ -3124,7 +3124,7 @@ DeleteIndexRange( line2 = TkBTreeLinesTo(textPtr, index2.linePtr); if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) { TkTextTag **arrayPtr; - int arraySize, i; + int arraySize; TkTextIndex oldIndex2; oldIndex2 = index2; diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index fba26b9..7832992 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -1070,7 +1070,7 @@ TkBTreeInsertChars( curPtr->nextPtr = segPtr; } segPtr->size = chunkSize; - memcpy(segPtr->body.chars, string, (size_t)chunkSize); + memcpy(segPtr->body.chars, string, chunkSize); segPtr->body.chars[chunkSize] = 0; if (eol[-1] != '\n') { @@ -4169,7 +4169,7 @@ Rebalance( Node *otherPtr; Node *halfwayNodePtr = NULL; /* Initialization needed only */ TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */ - int totalChildren, firstChildren, i; + int totalChildren, firstChildren; /* * Too few children for this node. If this is the root then, it's @@ -4230,8 +4230,6 @@ Rebalance( otherPtr->children.linePtr = NULL; } if (nodePtr->level == 0) { - TkTextLine *linePtr; - for (linePtr = nodePtr->children.linePtr, i = 1; linePtr->nextPtr != NULL; linePtr = linePtr->nextPtr, i++) { @@ -4246,8 +4244,6 @@ Rebalance( i++; } } else { - Node *childPtr; - for (childPtr = nodePtr->children.nodePtr, i = 1; childPtr->nextPtr != NULL; childPtr = childPtr->nextPtr, i++) { @@ -4559,7 +4555,7 @@ CharSplitProc( newPtr1->typePtr = &tkTextCharType; newPtr1->nextPtr = newPtr2; newPtr1->size = index; - memcpy(newPtr1->body.chars, segPtr->body.chars, (size_t)index); + memcpy(newPtr1->body.chars, segPtr->body.chars, index); newPtr1->body.chars[index] = 0; newPtr2->typePtr = &tkTextCharType; newPtr2->nextPtr = segPtr->nextPtr; @@ -4660,7 +4656,7 @@ CharDeleteProc( static void CharCheckProc( TkTextSegment *segPtr, /* Segment to check. */ - TkTextLine *linePtr) /* Line containing segment. */ + TCL_UNUSED(TkTextLine *)) /* Line containing segment. */ { /* * Make sure that the segment contains the number of characters indicated diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index c160083..c9f34e4 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -160,7 +160,6 @@ TkTextWindowCmd( switch ((enum windOptions) optionIndex) { case WIND_CGET: { TkTextIndex index; - TkTextSegment *ewPtr; Tcl_Obj *objPtr; TkTextEmbWindowClient *client; @@ -201,7 +200,6 @@ TkTextWindowCmd( } case WIND_CONFIGURE: { TkTextIndex index; - TkTextSegment *ewPtr; if (objc < 4) { Tcl_WrongNumArgs(interp, 3, objv, "index ?-option value ...?"); diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index bd7c7ba..83075bc 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -2,10 +2,10 @@ * Copyright (c) 2004, Joe English */ +#include "tkInt.h" #include #include #include -#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -294,7 +294,7 @@ static void ActivateTab(Notebook *nb, int index) static Ttk_State TabState(Notebook *nb, int index) { Ttk_State state = nb->core.state; - Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); + Tab *itab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); int i = 0; if (index == nb->notebook.currentIndex) { @@ -326,7 +326,7 @@ static Ttk_State TabState(Notebook *nb, int index) } break; } - if (tab->state == TAB_STATE_DISABLED) { + if (itab->state == TAB_STATE_DISABLED) { state |= TTK_STATE_DISABLED; } @@ -968,8 +968,8 @@ static int NotebookInsertCommand( /* Move existing content window: */ if (ConfigureTab(interp, nb, - (Tab *)Ttk_ContentData(nb->notebook.mgr,srcIndex), - Ttk_ContentWindow(nb->notebook.mgr,srcIndex), + (Tab *)Ttk_ContentData(nb->notebook.mgr, srcIndex), + Ttk_ContentWindow(nb->notebook.mgr, srcIndex), objc-4,objv+4) != TCL_OK) { return TCL_ERROR; diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c index 6a99124..8d293f6 100644 --- a/unix/tkUnixButton.c +++ b/unix/tkUnixButton.c @@ -173,7 +173,7 @@ TkpDrawCheckIndicator( * Sanity check. */ - if (tkwin == NULL || display == None || d == None || bgBorder == NULL + if (tkwin == NULL || display == NULL || d == None || bgBorder == NULL || indicatorColor == NULL) { return; } @@ -326,11 +326,9 @@ TkpDrawCheckIndicator( TkButton * TkpCreateButton( - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { - UnixButton *butPtr = ckalloc(sizeof(UnixButton)); - - return (TkButton *) butPtr; + return (TkButton *)ckalloc(sizeof(UnixButton)); } /* @@ -396,7 +394,7 @@ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { - register TkButton *butPtr = (TkButton *) clientData; + TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; @@ -807,8 +805,6 @@ TkpDisplayButton( butPtr->borderWidth, relief); } if (butPtr->highlightWidth > 0) { - GC gc; - if (butPtr->flags & GOT_FOCUS) { gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap); } else { @@ -860,7 +856,7 @@ TkpDisplayButton( void TkpComputeButtonGeometry( - register TkButton *butPtr) /* Button whose geometry may have changed. */ + TkButton *butPtr) /* Button whose geometry may have changed. */ { int width, height, avgWidth, txtWidth, txtHeight; int haveImage = 0, haveText = 0; diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index fc8b4f2..4ef5af2 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -145,7 +145,7 @@ TkpNewMenu( void TkpDestroyMenu( - TkMenu *menuPtr) + TCL_UNUSED(TkMenu *)) { /* * Nothing to do. @@ -171,7 +171,7 @@ TkpDestroyMenu( void TkpDestroyMenuEntry( - TkMenuEntry *mEntryPtr) + TCL_UNUSED(TkMenuEntry *)) { /* * Nothing to do. @@ -199,7 +199,7 @@ TkpDestroyMenuEntry( int TkpConfigureMenuEntry( - register TkMenuEntry *mePtr)/* Information about menu entry; may or may + TkMenuEntry *mePtr)/* Information about menu entry; may or may * not already have values for some fields. */ { /* @@ -239,7 +239,7 @@ TkpConfigureMenuEntry( int TkpMenuNewEntry( - TkMenuEntry *mePtr) + TCL_UNUSED(TkMenuEntry *)) { return TCL_OK; } @@ -292,9 +292,9 @@ TkpSetWindowMenuBar( void TkpSetMainMenubar( - Tcl_Interp *interp, - Tk_Window tkwin, - const char *menuName) + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(const char *)) { /* * Nothing to do. @@ -323,8 +323,8 @@ static void GetMenuIndicatorGeometry( TkMenu *menuPtr, /* The menu we are drawing. */ TkMenuEntry *mePtr, /* The entry we are interested in. */ - Tk_Font tkfont, /* The precalculated font */ - const Tk_FontMetrics *fmPtr,/* The precalculated metrics */ + TCL_UNUSED(Tk_Font), /* The precalculated font */ + TCL_UNUSED(const Tk_FontMetrics *),/* The precalculated metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { @@ -445,7 +445,6 @@ DrawMenuEntryBackground( } else { relief = TK_RELIEF_RAISED; } - Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, @@ -524,7 +523,7 @@ DrawMenuEntryAccelerator( if (menuPtr->menuType == MENUBAR) { left += 5; } - Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel, + Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel, mePtr->accelLength, left, (y + (height + fmPtr->ascent - fmPtr->descent) / 2)); } @@ -554,11 +553,11 @@ DrawMenuEntryIndicator( Tk_3DBorder border, /* The background color */ XColor *indicatorColor, /* The color to draw indicators with */ XColor *disableColor, /* The color use use when disabled */ - Tk_Font tkfont, /* The font to draw with */ - const Tk_FontMetrics *fmPtr,/* The font metrics of the font */ + TCL_UNUSED(Tk_Font), /* The font to draw with */ + TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics of the font */ int x, /* The left of the entry rect */ int y, /* The top of the entry rect */ - int width, /* Width of menu entry */ + TCL_UNUSED(int), /* Width of menu entry */ int height) /* Height of menu entry */ { /* @@ -623,11 +622,11 @@ DrawMenuEntryIndicator( static void DrawMenuSeparator( TkMenu *menuPtr, /* The menu we are drawing */ - TkMenuEntry *mePtr, /* The entry we are drawing */ + TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */ Drawable d, /* The drawable we are using */ - GC gc, /* The gc to draw into */ - Tk_Font tkfont, /* The font to draw with */ - const Tk_FontMetrics *fmPtr,/* The font metrics from the font */ + TCL_UNUSED(GC), /* The gc to draw into */ + TCL_UNUSED(Tk_Font), /* The font to draw with */ + TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics from the font */ int x, int y, int width, int height) { @@ -790,7 +789,7 @@ DrawMenuEntryLabel( imageHeight, d, leftEdge + imageXOffset, (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset)); } - } else if (mePtr->bitmapPtr != None) { + } else if (mePtr->bitmapPtr != NULL) { Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr); XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0, @@ -818,7 +817,7 @@ DrawMenuEntryLabel( XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y, (unsigned) width, (unsigned) height); } else if ((mePtr->image != NULL) - && (menuPtr->disabledImageGC != None)) { + && (menuPtr->disabledImageGC != NULL)) { XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC, leftEdge + imageXOffset, (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), @@ -852,7 +851,7 @@ DrawMenuUnderline( Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int x, int y, - int width, int height) + TCL_UNUSED(int), int height) { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; @@ -931,7 +930,7 @@ TkpPostMenu( int TkpPostTearoffMenu( - Tcl_Interp *interp, /* The interpreter of the menu */ + TCL_UNUSED(Tcl_Interp *), /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The root X,Y coordinates where the * specified entry will be posted */ @@ -1021,9 +1020,9 @@ TkpPostTearoffMenu( static void GetMenuSeparatorGeometry( - TkMenu *menuPtr, /* The menu we are measuring */ - TkMenuEntry *mePtr, /* The entry we are measuring */ - Tk_Font tkfont, /* The precalculated font */ + TCL_UNUSED(TkMenu *), /* The menu we are measuring */ + TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */ + TCL_UNUSED(Tk_Font), /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ @@ -1051,7 +1050,7 @@ GetMenuSeparatorGeometry( static void GetTearoffEntryGeometry( TkMenu *menuPtr, /* The menu we are drawing */ - TkMenuEntry *mePtr, /* The entry we are measuring */ + TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */ Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int *widthPtr, /* The resulting width */ @@ -1092,15 +1091,13 @@ TkpComputeMenubarGeometry( Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int width, height, i, j, x, y, currentRowHeight, maxWidth; int maxWindowWidth, lastRowBreak, lastEntry; - int borderWidth, activeBorderWidth, helpMenuIndex = -1; + int activeBorderWidth, helpMenuIndex = -1; TkMenuEntry *mePtr; if (menuPtr->tkwin == NULL) { return; } - Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, - &borderWidth); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); maxWidth = 0; @@ -1122,7 +1119,7 @@ TkpComputeMenubarGeometry( /* * On the Mac especially, getting font metrics can be quite slow, so * we want to do it intelligently. We are going to precalculate them - * and pass them down to all of the measureing and drawing routines. + * and pass them down to all of the measuring and drawing routines. * We will measure the font metrics of the menu once, and if an entry * has a font set, we will measure it as we come to it, and then we * decide which set to give the geometry routines. @@ -1269,11 +1266,11 @@ TkpComputeMenubarGeometry( static void DrawTearoffEntry( TkMenu *menuPtr, /* The menu we are drawing */ - TkMenuEntry *mePtr, /* The entry we are drawing */ + TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */ Drawable d, /* The drawable we are drawing into */ - GC gc, /* The gc we are drawing with */ - Tk_Font tkfont, /* The font we are drawing with */ - const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */ + TCL_UNUSED(GC), /* The gc we are drawing with */ + TCL_UNUSED(Tk_Font), /* The font we are drawing with */ + TCL_UNUSED(const Tk_FontMetrics *),/* The metrics we are drawing with */ int x, int y, int width, int height) { @@ -1324,8 +1321,8 @@ DrawTearoffEntry( void TkpInitializeMenuBindings( - Tcl_Interp *interp, /* The interpreter to set. */ - Tk_BindingTable bindingTable) + TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */ + TCL_UNUSED(Tk_BindingTable)) /* The table to add to. */ { /* @@ -1376,7 +1373,7 @@ SetHelpMenu( && (cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin != NULL) && (menuPtr->masterMenuPtr->tkwin != NULL)) { TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr; - char *helpMenuName = ckalloc(strlen(Tk_PathName( + char *helpMenuName = (char *)ckalloc(strlen(Tk_PathName( masterMenuPtr->tkwin)) + strlen(".help") + 1); strcpy(helpMenuName, Tk_PathName(masterMenuPtr->tkwin)); @@ -1852,8 +1849,8 @@ TkpComputeStandardMenuGeometry( void TkpMenuNotifyToplevelCreate( - Tcl_Interp *interp, /* The interp the menu lives in. */ - const char *menuName) /* The name of the menu to reconfigure. */ + TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */ + TCL_UNUSED(const char *)) /* The name of the menu to reconfigure. */ { /* * Nothing to do. diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index 2c6b99b..6677e83 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -25,16 +25,16 @@ * Returns a newly allocated TkMenuButton structure. * * Side effects: - * Registers an event handler for the widget. + * None * *---------------------------------------------------------------------- */ TkMenuButton * TkpCreateMenuButton( - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { - return ckalloc(sizeof(TkMenuButton)); + return (TkMenuButton *)ckalloc(sizeof(TkMenuButton)); } /* @@ -280,8 +280,6 @@ TkpDisplayMenuButton( mbPtr->borderWidth, mbPtr->relief); } if (mbPtr->highlightWidth != 0) { - GC gc; - if (mbPtr->flags & GOT_FOCUS) { gc = Tk_GCForColor(mbPtr->highlightColorPtr, pixmap); } else { diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index 4819183..527bc4c 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -240,17 +240,17 @@ TkSelGetSelection( void TkSelPropProc( - register XEvent *eventPtr) /* X PropertyChange event. */ + XEvent *eventPtr) /* X PropertyChange event. */ { - register IncrInfo *incrPtr; - register TkSelHandler *selPtr; + IncrInfo *incrPtr; + TkSelHandler *selPtr; int length, numItems; unsigned long i; Atom target, formatType; long buffer[TK_SEL_WORDS_AT_ONCE]; TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display); Tk_ErrorHandler errorHandler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -356,7 +356,7 @@ TkSelPropProc( ((char *) buffer)[numItems] = 0; errorHandler = Tk_CreateErrorHandler(eventPtr->xproperty.display, - -1, -1, -1, (int (*)()) NULL, NULL); + -1, -1, -1, NULL, NULL); /* * Encode the data using the proper format for each type. @@ -449,7 +449,7 @@ TkSelPropProc( if (srcLen > 3) { Tcl_Panic("selection conversion left too many bytes unconverted"); } - memcpy(incrPtr->converts[i].buffer, src, (size_t) srcLen+1); + memcpy(incrPtr->converts[i].buffer, src, srcLen + 1); Tcl_DStringFree(&ds); } else { /* @@ -519,10 +519,10 @@ TkSelPropProc( void TkSelEventProc( Tk_Window tkwin, /* Window for which event was targeted. */ - register XEvent *eventPtr) /* X event: either SelectionClear, + XEvent *eventPtr) /* X event: either SelectionClear, * SelectionRequest, or SelectionNotify. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; Tcl_Interp *interp; @@ -540,12 +540,11 @@ TkSelEventProc( */ if (eventPtr->type == SelectionNotify) { - register TkSelRetrievalInfo *retrPtr; + TkSelRetrievalInfo *retrPtr; char *propInfo, **propInfoPtr = &propInfo; Atom type; int format, result; unsigned long numItems, bytesAfter; - Tcl_DString ds; for (retrPtr = pendingRetrievals; ; retrPtr = retrPtr->nextPtr) { if (retrPtr == NULL) { @@ -591,6 +590,7 @@ TkSelEventProc( if ((type == XA_STRING) || (type == dispPtr->textAtom) || (type == dispPtr->compoundTextAtom)) { Tcl_Encoding encoding; + Tcl_DString ds; if (format != 8) { Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf( @@ -649,7 +649,7 @@ TkSelEventProc( } if (propInfo[numItems] != '\0') { - propData = ckalloc(numItems + 1); + propData = (char *)ckalloc(numItems + 1); strcpy(propData, propInfo); propData[numItems] = '\0'; } @@ -742,7 +742,7 @@ static void SelTimeoutProc( ClientData clientData) /* Information about retrieval in progress. */ { - register TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; /* * Make sure that the retrieval is still in progress. Then see how long @@ -766,7 +766,7 @@ SelTimeoutProc( retrPtr->result = TCL_ERROR; } else { retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc, - (ClientData) retrPtr); + retrPtr); } } @@ -796,7 +796,7 @@ ConvertSelection( * request; may not be selection's current * owner, be we set it to the current * owner. */ - register XSelectionRequestEvent *eventPtr) + XSelectionRequestEvent *eventPtr) /* Event describing request. */ { union { @@ -813,11 +813,11 @@ ConvertSelection( Tk_ErrorHandler errorHandler; TkSelectionInfo *infoPtr; TkSelInProgress ip; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1, - (int (*)()) NULL, NULL); + errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1, + -1, NULL, NULL); /* * Initialize the reply event. @@ -893,12 +893,12 @@ ConvertSelection( * below). */ - incr.converts = ckalloc(incr.numConversions * sizeof(ConvertInfo)); + incr.converts = (ConvertInfo *)ckalloc(incr.numConversions * sizeof(ConvertInfo)); incr.numIncrs = 0; for (i = 0; i < incr.numConversions; i++) { Atom target, property, type; long buffer[TK_SEL_WORDS_AT_ONCE]; - register TkSelHandler *selPtr; + TkSelHandler *selPtr; int numItems, format; char *propPtr; @@ -919,7 +919,7 @@ ConvertSelection( /* * Nobody seems to know about this kind of request. If it's of a * sort that we can handle without any help, do it. Otherwise mark - * the request as an errror. + * the request as an error. */ numItems = TkSelDefaultSelection(infoPtr, target, (char *) buffer, @@ -1064,7 +1064,7 @@ ConvertSelection( } Tcl_DeleteTimerHandler(incr.timeout); errorHandler = Tk_CreateErrorHandler(winPtr->display, - -1, -1, -1, (int (*)()) NULL, NULL); + -1, -1, -1, NULL, NULL); XSelectInput(reply.xsel.display, reply.xsel.requestor, 0L); Tk_DeleteErrorHandler(errorHandler); if (tsdPtr->pendingIncrs == &incr) { @@ -1124,9 +1124,9 @@ ConvertSelection( static void SelRcvIncrProc( ClientData clientData, /* Information about retrieval. */ - register XEvent *eventPtr) /* X PropertyChange event. */ + XEvent *eventPtr) /* X PropertyChange event. */ { - register TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; char *propInfo, **propInfoPtr = &propInfo; Atom type; int format, result; @@ -1374,7 +1374,7 @@ IncrTimeoutProc( * retrieval for which we are selection * owner. */ { - register IncrInfo *incrPtr = clientData; + IncrInfo *incrPtr = (IncrInfo *)clientData; incrPtr->idleTime++; if (incrPtr->idleTime >= 5) { @@ -1435,7 +1435,7 @@ SelCvtToX( if (Tcl_SplitList(NULL, string, &numFields, &field) != TCL_OK) { return NULL; } - propPtr = ckalloc(numFields * sizeof(long)); + propPtr = (long *)ckalloc(numFields * sizeof(long)); /* * Convert the fields one-by-one. @@ -1487,7 +1487,7 @@ SelCvtToX( static void SelCvtFromX32( - register long *propPtr, /* Property value from X. */ + long *propPtr, /* Property value from X. */ int numValues, /* Number of 32-bit values in property. */ Atom type, /* Type of property Should not be XA_STRING * (if so, don't bother calling this function @@ -1520,12 +1520,12 @@ SelCvtFromX32( static void SelCvtFromX8( - register char *propPtr, /* Property value from X. */ + char *propPtr, /* Property value from X. */ int numValues, /* Number of 8-bit values in property. */ - Atom type, /* Type of property Should not be XA_STRING + TCL_UNUSED(Atom), /* Type of property Should not be XA_STRING * (if so, don't bother calling this function * at all). */ - Tk_Window tkwin, /* Window to use for atom conversion. */ + TCL_UNUSED(Tk_Window), /* Window to use for atom conversion. */ Tcl_DString *dsPtr) /* Where to store the converted string. */ { /* -- cgit v0.12 From 5e7c6982ce66c388008bd5a81fac55fbf5b900da Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 5 Oct 2020 11:09:07 +0000 Subject: Fix build problem on UNIX (due to the introduction of TCL_UNUSED macro) --- generic/tkTest.c | 1 - unix/tkUnixMenu.c | 36 ------------------------------------ unix/tkUnixSelect.c | 3 --- 3 files changed, 40 deletions(-) diff --git a/generic/tkTest.c b/generic/tkTest.c index 125a9c2..2622c9c 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -1387,7 +1387,6 @@ ImageCreate( TImageModel *timPtr; const char *varName; int i; - (void)typePtr; varName = "log"; for (i = 0; i < objc; i += 2) { diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index e4899f2..a36effa 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -146,8 +146,6 @@ void TkpDestroyMenu( TCL_UNUSED(TkMenu *)) { - (void)menuPtr; - /* * Nothing to do. */ @@ -174,8 +172,6 @@ void TkpDestroyMenuEntry( TCL_UNUSED(TkMenuEntry *)) { - (void)mEntryPtr; - /* * Nothing to do. */ @@ -244,8 +240,6 @@ int TkpMenuNewEntry( TCL_UNUSED(TkMenuEntry *)) { - (void)mePtr; - return TCL_OK; } @@ -301,10 +295,6 @@ TkpSetMainMenubar( TCL_UNUSED(Tk_Window), TCL_UNUSED(const char *)) { - (void)interp; - (void)tkwin; - (void)menuName; - /* * Nothing to do. */ @@ -338,8 +328,6 @@ GetMenuIndicatorGeometry( int *heightPtr) /* The resulting height */ { int borderWidth; - (void)tkfont; - (void)fmPtr; if ((mePtr->type == CHECK_BUTTON_ENTRY) || (mePtr->type == RADIO_BUTTON_ENTRY)) { @@ -571,10 +559,6 @@ DrawMenuEntryIndicator( TCL_UNUSED(int), /* Width of menu entry */ int height) /* Height of menu entry */ { - (void)tkfont; - (void)fmPtr; - (void)width; - /* * Draw check-button indicator. */ @@ -647,11 +631,6 @@ DrawMenuSeparator( { XPoint points[2]; Tk_3DBorder border; - (void)mePtr; - (void)gc; - (void)tkfont; - (void)fmPtr; - if (menuPtr->menuType == MENUBAR) { return; } @@ -872,8 +851,6 @@ DrawMenuUnderline( int x, int y, TCL_UNUSED(int), int height) { - (void)width; - if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; @@ -1048,10 +1025,6 @@ GetMenuSeparatorGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { - (void)menuPtr; - (void)mePtr; - (void)tkfont; - *widthPtr = 0; *heightPtr = fmPtr->linespace; } @@ -1081,8 +1054,6 @@ GetTearoffEntryGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { - (void)mePtr; - if (menuPtr->menuType != MAIN_MENU) { *heightPtr = 0; *widthPtr = 0; @@ -1304,10 +1275,6 @@ DrawTearoffEntry( XPoint points[2]; int segmentWidth, maxX; Tk_3DBorder border; - (void)mePtr; - (void)gc; - (void)tkfont; - (void)fmPtr; if (menuPtr->menuType != MAIN_MENU) { return; @@ -1356,9 +1323,6 @@ TkpInitializeMenuBindings( TCL_UNUSED(Tk_BindingTable)) /* The table to add to. */ { - (void)interp; - (void)bindingTable; - /* * Nothing to do. */ diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index 858c246..527bc4c 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -1528,9 +1528,6 @@ SelCvtFromX8( TCL_UNUSED(Tk_Window), /* Window to use for atom conversion. */ Tcl_DString *dsPtr) /* Where to store the converted string. */ { - (void)type; - (void)tkwin; - /* * Convert each long in the property to a string value, which is a * hexadecimal string. We build the list in a Tcl_DString because this is -- cgit v0.12 From caa253fcf5871c9886ed214cfc4d68c5ab45d8f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 6 Oct 2020 06:01:14 +0000 Subject: More elimination of the "register" keyword, and more explicit typecasts --- generic/tk3d.c | 29 ++++--- generic/tkCanvLine.c | 6 +- tests/text.test | 8 +- unix/tkUnixCursor.c | 2 +- unix/tkUnixFont.c | 2 +- unix/tkUnixMenubu.c | 4 +- unix/tkUnixScale.c | 16 ++-- unix/tkUnixScrlbr.c | 20 ++--- unix/tkUnixSend.c | 57 +++++++------ unix/tkUnixWm.c | 223 +++++++++++++++++++++++++-------------------------- 10 files changed, 180 insertions(+), 187 deletions(-) diff --git a/generic/tk3d.c b/generic/tk3d.c index 987bace..f1cc8f1 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -90,7 +90,7 @@ Tk_Alloc3DBorderFromObj( if (objPtr->typePtr != &tkBorderObjType) { InitBorderObj(objPtr); } - borderPtr = objPtr->internalRep.twoPtrValue.ptr1; + borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkBorder, see if it's the one we @@ -127,7 +127,7 @@ Tk_Alloc3DBorderFromObj( */ if (borderPtr != NULL) { - TkBorder *firstBorderPtr = Tcl_GetHashValue(borderPtr->hashPtr); + TkBorder *firstBorderPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr); FreeBorderObj(objPtr); for (borderPtr = firstBorderPtr ; borderPtr != NULL; @@ -200,7 +200,7 @@ Tk_Get3DBorder( hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &isNew); if (!isNew) { - existingBorderPtr = Tcl_GetHashValue(hashPtr); + existingBorderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); for (borderPtr = existingBorderPtr; borderPtr != NULL; borderPtr = borderPtr->nextPtr) { if ((Tk_Screen(tkwin) == borderPtr->screen) @@ -420,12 +420,11 @@ Tk_Free3DBorder( Display *display = DisplayOfScreen(borderPtr->screen); TkBorder *prevPtr; - borderPtr->resourceRefCount--; - if (borderPtr->resourceRefCount > 0) { + if (borderPtr->resourceRefCount-- > 1) { return; } - prevPtr = Tcl_GetHashValue(borderPtr->hashPtr); + prevPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr); TkpFreeBorder(borderPtr); if (borderPtr->bgColorPtr != NULL) { Tk_FreeColor(borderPtr->bgColorPtr); @@ -527,7 +526,7 @@ static void FreeBorderObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkBorder *borderPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkBorder *borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; if (borderPtr != NULL) { borderPtr->objRefCount--; @@ -562,7 +561,7 @@ DupBorderObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkBorder *borderPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkBorder *borderPtr = (TkBorder *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = borderPtr; @@ -594,7 +593,7 @@ Tk_SetBackgroundFromBorder( Tk_Window tkwin, /* Window whose background is to be set. */ Tk_3DBorder border) /* Token for border. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; Tk_SetWindowBackground(tkwin, borderPtr->bgColorPtr->pixel); } @@ -759,7 +758,7 @@ Tk_Draw3DPolygon( { XPoint poly[4], b1, b2, newB1, newB2; XPoint perp, c, shift1, shift2; /* Used for handling parallel lines. */ - register XPoint *p1Ptr, *p2Ptr; + XPoint *p1Ptr, *p2Ptr; TkBorder *borderPtr = (TkBorder *) border; GC gc; int i, lightOnLeft, dx, dy, parallel, pointsSeen; @@ -956,7 +955,7 @@ Tk_Fill3DRectangle( int relief) /* Indicates 3D effect: TK_RELIEF_FLAT, * TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; int doubleBorder; /* @@ -1027,7 +1026,7 @@ Tk_Fill3DPolygon( * TK_RELIEF_FLAT, TK_RELIEF_RAISED, or * TK_RELIEF_SUNKEN. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; XFillPolygon(Tk_Display(tkwin), drawable, borderPtr->bgGC, pointPtr, numPoints, Complex, CoordModeOrigin); @@ -1253,7 +1252,7 @@ Tk_Get3DBorderFromObj( * cached in the internal representation of the Tcl_Obj. Check it out... */ - borderPtr = objPtr->internalRep.twoPtrValue.ptr1; + borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; if ((borderPtr != NULL) && (borderPtr->resourceRefCount > 0) && (Tk_Screen(tkwin) == borderPtr->screen) @@ -1281,7 +1280,7 @@ Tk_Get3DBorderFromObj( if (hashPtr == NULL) { goto error; } - for (borderPtr = Tcl_GetHashValue(hashPtr); borderPtr != NULL; + for (borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); borderPtr != NULL; borderPtr = borderPtr->nextPtr) { if ((Tk_Screen(tkwin) == borderPtr->screen) && (Tk_Colormap(tkwin) == borderPtr->colormap)) { @@ -1371,7 +1370,7 @@ TkDebugBorder( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, name); if (hashPtr != NULL) { - TkBorder *borderPtr = Tcl_GetHashValue(hashPtr); + TkBorder *borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); if (borderPtr == NULL) { Tcl_Panic("TkDebugBorder found empty hash table entry"); diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index ba7753e..ba4cda1 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -831,9 +831,9 @@ DisplayLine( Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ TCL_UNUSED(int), /* Describes region of canvas that must be */ - TCL_UNUSED(int), /* redisplayed (not used). */ + TCL_UNUSED(int), /* redisplayed (not used). */ TCL_UNUSED(int), - TCL_UNUSED(int)) + TCL_UNUSED(int)) { LineItem *linePtr = (LineItem *) itemPtr; XPoint staticPoints[MAX_STATIC_POINTS*3]; @@ -1949,7 +1949,7 @@ PrintArrowShape( * string here. */ { LineItem *linePtr = (LineItem *) recordPtr; - char *buffer = ckalloc(120); + char *buffer = (char *)ckalloc(120); sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA, linePtr->arrowShapeB, linePtr->arrowShapeC); diff --git a/tests/text.test b/tests/text.test index 2dbc78b..6bd0ae4 100644 --- a/tests/text.test +++ b/tests/text.test @@ -5066,11 +5066,11 @@ test text-22.132 {TextSearchCmd, multiline regexp matching} -body { void Tcl_SetObjLength(objPtr, length) - register Tcl_Obj *objPtr; /* Pointer to object. This object must - * not currently be shared. */ - register int length; /* Number of bytes desired for string + Tcl_Obj *objPtr; /* Pointer to object. This object must + * not currently be shared. */ + int length; /* Number of bytes desired for string * representation of object, not including - * terminating null byte. */ + * terminating null byte. */ \{ char *new; } diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c index 8afb92d..4c58adf 100644 --- a/unix/tkUnixCursor.c +++ b/unix/tkUnixCursor.c @@ -245,7 +245,7 @@ TkGetCursorByName( if ((argv[0][0] != '@') && !inTkTable) { XColor fg, bg; unsigned int maskIndex; - register const struct CursorName *namePtr; + const struct CursorName *namePtr; TkDisplay *dispPtr; /* diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index d524bfd..234b282 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -2636,7 +2636,7 @@ CanUseFallback( memcpy(newPtr, fontPtr->subFontArray, fontPtr->numSubFonts * sizeof(SubFont)); if (fixSubFontPtrPtr != NULL) { - register SubFont *fixSubFontPtr = *fixSubFontPtrPtr; + SubFont *fixSubFontPtr = *fixSubFontPtrPtr; if (fixSubFontPtr != &fontPtr->controlSubFont) { *fixSubFontPtrPtr = diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index 6677e83..b212aea 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -58,14 +58,14 @@ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { - register TkMenuButton *mbPtr = (TkMenuButton *) clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization needed only to stop compiler * warning. */ int y = 0; - register Tk_Window tkwin = mbPtr->tkwin; + Tk_Window tkwin = mbPtr->tkwin; int fullWidth, fullHeight; int textXOffset, textYOffset; int imageWidth, imageHeight; diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index 9c6e4f3..a603432 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -50,9 +50,9 @@ static void DisplayVerticalValue(TkScale *scalePtr, TkScale * TkpCreateScale( - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { - return ckalloc(sizeof(TkScale)); + return (TkScale *)ckalloc(sizeof(TkScale)); } /* @@ -256,7 +256,7 @@ DisplayVerticalScale( static void DisplayVerticalValue( - register TkScale *scalePtr, /* Information about widget in which to + TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ @@ -267,7 +267,7 @@ DisplayVerticalValue( * specified in pixels. */ const char *format) /* Format string to use for the value */ { - register Tk_Window tkwin = scalePtr->tkwin; + Tk_Window tkwin = scalePtr->tkwin; int y, width, length; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; @@ -325,7 +325,7 @@ DisplayHorizontalScale( * to reflect the part of the window that was * redrawn. */ { - register Tk_Window tkwin = scalePtr->tkwin; + Tk_Window tkwin = scalePtr->tkwin; int x, y, width, height, shadowWidth; double tickInterval = scalePtr->tickInterval; Tk_3DBorder sliderBorder; @@ -479,7 +479,7 @@ DisplayHorizontalScale( static void DisplayHorizontalValue( - register TkScale *scalePtr, /* Information about widget in which to + TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ @@ -490,7 +490,7 @@ DisplayHorizontalValue( * in pixels. */ const char *format) /* Format string to use for the value */ { - register Tk_Window tkwin = scalePtr->tkwin; + Tk_Window tkwin = scalePtr->tkwin; int x, y, length, width; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; @@ -546,7 +546,7 @@ void TkpDisplayScale( ClientData clientData) /* Widget record for scale. */ { - TkScale *scalePtr = (TkScale *) clientData; + TkScale *scalePtr = (TkScale *)clientData; Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; Pixmap pixmap; diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c index 9b75431..69843db 100644 --- a/unix/tkUnixScrlbr.c +++ b/unix/tkUnixScrlbr.c @@ -63,7 +63,7 @@ TkScrollbar * TkpCreateScrollbar( Tk_Window tkwin) { - UnixScrollbar *scrollPtr = ckalloc(sizeof(UnixScrollbar)); + UnixScrollbar *scrollPtr = (UnixScrollbar *)ckalloc(sizeof(UnixScrollbar)); scrollPtr->troughGC = NULL; scrollPtr->copyGC = NULL; @@ -97,8 +97,8 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - register TkScrollbar *scrollPtr = (TkScrollbar *) clientData; - register Tk_Window tkwin = scrollPtr->tkwin; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; + Tk_Window tkwin = scrollPtr->tkwin; XPoint points[7]; Tk_3DBorder border; int relief, width, elementBorderWidth; @@ -277,7 +277,7 @@ TkpDisplayScrollbar( extern void TkpComputeScrollbarGeometry( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Scrollbar whose geometry may have * changed. */ { @@ -394,22 +394,22 @@ TkpDestroyScrollbar( void TkpConfigureScrollbar( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Information about widget; may or may not * already have values for some fields. */ { XGCValues gcValues; - GC new; + GC newGC; UnixScrollbar *unixScrollPtr = (UnixScrollbar *) scrollPtr; Tk_SetBackgroundFromBorder(scrollPtr->tkwin, scrollPtr->bgBorder); gcValues.foreground = scrollPtr->troughColorPtr->pixel; - new = Tk_GetGC(scrollPtr->tkwin, GCForeground, &gcValues); + newGC = Tk_GetGC(scrollPtr->tkwin, GCForeground, &gcValues); if (unixScrollPtr->troughGC != NULL) { Tk_FreeGC(scrollPtr->display, unixScrollPtr->troughGC); } - unixScrollPtr->troughGC = new; + unixScrollPtr->troughGC = newGC; if (unixScrollPtr->copyGC == NULL) { gcValues.graphics_exposures = False; unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin, @@ -437,12 +437,12 @@ TkpConfigureScrollbar( int TkpScrollbarPosition( - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { int length, width, tmp; - register const int inset = scrollPtr->inset; + const int inset = scrollPtr->inset; if (scrollPtr->vertical) { length = Tk_Height(scrollPtr->tkwin); diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 1ee4bba..03d124f 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -269,7 +269,7 @@ RegOpen( handler = Tk_CreateErrorHandler(dispPtr->display, -1, -1, -1, NULL, NULL); - regPtr = ckalloc(sizeof(NameRegistry)); + regPtr = (NameRegistry *)ckalloc(sizeof(NameRegistry)); regPtr->dispPtr = dispPtr; regPtr->locked = 0; regPtr->modified = 0; @@ -479,7 +479,7 @@ RegAddName( sprintf(id, "%x ", (unsigned) commWindow); idLength = strlen(id); newBytes = idLength + strlen(name) + 1; - newProp = ckalloc(regPtr->propLength + newBytes); + newProp = (char *)ckalloc(regPtr->propLength + newBytes); strcpy(newProp, id); strcpy(newProp+idLength, name); if (regPtr->property != NULL) { @@ -808,7 +808,7 @@ Tk_SetAppName( const char *actualName; Tcl_DString dString; int offset, i; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); interp = winPtr->mainPtr->interp; @@ -830,7 +830,7 @@ Tk_SetAppName( * the "send" command to the interpreter. */ - riPtr = ckalloc(sizeof(RegisteredInterp)); + riPtr = (RegisteredInterp *)ckalloc(sizeof(RegisteredInterp)); riPtr->interp = interp; riPtr->dispPtr = winPtr->dispPtr; riPtr->nextPtr = tsdPtr->interpListPtr; @@ -914,7 +914,7 @@ Tk_SetAppName( RegAddName(regPtr, actualName, Tk_WindowId(dispPtr->commTkwin)); RegClose(regPtr); - riPtr->name = ckalloc(strlen(actualName) + 1); + riPtr->name = (char *)ckalloc(strlen(actualName) + 1); strcpy(riPtr->name, actualName); if (actualName != name) { Tcl_DStringFree(&dString); @@ -943,7 +943,7 @@ Tk_SetAppName( int Tk_SendObjCmd( - ClientData clientData, /* Information about sender (only dispPtr + TCL_UNUSED(void *), /* Information about sender (only dispPtr * field is used). */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -958,7 +958,7 @@ Tk_SendObjCmd( TkWindow *winPtr; Window commWindow; PendingCommand pending; - register RegisteredInterp *riPtr; + RegisteredInterp *riPtr; const char *destName; int result, index, async, i, firstArg; Tk_RestrictProc *prevProc; @@ -967,7 +967,7 @@ Tk_SendObjCmd( Tcl_Time timeout; NameRegistry *regPtr; Tcl_DString request; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Interp *localInterp; /* Used when the interpreter to send the * command to is within the same process. */ @@ -1175,7 +1175,7 @@ Tk_SendObjCmd( msg = "target application died"; } pending.code = TCL_ERROR; - pending.result = ckalloc(strlen(msg) + 1); + pending.result = (char *)ckalloc(strlen(msg) + 1); strcpy(pending.result, msg); pending.gotResponse = 1; } else { @@ -1356,7 +1356,7 @@ TkSendCleanup( static int SendInit( - Tcl_Interp *interp, /* Interpreter to use for error reporting (no + TCL_UNUSED(Tcl_Interp *), /* Interpreter to use for error reporting (no * errors are ever returned, but the * interpreter is needed anyway). */ TkDisplay *dispPtr) /* Display to initialize. */ @@ -1419,14 +1419,14 @@ SendEventProc( ClientData clientData, /* Display information. */ XEvent *eventPtr) /* Information about event. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; char *propInfo, **propInfoPtr = &propInfo; const char *p; int result, actualFormat; unsigned long numItems, bytesAfter; Atom actualType; Tcl_Interp *remoteInterp; /* Interp in which to execute the command. */ - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if ((eventPtr->xproperty.atom != dispPtr->commProperty) @@ -1698,16 +1698,16 @@ SendEventProc( } pcPtr->code = code; if (resultString != NULL) { - pcPtr->result = ckalloc(strlen(resultString) + 1); + pcPtr->result = (char *)ckalloc(strlen(resultString) + 1); strcpy(pcPtr->result, resultString); } if (code == TCL_ERROR) { if (errorInfo != NULL) { - pcPtr->errorInfo = ckalloc(strlen(errorInfo) + 1); + pcPtr->errorInfo = (char *)ckalloc(strlen(errorInfo) + 1); strcpy(pcPtr->errorInfo, errorInfo); } if (errorCode != NULL) { - pcPtr->errorCode = ckalloc(strlen(errorCode) + 1); + pcPtr->errorCode = (char *)ckalloc(strlen(errorCode) + 1); strcpy(pcPtr->errorCode, errorCode); } } @@ -1774,15 +1774,14 @@ AppendPropCarefully( * operation above. */ - /* ARGSUSED */ static int AppendErrorProc( ClientData clientData, /* Command to mark complete, or NULL. */ - XErrorEvent *errorPtr) /* Information about error. */ + TCL_UNUSED(XErrorEvent *)) /* Information about error. */ { - PendingCommand *pendingPtr = clientData; - register PendingCommand *pcPtr; - ThreadSpecificData *tsdPtr = + PendingCommand *pendingPtr = (PendingCommand *)clientData; + PendingCommand *pcPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (pendingPtr == NULL) { @@ -1796,7 +1795,7 @@ AppendErrorProc( for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL; pcPtr = pcPtr->nextPtr) { if ((pcPtr == pendingPtr) && (pcPtr->result == NULL)) { - pcPtr->result = ckalloc(strlen(pcPtr->target) + 50); + pcPtr->result = (char *)ckalloc(strlen(pcPtr->target) + 50); sprintf(pcPtr->result, "no application named \"%s\"", pcPtr->target); pcPtr->code = TCL_ERROR; @@ -1829,10 +1828,10 @@ DeleteProc( ClientData clientData) /* Info about registration, passed as * ClientData. */ { - RegisteredInterp *riPtr = clientData; - register RegisteredInterp *riPtr2; + RegisteredInterp *riPtr = (RegisteredInterp *)clientData; + RegisteredInterp *riPtr2; NameRegistry *regPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); regPtr = RegOpen(riPtr->interp, riPtr->dispPtr, 1); @@ -1874,11 +1873,10 @@ DeleteProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static Tk_RestrictAction SendRestrictProc( - ClientData clientData, /* Not used. */ - register XEvent *eventPtr) /* Event that just arrived. */ + TCL_UNUSED(void *), /* Not used. */ + XEvent *eventPtr) /* Event that just arrived. */ { TkDisplay *dispPtr; @@ -1921,7 +1919,7 @@ UpdateCommWindow( { Tcl_DString names; RegisteredInterp *riPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DStringInit(&names); @@ -1954,7 +1952,6 @@ UpdateCommWindow( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int TkpTestsendCmd( ClientData clientData, /* Main window for application. */ @@ -1968,7 +1965,7 @@ TkpTestsendCmd( static const char *const testsendOptions[] = { "bogus", "prop", "serial", NULL }; - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; Tk_ErrorHandler handler; int index; diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index f1d1fe0..83b36e3 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -36,7 +36,7 @@ typedef struct ProtocolHandler { } ProtocolHandler; #define HANDLER_SIZE(cmdLength) \ - ((unsigned) ((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength)) + ((unsigned)((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength)) /* * Data for [wm attributes] command: @@ -564,10 +564,10 @@ void TkWmNewWindow( TkWindow *winPtr) /* Newly-created top-level window. */ { - register WmInfo *wmPtr; + WmInfo *wmPtr; TkDisplay *dispPtr = winPtr->dispPtr; - wmPtr = ckalloc(sizeof(WmInfo)); + wmPtr = (WmInfo *)ckalloc(sizeof(WmInfo)); memset(wmPtr, 0, sizeof(WmInfo)); wmPtr->winPtr = winPtr; wmPtr->reparent = None; @@ -659,7 +659,7 @@ TkWmMapWindow( TkWindow *winPtr) /* Top-level window that's about to be * mapped. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; XTextProperty textProp; if (wmPtr->flags & WM_NEVER_MAPPED) { @@ -827,7 +827,7 @@ void TkWmDeadWindow( TkWindow *winPtr) /* Top-level window that's being deleted. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; WmInfo *wmPtr2; if (wmPtr == NULL) { @@ -836,7 +836,7 @@ TkWmDeadWindow( if ((WmInfo *) winPtr->dispPtr->firstWmPtr == wmPtr) { winPtr->dispPtr->firstWmPtr = wmPtr->nextPtr; } else { - register WmInfo *prevPtr; + WmInfo *prevPtr; for (prevPtr = (WmInfo *) winPtr->dispPtr->firstWmPtr; ; prevPtr = prevPtr->nextPtr) { @@ -1005,7 +1005,6 @@ TkWmSetClass( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tk_WmObjCmd( ClientData clientData, /* Main window associated with interpreter. */ @@ -1013,7 +1012,7 @@ Tk_WmObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", @@ -1182,13 +1181,13 @@ Tk_WmObjCmd( static int WmAspectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; if ((objc != 3) && (objc != 7)) { @@ -1315,7 +1314,7 @@ WmSetAttribute( SetNetWmState(winPtr, "_NET_WM_STATE_FULLSCREEN", wmPtr->reqState.fullscreen); break; - case _WMATT_LAST_ATTRIBUTE: /* NOTREACHED */ + case _WMATT_LAST_ATTRIBUTE: return TCL_ERROR; } return TCL_OK; @@ -1352,10 +1351,9 @@ WmGetAttribute( return Tcl_NewBooleanObj(wmPtr->attributes.fullscreen); case WMATT_TYPE: return GetNetWmType(winPtr); - case _WMATT_LAST_ATTRIBUTE: /*NOTREACHED*/ + case _WMATT_LAST_ATTRIBUTE: break; } - /*NOTREACHED*/ return NULL; } @@ -1385,7 +1383,7 @@ WmGetAttribute( static int WmAttributesCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -1449,13 +1447,13 @@ WmAttributesCmd( static int WmClientCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; @@ -1486,7 +1484,7 @@ WmClientCmd( if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } - wmPtr->clientMachine = ckalloc(length + 1); + wmPtr->clientMachine = (char *)ckalloc(length + 1); strcpy(wmPtr->clientMachine, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; @@ -1541,7 +1539,7 @@ WmColormapwindowsCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Window *cmapList; TkWindow *winPtr2; int count, i, windowObjc, gotToplevel; @@ -1584,7 +1582,7 @@ WmColormapwindowsCmd( != TCL_OK) { return TCL_ERROR; } - cmapList = ckalloc((windowObjc+1) * sizeof(Window)); + cmapList = (Window *)ckalloc((windowObjc+1) * sizeof(Window)); gotToplevel = 0; for (i = 0; i < windowObjc; i++) { Tk_Window mapWin; @@ -1636,13 +1634,13 @@ WmColormapwindowsCmd( static int WmCommandCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int cmdArgc; const char **cmdArgv; @@ -1705,13 +1703,13 @@ WmCommandCmd( static int WmDeiconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1755,13 +1753,13 @@ WmDeiconifyCmd( static int WmFocusmodelCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "active", "passive", NULL }; enum options { @@ -1810,13 +1808,13 @@ WmFocusmodelCmd( static int WmForgetCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window) winPtr; if (Tk_IsTopLevel(frameWin)) { TkFocusJoin(winPtr); @@ -1863,13 +1861,13 @@ WmForgetCmd( static int WmFrameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Window window; char buf[TCL_INTEGER_SPACE]; @@ -1905,13 +1903,13 @@ WmFrameCmd( static int WmGeometryCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; char xSign, ySign; int width, height; const char *argv3; @@ -1965,13 +1963,13 @@ WmGeometryCmd( static int WmGridCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; if ((objc != 3) && (objc != 7)) { @@ -2070,7 +2068,7 @@ WmGroupCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; const char *argv3; @@ -2114,7 +2112,7 @@ WmGroupCmd( } wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr); wmPtr->hints.flags |= WindowGroupHint; - wmPtr->leaderName = ckalloc(length + 1); + wmPtr->leaderName = (char *)ckalloc(length + 1); strcpy(wmPtr->leaderName, argv3); } UpdateHints(winPtr); @@ -2140,13 +2138,13 @@ WmGroupCmd( static int WmIconbitmapCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; @@ -2200,13 +2198,13 @@ WmIconbitmapCmd( static int WmIconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -2275,7 +2273,7 @@ WmIconmaskCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; @@ -2328,13 +2326,13 @@ WmIconmaskCmd( static int WmIconnameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; @@ -2380,13 +2378,13 @@ WmIconnameCmd( static int WmIconphotoCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_PhotoHandle photo; Tk_PhotoImageBlock block; int i, size = 0, width, height, index = 0, x, y, isDefault = 0; @@ -2437,7 +2435,7 @@ WmIconphotoCmd( * defines CARD32 arrays to use. [Bug 2902814] */ - iconPropertyData = attemptckalloc(sizeof(unsigned long) * size); + iconPropertyData = (unsigned long *)attemptckalloc(sizeof(unsigned long) * size); if (iconPropertyData == NULL) { return TCL_ERROR; } @@ -2479,9 +2477,9 @@ WmIconphotoCmd( iconPropertyData[index++] = (unsigned long) height; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { - register unsigned char *pixelPtr = + unsigned char *pixelPtr = block.pixelPtr + x*block.pixelSize + y*block.pitch; - register unsigned long R, G, B, A; + unsigned long R, G, B, A; R = pixelPtr[block.offset[0]]; G = pixelPtr[block.offset[1]]; @@ -2530,13 +2528,13 @@ WmIconphotoCmd( static int WmIconpositionCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; if ((objc != 3) && (objc != 5)) { @@ -2593,7 +2591,7 @@ WmIconwindowCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; XSetWindowAttributes atts; @@ -2707,14 +2705,14 @@ WmIconwindowCmd( static int WmManageCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + Tk_Window frameWin = (Tk_Window) winPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -2769,13 +2767,13 @@ WmManageCmd( static int WmMaxsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -2828,13 +2826,13 @@ WmMaxsizeCmd( static int WmMinsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -2879,7 +2877,7 @@ WmMinsizeCmd( static int WmOverrideredirectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2937,13 +2935,13 @@ WmOverrideredirectCmd( static int WmPositionfromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { @@ -3004,14 +3002,14 @@ WmPositionfromCmd( static int WmProtocolCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; - register ProtocolHandler *protPtr, *prevPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; int cmdLength; @@ -3082,7 +3080,7 @@ WmProtocolCmd( } cmd = Tcl_GetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { - protPtr = ckalloc(HANDLER_SIZE(cmdLength)); + protPtr = (ProtocolHandler *)ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; @@ -3114,13 +3112,13 @@ WmProtocolCmd( static int WmResizableCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -3173,13 +3171,13 @@ WmResizableCmd( static int WmSizefromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { @@ -3365,13 +3363,13 @@ WmStackorderCmd( static int WmStateCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "normal", "iconic", "withdrawn", NULL }; enum options { @@ -3471,13 +3469,13 @@ WmStateCmd( static int WmTitleCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; @@ -3496,7 +3494,7 @@ WmTitleCmd( ckfree(wmPtr->title); } argv3 = Tcl_GetStringFromObj(objv[3], &length); - wmPtr->title = ckalloc(length + 1); + wmPtr->title = (char *)ckalloc(length + 1); strcpy(wmPtr->title, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { @@ -3531,7 +3529,7 @@ WmTransientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *containerPtr = wmPtr->containerPtr, *w; WmInfo *wmPtr2; @@ -3674,13 +3672,13 @@ WmTransientCmd( static int WmWithdrawCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3729,7 +3727,7 @@ WmWaitMapProc( ClientData clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *containerPtr = winPtr->wmInfoPtr->containerPtr; if (containerPtr == NULL) { @@ -3780,7 +3778,7 @@ Tk_SetGrid( * of one grid unit. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Ensure widthInc and heightInc are greater than 0 @@ -3885,7 +3883,7 @@ Tk_UnsetGrid( * controlling gridding. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Find the top-level window for tkwin, plus the window manager @@ -4418,7 +4416,7 @@ WrapperEventProc( ClientData clientData, /* Information about toplevel window. */ XEvent *eventPtr) /* Event that just happened. */ { - WmInfo *wmPtr = clientData; + WmInfo *wmPtr = (WmInfo *)clientData; XEvent mapEvent; TkDisplay *dispPtr = wmPtr->winPtr->dispPtr; @@ -4498,10 +4496,9 @@ WrapperEventProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void TopLevelReqProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(void *), /* Not used. */ Tk_Window tkwin) /* Information about window. */ { TkWindow *winPtr = (TkWindow *) tkwin; @@ -4568,8 +4565,8 @@ static void UpdateGeometryInfo( ClientData clientData) /* Pointer to the window's record. */ { - register TkWindow *winPtr = clientData; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + TkWindow *winPtr = (TkWindow *)clientData; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, min, max; unsigned long serial; @@ -4830,7 +4827,7 @@ UpdateSizeHints( int newWidth, int newHeight) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; XSizeHints *hintsPtr; int maxWidth, maxHeight; @@ -5307,7 +5304,7 @@ WaitRestrictProc( ClientData clientData, /* Pointer to WaitRestrictInfo structure. */ XEvent *eventPtr) /* Event that is about to be handled. */ { - WaitRestrictInfo *infoPtr = clientData; + WaitRestrictInfo *infoPtr = (WaitRestrictInfo *)clientData; if (eventPtr->type == ReparentNotify) { return TK_PROCESS_EVENT; @@ -5463,7 +5460,7 @@ SetNetWmType( } if (objc > 0) { - atoms = ckalloc(sizeof(Atom) * objc); + atoms = (Atom *)ckalloc(sizeof(Atom) * objc); } for (n = 0; n < objc; ++n) { @@ -5576,10 +5573,10 @@ ParseGeometry( TkWindow *winPtr) /* Pointer to top-level window whose geometry * is to be changed. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, flags; char *end; - register const char *p = string; + const char *p = string; /* * The leading "=" is optional. @@ -5712,7 +5709,7 @@ Tk_GetRootCoords( int *yPtr) /* Where to store y-displacement of (0,0). */ { int x, y; - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; /* * Search back through this window's parents all the way to a top-level @@ -6179,7 +6176,7 @@ Tk_MoveToplevelWindow( int x, int y) /* New location for window (within parent). */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!(winPtr->flags & TK_TOP_LEVEL)) { Tcl_Panic("Tk_MoveToplevelWindow called with non-toplevel window"); @@ -6227,9 +6224,9 @@ Tk_MoveToplevelWindow( static void UpdateWmProtocols( - register WmInfo *wmPtr) /* Information about top-level window. */ + WmInfo *wmPtr) /* Information about top-level window. */ { - register ProtocolHandler *protPtr; + ProtocolHandler *protPtr; Atom deleteWindowAtom, pingAtom; int count; Atom *arrayPtr, *atomPtr; @@ -6246,7 +6243,7 @@ UpdateWmProtocols( protPtr = protPtr->nextPtr, count++) { /* Empty loop body; we're just counting the handlers. */ } - arrayPtr = ckalloc(count * sizeof(Atom)); + arrayPtr = (Atom *)ckalloc(count * sizeof(Atom)); deleteWindowAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "WM_DELETE_WINDOW"); pingAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "_NET_WM_PING"); @@ -6288,7 +6285,7 @@ TkWmProtocolEventProc( XEvent *eventPtr) /* X event. */ { WmInfo *wmPtr; - register ProtocolHandler *protPtr; + ProtocolHandler *protPtr; Atom protocol; int result; const char *protocolName; @@ -6437,7 +6434,7 @@ TkWmStackorderToplevel( Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); - window_ptr = windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *)); + window_ptr = windows = (TkWindow **)ckalloc((table.numEntries+1) * sizeof(TkWindow *)); if (windows == NULL) { return NULL; } @@ -6453,7 +6450,7 @@ TkWmStackorderToplevel( goto done; case 1: hPtr = Tcl_FirstHashEntry(&table, &search); - windows[0] = Tcl_GetHashValue(hPtr); + windows[0] = (TkWindow *)Tcl_GetHashValue(hPtr); windows[1] = NULL; goto done; } @@ -6469,9 +6466,9 @@ TkWmStackorderToplevel( windows = NULL; } else { for (i = 0; i < numChildren; i++) { - hPtr = Tcl_FindHashEntry(&table, (char *) children[i]); + hPtr = Tcl_FindHashEntry(&table, (char *)children[i]); if (hPtr != NULL) { - childWinPtr = Tcl_GetHashValue(hPtr); + childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); *window_ptr++ = childWinPtr; } } @@ -6644,7 +6641,7 @@ TkWmAddToColormapWindows( * add the toplevel itself as the last element of the list. */ - newPtr = ckalloc((count+2) * sizeof(Window)); + newPtr = (Window *)ckalloc((count+2) * sizeof(Window)); for (i = 0; i < count; i++) { newPtr[i] = oldPtr[i]; } @@ -6879,7 +6876,7 @@ GetMaxSize( static void TkSetTransientFor(Tk_Window tkwin, Tk_Window parent) { - if (parent == None) { + if (parent == NULL) { parent = Tk_Parent(tkwin); while (!Tk_IsTopLevel(parent)) parent = Tk_Parent(parent); @@ -6997,7 +6994,7 @@ CreateWrapper( TkWindow *winPtr, *wrapperPtr; Window parent; Tcl_HashEntry *hPtr; - int new; + int isNew; winPtr = wmPtr->winPtr; if (winPtr->window == None) { @@ -7041,7 +7038,7 @@ CreateWrapper( InputOutput, wrapperPtr->visual, wrapperPtr->dirtyAtts|CWOverrideRedirect, &wrapperPtr->atts); hPtr = Tcl_CreateHashEntry(&wrapperPtr->dispPtr->winTable, - (char *) wrapperPtr->window, &new); + (char *) wrapperPtr->window, &isNew); Tcl_SetHashValue(hPtr, wrapperPtr); wrapperPtr->mainPtr = winPtr->mainPtr; wrapperPtr->mainPtr->refCount++; @@ -7260,7 +7257,7 @@ MenubarReqProc( * for tkwin's toplevel. */ Tk_Window tkwin) /* Handle for menubar window. */ { - WmInfo *wmPtr = clientData; + WmInfo *wmPtr = (WmInfo *)clientData; wmPtr->menuHeight = Tk_ReqHeight(tkwin); if (wmPtr->menuHeight <= 0) { @@ -7295,7 +7292,7 @@ TkWindow * TkpGetWrapperWindow( TkWindow *winPtr) /* A toplevel window pointer. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if ((winPtr == NULL) || (wmPtr == NULL)) { return NULL; @@ -7325,7 +7322,7 @@ static void UpdateCommand( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tcl_DString cmds, ds; int i, *offsets; char **cmdArgv; @@ -7342,8 +7339,8 @@ UpdateCommand( * entire DString is done. */ - cmdArgv = ckalloc(sizeof(char *) * wmPtr->cmdArgc); - offsets = ckalloc(sizeof(int) * wmPtr->cmdArgc); + cmdArgv = (char **)ckalloc(sizeof(char *) * wmPtr->cmdArgc); + offsets = (int *)ckalloc(sizeof(int) * wmPtr->cmdArgc); Tcl_DStringInit(&cmds); for (i = 0; i < wmPtr->cmdArgc; i++) { Tcl_UtfToExternalDString(NULL, wmPtr->cmdArgv[i], -1, &ds); -- cgit v0.12 From 22140449e59b9070e741eb4108f372bb602c4537 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 6 Oct 2020 07:28:25 +0000 Subject: When adding the -Werror option to CFLAGS, the HAVE_PW_GECOS detection doesn't work any more. Here's the fix. --- unix/configure | 2 +- unix/configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/configure b/unix/configure index fe229ad..7e1f291 100755 --- a/unix/configure +++ b/unix/configure @@ -8805,7 +8805,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -struct passwd pwd; pwd.pw_gecos; +struct passwd pwd; (void)pwd.pw_gecos; ; return 0; } diff --git a/unix/configure.in b/unix/configure.in index fdffbcc..8242c7b 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -244,7 +244,7 @@ AC_CHECK_TYPE([uintptr_t], [ AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [ AC_TRY_COMPILE([#include ], - [struct passwd pwd; pwd.pw_gecos;], + [struct passwd pwd; (void)pwd.pw_gecos;], tcl_cv_pwd_pw_gecos=yes, tcl_cv_pwd_pw_gecos=no)]) if test $tcl_cv_pwd_pw_gecos = yes; then AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?]) -- cgit v0.12 From 8cd2f2d9e3a312c5f4e2ba6a5f812f3317b5c2e5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 6 Oct 2020 09:41:55 +0000 Subject: Mark winWm-9.2 testcase with failsOnUbuntu constraint --- tests/winWm.test | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/winWm.test b/tests/winWm.test index 705e355..baf8e3d 100644 --- a/tests/winWm.test +++ b/tests/winWm.test @@ -14,6 +14,7 @@ namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] test winWm-1.1 {TkWmMapWindow} -constraints win -setup { destroy .t @@ -485,7 +486,7 @@ test winWm-9.0 "Bug #2799589 - delayed activation of destroyed window" -constrai rename winwm90$cmd {} } destroy .tx .t .sd -} -result {ok} +} -result ok test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win -setup { proc winwm91click {w} { @@ -530,9 +531,9 @@ test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win rename winwm91$cmd {} } destroy .tx .t .sd -} -result {ok} +} -result ok -test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -setup { +test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -constraints failsOnUbuntu -setup { destroy .t toplevel .t set winwm92 {} @@ -541,15 +542,15 @@ test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -setup } -body { pack .t.f.x pack .t.f - lappend aid [after 2000 {set ::winwm92 timeout}] [after 100 { + lappend aid [after 5000 {set ::winwm92 timeout}] [after 500 { wm manage .t.f wm iconify .t - lappend aid [after 100 { + lappend aid [after 500 { wm forget .t.f wm deiconify .t - lappend aid [after 100 { + lappend aid [after 500 { pack .t.f - lappend aid [after 100 { + lappend aid [after 500 { set ::winwm92 [expr { [winfo rooty .t.f.x] == 0 ? "failed" : "ok"}]}] }] -- cgit v0.12 From 57b26d33d3737f509c2a4392d4843dea5d97bc3b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 6 Oct 2020 13:39:28 +0000 Subject: Sync unix/tcl.m4 with Tcl 8.6 --- unix/tcl.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 25a01ac..51ac8d9 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2339,7 +2339,7 @@ AC_DEFUN([SC_TIME_HANDLER], [ fi AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [ - AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_gmtoff;], + AC_TRY_COMPILE([#include ], [struct tm tm; (void)tm.tm_gmtoff;], tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)]) if test $tcl_cv_member_tm_gmtoff = yes ; then AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?]) -- cgit v0.12 From 9cd6dc52673b12cb03279a1252c65a7e93f496e1 Mon Sep 17 00:00:00 2001 From: marc_culler Date: Tue, 6 Oct 2020 14:24:54 +0000 Subject: Fix [175a6e4bb6]: Aqua tiled fullscreen windows cannot be resized. --- macosx/tkMacOSXSubwindows.c | 16 ++++++++++------ macosx/tkMacOSXWm.c | 7 +++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index e840cea..f4edfe0 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -360,12 +360,16 @@ XResizeWindow( NSWindow *w = macWin->winPtr->wmInfoPtr->window; if (w) { - NSRect r = [w contentRectForFrameRect:[w frame]]; - - r.origin.y += r.size.height - height; - r.size.width = width; - r.size.height = height; - [w setFrame:[w frameRectForContentRect:r] display:YES]; + if ([w styleMask] & NSFullScreenWindowMask) { + [w tkLayoutChanged]; + } else { + NSRect r = [w contentRectForFrameRect:[w frame]]; + + r.origin.y += r.size.height - height; + r.size.width = width; + r.size.height = height; + [w setFrame:[w frameRectForContentRect:r] display:YES]; + } } } else { MoveResizeWindow(macWin); diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 4a3f561..85cfa30 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6865,7 +6865,7 @@ ApplyWindowAttributeFlagChanges( * after 10.10. */ -#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101000) +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 if (!(macWindow.styleMask & NSUtilityWindowMask)) { /* * Exclude overrideredirect, transient, and "help"-styled @@ -6887,11 +6887,10 @@ ApplyWindowAttributeFlagChanges( * window. To work around this we make the max size equal * to the screen size. (For 10.11 and up, only) */ - if ([NSApp macOSVersion] > 101000) { -#if !(MAC_OS_X_VERSION_MAX_ALLOWED > 101000) + + if (@available(macOS 10.11, *)) { NSSize screenSize = [[macWindow screen] frame].size; [macWindow setMaxFullScreenContentSize:screenSize]; -#endif } } } -- cgit v0.12 From ab0f9c15a66718c8d5d9fb310cdea32a8bfcf72f Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 7 Oct 2020 06:13:57 +0000 Subject: Words matter. --- doc/bind.n | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/bind.n b/doc/bind.n index db89eae..6ba115c 100644 --- a/doc/bind.n +++ b/doc/bind.n @@ -283,8 +283,8 @@ it is destroyed. When the \fBDestroy\fR event is delivered to a widget, it is in a .QW half-dead -state: the widget still exists, but most operations on it will behave -in an undefined manner, and/or return arbitrary results. +state: the widget still exists, but operations that involve it +may return invalid results, or return an error. .RE .IP "\fBFocusIn\fR, \fBFocusOut\fR" 5 The \fBFocusIn\fR and \fBFocusOut\fR events are generated -- cgit v0.12 From 526bccf8bf38fe66da8e6e951cca4435c30869d9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 7 Oct 2020 11:52:25 +0000 Subject: Disable two test-cases for Tcl < 8.6.7 (they fail because of bug [25842c161f]) --- tests/imgPhoto.test | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test index c4b4755..46daaa2 100644 --- a/tests/imgPhoto.test +++ b/tests/imgPhoto.test @@ -129,7 +129,9 @@ testConstraint hasTeapotPhoto [file exists $teapotPhotoFile] # let's see if we have the semi-transparent one as well set transpTeapotPhotoFile [file join [file dirname [info script]] teapotTransparent.png] testConstraint hasTranspTeapotPhoto [file exists $transpTeapotPhotoFile] - +testConstraint needsTcl867 [package vsatisfies [package provide Tcl] 8.6.7-] + + test imgPhoto-1.1 {options for photo images} -body { image create photo photo1 -width 79 -height 83 list [photo1 cget -width] [photo1 cget -height] \ @@ -264,8 +266,9 @@ test imgPhoto-3.4 {ImgPhotoConfigureModel: -data } -constraints { } -cleanup { imageCleanup } -result {20 20} +# This testcase fails with Tcl < 8.6.7, due to [25842c] test imgPhoto-3.5 {ImgPhotoConfigureModel: -data } -constraints { - hasTeapotPhoto + hasTeapotPhoto needsTcl867 } -setup { image create photo photo1 -file $teapotPhotoFile image create photo photo2 @@ -1332,10 +1335,10 @@ test imgPhoto-4.117 {ImgPhotoCmd data: list colorformat} -setup { } -body { photo1 data -format {default -colorformat list} } -result {{{255 0 0 170} {0 128 0 255}} {{0 0 255 204} {255 255 255 221}}} +# This testcase fails with Tcl < 8.6.7, due to [25842c] test imgPhoto-4.118 {ImgPhotoCmd data: using data for new image results in same image as orignial } -constraints { - hasTeapotPhoto - hasTranspTeapotPhoto + hasTeapotPhoto hasTranspTeapotPhoto needsTcl867 } -setup { image create photo teapot -file $teapotPhotoFile teapot copy teapot -from 50 60 70 80 -shrink -- cgit v0.12 From 5450612a4d1bd4e6f796f76f12f3d216dfc935ba Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 7 Oct 2020 15:10:06 +0000 Subject: More warnings -Wshadow with C++ compiler. Simplify -> --- ChangeLog | 4 ++-- changes | 6 +++--- generic/tkCanvas.c | 4 ++-- generic/tkImgPNG.c | 4 ++-- generic/tkImgSVGnano.c | 6 +++--- generic/tkTest.c | 14 +++++++------- macosx/tkMacOSXScrlbr.c | 2 +- tests/bind.test | 20 ++++++++++---------- tests/imgPhoto.test | 2 +- win/tkWinMenu.c | 4 ++-- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index f01946a..4fbb0eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -714,7 +714,7 @@ a better first place to look now. 2011-10-27 Kevin B. Kenny * generic/tkInt.h: [Bug 3410609]: Change the event mechanism - * unix/tkUnixEvent.c: for events to use the keysym + * unix/tkUnixEvent.c: for events to use the keysym * unix/tkUnixKey.c: returned by XLookupString in preference to the one that appears in the raw X event at any level. This change allows binding to ISO_Level3_Shift-ed characters, composed characters, @@ -5213,7 +5213,7 @@ a better first place to look now. 2008-01-29 Joe English - * library/treeview.tcl: Fix bug in Shift-ButtonPress-1 binding (error + * library/treeview.tcl: Fix bug in Shift-Button-1 binding (error if no current focus item; reported on c.l.t.) 2008-01-29 Donal K. Fellows diff --git a/changes b/changes index 61aff06..b83c642 100644 --- a/changes +++ b/changes @@ -333,7 +333,7 @@ same menu. 4/12/92 (bug fix) Fixed core dump that occurred in tkError.c when removing the first error record from the error list. -4/15/92 (bug fix) Fixed bug in tkBind.c that prevented +4/15/92 (bug fix) Fixed bug in tkBind.c that prevented event specifications from being processed correctly: the "1" was treated as a button name rather than a keysym. @@ -3998,7 +3998,7 @@ into account the "-displayof" option. This problem also existed for the command to the Mac. Also fixed "resource write" when the resource was specified by id and already existed. (JI) -9/16/97 (bug fix) Added null bindings to for the +9/16/97 (bug fix) Added null bindings to for the text and entry widget on the Macintosh. This prevents unbound command key sequences from having the character echoed to the widget. Also fixed Cut & Copy bindings. (JI) (RJ) @@ -7527,7 +7527,7 @@ in this changeset (new minor version) rather than bug fixes: 2018-01-07 (bug)[fa8de7] Crash [ttk::checkbutton .x -variable {}] (werner) -2018-01-16 (bug)[382712] Crash in [event generate . ] (werner) +2018-01-16 (bug)[382712] Crash in [event generate . ] (werner) 2018-01-19 (bug)[657c38] Crash in menu destroy with checkbutton entry (werner) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 3bdfd00..3dd1403 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -852,7 +852,7 @@ CanvasWidgetCmd( "scan", "select", "type", "xview", "yview", NULL }; - enum options { + enum canvasOptionStringsEnum { CANV_ADDTAG, CANV_BBOX, CANV_BIND, CANV_CANVASX, CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS, CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG, @@ -876,7 +876,7 @@ CanvasWidgetCmd( Tcl_Preserve(canvasPtr); result = TCL_OK; - switch ((enum options)idx) { + switch ((enum canvasOptionStringsEnum)idx) { case CANV_ADDTAG: if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "tag searchCommand ?arg ...?"); diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index 0e0e59c..c8b2125 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -2295,7 +2295,7 @@ ParseFormat( static const char *const fmtOptions[] = { "-alpha", NULL }; - enum fmtOptions { + enum fmtOptionsEnum { OPT_ALPHA }; @@ -2332,7 +2332,7 @@ ParseFormat( objc--; objv++; - switch ((enum fmtOptions) optIndex) { + switch ((enum fmtOptionsEnum) optIndex) { case OPT_ALPHA: if (Tcl_GetDoubleFromObj(interp, objv[0], &pngPtr->alpha) == TCL_ERROR) { diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c index c18b181..4cdb648 100644 --- a/generic/tkImgSVGnano.c +++ b/generic/tkImgSVGnano.c @@ -336,7 +336,7 @@ ParseSVGWithOptions( static const char *const fmtOptions[] = { "-dpi", "-scale", "-scaletoheight", "-scaletowidth", NULL }; - enum fmtOptions { + enum fmtOptionsEnum { OPT_DPI, OPT_SCALE, OPT_SCALE_TO_HEIGHT, OPT_SCALE_TO_WIDTH }; @@ -394,7 +394,7 @@ ParseSVGWithOptions( /* * check that only one scale option is given */ - switch ((enum fmtOptions) optIndex) { + switch ((enum fmtOptionsEnum)optIndex) { case OPT_SCALE: case OPT_SCALE_TO_HEIGHT: case OPT_SCALE_TO_WIDTH: @@ -414,7 +414,7 @@ ParseSVGWithOptions( /* * Decode parameters */ - switch ((enum fmtOptions) optIndex) { + switch ((enum fmtOptionsEnum) optIndex) { case OPT_DPI: if (Tcl_GetDoubleFromObj(interp, objv[0], &dpi) == TCL_ERROR) { goto error; diff --git a/generic/tkTest.c b/generic/tkTest.c index 2622c9c..4347600 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -538,7 +538,7 @@ TestobjconfigObjCmd( * "chain2" subcommand: */ - typedef struct ExtensionWidgetRecord { + typedef struct { TrivialCommandHeader header; Tcl_Obj *base1ObjPtr; Tcl_Obj *base2ObjPtr; @@ -566,7 +566,7 @@ TestobjconfigObjCmd( switch (index) { case ALL_TYPES: { - typedef struct TypesRecord { + typedef struct { TrivialCommandHeader header; Tcl_Obj *booleanPtr; Tcl_Obj *integerPtr; @@ -784,7 +784,7 @@ TestobjconfigObjCmd( } case CONFIG_ERROR: { - typedef struct ErrorWidgetRecord { + typedef struct { Tcl_Obj *intPtr; } ErrorWidgetRecord; ErrorWidgetRecord widgetRecord; @@ -838,7 +838,7 @@ TestobjconfigObjCmd( * objects. */ - typedef struct InternalRecord { + typedef struct { TrivialCommandHeader header; int boolean; int integer; @@ -969,7 +969,7 @@ TestobjconfigObjCmd( } case NEW: { - typedef struct FiveRecord { + typedef struct { TrivialCommandHeader header; Tcl_Obj *one; Tcl_Obj *two; @@ -1028,7 +1028,7 @@ TestobjconfigObjCmd( break; } case NOT_ENOUGH_PARAMS: { - typedef struct NotEnoughRecord { + typedef struct { Tcl_Obj *fooObjPtr; } NotEnoughRecord; NotEnoughRecord record; @@ -1058,7 +1058,7 @@ TestobjconfigObjCmd( } case TWO_WINDOWS: { - typedef struct ContentRecord { + typedef struct { TrivialCommandHeader header; Tcl_Obj *windowPtr; } ContentRecord; diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index 8483cbb..3149b15 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -662,7 +662,7 @@ UpdateControlValues( * * ScrollbarEvent -- * - * This procedure is invoked in response to , + * This procedure is invoked in response to