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. |
11 #undef RootWindow | 11 #undef RootWindow |
12 #endif | 12 #endif |
13 | 13 |
14 #include "ash/display/display_controller.h" | 14 #include "ash/display/display_controller.h" |
15 #include "ash/display/display_info.h" | 15 #include "ash/display/display_info.h" |
16 #include "ash/display/display_manager.h" | 16 #include "ash/display/display_manager.h" |
17 #include "ash/display/root_window_transformers.h" | 17 #include "ash/display/root_window_transformers.h" |
18 #include "ash/host/root_window_host_factory.h" | 18 #include "ash/host/root_window_host_factory.h" |
| 19 #include "ash/root_window_settings.h" |
19 #include "ash/shell.h" | 20 #include "ash/shell.h" |
20 #include "ash/wm/window_properties.h" | |
21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
22 #include "ui/aura/client/capture_client.h" | 22 #include "ui/aura/client/capture_client.h" |
23 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
24 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
25 #include "ui/aura/root_window_transformer.h" | 25 #include "ui/aura/root_window_transformer.h" |
26 #include "ui/aura/window_delegate.h" | 26 #include "ui/aura/window_delegate.h" |
27 #include "ui/base/cursor/cursors_aura.h" | 27 #include "ui/base/cursor/cursors_aura.h" |
28 #include "ui/base/hit_test.h" | 28 #include "ui/base/hit_test.h" |
29 #include "ui/base/layout.h" | 29 #include "ui/base/layout.h" |
30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 root_window_.reset(new aura::RootWindow(params)); | 167 root_window_.reset(new aura::RootWindow(params)); |
168 root_window_->SetName( | 168 root_window_->SetName( |
169 base::StringPrintf("MirrorRootWindow-%d", mirror_root_window_count++)); | 169 base::StringPrintf("MirrorRootWindow-%d", mirror_root_window_count++)); |
170 root_window_->compositor()->SetBackgroundColor(SK_ColorBLACK); | 170 root_window_->compositor()->SetBackgroundColor(SK_ColorBLACK); |
171 // No need to remove RootWindowObserver because | 171 // No need to remove RootWindowObserver because |
172 // the DisplayController object outlives RootWindow objects. | 172 // the DisplayController object outlives RootWindow objects. |
173 root_window_->AddRootWindowObserver( | 173 root_window_->AddRootWindowObserver( |
174 Shell::GetInstance()->display_controller()); | 174 Shell::GetInstance()->display_controller()); |
175 root_window_->AddRootWindowObserver(this); | 175 root_window_->AddRootWindowObserver(this); |
176 // TODO(oshima): TouchHUD is using idkey. | 176 // TODO(oshima): TouchHUD is using idkey. |
177 root_window_->SetProperty(internal::kDisplayIdKey, display_info.id()); | 177 InitRootWindowSettings(root_window_.get())->display_id = display_info.id(); |
178 root_window_->Init(); | 178 root_window_->Init(); |
179 #if defined(USE_X11) | 179 #if defined(USE_X11) |
180 DisableInput(root_window_->GetAcceleratedWidget()); | 180 DisableInput(root_window_->GetAcceleratedWidget()); |
181 #endif | 181 #endif |
182 | 182 |
183 aura::client::SetCaptureClient(root_window_.get(), new NoneCaptureClient()); | 183 aura::client::SetCaptureClient(root_window_.get(), new NoneCaptureClient()); |
184 root_window_->ShowRootWindow(); | 184 root_window_->ShowRootWindow(); |
185 | 185 |
186 // TODO(oshima): Start mirroring. | 186 // TODO(oshima): Start mirroring. |
187 aura::Window* mirror_window = new aura::Window(NULL); | 187 aura::Window* mirror_window = new aura::Window(NULL); |
188 mirror_window->Init(ui::LAYER_TEXTURED); | 188 mirror_window->Init(ui::LAYER_TEXTURED); |
189 root_window_->AddChild(mirror_window); | 189 root_window_->AddChild(mirror_window); |
190 mirror_window->SetBounds(root_window_->bounds()); | 190 mirror_window->SetBounds(root_window_->bounds()); |
191 mirror_window->Show(); | 191 mirror_window->Show(); |
192 reflector_ = ui::ContextFactory::GetInstance()-> | 192 reflector_ = ui::ContextFactory::GetInstance()-> |
193 CreateReflector(Shell::GetPrimaryRootWindow()->compositor(), | 193 CreateReflector(Shell::GetPrimaryRootWindow()->compositor(), |
194 mirror_window->layer()); | 194 mirror_window->layer()); |
195 | 195 |
196 cursor_window_ = new aura::Window(cursor_window_delegate_.get()); | 196 cursor_window_ = new aura::Window(cursor_window_delegate_.get()); |
197 cursor_window_->SetTransparent(true); | 197 cursor_window_->SetTransparent(true); |
198 cursor_window_->Init(ui::LAYER_TEXTURED); | 198 cursor_window_->Init(ui::LAYER_TEXTURED); |
199 root_window_->AddChild(cursor_window_); | 199 root_window_->AddChild(cursor_window_); |
200 cursor_window_->Show(); | 200 cursor_window_->Show(); |
201 } else { | 201 } else { |
202 root_window_->SetProperty(internal::kDisplayIdKey, display_info.id()); | 202 GetRootWindowSettings(root_window_.get())->display_id = display_info.id(); |
203 root_window_->SetHostBounds(display_info.bounds_in_pixel()); | 203 root_window_->SetHostBounds(display_info.bounds_in_pixel()); |
204 } | 204 } |
205 | 205 |
206 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 206 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
207 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( | 207 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( |
208 Shell::GetScreen()->GetPrimaryDisplay().id()); | 208 Shell::GetScreen()->GetPrimaryDisplay().id()); |
209 DCHECK(display_manager->mirrored_display().is_valid()); | 209 DCHECK(display_manager->mirrored_display().is_valid()); |
210 scoped_ptr<aura::RootWindowTransformer> transformer( | 210 scoped_ptr<aura::RootWindowTransformer> transformer( |
211 internal::CreateRootWindowTransformerForMirroredDisplay( | 211 internal::CreateRootWindowTransformerForMirroredDisplay( |
212 source_display_info, | 212 source_display_info, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 Shell::GetScreen()->GetPrimaryDisplay().id()); | 335 Shell::GetScreen()->GetPrimaryDisplay().id()); |
336 DCHECK(display_manager->mirrored_display().is_valid()); | 336 DCHECK(display_manager->mirrored_display().is_valid()); |
337 return scoped_ptr<aura::RootWindowTransformer>( | 337 return scoped_ptr<aura::RootWindowTransformer>( |
338 internal::CreateRootWindowTransformerForMirroredDisplay( | 338 internal::CreateRootWindowTransformerForMirroredDisplay( |
339 source_display_info, | 339 source_display_info, |
340 mirror_display_info)); | 340 mirror_display_info)); |
341 } | 341 } |
342 | 342 |
343 } // namespace internal | 343 } // namespace internal |
344 } // namespace ash | 344 } // namespace ash |
OLD | NEW |