-
Notifications
You must be signed in to change notification settings - Fork 2
/
WlResource.h
22 lines (19 loc) · 953 Bytes
/
WlResource.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once
#include <wayland-server-core.h>
class WlResource {
private:
struct wl_resource *fResource = NULL;
static void Destructor(struct wl_resource *resource);
static int Dispatcher(const void *impl, void *resource, uint32_t opcode, const struct wl_message *message, union wl_argument *args);
public:
virtual ~WlResource() = default;
bool Init(struct wl_client *wl_client, uint32_t version, uint32_t id);
void Destroy();
virtual const struct wl_interface *Interface() const = 0;
virtual int Dispatch(uint32_t opcode, const struct wl_message *message, union wl_argument *args);
static WlResource *FromResource(struct wl_resource *resource);
struct wl_resource *ToResource() const {return fResource;}
struct wl_client *Client() const {return wl_resource_get_client(fResource);}
uint32_t Id() const {return wl_resource_get_id(fResource);}
uint32_t Version() const {return wl_resource_get_version(fResource);}
};