summaryrefslogtreecommitdiffstats
path: root/library/tearoff.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/tearoff.tcl')
-rw-r--r--library/tearoff.tcl15
1 files changed, 13 insertions, 2 deletions
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index 297a203..6da2a0f 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -44,7 +44,8 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
}
set parent [winfo parent $w]
- while {[winfo toplevel $parent] ne $parent || [winfo class $parent] eq "Menu"} {
+ while {[winfo toplevel $parent] ne $parent \
+ || [winfo class $parent] eq "Menu"} {
set parent [winfo parent $parent]
}
if {$parent eq "."} {
@@ -67,7 +68,7 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
if {[$menu cget -title] ne ""} {
wm title $menu [$menu cget -title]
} else {
- switch [winfo class $parent] {
+ switch -- [winfo class $parent] {
Menubutton {
wm title $menu [$parent cget -text]
}
@@ -77,6 +78,16 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
}
}
+ if {[tk windowingsystem] eq "win32"} {
+ # [Bug 3181181]: Find the toplevel window for the menu
+ set parent [winfo toplevel $parent]
+ while {[winfo class $parent] eq "Menu"} {
+ set parent [winfo toplevel [winfo parent $parent]]
+ }
+ wm transient $menu [winfo toplevel $parent]
+ wm attributes $menu -toolwindow 1
+ }
+
$menu post $x $y
if {[winfo exists $menu] == 0} {