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

Unified Diff: services/ui/ws/window_manager_state.cc

Issue 2257503002: Improve some debug tools for mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_mash
Patch Set: Fixes. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/window_manager_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_manager_state.cc
diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc
index 66aa0466d86efb50fcacac8b3651551e4710840f..224207202adc95319a720e7aab3b604d6d27c146 100644
--- a/services/ui/ws/window_manager_state.cc
+++ b/services/ui/ws/window_manager_state.cc
@@ -24,6 +24,10 @@ namespace ui {
namespace ws {
namespace {
+// Flags that matter when checking if a key event matches an accelerator.
+const int kAcceleratorEventFlags =
+ EF_SHIFT_DOWN | EF_CONTROL_DOWN | EF_ALT_DOWN | EF_COMMAND_DOWN;
+
base::TimeDelta GetDefaultAckTimerDelay() {
#if defined(NDEBUG)
return base::TimeDelta::FromMilliseconds(100);
@@ -96,6 +100,12 @@ class WindowManagerState::ProcessedEventTarget {
DISALLOW_COPY_AND_ASSIGN(ProcessedEventTarget);
};
+bool WindowManagerState::DebugAccelerator::Matches(
+ const ui::KeyEvent& event) const {
+ return key_code == event.key_code() &&
+ event_flags == (kAcceleratorEventFlags & event.flags());
+}
+
WindowManagerState::QueuedEvent::QueuedEvent() {}
WindowManagerState::QueuedEvent::~QueuedEvent() {}
@@ -379,8 +389,7 @@ void WindowManagerState::ProcessDebugAccelerator(const ui::Event& event) {
const ui::KeyEvent& key_event = *event.AsKeyEvent();
for (const DebugAccelerator& accelerator : debug_accelerators_) {
- if (accelerator.key_code == key_event.key_code() &&
- accelerator.event_flags == key_event.flags()) {
+ if (accelerator.Matches(key_event)) {
HandleDebugAccelerator(accelerator.type);
break;
}
@@ -388,7 +397,7 @@ void WindowManagerState::ProcessDebugAccelerator(const ui::Event& event) {
}
void WindowManagerState::HandleDebugAccelerator(DebugAcceleratorType type) {
-#if !defined(NDEBUG)
+#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
// Error so it will be collected in system logs.
for (Display* display : display_manager()->displays()) {
WindowManagerDisplayRoot* display_root =
« no previous file with comments | « services/ui/ws/window_manager_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698