| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/tabs/window_finder.h" | 5 #include "chrome/browser/ui/views/tabs/window_finder.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/tabs/window_finder_mus.h" |
| 7 #include "ui/display/display.h" | 8 #include "ui/display/display.h" |
| 8 #include "ui/display/screen.h" | 9 #include "ui/display/screen.h" |
| 9 #include "ui/gfx/geometry/point_conversions.h" | 10 #include "ui/gfx/geometry/point_conversions.h" |
| 10 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" | 11 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 float GetDeviceScaleFactor() { | 15 float GetDeviceScaleFactor() { |
| 15 return display::Screen::GetScreen() | 16 return display::Screen::GetScreen() |
| 16 ->GetPrimaryDisplay() | 17 ->GetPrimaryDisplay() |
| 17 .device_scale_factor(); | 18 .device_scale_factor(); |
| 18 } | 19 } |
| 19 | 20 |
| 20 gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) { | 21 gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) { |
| 21 return gfx::ScaleToFlooredPoint(dip_point, GetDeviceScaleFactor()); | 22 return gfx::ScaleToFlooredPoint(dip_point, GetDeviceScaleFactor()); |
| 22 } | 23 } |
| 23 | 24 |
| 24 } // anonymous namespace | 25 } // anonymous namespace |
| 25 | 26 |
| 26 gfx::NativeWindow WindowFinder::GetLocalProcessWindowAtPoint( | 27 gfx::NativeWindow WindowFinder::GetLocalProcessWindowAtPoint( |
| 27 const gfx::Point& screen_point, | 28 const gfx::Point& screen_point, |
| 28 const std::set<gfx::NativeWindow>& ignore) { | 29 const std::set<gfx::NativeWindow>& ignore) { |
| 29 // The X11 server is the canonical state of what the window stacking order | 30 gfx::NativeWindow mus_result = nullptr; |
| 30 // is. | 31 if (GetLocalProcessWindowAtPointMus(screen_point, ignore, &mus_result)) |
| 32 return mus_result; |
| 33 |
| 34 // The X11 server is the canonical state of what the window stacking order is. |
| 31 views::X11TopmostWindowFinder finder; | 35 views::X11TopmostWindowFinder finder; |
| 32 return finder.FindLocalProcessWindowAt(DIPToPixelPoint(screen_point), ignore); | 36 return finder.FindLocalProcessWindowAt(DIPToPixelPoint(screen_point), ignore); |
| 33 } | 37 } |
| OLD | NEW |