Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: ash/display/window_tree_host_manager.cc

Issue 1838833002: Move DisplayLayout and DisplayLayoutBuilder From ash To ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screenwinmove
Patch Set: Fix comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/window_tree_host_manager.h" 5 #include "ash/display/window_tree_host_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 26 matching lines...) Expand all
37 #include "ui/aura/client/capture_client.h" 37 #include "ui/aura/client/capture_client.h"
38 #include "ui/aura/client/focus_client.h" 38 #include "ui/aura/client/focus_client.h"
39 #include "ui/aura/client/screen_position_client.h" 39 #include "ui/aura/client/screen_position_client.h"
40 #include "ui/aura/window.h" 40 #include "ui/aura/window.h"
41 #include "ui/aura/window_event_dispatcher.h" 41 #include "ui/aura/window_event_dispatcher.h"
42 #include "ui/aura/window_property.h" 42 #include "ui/aura/window_property.h"
43 #include "ui/aura/window_tracker.h" 43 #include "ui/aura/window_tracker.h"
44 #include "ui/aura/window_tree_host.h" 44 #include "ui/aura/window_tree_host.h"
45 #include "ui/base/ime/input_method_factory.h" 45 #include "ui/base/ime/input_method_factory.h"
46 #include "ui/compositor/compositor.h" 46 #include "ui/compositor/compositor.h"
47 #include "ui/display/manager/display_layout.h"
47 #include "ui/gfx/display.h" 48 #include "ui/gfx/display.h"
48 #include "ui/gfx/screen.h" 49 #include "ui/gfx/screen.h"
49 #include "ui/wm/core/coordinate_conversion.h" 50 #include "ui/wm/core/coordinate_conversion.h"
50 #include "ui/wm/public/activation_client.h" 51 #include "ui/wm/public/activation_client.h"
51 52
52 #if defined(USE_X11) 53 #if defined(USE_X11)
53 #include "ui/base/x/x11_util.h" 54 #include "ui/base/x/x11_util.h"
54 #include "ui/gfx/x/x11_types.h" // nogncheck 55 #include "ui/gfx/x/x11_types.h" // nogncheck
55 56
56 // Including this at the bottom to avoid other 57 // Including this at the bottom to avoid other
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 CHECK_NE(primary_host, non_primary_host); 433 CHECK_NE(primary_host, non_primary_host);
433 434
434 window_tree_hosts_[new_primary_display.id()] = primary_host; 435 window_tree_hosts_[new_primary_display.id()] = primary_host;
435 GetRootWindowSettings(GetWindow(primary_host))->display_id = 436 GetRootWindowSettings(GetWindow(primary_host))->display_id =
436 new_primary_display.id(); 437 new_primary_display.id();
437 438
438 window_tree_hosts_[old_primary_display.id()] = non_primary_host; 439 window_tree_hosts_[old_primary_display.id()] = non_primary_host;
439 GetRootWindowSettings(GetWindow(non_primary_host))->display_id = 440 GetRootWindowSettings(GetWindow(non_primary_host))->display_id =
440 old_primary_display.id(); 441 old_primary_display.id();
441 442
442 const DisplayLayout& layout = GetDisplayManager()->GetCurrentDisplayLayout(); 443 const display::DisplayLayout& layout =
444 GetDisplayManager()->GetCurrentDisplayLayout();
443 // The requested primary id can be same as one in the stored layout 445 // The requested primary id can be same as one in the stored layout
444 // when the primary id is set after new displays are connected. 446 // when the primary id is set after new displays are connected.
445 // Only update the layout if it is requested to swap primary display. 447 // Only update the layout if it is requested to swap primary display.
446 if (layout.primary_id != new_primary_display.id()) { 448 if (layout.primary_id != new_primary_display.id()) {
447 scoped_ptr<DisplayLayout> swapped_layout(layout.Copy()); 449 scoped_ptr<display::DisplayLayout> swapped_layout(layout.Copy());
448 swapped_layout->placement_list[0].Swap(); 450 swapped_layout->placement_list[0].Swap();
449 swapped_layout->primary_id = new_primary_display.id(); 451 swapped_layout->primary_id = new_primary_display.id();
450 DisplayIdList list = display_manager->GetCurrentDisplayIdList(); 452 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList();
451 GetDisplayManager()->layout_store()->RegisterLayoutForDisplayIdList( 453 GetDisplayManager()->layout_store()->RegisterLayoutForDisplayIdList(
452 list, std::move(swapped_layout)); 454 list, std::move(swapped_layout));
453 } 455 }
454 456
455 primary_display_id = new_primary_display.id(); 457 primary_display_id = new_primary_display.id();
456 458
457 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(primary_host), 459 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(primary_host),
458 old_primary_display.GetWorkAreaInsets()); 460 old_primary_display.GetWorkAreaInsets());
459 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(non_primary_host), 461 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(non_primary_host),
460 new_primary_display.GetWorkAreaInsets()); 462 new_primary_display.GetWorkAreaInsets());
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 root_window->GetHost()->ConvertPointToNativeScreen(&point_in_native); 759 root_window->GetHost()->ConvertPointToNativeScreen(&point_in_native);
758 cursor_location_in_native_coords_for_restore_ = point_in_native; 760 cursor_location_in_native_coords_for_restore_ = point_in_native;
759 } 761 }
760 762
761 void WindowTreeHostManager::PostDisplayConfigurationChange() { 763 void WindowTreeHostManager::PostDisplayConfigurationChange() {
762 focus_activation_store_->Restore(); 764 focus_activation_store_->Restore();
763 765
764 DisplayManager* display_manager = GetDisplayManager(); 766 DisplayManager* display_manager = GetDisplayManager();
765 DisplayLayoutStore* layout_store = display_manager->layout_store(); 767 DisplayLayoutStore* layout_store = display_manager->layout_store();
766 if (display_manager->num_connected_displays() > 1) { 768 if (display_manager->num_connected_displays() > 1) {
767 DisplayIdList list = display_manager->GetCurrentDisplayIdList(); 769 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList();
768 const DisplayLayout& layout = 770 const display::DisplayLayout& layout =
769 layout_store->GetRegisteredDisplayLayout(list); 771 layout_store->GetRegisteredDisplayLayout(list);
770 layout_store->UpdateMultiDisplayState( 772 layout_store->UpdateMultiDisplayState(
771 list, display_manager->IsInMirrorMode(), layout.default_unified); 773 list, display_manager->IsInMirrorMode(), layout.default_unified);
772 if (gfx::Screen::GetScreen()->GetNumDisplays() > 1) { 774 if (gfx::Screen::GetScreen()->GetNumDisplays() > 1) {
773 SetPrimaryDisplayId(layout.primary_id == gfx::Display::kInvalidDisplayID 775 SetPrimaryDisplayId(layout.primary_id == gfx::Display::kInvalidDisplayID
774 ? list[0] 776 ? list[0]
775 : layout.primary_id); 777 : layout.primary_id);
776 } 778 }
777 } 779 }
778 780
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 SetDisplayPropertiesOnHost(ash_host, display); 841 SetDisplayPropertiesOnHost(ash_host, display);
840 842
841 #if defined(OS_CHROMEOS) 843 #if defined(OS_CHROMEOS)
842 if (switches::ConstrainPointerToRoot()) 844 if (switches::ConstrainPointerToRoot())
843 ash_host->ConfineCursorToRootWindow(); 845 ash_host->ConfineCursorToRootWindow();
844 #endif 846 #endif
845 return ash_host; 847 return ash_host;
846 } 848 }
847 849
848 } // namespace ash 850 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/unified_mouse_warp_controller.cc ('k') | ash/display/window_tree_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698