Wayland++
1.0.1
C++ Bindings for Wayland
Toggle main menu visibility
Loading...
Searching...
No Matches
wayland-cursor.hpp
1
/*
2
* Copyright (c) 2014-2022, Nils Christopher Brause, Philipp Kerling
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* 1. Redistributions of source code must retain the above copyright notice, this
9
* list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
13
*
14
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
*/
25
26
#ifndef CURSOR_HPP
27
#define CURSOR_HPP
28
29
#include <memory>
30
#include <string>
31
#include <cstdint>
32
33
#include <wayland-cursor.h>
34
#include <wayland-client-protocol.hpp>
35
#include <wayland-util.hpp>
36
37
namespace
wayland
38
{
39
class
cursor_image_t :
public
detail::basic_wrapper
<wl_cursor_image>
40
{
41
private
:
42
cursor_image_t(wl_cursor_image *image, std::shared_ptr<wl_cursor_theme> t);
43
friend
class
cursor_t;
44
// Extend lifetime of wl_cursor_theme
45
std::shared_ptr<wl_cursor_theme> cursor_theme;
46
47
public
:
48
cursor_image_t() =
default
;
49
uint32_t width()
const
;
50
uint32_t height()
const
;
51
uint32_t hotspot_x()
const
;
52
uint32_t hotspot_y()
const
;
53
uint32_t delay()
const
;
54
// buffer will be destroyed when cursor_theme is destroyed
55
buffer_t get_buffer()
const
;
56
};
57
58
class
cursor_t :
public
detail::basic_wrapper
<wl_cursor>
59
{
60
private
:
61
cursor_t(wl_cursor *c, std::shared_ptr<wl_cursor_theme> t);
62
friend
class
cursor_theme_t;
63
// Extend lifetime of wl_cursor_theme
64
std::shared_ptr<wl_cursor_theme> cursor_theme;
65
66
public
:
67
cursor_t() =
default
;
68
unsigned
int
image_count()
const
;
69
std::string name()
const
;
70
cursor_image_t image(
unsigned
int
n)
const
;
71
int
frame(uint32_t time)
const
;
72
};
73
74
class
cursor_theme_t :
public
detail::refcounted_wrapper
<wl_cursor_theme>
75
{
76
public
:
77
cursor_theme_t() =
default
;
78
cursor_theme_t(
const
std::string& name,
int
size,
const
shm_t& shm);
79
cursor_t get_cursor(
const
std::string& name)
const
;
80
};
81
}
82
83
#endif
wayland::detail::basic_wrapper
Non-refcounted wrapper for C objects.
Definition
wayland-util.hpp:75
wayland::detail::refcounted_wrapper
Refcounted wrapper for C objects.
Definition
wayland-util.hpp:154
include
wayland-cursor.hpp
Generated on
for Wayland++ by
1.17.0