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

Side by Side Diff: components/mus/ws/window_tree_host_impl.cc

Issue 1755223002: Adds WindowManagerManager to mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and WindowManagerState Created 4 years, 9 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 | « components/mus/ws/window_tree_host_impl.h ('k') | components/mus/ws/window_tree_impl.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/ws/window_tree_host_impl.h" 5 #include "components/mus/ws/window_tree_host_impl.h"
6 6
7 #include "base/debug/debugger.h" 7 #include "base/debug/debugger.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/mus/common/types.h" 9 #include "components/mus/common/types.h"
10 // #include "components/mus/public/interfaces/input_event_constants.mojom.h"
11 #include "components/mus/ws/client_connection.h"
10 #include "components/mus/ws/connection_manager.h" 12 #include "components/mus/ws/connection_manager.h"
13 #include "components/mus/ws/connection_manager_delegate.h"
11 #include "components/mus/ws/display_manager.h" 14 #include "components/mus/ws/display_manager.h"
12 #include "components/mus/ws/focus_controller.h" 15 #include "components/mus/ws/focus_controller.h"
16 #include "components/mus/ws/window_manager_factory_service.h"
17 #include "components/mus/ws/window_manager_state.h"
13 #include "components/mus/ws/window_tree_host_connection.h" 18 #include "components/mus/ws/window_tree_host_connection.h"
14 #include "components/mus/ws/window_tree_impl.h" 19 #include "components/mus/ws/window_tree_impl.h"
15 #include "mojo/common/common_type_converters.h" 20 #include "mojo/common/common_type_converters.h"
16 #include "mojo/converters/geometry/geometry_type_converters.h" 21 #include "mojo/converters/geometry/geometry_type_converters.h"
17 #include "mojo/converters/input_events/input_events_type_converters.h" 22 #include "mojo/converters/input_events/input_events_type_converters.h"
18 23
19 namespace mus { 24 namespace mus {
20 namespace ws { 25 namespace ws {
21 namespace { 26 namespace {
22 27
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 frame_decoration_values_->maximized_client_area_insets = mojo::Insets::New(); 104 frame_decoration_values_->maximized_client_area_insets = mojo::Insets::New();
100 frame_decoration_values_->max_title_bar_button_width = 0u; 105 frame_decoration_values_->max_title_bar_button_width = 0u;
101 106
102 display_manager_->Init(this); 107 display_manager_->Init(this);
103 } 108 }
104 109
105 WindowTreeHostImpl::~WindowTreeHostImpl() { 110 WindowTreeHostImpl::~WindowTreeHostImpl() {
106 DestroyFocusController(); 111 DestroyFocusController();
107 for (ServerWindow* window : windows_needing_frame_destruction_) 112 for (ServerWindow* window : windows_needing_frame_destruction_)
108 window->RemoveObserver(this); 113 window->RemoveObserver(this);
114
115 // TODO(sky): this may leave the WindowTreeImpls associated with the
116 // WindowManagerStates still alive. The shutdown ordering is a bit iffy,
117 // figure out what it should be. ConnectionManager::OnConnectionError()
118 // has a check that effects this too.
109 } 119 }
110 120
111 void WindowTreeHostImpl::Init(scoped_ptr<WindowTreeHostConnection> connection) { 121 void WindowTreeHostImpl::Init(scoped_ptr<WindowTreeHostConnection> connection) {
122 init_called_ = true;
112 window_tree_host_connection_ = std::move(connection); 123 window_tree_host_connection_ = std::move(connection);
113 connection_manager_->AddHost(this); 124 connection_manager_->AddHost(this);
114 CallOnDisplayInitializedIfNecessary(); 125 InitWindowManagersIfNecessary();
115 }
116
117 const WindowTreeImpl* WindowTreeHostImpl::GetWindowTree() const {
118 return window_tree_;
119 }
120
121 WindowTreeImpl* WindowTreeHostImpl::GetWindowTree() {
122 return window_tree_;
123 } 126 }
124 127
125 void WindowTreeHostImpl::SetFrameDecorationValues( 128 void WindowTreeHostImpl::SetFrameDecorationValues(
126 mojom::FrameDecorationValuesPtr values) { 129 mojom::FrameDecorationValuesPtr values) {
130 // TODO(sky): this needs to be moved to WindowManagerState.
127 frame_decoration_values_ = values.Clone(); 131 frame_decoration_values_ = values.Clone();
128 connection_manager_->ProcessFrameDecorationValuesChanged(this); 132 connection_manager_->ProcessFrameDecorationValuesChanged(this);
129 } 133 }
130 134
131 bool WindowTreeHostImpl::IsWindowAttachedToRoot(
132 const ServerWindow* window) const {
133 return root_->Contains(window) && window != root_.get();
134 }
135
136 bool WindowTreeHostImpl::SchedulePaintIfInViewport(const ServerWindow* window, 135 bool WindowTreeHostImpl::SchedulePaintIfInViewport(const ServerWindow* window,
137 const gfx::Rect& bounds) { 136 const gfx::Rect& bounds) {
138 if (root_->Contains(window)) { 137 if (root_->Contains(window)) {
139 display_manager_->SchedulePaint(window, bounds); 138 display_manager_->SchedulePaint(window, bounds);
140 return true; 139 return true;
141 } 140 }
142 return false; 141 return false;
143 } 142 }
144 143
145 void WindowTreeHostImpl::ScheduleSurfaceDestruction(ServerWindow* window) { 144 void WindowTreeHostImpl::ScheduleSurfaceDestruction(ServerWindow* window) {
146 if (!display_manager_->IsFramePending()) { 145 if (!display_manager_->IsFramePending()) {
147 window->DestroySurfacesScheduledForDestruction(); 146 window->DestroySurfacesScheduledForDestruction();
148 return; 147 return;
149 } 148 }
150 if (windows_needing_frame_destruction_.count(window)) 149 if (windows_needing_frame_destruction_.count(window))
151 return; 150 return;
152 windows_needing_frame_destruction_.insert(window); 151 windows_needing_frame_destruction_.insert(window);
153 window->AddObserver(this); 152 window->AddObserver(this);
154 } 153 }
155 154
156 const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const { 155 const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const {
157 return display_manager_->GetViewportMetrics(); 156 return display_manager_->GetViewportMetrics();
158 } 157 }
159 158
159 ServerWindow* WindowTreeHostImpl::GetRootWithId(const WindowId& id) {
160 if (id == root_->id())
161 return root_.get();
162 for (auto& pair : window_manager_state_map_) {
163 if (pair.second->root()->id() == id)
164 return pair.second->root();
165 }
166 return nullptr;
167 }
168
169 WindowManagerState* WindowTreeHostImpl::GetWindowManagerStateWithRoot(
170 const ServerWindow* window) {
171 for (auto& pair : window_manager_state_map_) {
172 if (pair.second->root() == window)
173 return pair.second.get();
174 }
175 return nullptr;
176 }
177
178 WindowManagerState* WindowTreeHostImpl::GetFirstWindowManagerState() {
179 return window_manager_state_map_.empty()
180 ? nullptr
181 : window_manager_state_map_.begin()->second.get();
182 }
183
160 void WindowTreeHostImpl::SetCapture(ServerWindow* window, 184 void WindowTreeHostImpl::SetCapture(ServerWindow* window,
161 bool in_nonclient_area) { 185 bool in_nonclient_area) {
162 ServerWindow* capture_window = event_dispatcher_.capture_window(); 186 ServerWindow* capture_window = event_dispatcher_.capture_window();
163 if (capture_window == window) 187 if (capture_window == window)
164 return; 188 return;
165 event_dispatcher_.SetCaptureWindow(window, in_nonclient_area); 189 event_dispatcher_.SetCaptureWindow(window, in_nonclient_area);
166 } 190 }
167 191
168 mojom::Rotation WindowTreeHostImpl::GetRotation() const { 192 mojom::Rotation WindowTreeHostImpl::GetRotation() const {
169 return display_manager_->GetRotation(); 193 return display_manager_->GetRotation();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 230 }
207 231
208 void WindowTreeHostImpl::SetImeVisibility(ServerWindow* window, bool visible) { 232 void WindowTreeHostImpl::SetImeVisibility(ServerWindow* window, bool visible) {
209 // Do not need to show or hide IME for unfocused window. 233 // Do not need to show or hide IME for unfocused window.
210 if (focus_controller_->GetFocusedWindow() != window) 234 if (focus_controller_->GetFocusedWindow() != window)
211 return; 235 return;
212 display_manager_->SetImeVisibility(visible); 236 display_manager_->SetImeVisibility(visible);
213 } 237 }
214 238
215 void WindowTreeHostImpl::OnWindowTreeConnectionError(WindowTreeImpl* tree) { 239 void WindowTreeHostImpl::OnWindowTreeConnectionError(WindowTreeImpl* tree) {
240 for (auto it = window_manager_state_map_.begin();
241 it != window_manager_state_map_.end(); ++it) {
242 if (it->second->tree() == tree) {
243 window_manager_state_map_.erase(it);
244 break;
245 }
246 }
247
216 if (tree_awaiting_input_ack_ != tree) 248 if (tree_awaiting_input_ack_ != tree)
217 return; 249 return;
218 // The WindowTree is dying. So it's not going to ack the event. 250 // The WindowTree is dying. So it's not going to ack the event.
219 OnEventAck(tree_awaiting_input_ack_); 251 OnEventAck(tree_awaiting_input_ack_);
220 } 252 }
221 253
222 void WindowTreeHostImpl::OnCursorUpdated(ServerWindow* window) { 254 void WindowTreeHostImpl::OnCursorUpdated(ServerWindow* window) {
223 if (window == event_dispatcher_.mouse_cursor_source_window()) 255 if (window == event_dispatcher_.mouse_cursor_source_window())
224 UpdateNativeCursor(window->cursor()); 256 UpdateNativeCursor(window->cursor());
225 } 257 }
(...skipping 18 matching lines...) Expand all
244 if (tree_awaiting_input_ack_ != tree) { 276 if (tree_awaiting_input_ack_ != tree) {
245 // TODO(sad): The ack must have arrived after the timeout. We should do 277 // TODO(sad): The ack must have arrived after the timeout. We should do
246 // something here, and in OnEventAckTimeout(). 278 // something here, and in OnEventAckTimeout().
247 return; 279 return;
248 } 280 }
249 tree_awaiting_input_ack_ = nullptr; 281 tree_awaiting_input_ack_ = nullptr;
250 event_ack_timer_.Stop(); 282 event_ack_timer_.Stop();
251 ProcessNextEventFromQueue(); 283 ProcessNextEventFromQueue();
252 } 284 }
253 285
254 void WindowTreeHostImpl::CallOnDisplayInitializedIfNecessary() { 286 void WindowTreeHostImpl::InitWindowManagersIfNecessary() {
255 if (window_tree_host_connection_ && root_) { 287 if (!init_called_ || !root_)
256 connection_manager_->OnWindowTreeHostDisplayAvailable(this); 288 return;
257 window_tree_ = window_tree_host_connection_->CreateWindowTree(root_.get()); 289
290 connection_manager_->OnWindowTreeHostDisplayAvailable(this);
291 if (window_tree_host_connection_) {
292 scoped_ptr<WindowManagerState> wms_ptr(new WindowManagerState(this));
293 WindowManagerState* wms = wms_ptr.get();
294 // For this case we never create additional WindowManagerStates, so any
295 // id works.
296 window_manager_state_map_[0u] = std::move(wms_ptr);
297 wms->tree_ = window_tree_host_connection_->CreateWindowTree(wms->root());
298 } else {
299 CreateWindowManagerStatesFromRegistry();
258 } 300 }
259 } 301 }
260 302
261 void WindowTreeHostImpl::OnEventAckTimeout() { 303 void WindowTreeHostImpl::OnEventAckTimeout() {
262 // TODO(sad): Figure out what we should do. 304 // TODO(sad): Figure out what we should do.
263 NOTIMPLEMENTED() << "Event ACK timed out."; 305 NOTIMPLEMENTED() << "Event ACK timed out.";
264 OnEventAck(tree_awaiting_input_ack_); 306 OnEventAck(tree_awaiting_input_ack_);
265 } 307 }
266 308
267 void WindowTreeHostImpl::QueueEvent( 309 void WindowTreeHostImpl::QueueEvent(
(...skipping 22 matching lines...) Expand all
290 *queued_event->event); 332 *queued_event->event);
291 return; 333 return;
292 } 334 }
293 } 335 }
294 } 336 }
295 337
296 void WindowTreeHostImpl::DispatchInputEventToWindowImpl( 338 void WindowTreeHostImpl::DispatchInputEventToWindowImpl(
297 ServerWindow* target, 339 ServerWindow* target,
298 bool in_nonclient_area, 340 bool in_nonclient_area,
299 const ui::Event& event) { 341 const ui::Event& event) {
342 if (target == root_.get()) {
343 // TODO(sky): use active windowmanager here.
344 target = GetFirstWindowManagerState()->root();
345 }
300 if (event.IsMousePointerEvent()) { 346 if (event.IsMousePointerEvent()) {
301 DCHECK(event_dispatcher_.mouse_cursor_source_window()); 347 DCHECK(event_dispatcher_.mouse_cursor_source_window());
302 UpdateNativeCursor( 348 UpdateNativeCursor(
303 event_dispatcher_.mouse_cursor_source_window()->cursor()); 349 event_dispatcher_.mouse_cursor_source_window()->cursor());
304 } 350 }
305 351
306 // If the event is in the non-client area the event goes to the owner of 352 // If the event is in the non-client area the event goes to the owner of
307 // the window. Otherwise if the window is an embed root, forward to the 353 // the window. Otherwise if the window is an embed root, forward to the
308 // embedded window. 354 // embedded window.
309 WindowTreeImpl* connection = 355 WindowTreeImpl* connection =
310 in_nonclient_area 356 in_nonclient_area
311 ? connection_manager_->GetConnection(target->id().connection_id) 357 ? connection_manager_->GetConnection(target->id().connection_id)
312 : connection_manager_->GetConnectionWithRoot(target); 358 : connection_manager_->GetConnectionWithRoot(target);
313 if (!connection) { 359 if (!connection) {
314 DCHECK(!in_nonclient_area); 360 DCHECK(!in_nonclient_area);
315 connection = connection_manager_->GetConnection(target->id().connection_id); 361 connection = connection_manager_->GetConnection(target->id().connection_id);
316 } 362 }
317 363
318 // TOOD(sad): Adjust this delay, possibly make this dynamic. 364 // TOOD(sad): Adjust this delay, possibly make this dynamic.
319 const base::TimeDelta max_delay = base::debug::BeingDebugged() 365 const base::TimeDelta max_delay = base::debug::BeingDebugged()
320 ? base::TimeDelta::FromDays(1) 366 ? base::TimeDelta::FromDays(1)
321 : GetDefaultAckTimerDelay(); 367 : GetDefaultAckTimerDelay();
322 event_ack_timer_.Start(FROM_HERE, max_delay, this, 368 event_ack_timer_.Start(FROM_HERE, max_delay, this,
323 &WindowTreeHostImpl::OnEventAckTimeout); 369 &WindowTreeHostImpl::OnEventAckTimeout);
324 370
325 tree_awaiting_input_ack_ = connection; 371 tree_awaiting_input_ack_ = connection;
326 connection->DispatchInputEvent(target, mojom::Event::From(event)); 372 connection->DispatchInputEvent(target, mojom::Event::From(event));
327 } 373 }
328 374
375 void WindowTreeHostImpl::CreateWindowManagerStatesFromRegistry() {
376 std::vector<WindowManagerFactoryService*> services =
377 connection_manager_->window_manager_factory_registry()->GetServices();
378 mojom::DisplayPtr display = connection_manager_->DisplayForHost(this);
379 for (WindowManagerFactoryService* service : services) {
380 scoped_ptr<WindowManagerState> wms_ptr(
381 new WindowManagerState(this, service->user_id()));
382 WindowManagerState* wms = wms_ptr.get();
383 window_manager_state_map_[service->user_id()] = std::move(wms_ptr);
384 ClientConnection* client_connection =
385 connection_manager_->delegate()->CreateClientConnectionForWindowManager(
386 this, wms->root(), *display, service->user_id(),
387 service->window_manager_factory());
388 client_connection->service()->ConfigureWindowManager();
389 wms->tree_ = client_connection->service();
390 }
391 }
392
329 void WindowTreeHostImpl::UpdateNativeCursor(int32_t cursor_id) { 393 void WindowTreeHostImpl::UpdateNativeCursor(int32_t cursor_id) {
330 if (cursor_id != last_cursor_) { 394 if (cursor_id != last_cursor_) {
331 display_manager_->SetCursorById(cursor_id); 395 display_manager_->SetCursorById(cursor_id);
332 last_cursor_ = cursor_id; 396 last_cursor_ = cursor_id;
333 } 397 }
334 } 398 }
335 399
336 ServerWindow* WindowTreeHostImpl::GetRootWindow() { 400 ServerWindow* WindowTreeHostImpl::GetRootWindow() {
337 return root_.get(); 401 return root_.get();
338 } 402 }
(...skipping 27 matching lines...) Expand all
366 const mojom::ViewportMetrics& old_metrics, 430 const mojom::ViewportMetrics& old_metrics,
367 const mojom::ViewportMetrics& new_metrics) { 431 const mojom::ViewportMetrics& new_metrics) {
368 if (!root_) { 432 if (!root_) {
369 root_.reset(connection_manager_->CreateServerWindow( 433 root_.reset(connection_manager_->CreateServerWindow(
370 RootWindowId(connection_manager_->GetAndAdvanceNextHostId()), 434 RootWindowId(connection_manager_->GetAndAdvanceNextHostId()),
371 ServerWindow::Properties())); 435 ServerWindow::Properties()));
372 root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels.To<gfx::Size>())); 436 root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels.To<gfx::Size>()));
373 root_->SetVisible(true); 437 root_->SetVisible(true);
374 focus_controller_.reset(new FocusController(this, root_.get())); 438 focus_controller_.reset(new FocusController(this, root_.get()));
375 focus_controller_->AddObserver(this); 439 focus_controller_->AddObserver(this);
376 CallOnDisplayInitializedIfNecessary(); 440 InitWindowManagersIfNecessary();
377 event_dispatcher_.set_root(root_.get()); 441 event_dispatcher_.set_root(root_.get());
378 } else { 442 } else {
379 root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels.To<gfx::Size>())); 443 root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels.To<gfx::Size>()));
444 const gfx::Rect wm_bounds(root_->bounds().size());
445 for (auto& pair : window_manager_state_map_)
446 pair.second->root()->SetBounds(wm_bounds);
380 } 447 }
381 connection_manager_->ProcessViewportMetricsChanged(this, old_metrics, 448 connection_manager_->ProcessViewportMetricsChanged(this, old_metrics,
382 new_metrics); 449 new_metrics);
383 } 450 }
384 451
385 void WindowTreeHostImpl::OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) { 452 void WindowTreeHostImpl::OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) {
386 event_dispatcher_.set_surface_id(surface_id); 453 event_dispatcher_.set_surface_id(surface_id);
387 } 454 }
388 455
389 void WindowTreeHostImpl::OnCompositorFrameDrawn() { 456 void WindowTreeHostImpl::OnCompositorFrameDrawn() {
(...skipping 16 matching lines...) Expand all
406 // Raise the new active window. 473 // Raise the new active window.
407 // TODO(sad): Let the WM dictate whether to raise the window or not? 474 // TODO(sad): Let the WM dictate whether to raise the window or not?
408 new_active_window->parent()->StackChildAtTop(new_active_window); 475 new_active_window->parent()->StackChildAtTop(new_active_window);
409 } 476 }
410 } 477 }
411 478
412 void WindowTreeHostImpl::OnFocusChanged( 479 void WindowTreeHostImpl::OnFocusChanged(
413 FocusControllerChangeSource change_source, 480 FocusControllerChangeSource change_source,
414 ServerWindow* old_focused_window, 481 ServerWindow* old_focused_window,
415 ServerWindow* new_focused_window) { 482 ServerWindow* new_focused_window) {
483 // TODO(sky): focus is global, not per windowtreehost. Move.
484
416 // There are up to four connections that need to be notified: 485 // There are up to four connections that need to be notified:
417 // . the connection containing |old_focused_window|. 486 // . the connection containing |old_focused_window|.
418 // . the connection with |old_focused_window| as its root. 487 // . the connection with |old_focused_window| as its root.
419 // . the connection containing |new_focused_window|. 488 // . the connection containing |new_focused_window|.
420 // . the connection with |new_focused_window| as its root. 489 // . the connection with |new_focused_window| as its root.
421 // Some of these connections may be the same. The following takes care to 490 // Some of these connections may be the same. The following takes care to
422 // notify each only once. 491 // notify each only once.
423 WindowTreeImpl* owning_connection_old = nullptr; 492 WindowTreeImpl* owning_connection_old = nullptr;
424 WindowTreeImpl* embedded_connection_old = nullptr; 493 WindowTreeImpl* embedded_connection_old = nullptr;
425 494
(...skipping 27 matching lines...) Expand all
453 connection_manager_->GetConnectionWithRoot(new_focused_window); 522 connection_manager_->GetConnectionWithRoot(new_focused_window);
454 if (embedded_connection_new && 523 if (embedded_connection_new &&
455 embedded_connection_new != owning_connection_old && 524 embedded_connection_new != owning_connection_old &&
456 embedded_connection_new != embedded_connection_old) { 525 embedded_connection_new != embedded_connection_old) {
457 DCHECK_NE(owning_connection_new, embedded_connection_new); 526 DCHECK_NE(owning_connection_new, embedded_connection_new);
458 embedded_connection_new->ProcessFocusChanged(old_focused_window, 527 embedded_connection_new->ProcessFocusChanged(old_focused_window,
459 new_focused_window); 528 new_focused_window);
460 } 529 }
461 } 530 }
462 531
463 // Ensure that we always notify the root connection of a focus change. 532 // WindowManagers are always notified of focus changes.
464 if (window_tree_ != owning_connection_old && 533 WindowTreeImpl* wms_tree_with_old_focused_window = nullptr;
465 window_tree_ != embedded_connection_old && 534 if (old_focused_window) {
466 window_tree_ != owning_connection_new && 535 WindowManagerState* wms =
467 window_tree_ != embedded_connection_new) { 536 connection_manager_->GetWindowManagerAndHost(old_focused_window)
468 window_tree_->ProcessFocusChanged(old_focused_window, new_focused_window); 537 .window_manager_state;
538 wms_tree_with_old_focused_window = wms ? wms->tree() : nullptr;
539 if (wms_tree_with_old_focused_window &&
540 wms_tree_with_old_focused_window != owning_connection_old &&
541 wms_tree_with_old_focused_window != embedded_connection_old &&
542 wms_tree_with_old_focused_window != owning_connection_new &&
543 wms_tree_with_old_focused_window != embedded_connection_new) {
544 wms_tree_with_old_focused_window->ProcessFocusChanged(old_focused_window,
545 new_focused_window);
546 }
547 }
548 if (new_focused_window) {
549 WindowManagerState* wms =
550 connection_manager_->GetWindowManagerAndHost(new_focused_window)
551 .window_manager_state;
552 WindowTreeImpl* wms_tree = wms ? wms->tree() : nullptr;
553 if (wms_tree && wms_tree != wms_tree_with_old_focused_window &&
554 wms_tree != owning_connection_old &&
555 wms_tree != embedded_connection_old &&
556 wms_tree != owning_connection_new &&
557 wms_tree != embedded_connection_new) {
558 wms_tree->ProcessFocusChanged(old_focused_window, new_focused_window);
559 }
469 } 560 }
470 561
471 UpdateTextInputState(new_focused_window, 562 UpdateTextInputState(new_focused_window,
472 new_focused_window->text_input_state()); 563 new_focused_window->text_input_state());
473 } 564 }
474 565
475 void WindowTreeHostImpl::OnAccelerator(uint32_t accelerator_id, 566 void WindowTreeHostImpl::OnAccelerator(uint32_t accelerator_id,
476 const ui::Event& event) { 567 const ui::Event& event) {
477 window_tree_->OnAccelerator(accelerator_id, mojom::Event::From(event)); 568 // TODO(sky): accelerators need to be maintained per windowmanager and pushed
569 // to the eventdispatcher when the active userid changes.
570 GetFirstWindowManagerState()->tree()->OnAccelerator(
571 accelerator_id, mojom::Event::From(event));
478 } 572 }
479 573
480 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( 574 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher(
481 ServerWindow* new_focused_window) { 575 ServerWindow* new_focused_window) {
482 SetFocusedWindow(new_focused_window); 576 SetFocusedWindow(new_focused_window);
483 } 577 }
484 578
485 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { 579 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() {
486 return GetFocusedWindow(); 580 return GetFocusedWindow();
487 } 581 }
(...skipping 24 matching lines...) Expand all
512 DispatchInputEventToWindowImpl(target, in_nonclient_area, event); 606 DispatchInputEventToWindowImpl(target, in_nonclient_area, event);
513 } 607 }
514 608
515 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { 609 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) {
516 windows_needing_frame_destruction_.erase(window); 610 windows_needing_frame_destruction_.erase(window);
517 window->RemoveObserver(this); 611 window->RemoveObserver(this);
518 } 612 }
519 613
520 } // namespace ws 614 } // namespace ws
521 } // namespace mus 615 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_tree_host_impl.h ('k') | components/mus/ws/window_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698