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 16 matching lines...) Expand all Loading... |
27 #include "ui/base/layout.h" | 27 #include "ui/base/layout.h" |
28 #include "ui/compositor/reflector.h" | 28 #include "ui/compositor/reflector.h" |
29 #include "ui/gfx/canvas.h" | 29 #include "ui/gfx/canvas.h" |
30 #include "ui/gfx/native_widget_types.h" | 30 #include "ui/gfx/native_widget_types.h" |
31 | 31 |
32 #if defined(USE_X11) | 32 #if defined(USE_X11) |
33 #include "ui/gfx/x/x11_types.h" | 33 #include "ui/gfx/x/x11_types.h" |
34 #endif | 34 #endif |
35 | 35 |
36 namespace ash { | 36 namespace ash { |
37 namespace internal { | |
38 namespace { | 37 namespace { |
39 | 38 |
40 #if defined(USE_X11) | 39 #if defined(USE_X11) |
41 // Mirror window shouldn't handle input events. | 40 // Mirror window shouldn't handle input events. |
42 void DisableInput(XID window) { | 41 void DisableInput(XID window) { |
43 long event_mask = ExposureMask | VisibilityChangeMask | | 42 long event_mask = ExposureMask | VisibilityChangeMask | |
44 StructureNotifyMask | PropertyChangeMask; | 43 StructureNotifyMask | PropertyChangeMask; |
45 XSelectInput(gfx::GetXDisplay(), window, event_mask); | 44 XSelectInput(gfx::GetXDisplay(), window, event_mask); |
46 } | 45 } |
47 #endif | 46 #endif |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } else { | 113 } else { |
115 GetRootWindowSettings(host_->window())->display_id = display_info.id(); | 114 GetRootWindowSettings(host_->window())->display_id = display_info.id(); |
116 host_->SetBounds(display_info.bounds_in_native()); | 115 host_->SetBounds(display_info.bounds_in_native()); |
117 } | 116 } |
118 | 117 |
119 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 118 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
120 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( | 119 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( |
121 Shell::GetScreen()->GetPrimaryDisplay().id()); | 120 Shell::GetScreen()->GetPrimaryDisplay().id()); |
122 DCHECK(display_manager->IsMirrored()); | 121 DCHECK(display_manager->IsMirrored()); |
123 scoped_ptr<aura::RootWindowTransformer> transformer( | 122 scoped_ptr<aura::RootWindowTransformer> transformer( |
124 internal::CreateRootWindowTransformerForMirroredDisplay( | 123 CreateRootWindowTransformerForMirroredDisplay(source_display_info, |
125 source_display_info, | 124 display_info)); |
126 display_info)); | |
127 host_->SetRootWindowTransformer(transformer.Pass()); | 125 host_->SetRootWindowTransformer(transformer.Pass()); |
128 } | 126 } |
129 | 127 |
130 void MirrorWindowController::UpdateWindow() { | 128 void MirrorWindowController::UpdateWindow() { |
131 if (host_.get()) { | 129 if (host_.get()) { |
132 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 130 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
133 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( | 131 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( |
134 display_manager->mirrored_display_id()); | 132 display_manager->mirrored_display_id()); |
135 UpdateWindow(mirror_display_info); | 133 UpdateWindow(mirror_display_info); |
136 } | 134 } |
(...skipping 27 matching lines...) Expand all Loading... |
164 | 162 |
165 scoped_ptr<aura::RootWindowTransformer> | 163 scoped_ptr<aura::RootWindowTransformer> |
166 MirrorWindowController::CreateRootWindowTransformer() const { | 164 MirrorWindowController::CreateRootWindowTransformer() const { |
167 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 165 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
168 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( | 166 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( |
169 display_manager->mirrored_display_id()); | 167 display_manager->mirrored_display_id()); |
170 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( | 168 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( |
171 Shell::GetScreen()->GetPrimaryDisplay().id()); | 169 Shell::GetScreen()->GetPrimaryDisplay().id()); |
172 DCHECK(display_manager->IsMirrored()); | 170 DCHECK(display_manager->IsMirrored()); |
173 return scoped_ptr<aura::RootWindowTransformer>( | 171 return scoped_ptr<aura::RootWindowTransformer>( |
174 internal::CreateRootWindowTransformerForMirroredDisplay( | 172 CreateRootWindowTransformerForMirroredDisplay(source_display_info, |
175 source_display_info, | 173 mirror_display_info)); |
176 mirror_display_info)); | |
177 } | 174 } |
178 | 175 |
179 } // namespace internal | |
180 } // namespace ash | 176 } // namespace ash |
OLD | NEW |