OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Specifies how long the display change should have been disabled | 65 // Specifies how long the display change should have been disabled |
66 // after each display change operations. | 66 // after each display change operations. |
67 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid | 67 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid |
68 // changing the settings while the system is still configurating | 68 // changing the settings while the system is still configurating |
69 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs| | 69 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs| |
70 // when the display change happens, so the actual timeout is much shorter. | 70 // when the display change happens, so the actual timeout is much shorter. |
71 const int64 kAfterDisplayChangeThrottleTimeoutMs = 500; | 71 const int64 kAfterDisplayChangeThrottleTimeoutMs = 500; |
72 const int64 kCycleDisplayThrottleTimeoutMs = 4000; | 72 const int64 kCycleDisplayThrottleTimeoutMs = 4000; |
73 const int64 kSwapDisplayThrottleTimeoutMs = 500; | 73 const int64 kSwapDisplayThrottleTimeoutMs = 500; |
74 | 74 |
75 internal::DisplayManager* GetDisplayManager() { | 75 DisplayManager* GetDisplayManager() { |
76 return Shell::GetInstance()->display_manager(); | 76 return Shell::GetInstance()->display_manager(); |
77 } | 77 } |
78 | 78 |
79 void SetDisplayPropertiesOnHost(aura::WindowTreeHost* host, | 79 void SetDisplayPropertiesOnHost(aura::WindowTreeHost* host, |
80 const gfx::Display& display) { | 80 const gfx::Display& display) { |
81 internal::DisplayInfo info = | 81 DisplayInfo info = GetDisplayManager()->GetDisplayInfo(display.id()); |
82 GetDisplayManager()->GetDisplayInfo(display.id()); | |
83 #if defined(OS_CHROMEOS) && defined(USE_X11) | 82 #if defined(OS_CHROMEOS) && defined(USE_X11) |
84 // Native window property (Atom in X11) that specifies the display's | 83 // Native window property (Atom in X11) that specifies the display's |
85 // rotation, scale factor and if it's internal display. They are | 84 // rotation, scale factor and if it's internal display. They are |
86 // read and used by touchpad/mouse driver directly on X (contact | 85 // read and used by touchpad/mouse driver directly on X (contact |
87 // adlr@ for more details on touchpad/mouse driver side). The value | 86 // adlr@ for more details on touchpad/mouse driver side). The value |
88 // of the rotation is one of 0 (normal), 1 (90 degrees clockwise), 2 | 87 // of the rotation is one of 0 (normal), 1 (90 degrees clockwise), 2 |
89 // (180 degree) or 3 (270 degrees clockwise). The value of the | 88 // (180 degree) or 3 (270 degrees clockwise). The value of the |
90 // scale factor is in percent (100, 140, 200 etc). | 89 // scale factor is in percent (100, 140, 200 etc). |
91 const char kRotationProp[] = "_CHROME_DISPLAY_ROTATION"; | 90 const char kRotationProp[] = "_CHROME_DISPLAY_ROTATION"; |
92 const char kScaleFactorProp[] = "_CHROME_DISPLAY_SCALE_FACTOR"; | 91 const char kScaleFactorProp[] = "_CHROME_DISPLAY_SCALE_FACTOR"; |
(...skipping 18 matching lines...) Expand all Loading... |
111 int internal = display.IsInternal() ? 1 : 0; | 110 int internal = display.IsInternal() ? 1 : 0; |
112 gfx::AcceleratedWidget xwindow = host->GetAcceleratedWidget(); | 111 gfx::AcceleratedWidget xwindow = host->GetAcceleratedWidget(); |
113 ui::SetIntProperty(xwindow, kInternalProp, kCARDINAL, internal); | 112 ui::SetIntProperty(xwindow, kInternalProp, kCARDINAL, internal); |
114 ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, xrandr_rotation); | 113 ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, xrandr_rotation); |
115 ui::SetIntProperty(xwindow, | 114 ui::SetIntProperty(xwindow, |
116 kScaleFactorProp, | 115 kScaleFactorProp, |
117 kCARDINAL, | 116 kCARDINAL, |
118 100 * display.device_scale_factor()); | 117 100 * display.device_scale_factor()); |
119 #endif | 118 #endif |
120 scoped_ptr<aura::RootWindowTransformer> transformer( | 119 scoped_ptr<aura::RootWindowTransformer> transformer( |
121 internal::CreateRootWindowTransformerForDisplay(host->window(), | 120 CreateRootWindowTransformerForDisplay(host->window(), display)); |
122 display)); | |
123 host->SetRootWindowTransformer(transformer.Pass()); | 121 host->SetRootWindowTransformer(transformer.Pass()); |
124 | 122 |
125 internal::DisplayMode mode; | 123 DisplayMode mode; |
126 if (GetDisplayManager()->GetSelectedModeForDisplayId(display.id(), &mode) && | 124 if (GetDisplayManager()->GetSelectedModeForDisplayId(display.id(), &mode) && |
127 mode.refresh_rate > 0.0f) { | 125 mode.refresh_rate > 0.0f) { |
128 host->compositor()->vsync_manager()->SetAuthoritativeVSyncInterval( | 126 host->compositor()->vsync_manager()->SetAuthoritativeVSyncInterval( |
129 base::TimeDelta::FromMicroseconds( | 127 base::TimeDelta::FromMicroseconds( |
130 base::Time::kMicrosecondsPerSecond / mode.refresh_rate)); | 128 base::Time::kMicrosecondsPerSecond / mode.refresh_rate)); |
131 } | 129 } |
132 } | 130 } |
133 | 131 |
134 } // namespace | 132 } // namespace |
135 | 133 |
136 namespace internal { | |
137 | |
138 // A utility class to store/restore focused/active window | 134 // A utility class to store/restore focused/active window |
139 // when the display configuration has changed. | 135 // when the display configuration has changed. |
140 class FocusActivationStore { | 136 class FocusActivationStore { |
141 public: | 137 public: |
142 FocusActivationStore() | 138 FocusActivationStore() |
143 : activation_client_(NULL), | 139 : activation_client_(NULL), |
144 capture_client_(NULL), | 140 capture_client_(NULL), |
145 focus_client_(NULL), | 141 focus_client_(NULL), |
146 focused_(NULL), | 142 focused_(NULL), |
147 active_(NULL) { | 143 active_(NULL) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 aura::client::ActivationClient* activation_client_; | 190 aura::client::ActivationClient* activation_client_; |
195 aura::client::CaptureClient* capture_client_; | 191 aura::client::CaptureClient* capture_client_; |
196 aura::client::FocusClient* focus_client_; | 192 aura::client::FocusClient* focus_client_; |
197 aura::WindowTracker tracker_; | 193 aura::WindowTracker tracker_; |
198 aura::Window* focused_; | 194 aura::Window* focused_; |
199 aura::Window* active_; | 195 aura::Window* active_; |
200 | 196 |
201 DISALLOW_COPY_AND_ASSIGN(FocusActivationStore); | 197 DISALLOW_COPY_AND_ASSIGN(FocusActivationStore); |
202 }; | 198 }; |
203 | 199 |
204 } // namespace internal | |
205 | |
206 //////////////////////////////////////////////////////////////////////////////// | 200 //////////////////////////////////////////////////////////////////////////////// |
207 // DisplayChangeLimiter | 201 // DisplayChangeLimiter |
208 | 202 |
209 DisplayController::DisplayChangeLimiter::DisplayChangeLimiter() | 203 DisplayController::DisplayChangeLimiter::DisplayChangeLimiter() |
210 : throttle_timeout_(base::Time::Now()) { | 204 : throttle_timeout_(base::Time::Now()) { |
211 } | 205 } |
212 | 206 |
213 void DisplayController::DisplayChangeLimiter::SetThrottleTimeout( | 207 void DisplayController::DisplayChangeLimiter::SetThrottleTimeout( |
214 int64 throttle_ms) { | 208 int64 throttle_ms) { |
215 throttle_timeout_ = | 209 throttle_timeout_ = |
216 base::Time::Now() + base::TimeDelta::FromMilliseconds(throttle_ms); | 210 base::Time::Now() + base::TimeDelta::FromMilliseconds(throttle_ms); |
217 } | 211 } |
218 | 212 |
219 bool DisplayController::DisplayChangeLimiter::IsThrottled() const { | 213 bool DisplayController::DisplayChangeLimiter::IsThrottled() const { |
220 return base::Time::Now() < throttle_timeout_; | 214 return base::Time::Now() < throttle_timeout_; |
221 } | 215 } |
222 | 216 |
223 //////////////////////////////////////////////////////////////////////////////// | 217 //////////////////////////////////////////////////////////////////////////////// |
224 // DisplayController | 218 // DisplayController |
225 | 219 |
226 DisplayController::DisplayController() | 220 DisplayController::DisplayController() |
227 : primary_root_window_for_replace_(NULL), | 221 : primary_root_window_for_replace_(NULL), |
228 focus_activation_store_(new internal::FocusActivationStore()), | 222 focus_activation_store_(new FocusActivationStore()), |
229 cursor_window_controller_(new internal::CursorWindowController()), | 223 cursor_window_controller_(new CursorWindowController()), |
230 mirror_window_controller_(new internal::MirrorWindowController()) { | 224 mirror_window_controller_(new MirrorWindowController()) { |
231 #if defined(OS_CHROMEOS) | 225 #if defined(OS_CHROMEOS) |
232 if (base::SysInfo::IsRunningOnChromeOS()) | 226 if (base::SysInfo::IsRunningOnChromeOS()) |
233 limiter_.reset(new DisplayChangeLimiter); | 227 limiter_.reset(new DisplayChangeLimiter); |
234 #endif | 228 #endif |
235 // Reset primary display to make sure that tests don't use | 229 // Reset primary display to make sure that tests don't use |
236 // stale display info from previous tests. | 230 // stale display info from previous tests. |
237 primary_display_id = gfx::Display::kInvalidDisplayID; | 231 primary_display_id = gfx::Display::kInvalidDisplayID; |
238 } | 232 } |
239 | 233 |
240 DisplayController::~DisplayController() { | 234 DisplayController::~DisplayController() { |
241 } | 235 } |
242 | 236 |
243 void DisplayController::Start() { | 237 void DisplayController::Start() { |
244 // Created here so that Shell has finished being created. Adds itself | 238 // Created here so that Shell has finished being created. Adds itself |
245 // as a ShellObserver. | 239 // as a ShellObserver. |
246 virtual_keyboard_window_controller_.reset( | 240 virtual_keyboard_window_controller_.reset( |
247 new internal::VirtualKeyboardWindowController); | 241 new VirtualKeyboardWindowController); |
248 Shell::GetScreen()->AddObserver(this); | 242 Shell::GetScreen()->AddObserver(this); |
249 Shell::GetInstance()->display_manager()->set_delegate(this); | 243 Shell::GetInstance()->display_manager()->set_delegate(this); |
250 | 244 |
251 FOR_EACH_OBSERVER(Observer, observers_, OnDisplaysInitialized()); | 245 FOR_EACH_OBSERVER(Observer, observers_, OnDisplaysInitialized()); |
252 } | 246 } |
253 | 247 |
254 void DisplayController::Shutdown() { | 248 void DisplayController::Shutdown() { |
255 // Unset the display manager's delegate here because | 249 // Unset the display manager's delegate here because |
256 // DisplayManager outlives DisplayController. | 250 // DisplayManager outlives DisplayController. |
257 Shell::GetInstance()->display_manager()->set_delegate(NULL); | 251 Shell::GetInstance()->display_manager()->set_delegate(NULL); |
258 | 252 |
259 cursor_window_controller_.reset(); | 253 cursor_window_controller_.reset(); |
260 mirror_window_controller_.reset(); | 254 mirror_window_controller_.reset(); |
261 virtual_keyboard_window_controller_.reset(); | 255 virtual_keyboard_window_controller_.reset(); |
262 | 256 |
263 Shell::GetScreen()->RemoveObserver(this); | 257 Shell::GetScreen()->RemoveObserver(this); |
264 // Delete all root window controllers, which deletes root window | 258 // Delete all root window controllers, which deletes root window |
265 // from the last so that the primary root window gets deleted last. | 259 // from the last so that the primary root window gets deleted last. |
266 for (std::map<int64, aura::Window*>::const_reverse_iterator it = | 260 for (std::map<int64, aura::Window*>::const_reverse_iterator it = |
267 root_windows_.rbegin(); it != root_windows_.rend(); ++it) { | 261 root_windows_.rbegin(); it != root_windows_.rend(); ++it) { |
268 internal::RootWindowController* controller = | 262 RootWindowController* controller = GetRootWindowController(it->second); |
269 internal::GetRootWindowController(it->second); | |
270 DCHECK(controller); | 263 DCHECK(controller); |
271 delete controller; | 264 delete controller; |
272 } | 265 } |
273 } | 266 } |
274 | 267 |
275 void DisplayController::InitPrimaryDisplay() { | 268 void DisplayController::InitPrimaryDisplay() { |
276 const gfx::Display& primary_candidate = | 269 const gfx::Display& primary_candidate = |
277 GetDisplayManager()->GetPrimaryDisplayCandidate(); | 270 GetDisplayManager()->GetPrimaryDisplayCandidate(); |
278 primary_display_id = primary_candidate.id(); | 271 primary_display_id = primary_candidate.id(); |
279 AddWindowTreeHostForDisplay(primary_candidate); | 272 AddWindowTreeHostForDisplay(primary_candidate); |
280 } | 273 } |
281 | 274 |
282 void DisplayController::InitSecondaryDisplays() { | 275 void DisplayController::InitSecondaryDisplays() { |
283 internal::DisplayManager* display_manager = GetDisplayManager(); | 276 DisplayManager* display_manager = GetDisplayManager(); |
284 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 277 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
285 const gfx::Display& display = display_manager->GetDisplayAt(i); | 278 const gfx::Display& display = display_manager->GetDisplayAt(i); |
286 if (primary_display_id != display.id()) { | 279 if (primary_display_id != display.id()) { |
287 aura::WindowTreeHost* host = AddWindowTreeHostForDisplay(display); | 280 aura::WindowTreeHost* host = AddWindowTreeHostForDisplay(display); |
288 internal::RootWindowController::CreateForSecondaryDisplay(host); | 281 RootWindowController::CreateForSecondaryDisplay(host); |
289 } | 282 } |
290 } | 283 } |
291 UpdateHostWindowNames(); | 284 UpdateHostWindowNames(); |
292 } | 285 } |
293 | 286 |
294 void DisplayController::AddObserver(Observer* observer) { | 287 void DisplayController::AddObserver(Observer* observer) { |
295 observers_.AddObserver(observer); | 288 observers_.AddObserver(observer); |
296 } | 289 } |
297 | 290 |
298 void DisplayController::RemoveObserver(Observer* observer) { | 291 void DisplayController::RemoveObserver(Observer* observer) { |
(...skipping 11 matching lines...) Expand all Loading... |
310 } | 303 } |
311 | 304 |
312 aura::Window* DisplayController::GetRootWindowForDisplayId(int64 id) { | 305 aura::Window* DisplayController::GetRootWindowForDisplayId(int64 id) { |
313 return root_windows_[id]; | 306 return root_windows_[id]; |
314 } | 307 } |
315 | 308 |
316 void DisplayController::CloseChildWindows() { | 309 void DisplayController::CloseChildWindows() { |
317 for (std::map<int64, aura::Window*>::const_iterator it = | 310 for (std::map<int64, aura::Window*>::const_iterator it = |
318 root_windows_.begin(); it != root_windows_.end(); ++it) { | 311 root_windows_.begin(); it != root_windows_.end(); ++it) { |
319 aura::Window* root_window = it->second; | 312 aura::Window* root_window = it->second; |
320 internal::RootWindowController* controller = | 313 RootWindowController* controller = GetRootWindowController(root_window); |
321 internal::GetRootWindowController(root_window); | |
322 if (controller) { | 314 if (controller) { |
323 controller->CloseChildWindows(); | 315 controller->CloseChildWindows(); |
324 } else { | 316 } else { |
325 while (!root_window->children().empty()) { | 317 while (!root_window->children().empty()) { |
326 aura::Window* child = root_window->children()[0]; | 318 aura::Window* child = root_window->children()[0]; |
327 delete child; | 319 delete child; |
328 } | 320 } |
329 } | 321 } |
330 } | 322 } |
331 } | 323 } |
332 | 324 |
333 aura::Window::Windows DisplayController::GetAllRootWindows() { | 325 aura::Window::Windows DisplayController::GetAllRootWindows() { |
334 aura::Window::Windows windows; | 326 aura::Window::Windows windows; |
335 for (std::map<int64, aura::Window*>::const_iterator it = | 327 for (std::map<int64, aura::Window*>::const_iterator it = |
336 root_windows_.begin(); it != root_windows_.end(); ++it) { | 328 root_windows_.begin(); it != root_windows_.end(); ++it) { |
337 DCHECK(it->second); | 329 DCHECK(it->second); |
338 if (internal::GetRootWindowController(it->second)) | 330 if (GetRootWindowController(it->second)) |
339 windows.push_back(it->second); | 331 windows.push_back(it->second); |
340 } | 332 } |
341 return windows; | 333 return windows; |
342 } | 334 } |
343 | 335 |
344 gfx::Insets DisplayController::GetOverscanInsets(int64 display_id) const { | 336 gfx::Insets DisplayController::GetOverscanInsets(int64 display_id) const { |
345 return GetDisplayManager()->GetOverscanInsets(display_id); | 337 return GetDisplayManager()->GetOverscanInsets(display_id); |
346 } | 338 } |
347 | 339 |
348 void DisplayController::SetOverscanInsets(int64 display_id, | 340 void DisplayController::SetOverscanInsets(int64 display_id, |
349 const gfx::Insets& insets_in_dip) { | 341 const gfx::Insets& insets_in_dip) { |
350 GetDisplayManager()->SetOverscanInsets(display_id, insets_in_dip); | 342 GetDisplayManager()->SetOverscanInsets(display_id, insets_in_dip); |
351 } | 343 } |
352 | 344 |
353 std::vector<internal::RootWindowController*> | 345 std::vector<RootWindowController*> |
354 DisplayController::GetAllRootWindowControllers() { | 346 DisplayController::GetAllRootWindowControllers() { |
355 std::vector<internal::RootWindowController*> controllers; | 347 std::vector<RootWindowController*> controllers; |
356 for (std::map<int64, aura::Window*>::const_iterator it = | 348 for (std::map<int64, aura::Window*>::const_iterator it = |
357 root_windows_.begin(); it != root_windows_.end(); ++it) { | 349 root_windows_.begin(); it != root_windows_.end(); ++it) { |
358 internal::RootWindowController* controller = | 350 RootWindowController* controller = GetRootWindowController(it->second); |
359 internal::GetRootWindowController(it->second); | |
360 if (controller) | 351 if (controller) |
361 controllers.push_back(controller); | 352 controllers.push_back(controller); |
362 } | 353 } |
363 return controllers; | 354 return controllers; |
364 } | 355 } |
365 | 356 |
366 void DisplayController::ToggleMirrorMode() { | 357 void DisplayController::ToggleMirrorMode() { |
367 internal::DisplayManager* display_manager = GetDisplayManager(); | 358 DisplayManager* display_manager = GetDisplayManager(); |
368 if (display_manager->num_connected_displays() <= 1) | 359 if (display_manager->num_connected_displays() <= 1) |
369 return; | 360 return; |
370 | 361 |
371 if (limiter_) { | 362 if (limiter_) { |
372 if (limiter_->IsThrottled()) | 363 if (limiter_->IsThrottled()) |
373 return; | 364 return; |
374 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); | 365 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); |
375 } | 366 } |
376 #if defined(OS_CHROMEOS) | 367 #if defined(OS_CHROMEOS) |
377 Shell* shell = Shell::GetInstance(); | 368 Shell* shell = Shell::GetInstance(); |
378 internal::OutputConfiguratorAnimation* animation = | 369 OutputConfiguratorAnimation* animation = |
379 shell->output_configurator_animation(); | 370 shell->output_configurator_animation(); |
380 animation->StartFadeOutAnimation(base::Bind( | 371 animation->StartFadeOutAnimation( |
381 base::IgnoreResult(&internal::DisplayManager::SetMirrorMode), | 372 base::Bind(base::IgnoreResult(&DisplayManager::SetMirrorMode), |
382 base::Unretained(display_manager), | 373 base::Unretained(display_manager), |
383 !display_manager->IsMirrored())); | 374 !display_manager->IsMirrored())); |
384 #endif | 375 #endif |
385 } | 376 } |
386 | 377 |
387 void DisplayController::SwapPrimaryDisplay() { | 378 void DisplayController::SwapPrimaryDisplay() { |
388 if (limiter_) { | 379 if (limiter_) { |
389 if (limiter_->IsThrottled()) | 380 if (limiter_->IsThrottled()) |
390 return; | 381 return; |
391 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs); | 382 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs); |
392 } | 383 } |
393 | 384 |
394 if (Shell::GetScreen()->GetNumDisplays() > 1) { | 385 if (Shell::GetScreen()->GetNumDisplays() > 1) { |
395 #if defined(OS_CHROMEOS) | 386 #if defined(OS_CHROMEOS) |
396 internal::OutputConfiguratorAnimation* animation = | 387 OutputConfiguratorAnimation* animation = |
397 Shell::GetInstance()->output_configurator_animation(); | 388 Shell::GetInstance()->output_configurator_animation(); |
398 if (animation) { | 389 if (animation) { |
399 animation->StartFadeOutAnimation(base::Bind( | 390 animation->StartFadeOutAnimation(base::Bind( |
400 &DisplayController::OnFadeOutForSwapDisplayFinished, | 391 &DisplayController::OnFadeOutForSwapDisplayFinished, |
401 base::Unretained(this))); | 392 base::Unretained(this))); |
402 } else { | 393 } else { |
403 SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay()); | 394 SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay()); |
404 } | 395 } |
405 #else | 396 #else |
406 SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay()); | 397 SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay()); |
407 #endif | 398 #endif |
408 } | 399 } |
409 } | 400 } |
410 | 401 |
411 void DisplayController::SetPrimaryDisplayId(int64 id) { | 402 void DisplayController::SetPrimaryDisplayId(int64 id) { |
412 DCHECK_NE(gfx::Display::kInvalidDisplayID, id); | 403 DCHECK_NE(gfx::Display::kInvalidDisplayID, id); |
413 if (id == gfx::Display::kInvalidDisplayID || primary_display_id == id) | 404 if (id == gfx::Display::kInvalidDisplayID || primary_display_id == id) |
414 return; | 405 return; |
415 | 406 |
416 const gfx::Display& display = GetDisplayManager()->GetDisplayForId(id); | 407 const gfx::Display& display = GetDisplayManager()->GetDisplayForId(id); |
417 if (display.is_valid()) | 408 if (display.is_valid()) |
418 SetPrimaryDisplay(display); | 409 SetPrimaryDisplay(display); |
419 } | 410 } |
420 | 411 |
421 void DisplayController::SetPrimaryDisplay( | 412 void DisplayController::SetPrimaryDisplay( |
422 const gfx::Display& new_primary_display) { | 413 const gfx::Display& new_primary_display) { |
423 internal::DisplayManager* display_manager = GetDisplayManager(); | 414 DisplayManager* display_manager = GetDisplayManager(); |
424 DCHECK(new_primary_display.is_valid()); | 415 DCHECK(new_primary_display.is_valid()); |
425 DCHECK(display_manager->IsActiveDisplay(new_primary_display)); | 416 DCHECK(display_manager->IsActiveDisplay(new_primary_display)); |
426 | 417 |
427 if (!new_primary_display.is_valid() || | 418 if (!new_primary_display.is_valid() || |
428 !display_manager->IsActiveDisplay(new_primary_display)) { | 419 !display_manager->IsActiveDisplay(new_primary_display)) { |
429 LOG(ERROR) << "Invalid or non-existent display is requested:" | 420 LOG(ERROR) << "Invalid or non-existent display is requested:" |
430 << new_primary_display.ToString(); | 421 << new_primary_display.ToString(); |
431 return; | 422 return; |
432 } | 423 } |
433 | 424 |
(...skipping 10 matching lines...) Expand all Loading... |
444 return; | 435 return; |
445 | 436 |
446 gfx::Display old_primary_display = Shell::GetScreen()->GetPrimaryDisplay(); | 437 gfx::Display old_primary_display = Shell::GetScreen()->GetPrimaryDisplay(); |
447 | 438 |
448 // Swap root windows between current and new primary display. | 439 // Swap root windows between current and new primary display. |
449 aura::Window* primary_root = root_windows_[primary_display_id]; | 440 aura::Window* primary_root = root_windows_[primary_display_id]; |
450 DCHECK(primary_root); | 441 DCHECK(primary_root); |
451 DCHECK_NE(primary_root, non_primary_root); | 442 DCHECK_NE(primary_root, non_primary_root); |
452 | 443 |
453 root_windows_[new_primary_display.id()] = primary_root; | 444 root_windows_[new_primary_display.id()] = primary_root; |
454 internal::GetRootWindowSettings(primary_root)->display_id = | 445 GetRootWindowSettings(primary_root)->display_id = new_primary_display.id(); |
455 new_primary_display.id(); | |
456 | 446 |
457 root_windows_[old_primary_display.id()] = non_primary_root; | 447 root_windows_[old_primary_display.id()] = non_primary_root; |
458 internal::GetRootWindowSettings(non_primary_root)->display_id = | 448 GetRootWindowSettings(non_primary_root)->display_id = |
459 old_primary_display.id(); | 449 old_primary_display.id(); |
460 | 450 |
461 primary_display_id = new_primary_display.id(); | 451 primary_display_id = new_primary_display.id(); |
462 GetDisplayManager()->layout_store()->UpdatePrimaryDisplayId( | 452 GetDisplayManager()->layout_store()->UpdatePrimaryDisplayId( |
463 display_manager->GetCurrentDisplayIdPair(), primary_display_id); | 453 display_manager->GetCurrentDisplayIdPair(), primary_display_id); |
464 | 454 |
465 UpdateWorkAreaOfDisplayNearestWindow( | 455 UpdateWorkAreaOfDisplayNearestWindow( |
466 primary_root, old_primary_display.GetWorkAreaInsets()); | 456 primary_root, old_primary_display.GetWorkAreaInsets()); |
467 UpdateWorkAreaOfDisplayNearestWindow( | 457 UpdateWorkAreaOfDisplayNearestWindow( |
468 non_primary_root, new_primary_display.GetWorkAreaInsets()); | 458 non_primary_root, new_primary_display.GetWorkAreaInsets()); |
469 | 459 |
470 // Update the dispay manager with new display info. | 460 // Update the dispay manager with new display info. |
471 std::vector<internal::DisplayInfo> display_info_list; | 461 std::vector<DisplayInfo> display_info_list; |
472 display_info_list.push_back(display_manager->GetDisplayInfo( | 462 display_info_list.push_back(display_manager->GetDisplayInfo( |
473 primary_display_id)); | 463 primary_display_id)); |
474 display_info_list.push_back(display_manager->GetDisplayInfo( | 464 display_info_list.push_back(display_manager->GetDisplayInfo( |
475 ScreenUtil::GetSecondaryDisplay().id())); | 465 ScreenUtil::GetSecondaryDisplay().id())); |
476 GetDisplayManager()->set_force_bounds_changed(true); | 466 GetDisplayManager()->set_force_bounds_changed(true); |
477 GetDisplayManager()->UpdateDisplays(display_info_list); | 467 GetDisplayManager()->UpdateDisplays(display_info_list); |
478 GetDisplayManager()->set_force_bounds_changed(false); | 468 GetDisplayManager()->set_force_bounds_changed(false); |
479 } | 469 } |
480 | 470 |
481 void DisplayController::EnsurePointerInDisplays() { | 471 void DisplayController::EnsurePointerInDisplays() { |
482 // If the mouse is currently on a display in native location, | 472 // If the mouse is currently on a display in native location, |
483 // use the same native location. Otherwise find the display closest | 473 // use the same native location. Otherwise find the display closest |
484 // to the current cursor location in screen coordinates. | 474 // to the current cursor location in screen coordinates. |
485 | 475 |
486 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); | 476 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); |
487 gfx::Point target_location_in_native; | 477 gfx::Point target_location_in_native; |
488 int64 closest_distance_squared = -1; | 478 int64 closest_distance_squared = -1; |
489 internal::DisplayManager* display_manager = GetDisplayManager(); | 479 DisplayManager* display_manager = GetDisplayManager(); |
490 | 480 |
491 aura::Window* dst_root_window = NULL; | 481 aura::Window* dst_root_window = NULL; |
492 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 482 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
493 const gfx::Display& display = display_manager->GetDisplayAt(i); | 483 const gfx::Display& display = display_manager->GetDisplayAt(i); |
494 const internal::DisplayInfo display_info = | 484 const DisplayInfo display_info = |
495 display_manager->GetDisplayInfo(display.id()); | 485 display_manager->GetDisplayInfo(display.id()); |
496 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); | 486 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); |
497 if (display_info.bounds_in_native().Contains( | 487 if (display_info.bounds_in_native().Contains( |
498 cursor_location_in_native_coords_for_restore_)) { | 488 cursor_location_in_native_coords_for_restore_)) { |
499 dst_root_window = root_window; | 489 dst_root_window = root_window; |
500 target_location_in_native = cursor_location_in_native_coords_for_restore_; | 490 target_location_in_native = cursor_location_in_native_coords_for_restore_; |
501 break; | 491 break; |
502 } | 492 } |
503 gfx::Point center = display.bounds().CenterPoint(); | 493 gfx::Point center = display.bounds().CenterPoint(); |
504 // Use the distance squared from the center of the dislay. This is not | 494 // Use the distance squared from the center of the dislay. This is not |
(...skipping 17 matching lines...) Expand all Loading... |
522 } | 512 } |
523 dst_root_window->GetHost()->ConvertPointFromNativeScreen( | 513 dst_root_window->GetHost()->ConvertPointFromNativeScreen( |
524 &target_location_in_native); | 514 &target_location_in_native); |
525 dst_root_window->MoveCursorTo(target_location_in_native); | 515 dst_root_window->MoveCursorTo(target_location_in_native); |
526 } | 516 } |
527 | 517 |
528 bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow( | 518 bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow( |
529 const aura::Window* window, | 519 const aura::Window* window, |
530 const gfx::Insets& insets) { | 520 const gfx::Insets& insets) { |
531 const aura::Window* root_window = window->GetRootWindow(); | 521 const aura::Window* root_window = window->GetRootWindow(); |
532 int64 id = internal::GetRootWindowSettings(root_window)->display_id; | 522 int64 id = GetRootWindowSettings(root_window)->display_id; |
533 // if id is |kInvaildDisplayID|, it's being deleted. | 523 // if id is |kInvaildDisplayID|, it's being deleted. |
534 DCHECK(id != gfx::Display::kInvalidDisplayID); | 524 DCHECK(id != gfx::Display::kInvalidDisplayID); |
535 return GetDisplayManager()->UpdateWorkAreaOfDisplay(id, insets); | 525 return GetDisplayManager()->UpdateWorkAreaOfDisplay(id, insets); |
536 } | 526 } |
537 | 527 |
538 void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) { | 528 void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) { |
539 const internal::DisplayInfo& display_info = | 529 const DisplayInfo& display_info = |
540 GetDisplayManager()->GetDisplayInfo(display.id()); | 530 GetDisplayManager()->GetDisplayInfo(display.id()); |
541 DCHECK(!display_info.bounds_in_native().IsEmpty()); | 531 DCHECK(!display_info.bounds_in_native().IsEmpty()); |
542 aura::WindowTreeHost* host = root_windows_[display.id()]->GetHost(); | 532 aura::WindowTreeHost* host = root_windows_[display.id()]->GetHost(); |
543 host->SetBounds(display_info.bounds_in_native()); | 533 host->SetBounds(display_info.bounds_in_native()); |
544 SetDisplayPropertiesOnHost(host, display); | 534 SetDisplayPropertiesOnHost(host, display); |
545 } | 535 } |
546 | 536 |
547 void DisplayController::OnDisplayAdded(const gfx::Display& display) { | 537 void DisplayController::OnDisplayAdded(const gfx::Display& display) { |
548 if (primary_root_window_for_replace_) { | 538 if (primary_root_window_for_replace_) { |
549 DCHECK(root_windows_.empty()); | 539 DCHECK(root_windows_.empty()); |
550 primary_display_id = display.id(); | 540 primary_display_id = display.id(); |
551 root_windows_[display.id()] = primary_root_window_for_replace_; | 541 root_windows_[display.id()] = primary_root_window_for_replace_; |
552 internal::GetRootWindowSettings(primary_root_window_for_replace_)-> | 542 GetRootWindowSettings(primary_root_window_for_replace_)->display_id = |
553 display_id = display.id(); | 543 display.id(); |
554 primary_root_window_for_replace_ = NULL; | 544 primary_root_window_for_replace_ = NULL; |
555 const internal::DisplayInfo& display_info = | 545 const DisplayInfo& display_info = |
556 GetDisplayManager()->GetDisplayInfo(display.id()); | 546 GetDisplayManager()->GetDisplayInfo(display.id()); |
557 aura::WindowTreeHost* host = root_windows_[display.id()]->GetHost(); | 547 aura::WindowTreeHost* host = root_windows_[display.id()]->GetHost(); |
558 host->SetBounds(display_info.bounds_in_native()); | 548 host->SetBounds(display_info.bounds_in_native()); |
559 SetDisplayPropertiesOnHost(host, display); | 549 SetDisplayPropertiesOnHost(host, display); |
560 } else { | 550 } else { |
561 if (primary_display_id == gfx::Display::kInvalidDisplayID) | 551 if (primary_display_id == gfx::Display::kInvalidDisplayID) |
562 primary_display_id = display.id(); | 552 primary_display_id = display.id(); |
563 DCHECK(!root_windows_.empty()); | 553 DCHECK(!root_windows_.empty()); |
564 aura::WindowTreeHost* host = AddWindowTreeHostForDisplay(display); | 554 aura::WindowTreeHost* host = AddWindowTreeHostForDisplay(display); |
565 internal::RootWindowController::CreateForSecondaryDisplay(host); | 555 RootWindowController::CreateForSecondaryDisplay(host); |
566 } | 556 } |
567 } | 557 } |
568 | 558 |
569 void DisplayController::OnDisplayRemoved(const gfx::Display& display) { | 559 void DisplayController::OnDisplayRemoved(const gfx::Display& display) { |
570 aura::Window* root_to_delete = root_windows_[display.id()]; | 560 aura::Window* root_to_delete = root_windows_[display.id()]; |
571 DCHECK(root_to_delete) << display.ToString(); | 561 DCHECK(root_to_delete) << display.ToString(); |
572 | 562 |
573 // Display for root window will be deleted when the Primary RootWindow | 563 // Display for root window will be deleted when the Primary RootWindow |
574 // is deleted by the Shell. | 564 // is deleted by the Shell. |
575 root_windows_.erase(display.id()); | 565 root_windows_.erase(display.id()); |
576 | 566 |
577 // When the primary root window's display is removed, move the primary | 567 // When the primary root window's display is removed, move the primary |
578 // root to the other display. | 568 // root to the other display. |
579 if (primary_display_id == display.id()) { | 569 if (primary_display_id == display.id()) { |
580 // Temporarily store the primary root window in | 570 // Temporarily store the primary root window in |
581 // |primary_root_window_for_replace_| when replacing the display. | 571 // |primary_root_window_for_replace_| when replacing the display. |
582 if (root_windows_.size() == 0) { | 572 if (root_windows_.size() == 0) { |
583 primary_display_id = gfx::Display::kInvalidDisplayID; | 573 primary_display_id = gfx::Display::kInvalidDisplayID; |
584 primary_root_window_for_replace_ = root_to_delete; | 574 primary_root_window_for_replace_ = root_to_delete; |
585 return; | 575 return; |
586 } | 576 } |
587 DCHECK_EQ(1U, root_windows_.size()); | 577 DCHECK_EQ(1U, root_windows_.size()); |
588 primary_display_id = ScreenUtil::GetSecondaryDisplay().id(); | 578 primary_display_id = ScreenUtil::GetSecondaryDisplay().id(); |
589 aura::Window* primary_root = root_to_delete; | 579 aura::Window* primary_root = root_to_delete; |
590 | 580 |
591 // Delete the other root instead. | 581 // Delete the other root instead. |
592 root_to_delete = root_windows_[primary_display_id]; | 582 root_to_delete = root_windows_[primary_display_id]; |
593 internal::GetRootWindowSettings(root_to_delete)->display_id = display.id(); | 583 GetRootWindowSettings(root_to_delete)->display_id = display.id(); |
594 | 584 |
595 // Setup primary root. | 585 // Setup primary root. |
596 root_windows_[primary_display_id] = primary_root; | 586 root_windows_[primary_display_id] = primary_root; |
597 internal::GetRootWindowSettings(primary_root)->display_id = | 587 GetRootWindowSettings(primary_root)->display_id = primary_display_id; |
598 primary_display_id; | |
599 | 588 |
600 OnDisplayBoundsChanged( | 589 OnDisplayBoundsChanged( |
601 GetDisplayManager()->GetDisplayForId(primary_display_id)); | 590 GetDisplayManager()->GetDisplayForId(primary_display_id)); |
602 } | 591 } |
603 internal::RootWindowController* controller = | 592 RootWindowController* controller = GetRootWindowController(root_to_delete); |
604 internal::GetRootWindowController(root_to_delete); | |
605 DCHECK(controller); | 593 DCHECK(controller); |
606 controller->MoveWindowsTo(GetPrimaryRootWindow()); | 594 controller->MoveWindowsTo(GetPrimaryRootWindow()); |
607 // Delete most of root window related objects, but don't delete | 595 // Delete most of root window related objects, but don't delete |
608 // root window itself yet because the stack may be using it. | 596 // root window itself yet because the stack may be using it. |
609 controller->Shutdown(); | 597 controller->Shutdown(); |
610 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller); | 598 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller); |
611 } | 599 } |
612 | 600 |
613 void DisplayController::OnHostResized(const aura::WindowTreeHost* host) { | 601 void DisplayController::OnHostResized(const aura::WindowTreeHost* host) { |
614 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( | 602 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( |
615 const_cast<aura::Window*>(host->window())); | 603 const_cast<aura::Window*>(host->window())); |
616 | 604 |
617 internal::DisplayManager* display_manager = GetDisplayManager(); | 605 DisplayManager* display_manager = GetDisplayManager(); |
618 if (display_manager->UpdateDisplayBounds(display.id(), host->GetBounds())) { | 606 if (display_manager->UpdateDisplayBounds(display.id(), host->GetBounds())) { |
619 mirror_window_controller_->UpdateWindow(); | 607 mirror_window_controller_->UpdateWindow(); |
620 cursor_window_controller_->UpdateContainer(); | 608 cursor_window_controller_->UpdateContainer(); |
621 } | 609 } |
622 } | 610 } |
623 | 611 |
624 void DisplayController::CreateOrUpdateNonDesktopDisplay( | 612 void DisplayController::CreateOrUpdateNonDesktopDisplay( |
625 const internal::DisplayInfo& info) { | 613 const DisplayInfo& info) { |
626 switch (GetDisplayManager()->second_display_mode()) { | 614 switch (GetDisplayManager()->second_display_mode()) { |
627 case internal::DisplayManager::MIRRORING: | 615 case DisplayManager::MIRRORING: |
628 mirror_window_controller_->UpdateWindow(info); | 616 mirror_window_controller_->UpdateWindow(info); |
629 cursor_window_controller_->UpdateContainer(); | 617 cursor_window_controller_->UpdateContainer(); |
630 virtual_keyboard_window_controller_->Close(); | 618 virtual_keyboard_window_controller_->Close(); |
631 break; | 619 break; |
632 case internal::DisplayManager::VIRTUAL_KEYBOARD: | 620 case DisplayManager::VIRTUAL_KEYBOARD: |
633 mirror_window_controller_->Close(); | 621 mirror_window_controller_->Close(); |
634 cursor_window_controller_->UpdateContainer(); | 622 cursor_window_controller_->UpdateContainer(); |
635 virtual_keyboard_window_controller_->UpdateWindow(info); | 623 virtual_keyboard_window_controller_->UpdateWindow(info); |
636 break; | 624 break; |
637 case internal::DisplayManager::EXTENDED: | 625 case DisplayManager::EXTENDED: |
638 NOTREACHED(); | 626 NOTREACHED(); |
639 } | 627 } |
640 } | 628 } |
641 | 629 |
642 void DisplayController::CloseNonDesktopDisplay() { | 630 void DisplayController::CloseNonDesktopDisplay() { |
643 mirror_window_controller_->Close(); | 631 mirror_window_controller_->Close(); |
644 cursor_window_controller_->UpdateContainer(); | 632 cursor_window_controller_->UpdateContainer(); |
645 virtual_keyboard_window_controller_->Close(); | 633 virtual_keyboard_window_controller_->Close(); |
646 } | 634 } |
647 | 635 |
(...skipping 11 matching lines...) Expand all Loading... |
659 root_window->GetHost()->ConvertPointToNativeScreen(&point_in_screen); | 647 root_window->GetHost()->ConvertPointToNativeScreen(&point_in_screen); |
660 cursor_location_in_native_coords_for_restore_ = point_in_screen; | 648 cursor_location_in_native_coords_for_restore_ = point_in_screen; |
661 } | 649 } |
662 | 650 |
663 void DisplayController::PostDisplayConfigurationChange() { | 651 void DisplayController::PostDisplayConfigurationChange() { |
664 if (limiter_) | 652 if (limiter_) |
665 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs); | 653 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs); |
666 | 654 |
667 focus_activation_store_->Restore(); | 655 focus_activation_store_->Restore(); |
668 | 656 |
669 internal::DisplayManager* display_manager = GetDisplayManager(); | 657 DisplayManager* display_manager = GetDisplayManager(); |
670 internal::DisplayLayoutStore* layout_store = display_manager->layout_store(); | 658 DisplayLayoutStore* layout_store = display_manager->layout_store(); |
671 if (display_manager->num_connected_displays() > 1) { | 659 if (display_manager->num_connected_displays() > 1) { |
672 DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair(); | 660 DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair(); |
673 layout_store->UpdateMirrorStatus(pair, display_manager->IsMirrored()); | 661 layout_store->UpdateMirrorStatus(pair, display_manager->IsMirrored()); |
674 DisplayLayout layout = layout_store->GetRegisteredDisplayLayout(pair); | 662 DisplayLayout layout = layout_store->GetRegisteredDisplayLayout(pair); |
675 | 663 |
676 if (Shell::GetScreen()->GetNumDisplays() > 1 ) { | 664 if (Shell::GetScreen()->GetNumDisplays() > 1 ) { |
677 int64 primary_id = layout.primary_id; | 665 int64 primary_id = layout.primary_id; |
678 SetPrimaryDisplayId( | 666 SetPrimaryDisplayId( |
679 primary_id == gfx::Display::kInvalidDisplayID ? | 667 primary_id == gfx::Display::kInvalidDisplayID ? |
680 pair.first : primary_id); | 668 pair.first : primary_id); |
681 // Update the primary_id in case the above call is | 669 // Update the primary_id in case the above call is |
682 // ignored. Happens when a) default layout's primary id | 670 // ignored. Happens when a) default layout's primary id |
683 // doesn't exist, or b) the primary_id has already been | 671 // doesn't exist, or b) the primary_id has already been |
684 // set to the same and didn't update it. | 672 // set to the same and didn't update it. |
685 layout_store->UpdatePrimaryDisplayId( | 673 layout_store->UpdatePrimaryDisplayId( |
686 pair, Shell::GetScreen()->GetPrimaryDisplay().id()); | 674 pair, Shell::GetScreen()->GetPrimaryDisplay().id()); |
687 } | 675 } |
688 } | 676 } |
689 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); | 677 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); |
690 UpdateHostWindowNames(); | 678 UpdateHostWindowNames(); |
691 EnsurePointerInDisplays(); | 679 EnsurePointerInDisplays(); |
692 } | 680 } |
693 | 681 |
694 aura::WindowTreeHost* DisplayController::AddWindowTreeHostForDisplay( | 682 aura::WindowTreeHost* DisplayController::AddWindowTreeHostForDisplay( |
695 const gfx::Display& display) { | 683 const gfx::Display& display) { |
696 static int host_count = 0; | 684 static int host_count = 0; |
697 const internal::DisplayInfo& display_info = | 685 const DisplayInfo& display_info = |
698 GetDisplayManager()->GetDisplayInfo(display.id()); | 686 GetDisplayManager()->GetDisplayInfo(display.id()); |
699 const gfx::Rect& bounds_in_native = display_info.bounds_in_native(); | 687 const gfx::Rect& bounds_in_native = display_info.bounds_in_native(); |
700 aura::WindowTreeHost* host = | 688 aura::WindowTreeHost* host = |
701 Shell::GetInstance()->window_tree_host_factory()->CreateWindowTreeHost( | 689 Shell::GetInstance()->window_tree_host_factory()->CreateWindowTreeHost( |
702 bounds_in_native); | 690 bounds_in_native); |
703 host->window()->SetName(base::StringPrintf("RootWindow-%d", host_count++)); | 691 host->window()->SetName(base::StringPrintf("RootWindow-%d", host_count++)); |
704 host->compositor()->SetBackgroundColor(SK_ColorBLACK); | 692 host->compositor()->SetBackgroundColor(SK_ColorBLACK); |
705 // No need to remove our observer observer because the DisplayController | 693 // No need to remove our observer observer because the DisplayController |
706 // outlives the host. | 694 // outlives the host. |
707 host->AddObserver(this); | 695 host->AddObserver(this); |
708 internal::InitRootWindowSettings(host->window())->display_id = display.id(); | 696 InitRootWindowSettings(host->window())->display_id = display.id(); |
709 host->InitHost(); | 697 host->InitHost(); |
710 | 698 |
711 root_windows_[display.id()] = host->window(); | 699 root_windows_[display.id()] = host->window(); |
712 SetDisplayPropertiesOnHost(host, display); | 700 SetDisplayPropertiesOnHost(host, display); |
713 | 701 |
714 #if defined(OS_CHROMEOS) | 702 #if defined(OS_CHROMEOS) |
715 static bool force_constrain_pointer_to_root = | 703 static bool force_constrain_pointer_to_root = |
716 CommandLine::ForCurrentProcess()->HasSwitch( | 704 CommandLine::ForCurrentProcess()->HasSwitch( |
717 switches::kAshConstrainPointerToRoot); | 705 switches::kAshConstrainPointerToRoot); |
718 if (base::SysInfo::IsRunningOnChromeOS() || force_constrain_pointer_to_root) | 706 if (base::SysInfo::IsRunningOnChromeOS() || force_constrain_pointer_to_root) |
(...skipping 20 matching lines...) Expand all Loading... |
739 std::string name = | 727 std::string name = |
740 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; | 728 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; |
741 gfx::AcceleratedWidget xwindow = | 729 gfx::AcceleratedWidget xwindow = |
742 root_windows[i]->GetHost()->GetAcceleratedWidget(); | 730 root_windows[i]->GetHost()->GetAcceleratedWidget(); |
743 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); | 731 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); |
744 } | 732 } |
745 #endif | 733 #endif |
746 } | 734 } |
747 | 735 |
748 } // namespace ash | 736 } // namespace ash |
OLD | NEW |