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

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

Issue 193813003: ozone: evdev: Add libgestures bindings for touchpad & mouse support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved 1 space by 1 character Created 6 years, 8 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 | Annotate | Revision Log
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 base::MessagePumpLibevent::Watcher,
24 public EventConverterEvdev {
25 public:
26 class Delegate {
27 public:
28 virtual ~Delegate();
29
30 // Notifier for open. This is called with the initial event state.
31 virtual void OnLibEvdevCrosOpen(Evdev* evdev, EventStateRec* evstate) = 0;
32
33 // Notifier for event. This is called with the updated event state.
34 virtual void OnLibEvdevCrosEvent(Evdev* evdev,
35 EventStateRec* state,
36 const timeval& time) = 0;
37 };
38
39 EventReaderLibevdevCros(int fd,
40 const base::FilePath& path,
41 scoped_ptr<Delegate> delegate);
42 ~EventReaderLibevdevCros();
43
44 // Overridden from ui::EventDeviceEvdev.
45 void Start() OVERRIDE;
46 void Stop() OVERRIDE;
47
48 // Overidden from MessagePumpLibevent::Watcher.
49 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
50 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
51
52 private:
53 static void OnSynReport(void* data,
54 EventStateRec* evstate,
55 struct timeval* tv);
56 static void OnLogMessage(void*, int level, const char*, ...);
57
58 // Libevdev state.
59 Evdev evdev_;
60
61 // Event state.
62 EventStateRec evstate_;
63
64 // Path to input device.
65 base::FilePath path_;
66
67 // Delegate for event processing.
68 scoped_ptr<Delegate> delegate_;
69
70 // Controller for watching the input fd.
71 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
72
73 DISALLOW_COPY_AND_ASSIGN(EventReaderLibevdevCros);
74 };
75
76 } // namspace ui
77
78 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698