From 179943ecfae06f26341c53dd0da7cc2ea79c33de Mon Sep 17 00:00:00 2001 From: stanton Date: Fri, 7 May 1999 20:05:40 +0000 Subject: * library/menu.tcl: Fixed bug where tk_popup fails when called too quickly. [Bug: 2009] --- library/menu.tcl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/library/menu.tcl b/library/menu.tcl index 538e330..177de2b 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -4,7 +4,7 @@ # It also implements keyboard traversal of menus and implements a few # other utility procedures related to menus. # -# RCS: @(#) $Id: menu.tcl,v 1.5 1999/04/16 01:51:26 stanton Exp $ +# RCS: @(#) $Id: menu.tcl,v 1.6 1999/05/07 20:05:40 stanton Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -555,6 +555,10 @@ proc tkMenuMotion {menu x y state} { proc tkMenuButtonDown menu { global tkPriv global tcl_platform + + if {![winfo viewable $menu]} { + return + } $menu postcascade active if {[string compare $tkPriv(postedMb) ""]} { grab -global $tkPriv(postedMb) @@ -1242,8 +1246,9 @@ proc tk_popup {menu x y {entry {}}} { tkMenuUnpost {} } tkPostOverPoint $menu $x $y $entry - if {![string compare $tcl_platform(platform) "unix"]} { - tkSaveGrabInfo $menu + if {![string compare $tcl_platform(platform) "unix"] \ + && [winfo viewable $menu]} { + tkSaveGrabInfo $menu grab -global $menu set tkPriv(popup) $menu tk_menuSetFocus $menu -- cgit v0.12