gitk: Only restore window size from ~/.gitk, not position
[gitweb.git] / gitk
diff --git a/gitk b/gitk
index f1f21e97bf5e89bd7609cf5b6d1f417e35a43b6c..f8f006fa11f62f239fd7be2d7262b29b6dbb69d0 100755 (executable)
--- 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}} {