{"thread":{"id":"20880","subject":"[PATCH] git-gui: store wm state and fix wm geometry","startedAt":"2009-09-08T18:39:33Z","lastAt":"2009-09-08T18:39:33Z","messageCount":1,"participants":["Alexey Borzenkov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"122715","messageId":"e2480c70909081139s6027cd91n6d32c2f845629ed1@mail.gmail.com","threadId":"20880","inReplyTo":null,"subject":"[PATCH] git-gui: store wm state and fix wm geometry","fromName":"Alexey Borzenkov","fromEmail":"snaury@gmail.com","sentAt":"2009-09-08T18:39:33Z","receivedAt":"2009-09-08T18:39:33Z","isPatch":true,"sender":{"key":"snaury@gmail.com","avatar":"https://gravatar.com/avatar/dd9f652303405e256f31e18690cea19ffcf21b83b04f746957334f62e399d95d?d=mp&s=160"},"body":"I often close git gui window when it is maximized, and when I reopen\nit next time the it would usually become out of place (e.g. a huge\nwindow with a top-left corner somewhere close to the center of the\nscreen). Fix it by storing and restoring wm state in config, as well\nas setting wm state to normal before retrieving wm geometry info.\n\nSigned-off-by: Alexey Borzenkov <snaury@gmail.com>\n---\n I've been using this patch for almost a year on Windows now.\n If you have any comments/questions please don't forget to cc me\n as I'm not subscribed to this list.\n\n git-gui.sh |   21 +++++++++++++++++++++\n 1 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex eae1f81..88d1025 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -2025,6 +2025,19 @@ proc do_quit {{rc {1}}} {\n\n \t\t# -- Stash our current window geometry into this repository.\n \t\t#\n+\t\tset cfg_wmstate [wm state .]\n+\t\tif {[catch {set rc_wmstate $repo_config(gui.wmstate)}]} {\n+\t\t\tset rc_wmstate {}\n+\t\t}\n+\t\tif {$cfg_wmstate ne $rc_wmstate} {\n+\t\t\tcatch {git config gui.wmstate $cfg_wmstate}\n+\t\t}\n+\t\tif {$cfg_wmstate eq {zoomed}} {\n+\t\t\t# on Windows wm geometry will lie about window\n+\t\t\t# position (but not size) when window is zoomed\n+\t\t\t# restore the window before querying wm geometry\n+\t\t\twm state . normal\n+\t\t}\n \t\tset cfg_geometry [list]\n \t\tlappend cfg_geometry [wm geometry .]\n \t\tlappend cfg_geometry [lindex [.vpane sash coord 0] 0]\n@@ -3264,6 +3277,14 @@ wm geometry . [lindex $gm 0]\n unset gm\n }\n\n+# -- Load window state\n+#\n+catch {\n+set gws $repo_config(gui.wmstate)\n+wm state . $gws\n+unset gws\n+}\n+\n # -- Key Bindings\n #\n bind $ui_comm <$M1B-Key-Return> {do_commit;break}\n-- \n1.6.4.2\n"}]}