You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
944 B
42 lines
944 B
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
#include <wayland-client.h>
|
|
|
|
#define ASSERT(cond, msg)\
|
|
if(!(cond)) {\
|
|
fprintf(stderr, "Runtime assertion %s at %s:%d failed: %s\n", #cond, __FILE__, __LINE__, msg);\
|
|
exit(-1);\
|
|
}
|
|
|
|
void handle_global(
|
|
void* data,
|
|
struct wl_registry* registry,
|
|
uint32_t name,
|
|
const char* interface,
|
|
uint32_t version) {
|
|
printf("v%d %s\n", version, interface);
|
|
}
|
|
|
|
void handle_global_remove(
|
|
void* data,
|
|
struct wl_registry* registry,
|
|
uint32_t name) {
|
|
// Who cares
|
|
}
|
|
|
|
const struct wl_registry_listener reg_callbacks = {
|
|
.global = handle_global,
|
|
.global_remove = handle_global_remove,
|
|
};
|
|
|
|
int main() {
|
|
struct wl_display* dpy = wl_display_connect(NULL);
|
|
ASSERT(dpy != NULL, "Unable to connect to Wayland");
|
|
|
|
struct wl_registry* registry = wl_display_get_registry(dpy);
|
|
wl_registry_add_listener(registry, ®_callbacks, NULL);
|
|
wl_display_roundtrip(dpy);
|
|
return 0;
|
|
}
|