| 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/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 for (Display* display : displays_) { | 192 for (Display* display : displays_) { |
| 193 display->platform_display()->GetFrameGenerator()->SetHighContrastMode( | 193 display->platform_display()->GetFrameGenerator()->SetHighContrastMode( |
| 194 enabled); | 194 enabled); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id, | 198 void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id, |
| 199 const UserId& active_id) { | 199 const UserId& active_id) { |
| 200 WindowManagerState* previous_window_manager_state = | 200 WindowManagerState* previous_window_manager_state = |
| 201 window_server_->GetWindowManagerStateForUser(previously_active_id); | 201 window_server_->GetWindowManagerStateForUser(previously_active_id); |
| 202 gfx::Point mouse_location_on_screen; | 202 gfx::Point mouse_location_on_display; |
| 203 int64_t mouse_display_id = 0; |
| 203 if (previous_window_manager_state) { | 204 if (previous_window_manager_state) { |
| 204 mouse_location_on_screen = previous_window_manager_state->event_dispatcher() | 205 mouse_location_on_display = |
| 205 ->mouse_pointer_last_location(); | 206 previous_window_manager_state->event_dispatcher() |
| 207 ->mouse_pointer_last_location(); |
| 208 mouse_display_id = previous_window_manager_state->event_dispatcher() |
| 209 ->mouse_pointer_display_id(); |
| 206 previous_window_manager_state->Deactivate(); | 210 previous_window_manager_state->Deactivate(); |
| 207 } | 211 } |
| 208 | 212 |
| 209 WindowManagerState* current_window_manager_state = | 213 WindowManagerState* current_window_manager_state = |
| 210 window_server_->GetWindowManagerStateForUser(active_id); | 214 window_server_->GetWindowManagerStateForUser(active_id); |
| 211 if (current_window_manager_state) | 215 if (current_window_manager_state) |
| 212 current_window_manager_state->Activate(mouse_location_on_screen); | 216 current_window_manager_state->Activate(mouse_location_on_display, |
| 217 mouse_display_id); |
| 213 } | 218 } |
| 214 | 219 |
| 215 void DisplayManager::OnDisplayAdded(const display::Display& display, | 220 void DisplayManager::OnDisplayAdded(const display::Display& display, |
| 216 const display::ViewportMetrics& metrics) { | 221 const display::ViewportMetrics& metrics) { |
| 217 DVLOG(3) << "OnDisplayAdded: " << display.ToString(); | 222 DVLOG(3) << "OnDisplayAdded: " << display.ToString(); |
| 218 | 223 |
| 219 ws::Display* ws_display = new ws::Display(window_server_); | 224 ws::Display* ws_display = new ws::Display(window_server_); |
| 220 ws_display->SetDisplay(display); | 225 ws_display->SetDisplay(display); |
| 221 ws_display->Init(metrics, nullptr); | 226 ws_display->Init(metrics, nullptr); |
| 222 } | 227 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 DVLOG(3) << "OnPrimaryDisplayChanged: " << primary_display_id; | 263 DVLOG(3) << "OnPrimaryDisplayChanged: " << primary_display_id; |
| 259 // TODO(kylechar): Send IPCs to WM clients first. | 264 // TODO(kylechar): Send IPCs to WM clients first. |
| 260 | 265 |
| 261 // Send IPCs to any DisplayManagerObservers. | 266 // Send IPCs to any DisplayManagerObservers. |
| 262 for (const auto& pair : user_display_managers_) | 267 for (const auto& pair : user_display_managers_) |
| 263 pair.second->OnPrimaryDisplayChanged(primary_display_id); | 268 pair.second->OnPrimaryDisplayChanged(primary_display_id); |
| 264 } | 269 } |
| 265 | 270 |
| 266 } // namespace ws | 271 } // namespace ws |
| 267 } // namespace ui | 272 } // namespace ui |
| OLD | NEW |