git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] Fix drop-down menus in the git-gui dialogs.

From
EREygene Ryabinkin <rea-git@codelabs.ru>
Date
Mar 27, 2007, 10:30 UTC
Message-ID
<20070327103005.GP14837@codelabs.ru>

If the drop-down menu (for example "Local Branch" from the dialog activated by the "Branch/Create..." menu item) is chosen with the left mouse button, then the pointer is moved off the drop-down menu while the mouse button is still pressed and then the 'Escape' key is pressed, the main menu will be broken. Next time when you will try to select any main menu item, the Tcl/Tk interpreter will spawn an internal error.

Error was fixed by "grab"bing the drop-down menu windows on their activation. Now all drop-down menus are disappearing once the mouse button is depressed, no matter what is the current position of the mouse pointer.

Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
---
 git-gui/git-gui.sh |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 8157184..1f3ee05 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -2126,6 +2126,7 @@ proc do_create_branch {} {
 		-font font_ui
 	set lbranchm [eval tk_optionMenu $w.from.head_m create_branch_head \
 		$all_heads]
+	bind $lbranchm <Visibility> "grab $lbranchm"
 	$lbranchm configure -font font_ui
 	$w.from.head_m configure -font font_ui
 	grid $w.from.head_r $w.from.head_m -sticky w
@@ -2140,6 +2141,7 @@ proc do_create_branch {} {
 		set tbranchm [eval tk_optionMenu $w.from.tracking_m \
 			create_branch_trackinghead \
 			$all_trackings]
+		bind $tbranchm <Visibility> "grab $tbranchm"
 		$tbranchm configure -font font_ui
 		$w.from.tracking_m configure -font font_ui
 		grid $w.from.tracking_r $w.from.tracking_m -sticky w
@@ -2155,6 +2157,7 @@ proc do_create_branch {} {
 		set tagsm [eval tk_optionMenu $w.from.tag_m \
 			create_branch_tag \
 			$all_tags]
+		bind $tagsm <Visibility> "grab $tagsm"
 		$tagsm configure -font font_ui
 		$w.from.tag_m configure -font font_ui
 		grid $w.from.tag_r $w.from.tag_m -sticky w
@@ -2353,6 +2356,7 @@ proc do_delete_branch {} {
 	set mergedlocalm [eval tk_optionMenu $w.validate.head_m \
 		delete_branch_head \
 		$all_heads]
+	bind $mergedlocalm <Visibility> "grab $mergedlocalm"
 	$mergedlocalm configure -font font_ui
 	$w.validate.head_m configure -font font_ui
 	grid $w.validate.head_r $w.validate.head_m -sticky w
@@ -2367,6 +2371,7 @@ proc do_delete_branch {} {
 		set mergedtrackm [eval tk_optionMenu $w.validate.tracking_m \
 			delete_branch_trackinghead \
 			$all_trackings]
+		bind $mergedtrackm <Visibility> "grab $mergedtrackm"
 		$mergedtrackm configure -font font_ui
 		$w.validate.tracking_m configure -font font_ui
 		grid $w.validate.tracking_r $w.validate.tracking_m -sticky w
@@ -2744,6 +2749,7 @@ proc do_push_anywhere {} {
 			-font font_ui
 		set remmenu [eval tk_optionMenu $w.dest.remote_m push_remote \
 			$all_remotes]
+		bind $remmenu <Visibility> "grab $remmenu"
 		$remmenu configure -font font_ui
 		$w.dest.remote_m configure -font font_ui
 		grid $w.dest.remote_r $w.dest.remote_m -sticky w
@@ -4713,6 +4719,7 @@ proc do_options {} {
 		set fontmenu [eval tk_optionMenu $w.global.$name.family \
 			global_config_new(gui.$font^^family) \
 			$all_fonts]
+		bind $fontmenu <Visibility> "grab $fontmenu"
 		$w.global.$name.family configure -font font_ui
 		$fontmenu configure -font font_ui
 		spinbox $w.global.$name.size \
-- 
1.5.0.3-dirty
Next: Shawn O. Pearce
Message 1 of 5 in “Fix drop-down menus in the git-gui dialogs.”
  1. 2/4 Fix drop-down menus in the git-gui dialogs.Eygene Ryabinkin, Mar 27, 2007
  2. Shawn O. PearceApr 4, 2007
  3. Eygene RyabinkinApr 5, 2007
  4. Shawn O. PearceApr 5, 2007
  5. Eygene RyabinkinApr 6, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.