| Index: ui/views/widget/desktop_aura/desktop_screen_x11.cc
|
| diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
|
| index ed8a0f4844cd7f002c6d1c492eff05575ebedf81..6221250b33cd47bca182564da446418db422b543 100644
|
| --- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc
|
| +++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
|
| @@ -45,6 +45,19 @@ float GetDeviceScaleFactor(int screen_pixels, int screen_mm) {
|
| return ui::GetScaleForScaleFactor(ui::GetSupportedScaleFactor(scale));
|
| }
|
|
|
| +float GetDeviceScaleFactor() {
|
| + gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
|
| + return display.device_scale_factor();
|
| +}
|
| +
|
| +gfx::Point PixelToDIPPoint(const gfx::Point& pixel_point) {
|
| + return ToFlooredPoint(ScalePoint(pixel_point, 1.0f / GetDeviceScaleFactor()));
|
| +}
|
| +
|
| +gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) {
|
| + return ToFlooredPoint(gfx::ScalePoint(dip_point, GetDeviceScaleFactor()));
|
| +}
|
| +
|
| std::vector<gfx::Display> GetFallbackDisplayList() {
|
| ::XDisplay* display = gfx::GetXDisplay();
|
| ::Screen* screen = DefaultScreenOfDisplay(display);
|
| @@ -130,7 +143,7 @@ gfx::Point DesktopScreenX11::GetCursorScreenPoint() {
|
| &win_y,
|
| &mask);
|
|
|
| - return gfx::Point(root_x, root_y);
|
| + return PixelToDIPPoint(gfx::Point(root_x, root_y));
|
| }
|
|
|
| gfx::NativeWindow DesktopScreenX11::GetWindowUnderCursor() {
|
| @@ -177,10 +190,11 @@ gfx::Display DesktopScreenX11::GetDisplayNearestWindow(
|
| }
|
|
|
| gfx::Display DesktopScreenX11::GetDisplayNearestPoint(
|
| - const gfx::Point& point) const {
|
| + const gfx::Point& requested_point) const {
|
| + const gfx::Point point_in_pixel = DIPToPixelPoint(requested_point);
|
| for (std::vector<gfx::Display>::const_iterator it = displays_.begin();
|
| it != displays_.end(); ++it) {
|
| - if (it->bounds().Contains(point))
|
| + if (it->bounds().Contains(point_in_pixel))
|
| return *it;
|
| }
|
|
|
|
|