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

Side by Side Diff: ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_
6 #define UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_
7
8 #include <libevdev/libevdev.h>
9
10 #include "base/files/file_path.h"
11 #include "base/message_loop/message_loop.h"
12 #include "ui/events/ozone/evdev/event_converter_evdev.h"
13
14 namespace ui {
15
16 // Basic wrapper for libevdev-cros.
17 //
18 // This drives libevdev-cros from a file descriptor and calls delegate
19 // with the updated event state from libevdev-cros.
20 //
21 // The library doesn't support all devices currently. In particular there
22 // is no support for keyboard events.
23 class EventReaderLibevdevCros : public EventConverterEvdev {
24 public:
25 class Delegate {
26 public:
27 virtual ~Delegate();
28
29 // Notifier for open. This is called with the initial event state.
30 virtual void OnLibEvdevCrosOpen(Evdev* evdev, EventStateRec* evstate) = 0;
31
32 // Notifier for event. This is called with the updated event state.
33 virtual void OnLibEvdevCrosEvent(Evdev* evdev,
34 EventStateRec* state,
35 const timeval& time) = 0;
36 };
37
38 EventReaderLibevdevCros(int fd,
39 const base::FilePath& path,
40 int id,
41 scoped_ptr<Delegate> delegate);
42 ~EventReaderLibevdevCros();
43
44 // EventConverterEvdev:
45 virtual void OnFileCanReadWithoutBlocking(int fd) override;
46
47 private:
48 static void OnSynReport(void* data,
49 EventStateRec* evstate,
50 struct timeval* tv);
51 static void OnLogMessage(void*, int level, const char*, ...);
52
53 // Libevdev state.
54 Evdev evdev_;
55
56 // Event state.
57 EventStateRec evstate_;
58
59 // Path to input device.
60 base::FilePath path_;
61
62 // Delegate for event processing.
63 scoped_ptr<Delegate> delegate_;
64
65 DISALLOW_COPY_AND_ASSIGN(EventReaderLibevdevCros);
66 };
67
68 } // namspace ui
69
70 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/keyboard_evdev.cc ('k') | ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698