Mir
validator.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 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 General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_INPUT_VALIDATOR_H_
20 #define MIR_INPUT_VALIDATOR_H_
21 
23 
24 #include <memory>
25 #include <unordered_map>
26 #include <mutex>
27 
28 namespace mir
29 {
30 namespace input
31 {
32 class Validator
33 {
34 public:
35  Validator(std::function<void(MirEvent const&)> const& dispatch_valid_event);
36 
37  void validate_and_dispatch(MirEvent const& event);
38 
39 private:
40  std::mutex state_guard;
41 
42  std::function<void(MirEvent const&)> const dispatch_valid_event;
43 
44  std::unordered_map<MirInputDeviceId, EventUPtr> last_event_by_device;
45 
46  void handle_touch_event(MirInputDeviceId,
47  MirTouchEvent const* event);
48  void ensure_stream_validity_locked(std::lock_guard<std::mutex> const& lg,
49  MirTouchEvent const* ev, MirTouchEvent const* last_ev);
50 };
51 
52 }
53 }
54 
55 #endif // MIR_INPUT_VALIDATOR_H_
All things Mir.
Definition: atomic_callback.h:25
void validate_and_dispatch(MirEvent const &event)
Definition: validator.cpp:38
Definition: motion_event.h:143
Validator(std::function< void(MirEvent const &)> const &dispatch_valid_event)
Definition: validator.cpp:32
Definition: validator.h:32
int64_t MirInputDeviceId
Definition: input_event.h:35
Definition: event.h:30

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