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

Side by Side Diff: ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc

Issue 1003523004: Remove GestureInterpreterLibevdevCros::SetAllowedKeys() because it is a no-op (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
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/libgestures_glue/gesture_interpreter_libevdev_cr os.h" 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr os.h"
6 6
7 #include <gestures/gestures.h> 7 #include <gestures/gestures.h>
8 #include <libevdev/libevdev.h> 8 #include <libevdev/libevdev.h>
9 #include <linux/input.h> 9 #include <linux/input.h>
10 10
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 void GestureInterpreterLibevdevCros::OnLibEvdevCrosStopped( 208 void GestureInterpreterLibevdevCros::OnLibEvdevCrosStopped(
209 Evdev* evdev, 209 Evdev* evdev,
210 EventStateRec* state) { 210 EventStateRec* state) {
211 stime_t timestamp = StimeNow(); 211 stime_t timestamp = StimeNow();
212 212
213 ReleaseKeys(timestamp); 213 ReleaseKeys(timestamp);
214 ReleaseMouseButtons(timestamp); 214 ReleaseMouseButtons(timestamp);
215 } 215 }
216 216
217 void GestureInterpreterLibevdevCros::SetAllowedKeys(
218 scoped_ptr<std::set<DomCode>> allowed_keys) {
219 if (!allowed_keys) {
220 allowed_keys_.reset();
221 return;
222 }
223
224 allowed_keys_.reset(new std::set<int>());
225 for (const auto& it : *allowed_keys) {
226 int evdev_code =
227 NativeCodeToEvdevCode(KeycodeConverter::DomCodeToNativeKeycode(it));
228 allowed_keys_->insert(evdev_code);
229 }
230 }
231
232 void GestureInterpreterLibevdevCros::AllowAllKeys() {
233 allowed_keys_.reset();
234 }
235
236 void GestureInterpreterLibevdevCros::OnGestureReady(const Gesture* gesture) { 217 void GestureInterpreterLibevdevCros::OnGestureReady(const Gesture* gesture) {
237 switch (gesture->type) { 218 switch (gesture->type) {
238 case kGestureTypeMove: 219 case kGestureTypeMove:
239 OnGestureMove(gesture, &gesture->details.move); 220 OnGestureMove(gesture, &gesture->details.move);
240 break; 221 break;
241 case kGestureTypeScroll: 222 case kGestureTypeScroll:
242 OnGestureScroll(gesture, &gesture->details.scroll); 223 OnGestureScroll(gesture, &gesture->details.scroll);
243 break; 224 break;
244 case kGestureTypeButtonsChange: 225 case kGestureTypeButtonsChange:
245 OnGestureButtonsChange(gesture, &gesture->details.buttons); 226 OnGestureButtonsChange(gesture, &gesture->details.buttons);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 bool value = EvdevBitIsSet(new_key_state, key); 427 bool value = EvdevBitIsSet(new_key_state, key);
447 428
448 // Mouse buttons are handled by DispatchMouseButton. 429 // Mouse buttons are handled by DispatchMouseButton.
449 if (key >= BTN_MOUSE && key < BTN_JOYSTICK) 430 if (key >= BTN_MOUSE && key < BTN_JOYSTICK)
450 continue; 431 continue;
451 432
452 // Ignore digi buttons (e.g. BTN_TOOL_FINGER). 433 // Ignore digi buttons (e.g. BTN_TOOL_FINGER).
453 if (key >= BTN_DIGI && key < BTN_WHEEL) 434 if (key >= BTN_DIGI && key < BTN_WHEEL)
454 continue; 435 continue;
455 436
456 if (allowed_keys_ && !allowed_keys_->count(key))
457 continue;
458
459 // Dispatch key press or release to keyboard. 437 // Dispatch key press or release to keyboard.
460 dispatcher_->DispatchKeyEvent( 438 dispatcher_->DispatchKeyEvent(
461 KeyEventParams(id_, key, value, StimeToTimedelta(timestamp))); 439 KeyEventParams(id_, key, value, StimeToTimedelta(timestamp)));
462 } 440 }
463 } 441 }
464 442
465 // Update internal key state. 443 // Update internal key state.
466 for (unsigned long i = 0; i < EVDEV_BITS_TO_LONGS(KEY_CNT); ++i) 444 for (unsigned long i = 0; i < EVDEV_BITS_TO_LONGS(KEY_CNT); ++i)
467 prev_key_state_[i] = new_key_state[i]; 445 prev_key_state_[i] = new_key_state[i];
468 } 446 }
(...skipping 22 matching lines...) Expand all
491 return true; 469 return true;
492 } 470 }
493 471
494 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) { 472 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) {
495 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp); 473 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp);
496 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp); 474 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp);
497 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp); 475 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp);
498 } 476 }
499 477
500 } // namespace ui 478 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698