Make gitk save and restore window pane position on Linux and Cygwin.
Subtle bugs remained on both Cygwin and Linux that caused the various window panes to be restored in positions different than where the user last placed them. Sergey Vlasov posed a pair of suggested fixes to this, what is done here is slightly different. The basic fix here involves a) explicitly remembering and restoring the sash positions for the upper window, and b) using paneconfigure to redundantly set height and width of other elements. This redundancy is needed as Cygwin Tcl has a nasty habit of setting pane sizes to zero if their slaves are not configured with a specific size, but Linux Tcl does not honor the specific size given. Signed-off-by: Mark Levedahl <mdl123@verizon.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Mark Levedahl committed
Feb 12, 2007 at 19:19 UTC
9ca72f4f60269fb6328bc9c4034d19b9479637ea
1 file changed
+13
-10
gitk
+13
-10
@@ -439,14 +439,13 @@ proc makewindow {} {
439
panedwindow .ctop -orient vertical
440
441
# possibly use assumed geometry
442
- if {![info exists geometry(topheight)]} {
442
+ if {![info exists geometry(pwsash0)]} {
443
set geometry(topheight) [expr {15 * $linespc}]
444
set geometry(topwidth) [expr {80 * $charspc}]
445
set geometry(botheight) [expr {15 * $linespc}]
446
set geometry(botwidth) [expr {50 * $charspc}]
447
- set geometry(canv) [expr {40 * $charspc}]
448
- set geometry(canv2) [expr {20 * $charspc}]
449
- set geometry(canv3) [expr {20 * $charspc}]
447
+ set geometry(pwsash0) "[expr {40 * $charspc}] 2"
448
+ set geometry(pwsash1) "[expr {60 * $charspc}] 2"
449
}
450
451
# the upper half will have a paned window, a scroll bar to the right, and some stuff below
@@ -457,18 +456,20 @@ proc makewindow {} {
456
# create three canvases
457
set cscroll .tf.histframe.csb
458
set canv .tf.histframe.pwclist.canv
460
- canvas $canv -width $geometry(canv) \
459
+ canvas $canv \
460
-background $bgcolor -bd 0 \
461
-yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll"
462
.tf.histframe.pwclist add $canv
463
set canv2 .tf.histframe.pwclist.canv2
465
- canvas $canv2 -width $geometry(canv2) \
464
+ canvas $canv2 \
465
-background $bgcolor -bd 0 -yscrollincr $linespc
466
.tf.histframe.pwclist add $canv2
467
set canv3 .tf.histframe.pwclist.canv3
469
- canvas $canv3 -width $geometry(canv3) \
468
+ canvas $canv3 \
469
-background $bgcolor -bd 0 -yscrollincr $linespc
470
.tf.histframe.pwclist add $canv3
471
+ eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)
472
+ eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)
473
474
# a scroll bar to rule them
475
scrollbar $cscroll -command {allcanvs yview} -highlightthickness 0
@@ -577,6 +578,8 @@ proc makewindow {} {
578
pack .tf.bar -in .tf -side bottom -fill x
579
pack .tf.histframe -fill both -side top -expand 1
580
.ctop add .tf
581
+ .ctop paneconfigure .tf -height $geometry(topheight)
582
+ .ctop paneconfigure .tf -width $geometry(topwidth)
583
584
# now build up the bottom
585
panedwindow .pwbottom -orient horizontal
@@ -638,6 +641,7 @@ proc makewindow {} {
641
$ctext tag conf found -back yellow
642
643
.pwbottom add .bleft
644
+ .pwbottom paneconfigure .bleft -width $geometry(botwidth)
645
646
# lower right
647
frame .bright
@@ -832,9 +836,8 @@ proc savestuff {w} {
836
puts $f "set geometry(main) [wm geometry .]"
837
puts $f "set geometry(topwidth) [winfo width .tf]"
838
puts $f "set geometry(topheight) [winfo height .tf]"
835
- puts $f "set geometry(canv) [winfo width $canv]"
836
- puts $f "set geometry(canv2) [winfo width $canv2]"
837
- puts $f "set geometry(canv3) [winfo width $canv3]"
839
+ puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sash coord 0]\""
840
+ puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sash coord 1]\""
841
puts $f "set geometry(botwidth) [winfo width .bleft]"
842
puts $f "set geometry(botheight) [winfo height .bleft]"
843