Merge branch 'js/persist-ref-window-geometry'
* js/persist-ref-window-geometry: gitk: persist position and size of the Tags and Heads window Revert "gitk: Only restore window size from ~/.gitk, not position"main
commit
bd3fd7e77c
37
gitk
37
gitk
|
|
@ -2131,12 +2131,14 @@ proc ttk_toplevel {w args} {
|
|||
return $w
|
||||
}
|
||||
|
||||
proc make_transient {window origin} {
|
||||
proc make_transient {window origin {geometry ""}} {
|
||||
wm transient $window $origin
|
||||
|
||||
# Windows fails to place transient windows normally, so
|
||||
# schedule a callback to center them on the parent.
|
||||
if {[tk windowingsystem] eq {win32}} {
|
||||
if {$geometry ne ""} {
|
||||
after idle [list wm geometry $window $geometry]
|
||||
} elseif {[tk windowingsystem] eq {win32}} {
|
||||
# Windows fails to place transient windows normally, so
|
||||
# schedule a callback to center them on the parent.
|
||||
after idle [list tk::PlaceWindow $window widget $origin]
|
||||
}
|
||||
}
|
||||
|
|
@ -2723,17 +2725,9 @@ proc makewindow {} {
|
|||
.pwbottom add .bright
|
||||
.ctop add .pwbottom
|
||||
|
||||
# restore window width & height if known
|
||||
# restore window position if known
|
||||
if {[info exists geometry(main)]} {
|
||||
if {[scan $geometry(main) "%dx%d" w h] >= 2} {
|
||||
if {$w > [winfo screenwidth .]} {
|
||||
set w [winfo screenwidth .]
|
||||
}
|
||||
if {$h > [winfo screenheight .]} {
|
||||
set h [winfo screenheight .]
|
||||
}
|
||||
wm geometry . "${w}x$h"
|
||||
}
|
||||
wm geometry . "$geometry(main)"
|
||||
}
|
||||
|
||||
if {[info exists geometry(state)] && $geometry(state) eq "zoomed"} {
|
||||
|
|
@ -3073,6 +3067,11 @@ proc savestuff {w} {
|
|||
puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sashpos 1] 1\""
|
||||
puts $f "set geometry(botwidth) [winfo width .bleft]"
|
||||
puts $f "set geometry(botheight) [winfo height .bleft]"
|
||||
unset -nocomplain geometry
|
||||
global geometry
|
||||
if {[info exists geometry(showrefs)]} {
|
||||
puts $f "set geometry(showrefs) $geometry(showrefs)"
|
||||
}
|
||||
|
||||
array set view_save {}
|
||||
array set views {}
|
||||
|
|
@ -10168,6 +10167,7 @@ proc rmbranch {} {
|
|||
proc showrefs {} {
|
||||
global showrefstop bgcolor fgcolor selectbgcolor
|
||||
global bglist fglist reflistfilter reflist maincursor
|
||||
global geometry
|
||||
|
||||
set top .showrefs
|
||||
set showrefstop $top
|
||||
|
|
@ -10178,7 +10178,11 @@ proc showrefs {} {
|
|||
}
|
||||
ttk_toplevel $top
|
||||
wm title $top [mc "Tags and heads: %s" [file tail [pwd]]]
|
||||
make_transient $top .
|
||||
if {[info exists geometry(showrefs)]} {
|
||||
make_transient $top . $geometry(showrefs)
|
||||
} else {
|
||||
make_transient $top .
|
||||
}
|
||||
text $top.list -background $bgcolor -foreground $fgcolor \
|
||||
-selectbackground $selectbgcolor -font mainfont \
|
||||
-xscrollcommand "$top.xsb set" -yscrollcommand "$top.ysb set" \
|
||||
|
|
@ -10214,6 +10218,9 @@ proc showrefs {} {
|
|||
bind $top.list <ButtonRelease-1> {sel_reflist %W %x %y; break}
|
||||
set reflist {}
|
||||
refill_reflist
|
||||
# avoid <Configure> being bound to child windows
|
||||
bindtags $top [linsert [bindtags $top] 1 bind$top]
|
||||
bind bind$top <Configure> {set geometry(showrefs) [wm geometry %W]}
|
||||
}
|
||||
|
||||
proc sel_reflist {w x y} {
|
||||
|
|
|
|||
Loading…
Reference in New Issue