Chromium Code Reviews| 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 "ui/events/event.h" | 5 #include "ui/events/event.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 | 10 |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1149 } | 1149 } |
| 1150 CHECK_EQ(ui::ET_KEY_PRESSED, event.type()); | 1150 CHECK_EQ(ui::ET_KEY_PRESSED, event.type()); |
| 1151 if (!last_key_event_) { | 1151 if (!last_key_event_) { |
| 1152 last_key_event_ = new KeyEvent(event); | 1152 last_key_event_ = new KeyEvent(event); |
| 1153 return false; | 1153 return false; |
| 1154 } else if (event.time_stamp() == last_key_event_->time_stamp()) { | 1154 } else if (event.time_stamp() == last_key_event_->time_stamp()) { |
| 1155 // The KeyEvent is created from the same native event. | 1155 // The KeyEvent is created from the same native event. |
| 1156 return (last_key_event_->flags() & ui::EF_IS_REPEAT) != 0; | 1156 return (last_key_event_->flags() & ui::EF_IS_REPEAT) != 0; |
| 1157 } | 1157 } |
| 1158 if (event.key_code() == last_key_event_->key_code() && | 1158 if (event.key_code() == last_key_event_->key_code() && |
| 1159 event.flags() == (last_key_event_->flags() & ~ui::EF_IS_REPEAT) && | 1159 // Ignore Caps Lock flag. Otherwise, Caps Lock toggles continuously |
| 1160 // when the key is hold down. | |
| 1161 (event.flags() & ~ui::EF_CAPS_LOCK_ON) == | |
| 1162 (last_key_event_->flags() & ~ui::EF_IS_REPEAT & | |
| 1163 ~ui::EF_CAPS_LOCK_ON) && | |
|
afakhry
2017/03/21 17:09:22
This doesn't look right. Clearing the CAPS LOCK fl
| |
| 1160 (event.time_stamp() - last_key_event_->time_stamp()).InMilliseconds() < | 1164 (event.time_stamp() - last_key_event_->time_stamp()).InMilliseconds() < |
| 1161 kMaxAutoRepeatTimeMs) { | 1165 kMaxAutoRepeatTimeMs) { |
| 1162 last_key_event_->set_time_stamp(event.time_stamp()); | 1166 last_key_event_->set_time_stamp(event.time_stamp()); |
| 1163 last_key_event_->set_flags(last_key_event_->flags() | ui::EF_IS_REPEAT); | 1167 last_key_event_->set_flags(last_key_event_->flags() | ui::EF_IS_REPEAT); |
| 1164 return true; | 1168 return true; |
| 1165 } | 1169 } |
| 1166 delete last_key_event_; | 1170 delete last_key_event_; |
| 1167 last_key_event_ = new KeyEvent(event); | 1171 last_key_event_ = new KeyEvent(event); |
| 1168 return false; | 1172 return false; |
| 1169 } | 1173 } |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1465 flags | EF_FROM_TOUCH), | 1469 flags | EF_FROM_TOUCH), |
| 1466 details_(details), | 1470 details_(details), |
| 1467 unique_touch_event_id_(unique_touch_event_id) { | 1471 unique_touch_event_id_(unique_touch_event_id) { |
| 1468 latency()->set_source_event_type(ui::SourceEventType::TOUCH); | 1472 latency()->set_source_event_type(ui::SourceEventType::TOUCH); |
| 1469 } | 1473 } |
| 1470 | 1474 |
| 1471 GestureEvent::~GestureEvent() { | 1475 GestureEvent::~GestureEvent() { |
| 1472 } | 1476 } |
| 1473 | 1477 |
| 1474 } // namespace ui | 1478 } // namespace ui |
| OLD | NEW |