From 7fe27ac7f2cb90019410f61ca31aab8e9cf7b862 Mon Sep 17 00:00:00 2001 From: hobbs Date: Thu, 1 Dec 2005 17:47:13 +0000 Subject: * library/menu.tcl (::tk::PostOverPoint): correct menu post near bottom of screen on Windows. [Bug 1353416] --- ChangeLog | 5 +++++ library/menu.tcl | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96c03b9..97e6656 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-12-01 Jeff Hobbs + + * library/menu.tcl (::tk::PostOverPoint): correct menu post near + bottom of screen on Windows. [Bug 1353416] + 2005-12-01 Daniel Steffen * unix/tcl.m4 (Darwin): fixed error when MACOSX_DEPLOYMENT_TARGET unset diff --git a/library/menu.tcl b/library/menu.tcl index 5a59c87..021e891 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.18.2.2 2005/05/27 18:00:59 tmh Exp $ +# RCS: @(#) $Id: menu.tcl,v 1.18.2.3 2005/12/01 17:47:14 hobbs Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -1187,7 +1187,7 @@ proc ::tk::MenuFindName {menu s} { proc ::tk::PostOverPoint {menu x y {entry {}}} { global tcl_platform - if {[string compare $entry {}]} { + if {$entry ne ""} { if {$entry == [$menu index last]} { incr y [expr {-([$menu yposition $entry] \ + [winfo reqheight $menu])/2}] @@ -1197,10 +1197,14 @@ proc ::tk::PostOverPoint {menu x y {entry {}}} { } incr x [expr {-[winfo reqwidth $menu]/2}] } - if {$tcl_platform(platform) == "windows"} { - # We need to fix some problems with menu posting on Windows. + if {$tcl_platform(platform) eq "windows"} { + # We need to fix some problems with menu posting on Windows, + # where, if the menu would overlap top or bottom of screen, + # Windows puts it in the wrong place for us. We must also + # subtract an extra amount for half the height of the current + # entry. To be safe we subtract an extra 10. set yoffset [expr {[winfo screenheight $menu] \ - - $y - [winfo reqheight $menu]}] + - $y - [winfo reqheight $menu] - 10}] if {$yoffset < 0} { # The bottom of the menu is offscreen, so adjust upwards incr y $yoffset @@ -1265,7 +1269,7 @@ proc ::tk_menuSetFocus {menu} { } focus $menu } - + proc ::tk::GenerateMenuSelect {menu} { variable ::tk::Priv -- cgit v0.12