| Index: services/ui/ws/display_manager.cc
|
| diff --git a/services/ui/ws/display_manager.cc b/services/ui/ws/display_manager.cc
|
| index e027dd15fc90813d6f98751c71af2279a8fd1ef9..ecc118de3084c2477c9b6ebe1b86f988a9d0afc5 100644
|
| --- a/services/ui/ws/display_manager.cc
|
| +++ b/services/ui/ws/display_manager.cc
|
| @@ -16,7 +16,9 @@
|
| #include "services/ui/ws/user_display_manager_delegate.h"
|
| #include "services/ui/ws/user_id_tracker.h"
|
| #include "services/ui/ws/window_manager_state.h"
|
| +#include "services/ui/ws/window_manager_window_tree_factory.h"
|
| #include "services/ui/ws/window_server_delegate.h"
|
| +#include "services/ui/ws/window_tree.h"
|
|
|
| namespace ui {
|
| namespace ws {
|
| @@ -168,15 +170,11 @@ void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id,
|
| }
|
|
|
| void DisplayManager::OnDisplayAdded(int64_t id,
|
| - const gfx::Rect& bounds,
|
| - const gfx::Size& pixel_size,
|
| - float scale_factor) {
|
| + const display::ViewportMetrics& metrics) {
|
| TRACE_EVENT1("mus-ws", "OnDisplayAdded", "id", id);
|
| PlatformDisplayInitParams params;
|
| params.display_id = id;
|
| - params.metrics.bounds = bounds;
|
| - params.metrics.pixel_size = pixel_size;
|
| - params.metrics.device_scale_factor = scale_factor;
|
| + params.metrics = metrics;
|
| params.display_compositor = window_server_->GetDisplayCompositor();
|
|
|
| ws::Display* display = new ws::Display(window_server_, params);
|
| @@ -192,12 +190,28 @@ void DisplayManager::OnDisplayRemoved(int64_t id) {
|
| DestroyDisplay(display);
|
| }
|
|
|
| -void DisplayManager::OnDisplayModified(int64_t id,
|
| - const gfx::Rect& bounds,
|
| - const gfx::Size& pixel_size,
|
| - float scale_factor) {
|
| - // TODO(kylechar): Implement.
|
| - NOTREACHED();
|
| +void DisplayManager::OnDisplayModified(
|
| + int64_t id,
|
| + const display::ViewportMetrics& metrics) {
|
| + TRACE_EVENT1("mus-ws", "OnDisplayModified", "id", id);
|
| +
|
| + Display* display = GetDisplayById(id);
|
| + DCHECK(display);
|
| +
|
| + // Update the platform display and check if anything has actually changed.
|
| + if (!display->platform_display()->UpdateViewportMetrics(metrics))
|
| + return;
|
| +
|
| + // Send IPCs to WM clients first with new display information.
|
| + std::vector<WindowManagerWindowTreeFactory*> factories =
|
| + window_server_->window_manager_window_tree_factory_set()->GetFactories();
|
| + for (WindowManagerWindowTreeFactory* factory : factories) {
|
| + if (factory->window_tree())
|
| + factory->window_tree()->OnWmDisplayModified(display->ToDisplay());
|
| + }
|
| +
|
| + display->OnViewportMetricsChanged(metrics);
|
| + OnDisplayUpdate(display);
|
| }
|
|
|
| } // namespace ws
|
|
|