| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/wm/core/accelerator_filter.h" | 5 #include "ui/wm/core/accelerator_filter.h" |
| 6 | 6 |
| 7 #include "ui/base/accelerators/accelerator.h" | 7 #include "ui/base/accelerators/accelerator.h" |
| 8 #include "ui/base/accelerators/accelerator_history.h" | 8 #include "ui/base/accelerators/accelerator_history.h" |
| 9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/wm/core/accelerator_delegate.h" | 10 #include "ui/wm/core/accelerator_delegate.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 accelerator_history_->StoreCurrentAccelerator(accelerator); | 64 accelerator_history_->StoreCurrentAccelerator(accelerator); |
| 65 | 65 |
| 66 AcceleratorDelegate::KeyType key_type = | 66 AcceleratorDelegate::KeyType key_type = |
| 67 IsSystemKey(event->key_code()) ? AcceleratorDelegate::KEY_TYPE_SYSTEM | 67 IsSystemKey(event->key_code()) ? AcceleratorDelegate::KEY_TYPE_SYSTEM |
| 68 : AcceleratorDelegate::KEY_TYPE_OTHER; | 68 : AcceleratorDelegate::KEY_TYPE_OTHER; |
| 69 | 69 |
| 70 if (delegate_->ProcessAccelerator(*event, accelerator, key_type)) | 70 if (delegate_->ProcessAccelerator(*event, accelerator, key_type)) |
| 71 event->StopPropagation(); | 71 event->StopPropagation(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void AcceleratorFilter::OnMouseEvent(ui::MouseEvent* event) { | |
| 75 // When a mouse event is interleaved between two key accelerators, we must | |
| 76 // store this event as an empty default accelerator in the accelerator | |
| 77 // history, so that the |AcceleratorController| can notice that something | |
| 78 // actually happened between those two key accelerators. | |
| 79 // Non-real synthesized mouse events should be ignored because we don't want | |
| 80 // them to interfere with tracking the key accelerator. | |
| 81 if (event->flags() & ui::EF_IS_SYNTHESIZED) | |
| 82 return; | |
| 83 | |
| 84 accelerator_history_->StoreCurrentAccelerator(ui::Accelerator()); | |
| 85 } | |
| 86 | |
| 87 } // namespace wm | 74 } // namespace wm |
| OLD | NEW |