Go to the documentation of this file.
19 #ifndef MIRAL_WAYLAND_HELPERS_H
20 #define MIRAL_WAYLAND_HELPERS_H
22 #include <wayland-client.h>
26 #include <unordered_map>
28 template<
typename Type>
29 auto make_scoped(Type* owned,
void(*deleter)(Type*)) -> std::unique_ptr<Type, void(*)(Type*)>
31 return {owned, deleter};
34 wl_shm_pool*
make_shm_pool(
struct wl_shm* shm,
int size,
void **data);
41 std::function<
void(
Output const&)> on_constructed,
42 std::function<
void(
Output const&)> on_change);
56 static void output_done(
void* data, wl_output*
output);
58 static wl_output_listener
const output_listener;
60 std::function<void(
Output const&)> on_constructed;
61 std::function<void(
Output const&)> on_change;
68 std::function<
void(
Output const&)> on_new_output,
69 std::function<
void(
Output const&)> on_output_changed,
70 std::function<
void(
Output const&)> on_output_gone);
73 wl_shm*
shm =
nullptr;
77 void init(
struct wl_display* display);
81 static void new_global(
83 struct wl_registry* registry,
85 char const* interface,
88 static void global_remove(
90 struct wl_registry* registry,
93 wl_registry_listener
const registry_listener = {
98 std::unique_ptr<wl_registry, decltype(&wl_registry_destroy)> registry;
100 std::unordered_map<uint32_t, std::unique_ptr<Output>> bound_outputs;
102 std::function<void(
Output const&)>
const on_new_output;
103 std::function<void(
Output const&)>
const on_output_changed;
104 std::function<void(
Output const&)>
const on_output_gone;
107 #endif //MIRAL_WAYLAND_HELPERS_H
auto make_scoped(Type *owned, void(*deleter)(Type *)) -> std::unique_ptr< Type, void(*)(Type *)>
Definition: wayland_helpers.h:29
int32_t width
Definition: wayland_helpers.h:52
~Output()
Definition: wayland_helpers.cpp:169
int32_t y
Definition: wayland_helpers.h:51
wl_shm_pool * make_shm_pool(struct wl_shm *shm, int size, void **data)
Definition: wayland_helpers.cpp:31
Output(wl_output *output, std::function< void(Output const &)> on_constructed, std::function< void(Output const &)> on_change)
Definition: wayland_helpers.cpp:158
wl_compositor * compositor
Definition: wayland_helpers.h:72
int32_t height
Definition: wayland_helpers.h:52
int32_t transform
Definition: wayland_helpers.h:53
const char * name
Definition: client_types.h:177
Definition: wayland_helpers.h:64
void teardown()
Definition: wayland_helpers.cpp:254
wl_output * output
Definition: wayland_helpers.h:54
wl_shm * shm
Definition: wayland_helpers.h:73
Globals(std::function< void(Output const &)> on_new_output, std::function< void(Output const &)> on_output_changed, std::function< void(Output const &)> on_output_gone)
Definition: wayland_helpers.cpp:175
wl_shell * shell
Definition: wayland_helpers.h:75
int32_t x
Definition: wayland_helpers.h:51
Output & operator=(Output const &)=delete
Definition: wayland_helpers.h:36
wl_seat * seat
Definition: wayland_helpers.h:74
void init(struct wl_display *display)
Definition: wayland_helpers.cpp:245
Copyright © 2012-2019
Canonical Ltd.
Generated on Fri Dec 6 02:23:43 UTC 2019
This documentation is licensed under the GPL version 2 or 3.