diff options
author | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-05-04 22:05:25 (GMT) |
---|---|---|
committer | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-05-04 22:05:25 (GMT) |
commit | 700e3c5ab0a3f215c4f1c111cbfa500b45193727 (patch) | |
tree | 136a7848596946642fdacd26b1fe3410feeb6dd5 /library/menu.tcl | |
parent | b5d1bb79b551c33995dfbdad9a3bf7ef2b4644ab (diff) | |
download | tk-700e3c5ab0a3f215c4f1c111cbfa500b45193727.zip tk-700e3c5ab0a3f215c4f1c111cbfa500b45193727.tar.gz tk-700e3c5ab0a3f215c4f1c111cbfa500b45193727.tar.bz2 |
[Bug 2768586]: Menu posting problem on dual monitors
Diffstat (limited to 'library/menu.tcl')
-rw-r--r-- | library/menu.tcl | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/library/menu.tcl b/library/menu.tcl index ed8182e..ff62484 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -284,8 +284,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 } @@ -294,8 +294,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 } @@ -1196,16 +1196,15 @@ proc ::tk::PostOverPoint {menu x y {entry {}}} { # entry. To be safe we subtract an extra 10. 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] } } $menu post $x $y |