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

Unified Diff: ui/events/ozone/evdev/event_converter_evdev_impl.h

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/ozone/evdev/event_converter_evdev.cc ('k') | ui/events/ozone/evdev/event_converter_evdev_impl.cc » ('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.h
diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.h b/ui/events/ozone/evdev/event_converter_evdev_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..40e069476e3b7ef6ccdf1d73d98091030243aee5
--- /dev/null
+++ b/ui/events/ozone/evdev/event_converter_evdev_impl.h
@@ -0,0 +1,105 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_
+#define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_
+
+#include <bitset>
+
+#include "base/files/file_path.h"
+#include "base/message_loop/message_pump_libevent.h"
+#include "ui/events/devices/input_device.h"
+#include "ui/events/event.h"
+#include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
+#include "ui/events/ozone/evdev/event_converter_evdev.h"
+#include "ui/events/ozone/evdev/event_device_info.h"
+#include "ui/events/ozone/evdev/event_modifiers_evdev.h"
+#include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
+#include "ui/events/ozone/evdev/keyboard_evdev.h"
+#include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
+
+struct input_event;
+
+namespace ui {
+
+class DeviceEventDispatcherEvdev;
+
+class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl
+ : public EventConverterEvdev {
+ public:
+ EventConverterEvdevImpl(int fd,
+ base::FilePath path,
+ int id,
+ InputDeviceType type,
+ const EventDeviceInfo& info,
+ CursorDelegateEvdev* cursor,
+ DeviceEventDispatcherEvdev* dispatcher);
+ ~EventConverterEvdevImpl() override;
+
+ // EventConverterEvdev:
+ void OnFileCanReadWithoutBlocking(int fd) override;
+ bool HasKeyboard() const override;
+ bool HasTouchpad() const override;
+ bool HasCapsLockLed() const override;
+ void SetKeyFilter(bool enable_filter,
+ std::vector<DomCode> allowed_keys) override;
+ void OnDisabled() override;
+
+ void ProcessEvents(const struct input_event* inputs, int count);
+
+ private:
+ void ConvertKeyEvent(const input_event& input);
+ void ConvertMouseMoveEvent(const input_event& input);
+ void OnKeyChange(unsigned int key,
+ bool down,
+ const base::TimeDelta& timestamp);
+ void ReleaseKeys();
+ void ReleaseMouseButtons();
+ void OnLostSync();
+ void DispatchMouseButton(const input_event& input);
+ void OnButtonChange(int code, bool down, const base::TimeDelta& timestamp);
+
+ // Flush events delimited by EV_SYN. This is useful for handling
+ // non-axis-aligned movement properly.
+ void FlushEvents(const input_event& input);
+
+ // Input modalities for this device.
+ bool has_keyboard_;
+ bool has_touchpad_;
+
+ // LEDs for this device.
+ bool has_caps_lock_led_;
+
+ // Save x-axis events of relative devices to be flushed at EV_SYN time.
+ int x_offset_ = 0;
+
+ // Save y-axis events of relative devices to be flushed at EV_SYN time.
+ int y_offset_ = 0;
+
+ // Controller for watching the input fd.
+ base::MessagePumpLibevent::FileDescriptorWatcher controller_;
+
+ // The evdev codes of the keys which should be blocked.
+ std::bitset<KEY_CNT> blocked_keys_;
+
+ // Pressed keys bitset.
+ std::bitset<KEY_CNT> key_state_;
+
+ // Last mouse button state.
+ static const int kMouseButtonCount = BTN_JOYSTICK - BTN_MOUSE;
+ std::bitset<kMouseButtonCount> mouse_button_state_;
+
+ // Shared cursor state.
+ CursorDelegateEvdev* cursor_;
+
+ // Callbacks for dispatching events.
+ DeviceEventDispatcherEvdev* dispatcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl);
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_
+
« no previous file with comments | « ui/events/ozone/evdev/event_converter_evdev.cc ('k') | ui/events/ozone/evdev/event_converter_evdev_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698