Landing Recent QUIC Changes.
[chromium-blink-merge.git] / ui / events / ozone / evdev / mouse_button_map_evdev.h
blob5cc240dfdeea6c1cb292f3437d097f0caf7abc02
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.
5 #ifndef UI_EVENTS_OZONE_EVDEV_MOUSE_BUTTON_MAP_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_MOUSE_BUTTON_MAP_EVDEV_H_
8 #include <map>
10 #include "base/basictypes.h"
11 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
13 namespace ui {
15 // Mouse button map for Evdev.
17 // Chrome relies on the underlying OS to interpret mouse buttons. The Linux
18 // input subsystem does not assign any special meaning to these keys, so
19 // this work must happen at a higher layer (normally X11 or the console driver).
20 // When using evdev directly, we must do it ourselves.
22 // The mouse button map is shared between all input devices connected to the
23 // system.
24 class EVENTS_OZONE_EVDEV_EXPORT MouseButtonMapEvdev {
25 public:
26 typedef uint32_t Button;
27 typedef std::map<uint32_t, uint32_t> ButtonMap;
29 MouseButtonMapEvdev();
30 ~MouseButtonMapEvdev();
32 // Set mapping for one button.
33 void UpdateButtonMap(Button button_from, Button button_to);
35 // Reset the button map to the system default.
36 void ResetButtonMap();
38 // Return the mapped button.
39 int GetMappedButton(const Button button) const;
41 // Return current button map to use for incoming events.
42 const ButtonMap& button_map() { return button_map_; }
44 private:
45 // Mouse button map.
46 ButtonMap button_map_;
48 DISALLOW_COPY_AND_ASSIGN(MouseButtonMapEvdev);
51 } // namspace ui
53 #endif // UI_EVENTS_OZONE_EVDEV_MOUSE_BUTTON_MAP_EVDEV_H_