Поддержка многопоточности

This commit is contained in:
2025-11-16 20:50:02 +03:00
parent eeb632ed0e
commit 6880efafab
9 changed files with 420 additions and 57 deletions

View File

@@ -6,7 +6,16 @@
/* Initialize registry listener on the given registry */
void registry_add_listener(struct wl_registry *registry);
/* Accessors for bound globals */
/* Prepare per-thread bindings for compositor/shm/xdg_wm_base */
int registry_thread_bind(struct wl_display *display, struct wl_event_queue *queue);
/* Release per-thread resources allocated by registry_thread_bind */
void registry_thread_unbind(void);
/* Reset global registry bookkeeping (used during teardown) */
void registry_reset_globals(void);
/* Accessors for bound globals (per-thread via registry_thread_bind) */
struct wl_compositor *registry_get_compositor(void);
struct wl_shm *registry_get_shm(void);
struct xdg_wm_base *registry_get_xdg_wm_base(void);

View File

@@ -0,0 +1,18 @@
#ifndef WAYLAND_RUNTIME_H
#define WAYLAND_RUNTIME_H
#include <stdint.h>
/* Initialize shared Wayland connection and prepare global data */
int32_t init_wayland(void);
/* Spawn a new window thread; returns slot index or negative on failure */
int32_t run_window(void);
/* Block until all window threads have exited */
void wait_for_windows(void);
/* Tear down window threads, input, and the shared Wayland connection */
void destroy_wayland(void);
#endif

View File

@@ -7,6 +7,7 @@
struct wayland_window {
struct wl_surface *wl_surface;
struct wl_buffer *buffer;
struct wl_callback *frame_callback;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
uint8_t *data;