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

Side by Side Diff: ui/events/ozone/evdev/keyboard_evdev.h

Issue 641113004: ozone: evdev: Factor keyboard into KeyboardEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_KEYBOARD_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_
7
8 #include <linux/input.h>
9
10 #include "ui/events/ozone/evdev/event_device_util.h"
11 #include "ui/events/ozone/evdev/event_dispatch_callback.h"
12 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
13
14 namespace ui {
15
16 class EventModifiersEvdev;
17
18 // Keyboard for evdev.
19 //
20 // This object is responsible for combining all attached keyboards into
21 // one logical keyboard, applying modifiers & implementing key repeat.
22 //
23 // It also currently also applies the layout (hardcoded as US).
24 //
25 // TODO(spang): Implement key repeat & turn off kernel repeat.
26 class EVENTS_OZONE_EVDEV_EXPORT KeyboardEvdev {
27 public:
28 KeyboardEvdev(EventModifiersEvdev* modifiers,
29 const EventDispatchCallback& callback);
30 ~KeyboardEvdev();
31
32 // Handlers for raw key presses & releases.
33 void OnKeyChange(unsigned int code, bool down);
34
35 private:
36 void UpdateModifier(unsigned int key, bool down);
37 void DispatchKey(unsigned int key, bool down);
38
39 // Aggregated key state. There is only one bit of state per key; we do not
40 // attempt to count presses of the same key on multiple keyboards.
41 //
42 // A key is down iff the most recent event pertaining to that key was a key
43 // down event rather than a key up event. Therefore, a particular key position
44 // can be considered released even if it is being depresssed on one or more
45 // keyboards.
46 unsigned long key_state_[EVDEV_BITS_TO_LONGS(KEY_CNT)];
kpschoedel 2014/10/09 22:51:09 Why not use std::bitset?
spang 2014/10/14 16:02:08 Done.
47
48 // Callback for dispatching events.
49 EventDispatchCallback callback_;
50
51 // Shared modifier state.
52 EventModifiersEvdev* modifiers_;
53
54 DISALLOW_COPY_AND_ASSIGN(KeyboardEvdev);
55 };
56
57 } // namespace ui
58
59 #endif // UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/key_event_converter_evdev_unittest.cc ('k') | ui/events/ozone/evdev/keyboard_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698