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

Unified Diff: ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc

Issue 806693009: Port ScopedDisableInternalMouseAndKeyboardX11 to Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc
diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc b/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc
index e3191a2ebdb0b71326653f645b2cabb053ce043d..de262b94ce0f73195a139a0a982d74fb78161dd8 100644
--- a/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc
+++ b/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc
@@ -235,6 +235,15 @@ void GestureInterpreterLibevdevCros::OnLibEvdevCrosEvent(Evdev* evdev,
GestureInterpreterPushHardwareState(interpreter_, &hwstate);
}
+void GestureInterpreterLibevdevCros::SetAllowedKeys(
+ scoped_ptr<std::set<KeyboardCode>> allowed_keys) {
+ allowed_keys_ = allowed_keys.Pass();
+}
+
+void GestureInterpreterLibevdevCros::AllowAllKeys() {
+ allowed_keys_.reset();
+}
+
void GestureInterpreterLibevdevCros::OnGestureReady(const Gesture* gesture) {
switch (gesture->type) {
case kGestureTypeMove:
@@ -483,6 +492,10 @@ void GestureInterpreterLibevdevCros::DispatchChangedKeys(Evdev* evdev,
if (key >= BTN_DIGI && key < BTN_WHEEL)
continue;
+ KeyboardCode key_code = KeyboardEvdev::KeyboardCodeFromEvdevKey(key);
+ if (allowed_keys_ && !allowed_keys_->count(key_code))
+ continue;
+
// Dispatch key press or release to keyboard.
keyboard_->OnKeyChange(key, value);
}

Powered by Google App Engine
This is Rietveld 408576698