Crop CSD titlebar gutter instead of terminal bottom row

For clients (kitty/foot) that reserve a titlebar gutter above their
content but never paint it, that area showed as a dark bar while their
content sat low enough that the bottom row/cursor was pushed out the
output edge. Shift such clients up by the gutter so the dark bar is
cropped away instead of the terminal's bottom. Clients with no gutter
(geometry.y >= 0, e.g. the shm test client) are left untouched.
This commit is contained in:
Andrew Hamilton 2026-08-07 10:27:48 +10:00
parent b59840bc49
commit b7faf9ec91

View file

@ -439,14 +439,17 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
static void position_toplevel(struct tabbed_app *app) {
if (!app || !app->tree) return;
/* Place the client's surface so its geometry top-left lands at the
window origin. wlroots renders the xdg surface at the tree node
position without applying the geometry offset itself, so CSD clients
that report a negative geometry.y (a titlebar above the content)
must be shifted down by exactly that amount, and the content then
fills the output down to its bottom edge. */
/* CSD clients (foot/kitty) reserve a titlebar gutter above their
content, which we don't paint, so it shows as a dark bar and their
content sits too low (bottom row/cursor cropped). Shift them up by
that gutter so the dark bar is cropped instead of the terminal's
bottom. Clients with no gutter (geometry.y >= 0, e.g. wltest) are
left untouched. */
struct wlr_box geom = app->toplevel->base->geometry;
wlr_scene_node_set_position(&app->tree->node, -geom.x, -geom.y);
int y = -geom.y;
if (geom.y < 0)
y -= 26;
wlr_scene_node_set_position(&app->tree->node, -geom.x, y);
}
static void handle_toplevel_commit(struct wl_listener *listener, void *data) {