Files
NASM/wayland/c.c

56 lines
1.5 KiB
C

#include <wayland-client.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
#include <xkbcommon/xkbcommon.h>
#include "xdg-shell-client-protocol.h"
#include "input.h"
#include "window.h"
#include "registry.h"
// core is now split into modules: registry, input and window
// resize, draw and frame callbacks moved to `window.c`
/* Input, window and registry logic has been moved into separate modules.
* This file now wires them together and runs the main loop. */
/* Window events moved to `window.c` */
/* frame callback now in `window.c` */
/* ping/pong moved to `window.c` */
// Функция для прослушивания глобальных объектов
/* registry listener moved to `registry.c` */
// No registry functions here; they are implemented in `registry.c`.
/* listeners implemented in modules */
int32_t run_wayland()
{
struct wl_display *display = wl_display_connect(0);
if (!display)
return -1;
struct wl_registry *registry = wl_display_get_registry(display);
registry_add_listener(registry);
wl_display_roundtrip(display);
struct wayland_window win;
if (window_init(display, &win) < 0)
return -1;
while (wl_display_dispatch(display))
{
if (window_should_close(&win))
{
printf("Window closing\n");
break;
}
}
window_destroy(&win);
input_cleanup();
wl_display_disconnect(display);
return 0;
}