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

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

Issue 948583005: Add more tests for mouse rotation,scale&position after display change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « ash/display/display_controller.h ('k') | ash/display/display_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 std::vector<DisplayInfo> display_info_list; 531 std::vector<DisplayInfo> display_info_list;
532 display_info_list.push_back(display_manager->GetDisplayInfo( 532 display_info_list.push_back(display_manager->GetDisplayInfo(
533 primary_display_id)); 533 primary_display_id));
534 display_info_list.push_back(display_manager->GetDisplayInfo( 534 display_info_list.push_back(display_manager->GetDisplayInfo(
535 ScreenUtil::GetSecondaryDisplay().id())); 535 ScreenUtil::GetSecondaryDisplay().id()));
536 GetDisplayManager()->set_force_bounds_changed(true); 536 GetDisplayManager()->set_force_bounds_changed(true);
537 GetDisplayManager()->UpdateDisplays(display_info_list); 537 GetDisplayManager()->UpdateDisplays(display_info_list);
538 GetDisplayManager()->set_force_bounds_changed(false); 538 GetDisplayManager()->set_force_bounds_changed(false);
539 } 539 }
540 540
541 void DisplayController::EnsurePointerInDisplays() { 541 void DisplayController::UpdateMouseLocationAfterDisplayChange() {
542 // If the mouse is currently on a display in native location, 542 // If the mouse is currently on a display in native location,
543 // use the same native location. Otherwise find the display closest 543 // use the same native location. Otherwise find the display closest
544 // to the current cursor location in screen coordinates. 544 // to the current cursor location in screen coordinates.
545 545
546 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); 546 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint();
547 gfx::Point target_location_in_native; 547 gfx::Point target_location_in_native;
548 int64 closest_distance_squared = -1; 548 int64 closest_distance_squared = -1;
549 DisplayManager* display_manager = GetDisplayManager(); 549 DisplayManager* display_manager = GetDisplayManager();
550 550
551 aura::Window* dst_root_window = NULL; 551 aura::Window* dst_root_window = NULL;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 // Update the primary_id in case the above call is 774 // Update the primary_id in case the above call is
775 // ignored. Happens when a) default layout's primary id 775 // ignored. Happens when a) default layout's primary id
776 // doesn't exist, or b) the primary_id has already been 776 // doesn't exist, or b) the primary_id has already been
777 // set to the same and didn't update it. 777 // set to the same and didn't update it.
778 layout_store->UpdatePrimaryDisplayId( 778 layout_store->UpdatePrimaryDisplayId(
779 pair, Shell::GetScreen()->GetPrimaryDisplay().id()); 779 pair, Shell::GetScreen()->GetPrimaryDisplay().id());
780 } 780 }
781 } 781 }
782 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); 782 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged());
783 UpdateHostWindowNames(); 783 UpdateHostWindowNames();
784 EnsurePointerInDisplays(); 784 UpdateMouseLocationAfterDisplayChange();
785 } 785 }
786 786
787 AshWindowTreeHost* DisplayController::AddWindowTreeHostForDisplay( 787 AshWindowTreeHost* DisplayController::AddWindowTreeHostForDisplay(
788 const gfx::Display& display, 788 const gfx::Display& display,
789 const AshWindowTreeHostInitParams& init_params) { 789 const AshWindowTreeHostInitParams& init_params) {
790 static int host_count = 0; 790 static int host_count = 0;
791 const DisplayInfo& display_info = 791 const DisplayInfo& display_info =
792 GetDisplayManager()->GetDisplayInfo(display.id()); 792 GetDisplayManager()->GetDisplayInfo(display.id());
793 AshWindowTreeHostInitParams params_with_bounds(init_params); 793 AshWindowTreeHostInitParams params_with_bounds(init_params);
794 params_with_bounds.initial_bounds = display_info.bounds_in_native(); 794 params_with_bounds.initial_bounds = display_info.bounds_in_native();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 std::string name = 840 std::string name =
841 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; 841 root_windows[i] == primary ? "aura_root_0" : "aura_root_x";
842 gfx::AcceleratedWidget xwindow = 842 gfx::AcceleratedWidget xwindow =
843 root_windows[i]->GetHost()->GetAcceleratedWidget(); 843 root_windows[i]->GetHost()->GetAcceleratedWidget();
844 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); 844 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str());
845 } 845 }
846 #endif 846 #endif
847 } 847 }
848 848
849 } // namespace ash 849 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_controller.h ('k') | ash/display/display_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698