From dc8f8644293b17f056edefa9e0e4a786686816a1 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 21 Apr 2023 14:58:55 +0200 Subject: add resize_drw instead of free and create --- swt.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'swt.c') diff --git a/swt.c b/swt.c index b16447d..2b5720c 100644 --- a/swt.c +++ b/swt.c @@ -275,6 +275,9 @@ draw_glyph(Glyph g, int x, int y) void wdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) { + if (IS_SET(MODE_HIDE)) + return; + draw_rect( win.canvas, borderpx + ox * win.fontcache->box.width, @@ -431,6 +434,7 @@ void wximspot(int, int) {} void buffer_release(void *data, struct wl_buffer *buffer) { + fprintf(stderr, "BUFFER RELEASE\n"); wl_buffer_destroy(buffer); } @@ -458,7 +462,7 @@ surface_configure(void *data, struct xdg_surface *surface, uint32_t serial) int first_configure = win.canvas == 0; xdg_surface_ack_configure(surface, serial); - if (first_configure) + if (first_configure); commit_surface(); } @@ -475,11 +479,12 @@ toplevel_configure(void *data, struct xdg_toplevel *toplevel, int32_t width, int win.height = height; } - if (win.canvas != 0) { - free_drw(win.canvas); + if (win.canvas == 0) { + win.canvas = create_drw(client.shm, win.width, win.height); + } else { + resize_drw(win.canvas, width, height); } - win.canvas = create_drw(client.shm, win.width, win.height); draw_frame(); win.tty.width = (win.width - 2 * borderpx) / win.fontcache->box.width; win.tty.height = (win.height - 2 * borderpx) / win.fontcache->box.height; @@ -521,6 +526,7 @@ registry_global(void *data, struct wl_registry *registry, uint32_t name, const c void registry_global_remove(void *data, struct wl_registry *registry, uint32_t name) { + fprintf(stderr, "REMOVE %i\n", name); /* TODO: Check if this is necessary */ } @@ -910,12 +916,14 @@ run() if (wl_display_flush(client.display) < 0) { if (errno == EAGAIN) continue; + die("wayland error:"); break; } if (poll(fds, sizeof(fds) / sizeof(*fds), -1) < 0) { if (errno == EAGAIN) continue; + die("poll error:"); break; } -- cgit v1.2.3-70-g09d2