Tk Source Code

Artifact [379eebee]
Login

Artifact 379eebee392330f96854e00b0b26227756240d765009d02d95f827bb5f16db35:

Attachment "combobox.patch" to ticket [1600dc73] added by bll 2020-10-11 15:27:43.
--- a/library/ttk/combobox.tcl	2020-10-07 21:58:30.813732175 -0700
+++ b/library/ttk/combobox.tcl	2020-10-11 08:23:58.568891110 -0700
@@ -285,6 +285,14 @@
     return $cb.popdown
 }
 
+proc ::ttk::combobox::checkVisibility { currw cw visState } {
+  if { $currw eq $cw &&
+      ($visState eq "VisibilityPartiallyObscured" ||
+       $visState eq "VisibilityFullyObscured") } {
+    ::ttk::combobox::Unpost $cw
+  }
+}
+
 ## PopdownToplevel -- Create toplevel window for the combobox popdown
 #
 #	See also <<NOTE-WM-TRANSIENT>>
@@ -295,6 +303,9 @@
     switch -- [tk windowingsystem] {
 	default -
 	x11 {
+            set cw [winfo parent $w] 
+            bind $cw <Visibility> \
+                [list ::ttk::combobox::checkVisibility %W $cw %s]
 	    $w configure -relief flat -borderwidth 0
 	    wm attributes $w -type combo
 	    wm overrideredirect $w true