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>
Paul Mackerras committed
Mar 10, 2008 at 16:50 UTC
b9bee11526ec23541ddbbd75716bfd1acc241463
1 file changed
+10
-2
gitk
+10
-2
@@ -930,9 +930,17 @@ proc makewindow {} {
930
.pwbottom add .bright
931
.ctop add .pwbottom
932
933
- # restore window position if known
933
+ # restore window width & height if known
934
if {[info exists geometry(main)]} {
935
- wm geometry . "$geometry(main)"
935
+ if {[scan $geometry(main) "%dx%d" w h] >= 2} {
936
+ if {$w > [winfo screenwidth .]} {
937
+ set w [winfo screenwidth .]
938
+ }
939
+ if {$h > [winfo screenheight .]} {
940
+ set h [winfo screenheight .]
941
+ }
942
+ wm geometry . "${w}x$h"
943
+ }
944
}
945
946
if {[tk windowingsystem] eq {aqua}} {