Re: [PATCH] gitk: don't save the geometry to rc file on exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 6, 2008 at 12:17 PM, Paul Mackerras <paulus@xxxxxxxxx> wrote:
> Mark Levedahl writes:
>
>  > I can only offer to test the proposed patch, I am unable to predict what
>  > will or won't trip up the buggy geometry engine in Cygwin's Tk. I do
>  > remember I had trouble finding a way to restore the size but not the
>  > position of the main window on Cygwin: that doesn't mean it can't be
>  > done (logically, it should be easy), just that I didn't find the right
>  > spell or incantation that would work. I'll also admit to not having
>  > tried after I got to a completely working geometry solution, so perhaps
>  > just restoring the size without position will now work on Cygwin.
>  >
>  > Using the saved panel sizes in conjunction with the default window size
>  > yields an unusable screen: many elements are obscured. The same occurs
>  > using the defaults altogether: either way the user must resize and
>  > adjust things to get to a workable layout. So, I am very opposed to
>  > disabling the memory altogether. Also, I have a number of X apps that
>  > remember their layout, so gitk's current behavior is not (at least to
>  > me) an aberration and I would like that behavior to at least remain an
>  > option.
>
>  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 almost works on OS X.  The only problem is that it's not taking
into account menubars and windowbars.  eg, if I have a screen
resolution of 640x480, setting the window _content_ to that size will
make the entire window including its titlebar about 500px tall.  Not
only that, but the system-wide menubar at the top of the screen also
reduces the available space, meaning that the maximum window size
ought to be around 640x456.  (If you wanted to get even pickier, that
will changing depending on the interface resolution...)

Presumably your patch does nothing to move gitk back on screen if the
monitor it was on last time has gone away?  Or are we still blaming
the window manager for that?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux