# [PATCH] Make gitk save and restore window pane position on Linux and Cygwin.

4 messages from 2007-02-13 to 2007-02-13. Participants: Mark Levedahl, Junio C Hamano, Sergey Vlasov.
Thread: https://gitlist.dev/t/6789

## Mark Levedahl, 2007-02-13 00:19

Subject: [PATCH] Make gitk save and restore window pane position on Linux and Cygwin.
Message-ID: <11713259742627-git-send-email-mdl123@verizon.net>
URL: https://gitlist.dev/e/11713259742627-git-send-email-mdl123%40verizon.net

```
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>
---
 gitk |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/gitk b/gitk
index df1ce8c..9ddff3e 100755
--- a/gitk
+++ b/gitk
@@ -439,14 +439,13 @@ proc makewindow {} {
     panedwindow .ctop -orient vertical
 
     # possibly use assumed geometry
-    if {![info exists geometry(topheight)]} {
+    if {![info exists geometry(pwsash0)]} {
         set geometry(topheight) [expr {15 * $linespc}]
         set geometry(topwidth) [expr {80 * $charspc}]
         set geometry(botheight) [expr {15 * $linespc}]
         set geometry(botwidth) [expr {50 * $charspc}]
-        set geometry(canv) [expr {40 * $charspc}]
-        set geometry(canv2) [expr {20 * $charspc}]
-        set geometry(canv3) [expr {20 * $charspc}]
+        set geometry(pwsash0) "[expr {40 * $charspc}] 2"
+        set geometry(pwsash1) "[expr {60 * $charspc}] 2"
     }
 
     # the upper half will have a paned window, a scroll bar to the right, and some stuff below
@@ -457,18 +456,20 @@ proc makewindow {} {
     # create three canvases
     set cscroll .tf.histframe.csb
     set canv .tf.histframe.pwclist.canv
-    canvas $canv -width $geometry(canv) \
+    canvas $canv \
 	-background $bgcolor -bd 0 \
 	-yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll"
     .tf.histframe.pwclist add $canv
     set canv2 .tf.histframe.pwclist.canv2
-    canvas $canv2 -width $geometry(canv2) \
+    canvas $canv2 \
 	-background $bgcolor -bd 0 -yscrollincr $linespc
     .tf.histframe.pwclist add $canv2
     set canv3 .tf.histframe.pwclist.canv3
-    canvas $canv3 -width $geometry(canv3) \
+    canvas $canv3 \
 	-background $bgcolor -bd 0 -yscrollincr $linespc
     .tf.histframe.pwclist add $canv3
+    eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)
+    eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)
 
     # a scroll bar to rule them
     scrollbar $cscroll -command {allcanvs yview} -highlightthickness 0
@@ -577,6 +578,8 @@ proc makewindow {} {
     pack .tf.bar -in .tf -side bottom -fill x
     pack .tf.histframe -fill both -side top -expand 1
     .ctop add .tf
+    .ctop paneconfigure .tf -height $geometry(topheight)
+    .ctop paneconfigure .tf -width $geometry(topwidth)
 
     # now build up the bottom
     panedwindow .pwbottom -orient horizontal
@@ -638,6 +641,7 @@ proc makewindow {} {
     $ctext tag conf found -back yellow
 
     .pwbottom add .bleft
+    .pwbottom paneconfigure .bleft -width $geometry(botwidth)
 
     # lower right
     frame .bright
@@ -832,9 +836,8 @@ proc savestuff {w} {
 	puts $f "set geometry(main) [wm geometry .]"
 	puts $f "set geometry(topwidth) [winfo width .tf]"
 	puts $f "set geometry(topheight) [winfo height .tf]"
-	puts $f "set geometry(canv) [winfo width $canv]"
-	puts $f "set geometry(canv2) [winfo width $canv2]"
-	puts $f "set geometry(canv3) [winfo width $canv3]"
+        puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sash coord 0]\""
+        puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sash coord 1]\""
 	puts $f "set geometry(botwidth) [winfo width .bleft]"
 	puts $f "set geometry(botheight) [winfo height .bleft]"
 
-- 
1.5.0.rc3.24.g0c5e

```

## Junio C Hamano, 2007-02-13 01:15

Subject: Re: [PATCH] Make gitk save and restore window pane position on Linux and Cygwin.
Message-ID: <7vbqjy7t86.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vbqjy7t86.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <11713259742627-git-send-email-mdl123@verizon.net>

```
This looks sane to me, although a bit twisted (and again it is
not Mark's fault).  Sergey, Ack?

```

## Sergey Vlasov, 2007-02-13 11:10

Subject: Re: [PATCH] Make gitk save and restore window pane position on Linux and Cygwin.
Message-ID: <20070213111037.GM23550@master.mivlgu.local>
URL: https://gitlist.dev/e/20070213111037.GM23550%40master.mivlgu.local
In-Reply-To: <7vbqjy7t86.fsf@assigned-by-dhcp.cox.net>

```
On Mon, Feb 12, 2007 at 05:15:53PM -0800, Junio C Hamano wrote:
> This looks sane to me, although a bit twisted (and again it is
> not Mark's fault).  Sergey, Ack?

Yes, current git (85b1f988) works for me.

```

## Junio C Hamano, 2007-02-13 17:45

Subject: Re: [PATCH] Make gitk save and restore window pane position on Linux and Cygwin.
Message-ID: <7vps8ex87s.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vps8ex87s.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070213111037.GM23550@master.mivlgu.local>

```
Sergey Vlasov <vsu@altlinux.ru> writes:

> On Mon, Feb 12, 2007 at 05:15:53PM -0800, Junio C Hamano wrote:
>> This looks sane to me, although a bit twisted (and again it is
>> not Mark's fault).  Sergey, Ack?
>
> Yes, current git (85b1f988) works for me.

Thanks, both.

```
