Re: [PATCH] gitk: don't save the geometry to rc file on exit
- From
Mark Levedahl <mlevedahl@gmail.com>
- Date
- Mar 7, 2008, 03:03 UTC
- Message-ID
- <47D0B098.9040707@gmail.com>
- In-Reply-To
- <18383.57540.26282.526111@cargo.ozlabs.ibm.com>
Paul Mackerras wrote:
Show 32 quoted lines
> Here's a patch for people to test. It only restores the width and
> height, and limits the width and height to be at most the width and
> height of the screen. It seems to work fine under X; I would be
> interested to know what happens under macos and windows.
>
> Paul.
> ---
> diff --git a/gitk b/gitk
> index f1f21e9..f8f006f 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}} {
> This works fine on Cygwin: the size restores properly across sessions, the window and widgets all behave as expected. So, you can add a "Tested-by: Mark Levedahl <mlevedahl@gmail.com" if you wish to this.
Mark