{"thread":{"id":"7425","subject":"[PATCH 2/4] Fix drop-down menus in the git-gui dialogs.","startedAt":"2007-03-27T10:30:05Z","lastAt":"2007-04-06T07:42:42Z","messageCount":5,"participants":["Eygene Ryabinkin","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"38130","messageId":"20070327103005.GP14837@codelabs.ru","threadId":"7425","inReplyTo":null,"subject":"[PATCH 2/4] Fix drop-down menus in the git-gui dialogs.","fromName":"Eygene Ryabinkin","fromEmail":"rea-git@codelabs.ru","sentAt":"2007-03-27T10:30:05Z","receivedAt":"2007-03-27T10:30:05Z","isPatch":true,"sender":{"key":"rea-git@codelabs.ru","avatar":null},"body":"If the drop-down menu (for example \"Local Branch\" from the dialog\nactivated by the \"Branch/Create...\" menu item) is chosen with the\nleft mouse button, then the pointer is moved off the drop-down menu\nwhile the mouse button is still pressed and then the 'Escape' key\nis pressed, the main menu will be broken. Next time when you will\ntry to select any main menu item, the Tcl/Tk interpreter will spawn\nan internal error.\n\nError was fixed by \"grab\"bing the drop-down menu windows on their\nactivation. Now all drop-down menus are disappearing once the mouse\nbutton is depressed, no matter what is the current position of the\nmouse pointer.\n\nSigned-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>\n---\n git-gui/git-gui.sh |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 8157184..1f3ee05 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -2126,6 +2126,7 @@ proc do_create_branch {} {\n \t\t-font font_ui\n \tset lbranchm [eval tk_optionMenu $w.from.head_m create_branch_head \\\n \t\t$all_heads]\n+\tbind $lbranchm <Visibility> \"grab $lbranchm\"\n \t$lbranchm configure -font font_ui\n \t$w.from.head_m configure -font font_ui\n \tgrid $w.from.head_r $w.from.head_m -sticky w\n@@ -2140,6 +2141,7 @@ proc do_create_branch {} {\n \t\tset tbranchm [eval tk_optionMenu $w.from.tracking_m \\\n \t\t\tcreate_branch_trackinghead \\\n \t\t\t$all_trackings]\n+\t\tbind $tbranchm <Visibility> \"grab $tbranchm\"\n \t\t$tbranchm configure -font font_ui\n \t\t$w.from.tracking_m configure -font font_ui\n \t\tgrid $w.from.tracking_r $w.from.tracking_m -sticky w\n@@ -2155,6 +2157,7 @@ proc do_create_branch {} {\n \t\tset tagsm [eval tk_optionMenu $w.from.tag_m \\\n \t\t\tcreate_branch_tag \\\n \t\t\t$all_tags]\n+\t\tbind $tagsm <Visibility> \"grab $tagsm\"\n \t\t$tagsm configure -font font_ui\n \t\t$w.from.tag_m configure -font font_ui\n \t\tgrid $w.from.tag_r $w.from.tag_m -sticky w\n@@ -2353,6 +2356,7 @@ proc do_delete_branch {} {\n \tset mergedlocalm [eval tk_optionMenu $w.validate.head_m \\\n \t\tdelete_branch_head \\\n \t\t$all_heads]\n+\tbind $mergedlocalm <Visibility> \"grab $mergedlocalm\"\n \t$mergedlocalm configure -font font_ui\n \t$w.validate.head_m configure -font font_ui\n \tgrid $w.validate.head_r $w.validate.head_m -sticky w\n@@ -2367,6 +2371,7 @@ proc do_delete_branch {} {\n \t\tset mergedtrackm [eval tk_optionMenu $w.validate.tracking_m \\\n \t\t\tdelete_branch_trackinghead \\\n \t\t\t$all_trackings]\n+\t\tbind $mergedtrackm <Visibility> \"grab $mergedtrackm\"\n \t\t$mergedtrackm configure -font font_ui\n \t\t$w.validate.tracking_m configure -font font_ui\n \t\tgrid $w.validate.tracking_r $w.validate.tracking_m -sticky w\n@@ -2744,6 +2749,7 @@ proc do_push_anywhere {} {\n \t\t\t-font font_ui\n \t\tset remmenu [eval tk_optionMenu $w.dest.remote_m push_remote \\\n \t\t\t$all_remotes]\n+\t\tbind $remmenu <Visibility> \"grab $remmenu\"\n \t\t$remmenu configure -font font_ui\n \t\t$w.dest.remote_m configure -font font_ui\n \t\tgrid $w.dest.remote_r $w.dest.remote_m -sticky w\n@@ -4713,6 +4719,7 @@ proc do_options {} {\n \t\tset fontmenu [eval tk_optionMenu $w.global.$name.family \\\n \t\t\tglobal_config_new(gui.$font^^family) \\\n \t\t\t$all_fonts]\n+\t\tbind $fontmenu <Visibility> \"grab $fontmenu\"\n \t\t$w.global.$name.family configure -font font_ui\n \t\t$fontmenu configure -font font_ui\n \t\tspinbox $w.global.$name.size \\\n-- \n1.5.0.3-dirty\n"},{"id":"38632","messageId":"20070404163709.GA5167@spearce.org","threadId":"7425","inReplyTo":"20070327103005.GP14837@codelabs.ru","subject":"Re: [PATCH 2/4] Fix drop-down menus in the git-gui dialogs.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-04-04T16:37:09Z","receivedAt":"2007-04-04T16:37:09Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"git-gui patches should be addressed to me, not Paul.\n\nEygene Ryabinkin <rea-git@codelabs.ru> wrote:\n> If the drop-down menu (for example \"Local Branch\" from the dialog\n> activated by the \"Branch/Create...\" menu item) is chosen with the\n> left mouse button, then the pointer is moved off the drop-down menu\n> while the mouse button is still pressed and then the 'Escape' key\n> is pressed, the main menu will be broken. Next time when you will\n> try to select any main menu item, the Tcl/Tk interpreter will spawn\n> an internal error.\n> \n> Error was fixed by \"grab\"bing the drop-down menu windows on their\n> activation. Now all drop-down menus are disappearing once the mouse\n> button is depressed, no matter what is the current position of the\n> mouse pointer.\n\nThis fix actually horribly breaks on Mac OS X.  The problem\nappears to be that the <Visibility> event on that system doesn't\nget delivered until after the menu is destroyed, yet I'm getting\na %s of VisibilityUnobscured in the event handler.  Go figure.\n\nSo anyway, I cannot apply this patch as-is, because it breaks\nmy main development system.  I understand and feel your pain,\nbut you either need to make this binding apply only on your OS,\nor find another way to workaround that Tk bug...\n\n> diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\n> index 8157184..1f3ee05 100755\n> --- a/git-gui/git-gui.sh\n> +++ b/git-gui/git-gui.sh\n> @@ -2126,6 +2126,7 @@ proc do_create_branch {} {\n>  \t\t-font font_ui\n>  \tset lbranchm [eval tk_optionMenu $w.from.head_m create_branch_head \\\n>  \t\t$all_heads]\n> +\tbind $lbranchm <Visibility> \"grab $lbranchm\"\n>  \t$lbranchm configure -font font_ui\n>  \t$w.from.head_m configure -font font_ui\n>  \tgrid $w.from.head_r $w.from.head_m -sticky w\n\n-- \nShawn.\n"},{"id":"38699","messageId":"20070405124920.GV26348@codelabs.ru","threadId":"7425","inReplyTo":"20070404163709.GA5167@spearce.org","subject":"Re: [PATCH 2/4] Fix drop-down menus in the git-gui dialogs.","fromName":"Eygene Ryabinkin","fromEmail":"rea-git@codelabs.ru","sentAt":"2007-04-05T12:49:20Z","receivedAt":"2007-04-05T12:49:20Z","isPatch":true,"sender":{"key":"rea-git@codelabs.ru","avatar":null},"body":"Shawn, good day.\n\nWed, Apr 04, 2007 at 12:37:09PM -0400, Shawn O. Pearce wrote:\n> git-gui patches should be addressed to me, not Paul.\n\nYep, I just messed with the mail addresses, since I was doing patches\nboth for gitk and git-gui. Sorry for it!\n\n> > Error was fixed by \"grab\"bing the drop-down menu windows on their\n> > activation. Now all drop-down menus are disappearing once the mouse\n> > button is depressed, no matter what is the current position of the\n> > mouse pointer.\n> \n> This fix actually horribly breaks on Mac OS X.  The problem\n> appears to be that the <Visibility> event on that system doesn't\n> get delivered until after the menu is destroyed, yet I'm getting\n> a %s of VisibilityUnobscured in the event handler.  Go figure.\n>\n> So anyway, I cannot apply this patch as-is, because it breaks\n> my main development system.  I understand and feel your pain,\n> but you either need to make this binding apply only on your OS,\n> or find another way to workaround that Tk bug...\n\nOK, I will try to find the other workaround, but I have no Mac OS\nX at hand (they are a bit expensive to me), so I hope you will find\nsome time to test the new approaches, if I will come up with any.\n\nThank you!\n-- \nEygene\n"},{"id":"38712","messageId":"20070405153226.GH5436@spearce.org","threadId":"7425","inReplyTo":"20070405124920.GV26348@codelabs.ru","subject":"Re: [PATCH 2/4] Fix drop-down menus in the git-gui dialogs.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-04-05T15:32:26Z","receivedAt":"2007-04-05T15:32:26Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Eygene Ryabinkin <rea-git@codelabs.ru> wrote:\n> Wed, Apr 04, 2007 at 12:37:09PM -0400, Shawn O. Pearce wrote:\n> > git-gui patches should be addressed to me, not Paul.\n> \n> Yep, I just messed with the mail addresses, since I was doing patches\n> both for gitk and git-gui. Sorry for it!\n\nNot a problem, I just wanted to make sure you were aware that they\nshould come to me, so that you can leave poor paulus' inbox alone.\n;-)\n \n> > So anyway, I cannot apply this patch as-is, because it breaks\n> > my main development system.  I understand and feel your pain,\n> > but you either need to make this binding apply only on your OS,\n> > or find another way to workaround that Tk bug...\n> \n> OK, I will try to find the other workaround, but I have no Mac OS\n> X at hand (they are a bit expensive to me), so I hope you will find\n> some time to test the new approaches, if I will come up with any.\n\nThat's fine.  I'd be happy to retest something.  If I understood your\nproblem description right, this bug doesn't appear on either Cygwin's\nTcl/Tk implementation or my Mac OS X implementation.  Maybe this\nis one of those things that we just have to do conditionally per OS.\n\nIf that's the case, maybe we should also consider making our own\nlocal variant of tk_optionMenu (a wrapper of sorts) that sets our\nfont_ui, and does this grab fix on your platform.\n\n-- \nShawn.\n"},{"id":"38783","messageId":"20070406074242.GC1458@twilight.grid.kiae.ru","threadId":"7425","inReplyTo":"20070405153226.GH5436@spearce.org","subject":"Re: [PATCH 2/4] Fix drop-down menus in the git-gui dialogs.","fromName":"Eygene Ryabinkin","fromEmail":"rea-git@codelabs.ru","sentAt":"2007-04-06T07:42:42Z","receivedAt":"2007-04-06T07:42:42Z","isPatch":true,"sender":{"key":"rea-git@codelabs.ru","avatar":null},"body":"Shawn, good day.\n\nThu, Apr 05, 2007 at 11:32:26AM -0400, Shawn O. Pearce wrote:\n> > OK, I will try to find the other workaround, but I have no Mac OS\n> > X at hand (they are a bit expensive to me), so I hope you will find\n> > some time to test the new approaches, if I will come up with any.\n> \n> That's fine.  I'd be happy to retest something.  If I understood your\n> problem description right, this bug doesn't appear on either Cygwin's\n> Tcl/Tk implementation or my Mac OS X implementation.  Maybe this\n> is one of those things that we just have to do conditionally per OS.\n\nI was not tested this under Cygwin. But the wrong list behaviour I\ngot is appearing only in dialogs. I am not getting this in the gitk:\nthere are many drop-down menus in the main window. All of them are\ndisappearing once I depress the mouse button no matter where the\ncursor is. So this issue can be dialog-specific, but I believe that\nthe main window and dialog windows are handled by Tcl/Tk on the\nsame footing. Thought, I do not 100% sure.\n\n> If that's the case, maybe we should also consider making our own\n> local variant of tk_optionMenu (a wrapper of sorts) that sets our\n> font_ui, and does this grab fix on your platform.\n\nI think this would be the last hope. I will try to understand the\nproblem a bit deeper first.\n\nThank you!\n-- \nEygene\n"}]}