diff options
author | Alexey Borzenkov <snaury@gmail.com> | 2009-09-08 22:39:33 +0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2009-09-12 11:35:29 -0700 |
commit | ed7b603381a57f706d758cf5a2f2ce604ef8c825 (patch) | |
tree | 9b8c0f72c5786ca8919198bdfe7fcba6aa60231e | |
parent | 118d938812f3fc660f43bad9b546e7dadc3571a9 (diff) | |
download | git-ed7b603381a57f706d758cf5a2f2ce604ef8c825.tar.gz |
git-gui: store wm state and fix wm geometry
I often close git gui window when it is maximized, and when I reopen
it next time the it would usually become out of place (e.g. a huge
window with a top-left corner somewhere close to the center of the
screen). Fix it by storing and restoring wm state in config, as well
as setting wm state to normal before retrieving wm geometry info.
Signed-off-by: Alexey Borzenkov <snaury@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rwxr-xr-x | git-gui.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/git-gui.sh b/git-gui.sh index eae1f8121d..88d1025dd0 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2025,6 +2025,19 @@ proc do_quit {{rc {1}}} { # -- Stash our current window geometry into this repository. # + set cfg_wmstate [wm state .] + if {[catch {set rc_wmstate $repo_config(gui.wmstate)}]} { + set rc_wmstate {} + } + if {$cfg_wmstate ne $rc_wmstate} { + catch {git config gui.wmstate $cfg_wmstate} + } + if {$cfg_wmstate eq {zoomed}} { + # on Windows wm geometry will lie about window + # position (but not size) when window is zoomed + # restore the window before querying wm geometry + wm state . normal + } set cfg_geometry [list] lappend cfg_geometry [wm geometry .] lappend cfg_geometry [lindex [.vpane sash coord 0] 0] @@ -3264,6 +3277,14 @@ wm geometry . [lindex $gm 0] unset gm } +# -- Load window state +# +catch { +set gws $repo_config(gui.wmstate) +wm state . $gws +unset gws +} + # -- Key Bindings # bind $ui_comm <$M1B-Key-Return> {do_commit;break} |