2
* Copyright © 2013 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Alan Griffiths <alan@octopull.co.uk>
20
#ifndef MIR_GRAPHICS_GBM_GBM_CURSOR_H_
21
#define MIR_GRAPHICS_GBM_GBM_CURSOR_H_
23
#include "mir/graphics/cursor.h"
38
class KMSOutputContainer;
40
class KMSDisplayConfiguration;
43
class CurrentConfiguration
46
virtual ~CurrentConfiguration() = default;
48
virtual void with_current_configuration_do(
49
std::function<void(KMSDisplayConfiguration const&)> const& exec) = 0;
52
CurrentConfiguration() = default;
53
CurrentConfiguration(CurrentConfiguration const&) = delete;
54
CurrentConfiguration& operator=(CurrentConfiguration const&) = delete;
57
class GBMCursor : public Cursor
62
KMSOutputContainer& output_container,
63
std::shared_ptr<CurrentConfiguration> const& current_configuration);
65
~GBMCursor() noexcept;
67
void set_image(const void* raw_argb, geometry::Size size);
69
void move_to(geometry::Point position);
71
void show_at_last_known_position();
75
enum ForceCursorState { UpdateState, ForceState };
76
void for_each_used_output(std::function<void(KMSOutput&, geometry::Rectangle const&)> const& f);
77
void place_cursor_at(geometry::Point position, ForceCursorState force_state);
79
KMSOutputContainer& output_container;
80
geometry::Point current_position;
84
GBMBOWrapper(gbm_device* gbm);
89
GBMBOWrapper(GBMBOWrapper const&) = delete;
90
GBMBOWrapper& operator=(GBMBOWrapper const&) = delete;
93
std::shared_ptr<CurrentConfiguration> const current_configuration;
100
#endif /* MIR_GRAPHICS_GBM_GBM_CURSOR_H_ */