@@ -1739,6 +1739,24 @@ proc removehead {id name} {
17391739 unset headids($name )
17401740}
17411741
1742+ proc make_transient {window origin} {
1743+ global have_tk85
1744+
1745+ # In MacOS Tk 8.4 transient appears to work by setting
1746+ # overrideredirect, which is utterly useless, since the
1747+ # windows get no border, and are not even kept above
1748+ # the parent.
1749+ if {!$have_tk85 && [tk windowingsystem] eq {aqua}} return
1750+
1751+ wm transient $window $origin
1752+
1753+ # Windows fails to place transient windows normally, so
1754+ # schedule a callback to center them on the parent.
1755+ if {[tk windowingsystem] eq {win32}} {
1756+ after idle [list tk::PlaceWindow $window widget $origin ]
1757+ }
1758+ }
1759+
17421760proc show_error {w top msg} {
17431761 message $w .m -text $msg -justify center -aspect 400
17441762 pack $w .m -side top -fill x -padx 20 -pady 20
@@ -1754,7 +1772,7 @@ proc show_error {w top msg} {
17541772proc error_popup {msg {owner .}} {
17551773 set w .error
17561774 toplevel $w
1757- wm transient $w $owner
1775+ make_transient $w $owner
17581776 show_error $w $w $msg
17591777}
17601778
@@ -1763,7 +1781,7 @@ proc confirm_popup {msg {owner .}} {
17631781 set confirm_ok 0
17641782 set w .confirm
17651783 toplevel $w
1766- wm transient $w $owner
1784+ make_transient $w $owner
17671785 message $w .m -text $msg -justify center -aspect 400
17681786 pack $w .m -side top -fill x -padx 20 -pady 20
17691787 button $w .ok -text [mc OK] -command " set confirm_ok 1; destroy $w "
@@ -2558,7 +2576,7 @@ proc about {} {
25582576 }
25592577 toplevel $w
25602578 wm title $w [mc " About gitk" ]
2561- wm transient $w .
2579+ make_transient $w .
25622580 message $w .m -text [mc "
25632581Gitk - a commit viewer for git
25642582
@@ -2587,7 +2605,7 @@ proc keys {} {
25872605 }
25882606 toplevel $w
25892607 wm title $w [mc " Gitk key bindings" ]
2590- wm transient $w .
2608+ make_transient $w .
25912609 message $w .m -text "
25922610[ mc " Gitk key bindings:" ]
25932611
@@ -3669,7 +3687,7 @@ proc vieweditor {top n title} {
36693687
36703688 toplevel $top
36713689 wm title $top $title
3672- wm transient $top .
3690+ make_transient $top .
36733691
36743692 # View name
36753693 frame $top .nfr
@@ -7912,7 +7930,7 @@ proc mkpatch {} {
79127930 set patchtop $top
79137931 catch {destroy $top }
79147932 toplevel $top
7915- wm transient $top .
7933+ make_transient $top .
79167934 label $top .title -text [mc " Generate patch" ]
79177935 grid $top .title - -pady 10
79187936 label $top .from -text [mc " From:" ]
@@ -7999,7 +8017,7 @@ proc mktag {} {
79998017 set mktagtop $top
80008018 catch {destroy $top }
80018019 toplevel $top
8002- wm transient $top .
8020+ make_transient $top .
80038021 label $top .title -text [mc " Create tag" ]
80048022 grid $top .title - -pady 10
80058023 label $top .id -text [mc " ID:" ]
@@ -8102,7 +8120,7 @@ proc writecommit {} {
81028120 set wrcomtop $top
81038121 catch {destroy $top }
81048122 toplevel $top
8105- wm transient $top .
8123+ make_transient $top .
81068124 label $top .title -text [mc " Write commit to file" ]
81078125 grid $top .title - -pady 10
81088126 label $top .id -text [mc " ID:" ]
@@ -8159,7 +8177,7 @@ proc mkbranch {} {
81598177 set top .makebranch
81608178 catch {destroy $top }
81618179 toplevel $top
8162- wm transient $top .
8180+ make_transient $top .
81638181 label $top .title -text [mc " Create new branch" ]
81648182 grid $top .title - -pady 10
81658183 label $top .id -text [mc " ID:" ]
@@ -8322,7 +8340,7 @@ proc resethead {} {
83228340 set confirm_ok 0
83238341 set w " .confirmreset"
83248342 toplevel $w
8325- wm transient $w .
8343+ make_transient $w .
83268344 wm title $w [mc " Confirm reset" ]
83278345 message $w .m -text \
83288346 [mc " Reset branch %s to %s?" $mainhead [string range $rowmenuid 0 7]] \
@@ -8502,7 +8520,7 @@ proc showrefs {} {
85028520 }
85038521 toplevel $top
85048522 wm title $top [mc " Tags and heads: %s" [file tail [pwd ]]]
8505- wm transient $top .
8523+ make_transient $top .
85068524 text $top .list -background $bgcolor -foreground $fgcolor \
85078525 -selectbackground $selectbgcolor -font mainfont \
85088526 -xscrollcommand " $top .xsb set" -yscrollcommand " $top .ysb set" \
@@ -9844,7 +9862,7 @@ proc choosefont {font which} {
98449862 font create sample
98459863 eval font config sample [font actual $font ]
98469864 toplevel $top
9847- wm transient $top $prefstop
9865+ make_transient $top $prefstop
98489866 wm title $top [mc " Gitk font chooser" ]
98499867 label $top .l -textvariable fontparam(which)
98509868 pack $top .l -side top
@@ -9961,7 +9979,7 @@ proc doprefs {} {
99619979 }
99629980 toplevel $top
99639981 wm title $top [mc " Gitk preferences" ]
9964- wm transient $top .
9982+ make_transient $top .
99659983 label $top .ldisp -text [mc " Commit list display options" ]
99669984 grid $top .ldisp - -sticky w -pady 10
99679985 label $top .spacer -text " "
0 commit comments