Chromium Code Reviews| 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 // Xlib defines RootWindow | |
| 10 #ifdef RootWindow | |
| 11 #undef RootWindow | |
| 12 #endif | |
| 13 | |
| 14 #include "ash/accelerators/accelerator_controller.h" | |
| 15 #include "ash/shell.h" | |
| 16 #include "base/message_loop.h" | |
| 17 #include "base/message_pump_x.h" | |
|
oshima
2012/01/31 20:42:00
are these two necessary?
| |
| 18 #include "ui/aura/event.h" | |
| 19 #include "ui/aura/root_window.h" | |
| 20 #include "ui/base/accelerators/accelerator.h" | |
| 21 | |
| 22 namespace ash { | |
| 23 | |
| 24 namespace { | |
| 25 | |
| 26 const int kModifierMask = (ui::EF_SHIFT_DOWN | | |
| 27 ui::EF_CONTROL_DOWN | | |
| 28 ui::EF_ALT_DOWN); | |
| 29 } // namespace | |
| 30 | |
| 31 base::MessagePumpDispatcher::DispatchStatus AcceleratorDispatcher::Dispatch( | |
| 32 XEvent* xev) { | |
| 33 ash::Shell* shell = ash::Shell::GetInstance(); | |
| 34 if (shell->IsScreenLocked()) | |
|
oshima
2012/01/31 20:42:00
one liner too. same for win.
pkotwicz
2012/02/01 19:11:31
I need to use shell later, so it makes sense to ke
| |
| 35 return aura::RootWindow::GetInstance()->GetDispatcher()->Dispatch(xev); | |
| 36 | |
| 37 if (xev->type == KeyPress) { | |
| 38 ash::AcceleratorController* accelerator_controller = | |
| 39 shell->accelerator_controller(); | |
| 40 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev), | |
| 41 ui::EventFlagsFromNative(xev) & kModifierMask); | |
| 42 if (accelerator_controller && accelerator_controller->Process(accelerator)) | |
| 43 return EVENT_PROCESSED; | |
| 44 } | |
| 45 return nested_dispatcher_->Dispatch(xev); | |
| 46 } | |
| 47 | |
| 48 } // namespace ash | |
| OLD | NEW |