git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug in gitk - can post the window off screen
@ 2008-02-07  6:16 Tommy Thorn
  2008-02-07  6:30 ` Shawn O. Pearce
  0 siblings, 1 reply; 26+ messages in thread
From: Tommy Thorn @ 2008-02-07  6:16 UTC (permalink / raw
  To: git

Just a quick heads-up: I was running a dual screen setup with gitk on my 
2nd monitor. When I later started gitk up without the 2nd monitor, the 
gitk window didn't appear. Given the time between the two sessions, it 
didn't occur to me what the problem was.

Gitk should probably validate the "set geometry(main)" variable against 
the current resolution.

Tommy

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Bug in gitk - can post the window off screen
  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
  0 siblings, 1 reply; 26+ messages in thread
From: Shawn O. Pearce @ 2008-02-07  6:30 UTC (permalink / raw
  To: Tommy Thorn; +Cc: git

Tommy Thorn <tommy-git@thorn.ws> wrote:
> Just a quick heads-up: I was running a dual screen setup with gitk on my 
> 2nd monitor. When I later started gitk up without the 2nd monitor, the 
> gitk window didn't appear. Given the time between the two sessions, it 
> didn't occur to me what the problem was.
> 
> Gitk should probably validate the "set geometry(main)" variable against 
> the current resolution.

Sad to say but this is a known issue with both gitk and git-gui.
Both applications save the prior geometry and restore it during
the next run, but neither validates the new geometry makes sense
with the current available desktop space.  :-\

-- 
Shawn.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Bug in gitk - can post the window off screen
  2008-02-07  6:30 ` Shawn O. Pearce
@ 2008-02-07  9:56   ` Robin Rosenberg
  2008-02-07 10:10     ` Gerrit Pape
  0 siblings, 1 reply; 26+ messages in thread
