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

Unified Diff: ash/accelerators/accelerator_dispatcher_linux.cc

Issue 9538015: Allows ash accelerators in wrench menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as requested Created 8 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 side-by-side diff with in-line comments
Download patch
Index: ash/accelerators/accelerator_dispatcher_linux.cc
diff --git a/ash/accelerators/accelerator_dispatcher_linux.cc b/ash/accelerators/accelerator_dispatcher_linux.cc
index 8403480f192077e960eb452ba1b9af0c0c85a54a..bfa1056138e01bf5004352bf1cc2d0a4480a31d9 100644
--- a/ash/accelerators/accelerator_dispatcher_linux.cc
+++ b/ash/accelerators/accelerator_dispatcher_linux.cc
@@ -12,6 +12,7 @@
#endif
#include "ash/accelerators/accelerator_controller.h"
+#include "ash/ime/event.h"
#include "ash/shell.h"
#include "ui/aura/env.h"
#include "ui/aura/event.h"
@@ -30,18 +31,25 @@ const int kModifierMask = (ui::EF_SHIFT_DOWN |
base::MessagePumpDispatcher::DispatchStatus AcceleratorDispatcher::Dispatch(
XEvent* xev) {
+ // TODO(oshima): Consolidate win and linux. http://crbug.com/116282
if (!associated_window_)
return EVENT_QUIT;
if (!ui::IsNoopEvent(xev) && !associated_window_->CanReceiveEvents())
return aura::Env::GetInstance()->GetDispatcher()->Dispatch(xev);
- if (xev->type == KeyPress) {
+ if (xev->type == KeyPress || xev->type == KeyRelease) {
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;
+ if (accelerator_controller) {
+ ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev),
+ ui::EventFlagsFromNative(xev) & kModifierMask);
+ if (accelerator_controller->Process(accelerator))
+ return EVENT_PROCESSED;
+
+ accelerator.set_type(TranslatedKeyEvent(xev, false).type());
+ if (accelerator_controller->Process(accelerator))
+ return EVENT_PROCESSED;
+ }
}
return nested_dispatcher_->Dispatch(xev);
}

Powered by Google App Engine
This is Rietveld 408576698