Mir
software_cursor.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: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_SOFTWARE_CURSOR_H_
20 #define MIR_GRAPHICS_SOFTWARE_CURSOR_H_
21 
22 #include "mir/graphics/cursor.h"
25 #include <mutex>
26 
27 namespace mir
28 {
29 namespace input { class Scene; }
30 namespace graphics
31 {
32 class GraphicBufferAllocator;
33 class Renderable;
34 
35 namespace detail
36 {
37 class CursorRenderable;
38 }
39 
40 class SoftwareCursor : public Cursor
41 {
42 public:
44  std::shared_ptr<GraphicBufferAllocator> const& allocator,
45  std::shared_ptr<input::Scene> const& scene);
47 
48  void show(CursorImage const& cursor_image) override;
49  void hide() override;
50  void move_to(geometry::Point position) override;
51 
52 private:
53  std::shared_ptr<detail::CursorRenderable> create_renderable_for(
54  CursorImage const& cursor_image, geometry::Point position);
55 
56  std::shared_ptr<GraphicBufferAllocator> const allocator;
57  std::shared_ptr<input::Scene> const scene;
58  MirPixelFormat const format;
59  std::mutex guard;
60  std::shared_ptr<detail::CursorRenderable> renderable;
61  geometry::Displacement hotspot;
62 };
63 
64 }
65 }
66 
67 #endif
void move_to(geometry::Point position) override
Definition: software_cursor.cpp:189
All things Mir.
Definition: buffer_stream.h:37
Definition: point.h:30
~SoftwareCursor()
Definition: software_cursor.cpp:117
SoftwareCursor(std::shared_ptr< GraphicBufferAllocator > const &allocator, std::shared_ptr< input::Scene > const &scene)
Definition: software_cursor.cpp:107
Definition: cursor_image.h:30
Definition: cursor.h:33
MirPixelFormat
The order of components in a format enum matches the order of the components as they would be written...
Definition: common.h:127
Definition: displacement.h:32
void show(CursorImage const &cursor_image) override
Definition: software_cursor.cpp:122
Definition: software_cursor.h:40
void hide() override
Definition: software_cursor.cpp:175

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Mar 24 16:15:19 UTC 2015