OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
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_dispatcher.h" | |
6 | |
7 #include <X11/Xlib.h> | |
8 | |
9 #include "ash/accelerators/accelerator_controller.h" | |
10 #include "ash/shell.h" | |
11 #include "base/message_loop.h" | |
12 #include "base/message_pump_x.h" | |
13 #include "ui/aura/event.h" | |
14 #include "ui/base/accelerators/accelerator.h" | |
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); | |
23 } // namespace | |
24 | |
25 base::MessagePumpDispatcher::DispatchStatus AcceleratorDispatcher::Dispatch( | |
26 XEvent* xev) { | |
27 ash::Shell* shell = ash::Shell::GetInstance(); | |
28 if (shell->IsScreenLocked()) | |
29 return EVENT_PROCESSED; | |
oshima
2012/01/31 18:19:52
I believe you need to call
return RootWindow::Get
| |
30 | |
31 if (xev->type == KeyPress) { | |
32 ash::AcceleratorController* accelerator_controller = | |
33 shell->accelerator_controller(); | |
34 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev), | |
35 ui::EventFlagsFromNative(xev) & kModifierMask); | |
36 if (accelerator_controller && accelerator_controller->Process(accelerator)) | |
37 return EVENT_PROCESSED; | |
38 } | |
39 return nested_dispatcher_->Dispatch(xev); | |
40 } | |
41 | |
42 } // namespace ash | |
OLD | NEW |