aboutsummaryrefslogtreecommitdiff
path: root/swt.c
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-04-11 08:25:47 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2023-04-11 08:25:47 +0200
commit76440f53fd9529525e286224e11e918d1e05baf5 (patch)
treea5e85e3676110357c14651bc4a88198aabc9d1c4 /swt.c
parent411a4d703c178a312a41bd5e36a52b4ca6ccf6d0 (diff)
smoother resizing
Diffstat (limited to 'swt.c')
-rw-r--r--swt.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/swt.c b/swt.c
index fdc852d..b43b43d 100644
--- a/swt.c
+++ b/swt.c
@@ -347,19 +347,6 @@ surface_configure(void *data, struct xdg_surface *surface, uint32_t serial)
int ttywidth, ttyheight;
xdg_surface_ack_configure(surface, serial);
- if (win.geometry_changed || first_configure) {
- if (win.canvas != 0) {
- free_drw(win.canvas);
- }
- win.canvas = create_drw(client.shm, win.width, win.height);
- ttywidth = (win.width - 2 * borderpx) / win.fontcache->box.width;
- ttyheight = (win.height - 2 * borderpx) / win.fontcache->box.height;
- tresize(ttywidth, ttyheight);
- ttyresize(ttywidth, ttyheight);
- draw_frame();
- win.geometry_changed = 0;
- }
-
if (first_configure)
commit_surface();
}
@@ -368,15 +355,28 @@ surface_configure(void *data, struct xdg_surface *surface, uint32_t serial)
void
toplevel_configure(void *data, struct xdg_toplevel *toplevel, int32_t width, int32_t height, struct wl_array *clients)
{
- if (width != win.width && height != win.height)
- win.geometry_changed = 1;
+ int ttywidth, ttyheight;
+ if (win.canvas == 0 || width != win.width || height != win.height) {
+ if (width == 0 || height == 0) {
+ win.width = 800;
+ win.height = 600;
+ } else {
+ win.width = width;
+ win.height = height;
+ }
- if (width == 0 || height == 0) {
- win.width = 800;
- win.height = 600;
- } else {
- win.width = width;
- win.height = height;
+ if (win.canvas != 0) {
+ free_drw(win.canvas);
+ }
+
+ win.canvas = create_drw(client.shm, win.width, win.height);
+ ttywidth = (win.width - 2 * borderpx) / win.fontcache->box.width;
+ ttyheight = (win.height - 2 * borderpx) / win.fontcache->box.height;
+ ttywidth = MAX(ttywidth, 1);
+ ttyheight = MAX(ttyheight, 1);
+ tresize(ttywidth, ttyheight);
+ ttyresize(ttywidth, ttyheight);
+ draw_frame();
}
}