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

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

Issue 1677513002: mus Window Server: implement event capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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.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 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" 10 #include "components/mus/public/interfaces/input_event_constants.mojom.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (windows_needing_frame_destruction_.count(window)) 154 if (windows_needing_frame_destruction_.count(window))
155 return; 155 return;
156 windows_needing_frame_destruction_.insert(window); 156 windows_needing_frame_destruction_.insert(window);
157 window->AddObserver(this); 157 window->AddObserver(this);
158 } 158 }
159 159
160 const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const { 160 const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const {
161 return display_manager_->GetViewportMetrics(); 161 return display_manager_->GetViewportMetrics();
162 } 162 }
163 163
164 void WindowTreeHostImpl::SetCapture(ServerWindow* window,
165 bool in_nonclient_area) {
166 ServerWindow* capture_window = event_dispatcher_.capture_window();
167 if (capture_window == window)
168 return;
169 event_dispatcher_.SetCaptureWindow(window, in_nonclient_area);
170 }
171
164 mojom::Rotation WindowTreeHostImpl::GetRotation() const { 172 mojom::Rotation WindowTreeHostImpl::GetRotation() const {
165 return display_manager_->GetRotation(); 173 return display_manager_->GetRotation();
166 } 174 }
167 175
168 void WindowTreeHostImpl::SetFocusedWindow(ServerWindow* new_focused_window) { 176 void WindowTreeHostImpl::SetFocusedWindow(ServerWindow* new_focused_window) {
169 ServerWindow* old_focused_window = focus_controller_->GetFocusedWindow(); 177 ServerWindow* old_focused_window = focus_controller_->GetFocusedWindow();
170 if (old_focused_window == new_focused_window) 178 if (old_focused_window == new_focused_window)
171 return; 179 return;
172 DCHECK(root_window()->Contains(new_focused_window)); 180 DCHECK(root_window()->Contains(new_focused_window));
173 focus_controller_->SetFocusedWindow(new_focused_window); 181 focus_controller_->SetFocusedWindow(new_focused_window);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 event_queue_.back()->event = CoalesceEvents( 344 event_queue_.back()->event = CoalesceEvents(
337 std::move(event_queue_.back()->event), std::move(mojo_event)); 345 std::move(event_queue_.back()->event), std::move(mojo_event));
338 return; 346 return;
339 } 347 }
340 QueueEvent(std::move(mojo_event), nullptr); 348 QueueEvent(std::move(mojo_event), nullptr);
341 return; 349 return;
342 } 350 }
343 event_dispatcher_.ProcessEvent(std::move(mojo_event)); 351 event_dispatcher_.ProcessEvent(std::move(mojo_event));
344 } 352 }
345 353
354 void WindowTreeHostImpl::OnNativeCaptureLost() {
355 SetCapture(nullptr, false);
356 }
357
346 void WindowTreeHostImpl::OnDisplayClosed() { 358 void WindowTreeHostImpl::OnDisplayClosed() {
347 if (delegate_) 359 if (delegate_)
348 delegate_->OnDisplayClosed(); 360 delegate_->OnDisplayClosed();
349 } 361 }
350 362
351 void WindowTreeHostImpl::OnViewportMetricsChanged( 363 void WindowTreeHostImpl::OnViewportMetricsChanged(
352 const mojom::ViewportMetrics& old_metrics, 364 const mojom::ViewportMetrics& old_metrics,
353 const mojom::ViewportMetrics& new_metrics) { 365 const mojom::ViewportMetrics& new_metrics) {
354 if (!root_) { 366 if (!root_) {
355 root_.reset(connection_manager_->CreateServerWindow( 367 root_.reset(connection_manager_->CreateServerWindow(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 479
468 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( 480 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher(
469 ServerWindow* new_focused_window) { 481 ServerWindow* new_focused_window) {
470 SetFocusedWindow(new_focused_window); 482 SetFocusedWindow(new_focused_window);
471 } 483 }
472 484
473 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { 485 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() {
474 return GetFocusedWindow(); 486 return GetFocusedWindow();
475 } 487 }
476 488
489 void WindowTreeHostImpl::SetNativeCapture() {
490 display_manager_->SetCapture();
491 }
492
493 void WindowTreeHostImpl::ReleaseNativeCapture() {
494 display_manager_->ReleaseCapture();
495 }
496
497 void WindowTreeHostImpl::OnServerWindowCaptureLost(ServerWindow* window) {
498 DCHECK(window);
499 connection_manager_->ProcessLostCapture(window);
500 }
501
477 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, 502 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target,
478 bool in_nonclient_area, 503 bool in_nonclient_area,
479 mojom::EventPtr event) { 504 mojom::EventPtr event) {
480 if (event_ack_timer_.IsRunning()) { 505 if (event_ack_timer_.IsRunning()) {
481 scoped_ptr<ProcessedEventTarget> processed_event_target( 506 scoped_ptr<ProcessedEventTarget> processed_event_target(
482 new ProcessedEventTarget(target, in_nonclient_area)); 507 new ProcessedEventTarget(target, in_nonclient_area));
483 QueueEvent(std::move(event), std::move(processed_event_target)); 508 QueueEvent(std::move(event), std::move(processed_event_target));
484 return; 509 return;
485 } 510 }
486 511
487 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event)); 512 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event));
488 } 513 }
489 514
490 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { 515 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) {
491 windows_needing_frame_destruction_.erase(window); 516 windows_needing_frame_destruction_.erase(window);
492 window->RemoveObserver(this); 517 window->RemoveObserver(this);
493 } 518 }
494 519
495 } // namespace ws 520 } // namespace ws
496 } // namespace mus 521 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_tree_host_impl.h ('k') | components/mus/ws/window_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698