Another bug in the same vein. This bug presents as before, but in
fullscreen layout: start a fresh dvtm instance (only one window),
switch to fullscreen layout, create a new window, switch to the
previous window. The dimensions of the vt have not changed (TIOCSWINSZ
was not called). The height should have decreased by one line since
the top line is now used for the title. Switching to another layout
(tile) and back to fullscreen temporarily fixes this, but if you now
close one of the two windows, the remaining one should, but does not,
grow by one line in height since the title line no longer appears.

     -Mark
From 2a9e2ab8faf513be90c811743f3d9fce831ff101 Mon Sep 17 00:00:00 2001
From: Mark Edgar <medgar...@gmail.com>
Date: Tue, 17 Jun 2014 00:44:47 +0200
Subject: [PATCH 2/2] Resize the vt if its has_title_line has changed, even if
 its dimensions have not.

---
 dvtm.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/dvtm.c b/dvtm.c
index fc135b2..71ffccb 100644
--- a/dvtm.c
+++ b/dvtm.c
@@ -67,6 +67,7 @@ struct Client {
 	unsigned short int y;
 	unsigned short int w;
 	unsigned short int h;
+	bool has_title_line;
 	bool minimized;
 	bool died;
 	Client *next;
@@ -291,7 +292,7 @@ draw_border(Client *c) {
 
 static void
 draw_content(Client *c) {
-	vt_draw(c->term, c->window, show_border(), 0);
+	vt_draw(c->term, c->window, c->has_title_line, 0);
 }
 
 static void
@@ -462,16 +463,21 @@ move_client(Client *c, int x, int y) {
 
 static void
 resize_client(Client *c, int w, int h) {
-	if (c->w == w && c->h == h)
-		return;
-	debug("resizing, w: %d h: %d\n", w, h);
-	if (wresize(c->window, h, w) == ERR) {
-		eprint("error resizing, w: %d h: %d\n", w, h);
-	} else {
-		c->w = w;
-		c->h = h;
+	bool has_title_line = show_border();
+	bool resize_window = c->w != w || c->h != h;
+	if (resize_window) {
+		debug("resizing, w: %d h: %d\n", w, h);
+		if (wresize(c->window, h, w) == ERR) {
+			eprint("error resizing, w: %d h: %d\n", w, h);
+		} else {
+			c->w = w;
+			c->h = h;
+		}
+	}
+	if (resize_window || c->has_title_line != has_title_line) {
+		c->has_title_line = has_title_line;
+		vt_resize(c->term, h - has_title_line, w);
 	}
-	vt_resize(c->term, h - show_border(), w);
 }
 
 static void
@@ -736,7 +742,8 @@ create(const char *args[]) {
 		return;
 	}
 
-	if (!(c->term = vt_create(screen.h - show_border(), screen.w, screen.history))) {
+	c->has_title_line = show_border();
+	if (!(c->term = vt_create(screen.h - c->has_title_line, screen.w, screen.history))) {
 		delwin(c->window);
 		free(c);
 		return;
-- 
2.0.0

Reply via email to