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

Unified Diff: ui/events/ozone/evdev/event_converter_evdev_impl.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
« no previous file with comments | « ui/events/ozone/evdev/event_converter_evdev_impl.h ('k') | ui/events/ozone/evdev/event_device_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/event_converter_evdev_impl.cc
diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc
index 011a6c2dda5c5c783ccb092cf774b758ba98592b..6023e990d67f13e80b95cf4247c812be2454b7de 100644
--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc
+++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc
@@ -10,7 +10,7 @@
#include "base/message_loop/message_loop.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/dom4/keycode_converter.h"
-#include "ui/events/keycodes/keyboard_codes.h"
+#include "ui/events/ozone/evdev/keyboard_evdev.h"
namespace ui {
@@ -31,6 +31,7 @@ EventConverterEvdevImpl::EventConverterEvdevImpl(
const EventDispatchCallback& callback)
: EventConverterEvdev(fd, path, id, type),
has_keyboard_(devinfo.HasKeyboard()),
+ has_touchpad_(devinfo.HasTouchpad()),
x_offset_(0),
y_offset_(0),
cursor_(cursor),
@@ -57,6 +58,9 @@ void EventConverterEvdevImpl::OnFileCanReadWithoutBlocking(int fd) {
return;
}
+ if (ignore_events_)
spang 2015/01/02 22:49:57 Add a TODO(spang): Re-implement this by releasing
+ return;
+
DCHECK_EQ(read_size % sizeof(*inputs), 0u);
ProcessEvents(inputs, read_size / sizeof(*inputs));
}
@@ -65,6 +69,21 @@ bool EventConverterEvdevImpl::HasKeyboard() const {
return has_keyboard_;
}
+bool EventConverterEvdevImpl::HasTouchpad() const {
+ return has_touchpad_;
+}
+
+void EventConverterEvdevImpl::SetAllowedKeys(
+ scoped_ptr<std::set<DomCode>> allowed_keys) {
+ DCHECK(HasKeyboard());
+ allowed_keys_ = allowed_keys.Pass();
+}
+
+void EventConverterEvdevImpl::AllowAllKeys() {
+ DCHECK(HasKeyboard());
+ allowed_keys_.reset();
+}
+
void EventConverterEvdevImpl::ProcessEvents(const input_event* inputs,
int count) {
for (int i = 0; i < count; ++i) {
@@ -95,7 +114,10 @@ void EventConverterEvdevImpl::ConvertKeyEvent(const input_event& input) {
}
// Keyboard processing.
- keyboard_->OnKeyChange(input.code, input.value != kKeyReleaseValue);
+ DomCode key_code = KeycodeConverter::NativeKeycodeToDomCode(
+ KeyboardEvdev::EvdevCodeToNativeCode(input.code));
kpschoedel 2014/12/25 18:14:17 NativeKeycodeToDomCode() is a slow operation; sinc
+ if (!allowed_keys_ || allowed_keys_->count(key_code))
+ keyboard_->OnKeyChange(input.code, input.value != kKeyReleaseValue);
}
void EventConverterEvdevImpl::ConvertMouseMoveEvent(const input_event& input) {
« no previous file with comments | « ui/events/ozone/evdev/event_converter_evdev_impl.h ('k') | ui/events/ozone/evdev/event_device_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698