OLD | NEW |
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // No need to remove RootWindowObserver because | 172 // No need to remove RootWindowObserver because |
173 // the DisplayController object outlives RootWindow objects. | 173 // the DisplayController object outlives RootWindow objects. |
174 root_window_->AddRootWindowObserver( | 174 root_window_->AddRootWindowObserver( |
175 Shell::GetInstance()->display_controller()); | 175 Shell::GetInstance()->display_controller()); |
176 root_window_->AddRootWindowObserver(this); | 176 root_window_->AddRootWindowObserver(this); |
177 // TODO(oshima): TouchHUD is using idkey. | 177 // TODO(oshima): TouchHUD is using idkey. |
178 InitRootWindowSettings(root_window_->window())->display_id = | 178 InitRootWindowSettings(root_window_->window())->display_id = |
179 display_info.id(); | 179 display_info.id(); |
180 root_window_->Init(); | 180 root_window_->Init(); |
181 #if defined(USE_X11) | 181 #if defined(USE_X11) |
182 DisableInput(root_window_->GetAcceleratedWidget()); | 182 DisableInput(root_window_->host()->GetAcceleratedWidget()); |
183 #endif | 183 #endif |
184 | 184 |
185 aura::client::SetCaptureClient(root_window_->window(), | 185 aura::client::SetCaptureClient(root_window_->window(), |
186 new NoneCaptureClient()); | 186 new NoneCaptureClient()); |
187 root_window_->ShowRootWindow(); | 187 root_window_->host()->Show(); |
188 | 188 |
189 // TODO(oshima): Start mirroring. | 189 // TODO(oshima): Start mirroring. |
190 aura::Window* mirror_window = new aura::Window(NULL); | 190 aura::Window* mirror_window = new aura::Window(NULL); |
191 mirror_window->Init(ui::LAYER_TEXTURED); | 191 mirror_window->Init(ui::LAYER_TEXTURED); |
192 root_window_->window()->AddChild(mirror_window); | 192 root_window_->window()->AddChild(mirror_window); |
193 mirror_window->SetBounds(root_window_->window()->bounds()); | 193 mirror_window->SetBounds(root_window_->window()->bounds()); |
194 mirror_window->Show(); | 194 mirror_window->Show(); |
195 reflector_ = ui::ContextFactory::GetInstance()->CreateReflector( | 195 reflector_ = ui::ContextFactory::GetInstance()->CreateReflector( |
196 Shell::GetPrimaryRootWindow()->GetDispatcher()->compositor(), | 196 Shell::GetPrimaryRootWindow()->GetDispatcher()->compositor(), |
197 mirror_window->layer()); | 197 mirror_window->layer()); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 void MirrorWindowController::SetMirroredCursorVisibility(bool visible) { | 315 void MirrorWindowController::SetMirroredCursorVisibility(bool visible) { |
316 if (cursor_window_) | 316 if (cursor_window_) |
317 visible ? cursor_window_->Show() : cursor_window_->Hide(); | 317 visible ? cursor_window_->Show() : cursor_window_->Hide(); |
318 } | 318 } |
319 | 319 |
320 void MirrorWindowController::OnRootWindowHostResized( | 320 void MirrorWindowController::OnRootWindowHostResized( |
321 const aura::RootWindow* root) { | 321 const aura::RootWindow* root) { |
322 // Do not use |old_size| as it contains RootWindow's (but not host's) size, | 322 // Do not use |old_size| as it contains RootWindow's (but not host's) size, |
323 // and this parameter wil be removed soon. | 323 // and this parameter wil be removed soon. |
324 if (mirror_window_host_size_ == root->GetHostSize()) | 324 if (mirror_window_host_size_ == root->host()->GetBounds().size()) |
325 return; | 325 return; |
326 mirror_window_host_size_ = root->GetHostSize(); | 326 mirror_window_host_size_ = root->host()->GetBounds().size(); |
327 reflector_->OnMirroringCompositorResized(); | 327 reflector_->OnMirroringCompositorResized(); |
328 root_window_->SetRootWindowTransformer( | 328 root_window_->SetRootWindowTransformer( |
329 CreateRootWindowTransformer().Pass()); | 329 CreateRootWindowTransformer().Pass()); |
330 UpdateCursorLocation(); | 330 UpdateCursorLocation(); |
331 } | 331 } |
332 | 332 |
333 | 333 |
334 scoped_ptr<aura::RootWindowTransformer> | 334 scoped_ptr<aura::RootWindowTransformer> |
335 MirrorWindowController::CreateRootWindowTransformer() const { | 335 MirrorWindowController::CreateRootWindowTransformer() const { |
336 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 336 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
337 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( | 337 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( |
338 display_manager->mirrored_display_id()); | 338 display_manager->mirrored_display_id()); |
339 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( | 339 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( |
340 Shell::GetScreen()->GetPrimaryDisplay().id()); | 340 Shell::GetScreen()->GetPrimaryDisplay().id()); |
341 DCHECK(display_manager->IsMirrored()); | 341 DCHECK(display_manager->IsMirrored()); |
342 return scoped_ptr<aura::RootWindowTransformer>( | 342 return scoped_ptr<aura::RootWindowTransformer>( |
343 internal::CreateRootWindowTransformerForMirroredDisplay( | 343 internal::CreateRootWindowTransformerForMirroredDisplay( |
344 source_display_info, | 344 source_display_info, |
345 mirror_display_info)); | 345 mirror_display_info)); |
346 } | 346 } |
347 | 347 |
348 } // namespace internal | 348 } // namespace internal |
349 } // namespace ash | 349 } // namespace ash |
OLD | NEW |