From 0d3efeda49df14117c5e5565026b4af6fbe077e2 Mon Sep 17 00:00:00 2001 From: Roman Pytkov Date: Sun, 16 Nov 2025 20:57:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=BE=D0=B3=D0=B8=20=D0=B7=D0=B0=D0=BA?= =?UTF-8?q?=D1=80=D1=8B=D1=82=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wayland/include/window.h | 5 +++-- wayland/src/c.c | 2 +- wayland/src/window.c | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wayland/include/window.h b/wayland/include/window.h index 0ef1b46..c22bc5e 100644 --- a/wayland/include/window.h +++ b/wayland/include/window.h @@ -5,14 +5,15 @@ /* Data for a single Wayland window (one surface) */ struct wayland_window { + int id; 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; - int16_t width; - int16_t height; + int32_t width; + int32_t height; int need_close; uint8_t color; }; diff --git a/wayland/src/c.c b/wayland/src/c.c index 1ce5fb1..9fd076f 100644 --- a/wayland/src/c.c +++ b/wayland/src/c.c @@ -80,7 +80,7 @@ static void *window_thread_main(void *arg) break; } } - printf("Window # closed"); + printf("Window #%d closed\n", slot->window.id); input_cleanup(); window_destroy(&slot->window); diff --git a/wayland/src/window.c b/wayland/src/window.c index 512207b..0514967 100644 --- a/wayland/src/window.c +++ b/wayland/src/window.c @@ -11,7 +11,6 @@ #include #include -// Moving all window specific data into `struct wayland_window`. static struct wl_callback_listener callback_listener; static struct xdg_surface_listener surface_listener; @@ -76,7 +75,7 @@ static void resize_canvas(struct wayland_window *win) 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) 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) { + static int id = 0; (void)display; struct wl_compositor *compositor = registry_get_compositor(); 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); /* initialize state */ + win->id = id++; win->width = 200; win->height = 100; win->data = NULL;