#2622 Menu posting problem on dual monitors

closed-fixed
Jan Nijtmans
5
2012-05-11
2009-04-16
Koen Danckaert
No

This bug happens on Windows in dual monitor mode, when the second monitor is placed above the primary monitor. Note that this means that the second monitor has negative y coordinates.
When posting a menu on the second monitor (either from a menubutton or directly with tk_popup), the menu is actually displayed on the primary monitor.

The reason can be found in the procedures ::tk::MbPost and ::tk::PostOverPoint. These contains checks like:

if {$y < 0} {
set y 0
}

Which makes it impossible to post menus at negative y coordinates.

Discussion

  • Tim Davis
    Tim Davis
    2009-10-30

    I just ran into this problem as well. Is there a work around? I put a large monitor, connected to my docking station, above my laptop display. I suspect this is a common arrangement (based on walking around cubes) so whoever deploys Tk apps to work across multiple monitors will get dinged for this bug.

     
  • Koen Danckaert
    Koen Danckaert
    2009-11-02

    I've a workaround (see attached file) which works by always posting the menu at the mouse pointer. Note that this means that "-direction flush" for option-menus does not work as intended anymore. But at least the menu gets posted on the right monitor!
    For a real fix, we need to know the available coordinate space, and apparently there is no API in Tk for doing that.

     
  • Koen Danckaert
    Koen Danckaert
    2009-11-02

     
    Attachments
  • Tim Davis
    Tim Davis
    2009-11-03

    Can't Tk assume that if the upper left corner of the application window "." is in negative coordinates that the menus can be in negative coordinates? Also, don't post the menu any higher then the top edge of the "." window as a workaround to the lack of coordinate space API.

     
  • Pat Thoyts
    Pat Thoyts
    2009-12-05

    • assigned_to: tmh --> patthoyts
     
  • Pat Thoyts
    Pat Thoyts
    2009-12-05

    I thought I'd fixed all the multiple-monitor placement issues years ago with fixes to tk::PlaceWindow. Evidently this got missed. I'll look into this from work where I've a dual monitor setup.
    Wrt to finding the coord space - post any suggestions. If you are running into this then you at least have some idea of the usage for such a feature. As I've never run into this as a problem I'm in a worse position to design the feature. There is an (ancient) bug raised about finding out about multiple monitors but the developer for that area is clearly not going to work it so anyone with an interest needs to get involved.

     
  • Jan Nijtmans
    Jan Nijtmans
    2012-04-13

    • assigned_to: patthoyts --> nijtmans
     
  • Jan Nijtmans
    Jan Nijtmans
    2012-05-04

    • status: open --> pending-fixed
     
  • Jan Nijtmans
    Jan Nijtmans
    2012-05-04

    Fix committed to core-8-4-branc, core-8-5-branch and trunk.

    [Bug 533519] was essentially the same as this bug,
    only [Bug 533519] was about window placement while
    this one is about menu placement.

    > For a real fix, we need to know the available
    > coordinate space, and apparently there is
    > no API in Tk for doing that.
    Yes, there was an API for that, but it
    didn't report the right coordinates. So
    Koen (or anyone else), please confirm
    that this really fixes your bug. If not,
    then report it here.

     
  • Koen Danckaert
    Koen Danckaert
    2012-05-11

    Sorry, it took me some time to find a setup to reproduce this again.
    But I can confirm it is fixed now.
    Thanks!

     
  • Koen Danckaert
    Koen Danckaert
    2012-05-11

    • status: pending-fixed --> closed-fixed