summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-06-26 17:15:48 (GMT)
committervincentdarley <vincentdarley>2003-06-26 17:15:48 (GMT)
commit4b647485572620a6bbe358c9d85ede6fbf62b4f4 (patch)
tree05b45dfc22dd07f8c6d7651c51f9907d44cf890f
parent5581cf0b7b7b8ca40b31c8bfadd7f3a64c7d6593 (diff)
downloadtk-4b647485572620a6bbe358c9d85ede6fbf62b4f4.zip
tk-4b647485572620a6bbe358c9d85ede6fbf62b4f4.tar.gz
tk-4b647485572620a6bbe358c9d85ede6fbf62b4f4.tar.bz2
Windows menu popup location fix
-rw-r--r--ChangeLog5
-rw-r--r--library/menu.tcl10
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 17d895f..d9a6cf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-26 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * library/menu.tcl: workaround problem on some Windows systems
+ by trying to avoid posting a menu offscreen.
+
2003-06-09 Joe English <jenglish@users.sourceforge.net>
* unix/tkUnixRFont.c: fix for [Bug#751553] "Xft:
[font configure] does not update in-use fonts".
diff --git a/library/menu.tcl b/library/menu.tcl
index 21dd22d..c291ce3 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 2002/08/31 06:12:28 das Exp $
+# RCS: @(#) $Id: menu.tcl,v 1.19 2003/06/26 17:15:48 vincentdarley Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -1186,9 +1186,13 @@ 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.
+ # 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