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

Unified Diff: ash/accelerators/accelerator_handler_linux.cc

Issue 9224001: Fixes issue with accelerators when a menu is open (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nicer diff Created 8 years, 11 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
Index: ash/accelerators/accelerator_handler_linux.cc
diff --git a/ash/accelerators/accelerator_handler_linux.cc b/ash/accelerators/accelerator_handler_linux.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f93222c2e4cf61ae30d267945e260d53fd652842
--- /dev/null
+++ b/ash/accelerators/accelerator_handler_linux.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <X11/Xlib.h>
oshima 2012/01/23 21:40:52 move this after accelerator_handler.h but before a
+
+#include "ash/accelerators/accelerator_handler.h"
+
+#include "ash/accelerators/accelerator_controller.h"
+#include "ash/shell.h"
+#include "base/message_loop.h"
+#include "base/message_pump_x.h"
+#include "ui/aura/event.h"
+#include "ui/base/accelerators/accelerator.h"
+
+namespace ash {
+
+namespace {
+
+const int kModifierMask = (ui::EF_SHIFT_DOWN |
+ ui::EF_CONTROL_DOWN |
+ ui::EF_ALT_DOWN);
+} // namespace
oshima 2012/01/23 21:40:52 two spaces before //
+
+base::MessagePumpDispatcher::DispatchStatus AcceleratorHandler::Dispatch(
+ XEvent* xev) {
+ if (xev->type == KeyPress) {
+ ash::AcceleratorController* accelerator_controller =
+ ash::Shell::GetInstance()->accelerator_controller();
+ ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev),
+ ui::EventFlagsFromNative(xev) & kModifierMask);
+ if (accelerator_controller && accelerator_controller->Process(accelerator))
+ return EVENT_PROCESSED;
+ }
+ return nested_dispatcher_->Dispatch(xev);
+}
+
+} // namespace ash
oshima 2012/01/23 21:40:52 ditto

Powered by Google App Engine
This is Rietveld 408576698