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