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_
10 #include "base/basictypes.h"
11 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
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
24 class EVENTS_OZONE_EVDEV_EXPORT MouseButtonMapEvdev
{
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_
; }
46 ButtonMap button_map_
;
48 DISALLOW_COPY_AND_ASSIGN(MouseButtonMapEvdev
);
53 #endif // UI_EVENTS_OZONE_EVDEV_MOUSE_BUTTON_MAP_EVDEV_H_