1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include <wayland-client.h>
#include "util.h"
static void
registry_handle_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version);
static void
registry_handle_global_remove(void *data, struct wl_registry *registry,
uint32_t name);
static const struct wl_registry_listener
registry_listener = {
.global = registry_handle_global,
.global_remove = registry_handle_global_remove,
};
static void
registry_handle_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version)
{
plog(PLOG_INFO, "interface: %s, version: %d, name: %d", interface,
version, name);
}
static void
registry_handle_global_remove(void *data, struct wl_registry *registry,
uint32_t name)
{
plog(PLOG_INFO, "interface with name %d removed", name);
}
int main(void)
{
struct wl_display *display;
struct wl_registry *registry;
display = wl_display_connect(NULL);
if (!display) {
plog(PLOG_ERR, "Unable to connect to wayland display");
return 1;
}
plog(PLOG_INFO, "Running wayland display");
registry = wl_display_get_registry(display);
wl_registry_add_listener(registry, ®istry_listener, NULL);
wl_display_roundtrip(display);
wl_display_disconnect(display);
return 0;
}
|