Wayland++
0.2.6
C++ Bindings for Wayland
|
Go to the documentation of this file.
26 #ifndef WAYLAND_CLIENT_HPP
27 #define WAYLAND_CLIENT_HPP
36 #include <wayland-version.hpp>
37 #include <wayland-client-core.h>
38 #include <wayland-util.hpp>
79 virtual ~events_base_t() { }
138 wl_proxy *proxy =
nullptr;
139 detail::proxy_data_t *data =
nullptr;
141 friend class detail::argument_t;
142 friend struct detail::proxy_data_t;
145 static int c_dispatcher(
const void *implementation,
void *target,
146 uint32_t opcode,
const wl_message *message,
150 proxy_t marshal_single(uint32_t opcode,
const wl_interface *interface,
151 std::vector<detail::argument_t> args, std::uint32_t version = 0);
155 const wl_interface *
interface = nullptr;
168 template <
typename...T>
169 void marshal(uint32_t opcode, T...args)
171 std::vector<detail::argument_t> v = { detail::argument_t(args)... };
172 marshal_single(opcode,
nullptr, v);
176 template <
typename...T>
177 proxy_t marshal_constructor(uint32_t opcode,
const wl_interface *interface,
180 std::vector<detail::argument_t> v = { detail::argument_t(args)... };
181 return marshal_single(opcode, interface, v);
185 template <
typename...T>
186 proxy_t marshal_constructor_versioned(uint32_t opcode,
const wl_interface *interface,
187 uint32_t version, T...args)
189 std::vector<detail::argument_t> v = { detail::argument_t(args)... };
190 return marshal_single(opcode, interface, v, version);
194 void set_destroy_opcode(uint32_t destroy_opcode);
201 void set_events(std::shared_ptr<detail::events_base_t> events,
202 int(*dispatcher)(uint32_t, std::vector<detail::any>, std::shared_ptr<detail::events_base_t>));
205 std::shared_ptr<detail::events_base_t> get_events();
210 struct construct_proxy_wrapper_tag {};
212 proxy_t(
const proxy_t &wrapped_proxy, construct_proxy_wrapper_tag );
227 proxy_t(
const proxy_t &p);
242 proxy_t(proxy_t &&p);
307 wl_proxy *
c_ptr()
const;
319 operator bool()
const;
390 read_intent(wl_display *display, wl_event_queue *event_queue =
nullptr);
396 wl_event_queue *event_queue =
nullptr;
397 bool finalized =
false;
722 std::tuple<int, bool>
flush();
745 operator wl_display*()
const;
753 #include <wayland-client-protocol.hpp>
Represents a connection to the compositor and acts as a proxy to the display singleton object.
read_intent obtain_read_intent()
Announce calling thread's intention to read events from the Wayland display file descriptor.
wrapper_type get_wrapper_type() const
Get the type of a proxy object.
std::tuple< int, bool > flush()
Send all buffered requests on the display to the server.
int dispatch()
Process incoming events.
registry_t get_registry()
get global registry object
uint32_t get_id() const
Get the id of a proxy object.
Refcounted wrapper for C objects.
int get_error() const
Retrieve the last error that occurred on a display.
void proxy_release()
Release the wrapped object (if any), making this an empty wrapper.
bool proxy_has_object() const
Check whether this wrapper actually wraps an object.
Represents an intention to read from the display file descriptor.
std::function< void(std::string)> log_handler
Type for functions that handle log messages.
callback_t sync()
asynchronous roundtrip
int roundtrip_queue(event_queue_t queue)
Block until all pending request are processed by the server.
read_intent obtain_queue_read_intent(event_queue_t queue)
Announce calling thread's intention to read events from the Wayland display file descriptor.
bool operator==(const proxy_t &right) const
Check whether two wrappers refer to the same object.
int dispatch_queue(event_queue_t queue)
Dispatch events in an event queue.
uint32_t get_version() const
Get the protocol object version of a proxy object.
void cancel()
Cancel read intent.
~display_t()
Close a connection to a Wayland display.
Represents a protocol object on the client side.
int dispatch_pending()
Dispatch main queue events without reading from the display fd.
display_t proxy_create_wrapper()
create proxy wrapper for this display
std::string get_class() const
Get the interface name (class) of a proxy object.
A queue for proxy_t object events.
wl_proxy * c_ptr() const
Get a pointer to the underlying C struct.
void read()
Read events from display file descriptor.
void set_log_handler(log_handler handler)
Set C library log handler.
event_queue_t create_queue()
Create a new event queue for this display.
proxy_t & operator=(const proxy_t &p)
Assignment operator.
bool operator!=(const proxy_t &right) const
Check whether two wrappers refer to different objects.
int roundtrip()
Block until all pending request are processed by the server.
int dispatch_queue_pending(event_queue_t queue)
Dispatch pending events in an event queue.
void set_queue(event_queue_t queue)
Assign a proxy to an event queue.
int get_fd()
Get a display context's file descriptor.
bool is_finalized() const
Check whether this intent was already finalized with cancel or read.