aboutsummaryrefslogtreecommitdiff
path: root/swt.c
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-04-21 14:58:55 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2023-04-21 14:58:55 +0200
commitdc8f8644293b17f056edefa9e0e4a786686816a1 (patch)
tree392b5a1769ee2bb8e18a57a006149b8d8d82e7d9 /swt.c
parenta46daccc110b6a43bf1dba928d7f1f1e72a14d81 (diff)
add resize_drw instead of free and create
Diffstat (limited to 'swt.c')
-rw-r--r--swt.c16
1 files changed, 12 insertions, 4 deletions
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;
}