Skip to content

Commit

Permalink
git-gui: store wm state and fix wm geometry
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Borzenkov authored and Shawn O. Pearce committed Sep 12, 2009
1 parent 118d938 commit ed7b603
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit ed7b603

Please sign in to comment.