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);
46  ~SoftwareCursor();
47 
48  void show() override;
49  void show(CursorImage const& cursor_image) override;
50  void hide() override;
51  void move_to(geometry::Point position) override;
52 
53 private:
54  std::shared_ptr<detail::CursorRenderable> create_renderable_for(
55  CursorImage const& cursor_image, geometry::Point position);
56 
57  std::shared_ptr<GraphicBufferAllocator> const allocator;
58  std::shared_ptr<input::Scene> const scene;
59  MirPixelFormat const format;
60  std::mutex guard;
61  std::shared_ptr<detail::CursorRenderable> renderable;
62  bool visible;
63  geometry::Displacement hotspot;
64 };
65 
66 }
67 }
68 
69 #endif
All things Mir.
Definition: atomic_callback.h:25
Definition: point.h:30
Definition: cursor_image.h:30
Definition: cursor.h:33
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
Definition: displacement.h:32
Definition: software_cursor.h:40

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