OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
oshima
2012/01/23 18:06:39
2012
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ash/accelerators/accelerator_handler.h" | |
6 | |
7 #include "ash/accelerators/accelerator_controller.h" | |
8 #include "ash/shell.h" | |
9 #include "base/message_loop.h" | |
10 #include "base/message_pump_x.h" | |
11 #include "ui/aura/event.h" | |
12 #include "ui/base/accelerators/accelerator.h" | |
13 | |
14 #include <X11/Xlib.h> | |
oshima
2012/01/23 18:06:39
move this before chrome includes.
| |
15 | |
16 namespace ash { | |
17 | |
18 namespace { | |
19 | |
20 const int kModifierMask = (ui::EF_SHIFT_DOWN | | |
21 ui::EF_CONTROL_DOWN | | |
22 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
| |
23 } //namespace | |
oshima
2012/01/23 18:06:39
} // namespace
| |
24 | |
25 base::MessagePumpDispatcher::DispatchStatus AcceleratorHandler::Dispatch( | |
26 XEvent* xev) { | |
27 if (xev->type == KeyPress) { | |
28 ash::AcceleratorController* accelerator_controller = | |
29 ash::Shell::GetInstance() ->accelerator_controller(); | |
oshima
2012/01/23 18:06:39
no space before ->
| |
30 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev), | |
31 ui::EventFlagsFromNative(xev) & kModifierMask); | |
32 if (accelerator_controller && accelerator_controller-> | |
oshima
2012/01/23 18:06:39
(a &&
a->Process())
would be more readable.
| |
33 Process(accelerator)) | |
34 return EVENT_PROCESSED; | |
35 } | |
36 return nested_dispatcher_->Dispatch(xev); | |
37 } | |
38 | |
39 } // namespace ash | |
OLD | NEW |