{"thread":{"id":"25009","subject":"Re: [RFC/PATCH] Force using Tcl/Tk 8.4 on Mac OS X","startedAt":"2010-09-06T19:36:34Z","lastAt":"2010-09-23T07:39:06Z","messageCount":11,"participants":["Daniel A. Steffen","Stefan Haller","Pat Thoyts","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"150114","messageId":"CB6C69E6-7943-49B7-96E7-4C00831C3C9D@users.sourceforge.net","threadId":"25009","inReplyTo":"1283792854-45023-1-git-send-email-lists@haller-berlin.de","subject":"Re: [RFC/PATCH] Force using Tcl/Tk 8.4 on Mac OS X","fromName":"Daniel A. Steffen","fromEmail":"das@users.sourceforge.net","sentAt":"2010-09-06T19:36:34Z","receivedAt":"2010-09-06T19:36:34Z","isPatch":true,"sender":{"key":"das@users.sourceforge.net","avatar":null},"body":"Hi Stefan,\n\nOn Sep 6, 2010, at 10:07 AM, Stefan Haller wrote:\n\n> When using Git Gui.app on a Snow Leopard system with Tcl/Tk 8.5,\n> there are two problems:\n> \n> 1) Menu commands that open a dialog (e.g. \"Push\" or \"Revert changes\")\n>   don't work when invoked via their keyboard shortcuts. You get a\n>   dialog without a title bar, and the application then hangs without\n>   further responding to any user input; you need to kill it. Invoking\n>   the same commands with the mouse by choosing from the menu works fine.\n\nfirst time I hear of this (or see this myself, and I use git gui every day on Mac OS X); in part this may be due to the fact that many of the menu shortcuts assigned by git gui conflict with existing OS X shortcuts and don't work anyway e.g. cmd-A (esp if a text widget is in focus)...\n\npersonally I would hate for my git gui to be downgraded to Tk 8.4 and Carbon because of this small issue, and I'm unlikely to be alone.\n\n> 2) The colored pane headers (red, green, yellow) are all grey.\n\nthis is intentional and triggered by the use of ttk, there is a config setting to turn it off (gui.usettk)\n\n> Obviously, the first problem is much more serious than the second.\n> \n> Both problems go away when using Tcl/Tk 8.4 instead of 8.5. The user\n> interface looks a little \"older\" then, but at least it works reliably.\n> \n> Until someone figures out how to solve these problems properly with\n> 8.5, force using 8.4.\n\nplease don't brute-force around the problem in this way, there are many features that the Cocoa Tk in 8.5+ adds that would be lost by such a change. \nMoreover the fact that 8.4 is present in that location is for backwards compatibility only, please don't introduce any new dependencies on it.\n\nAn effective small workaround for the problem appears to be to turn off the menu accelerators for the affected commands (the key shortcuts will still work, since the actual key bindings are independent of the menu accelerators), see below.\nIs there a complete list of menu shortcuts that bring up a dialog?\n\nUltimately the right way to address this issue is to fix it in Tk, please report this in the Tk bug tracker if you haven't already, a quick glance in the debugger shows a hang in recursive event loop invocation such as used by tk_dialog when called from a menu accelerator callback.\n\nThanks!\n\nCheers,\n\nDaniel\n\n\ndiff --git i/git-gui.sh w/git-gui.sh\nindex 0d5c5e3..ec7ed7d 100755\n--- i/git-gui.sh\n+++ w/git-gui.sh\n@@ -2723,6 +2723,9 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {\n                -accelerator $M1T-J\n        lappend disable_on_lock \\\n                [list .mbar.commit entryconf [.mbar.commit index last] -state]\n+       if {[is_MacOSX]} {\n+               .mbar.commit entryconf last -accelerator {}\n+       }\n \n        .mbar.commit add separator\n \n"},{"id":"150193","messageId":"1jofybj.1n3hzqy1yd85vfM%lists@haller-berlin.de","threadId":"25009","inReplyTo":"CB6C69E6-7943-49B7-96E7-4C00831C3C9D@users.sourceforge.net","subject":"Re: [RFC/PATCH] Force using Tcl/Tk 8.4 on Mac OS X","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2010-09-07T07:19:42Z","receivedAt":"2010-09-07T07:19:42Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Daniel A. Steffen <das@users.sourceforge.net> wrote:\n\n> On Sep 6, 2010, at 10:07 AM, Stefan Haller wrote:\n> \n> > When using Git Gui.app on a Snow Leopard system with Tcl/Tk 8.5,\n> > there are two problems:\n> > \n> > 1) Menu commands that open a dialog (e.g. \"Push\" or \"Revert changes\")\n> >   don't work when invoked via their keyboard shortcuts. You get a\n> >   dialog without a title bar, and the application then hangs without\n> >   further responding to any user input; you need to kill it. Invoking\n> >   the same commands with the mouse by choosing from the menu works fine.\n> \n> first time I hear of this (or see this myself, and I use git gui every day\n> on Mac OS X); in part this may be due to the fact that many of the menu\n> shortcuts assigned by git gui conflict with existing OS X shortcuts and\n> don't work anyway e.g. cmd-A (esp if a text widget is in focus)...\n> \n> personally I would hate for my git gui to be downgraded to Tk 8.4 and\n> Carbon because of this small issue, and I'm unlikely to be alone.\n\nIt's not a small issue for me, but I agree that downgrading to 8.4 is\nthe wrong solution.\n\n> An effective small workaround for the problem appears to be to turn off\n> the menu accelerators for the affected commands (the key shortcuts will\n> still work, since the actual key bindings are independent of the menu\n> accelerators), see below.\n\nThis does indeed solve the problem, but at a high price; having the menu\naccelerators not visible in the menu is not a satisfactory solution.\n(For me personally it's ok, but not for new users.)\n\nIs there no other way to work around this in git gui, like maybe\ndeferring the command invocation with a one-shot timer or something?\n\n> Is there a complete list of menu shortcuts that bring up a dialog?\n\nAs far as I can see, it's\n\n    Branch/Create\n    Branch/Checkout\n    Commit/Revert Changes\n    Merge/Local Merge\n    Remote/Push\n\n> Ultimately the right way to address this issue is to fix it in Tk, please\n> report this in the Tk bug tracker if you haven't already, a quick glance\n> in the debugger shows a hang in recursive event loop invocation such as\n> used by tk_dialog when called from a menu accelerator callback.\n\nWill do, thanks.\n\n> > 2) The colored pane headers (red, green, yellow) are all grey.\n> \n> this is intentional and triggered by the use of ttk, there is a config\n> setting to turn it off (gui.usettk)\n\nI'm not sure I understand. On a Windows system with Tk 8.5 and ttk on,\nthe pane headers are still colored.  Why is it desirable to have them\ngrey on Mac?\n\n-Stefan\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"150241","messageId":"87r5h5pdwz.fsf@fox.patthoyts.tk","threadId":"25009","inReplyTo":"CB6C69E6-7943-49B7-96E7-4C00831C3C9D@users.sourceforge.net","subject":"Re: [RFC/PATCH] Force using Tcl/Tk 8.4 on Mac OS X","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2010-09-07T19:11:08Z","receivedAt":"2010-09-07T19:11:08Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"\"Daniel A. Steffen\" <das@users.sourceforge.net> writes:\n\n>Hi Stefan,\n>\n>On Sep 6, 2010, at 10:07 AM, Stefan Haller wrote:\n>\n>> When using Git Gui.app on a Snow Leopard system with Tcl/Tk 8.5,\n>> there are two problems:\n>> \n>> 1) Menu commands that open a dialog (e.g. \"Push\" or \"Revert changes\")\n>>   don't work when invoked via their keyboard shortcuts. You get a\n>>   dialog without a title bar, and the application then hangs without\n>>   further responding to any user input; you need to kill it. Invoking\n>>   the same commands with the mouse by choosing from the menu works fine.\n>\n>first time I hear of this (or see this myself, and I use git gui every\n>day on Mac OS X); in part this may be due to the fact that many of the\n>menu shortcuts assigned by git gui conflict with existing OS X\n>shortcuts and don't work anyway e.g. cmd-A (esp if a text widget is in\n>focus)...\n>\n>personally I would hate for my git gui to be downgraded to Tk 8.4 and\n>Carbon because of this small issue, and I'm unlikely to be alone.\n>\n\nI will not force 8.4 on anyone. If someone wants to force it locally\nthey can just edit the wish command in their git-gui script file to use\nwish8.4.\n\nI'm happy - even eager - to apply patches to improve the MacOSX git gui\nexperience but I can't test them as I don't have such a system.\n\n>\n>diff --git i/git-gui.sh w/git-gui.sh\n>index 0d5c5e3..ec7ed7d 100755\n>--- i/git-gui.sh\n>+++ w/git-gui.sh\n>@@ -2723,6 +2723,9 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {\n>                -accelerator $M1T-J\n>        lappend disable_on_lock \\\n>                [list .mbar.commit entryconf [.mbar.commit index last] -state]\n>+       if {[is_MacOSX]} {\n>+               .mbar.commit entryconf last -accelerator {}\n>+       }\n> \n>        .mbar.commit add separator\n> \n>\n\nThis removes the Cmd-J accelerator from the \"Revert Changes\" menu\nitem. I assume that just changing the menu command to \n {after idle [list do_revert_selection]}\ndoesn't work either?\n\nDo you want this applied or will you produce a patch that removes more\nsuch inappropriate accelerators?\n\nAlso - got any other MacOS specific patches?\n\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"},{"id":"150245","messageId":"1jogy2y.tfhl6g1eq9mylM%lists@haller-berlin.de","threadId":"25009","inReplyTo":"87r5h5pdwz.fsf@fox.patthoyts.tk","subject":"Re: [RFC/PATCH] Force using Tcl/Tk 8.4 on Mac OS X","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2010-09-07T19:56:07Z","receivedAt":"2010-09-07T19:56:07Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Pat Thoyts <patthoyts@users.sourceforge.net> wrote:\n\n> This removes the Cmd-J accelerator from the \"Revert Changes\" menu\n> item. I assume that just changing the menu command to \n>  {after idle [list do_revert_selection]}\n> doesn't work either?\n\nNo, but \"after 100\" does for me; \"after 10\" does not, and \"after 50\"\ndoes some of the time.  I'm not sure if this would be suitable as a\nworkaround then.\n\n-Stefan\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"150495","messageId":"1joncyu.2n3oi9e5w1fpM%haller@ableton.com","threadId":"25009","inReplyTo":"1jogy2y.tfhl6g1eq9mylM%lists@haller-berlin.de","subject":"Re: [RFC/PATCH] Force using Tcl/Tk 8.4 on Mac OS X","fromName":"Stefan Haller","fromEmail":"haller@ableton.com","sentAt":"2010-09-11T07:12:40Z","receivedAt":"2010-09-11T07:12:40Z","isPatch":true,"sender":{"key":"haller@ableton.com","avatar":null},"body":"Stefan Haller <lists@haller-berlin.de> wrote:\n\n> Pat Thoyts <patthoyts@users.sourceforge.net> wrote:\n> \n> > This removes the Cmd-J accelerator from the \"Revert Changes\" menu\n> > item. I assume that just changing the menu command to \n> >  {after idle [list do_revert_selection]}\n> > doesn't work either?\n> \n> No, but \"after 100\" does for me; \"after 10\" does not, and \"after 50\"\n> does some of the time.  I'm not sure if this would be suitable as a\n> workaround then.\n\nWe seem to be stuck with this right now.  What can I do to move this\nforward?  I have little experience with Tcl/Tk, so I'm probably unable\nto solve this in a satifactory way myself; but I'd like to do everything\nI can to make progress here.\n\nDo people think that the \"after 100\" hack would be acceptable, if it's\nconditional for {[is_MacOSX] && $::have_tk85}?  Would it help if I try\nto come up with a patch for that?\n\n-Stefan\n\n\n-- \nStefan Haller\nAbleton\nhttp://www.ableton.com/\n"},{"id":"150494","messageId":"1jondo9.dzvb0d1am10m3M%lists@haller-berlin.de","threadId":"25009","inReplyTo":"1jogy2y.tfhl6g1eq9mylM%lists@haller-berlin.de","subject":"Re: [RFC/PATCH] Force using Tcl/Tk 8.4 on Mac OS X","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2010-09-11T07:31:22Z","receivedAt":"2010-09-11T07:31:22Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Stefan Haller <lists@haller-berlin.de> wrote:\n\n> Pat Thoyts <patthoyts@users.sourceforge.net> wrote:\n> \n> > This removes the Cmd-J accelerator from the \"Revert Changes\" menu\n> > item. I assume that just changing the menu command to \n> >  {after idle [list do_revert_selection]}\n> > doesn't work either?\n> \n> No, but \"after 100\" does for me; \"after 10\" does not, and \"after 50\"\n> does some of the time.  I'm not sure if this would be suitable as a\n> workaround then.\n\nWe seem to be stuck with this right now.  What can I do to move this\nforward?  I have little experience with Tcl/Tk, so I'm probably unable\nto solve this in a satifactory way myself; but I'd like to do everything\nI can to help make progress here.\n\nDo people think that the \"after 100\" hack would be acceptable, if it's\nconditional for {[is_MacOSX] && $::have_tk85}?  Would it help if I try\nto come up with a patch for that?\n\n-Stefan\n\n\n(Sorry for the duplicate mail; I used the wrong return address the first\ntime, so it didn't got to the list.)\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"150663","messageId":"1jossvu.zf5a2u1xnuow0M%lists@haller-berlin.de","threadId":"25009","inReplyTo":"CB6C69E6-7943-49B7-96E7-4C00831C3C9D@users.sourceforge.net","subject":"Re: [RFC/PATCH] Force using Tcl/Tk 8.4 on Mac OS X","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2010-09-14T05:42:34Z","receivedAt":"2010-09-14T05:42:34Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Daniel A. Steffen <das@users.sourceforge.net> wrote:\n\n> Ultimately the right way to address this issue is to fix it in Tk, please\n> report this in the Tk bug tracker if you haven't already, a quick glance\n> in the debugger shows a hang in recursive event loop invocation such as\n> used by tk_dialog when called from a menu accelerator callback.\n\nI finally got around to this now.  It was already reported as issue\n3044863; I added a comment to the existing ticket.\n\n<http://sourceforge.net/tracker/?func=detail&aid=3044863&group_id=12997&atid=112997>\n\nI still think we need a work-around in git gui (and maybe gitk) until a\nfixed Tk version is widely available. Yesterday I showed git to a\nco-worker, and after 20 minutes of randomly playing around with it he\nran into the problem (without me pointing him to it).\n\n-Stefan\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"151188","messageId":"1jp5xs1.ebxa6718bj9huM%lists@haller-berlin.de","threadId":"25009","inReplyTo":"1jogy2y.tfhl6g1eq9mylM%lists@haller-berlin.de","subject":"[PATCH] git-gui: Work around freeze problem with dialogs in Mac OS X","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2010-09-21T08:26:44Z","receivedAt":"2010-09-21T08:26:44Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Tk 8.5 on Mac OS X has a bug whereby a dialog opened from a key\nbinding will hang; see issue 3044863 in the Tk issue tracker.\n<http://sourceforge.net/tracker/?func=detail&aid=3044863&group_id=12997&atid=112997>\n\nTo work around this, we perform commands that open a dialog after\na brief delay; 150 ms seems to be a good compromise between short\nenough as to be not annoying, and long enough to reliably work\naround the issue.\n\nSigned-off-by: Stefan Haller <stefan@haller-berlin.de>\n---\n git-gui.sh |   39 +++++++++++++++++++++++++++------------\n 1 files changed, 27 insertions(+), 12 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 4617f29..394c2a0 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -3560,6 +3560,21 @@ if {[info exists repo_config(gui.wmstate)]} {\n    catch {wm state . $repo_config(gui.wmstate)}\n }\n \n+proc mac_freeze_workaround {cmd} {\n+   if {[is_MacOSX] && $::have_tk85} {\n+       # Tk 8.5 on Mac OS X has a bug whereby a dialog opened from a key\n+       # binding will hang; see issue 3044863 in the Tk issue tracker.\n+       # <http://sourceforge.net/tracker/?func=detail&aid=3044863&group_id=12997&atid=112997>\n+       #\n+       # To work around this, we perform commands that open a dialog after a brief\n+       # delay; 150 ms seems to be a good compromise between short enough as to be\n+       # not annoying, and long enough to reliably work around the issue.\n+       after 150 $cmd\n+   } else {\n+       $cmd\n+   }\n+}\n+\n # -- Key Bindings\n #\n bind $ui_comm <$M1B-Key-Return> {do_commit;break}\n@@ -3567,8 +3582,8 @@ bind $ui_comm <$M1B-Key-t> {do_add_selection;break}\n bind $ui_comm <$M1B-Key-T> {do_add_selection;break}\n bind $ui_comm <$M1B-Key-u> {do_unstage_selection;break}\n bind $ui_comm <$M1B-Key-U> {do_unstage_selection;break}\n-bind $ui_comm <$M1B-Key-j> {do_revert_selection;break}\n-bind $ui_comm <$M1B-Key-J> {do_revert_selection;break}\n+bind $ui_comm <$M1B-Key-j> {mac_freeze_workaround do_revert_selection;break}\n+bind $ui_comm <$M1B-Key-J> {mac_freeze_workaround do_revert_selection;break}\n bind $ui_comm <$M1B-Key-i> {do_add_all;break}\n bind $ui_comm <$M1B-Key-I> {do_add_all;break}\n bind $ui_comm <$M1B-Key-x> {tk_textCut %W;break}\n@@ -3606,16 +3621,16 @@ bind $ui_diff <Control-Key-f> {catch {%W yview scroll  1 pages};break}\n bind $ui_diff <Button-1>   {focus %W}\n \n if {[is_enabled branch]} {\n-   bind . <$M1B-Key-n> branch_create::dialog\n-   bind . <$M1B-Key-N> branch_create::dialog\n-   bind . <$M1B-Key-o> branch_checkout::dialog\n-   bind . <$M1B-Key-O> branch_checkout::dialog\n-   bind . <$M1B-Key-m> merge::dialog\n-   bind . <$M1B-Key-M> merge::dialog\n+   bind . <$M1B-Key-n> {mac_freeze_workaround branch_create::dialog}\n+   bind . <$M1B-Key-N> {mac_freeze_workaround branch_create::dialog}\n+   bind . <$M1B-Key-o> {mac_freeze_workaround branch_checkout::dialog}\n+   bind . <$M1B-Key-O> {mac_freeze_workaround branch_checkout::dialog}\n+   bind . <$M1B-Key-m> {mac_freeze_workaround merge::dialog}\n+   bind . <$M1B-Key-M> {mac_freeze_workaround merge::dialog}\n }\n if {[is_enabled transport]} {\n-   bind . <$M1B-Key-p> do_push_anywhere\n-   bind . <$M1B-Key-P> do_push_anywhere\n+   bind . <$M1B-Key-p> {mac_freeze_workaround do_push_anywhere}\n+   bind . <$M1B-Key-P> {mac_freeze_workaround do_push_anywhere}\n }\n \n bind .   <Key-F5>     ui_do_rescan\n@@ -3625,8 +3640,8 @@ bind .   <$M1B-Key-s> do_signoff\n bind .   <$M1B-Key-S> do_signoff\n bind .   <$M1B-Key-t> do_add_selection\n bind .   <$M1B-Key-T> do_add_selection\n-bind .   <$M1B-Key-j> do_revert_selection\n-bind .   <$M1B-Key-J> do_revert_selection\n+bind .   <$M1B-Key-j> {mac_freeze_workaround do_revert_selection}\n+bind .   <$M1B-Key-J> {mac_freeze_workaround do_revert_selection}\n bind .   <$M1B-Key-i> do_add_all\n bind .   <$M1B-Key-I> do_add_all\n bind .   <$M1B-Key-minus> {show_less_context;break}\n-- \n1.7.3.4.g200b9\n"},{"id":"151303","messageId":"1jp8k4n.1lz3bce9u857kM%lists@haller-berlin.de","threadId":"25009","inReplyTo":"1jogy2y.tfhl6g1eq9mylM%lists@haller-berlin.de","subject":"[PATCH] git-gui: Work around freeze problem with dialogs in Mac OS X","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2010-09-22T17:46:52Z","receivedAt":"2010-09-22T17:46:52Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Tk 8.5 on Mac OS X has a bug whereby a dialog opened from a key\nbinding will hang; see issue 3044863 in the Tk issue tracker.\n<http://sourceforge.net/tracker/?func=detail&aid=3044863&group_id=12997&atid=112997>\n\nTo work around this, we perform commands that open a dialog after\na brief delay; 150 ms seems to be a good compromise between short\nenough as to be not annoying, and long enough to reliably work\naround the issue.\n\nSigned-off-by: Stefan Haller <stefan@haller-berlin.de>\n---\nI already sent this two days ago, but it didn't seem to appear on the\nlist for some reason, so I'm resending it. Apologies if you see this\ntwice.\n\n git-gui.sh |   39 +++++++++++++++++++++++++++------------\n 1 files changed, 27 insertions(+), 12 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 4617f29..394c2a0 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -3560,6 +3560,21 @@ if {[info exists repo_config(gui.wmstate)]} {\n    catch {wm state . $repo_config(gui.wmstate)}\n }\n \n+proc mac_freeze_workaround {cmd} {\n+   if {[is_MacOSX] && $::have_tk85} {\n+       # Tk 8.5 on Mac OS X has a bug whereby a dialog opened from a key\n+       # binding will hang; see issue 3044863 in the Tk issue tracker.\n+       # <http://sourceforge.net/tracker/?func=detail&aid=3044863&group_id=12997&atid=112997>\n+       #\n+       # To work around this, we perform commands that open a dialog after a brief\n+       # delay; 150 ms seems to be a good compromise between short enough as to be\n+       # not annoying, and long enough to reliably work around the issue.\n+       after 150 $cmd\n+   } else {\n+       $cmd\n+   }\n+}\n+\n # -- Key Bindings\n #\n bind $ui_comm <$M1B-Key-Return> {do_commit;break}\n@@ -3567,8 +3582,8 @@ bind $ui_comm <$M1B-Key-t> {do_add_selection;break}\n bind $ui_comm <$M1B-Key-T> {do_add_selection;break}\n bind $ui_comm <$M1B-Key-u> {do_unstage_selection;break}\n bind $ui_comm <$M1B-Key-U> {do_unstage_selection;break}\n-bind $ui_comm <$M1B-Key-j> {do_revert_selection;break}\n-bind $ui_comm <$M1B-Key-J> {do_revert_selection;break}\n+bind $ui_comm <$M1B-Key-j> {mac_freeze_workaround do_revert_selection;break}\n+bind $ui_comm <$M1B-Key-J> {mac_freeze_workaround do_revert_selection;break}\n bind $ui_comm <$M1B-Key-i> {do_add_all;break}\n bind $ui_comm <$M1B-Key-I> {do_add_all;break}\n bind $ui_comm <$M1B-Key-x> {tk_textCut %W;break}\n@@ -3606,16 +3621,16 @@ bind $ui_diff <Control-Key-f> {catch {%W yview scroll  1 pages};break}\n bind $ui_diff <Button-1>   {focus %W}\n \n if {[is_enabled branch]} {\n-   bind . <$M1B-Key-n> branch_create::dialog\n-   bind . <$M1B-Key-N> branch_create::dialog\n-   bind . <$M1B-Key-o> branch_checkout::dialog\n-   bind . <$M1B-Key-O> branch_checkout::dialog\n-   bind . <$M1B-Key-m> merge::dialog\n-   bind . <$M1B-Key-M> merge::dialog\n+   bind . <$M1B-Key-n> {mac_freeze_workaround branch_create::dialog}\n+   bind . <$M1B-Key-N> {mac_freeze_workaround branch_create::dialog}\n+   bind . <$M1B-Key-o> {mac_freeze_workaround branch_checkout::dialog}\n+   bind . <$M1B-Key-O> {mac_freeze_workaround branch_checkout::dialog}\n+   bind . <$M1B-Key-m> {mac_freeze_workaround merge::dialog}\n+   bind . <$M1B-Key-M> {mac_freeze_workaround merge::dialog}\n }\n if {[is_enabled transport]} {\n-   bind . <$M1B-Key-p> do_push_anywhere\n-   bind . <$M1B-Key-P> do_push_anywhere\n+   bind . <$M1B-Key-p> {mac_freeze_workaround do_push_anywhere}\n+   bind . <$M1B-Key-P> {mac_freeze_workaround do_push_anywhere}\n }\n \n bind .   <Key-F5>     ui_do_rescan\n@@ -3625,8 +3640,8 @@ bind .   <$M1B-Key-s> do_signoff\n bind .   <$M1B-Key-S> do_signoff\n bind .   <$M1B-Key-t> do_add_selection\n bind .   <$M1B-Key-T> do_add_selection\n-bind .   <$M1B-Key-j> do_revert_selection\n-bind .   <$M1B-Key-J> do_revert_selection\n+bind .   <$M1B-Key-j> {mac_freeze_workaround do_revert_selection}\n+bind .   <$M1B-Key-J> {mac_freeze_workaround do_revert_selection}\n bind .   <$M1B-Key-i> do_add_all\n bind .   <$M1B-Key-I> do_add_all\n bind .   <$M1B-Key-minus> {show_less_context;break}\n-- \n1.7.3.4.g200b9\n\n"},{"id":"151316","messageId":"7vocbpsivd.fsf@alter.siamese.dyndns.org","threadId":"25009","inReplyTo":"1jp8k4n.1lz3bce9u857kM%lists@haller-berlin.de","subject":"Re: [PATCH] git-gui: Work around freeze problem with dialogs in Mac OS X","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-09-22T19:01:10Z","receivedAt":"2010-09-22T19:01:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"lists@haller-berlin.de (Stefan Haller) writes:\n\n> Tk 8.5 on Mac OS X has a bug whereby a dialog opened from a key\n> binding will hang; see issue 3044863 in the Tk issue tracker.\n> <http://sourceforge.net/tracker/?func=detail&aid=3044863&group_id=12997&atid=112997>\n>\n> To work around this, we perform commands that open a dialog after\n> a brief delay; 150 ms seems to be a good compromise between short\n> enough as to be not annoying, and long enough to reliably work\n> around the issue.\n>\n> Signed-off-by: Stefan Haller <stefan@haller-berlin.de>\n\nIs 150ms applicable no matter how fast or slow your Mac is, or is Mac so\nmonoculture that everybody's machine has more or less the same performance\ncharacteristics?  IOW does this need to be autoadjusted?\n\nI see a lot of wrapping around foo::dialog; without knowing much about\nTcl, I wonder if it would be simpler, less error prone and more future\nproof to add the wrapping logic around something commonly used from them,\ne.g. class::make_dialog.\n\n> ---\n> I already sent this two days ago, but it didn't seem to appear on the\n> list for some reason, so I'm resending it. Apologies if you see this\n> twice.\n>\n>  git-gui.sh |   39 +++++++++++++++++++++++++++------------\n>  1 files changed, 27 insertions(+), 12 deletions(-)\n>\n> diff --git a/git-gui.sh b/git-gui.sh\n> index 4617f29..394c2a0 100755\n> --- a/git-gui.sh\n> +++ b/git-gui.sh\n> @@ -3560,6 +3560,21 @@ if {[info exists repo_config(gui.wmstate)]} {\n>     catch {wm state . $repo_config(gui.wmstate)}\n>  }\n>  \n> +proc mac_freeze_workaround {cmd} {\n> +   if {[is_MacOSX] && $::have_tk85} {\n> +       # Tk 8.5 on Mac OS X has a bug whereby a dialog opened from a key\n> +       # binding will hang; see issue 3044863 in the Tk issue tracker.\n> +       # <http://sourceforge.net/tracker/?func=detail&aid=3044863&group_id=12997&atid=112997>\n> +       #\n> +       # To work around this, we perform commands that open a dialog after a brief\n> +       # delay; 150 ms seems to be a good compromise between short enough as to be\n> +       # not annoying, and long enough to reliably work around the issue.\n> +       after 150 $cmd\n> +   } else {\n> +       $cmd\n> +   }\n> +}\n> +\n>  # -- Key Bindings\n>  #\n>  bind $ui_comm <$M1B-Key-Return> {do_commit;break}\n> @@ -3567,8 +3582,8 @@ bind $ui_comm <$M1B-Key-t> {do_add_selection;break}\n>  bind $ui_comm <$M1B-Key-T> {do_add_selection;break}\n>  bind $ui_comm <$M1B-Key-u> {do_unstage_selection;break}\n>  bind $ui_comm <$M1B-Key-U> {do_unstage_selection;break}\n> -bind $ui_comm <$M1B-Key-j> {do_revert_selection;break}\n> -bind $ui_comm <$M1B-Key-J> {do_revert_selection;break}\n> +bind $ui_comm <$M1B-Key-j> {mac_freeze_workaround do_revert_selection;break}\n> +bind $ui_comm <$M1B-Key-J> {mac_freeze_workaround do_revert_selection;break}\n>  bind $ui_comm <$M1B-Key-i> {do_add_all;break}\n>  bind $ui_comm <$M1B-Key-I> {do_add_all;break}\n>  bind $ui_comm <$M1B-Key-x> {tk_textCut %W;break}\n> @@ -3606,16 +3621,16 @@ bind $ui_diff <Control-Key-f> {catch {%W yview scroll  1 pages};break}\n>  bind $ui_diff <Button-1>   {focus %W}\n>  \n>  if {[is_enabled branch]} {\n> -   bind . <$M1B-Key-n> branch_create::dialog\n> -   bind . <$M1B-Key-N> branch_create::dialog\n> -   bind . <$M1B-Key-o> branch_checkout::dialog\n> -   bind . <$M1B-Key-O> branch_checkout::dialog\n> -   bind . <$M1B-Key-m> merge::dialog\n> -   bind . <$M1B-Key-M> merge::dialog\n> +   bind . <$M1B-Key-n> {mac_freeze_workaround branch_create::dialog}\n> +   bind . <$M1B-Key-N> {mac_freeze_workaround branch_create::dialog}\n> +   bind . <$M1B-Key-o> {mac_freeze_workaround branch_checkout::dialog}\n> +   bind . <$M1B-Key-O> {mac_freeze_workaround branch_checkout::dialog}\n> +   bind . <$M1B-Key-m> {mac_freeze_workaround merge::dialog}\n> +   bind . <$M1B-Key-M> {mac_freeze_workaround merge::dialog}\n>  }\n>  if {[is_enabled transport]} {\n> -   bind . <$M1B-Key-p> do_push_anywhere\n> -   bind . <$M1B-Key-P> do_push_anywhere\n> +   bind . <$M1B-Key-p> {mac_freeze_workaround do_push_anywhere}\n> +   bind . <$M1B-Key-P> {mac_freeze_workaround do_push_anywhere}\n>  }\n>  \n>  bind .   <Key-F5>     ui_do_rescan\n> @@ -3625,8 +3640,8 @@ bind .   <$M1B-Key-s> do_signoff\n>  bind .   <$M1B-Key-S> do_signoff\n>  bind .   <$M1B-Key-t> do_add_selection\n>  bind .   <$M1B-Key-T> do_add_selection\n> -bind .   <$M1B-Key-j> do_revert_selection\n> -bind .   <$M1B-Key-J> do_revert_selection\n> +bind .   <$M1B-Key-j> {mac_freeze_workaround do_revert_selection}\n> +bind .   <$M1B-Key-J> {mac_freeze_workaround do_revert_selection}\n>  bind .   <$M1B-Key-i> do_add_all\n>  bind .   <$M1B-Key-I> do_add_all\n>  bind .   <$M1B-Key-minus> {show_less_context;break}\n> -- \n> 1.7.3.4.g200b9\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"151348","messageId":"1jp9mb7.wvga2l1g48z3oM%lists@haller-berlin.de","threadId":"25009","inReplyTo":"7vocbpsivd.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-gui: Work around freeze problem with dialogs in Mac OS X","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2010-09-23T07:39:06Z","receivedAt":"2010-09-23T07:39:06Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n\n> lists@haller-berlin.de (Stefan Haller) writes:\n> \n> > Tk 8.5 on Mac OS X has a bug whereby a dialog opened from a key\n> > binding will hang; see issue 3044863 in the Tk issue tracker.\n> > <http://sourceforge.net/tracker/?func=detail&aid=3044863&group_id=12997&atid=112997>\n> >\n> > To work around this, we perform commands that open a dialog after\n> > a brief delay; 150 ms seems to be a good compromise between short\n> > enough as to be not annoying, and long enough to reliably work\n> > around the issue.\n> >\n> > Signed-off-by: Stefan Haller <stefan@haller-berlin.de>\n> \n> Is 150ms applicable no matter how fast or slow your Mac is, or is Mac so\n> monoculture that everybody's machine has more or less the same performance\n> characteristics?  IOW does this need to be autoadjusted?\n\nTo be honest, I don't know.  I was hoping that Daniel could shed some\nlight on whether this is dependent on the machine's performance, or why\nthe delay is needed at all (i.e. why a simple \"after idle\" won't do, as\none would have expected).\n\n> I see a lot of wrapping around foo::dialog; without knowing much about\n> Tcl, I wonder if it would be simpler, less error prone and more future\n> proof to add the wrapping logic around something commonly used from them,\n> e.g. class::make_dialog.\n\nI need to wrap the top-level entry points of the command handlers,\nbecause we want the delay only when the command is invoked from a key\nbinding, not when a menu item is selected with the mouse, or a button is\npushed.  Inside the functions, at the place where the dialog is created,\nI can't tell from where we were called.\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"}]}