Chromium Code Reviews| 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..dfbd82443c55a361e741d84f337ee6c4799eda53 |
| --- /dev/null |
| +++ b/ash/accelerators/accelerator_handler_linux.cc |
| @@ -0,0 +1,39 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
oshima
2012/01/23 18:06:39
2012
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#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" |
| + |
| +#include <X11/Xlib.h> |
|
oshima
2012/01/23 18:06:39
move this before chrome includes.
|
| + |
| +namespace ash { |
| + |
| +namespace { |
| + |
| +const int kModifierMask = (ui::EF_SHIFT_DOWN | |
| + ui::EF_CONTROL_DOWN | |
| + ui::EF_ALT_DOWN); |
|
oshima
2012/01/23 18:06:39
If this is necessary, won't it make more sense to
pkotwicz
2012/01/23 19:34:56
I put it here to mimic chromium/src/ash/accelerato
|
| +} //namespace |
|
oshima
2012/01/23 18:06:39
} // namespace
|
| + |
| +base::MessagePumpDispatcher::DispatchStatus AcceleratorHandler::Dispatch( |
| + XEvent* xev) { |
| + if (xev->type == KeyPress) { |
| + ash::AcceleratorController* accelerator_controller = |
| + ash::Shell::GetInstance() ->accelerator_controller(); |
|
oshima
2012/01/23 18:06:39
no space before ->
|
| + ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev), |
| + ui::EventFlagsFromNative(xev) & kModifierMask); |
| + if (accelerator_controller && accelerator_controller-> |
|
oshima
2012/01/23 18:06:39
(a &&
a->Process())
would be more readable.
|
| + Process(accelerator)) |
| + return EVENT_PROCESSED; |
| + } |
| + return nested_dispatcher_->Dispatch(xev); |
| +} |
| + |
| +} // namespace ash |