{"thread":{"id":"6769","subject":"[PATCH] Make gitk save and restore the user set window position.","startedAt":"2007-02-11T14:27:18Z","lastAt":"2007-02-11T21:49:15Z","messageCount":8,"participants":["Mark Levedahl","Sergey Vlasov","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"34165","messageId":"11712040401127-git-send-email-mdl123@verizon.net","threadId":"6769","inReplyTo":null,"subject":"[PATCH] Make gitk save and restore the user set window position.","fromName":"Mark Levedahl","fromEmail":"mdl123@verizon.net","sentAt":"2007-02-11T14:27:18Z","receivedAt":"2007-02-11T14:27:18Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"I sent these patches to Junio and Paul last week, mistyped the git mailing list\naddress so they didn't get to the list so am resending for the record.\n\nMark Levedahl\n"},{"id":"34163","messageId":"11712040403973-git-send-email-mdl123@verizon.net","threadId":"6769","inReplyTo":"11712040401127-git-send-email-mdl123@verizon.net","subject":"[PATCH] Make gitk save and restore the user set window position.","fromName":"Mark Levedahl","fromEmail":"mdl123@verizon.net","sentAt":"2007-02-11T14:27:19Z","receivedAt":"2007-02-11T14:27:19Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"gitk was saving widget sizes and positions when the main window was\ndestroyed, which is after all child widgets are destroyed. The cure\nis to trap the WM_DELETE_WINDOW event before the gui is torn down. Also,\nthe saved geometry was captured using \"winfo geometry .\", rather than\n\"wm geometry .\" Under Linux, these two return different answers and the\nlatter one is correct.\n\nSigned-off-by: Mark Levedahl <mdl123@verizon.net>\n---\n gitk |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 1c36235..23bf567 100755\n--- a/gitk\n+++ b/gitk\n@@ -725,7 +725,7 @@ proc makewindow {} {\n     bind . <Control-KP_Add> {incrfont 1}\n     bind . <Control-minus> {incrfont -1}\n     bind . <Control-KP_Subtract> {incrfont -1}\n-    bind . <Destroy> {savestuff %W}\n+    wm protocol . WM_DELETE_WINDOW doquit\n     bind . <Button-1> \"click %W\"\n     bind $fstring <Key-Return> dofind\n     bind $sha1entry <Key-Return> gotocommit\n@@ -829,7 +829,7 @@ proc savestuff {w} {\n \tputs $f [list set colors $colors]\n \tputs $f [list set diffcolors $diffcolors]\n \n-        puts $f \"set geometry(main) [winfo geometry .]\"\n+\tputs $f \"set geometry(main) [wm geometry .]\"\n \tputs $f \"set geometry(topwidth) [winfo width .tf]\"\n \tputs $f \"set geometry(topheight) [winfo height .tf]\"\n \tputs $f \"set geometry(canv) [expr {[winfo width $canv]-0}]\"\n@@ -5800,6 +5800,7 @@ proc showtag {tag isnew} {\n proc doquit {} {\n     global stopped\n     set stopped 100\n+    savestuff .\n     destroy .\n }\n \n-- \n1.5.0.rc3.24.g0c5e\n"},{"id":"34164","messageId":"1171204040779-git-send-email-mdl123@verizon.net","threadId":"6769","inReplyTo":"11712040403973-git-send-email-mdl123@verizon.net","subject":"[PATCH] Clean up geometry save code in gitk.","fromName":"Mark Levedahl","fromEmail":"mdl123@verizon.net","sentAt":"2007-02-11T14:27:20Z","receivedAt":"2007-02-11T14:27:20Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"Leftover code was subtracting zero from several items before storing, an\nobvious noop now deleted.\n\nSigned-off-by: Mark Levedahl <mdl123@verizon.net>\n---\n gitk |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 23bf567..df1ce8c 100755\n--- a/gitk\n+++ b/gitk\n@@ -832,9 +832,9 @@ proc savestuff {w} {\n \tputs $f \"set geometry(main) [wm geometry .]\"\n \tputs $f \"set geometry(topwidth) [winfo width .tf]\"\n \tputs $f \"set geometry(topheight) [winfo height .tf]\"\n-\tputs $f \"set geometry(canv) [expr {[winfo width $canv]-0}]\"\n-\tputs $f \"set geometry(canv2) [expr {[winfo width $canv2]-0}]\"\n-\tputs $f \"set geometry(canv3) [expr {[winfo width $canv3]-0}]\"\n+\tputs $f \"set geometry(canv) [winfo width $canv]\"\n+\tputs $f \"set geometry(canv2) [winfo width $canv2]\"\n+\tputs $f \"set geometry(canv3) [winfo width $canv3]\"\n \tputs $f \"set geometry(botwidth) [winfo width .bleft]\"\n \tputs $f \"set geometry(botheight) [winfo height .bleft]\"\n \n-- \n1.5.0.rc3.24.g0c5e\n"},{"id":"34175","messageId":"20070211195643.b1f548f2.vsu@altlinux.ru","threadId":"6769","inReplyTo":"1171204040779-git-send-email-mdl123@verizon.net","subject":"Re: [PATCH] Clean up geometry save code in gitk.","fromName":"Sergey Vlasov","fromEmail":"vsu@altlinux.ru","sentAt":"2007-02-11T16:56:43Z","receivedAt":"2007-02-11T16:56:43Z","isPatch":true,"sender":{"key":"vsu@altlinux.ru","avatar":"https://avatars.githubusercontent.com/u/616082?v=4"},"body":"Hello!\n\nOn Sun, 11 Feb 2007 09:27:20 -0500\nMark Levedahl <mdl123@verizon.net> wrote:\n\n> gitk was saving widget sizes and positions when the main window was\n> destroyed, which is after all child widgets are destroyed. The cure\n> is to trap the WM_DELETE_WINDOW event before the gui is torn down. Also,\n> the saved geometry was captured using \"winfo geometry .\", rather than\n> \"wm geometry .\" Under Linux, these two return different answers and the\n> latter one is correct.\n\n> Leftover code was subtracting zero from several items before storing, an\n> obvious noop now deleted.\n\nThese two patches fix saving of the window position for me; however,\nsome things still remain broken:\n\n - No matter what sizes of the commit tree, patch and filelist panes I\n   set, on gitk restart they come up with their default sizes.\n\n - Sizes of commit tree columns are not saved properly - on every gitk\n   restart the dividers are shifting more and more to the right.\n\nThis is on Linux (x86_64) with Tk 8.4.13.\n\nI made two more patches which fix the above problems for me - please\ntest them (in particular, someone needs to check that the Cygwin\nsupport is not broken - apparently something is different between Tk\non Linux and Cygwin to create the problem with commit tree columns).\n\nSee the followup messages.\n\n--\nSergey Vlasov\n"},{"id":"34176","messageId":"117121311393-git-send-email-vsu@altlinux.ru","threadId":"6769","inReplyTo":"20070211195643.b1f548f2.vsu@altlinux.ru","subject":"gitk: Fix restoring of pane sizes","fromName":"Sergey Vlasov","fromEmail":"vsu@altlinux.ru","sentAt":"2007-02-11T16:58:32Z","receivedAt":"2007-02-11T16:58:32Z","isPatch":false,"sender":{"key":"vsu@altlinux.ru","avatar":"https://avatars.githubusercontent.com/u/616082?v=4"},"body":"At least on Linux with Tk 8.4.13 gitk always came up with default pane\nsizes, even though they were previously saved in ~/.gitk.  Apparently\nsetting width and height of frames in these panes when creating them\nis not enough, and an explicit paneconfigure call is needed.\n\nSigned-off-by: Sergey Vlasov <vsu@altlinux.ru>\n---\n gitk |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex df1ce8c..7e6ee56 100755\n--- a/gitk\n+++ b/gitk\n@@ -577,6 +577,7 @@ proc makewindow {} {\n     pack .tf.bar -in .tf -side bottom -fill x\n     pack .tf.histframe -fill both -side top -expand 1\n     .ctop add .tf\n+    .ctop paneconfigure .tf -height $geometry(topheight)\n \n     # now build up the bottom\n     panedwindow .pwbottom -orient horizontal\n@@ -638,6 +639,7 @@ proc makewindow {} {\n     $ctext tag conf found -back yellow\n \n     .pwbottom add .bleft\n+    .pwbottom paneconfigure .bleft -width $geometry(botwidth)\n \n     # lower right\n     frame .bright\n-- \n1.5.0.rc4.50.g403de\n"},{"id":"34177","messageId":"11712131153045-git-send-email-vsu@altlinux.ru","threadId":"6769","inReplyTo":"117121311393-git-send-email-vsu@altlinux.ru","subject":"gitk: Fix restoring of column widths in the commit tree","fromName":"Sergey Vlasov","fromEmail":"vsu@altlinux.ru","sentAt":"2007-02-11T16:58:33Z","receivedAt":"2007-02-11T16:58:33Z","isPatch":false,"sender":{"key":"vsu@altlinux.ru","avatar":"https://avatars.githubusercontent.com/u/616082?v=4"},"body":"On Linux with Tk 8.4.13 after each gitk restart the column dividers\nwere shifting more and more to the right.  Apparently the value from\n[winfo width $canv] is larger than the value of the -width option\nspecified when creating the widget due to non-zero -highlightthickness\nused by default.  But gitk never shows the focus highlight on canvases\nused for the commit tree, so we can just set \"-highlightthickness 0\",\nwhich fixes the width mismatch.\n\n(The code before commit 3468e71f452701b3eff6a2aeb826bbe0cdad8270\nsubtracted 2 from widths of canvases when saving them - apparently to\naccount for that hidden highlightthickness; I suppose that Cygwin\nbehaves differently - hope that \"-highlightthickness 0\" will give\nproper results everywhere.)\n\nSigned-off-by: Sergey Vlasov <vsu@altlinux.ru>\n---\n gitk |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 7e6ee56..ea3d68a 100755\n--- a/gitk\n+++ b/gitk\n@@ -459,14 +459,17 @@ proc makewindow {} {\n     set canv .tf.histframe.pwclist.canv\n     canvas $canv -width $geometry(canv) \\\n \t-background $bgcolor -bd 0 \\\n+\t-highlightthickness 0 \\\n \t-yscrollincr $linespc -yscrollcommand \"scrollcanv $cscroll\"\n     .tf.histframe.pwclist add $canv\n     set canv2 .tf.histframe.pwclist.canv2\n     canvas $canv2 -width $geometry(canv2) \\\n+\t-highlightthickness 0 \\\n \t-background $bgcolor -bd 0 -yscrollincr $linespc\n     .tf.histframe.pwclist add $canv2\n     set canv3 .tf.histframe.pwclist.canv3\n     canvas $canv3 -width $geometry(canv3) \\\n+\t-highlightthickness 0 \\\n \t-background $bgcolor -bd 0 -yscrollincr $linespc\n     .tf.histframe.pwclist add $canv3\n \n-- \n1.5.0.rc4.50.g403de\n"},{"id":"34180","messageId":"45CF55E3.9080508@verizon.net","threadId":"6769","inReplyTo":"20070211195643.b1f548f2.vsu@altlinux.ru","subject":"Re: [PATCH] Clean up geometry save code in gitk.","fromName":"Mark Levedahl","fromEmail":"mdl123@verizon.net","sentAt":"2007-02-11T17:44:03Z","receivedAt":"2007-02-11T17:44:03Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"Sergey Vlasov wrote:\n> These two patches fix saving of the window position for me; however,\n> some things still remain broken:\n>\n>  - No matter what sizes of the commit tree, patch and filelist panes I\n>    set, on gitk restart they come up with their default sizes.\n>\n>  - Sizes of commit tree columns are not saved properly - on every gitk\n>    restart the dividers are shifting more and more to the right.\n>\n> This is on Linux (x86_64) with Tk 8.4.13.\n>\n> I made two more patches which fix the above problems for me - please\n> test them (in particular, someone needs to check that the Cygwin\n> support is not broken - apparently something is different between Tk\n> on Linux and Cygwin to create the problem with commit tree columns).\n>\n> See the followup messages.\n>\n> --\n> Sergey Vlasov\n>   \n\nI could not actually apply your patches, but your suggested changes were \nsimple enough to apply by hand:\n1) I do notice the change in size of panes in the upper window on Cygwin \n(hadn't noticed before but it is there), and your \"-highlightthickness \n0\" tweak fixes that. Just for grins, I tried reenabling the \"subtract 2\" \nstrategy in place before, and that only makes the problem worse on Cygwin.\n2) I don't see any effect of the \"pane configure\" tweak on Cygwin. \nHaven't checked on Linux (don't have that here) so cannot comment.\n\nGotta say, the more I play with Tk, the more I wonder why anyone uses \nanything else  ;-) .\n\nMark\n"},{"id":"34191","messageId":"7vodo0cqlg.fsf@assigned-by-dhcp.cox.net","threadId":"6769","inReplyTo":"11712040401127-git-send-email-mdl123@verizon.net","subject":"Re: [PATCH] Make gitk save and restore the user set window position.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-11T21:49:15Z","receivedAt":"2007-02-11T21:49:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mark Levedahl <mdl123@verizon.net> writes:\n\n> I sent these patches to Junio and Paul last week, mistyped the git mailing list\n> address so they didn't get to the list so am resending for the record.\n\nThanks.  Will apply them, short-circuitting Paul.\n"}]}