Mir
event_builder.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:
17  * Andreas Pokorny <andreas.pokorny@canonical.com>
18  */
19 
20 #ifndef MIR_INPUT_EVENT_BUILDER_H_
21 #define MIR_INPUT_EVENT_BUILDER_H_
22 
23 #include "mir_toolkit/event.h"
25 #include <memory>
26 #include <chrono>
27 #include <vector>
28 
29 namespace mir
30 {
31 
32 using EventUPtr = std::unique_ptr<MirEvent, void(*)(MirEvent*)>;
33 
34 namespace input
35 {
37 {
38 public:
39  EventBuilder() = default;
40  virtual ~EventBuilder() = default;
41  using Timestamp = std::chrono::nanoseconds;
42 
43  virtual EventUPtr key_event(Timestamp timestamp, MirKeyboardAction action, xkb_keysym_t key_code, int scan_code) = 0;
44 
45  virtual EventUPtr pointer_event(Timestamp timestamp, MirPointerAction action, MirPointerButtons buttons_pressed,
46  float hscroll_value, float vscroll_value, float relative_x_value,
47  float relative_y_value) = 0;
48 
49  virtual EventUPtr device_state_event(float cursor_x, float cursor_y) = 0;
50 
51  virtual EventUPtr pointer_event(Timestamp timestamp, MirPointerAction action, MirPointerButtons buttons_pressed,
52  float x_position, float y_position,
53  float hscroll_value, float vscroll_value, float relative_x_value,
54  float relative_y_value) = 0;
55 
56  virtual EventUPtr touch_event(Timestamp timestamp, std::vector<mir::events::ContactState> const& contacts) = 0;
57 protected:
58  EventBuilder(EventBuilder const&) = delete;
59  EventBuilder& operator=(EventBuilder const&) = delete;
60 };
61 }
62 }
63 
64 #endif
Definition: as_render_target.h:27
virtual EventUPtr pointer_event(Timestamp timestamp, MirPointerAction action, MirPointerButtons buttons_pressed, float hscroll_value, float vscroll_value, float relative_x_value, float relative_y_value)=0
virtual EventUPtr touch_event(Timestamp timestamp, std::vector< mir::events::ContactState > const &contacts)=0
virtual EventUPtr device_state_event(float cursor_x, float cursor_y)=0
MirPointerAction
Possible pointer actions.
Definition: pointer_event.h:40
EventBuilder & operator=(EventBuilder const &)=delete
MirKeyboardAction
Possible actions for changing key state.
Definition: keyboard_event.h:46
std::unique_ptr< MirEvent, void(*)(MirEvent *)> EventUPtr
Definition: event_builders.h:39
unsigned int MirPointerButtons
Definition: pointer_event.h:88
virtual ~EventBuilder()=default
std::chrono::nanoseconds Timestamp
Definition: event_builder.h:41
virtual EventUPtr key_event(Timestamp timestamp, MirKeyboardAction action, xkb_keysym_t key_code, int scan_code)=0
Definition: event_builder.h:36

Copyright © 2012-2016 Canonical Ltd.
Generated on Tue Oct 31 05:57:28 UTC 2017