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 <wayland-cursor.h>
32
#include <wayland-client-protocol.hpp>
33
#include <wayland-util.hpp>
34
35
namespace
wayland
36
{
37
class
cursor_image_t :
public
detail::basic_wrapper
<wl_cursor_image>
38
{
39
private
:
40
cursor_image_t(wl_cursor_image *image, std::shared_ptr<wl_cursor_theme> t);
41
friend
class
cursor_t;
42
// Extend lifetime of wl_cursor_theme
43
std::shared_ptr<wl_cursor_theme> cursor_theme;
44
45
public
:
46
cursor_image_t() =
default
;
47
uint32_t width()
const
;
48
uint32_t height()
const
;
49
uint32_t hotspot_x()
const
;
50
uint32_t hotspot_y()
const
;
51
uint32_t delay()
const
;
52
// buffer will be destroyed when cursor_theme is destroyed
53
buffer_t get_buffer()
const
;
54
};
55
56
class
cursor_t :
public
detail::basic_wrapper
<wl_cursor>
57
{
58
private
:
59
cursor_t(wl_cursor *c, std::shared_ptr<wl_cursor_theme> t);
60
friend
class
cursor_theme_t;
61
// Extend lifetime of wl_cursor_theme
62
std::shared_ptr<wl_cursor_theme> cursor_theme;
63
64
public
:
65
cursor_t() =
default
;
66
unsigned
int
image_count()
const
;
67
std::string name()
const
;
68
cursor_image_t image(
unsigned
int
n)
const
;
69
int
frame(uint32_t time)
const
;
70
};
71
72
class
cursor_theme_t :
public
detail::refcounted_wrapper
<wl_cursor_theme>
73
{
74
public
:
75
cursor_theme_t() =
default
;
76
cursor_theme_t(
const
std::string& name,
int
size,
const
shm_t& shm);
77
cursor_t get_cursor(
const
std::string& name)
const
;
78
};
79
}
80
81
#endif
wayland::detail::basic_wrapper
Non-refcounted wrapper for C objects.
Definition
wayland-util.hpp:74
wayland::detail::refcounted_wrapper
Refcounted wrapper for C objects.
Definition
wayland-util.hpp:153
include
wayland-cursor.hpp
Generated on
for Wayland++ by
1.17.0