
# Misc bindings.

bind Menu <3> {
    if {$tk::Priv(postedMb) == ""} {
	%W unpost
    } else {
	tk_mbUnpost
    }
}

# This is also something random.

source $tk_library/button.tcl
tkButtonBind ""
bind Checkbutton <Enter> { catch {tk::ButtonEnter %W} }
bind Checkbutton <Leave> { catch {tk::ButtonLeave %W} }
bind Radiobutton <Enter> { catch {tk::ButtonEnter %W} }
bind Radiobutton <Leave> { catch {tk::ButtonLeave %W} }

# Stuff to re-enable the nice tear-off behavior.

source $tk_library/menu.tcl

bind Menubutton <2> {
    if {($tk::Priv(postedMb) == "") && \
	    ([lindex [%W config -state] 4] != "disabled")} {
	set tk::Priv(dragging) %W
	[lindex [$tk::Priv(dragging) config -menu] 4] post %X %Y
    }
}
bind Menubutton <B2-Motion> {
    if {$tk::Priv(dragging) != ""} {
	[lindex [$tk::Priv(dragging) config -menu] 4] post %X %Y
    }
}
bind Menubutton <ButtonRelease-2> {set tk::Priv(dragging) ""}

bind Menu <2> {set tk::Priv(x) %x; set tk::Priv(y) %y}
bind Menu <B2-Motion> {
    if {$tk::Priv(postedMb) == ""} {
	%W post [expr %X-$tk::Priv(x)] [expr %Y-$tk::Priv(y)]
    }
}
bind Menu <B2-Leave> { }
bind Menu <B2-Enter> { }
