| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/accelerators/accelerator_dispatcher.h" | 5 #include "ash/accelerators/accelerator_dispatcher.h" |
| 6 | 6 |
| 7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 // Xlib defines RootWindow | 10 // Xlib defines RootWindow |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 bool AcceleratorDispatcher::Dispatch(const base::NativeEvent& event) { | 68 bool AcceleratorDispatcher::Dispatch(const base::NativeEvent& event) { |
| 69 if (!associated_window_) | 69 if (!associated_window_) |
| 70 return false; | 70 return false; |
| 71 if (!ui::IsNoopEvent(event) && !associated_window_->CanReceiveEvents()) | 71 if (!ui::IsNoopEvent(event) && !associated_window_->CanReceiveEvents()) |
| 72 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(event); | 72 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(event); |
| 73 | 73 |
| 74 if (IsKeyEvent(event)) { | 74 if (IsKeyEvent(event)) { |
| 75 ash::AcceleratorController* accelerator_controller = | 75 ash::AcceleratorController* accelerator_controller = |
| 76 ash::Shell::GetInstance()->accelerator_controller(); | 76 ash::Shell::GetInstance()->accelerator_controller(); |
| 77 if (accelerator_controller) { | 77 if (accelerator_controller) { |
| 78 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(event), | 78 ui::Accelerator accelerator( |
| 79 ui::EventFlagsFromNative(event) & kModifierMask); | 79 ui::KeyboardCodeFromNative(event), |
| 80 if (IsKeyRelease(event)) | 80 ui::EventFlagsFromNative(event) & kModifierMask, |
| 81 accelerator.set_type(ui::ET_KEY_RELEASED); | 81 IsKeyRelease(event) ? ui::ET_KEY_RELEASED : ui::ET_KEY_PRESSED); |
| 82 if (accelerator_controller->Process(accelerator)) | 82 if (accelerator_controller->Process(accelerator)) |
| 83 return true; | 83 return true; |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 return nested_dispatcher_->Dispatch(event); | 87 return nested_dispatcher_->Dispatch(event); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace ash | 90 } // namespace ash |
| OLD | NEW |