From 39c126914b4b7365251f32d34926506c229f090e Mon Sep 17 00:00:00 2001
From: Paul Mackerras <paulus@samba.org>
Date: Sat, 11 May 2013 17:08:41 +1000
Subject: [PATCH] gitk: Improve behaviour of drop-down lists

The drop-down lists used for things like the criteria for finding
commits (containing/touching paths/etc.) use a combobox if we are
using the ttk widgets.  By default the combobox exports its value
as the selection when it is changed, which is unnecessary, and sometimes
the combobox wouldn't release the selection, which is annoying.

To fix this, we make these comboboxes not export their selection,
and also clear their selection whenever they are changed.  This makes
them more like a simple selection of alternatives, improving the look
and feel of gitk.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 gitk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gitk b/gitk
index 572f73f1181..5ba2ce6ebcb 100755
--- a/gitk
+++ b/gitk
@@ -1998,6 +1998,9 @@ proc mca {str} {
     return [string map {&& & & {}} [mc $str]]
 }
 
+proc cleardropsel {w} {
+    $w selection clear
+}
 proc makedroplist {w varname args} {
     global use_ttk
     if {$use_ttk} {
@@ -2007,7 +2010,9 @@ proc makedroplist {w varname args} {
             if {$cx > $width} {set width $cx}
         }
 	set gm [ttk::combobox $w -width $width -state readonly\
-		    -textvariable $varname -values $args]
+		    -textvariable $varname -values $args \
+		    -exportselection false]
+	bind $gm <<ComboboxSelected>> [list $gm selection clear]
     } else {
 	set gm [eval [linsert $args 0 tk_optionMenu $w $varname]]
     }