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

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

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/mirror_window_controller.h" 5 #include "ash/display/mirror_window_controller.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 // Xlib.h defines RootWindow. 10 // Xlib.h defines RootWindow.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 aura::client::SetCaptureClient(root_window_.get(), new NoneCaptureClient()); 181 aura::client::SetCaptureClient(root_window_.get(), new NoneCaptureClient());
182 root_window_->ShowRootWindow(); 182 root_window_->ShowRootWindow();
183 183
184 // TODO(oshima): Start mirroring. 184 // TODO(oshima): Start mirroring.
185 aura::Window* mirror_window = new aura::Window(NULL); 185 aura::Window* mirror_window = new aura::Window(NULL);
186 mirror_window->Init(ui::LAYER_TEXTURED); 186 mirror_window->Init(ui::LAYER_TEXTURED);
187 root_window_->AddChild(mirror_window); 187 root_window_->AddChild(mirror_window);
188 mirror_window->SetBounds(root_window_->bounds()); 188 mirror_window->SetBounds(root_window_->bounds());
189 mirror_window->Show(); 189 mirror_window->Show();
190 reflector_ = ui::ContextFactory::GetInstance()-> 190 reflector_ = ui::ContextFactory::GetInstance()->CreateReflector(
191 CreateReflector(Shell::GetPrimaryRootWindow()->compositor(), 191 Shell::GetPrimaryRootWindow()->GetDispatcher()->compositor(),
192 mirror_window->layer()); 192 mirror_window->layer());
193 193
194 cursor_window_ = new aura::Window(cursor_window_delegate_.get()); 194 cursor_window_ = new aura::Window(cursor_window_delegate_.get());
195 cursor_window_->SetTransparent(true); 195 cursor_window_->SetTransparent(true);
196 cursor_window_->Init(ui::LAYER_TEXTURED); 196 cursor_window_->Init(ui::LAYER_TEXTURED);
197 root_window_->AddChild(cursor_window_); 197 root_window_->AddChild(cursor_window_);
198 cursor_window_->Show(); 198 cursor_window_->Show();
199 } else { 199 } else {
200 GetRootWindowSettings(root_window_.get())->display_id = display_info.id(); 200 GetRootWindowSettings(root_window_.get())->display_id = display_info.id();
201 root_window_->SetHostBounds(display_info.bounds_in_native()); 201 root_window_->SetHostBounds(display_info.bounds_in_native());
202 } 202 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 root_window_->RemoveRootWindowObserver(this); 237 root_window_->RemoveRootWindowObserver(this);
238 root_window_.reset(); 238 root_window_.reset();
239 cursor_window_ = NULL; 239 cursor_window_ = NULL;
240 } 240 }
241 } 241 }
242 242
243 void MirrorWindowController::UpdateCursorLocation() { 243 void MirrorWindowController::UpdateCursorLocation() {
244 if (cursor_window_) { 244 if (cursor_window_) {
245 // TODO(oshima): Rotate cursor image (including hotpoint). 245 // TODO(oshima): Rotate cursor image (including hotpoint).
246 gfx::Point point = aura::Env::GetInstance()->last_mouse_location(); 246 gfx::Point point = aura::Env::GetInstance()->last_mouse_location();
247 Shell::GetPrimaryRootWindow()->ConvertPointToHost(&point); 247 Shell::GetPrimaryRootWindow()->GetDispatcher()->ConvertPointToHost(&point);
248 point.Offset(-hot_point_.x(), -hot_point_.y()); 248 point.Offset(-hot_point_.x(), -hot_point_.y());
249 gfx::Rect bounds = cursor_window_->bounds(); 249 gfx::Rect bounds = cursor_window_->bounds();
250 bounds.set_origin(point); 250 bounds.set_origin(point);
251 cursor_window_->SetBounds(bounds); 251 cursor_window_->SetBounds(bounds);
252 } 252 }
253 } 253 }
254 254
255 void MirrorWindowController::SetMirroredCursor(gfx::NativeCursor cursor) { 255 void MirrorWindowController::SetMirroredCursor(gfx::NativeCursor cursor) {
256 const gfx::Display& display = Shell::GetScreen()->GetPrimaryDisplay(); 256 const gfx::Display& display = Shell::GetScreen()->GetPrimaryDisplay();
257 if (current_cursor_type_ == cursor.native_type() && 257 if (current_cursor_type_ == cursor.native_type() &&
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 Shell::GetScreen()->GetPrimaryDisplay().id()); 334 Shell::GetScreen()->GetPrimaryDisplay().id());
335 DCHECK(display_manager->mirrored_display().is_valid()); 335 DCHECK(display_manager->mirrored_display().is_valid());
336 return scoped_ptr<aura::RootWindowTransformer>( 336 return scoped_ptr<aura::RootWindowTransformer>(
337 internal::CreateRootWindowTransformerForMirroredDisplay( 337 internal::CreateRootWindowTransformerForMirroredDisplay(
338 source_display_info, 338 source_display_info,
339 mirror_display_info)); 339 mirror_display_info));
340 } 340 }
341 341
342 } // namespace internal 342 } // namespace internal
343 } // namespace ash 343 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | ash/display/mirror_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698