From e467661baf3d035fb4726559abee52a0c8897ab0 Mon Sep 17 00:00:00 2001 From: nasr Date: Tue, 6 Oct 2026 23:32:02 +0200 Subject: feature: wayland connection --- source/loo/loo.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 source/loo/loo.cpp (limited to 'source/loo') diff --git a/source/loo/loo.cpp b/source/loo/loo.cpp new file mode 100644 index 0000000..e2de702 --- /dev/null +++ b/source/loo/loo.cpp @@ -0,0 +1,34 @@ +#include "base/base_include.h" + +ENTRYPOINT() +{ + MemArena *arena = ArenaCreate(MiB(100)); + Assert(arena); + +int fd = wayland_display_connect(arena); + + state_t state = {0}; + state.wl_registry = wayland_wl_display_get_registry(fd), + state.w = 117, + state.h = 150, + state.stride = 117 * color_channels, + state.shm_pool_size = state.h * state.stride; + + + while (1) { + char read_buf[4096] = ""; + int64_t read_bytes = recv(fd, read_buf, sizeof(read_buf), 0); + if (read_bytes == -1) + exit(errno); + + char *msg = read_buf; + uint64_t msg_len = (uint64_t)read_bytes; + + while (msg_len > 0) + wayland_handle_message(fd, &state, &msg, &msg_len); + } + + return 0; + + +} -- cgit v1.3.1