git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edgar Toernig <froese@gmx.de>
To: Mark Levedahl <mlevedahl@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>, Gerrit Pape <pape@smarden.org>,
	git@vger.kernel.org
Subject: Re: [PATCH] gitk: don't save the geometry to rc file on exit
Date: Sun, 24 Feb 2008 19:21:07 +0100	[thread overview]
Message-ID: <20080224192107.323a6abc.froese@gmx.de> (raw)
In-Reply-To: <47C190E3.6000407@gmail.com>

Mark Levedahl wrote:
>
> [...] 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.

It would be really annoying if I had to resize and reconfigure (the
panes) each time I start gitk.

How about only taking the saved geometry/fonts/etc when the screen
size hasn't changed?

The easiest method (for a Tcl-noob like me) would be to wrap the
"set geometry..." in .gitk with an if-statement which checks the
screen size.

Something like this:

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 5560e4d..1c572c9 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -1158,14 +1158,12 @@ proc savestuff {w} {
     global viewname viewfiles viewargs viewperm nextviewnum
     global cmitmode wrapcomment datetimeformat limitdiffs
     global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
+    global screen_size
 
     if {$stuffsaved} return
     if {![winfo viewable .]} return
     catch {
 	set f [open "~/.gitk-new" w]
-	puts $f [list set mainfont $mainfont]
-	puts $f [list set textfont $textfont]
-	puts $f [list set uifont $uifont]
 	puts $f [list set tabstop $tabstop]
 	puts $f [list set findmergefiles $findmergefiles]
 	puts $f [list set maxgraphpct $maxgraphpct]
@@ -1183,6 +1181,10 @@ proc savestuff {w} {
 	puts $f [list set diffcontext $diffcontext]
 	puts $f [list set selectbgcolor $selectbgcolor]
 
+	puts $f "if {\$screen_size == \"$screen_size\"} {"
+	puts $f [list set mainfont $mainfont]
+	puts $f [list set textfont $textfont]
+	puts $f [list set uifont $uifont]
 	puts $f "set geometry(main) [wm geometry .]"
 	puts $f "set geometry(topwidth) [winfo width .tf]"
 	puts $f "set geometry(topheight) [winfo height .tf]"
@@ -1198,6 +1200,7 @@ proc savestuff {w} {
 	    }
 	}
 	puts $f "}"
+	puts $f "}"
 	close $f
 	file rename -force "~/.gitk-new" "~/.gitk"
     }
@@ -8461,6 +8464,8 @@ set diffcolors {red "#00a000" blue}
 set diffcontext 3
 set selectbgcolor gray85
 
+set screen_size [winfo screenwidth .]x[winfo screenheight .]
+
 ## For msgcat loading, first locate the installation location.
 if { [info exists ::env(GITK_MSGSDIR)] } {
     ## Msgsdir was manually set in the environment.

Saving geometries for multiple screen sizes would be even better
(i.e. geometry_1440x900(main) etc or an additional ".gitk-$screen_size"
for the geometry data) but that is beyond my Tcl-skills.

Ciao, ET.

  reply	other threads:[~2008-02-24 18:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-07  6:16 Bug in gitk - can post the window off screen Tommy Thorn
2008-02-07  6:30 ` Shawn O. Pearce
2008-02-07  9:56   ` Robin Rosenberg
2008-02-07 10:10     ` Gerrit Pape
2008-02-23 11:37       ` [PATCH] gitk: don't save the geometry to rc file on exit Gerrit Pape
2008-02-23 12:52         ` Robin Rosenberg
2008-02-23 13:15           ` Jonathan del Strother
2008-02-23 22:49         ` Paul Mackerras
2008-02-24 15:44           ` Mark Levedahl
2008-02-24 18:21             ` Edgar Toernig [this message]
2008-03-06 12:17             ` Paul Mackerras
2008-03-06 12:59               ` Jonathan del Strother
2008-03-06 23:10                 ` Paul Mackerras
2008-03-07  3:03               ` Mark Levedahl
2008-03-07 11:11               ` martin f krafft
2008-03-08 11:11                 ` Paul Mackerras
2008-03-10 11:29                   ` martin f krafft
2008-03-10 13:17                   ` David Tweed
2008-02-25  8:07           ` martin f krafft
2008-02-25 12:09             ` Paul Mackerras
2008-02-25 12:24               ` martin f krafft
2008-02-25 13:35               ` Mark Levedahl
2008-02-25 14:15                 ` martin f krafft
2008-02-25 19:59                 ` Martin Langhoff
2008-02-25 23:08                   ` Robin Rosenberg
2008-02-26  2:15           ` A Large Angry SCM

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080224192107.323a6abc.froese@gmx.de \
    --to=froese@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=mlevedahl@gmail.com \
    --cc=pape@smarden.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).