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

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

Issue 10790090: Enable Virtual Screen Coordinates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ash/display/multi_display_manager_unittest.cc ('k') | ash/extended_desktop_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/screen_position_controller.h" 5 #include "ash/display/screen_position_controller.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/system_modal_container_layout_manager.h" 10 #include "ash/wm/system_modal_container_layout_manager.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 } // namespace 50 } // namespace
51 51
52 namespace internal { 52 namespace internal {
53 53
54 void ScreenPositionController::ConvertPointToScreen( 54 void ScreenPositionController::ConvertPointToScreen(
55 const aura::Window* window, 55 const aura::Window* window,
56 gfx::Point* point) { 56 gfx::Point* point) {
57 const aura::RootWindow* root = window->GetRootWindow(); 57 const aura::RootWindow* root = window->GetRootWindow();
58 aura::Window::ConvertPointToWindow(window, root, point); 58 aura::Window::ConvertPointToWindow(window, root, point);
59 if (DisplayController::IsVirtualScreenCoordinatesEnabled()) { 59 if (DisplayController::IsExtendedDesktopEnabled()) {
60 const gfx::Point display_origin = 60 const gfx::Point display_origin =
61 gfx::Screen::GetDisplayNearestWindow( 61 gfx::Screen::GetDisplayNearestWindow(
62 const_cast<aura::RootWindow*>(root)).bounds().origin(); 62 const_cast<aura::RootWindow*>(root)).bounds().origin();
63 point->Offset(display_origin.x(), display_origin.y()); 63 point->Offset(display_origin.x(), display_origin.y());
64 } 64 }
65 } 65 }
66 66
67 void ScreenPositionController::ConvertPointFromScreen( 67 void ScreenPositionController::ConvertPointFromScreen(
68 const aura::Window* window, 68 const aura::Window* window,
69 gfx::Point* point) { 69 gfx::Point* point) {
70 const aura::RootWindow* root = window->GetRootWindow(); 70 const aura::RootWindow* root = window->GetRootWindow();
71 if (DisplayController::IsVirtualScreenCoordinatesEnabled()) { 71 if (DisplayController::IsExtendedDesktopEnabled()) {
72 const gfx::Point display_origin = 72 const gfx::Point display_origin =
73 gfx::Screen::GetDisplayNearestWindow( 73 gfx::Screen::GetDisplayNearestWindow(
74 const_cast<aura::RootWindow*>(root)).bounds().origin(); 74 const_cast<aura::RootWindow*>(root)).bounds().origin();
75 point->Offset(-display_origin.x(), -display_origin.y()); 75 point->Offset(-display_origin.x(), -display_origin.y());
76 } 76 }
77 aura::Window::ConvertPointToWindow(root, window, point); 77 aura::Window::ConvertPointToWindow(root, window, point);
78 } 78 }
79 79
80 void ScreenPositionController::SetBounds( 80 void ScreenPositionController::SetBounds(
81 aura::Window* window, 81 aura::Window* window,
82 const gfx::Rect& bounds) { 82 const gfx::Rect& bounds) {
83 if (!DisplayController::IsVirtualScreenCoordinatesEnabled() || 83 if (!DisplayController::IsExtendedDesktopEnabled() ||
84 !window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { 84 !window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) {
85 window->SetBounds(bounds); 85 window->SetBounds(bounds);
86 return; 86 return;
87 } 87 }
88 88
89 // Don't move a transient windows to other root window. 89 // Don't move a transient windows to other root window.
90 // It moves when its transient_parent moves. 90 // It moves when its transient_parent moves.
91 if (!window->transient_parent()) { 91 if (!window->transient_parent()) {
92 aura::RootWindow* dst_root = Shell::GetRootWindowMatching(bounds); 92 aura::RootWindow* dst_root = Shell::GetRootWindowMatching(bounds);
93 aura::Window* dst_container = NULL; 93 aura::Window* dst_container = NULL;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 gfx::Point origin(bounds.origin()); 128 gfx::Point origin(bounds.origin());
129 const gfx::Point display_origin = 129 const gfx::Point display_origin =
130 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin(); 130 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin();
131 origin.Offset(-display_origin.x(), -display_origin.y()); 131 origin.Offset(-display_origin.x(), -display_origin.y());
132 window->SetBounds(gfx::Rect(origin, bounds.size())); 132 window->SetBounds(gfx::Rect(origin, bounds.size()));
133 } 133 }
134 134
135 } // internal 135 } // internal
136 } // ash 136 } // ash
OLDNEW
« no previous file with comments | « ash/display/multi_display_manager_unittest.cc ('k') | ash/extended_desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698