| 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 |
| 11 #include "services/shell/public/cpp/connection.h" | 11 #include "services/shell/public/cpp/connection.h" |
| 12 #include "services/shell/public/cpp/connector.h" | 12 #include "services/shell/public/cpp/connector.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/views/mus/native_widget_mus.h" |
| 14 #include "ui/views/mus/screen_mus_delegate.h" | 15 #include "ui/views/mus/screen_mus_delegate.h" |
| 15 #include "ui/views/mus/window_manager_frame_values.h" | 16 #include "ui/views/mus/window_manager_frame_values.h" |
| 16 | 17 |
| 17 namespace mojo { | 18 namespace mojo { |
| 18 | 19 |
| 19 template <> | 20 template <> |
| 20 struct TypeConverter<views::WindowManagerFrameValues, | 21 struct TypeConverter<views::WindowManagerFrameValues, |
| 21 ui::mojom::FrameDecorationValuesPtr> { | 22 ui::mojom::FrameDecorationValuesPtr> { |
| 22 static views::WindowManagerFrameValues Convert( | 23 static views::WindowManagerFrameValues Convert( |
| 23 const ui::mojom::FrameDecorationValuesPtr& input) { | 24 const ui::mojom::FrameDecorationValuesPtr& input) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 75 } |
| 75 | 76 |
| 76 return delegate_->GetCursorScreenPoint(); | 77 return delegate_->GetCursorScreenPoint(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 bool ScreenMus::IsWindowUnderCursor(gfx::NativeWindow window) { | 80 bool ScreenMus::IsWindowUnderCursor(gfx::NativeWindow window) { |
| 80 return window && window->IsVisible() && | 81 return window && window->IsVisible() && |
| 81 window->GetBoundsInScreen().Contains(GetCursorScreenPoint()); | 82 window->GetBoundsInScreen().Contains(GetCursorScreenPoint()); |
| 82 } | 83 } |
| 83 | 84 |
| 85 gfx::NativeWindow ScreenMus::GetWindowAtScreenPoint(const gfx::Point& point) { |
| 86 aura::Window* aura_window = nullptr; |
| 87 ui::Window* ui_window = delegate_->GetWindowAtScreenPoint(point); |
| 88 if (ui_window) { |
| 89 NativeWidgetMus* nw_mus = NativeWidgetMus::GetForWindow(ui_window); |
| 90 if (nw_mus) { |
| 91 aura_window = |
| 92 static_cast<internal::NativeWidgetPrivate*>(nw_mus)->GetNativeView(); |
| 93 } |
| 94 } |
| 95 return aura_window; |
| 96 } |
| 97 |
| 84 void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) { | 98 void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) { |
| 85 // This should only be called once from Init() before any observers have been | 99 // This should only be called once from Init() before any observers have been |
| 86 // added. | 100 // added. |
| 87 DCHECK(display_list()->displays().empty()); | 101 DCHECK(display_list()->displays().empty()); |
| 88 for (size_t i = 0; i < ws_displays.size(); ++i) { | 102 for (size_t i = 0; i < ws_displays.size(); ++i) { |
| 89 const bool is_primary = ws_displays[i]->is_primary; | 103 const bool is_primary = ws_displays[i]->is_primary; |
| 90 display_list()->AddDisplay(ws_displays[i]->display, | 104 display_list()->AddDisplay(ws_displays[i]->display, |
| 91 is_primary | 105 is_primary |
| 92 ? display::DisplayList::Type::PRIMARY | 106 ? display::DisplayList::Type::PRIMARY |
| 93 : display::DisplayList::Type::NOT_PRIMARY); | 107 : display::DisplayList::Type::NOT_PRIMARY); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 116 delegate_->OnWindowManagerFrameValuesChanged(); | 130 delegate_->OnWindowManagerFrameValuesChanged(); |
| 117 } | 131 } |
| 118 } | 132 } |
| 119 } | 133 } |
| 120 | 134 |
| 121 void ScreenMus::OnDisplayRemoved(int64_t id) { | 135 void ScreenMus::OnDisplayRemoved(int64_t id) { |
| 122 display_list()->RemoveDisplay(id); | 136 display_list()->RemoveDisplay(id); |
| 123 } | 137 } |
| 124 | 138 |
| 125 } // namespace views | 139 } // namespace views |
| OLD | NEW |