Fix foot window shrink by sizing host window only once

This commit is contained in:
Andrew Hamilton 2026-08-06 12:22:22 +10:00
parent 5d08c7d342
commit 786f7904b5

View file

@ -163,6 +163,9 @@ struct tabbed_host {
void *shm_data;
size_t shm_size;
bool configured;
/* host window size has been set once from client content; further
client commits no longer resize the host (labwc drives it) */
bool client_sized;
int width, height;
/* EGL */
bool egl_ok;
@ -1852,17 +1855,21 @@ static void schedule_redraw(void) {
needs_redraw = true;
}
/* Resize the host (nested) window to fit active content, 1:1 (no scaling). */
/* Resize the host (nested) window to fit active content once, 1:1 (no
scaling). Afterwards the host window size is labwc-driven only; client
commits must not resize it (that caused a shrink loop with CSD clients
like foot, which render their buffer smaller than the configured size). */
static void fit_host_window(void) {
struct tabbed_surface *a = compositor.active_surface;
if (!a || !host.configured) return;
if (host.client_sized) return;
int bw = 0, bh = 0;
if (a->has_tex) { bw = a->tex_w; bh = a->tex_h; }
else if (a->pixels) { bw = a->pixel_width; bh = a->pixel_height; }
if (bw <= 0 || bh <= 0) return;
if (bw > MAX_WIN_W) bw = MAX_WIN_W;
if (bh > MAX_WIN_H) bh = MAX_WIN_H;
if (bw == host.width && bh == host.height) return;
host.client_sized = true;
host_resize(bw, bh);
}