From: Robin Rosenberg @ 2008-02-07  9:56 UTC (permalink / raw
  To: Shawn O. Pearce; +Cc: Tommy Thorn, git

torsdagen den 7 februari 2008 skrev Shawn O. Pearce:
> Tommy Thorn <tommy-git@thorn.ws> wrote:
> > Just a quick heads-up: I was running a dual screen setup with gitk on my 
> > 2nd monitor. When I later started gitk up without the 2nd monitor, the 
> > gitk window didn't appear. Given the time between the two sessions, it 
> > didn't occur to me what the problem was.
> > 
> > Gitk should probably validate the "set geometry(main)" variable against 
> > the current resolution.
> 
> Sad to say but this is a known issue with both gitk and git-gui.
> Both applications save the prior geometry and restore it during
> the next run, but neither validates the new geometry makes sense
> with the current available desktop space.  :-\

Seems KDE forces it back into visible space, but it is annoying that the 
gitk/git-gui windows do not come up on the same monitor as my cursor is on. 
Could we change it and save just size, just like "all other" apps?

-- robin

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Bug in gitk - can post the window off screen
  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
  0 siblings, 1 reply; 26+ messages in thread
From: Gerrit Pape @ 2008-02-07 10:10 UTC (permalink / raw
  To: Robin Rosenberg; +Cc: Shawn O. Pearce, Tommy Thorn, git

On Thu, Feb 07, 2008 at 10:56:19AM +0100, Robin Rosenberg wrote:
> torsdagen den 7 februari 2008 skrev Shawn O. Pearce:
> > Tommy Thorn <tommy-git@thorn.ws> wrote:
> > > Just a quick heads-up: I was running a dual screen setup with gitk on my 
> > > 2nd monitor. When I later started gitk up without the 2nd monitor, the 
> > > gitk window didn't appear. Given the time between the two sessions, it 
> > > didn't occur to me what the problem was.
> > > 
> > > Gitk should probably validate the "set geometry(main)" variable against 
> > > the current resolution.
> > 
> > Sad to say but this is a known issue with both gitk and git-gui.
> > Both applications save the prior geometry and restore it during
> > the next run, but neither validates the new geometry makes sense
> > with the current available desktop space.  :-\
> 
> Seems KDE forces it back into visible space, but it is annoying that the 
> gitk/git-gui windows do not come up on the same monitor as my cursor is on. 
> Could we change it and save just size, just like "all other" apps?

Not saving the geometry on exit was also suggested through the Debian
BTS, "as window placement and sizing are the task of the window
manager"
 http://bugs.debian.org/442253

Regards, Gerrit.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-07 10:10     ` Gerrit Pape
@ 2008-02-23 11:37       ` Gerrit Pape
  2008-02-23 12:52         ` Robin Rosenberg
  2008-02-23 22:49         ` Paul Mackerras
  0 siblings, 2 replies; 26+ messages in thread
From: Gerrit Pape @ 2008-02-23 11:37 UTC (permalink / raw
  To: git, Paul Mackerras

Saving the geometry can cause several inconveniences, e.g. when using a
temporary dual screen setup, or sharing ~/.gitk between multiple
systems.  Additionally it can be argued that window placement and sizing
are the tasks of the window manager.  So don't do that anymore.

This has been requested by martin f krafft and Josh Triplett through
 http://bugs.debian.org/442253
 http://bugs.debian.org/467121

Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 gitk-git/gitk |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index f1f21e9..8039d19 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -1188,14 +1188,6 @@ proc savestuff {w} {
 	puts $f [list set diffcontext $diffcontext]
 	puts $f [list set selectbgcolor $selectbgcolor]
 
-	puts $f "set geometry(main) [wm geometry .]"
-	puts $f "set geometry(topwidth) [winfo width .tf]"
-	puts $f "set geometry(topheight) [winfo height .tf]"
-        puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sash coord 0]\""
-        puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sash coord 1]\""
-	puts $f "set geometry(botwidth) [winfo width .bleft]"
-	puts $f "set geometry(botheight) [winfo height .bleft]"
-
 	puts -nonewline $f "set permviews {"
 	for {set v 0} {$v < $nextviewnum} {incr v} {
 	    if {$viewperm($v)} {
-- 
1.5.4.2

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  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
  1 sibling, 1 reply; 26+ messages in thread
From: Robin Rosenberg @ 2008-02-23 12:52 UTC (permalink / raw
  To: Gerrit Pape; +Cc: git, Paul Mackerras

lördagen den 23 februari 2008 skrev Gerrit Pape:
> Saving the geometry can cause several inconveniences, e.g. when using a
> temporary dual screen setup, or sharing ~/.gitk between multiple
> systems.  Additionally it can be argued that window placement and sizing
> are the tasks of the window manager.  So don't do that anymore.

Shouldn't the restoring code also be dropped then? 

Other than that, I agree. The Gitk current behaviour wrt dual screens 
is really inconvenient.

-- robin

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-23 12:52         ` Robin Rosenberg
@ 2008-02-23 13:15           ` Jonathan del Strother
  0 siblings, 0 replies; 26+ messages in thread
From: Jonathan del Strother @ 2008-02-23 13:15 UTC (permalink / raw
  To: Robin Rosenberg; +Cc: Gerrit Pape, git, Paul Mackerras

On Sat, Feb 23, 2008 at 12:52 PM, Robin Rosenberg
<robin.rosenberg.lists@dewire.com> wrote:
> lördagen den 23 februari 2008 skrev Gerrit Pape:
>
> > Saving the geometry can cause several inconveniences, e.g. when using a
>  > temporary dual screen setup, or sharing ~/.gitk between multiple
>  > systems.  Additionally it can be argued that window placement and sizing
>  > are the tasks of the window manager.  So don't do that anymore.
>
>  Shouldn't the restoring code also be dropped then?

Perhaps, though that would prevent you setting up default width &
height.  You'd always be stuck with the (too small IMO) original
window size

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  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 22:49         ` Paul Mackerras
  2008-02-24 15:44           ` Mark Levedahl
                             ` (2 more replies)
  1 sibling, 3 replies; 26+ messages in thread
From: Paul Mackerras @ 2008-02-23 22:49 UTC (permalink / raw
  To: Gerrit Pape; +Cc: git, Mark Levedahl

Gerrit Pape writes:

> Saving the geometry can cause several inconveniences, e.g. when using a
> temporary dual screen setup, or sharing ~/.gitk between multiple
> systems.  Additionally it can be argued that window placement and sizing
> are the tasks of the window manager.  So don't do that anymore.

I myself find it useful to have gitk remember the size and layout of
the various panes, so I won't be applying this patch.

The saving/restoring of the window position was done by Mark Levedahl
to make gitk work properly on Cygwin.  I agree it can be annoying on X
and I would take a patch to inhibit the restoring of the window
position when running under X.  I'd want an ack from Mark before
making that change more generally.

Paul.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-23 22:49         ` Paul Mackerras
@ 2008-02-24 15:44           ` Mark Levedahl
  2008-02-24 18:21             ` Edgar Toernig
  2008-03-06 12:17             ` Paul Mackerras
  2008-02-25  8:07           ` martin f krafft
  2008-02-26  2:15           ` A Large Angry SCM
  2 siblings, 2 replies; 26+ messages in thread
From: Mark Levedahl @ 2008-02-24 15:44 UTC (permalink / raw
  To: Paul Mackerras; +Cc: Gerrit Pape, git

Paul Mackerras wrote:
> Gerrit Pape writes:
>
>   
>> Saving the geometry can cause several inconveniences, e.g. when using a
>> temporary dual screen setup, or sharing ~/.gitk between multiple
>> systems.  Additionally it can be argued that window placement and sizing
>> are the tasks of the window manager.  So don't do that anymore.
>>     
>
> I myself find it useful to have gitk remember the size and layout of
> the various panes, so I won't be applying this patch.
>
> The saving/restoring of the window position was done by Mark Levedahl
> to make gitk work properly on Cygwin.  I agree it can be annoying on X
> and I would take a patch to inhibit the restoring of the window
> position when running under X.  I'd want an ack from Mark before
> making that change more generally.
>
> Paul.
>
>   
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.

Mark

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-24 15:44           ` Mark Levedahl
@ 2008-02-24 18:21             ` Edgar Toernig
  2008-03-06 12:17             ` Paul Mackerras
  1 sibling, 0 replies; 26+ messages in thread
From: Edgar Toernig @ 2008-02-24 18:21 UTC (permalink / raw
  To: Mark Levedahl; +Cc: Paul Mackerras, Gerrit Pape, git

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.

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-23 22:49         ` Paul Mackerras
  2008-02-24 15:44           ` Mark Levedahl
@ 2008-02-25  8:07           ` martin f krafft
  2008-02-25 12:09             ` Paul Mackerras
  2008-02-26  2:15           ` A Large Angry SCM
  2 siblings, 1 reply; 26+ messages in thread
From: martin f krafft @ 2008-02-25  8:07 UTC (permalink / raw
  To: Paul Mackerras; +Cc: Gerrit Pape, git, Mark Levedahl

[-- Attachment #1: Type: text/plain, Size: 1311 bytes --]

also sprach Paul Mackerras <paulus@samba.org> [2008.02.23.2349 +0100]:
> > Saving the geometry can cause several inconveniences, e.g. when
> > using a temporary dual screen setup, or sharing ~/.gitk between
> > multiple systems.  Additionally it can be argued that window
> > placement and sizing are the tasks of the window manager.  So
> > don't do that anymore.
> 
> I myself find it useful to have gitk remember the size and layout
> of the various panes, so I won't be applying this patch.
> 
> The saving/restoring of the window position was done by Mark
> Levedahl to make gitk work properly on Cygwin.  I agree it can be
> annoying on X and I would take a patch to inhibit the restoring of
> the window position when running under X.  I'd want an ack from
> Mark before making that change more generally.

May I suggest that such a patch actually disables writing of the
config file, so that we won't get conflicts every time you sync
config files via home-in-git?

Of course I offer to look into this once Mark approves.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"if there's anything more important than my ego,
 i want it caught and shot now."
                                                -- zaphod beeblebrox
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  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
  0 siblings, 2 replies; 26+ messages in thread
From: Paul Mackerras @ 2008-02-25 12:09 UTC (permalink / raw
  To: martin f krafft; +Cc: Gerrit Pape, git, Mark Levedahl

martin f krafft writes:

> May I suggest that such a patch actually disables writing of the
> config file, so that we won't get conflicts every time you sync
> config files via home-in-git?

Then various other bits of config won't be persistent, such as font
settings.  So I don't think that's a good idea.

It would be possible to make the config file be per-repository rather
than global, I guess, if that is something people want.  I personally
would find it annoying to have to change the font separately in each
repository, but tastes differ, I guess.

Paul.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-25 12:09             ` Paul Mackerras
@ 2008-02-25 12:24               ` martin f krafft
  2008-02-25 13:35               ` Mark Levedahl
  1 sibling, 0 replies; 26+ messages in thread
From: martin f krafft @ 2008-02-25 12:24 UTC (permalink / raw
  To: Paul Mackerras, Gerrit Pape, git, Mark Levedahl

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

also sprach Paul Mackerras <paulus@samba.org> [2008.02.25.1309 +0100]:
> Then various other bits of config won't be persistent, such as font
> settings.  So I don't think that's a good idea.

Huh? I use the same font on all machines, but the screen resolutions
differ...

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
time wounds all heels.
                                                       -- groucho marx
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  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
  1 sibling, 2 replies; 26+ messages in thread
From: Mark Levedahl @ 2008-02-25 13:35 UTC (permalink / raw
  To: Paul Mackerras; +Cc: martin f krafft, Gerrit Pape, git

On Mon, Feb 25, 2008 at 7:09 AM, Paul Mackerras <paulus@samba.org> wrote:
> martin f krafft writes:
>
>  > May I suggest that such a patch actually disables writing of the
>  > config file, so that we won't get conflicts every time you sync
>  > config files via home-in-git?
>
>  Then various other bits of config won't be persistent, such as font
>  settings.  So I don't think that's a good idea.
>
>  It would be possible to make the config file be per-repository rather
>  than global, I guess, if that is something people want.  I personally
>  would find it annoying to have to change the font separately in each
>  repository, but tastes differ, I guess.
>
>  Paul.
>
Two things we could do:

1) Add a "save config now" button and a "save config on exit"
checkbox/option to the options dialog.
2) Perform a screen geometry check at load time to see if the corners
of the main window would be visible before applying the main window
geometry.

Mark

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-25 13:35               ` Mark Levedahl
@ 2008-02-25 14:15                 ` martin f krafft
  2008-02-25 19:59                 ` Martin Langhoff
  1 sibling, 0 replies; 26+ messages in thread
From: martin f krafft @ 2008-02-25 14:15 UTC (permalink / raw
  To: Mark Levedahl, Paul Mackerras, Gerrit Pape, git

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

also sprach Mark Levedahl <mlevedahl@gmail.com> [2008.02.25.1435 +0100]:
> 1) Add a "save config now" button and a "save config on exit"
> checkbox/option to the options dialog.

and a checkbox like "disable writing window geometry data to the
configuration file"

> 2) Perform a screen geometry check at load time to see if the corners
> of the main window would be visible before applying the main window
> geometry.

I don't see the benefit of this. I really rather believe that window
geometry is the job of the window manager. If Cygwin needs it, then
maybe it could be conditionally compiled on that platform.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
quantum mechanics: the dreams stuff is made of.
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  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
  1 sibling, 1 reply; 26+ messages in thread
From: Martin Langhoff @ 2008-02-25 19:59 UTC (permalink / raw
  To: Mark Levedahl; +Cc: Paul Mackerras, martin f krafft, Gerrit Pape, git

On Tue, Feb 26, 2008 at 2:35 AM, Mark Levedahl <mlevedahl@gmail.com> wrote:
>  2) Perform a screen geometry check at load time to see if the corners
>  of the main window would be visible before applying the main window
>  geometry.

As a multi-screen-layouts, multi-machine user, this approach has my
vote. I see a proto-patch from Edgar too. Even if the wm has similar
capabilities, those will be limited to main window geometry, not
inner-panel geometry so this is still useful.

cheers,


m

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-25 19:59                 ` Martin Langhoff
@ 2008-02-25 23:08                   ` Robin Rosenberg
  0 siblings, 0 replies; 26+ messages in thread
From: Robin Rosenberg @ 2008-02-25 23:08 UTC (permalink / raw
  To: Martin Langhoff
  Cc: Mark Levedahl, Paul Mackerras, martin f krafft, Gerrit Pape, git

måndagen den 25 februari 2008 skrev Martin Langhoff:
> On Tue, Feb 26, 2008 at 2:35 AM, Mark Levedahl <mlevedahl@gmail.com> wrote:
> >  2) Perform a screen geometry check at load time to see if the corners
> >  of the main window would be visible before applying the main window
> >  geometry.
> 
> As a multi-screen-layouts, multi-machine user, this approach has my
> vote. I see a proto-patch from Edgar too. Even if the wm has similar
> capabilities, those will be limited to main window geometry, not
> inner-panel geometry so this is still useful.

The annoying part is that it remembers the position. Remembering siz
I can live with, but I don't want it popping up the wrong screen.

-- robin

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-23 22:49         ` Paul Mackerras
  2008-02-24 15:44           ` Mark Levedahl
  2008-02-25  8:07           ` martin f krafft
@ 2008-02-26  2:15           ` A Large Angry SCM
  2 siblings, 0 replies; 26+ messages in thread
From: A Large Angry SCM @ 2008-02-26  2:15 UTC (permalink / raw
  To: Paul Mackerras; +Cc: Gerrit Pape, git, Mark Levedahl

Paul Mackerras wrote:
> Gerrit Pape writes:
> 
>> Saving the geometry can cause several inconveniences, e.g. when using a
>> temporary dual screen setup, or sharing ~/.gitk between multiple
>> systems.  Additionally it can be argued that window placement and sizing
>> are the tasks of the window manager.  So don't do that anymore.
> 
> I myself find it useful to have gitk remember the size and layout of
> the various panes, so I won't be applying this patch.
> 
> The saving/restoring of the window position was done by Mark Levedahl
> to make gitk work properly on Cygwin.  I agree it can be annoying on X
> and I would take a patch to inhibit the restoring of the window
> position when running under X.  I'd want an ack from Mark before
> making that change more generally.

I use gitk under X and like the saving/restoring of window 
size/geometry. Please do not remove that feature.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-02-24 15:44           ` Mark Levedahl
  2008-02-24 18:21             ` Edgar Toernig
@ 2008-03-06 12:17             ` Paul Mackerras
  2008-03-06 12:59               ` Jonathan del Strother
                                 ` (2 more replies)
  1 sibling, 3 replies; 26+ messages in thread
From: Paul Mackerras @ 2008-03-06 12:17 UTC (permalink / raw
  To: Mark Levedahl; +Cc: Gerrit Pape, git

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}} {


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  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
  2 siblings, 1 reply; 26+ messages in thread
From: Jonathan del Strother @ 2008-03-06 12:59 UTC (permalink / raw
  To: Paul Mackerras; +Cc: Mark Levedahl, Gerrit Pape, git

On Thu, Mar 6, 2008 at 12:17 PM, Paul Mackerras <paulus@samba.org> 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?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-03-06 12:59               ` Jonathan del Strother
@ 2008-03-06 23:10                 ` Paul Mackerras
  0 siblings, 0 replies; 26+ messages in thread
From: Paul Mackerras @ 2008-03-06 23:10 UTC (permalink / raw
  To: Jonathan del Strother; +Cc: Mark Levedahl, Gerrit Pape, git

Jonathan del Strother writes:

> 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...)

Do you know of any way for an application to determine how big it can
be, then?

> 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?

With the patch it no longer specifies a position, so yes we blame the
window manager now if it doesn't put the window somewhere visible. :)

Paul.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-03-06 12:17             ` Paul Mackerras
  2008-03-06 12:59               ` Jonathan del Strother
@ 2008-03-07  3:03               ` Mark Levedahl
  2008-03-07 11:11               ` martin f krafft
  2 siblings, 0 replies; 26+ messages in thread
From: Mark Levedahl @ 2008-03-07  3:03 UTC (permalink / raw
  To: Paul Mackerras; +Cc: Gerrit Pape, git

Paul Mackerras wrote:
> 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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-03-06 12:17             ` Paul Mackerras
  2008-03-06 12:59               ` Jonathan del Strother
  2008-03-07  3:03               ` Mark Levedahl
@ 2008-03-07 11:11               ` martin f krafft
  2008-03-08 11:11                 ` Paul Mackerras
  2 siblings, 1 reply; 26+ messages in thread
From: martin f krafft @ 2008-03-07 11:11 UTC (permalink / raw
  To: Paul Mackerras; +Cc: Mark Levedahl, Gerrit Pape, git, 442253-quiet

[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]

also sprach Paul Mackerras <paulus@samba.org> [2008.03.06.1317 +0100]:
> 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.

I can confirm that the behaviour is much better: the window size is
restored, as is the position, but it gives preference to the
Xinerama head. You'd think it restores at the same *relative*
position on the current head, but it actually just restores
somewhere — I cannot figure out the behaviour.

However, I still wonder why we have to do this at all. I understand
that Cygwin has issues and needs this code, but couldn't it then be
made to run only on Cygwin, such that on "proper" Unix systems, the
config file is *not* updated every time I move the window before
closing the application? As I said earlier, this is really the job
of a window manager, *not* a configuration option. If your window
manager cannot restore the window to a size you control, then it's
broken. Let's not hack applications to work around that, please.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
$complex->{'data'}[$structures][$in_perl] = @{$can{'be'}->[$painful]};
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  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
  0 siblings, 2 replies; 26+ messages in thread
From: Paul Mackerras @ 2008-03-08 11:11 UTC (permalink / raw
  To: martin f krafft; +Cc: Mark Levedahl, Gerrit Pape, git, 442253-quiet

martin f krafft writes:

> I can confirm that the behaviour is much better: the window size is
> restored, as is the position, but it gives preference to the
> Xinerama head. You'd think it restores at the same *relative*
> position on the current head, but it actually just restores
> somewhere ^[$,1rt^[(B I cannot figure out the behaviour.

The position is entirely up to your window manager.

> However, I still wonder why we have to do this at all.

Well, try it without... :)

Restoring the overall window size and the positions of the sashes of
the panedwindows is the simplest and most reliable method I have found
for making the window come back the way the user last set it.

> I understand
> that Cygwin has issues and needs this code, but couldn't it then be
> made to run only on Cygwin, such that on "proper" Unix systems, the
> config file is *not* updated every time I move the window before
> closing the application?

What's the issue with updating the config file?

> As I said earlier, this is really the job
> of a window manager, *not* a configuration option. If your window
> manager cannot restore the window to a size you control, then it's
> broken. Let's not hack applications to work around that, please.

I disagree.  It's not a window manager's job to tell an application
how big its window should be.

Paul.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-03-08 11:11                 ` Paul Mackerras
@ 2008-03-10 11:29                   ` martin f krafft
  2008-03-10 13:17                   ` David Tweed
  1 sibling, 0 replies; 26+ messages in thread
From: martin f krafft @ 2008-03-10 11:29 UTC (permalink / raw
  To: Paul Mackerras, Mark Levedahl, Gerrit Pape, git, 442253-quiet

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]

also sprach Paul Mackerras <paulus@samba.org> [2008.03.08.1211 +0100]:
> > I understand that Cygwin has issues and needs this code, but
> > couldn't it then be made to run only on Cygwin, such that on
> > "proper" Unix systems, the config file is *not* updated every
> > time I move the window before closing the application?
> 
> What's the issue with updating the config file?

Conflicts when synchronising the files between different machines,
or the need for a custom merge driver just for .gitkrc files.

> > As I said earlier, this is really the job of a window manager,
> > *not* a configuration option. If your window manager cannot
> > restore the window to a size you control, then it's broken.
> > Let's not hack applications to work around that, please.
> 
> I disagree.  It's not a window manager's job to tell an
> application how big its window should be.

I always assumed it was: position and geometry. However, I am
starting to see your point.

I guess the best way would be a checkbox with which I can disable
the saving of the geometry on application close, possibly paired
with a button "save now".

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
an egg has the shortest sex-life of all: if gets laid once; it gets
eaten once. it also has to come in a box with 11 others, and the
only person who will sit on its face is its mother.
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] gitk: don't save the geometry to rc file on exit
  2008-03-08 11:11                 ` Paul Mackerras
  2008-03-10 11:29                   ` martin f krafft
@ 2008-03-10 13:17                   ` David Tweed
  1 sibling, 0 replies; 26+ messages in thread
From: David Tweed @ 2008-03-10 13:17 UTC (permalink / raw
  To: Paul Mackerras
  Cc: martin f krafft, Mark Levedahl, Gerrit Pape, git, 442253-quiet

2008/3/8 Paul Mackerras <paulus@samba.org>:
>  > As I said earlier, this is really the job
>  > of a window manager, *not* a configuration option. If your window
>  > manager cannot restore the window to a size you control, then it's
>  > broken. Let's not hack applications to work around that, please.
>
>  I disagree.  It's not a window manager's job to tell an application
>  how big its window should be.

There are some modestly popular tiling window managers that attempt to
remove the bother of having to manually move windows around which take
the view that the window manager's decisions should only be overruled
in the very rare cases where it's absolutely necessary, eg,

Ion http://modeemi.fi/~tuomov/ion/
dwm http://www.suckless.org/wiki/dwm

(The major windows that don't resize well are from image based
programs where you want exactly the underlying image on your display.
Text based programs like gitk work great under autoresizing.) However,
the current gitk appears to work fine on those window managers because
the internal dividers get automtatically resized whenever the global
window resizes, and the wm resizes the window so quickly after
creation I don't have time to notice it.

-- 
cheers, dave tweed__________________________
david.tweed@gmail.com
Rm 124, School of Systems Engineering, University of Reading.
"while having code so boring anyone can maintain it, use Python." --
attempted insult seen on slashdot

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2008-03-10 13:19 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).