mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 03:45:58 +01:00
43 lines
1.5 KiB
C
43 lines
1.5 KiB
C
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <wayland-client.h>
|
|
#include <wlr/util/log.h>
|
|
#include "backend/wayland.h"
|
|
|
|
static void registry_global(void *data, struct wl_registry *registry,
|
|
uint32_t name, const char *interface, uint32_t version) {
|
|
struct wlr_wl_backend *backend = data;
|
|
wlr_log(L_DEBUG, "Remote wayland global: %s v%d", interface, version);
|
|
|
|
if (strcmp(interface, wl_compositor_interface.name) == 0) {
|
|
backend->compositor = wl_registry_bind(registry, name,
|
|
&wl_compositor_interface, version);
|
|
} else if (strcmp(interface, wl_shell_interface.name) == 0) {
|
|
backend->shell = wl_registry_bind(registry, name,
|
|
&wl_shell_interface, version);
|
|
} else if (strcmp(interface, wl_shm_interface.name) == 0) {
|
|
backend->shm = wl_registry_bind(registry, name,
|
|
&wl_shm_interface, version);
|
|
} else if (strcmp(interface, wl_seat_interface.name) == 0) {
|
|
backend->seat = wl_registry_bind(registry, name,
|
|
&wl_seat_interface, version);
|
|
wl_seat_add_listener(backend->seat, &seat_listener, backend);
|
|
}
|
|
}
|
|
|
|
static void registry_global_remove(void *data, struct wl_registry *registry,
|
|
uint32_t name) {
|
|
// TODO
|
|
}
|
|
|
|
static const struct wl_registry_listener registry_listener = {
|
|
.global = registry_global,
|
|
.global_remove = registry_global_remove
|
|
};
|
|
|
|
void wlr_wl_registry_poll(struct wlr_wl_backend *backend) {
|
|
wl_registry_add_listener(backend->registry, ®istry_listener, backend);
|
|
wl_display_dispatch(backend->remote_display);
|
|
wl_display_roundtrip(backend->remote_display);
|
|
}
|