aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-03-10 16:50:34 +1100
committerPaul Mackerras <paulus@samba.org>2008-03-10 16:50:34 +1100
commitb9bee11526ec23541ddbbd75716bfd1acc241463 (patch)
tree12f3eb159519e33f8557fa460941c7c3e9290a93
parent6675ea4240540e3ee3b0dd2f26b1ad86121d22c6 (diff)
downloadgit-b9bee11526ec23541ddbbd75716bfd1acc241463.tar.gz
git-b9bee11526ec23541ddbbd75716bfd1acc241463.tar.xz
gitk: Only restore window size from ~/.gitk, not position
This also limits the window size to the screen size. That is better than nothing, but it isn't perfect, since ideally we would take into account window decorations, and things such as gnome panels or the Mac OS X dock and menu bar, but I don't know how to do that. On Cygwin this is as good as restoring the whole geometry (size and position) at working around the Cygwin Tk bugs, according to Mark Levedahl. Tested-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk12
1 files changed, 10 insertions, 2 deletions
diff --git a/gitk b/gitk
index f1f21e97b..f8f006fa1 100755
--- a/gitk
+++ b/gitk
@@ -930,9 +930,17 @@ proc makewindow {} {
.pwbottom add .bright
.ctop add .pwbottom
- # restore window position if known
+ # restore window width & height if known
if {[info exists geometry(main)]} {
- wm geometry . "$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"
+ }
}
if {[tk windowingsystem] eq {aqua}} {