summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <jan.nijtmans@noemail.net>2012-05-04 22:18:56 (GMT)
committerjan.nijtmans <jan.nijtmans@noemail.net>2012-05-04 22:18:56 (GMT)
commit8ff16ce66d713b96ac834fffb2591154c4571dc7 (patch)
tree406d8c0393b643f248a743b868ba345f4a31882c /library
parent57dd6efbf33acc2d9d65941440fff94b9b1ef954 (diff)
parenta5a32395beef3791573a62161824005c9c9d1d6f (diff)
downloadtk-8ff16ce66d713b96ac834fffb2591154c4571dc7.zip
tk-8ff16ce66d713b96ac834fffb2591154c4571dc7.tar.gz
tk-8ff16ce66d713b96ac834fffb2591154c4571dc7.tar.bz2
[Bug 2768586]: Menu posting problem on dual monitors
FossilOrigin-Name: bb23398c9a5b9a03e68c60e253ea02d4ffae8c4a
Diffstat (limited to 'library')
-rw-r--r--library/menu.tcl17
1 files changed, 8 insertions, 9 deletions
diff --git a/library/menu.tcl b/library/menu.tcl
index e00dad9..8337eae 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -286,8 +286,8 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
set x [winfo rootx $w]
set y [expr {[winfo rooty $w] - [winfo reqheight $menu]}]
# if we go offscreen to the top, show as 'below'
- if {$y < 0} {
- set y [expr {[winfo rooty $w] + [winfo height $w]}]
+ if {$y < [winfo vrooty $w]} {
+ set y [expr {[winfo vrooty $w] + [winfo rooty $w] + [winfo reqheight $w]}]
}
PostOverPoint $menu $x $y
}
@@ -296,8 +296,8 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
set y [expr {[winfo rooty $w] + [winfo height $w]}]
# if we go offscreen to the bottom, show as 'above'
set mh [winfo reqheight $menu]
- if {($y + $mh) > [winfo screenheight $w]} {
- set y [expr {[winfo rooty $w] - $mh}]
+ if {($y + $mh) > ([winfo vrooty $w] + [winfo vrootheight $w])} {
+ set y [expr {[winfo vrooty $w] + [winfo vrootheight $w] + [winfo rooty $w] - $mh}]
}
PostOverPoint $menu $x $y
}
@@ -1240,16 +1240,15 @@ proc ::tk::PostOverPoint {menu x y {entry {}}} {
if {$ver < 6} {
set yoffset [expr {[winfo screenheight $menu] \
- $y - [winfo reqheight $menu] - 10}]
- if {$yoffset < 0} {
+ if {$yoffset < [winfo vrooty $menu]} {
# The bottom of the menu is offscreen, so adjust upwards
- incr y $yoffset
- if {$y < 0} { set y 0 }
+ incr y [expr {$yoffset - [winfo vrooty $menu]}]
}
# If we're off the top of the screen (either because we were
# originally or because we just adjusted too far upwards),
# then make the menu popup on the top edge.
- if {$y < 0} {
- set y 0
+ if {$y < [winfo vrooty $menu]} {
+ set y [winfo vrooty $menu]
}
}
}