| 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 #include "services/ui/ws/display_manager.h" | 5 #include "services/ui/ws/display_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 for (Display* display : displays_) { | 297 for (Display* display : displays_) { |
| 298 display->platform_display()->GetFrameGenerator()->SetHighContrastMode( | 298 display->platform_display()->GetFrameGenerator()->SetHighContrastMode( |
| 299 enabled); | 299 enabled); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id, | 303 void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id, |
| 304 const UserId& active_id) { | 304 const UserId& active_id) { |
| 305 WindowManagerState* previous_window_manager_state = | 305 WindowManagerState* previous_window_manager_state = |
| 306 window_server_->GetWindowManagerStateForUser(previously_active_id); | 306 window_server_->GetWindowManagerStateForUser(previously_active_id); |
| 307 gfx::Point mouse_location_on_screen; | 307 gfx::Point mouse_location_on_display; |
| 308 int64_t mouse_display_id = 0; |
| 308 if (previous_window_manager_state) { | 309 if (previous_window_manager_state) { |
| 309 mouse_location_on_screen = previous_window_manager_state->event_dispatcher() | 310 mouse_location_on_display = |
| 310 ->mouse_pointer_last_location(); | 311 previous_window_manager_state->event_dispatcher() |
| 312 ->mouse_pointer_last_location(); |
| 313 mouse_display_id = previous_window_manager_state->event_dispatcher() |
| 314 ->mouse_pointer_display_id(); |
| 311 previous_window_manager_state->Deactivate(); | 315 previous_window_manager_state->Deactivate(); |
| 312 } | 316 } |
| 313 | 317 |
| 314 WindowManagerState* current_window_manager_state = | 318 WindowManagerState* current_window_manager_state = |
| 315 window_server_->GetWindowManagerStateForUser(active_id); | 319 window_server_->GetWindowManagerStateForUser(active_id); |
| 316 if (current_window_manager_state) | 320 if (current_window_manager_state) |
| 317 current_window_manager_state->Activate(mouse_location_on_screen); | 321 current_window_manager_state->Activate(mouse_location_on_display, |
| 322 mouse_display_id); |
| 318 } | 323 } |
| 319 | 324 |
| 320 void DisplayManager::CreateDisplay(const display::Display& display, | 325 void DisplayManager::CreateDisplay(const display::Display& display, |
| 321 const display::ViewportMetrics& metrics) { | 326 const display::ViewportMetrics& metrics) { |
| 322 ws::Display* ws_display = new ws::Display(window_server_); | 327 ws::Display* ws_display = new ws::Display(window_server_); |
| 323 ws_display->SetDisplay(display); | 328 ws_display->SetDisplay(display); |
| 324 ws_display->Init(metrics, nullptr); | 329 ws_display->Init(metrics, nullptr); |
| 325 } | 330 } |
| 326 | 331 |
| 327 void DisplayManager::OnDisplayAdded(const display::Display& display, | 332 void DisplayManager::OnDisplayAdded(const display::Display& display, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 DVLOG(3) << "OnPrimaryDisplayChanged: " << primary_display_id; | 372 DVLOG(3) << "OnPrimaryDisplayChanged: " << primary_display_id; |
| 368 // TODO(kylechar): Send IPCs to WM clients first. | 373 // TODO(kylechar): Send IPCs to WM clients first. |
| 369 | 374 |
| 370 // Send IPCs to any DisplayManagerObservers. | 375 // Send IPCs to any DisplayManagerObservers. |
| 371 for (const auto& pair : user_display_managers_) | 376 for (const auto& pair : user_display_managers_) |
| 372 pair.second->OnPrimaryDisplayChanged(primary_display_id); | 377 pair.second->OnPrimaryDisplayChanged(primary_display_id); |
| 373 } | 378 } |
| 374 | 379 |
| 375 } // namespace ws | 380 } // namespace ws |
| 376 } // namespace ui | 381 } // namespace ui |
| OLD | NEW |