| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // This has to be before any other includes, else default is picked up. | 5 // This has to be before any other includes, else default is picked up. |
| 6 // See base/logging for details on this. | 6 // See base/logging for details on this. |
| 7 #define NOTIMPLEMENTED_POLICY 5 | 7 #define NOTIMPLEMENTED_POLICY 5 |
| 8 | 8 |
| 9 #include "ui/views/mus/screen_mus.h" | 9 #include "ui/views/mus/screen_mus.h" |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 return delegate_->GetCursorScreenPoint(); | 76 return delegate_->GetCursorScreenPoint(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool ScreenMus::IsWindowUnderCursor(gfx::NativeWindow window) { | 79 bool ScreenMus::IsWindowUnderCursor(gfx::NativeWindow window) { |
| 80 return window && window->IsVisible() && | 80 return window && window->IsVisible() && |
| 81 window->GetBoundsInScreen().Contains(GetCursorScreenPoint()); | 81 window->GetBoundsInScreen().Contains(GetCursorScreenPoint()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 gfx::NativeWindow ScreenMus::GetWindowAtScreenPoint(const gfx::Point& point) { | 84 aura::Window* ScreenMus::GetWindowAtScreenPoint(const gfx::Point& point) { |
| 85 aura::Window* aura_window = nullptr; | 85 return delegate_->GetWindowAtScreenPoint(point); |
| 86 ui::Window* ui_window = delegate_->GetWindowAtScreenPoint(point); | |
| 87 if (ui_window) { | |
| 88 NativeWidgetMus* nw_mus = NativeWidgetMus::GetForWindow(ui_window); | |
| 89 if (nw_mus) { | |
| 90 aura_window = | |
| 91 static_cast<internal::NativeWidgetPrivate*>(nw_mus)->GetNativeView(); | |
| 92 } | |
| 93 } | |
| 94 return aura_window; | |
| 95 } | 86 } |
| 96 | 87 |
| 97 void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays, | 88 void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays, |
| 98 int64_t primary_display_id, | 89 int64_t primary_display_id, |
| 99 int64_t internal_display_id) { | 90 int64_t internal_display_id) { |
| 100 // This should only be called once when ScreenMus is added as an observer. | 91 // This should only be called once when ScreenMus is added as an observer. |
| 101 DCHECK(display_list()->displays().empty()); | 92 DCHECK(display_list()->displays().empty()); |
| 102 | 93 |
| 103 for (size_t i = 0; i < ws_displays.size(); ++i) { | 94 for (size_t i = 0; i < ws_displays.size(); ++i) { |
| 104 const display::Display& display = ws_displays[i]->display; | 95 const display::Display& display = ws_displays[i]->display; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // TODO(kylechar): DisplayList would need to change to handle having no | 140 // TODO(kylechar): DisplayList would need to change to handle having no |
| 150 // primary display. | 141 // primary display. |
| 151 if (primary_display_id == display::Display::kInvalidDisplayID) | 142 if (primary_display_id == display::Display::kInvalidDisplayID) |
| 152 return; | 143 return; |
| 153 | 144 |
| 154 ProcessDisplayChanged(*display_list()->FindDisplayById(primary_display_id), | 145 ProcessDisplayChanged(*display_list()->FindDisplayById(primary_display_id), |
| 155 true); | 146 true); |
| 156 } | 147 } |
| 157 | 148 |
| 158 } // namespace views | 149 } // namespace views |
| OLD | NEW |