Mir
touch_visualizer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 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_TOUCH_VISUALIZER_H_
20 #define MIR_INPUT_TOUCH_VISUALIZER_H_
21 
22 #include "mir/geometry/point.h"
23 
24 #include <vector>
25 
26 namespace mir
27 {
28 namespace input
29 {
30 
32 // a "spot" style visualization.
34 {
35 public:
36  virtual ~TouchVisualizer() = default;
37 
38  struct Spot
39  {
41 
42  // If pressure is zero, the touch-point can be interpreted as a hover.
43  float pressure;
44  };
45 
46  // Toggle visualization of touches
47  virtual void enable() = 0;
48  virtual void disable() = 0;
49 
50  // Visualize a given set of touches statelessly.
51  virtual void visualize_touches(std::vector<Spot> const& touches) = 0;
52 
53 protected:
54  TouchVisualizer() = default;
55  TouchVisualizer(const TouchVisualizer&) = delete;
56  TouchVisualizer& operator=(const TouchVisualizer&) = delete;
57 };
58 
59 inline bool operator==(TouchVisualizer::Spot const &lhs, TouchVisualizer::Spot const& rhs)
60 {
61  return lhs.touch_location == rhs.touch_location &&
62  lhs.pressure == rhs.pressure;
63 }
64 
65 }
66 }
67 
68 #endif // MIR_INPUT_TOUCH_VISUALIZER_H_
An interface for listening to a low level stream of touches, in order to provide. ...
Definition: touch_visualizer.h:33
All things Mir.
Definition: atomic_callback.h:25
Definition: point.h:30
Definition: touch_visualizer.h:38
TouchVisualizer & operator=(const TouchVisualizer &)=delete
virtual void visualize_touches(std::vector< Spot > const &touches)=0
virtual ~TouchVisualizer()=default
float pressure
Definition: touch_visualizer.h:43
virtual void disable()=0
geometry::Point touch_location
Definition: touch_visualizer.h:40
bool operator==(Keymap const &lhs, Keymap const &rhs)
Definition: keymap.h:56

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