win: fix ScreenWin::GetDisplayNearestPoint implementation
commite027f6829a0644ab140bef89125307db2b93dd29
authorscottmg <scottmg@chromium.org>
Wed, 4 Feb 2015 00:48:52 +0000 (3 16:48 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 4 Feb 2015 00:51:31 +0000 (4 00:51 +0000)
treea0c0d3b6b74293b752f021e29e53ca41a802ad2f
parent7ccf4fab5d4473e431f1a289056033eea0b3dd43
win: fix ScreenWin::GetDisplayNearestPoint implementation

MenuController::CalculateMenuBounds adjusts the location of popup menus
based on the monitor it thinks the menu is on. Because
MenuController::State is filled via GetDisplayNearestPoint when on
hidpi, on a second monitor to the right of the first monitor, this
would return the first monitor (because of lack of adjustment for dpi)
and so the menu would be incorrectly adjusted and shown on the first
monitor, instead of at the correct location. This does fix the popup
menu.

There are a non-zero number of other calls to GetDisplayNearestPoint.
Looking through the windows ones I don't see any horrible behaviour.
This also fixes, e.g. the wrench menu showing up at the wrong location.
The most suspicious looking is
https://code.google.com/p/chromium/codesearch#chromium/src/ui/views/corewm/tooltip_win.cc&l=122
but I cannot reproduce any problem with tooltips with this patch. And
all the tests pass, so I guess I'll try it and see how it goes.

R=sky@chromium.org,ananta@chromium.org
BUG=378945

Review URL: https://codereview.chromium.org/759853003

Cr-Commit-Position: refs/heads/master@{#314452}
ui/gfx/screen.h
ui/gfx/screen_win.cc