summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2005-12-01 17:47:13 (GMT)
committerhobbs <hobbs@noemail.net>2005-12-01 17:47:13 (GMT)
commit347f1796ebbcb8c7a7a67f0a3c363af16bd04546 (patch)
tree96bcf6ee65527735cd004998be94784c8ce961e5
parente203970ee18500e31d543c35bb26ee896fe57bec (diff)
downloadtk-347f1796ebbcb8c7a7a67f0a3c363af16bd04546.zip
tk-347f1796ebbcb8c7a7a67f0a3c363af16bd04546.tar.gz
tk-347f1796ebbcb8c7a7a67f0a3c363af16bd04546.tar.bz2
* library/menu.tcl (::tk::PostOverPoint): correct menu post near
bottom of screen on Windows. [Bug 1353416] FossilOrigin-Name: b1d56c24d70afe63c1439642edee649aa7807bad
-rw-r--r--ChangeLog5
-rw-r--r--library/menu.tcl16
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 <jeffh@ActiveState.com>
+
+ * library/menu.tcl (::tk::PostOverPoint): correct menu post near
+ bottom of screen on Windows. [Bug 1353416]
+
2005-12-01 Daniel Steffen <das@users.sourceforge.net>
* 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