Mir
input_device.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Cemil Azizoglu <cemil.azizoglu@canonical.com>
17  */
18 
19 #ifndef MIR_INPUT_X_INPUT_DEVICE_H_
20 #define MIR_INPUT_X_INPUT_DEVICE_H_
21 
22 #include "mir/input/input_device.h"
24 #include "mir_toolkit/event.h"
25 #include "mir/geometry/point.h"
27 #include "mir/optional_value.h"
28 
29 #include <chrono>
30 
31 namespace mir
32 {
33 namespace input
34 {
35 
36 namespace X
37 {
38 
40 {
41 public:
42  XInputDevice(InputDeviceInfo const& info);
43 
44  std::shared_ptr<dispatch::Dispatchable> dispatchable();
45  void start(InputSink* destination, EventBuilder* builder) override;
46  void stop() override;
48 
50  void apply_settings(PointerSettings const& settings) override;
52  void apply_settings(TouchpadSettings const& settings) override;
53 
54  bool started() const;
55  void key_press(std::chrono::nanoseconds event_time, xkb_keysym_t key_sym, int32_t key_code);
56  void key_release(std::chrono::nanoseconds event_time, xkb_keysym_t key_sym, int32_t key_code);
57  void update_button_state(int button);
58  void pointer_press(std::chrono::nanoseconds event_time, int button, mir::geometry::Point const& pos, mir::geometry::Displacement scroll);
59  void pointer_release(std::chrono::nanoseconds event_time, int button, mir::geometry::Point const& pos, mir::geometry::Displacement scroll);
60  void pointer_motion(std::chrono::nanoseconds event_time, mir::geometry::Point const& pos, mir::geometry::Displacement scroll);
61 
62 private:
63  MirPointerButtons button_state{0};
64  InputSink* sink{nullptr};
65  EventBuilder* builder{nullptr};
66  geometry::Point pointer_pos;
67  InputDeviceInfo info;
68 };
69 
70 }
71 
72 }
73 }
74 
75 #endif // MIR_INPUT_X_INPUT_DEVICE_H_
All things Mir.
Definition: atomic_callback.h:25
void key_press(std::chrono::nanoseconds event_time, xkb_keysym_t key_sym, int32_t key_code)
std::shared_ptr< dispatch::Dispatchable > dispatchable()
Definition: point.h:30
Definition: input_device.h:39
Definition: touchpad_settings.h:31
void update_button_state(int button)
Represents an input device.
Definition: input_device.h:46
void key_release(std::chrono::nanoseconds event_time, xkb_keysym_t key_sym, int32_t key_code)
optional_value< PointerSettings > get_pointer_settings() const override
optional_value< TouchpadSettings > get_touchpad_settings() const override
void pointer_motion(std::chrono::nanoseconds event_time, mir::geometry::Point const &pos, mir::geometry::Displacement scroll)
void start(InputSink *destination, EventBuilder *builder) override
XInputDevice(InputDeviceInfo const &info)
InputDeviceInfo get_device_info() override
void apply_settings(PointerSettings const &settings) override
Definition: optional_value.h:28
Definition: displacement.h:32
unsigned int MirPointerButtons
Definition: pointer_event.h:85
Definition: input_device_info.h:32
void pointer_press(std::chrono::nanoseconds event_time, int button, mir::geometry::Point const &pos, mir::geometry::Displacement scroll)
void pointer_release(std::chrono::nanoseconds event_time, int button, mir::geometry::Point const &pos, mir::geometry::Displacement scroll)
Definition: pointer_settings.h:31
detail::IntWrapper< struct XTag > X
Definition: dimensions.h:111
Definition: event_builder.h:34
Definition: input_sink.h:33

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016