Логи закрытия

This commit is contained in:
2025-11-16 20:57:46 +03:00
parent 6880efafab
commit 0d3efeda49
3 changed files with 7 additions and 5 deletions

View File

@@ -5,14 +5,15 @@
/* Data for a single Wayland window (one surface) */ /* Data for a single Wayland window (one surface) */
struct wayland_window { struct wayland_window {
int id;
struct wl_surface *wl_surface; struct wl_surface *wl_surface;
struct wl_buffer *buffer; struct wl_buffer *buffer;
struct wl_callback *frame_callback; struct wl_callback *frame_callback;
struct xdg_surface *xdg_surface; struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel; struct xdg_toplevel *xdg_toplevel;
uint8_t *data; uint8_t *data;
int16_t width; int32_t width;
int16_t height; int32_t height;
int need_close; int need_close;
uint8_t color; uint8_t color;
}; };

View File

@@ -80,7 +80,7 @@ static void *window_thread_main(void *arg)
break; break;
} }
} }
printf("Window # closed"); printf("Window #%d closed\n", slot->window.id);
input_cleanup(); input_cleanup();
window_destroy(&slot->window); window_destroy(&slot->window);

View File

@@ -11,7 +11,6 @@
#include <string.h> #include <string.h>
#include <stdatomic.h> #include <stdatomic.h>
// Moving all window specific data into `struct wayland_window`.
static struct wl_callback_listener callback_listener; static struct wl_callback_listener callback_listener;
static struct xdg_surface_listener surface_listener; static struct xdg_surface_listener surface_listener;
@@ -76,7 +75,7 @@ static void resize_canvas(struct wayland_window *win)
win->data = map; win->data = map;
} }
static void resize_new(struct wayland_window *win, int16_t w, int16_t h) static void resize_new(struct wayland_window *win, int32_t w, int32_t h)
{ {
if (!w || !h) if (!w || !h)
return; return;
@@ -166,6 +165,7 @@ static void wm_base_ping(void *data, struct xdg_wm_base *wm_base, uint32_t seria
int window_init(struct wl_display *display, struct wayland_window *win) int window_init(struct wl_display *display, struct wayland_window *win)
{ {
static int id = 0;
(void)display; (void)display;
struct wl_compositor *compositor = registry_get_compositor(); struct wl_compositor *compositor = registry_get_compositor();
struct wl_shm *shm = registry_get_shm(); struct wl_shm *shm = registry_get_shm();
@@ -198,6 +198,7 @@ int window_init(struct wl_display *display, struct wayland_window *win)
xdg_wm_base_add_listener(wm, &wm_base_listener, win); xdg_wm_base_add_listener(wm, &wm_base_listener, win);
/* initialize state */ /* initialize state */
win->id = id++;
win->width = 200; win->width = 200;
win->height = 100; win->height = 100;
win->data = NULL; win->data = NULL;