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

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

Issue 1953193002: mus: Add debug key to print the server window hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_manager_state.h" 5 #include "components/mus/ws/window_manager_state.h"
6 6
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "components/mus/ws/accelerator.h" 8 #include "components/mus/ws/accelerator.h"
9 #include "components/mus/ws/display_manager.h" 9 #include "components/mus/ws/display_manager.h"
10 #include "components/mus/ws/platform_display.h" 10 #include "components/mus/ws/platform_display.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void WindowManagerState::Deactivate() { 207 void WindowManagerState::Deactivate() {
208 root_->SetVisible(false); 208 root_->SetVisible(false);
209 event_dispatcher_.Reset(); 209 event_dispatcher_.Reset();
210 // The tree is no longer active, so no point in dispatching any further 210 // The tree is no longer active, so no point in dispatching any further
211 // events. 211 // events.
212 std::queue<std::unique_ptr<QueuedEvent>> event_queue; 212 std::queue<std::unique_ptr<QueuedEvent>> event_queue;
213 event_queue.swap(event_queue_); 213 event_queue.swap(event_queue_);
214 } 214 }
215 215
216 void WindowManagerState::ProcessEvent(const ui::Event& event) { 216 void WindowManagerState::ProcessEvent(const ui::Event& event) {
217 RunDebugShortcuts(event);
218
217 // If this is still waiting for an ack from a previously sent event, then 219 // If this is still waiting for an ack from a previously sent event, then
218 // queue up the event to be dispatched once the ack is received. 220 // queue up the event to be dispatched once the ack is received.
219 if (event_ack_timer_.IsRunning()) { 221 if (event_ack_timer_.IsRunning()) {
220 if (!event_queue_.empty() && !event_queue_.back()->processed_target && 222 if (!event_queue_.empty() && !event_queue_.back()->processed_target &&
221 EventsCanBeCoalesced(*event_queue_.back()->event, event)) { 223 EventsCanBeCoalesced(*event_queue_.back()->event, event)) {
222 event_queue_.back()->event = CoalesceEvents( 224 event_queue_.back()->event = CoalesceEvents(
223 std::move(event_queue_.back()->event), ui::Event::Clone(event)); 225 std::move(event_queue_.back()->event), ui::Event::Clone(event));
224 return; 226 return;
225 } 227 }
226 QueueEvent(event, nullptr); 228 QueueEvent(event, nullptr);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 event_awaiting_input_ack_ = ui::Event::Clone(event); 331 event_awaiting_input_ack_ = ui::Event::Clone(event);
330 post_target_accelerator_ = accelerator; 332 post_target_accelerator_ = accelerator;
331 } 333 }
332 334
333 // Ignore |tree| because it will receive the event via normal dispatch. 335 // Ignore |tree| because it will receive the event via normal dispatch.
334 window_server()->SendToEventObservers(event, user_id_, tree); 336 window_server()->SendToEventObservers(event, user_id_, tree);
335 337
336 tree->DispatchInputEvent(target, event); 338 tree->DispatchInputEvent(target, event);
337 } 339 }
338 340
341 void WindowManagerState::RunDebugShortcuts(const ui::Event& event) {
msw 2016/05/05 22:12:08 Should this instead use accelerators, like ash/acc
James Cook 2016/05/05 22:53:18 It seems like overkill. Ash already has an acceler
msw 2016/05/05 23:10:06 See if it's easy to add an accelerator to the Even
342 #if !defined(NDEBUG)
343 if (event.type() != ui::ET_KEY_PRESSED)
344 return;
345 const ui::KeyEvent* key = event.AsKeyEvent();
346 if (key->key_code() == ui::VKEY_S && key->IsControlDown()
347 && key->IsShiftDown() && key->IsAltDown()) {
348 // Error so it will be collected in system logs.
349 LOG(ERROR) << "ServerWindow hierarchy:\n"
350 << root()->GetDebugWindowHierarchy();
351 }
352 #endif
353 }
354
339 //////////////////////////////////////////////////////////////////////////////// 355 ////////////////////////////////////////////////////////////////////////////////
340 // EventDispatcherDelegate: 356 // EventDispatcherDelegate:
341 357
342 void WindowManagerState::OnAccelerator(uint32_t accelerator_id, 358 void WindowManagerState::OnAccelerator(uint32_t accelerator_id,
343 const ui::Event& event) { 359 const ui::Event& event) {
344 DCHECK(IsActive()); 360 DCHECK(IsActive());
345 tree_->OnAccelerator(accelerator_id, event); 361 tree_->OnAccelerator(accelerator_id, event);
346 } 362 }
347 363
348 void WindowManagerState::SetFocusedWindowFromEventDispatcher( 364 void WindowManagerState::SetFocusedWindowFromEventDispatcher(
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 weak_accelerator); 411 weak_accelerator);
396 } 412 }
397 413
398 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { 414 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) {
399 window_server()->SendToEventObservers(event, user_id_, 415 window_server()->SendToEventObservers(event, user_id_,
400 nullptr /* ignore_tree */); 416 nullptr /* ignore_tree */);
401 } 417 }
402 418
403 } // namespace ws 419 } // namespace ws
404 } // namespace mus 420 } // namespace mus
OLDNEW
« components/mus/ws/server_window.cc ('K') | « components/mus/ws/window_manager_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698