aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Levedahl <mdl123@verizon.net>2007-02-08 22:22:24 -0500
committerPaul Mackerras <paulus@samba.org>2007-02-15 09:12:53 +1100
commitb6047c5a8166a71e01c6b63ebbb67c6894d95114 (patch)
tree3351ed1493a7aab3e19cdbff9f6ed8f3e50f19ff
parent7426eb74694b2f8b3909065edeec35b7a9117b35 (diff)
downloadgit-b6047c5a8166a71e01c6b63ebbb67c6894d95114.tar.gz
git-b6047c5a8166a71e01c6b63ebbb67c6894d95114.tar.xz
Make gitk save and restore the user set window position.
gitk was saving widget sizes and positions when the main window was destroyed, which is after all child widgets are destroyed. The cure is to trap the WM_DELETE_WINDOW event before the gui is torn down. Also, the saved geometry was captured using "winfo geometry .", rather than "wm geometry ." Under Linux, these two return different answers and the latter one is correct. [jc: credit goes to Brett Schwarz for suggesting the use of "wm protocol"; I also squashed the follow-up patch to remove extraneous -0 from expressions.] Signed-off-by: Mark Levedahl <mdl123@verizon.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-xgitk11
1 files changed, 6 insertions, 5 deletions
diff --git a/gitk b/gitk
index 1c36235bf..df1ce8cbb 100755
--- a/gitk
+++ b/gitk
@@ -725,7 +725,7 @@ proc makewindow {} {
bind . <Control-KP_Add> {incrfont 1}
bind . <Control-minus> {incrfont -1}
bind . <Control-KP_Subtract> {incrfont -1}
- bind . <Destroy> {savestuff %W}
+ wm protocol . WM_DELETE_WINDOW doquit
bind . <Button-1> "click %W"
bind $fstring <Key-Return> dofind
bind $sha1entry <Key-Return> gotocommit
@@ -829,12 +829,12 @@ proc savestuff {w} {
puts $f [list set colors $colors]
puts $f [list set diffcolors $diffcolors]
- puts $f "set geometry(main) [winfo geometry .]"
+ 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) [expr {[winfo width $canv]-0}]"
- puts $f "set geometry(canv2) [expr {[winfo width $canv2]-0}]"
- puts $f "set geometry(canv3) [expr {[winfo width $canv3]-0}]"
+ 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(botwidth) [winfo width .bleft]"
puts $f "set geometry(botheight) [winfo height .bleft]"
@@ -5800,6 +5800,7 @@ proc showtag {tag isnew} {
proc doquit {} {
global stopped
set stopped 100
+ savestuff .
destroy .
}