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

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

Issue 2319933002: X11: Remove calls to XSelectInput (Closed)
Patch Set: Comments Created 4 years, 3 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
« no previous file with comments | « no previous file | ui/aura/window_tree_host_x11.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 22 matching lines...) Expand all
33 #include "ui/aura/window_tree_host.h" 33 #include "ui/aura/window_tree_host.h"
34 #include "ui/base/layout.h" 34 #include "ui/base/layout.h"
35 #include "ui/compositor/reflector.h" 35 #include "ui/compositor/reflector.h"
36 #include "ui/display/manager/display_layout.h" 36 #include "ui/display/manager/display_layout.h"
37 #include "ui/display/manager/managed_display_info.h" 37 #include "ui/display/manager/managed_display_info.h"
38 #include "ui/display/screen.h" 38 #include "ui/display/screen.h"
39 #include "ui/gfx/canvas.h" 39 #include "ui/gfx/canvas.h"
40 #include "ui/gfx/native_widget_types.h" 40 #include "ui/gfx/native_widget_types.h"
41 41
42 #if defined(USE_X11) 42 #if defined(USE_X11)
43 #include "ui/aura/window_tree_host_x11.h"
43 #include "ui/gfx/x/x11_types.h" // nogncheck 44 #include "ui/gfx/x/x11_types.h" // nogncheck
44 #endif 45 #endif
45 46
46 namespace ash { 47 namespace ash {
47 namespace { 48 namespace {
48 49
49 #if defined(USE_X11)
50 // Mirror window shouldn't handle input events.
51 void DisableInput(XID window) {
52 long event_mask = ExposureMask | VisibilityChangeMask | StructureNotifyMask |
53 PropertyChangeMask;
54 XSelectInput(gfx::GetXDisplay(), window, event_mask);
55 unsigned char mask[XIMaskLen(XI_LASTEVENT)] = {0};
56 XIEventMask evmask;
57 evmask.deviceid = XIAllDevices;
58 evmask.mask_len = sizeof(mask);
59 evmask.mask = mask;
60 XISelectEvents(gfx::GetXDisplay(), window, &evmask, 1);
61 }
62 #endif
63
64 // ScreenPositionClient for mirroring windows. 50 // ScreenPositionClient for mirroring windows.
65 class MirroringScreenPositionClient 51 class MirroringScreenPositionClient
66 : public aura::client::ScreenPositionClient { 52 : public aura::client::ScreenPositionClient {
67 public: 53 public:
68 explicit MirroringScreenPositionClient(MirrorWindowController* controller) 54 explicit MirroringScreenPositionClient(MirrorWindowController* controller)
69 : controller_(controller) {} 55 : controller_(controller) {}
70 56
71 void ConvertPointToScreen(const aura::Window* window, 57 void ConvertPointToScreen(const aura::Window* window,
72 gfx::Point* point) override { 58 gfx::Point* point) override {
73 const aura::Window* root = window->GetRootWindow(); 59 const aura::Window* root = window->GetRootWindow();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 host_info->ash_host.reset(AshWindowTreeHost::Create(init_params)); 176 host_info->ash_host.reset(AshWindowTreeHost::Create(init_params));
191 mirroring_host_info_map_[display_info.id()] = host_info; 177 mirroring_host_info_map_[display_info.id()] = host_info;
192 178
193 aura::WindowTreeHost* host = host_info->ash_host->AsWindowTreeHost(); 179 aura::WindowTreeHost* host = host_info->ash_host->AsWindowTreeHost();
194 host->SetSharedInputMethod( 180 host->SetSharedInputMethod(
195 Shell::GetInstance()->window_tree_host_manager()->input_method()); 181 Shell::GetInstance()->window_tree_host_manager()->input_method());
196 host->window()->SetName( 182 host->window()->SetName(
197 base::StringPrintf("MirrorRootWindow-%d", mirror_host_count++)); 183 base::StringPrintf("MirrorRootWindow-%d", mirror_host_count++));
198 host->compositor()->SetBackgroundColor(SK_ColorBLACK); 184 host->compositor()->SetBackgroundColor(SK_ColorBLACK);
199 // No need to remove the observer because the WindowTreeHostManager 185 // No need to remove the observer because the WindowTreeHostManager
200 // outlives 186 // outlives the host.
201 // the
202 // host.
203 host->AddObserver(Shell::GetInstance()->window_tree_host_manager()); 187 host->AddObserver(Shell::GetInstance()->window_tree_host_manager());
204 host->AddObserver(this); 188 host->AddObserver(this);
205 // TODO(oshima): TouchHUD is using idkey. 189 // TODO(oshima): TouchHUD is using idkey.
206 InitRootWindowSettings(host->window())->display_id = display_info.id(); 190 InitRootWindowSettings(host->window())->display_id = display_info.id();
207 host->InitHost(); 191 host->InitHost();
208 #if defined(USE_X11) 192 #if defined(USE_X11)
209 if (!display_manager->IsInUnifiedMode()) 193 if (!display_manager->IsInUnifiedMode()) {
210 DisableInput(host->GetAcceleratedWidget()); 194 // Mirror window shouldn't handle input events.
195 static_cast<aura::WindowTreeHostX11*>(host)->DisableInput();
196 }
211 #endif 197 #endif
212 198
213 #if defined(OS_CHROMEOS) 199 #if defined(OS_CHROMEOS)
214 if (display_manager->IsInUnifiedMode()) { 200 if (display_manager->IsInUnifiedMode()) {
215 host_info->ash_host->ConfineCursorToRootWindow(); 201 host_info->ash_host->ConfineCursorToRootWindow();
216 AshWindowTreeHost* unified_ash_host = 202 AshWindowTreeHost* unified_ash_host =
217 Shell::GetInstance() 203 Shell::GetInstance()
218 ->window_tree_host_manager() 204 ->window_tree_host_manager()
219 ->GetAshWindowTreeHostForDisplayId( 205 ->GetAshWindowTreeHostForDisplayId(
220 display::Screen::GetScreen()->GetPrimaryDisplay().id()); 206 display::Screen::GetScreen()->GetPrimaryDisplay().id());
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // EventProcessor may be accessed after this call if the mirroring window 365 // EventProcessor may be accessed after this call if the mirroring window
380 // was deleted as a result of input event (e.g. shortcut), so don't delete 366 // was deleted as a result of input event (e.g. shortcut), so don't delete
381 // now. 367 // now.
382 if (delay_host_deletion) 368 if (delay_host_deletion)
383 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); 369 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info);
384 else 370 else
385 delete host_info; 371 delete host_info;
386 } 372 }
387 373
388 } // namespace ash 374 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/aura/window_tree_host_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698