Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: ui/events/ozone/evdev/keyboard_evdev.cc

Issue 1074503002: ozone: evdev: Fix repeating the same key after r324081 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/events/ozone/evdev/keyboard_evdev.h" 5 #include "ui/events/ozone/evdev/keyboard_evdev.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 void KeyboardEvdev::StartKeyRepeat(unsigned int key) { 151 void KeyboardEvdev::StartKeyRepeat(unsigned int key) {
152 repeat_key_ = key; 152 repeat_key_ = key;
153 repeat_sequence_++; 153 repeat_sequence_++;
154 154
155 ScheduleKeyRepeat(repeat_delay_); 155 ScheduleKeyRepeat(repeat_delay_);
156 } 156 }
157 157
158 void KeyboardEvdev::StopKeyRepeat() { 158 void KeyboardEvdev::StopKeyRepeat() {
159 repeat_key_ = KEY_RESERVED;
159 repeat_sequence_++; 160 repeat_sequence_++;
160 } 161 }
161 162
162 void KeyboardEvdev::ScheduleKeyRepeat(const base::TimeDelta& delay) { 163 void KeyboardEvdev::ScheduleKeyRepeat(const base::TimeDelta& delay) {
163 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 164 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
164 FROM_HERE, base::Bind(&KeyboardEvdev::OnRepeatTimeout, 165 FROM_HERE, base::Bind(&KeyboardEvdev::OnRepeatTimeout,
165 weak_ptr_factory_.GetWeakPtr(), repeat_sequence_), 166 weak_ptr_factory_.GetWeakPtr(), repeat_sequence_),
166 delay); 167 delay);
167 } 168 }
168 169
(...skipping 30 matching lines...) Expand all
199 UpdateModifier(ModifierDomKeyToEventFlag(dom_key), down); 200 UpdateModifier(ModifierDomKeyToEventFlag(dom_key), down);
200 201
201 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code, 202 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code,
202 modifiers_->GetModifierFlags(), dom_key, character, timestamp); 203 modifiers_->GetModifierFlags(), dom_key, character, timestamp);
203 if (platform_keycode) 204 if (platform_keycode)
204 event.set_platform_keycode(platform_keycode); 205 event.set_platform_keycode(platform_keycode);
205 callback_.Run(&event); 206 callback_.Run(&event);
206 } 207 }
207 208
208 } // namespace ui 209 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698