@matheusbsbs / matheus-bagliano / commits / ed7b603381
Fork 0

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>

Alexey Borzenkov committed Sep 8, 2009 at 22:39 UTC ed7b603381a57f706d758cf5a2f2ce604ef8c825
1 file changed +21
git-gui.sh
+21
@@ -2025,6 +2025,19 @@ proc do_quit {{rc {1}}} {
2025
2026 # -- Stash our current window geometry into this repository.
2027 #
2028 + set cfg_wmstate [wm state .]
2029 + if {[catch {set rc_wmstate $repo_config(gui.wmstate)}]} {
2030 + set rc_wmstate {}
2031 + }
2032 + if {$cfg_wmstate ne $rc_wmstate} {
2033 + catch {git config gui.wmstate $cfg_wmstate}
2034 + }
2035 + if {$cfg_wmstate eq {zoomed}} {
2036 + # on Windows wm geometry will lie about window
2037 + # position (but not size) when window is zoomed
2038 + # restore the window before querying wm geometry
2039 + wm state . normal
2040 + }
2041 set cfg_geometry [list]
2042 lappend cfg_geometry [wm geometry .]
2043 lappend cfg_geometry [lindex [.vpane sash coord 0] 0]
@@ -3264,6 +3277,14 @@ wm geometry . [lindex $gm 0]
3277 unset gm
3278 }
3279
3280 +# -- Load window state
3281 +#
3282 +catch {
3283 +set gws $repo_config(gui.wmstate)
3284 +wm state . $gws
3285 +unset gws
3286 +}
3287 +
3288 # -- Key Bindings
3289 #
3290 bind $ui_comm <$M1B-Key-Return> {do_commit;break}