Skip to content

Commit

Permalink
gitk: Only restore window size from ~/.gitk, not position
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Mackerras committed Mar 10, 2008
1 parent 6675ea4 commit b9bee11
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -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}} {
Expand Down

0 comments on commit b9bee11

Please sign in to comment.