Chromium Code Reviews| 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(); | |
|
Elliot Glaysher
2016/10/04 22:27:19
AFAICT based on the windows implementation of GetW
| |
| 93 } | |
| 94 return aura_window; | |
| 95 } | |
| 96 | |
| 84 void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) { | 97 void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) { |
| 85 // This should only be called once from Init() before any observers have been | 98 // This should only be called once from Init() before any observers have been |
| 86 // added. | 99 // added. |
| 87 DCHECK(display_list()->displays().empty()); | 100 DCHECK(display_list()->displays().empty()); |
| 88 for (size_t i = 0; i < ws_displays.size(); ++i) { | 101 for (size_t i = 0; i < ws_displays.size(); ++i) { |
| 89 const bool is_primary = ws_displays[i]->is_primary; | 102 const bool is_primary = ws_displays[i]->is_primary; |
| 90 display_list()->AddDisplay(ws_displays[i]->display, | 103 display_list()->AddDisplay(ws_displays[i]->display, |
| 91 is_primary | 104 is_primary |
| 92 ? display::DisplayList::Type::PRIMARY | 105 ? display::DisplayList::Type::PRIMARY |
| 93 : display::DisplayList::Type::NOT_PRIMARY); | 106 : display::DisplayList::Type::NOT_PRIMARY); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 116 delegate_->OnWindowManagerFrameValuesChanged(); | 129 delegate_->OnWindowManagerFrameValuesChanged(); |
| 117 } | 130 } |
| 118 } | 131 } |
| 119 } | 132 } |
| 120 | 133 |
| 121 void ScreenMus::OnDisplayRemoved(int64_t id) { | 134 void ScreenMus::OnDisplayRemoved(int64_t id) { |
| 122 display_list()->RemoveDisplay(id); | 135 display_list()->RemoveDisplay(id); |
| 123 } | 136 } |
| 124 | 137 |
| 125 } // namespace views | 138 } // namespace views |
| OLD | NEW |