git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jonathan del Strother <maillist@steelskies.com>
Date
Mar 6, 2008, 12:59 UTC
Message-ID
<57518fd10803060459m6e3ffc00n388721ad2e5975ad@mail.gmail.com>
In-Reply-To
<18383.57540.26282.526111@cargo.ozlabs.ibm.com>
On Thu, Mar 6, 2008 at 12:17 PM, Paul Mackerras <paulus@samba.org> wrote:
Show 54 quoted lines
> 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?

Previous: Paul MackerrasNext: Paul Mackerras
Message 12 of 26 in “Bug in gitk - can post the window off screen”
  1. Tommy ThornFeb 7, 2008
  2. Shawn O. PearceFeb 7, 2008
  3. Robin RosenbergFeb 7, 2008
  4. Gerrit PapeFeb 7, 2008
  5. gitk: don't save the geometry to rc file on exitGerrit Pape, Feb 23, 2008
  6. Robin RosenbergFeb 23, 2008
  7. Jonathan del StrotherFeb 23, 2008
  8. Paul MackerrasFeb 23, 2008
  9. Mark LevedahlFeb 24, 2008
  10. Edgar ToernigFeb 24, 2008
  11. Paul MackerrasMar 6, 2008
  12. Jonathan del StrotherMar 6, 2008
  13. Paul MackerrasMar 6, 2008
  14. Mark LevedahlMar 7, 2008
  15. martin f krafftMar 7, 2008
  16. Paul MackerrasMar 8, 2008
  17. martin f krafftMar 10, 2008
  18. David TweedMar 10, 2008
  19. martin f krafftFeb 25, 2008
  20. Paul MackerrasFeb 25, 2008
  21. martin f krafftFeb 25, 2008
  22. Mark LevedahlFeb 25, 2008
  23. martin f krafftFeb 25, 2008
  24. Martin LanghoffFeb 25, 2008
  25. Robin RosenbergFeb 25, 2008
  26. A Large Angry SCMFeb 26, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.