| 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 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #if defined(USE_X11) | 9 #if defined(USE_X11) |
| 10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #if defined(USE_X11) | 42 #if defined(USE_X11) |
| 43 #include "ui/gfx/x/x11_types.h" // nogncheck | 43 #include "ui/gfx/x/x11_types.h" // nogncheck |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 namespace ash { | 46 namespace ash { |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 #if defined(USE_X11) | 49 #if defined(USE_X11) |
| 50 // Mirror window shouldn't handle input events. | 50 // Mirror window shouldn't handle input events. |
| 51 void DisableInput(XID window) { | 51 void DisableInput(XID window) { |
| 52 long event_mask = ExposureMask | VisibilityChangeMask | | 52 long event_mask = ExposureMask | VisibilityChangeMask | StructureNotifyMask | |
| 53 StructureNotifyMask | PropertyChangeMask; | 53 PropertyChangeMask; |
| 54 XSelectInput(gfx::GetXDisplay(), window, event_mask); | 54 XSelectInput(gfx::GetXDisplay(), window, event_mask); |
| 55 unsigned char mask[XIMaskLen(XI_LASTEVENT)] = {0}; | 55 unsigned char mask[XIMaskLen(XI_LASTEVENT)] = {0}; |
| 56 XIEventMask evmask; | 56 XIEventMask evmask; |
| 57 evmask.deviceid = XIAllDevices; | 57 evmask.deviceid = XIAllDevices; |
| 58 evmask.mask_len = sizeof(mask); | 58 evmask.mask_len = sizeof(mask); |
| 59 evmask.mask = mask; | 59 evmask.mask = mask; |
| 60 XISelectEvents(gfx::GetXDisplay(), window, &evmask, 1); | 60 XISelectEvents(gfx::GetXDisplay(), window, &evmask, 1); |
| 61 } | 61 } |
| 62 #endif | 62 #endif |
| 63 | 63 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } // namespace | 138 } // namespace |
| 139 | 139 |
| 140 struct MirrorWindowController::MirroringHostInfo { | 140 struct MirrorWindowController::MirroringHostInfo { |
| 141 MirroringHostInfo(); | 141 MirroringHostInfo(); |
| 142 ~MirroringHostInfo(); | 142 ~MirroringHostInfo(); |
| 143 std::unique_ptr<AshWindowTreeHost> ash_host; | 143 std::unique_ptr<AshWindowTreeHost> ash_host; |
| 144 gfx::Size mirror_window_host_size; | 144 gfx::Size mirror_window_host_size; |
| 145 aura::Window* mirror_window = nullptr; | 145 aura::Window* mirror_window = nullptr; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 MirrorWindowController::MirroringHostInfo::MirroringHostInfo() { | 148 MirrorWindowController::MirroringHostInfo::MirroringHostInfo() {} |
| 149 } | 149 MirrorWindowController::MirroringHostInfo::~MirroringHostInfo() {} |
| 150 MirrorWindowController::MirroringHostInfo::~MirroringHostInfo() { | |
| 151 } | |
| 152 | 150 |
| 153 MirrorWindowController::MirrorWindowController() | 151 MirrorWindowController::MirrorWindowController() |
| 154 : multi_display_mode_(DisplayManager::EXTENDED), | 152 : multi_display_mode_(DisplayManager::EXTENDED), |
| 155 screen_position_client_(new MirroringScreenPositionClient(this)) { | 153 screen_position_client_(new MirroringScreenPositionClient(this)) {} |
| 156 } | |
| 157 | 154 |
| 158 MirrorWindowController::~MirrorWindowController() { | 155 MirrorWindowController::~MirrorWindowController() { |
| 159 // Make sure the root window gets deleted before cursor_window_delegate. | 156 // Make sure the root window gets deleted before cursor_window_delegate. |
| 160 Close(false); | 157 Close(false); |
| 161 } | 158 } |
| 162 | 159 |
| 163 void MirrorWindowController::UpdateWindow( | 160 void MirrorWindowController::UpdateWindow( |
| 164 const std::vector<DisplayInfo>& display_info_list) { | 161 const std::vector<DisplayInfo>& display_info_list) { |
| 165 static int mirror_host_count = 0; | 162 static int mirror_host_count = 0; |
| 166 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 163 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // EventProcessor may be accessed after this call if the mirroring window | 380 // EventProcessor may be accessed after this call if the mirroring window |
| 384 // was deleted as a result of input event (e.g. shortcut), so don't delete | 381 // was deleted as a result of input event (e.g. shortcut), so don't delete |
| 385 // now. | 382 // now. |
| 386 if (delay_host_deletion) | 383 if (delay_host_deletion) |
| 387 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); | 384 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); |
| 388 else | 385 else |
| 389 delete host_info; | 386 delete host_info; |
| 390 } | 387 } |
| 391 | 388 |
| 392 } // namespace ash | 389 } // namespace ash |
| OLD | NEW |