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"
24 #include <memory>
25 #include <chrono>
26 
27 namespace mir
28 {
29 
30 using EventUPtr = std::unique_ptr<MirEvent, void(*)(MirEvent*)>;
31 
32 namespace input
33 {
35 {
36 public:
37  EventBuilder() = default;
38  virtual ~EventBuilder() = default;
39  using Timestamp = std::chrono::nanoseconds;
40 
41  virtual EventUPtr key_event(Timestamp timestamp, MirKeyboardAction action, xkb_keysym_t key_code, int scan_code) = 0;
42 
43  virtual EventUPtr touch_event(Timestamp timestamp) = 0;
44  virtual void add_touch(MirEvent& event, MirTouchId touch_id, MirTouchAction action, MirTouchTooltype tooltype,
45  float x_axis_value, float y_axis_value, float pressure_value, float touch_major_value,
46  float touch_minor_value, float size_value) = 0;
47 
48  virtual EventUPtr pointer_event(Timestamp timestamp, MirPointerAction action, MirPointerButtons buttons_pressed,
49  float hscroll_value, float vscroll_value, float relative_x_value,
50  float relative_y_value) = 0;
51 
53 
54  virtual EventUPtr device_state_event(float cursor_x, float cursor_y) = 0;
55 
56 protected:
57  EventBuilder(EventBuilder const&) = delete;
58  EventBuilder& operator=(EventBuilder const&) = delete;
59 };
60 }
61 }
62 
63 #endif
All things Mir.
Definition: atomic_callback.h:25
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 void add_touch(MirEvent &event, MirTouchId touch_id, MirTouchAction action, MirTouchTooltype tooltype, float x_axis_value, float y_axis_value, float pressure_value, float touch_major_value, float touch_minor_value, float size_value)=0
virtual EventUPtr device_state_event(float cursor_x, float cursor_y)=0
int32_t MirTouchId
An identifier for a touch-point.
Definition: touch_event.h:40
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
virtual EventUPtr touch_event(Timestamp timestamp)=0
std::unique_ptr< MirEvent, void(*)(MirEvent *)> EventUPtr
Definition: seat.h:32
MirTouchTooltype
Identifiers for per-touch tool types.
Definition: touch_event.h:78
unsigned int MirPointerButtons
Definition: pointer_event.h:85
MirInputConfigurationAction
MirInputConfigurationEvent indicates a configuration change in the input device subsystem. Eventually it&#39;s usage will be required to properly interpret MirInputEvent, for example: If we receive a button down, and then a device reset, we should not expect to receive the button up.
Definition: input_configuration_event.h:43
virtual EventUPtr configuration_event(Timestamp timestamp, MirInputConfigurationAction action)=0
virtual ~EventBuilder()=default
MirTouchAction
Possible per touch actions for state changing.
Definition: touch_event.h:45
std::chrono::nanoseconds Timestamp
Definition: event_builder.h:39
virtual EventUPtr key_event(Timestamp timestamp, MirKeyboardAction action, xkb_keysym_t key_code, int scan_code)=0
Definition: event_builder.h:34
Definition: event.h:30

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