From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JqXIL-0003F1-8g for qemu-devel@nongnu.org; Mon, 28 Apr 2008 13:37:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JqXIJ-0003Cd-2v for qemu-devel@nongnu.org; Mon, 28 Apr 2008 13:37:40 -0400 Received: from [199.232.76.173] (port=36124 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JqXII-0003CN-Lf for qemu-devel@nongnu.org; Mon, 28 Apr 2008 13:37:38 -0400 Received: from tapir.sajinet.com.pe ([66.139.79.212]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JqXII-00022j-Ao for qemu-devel@nongnu.org; Mon, 28 Apr 2008 13:37:38 -0400 Date: Mon, 28 Apr 2008 12:56:31 -0500 From: Carlo Marcelo Arenas Belon Subject: Re: [Qemu-devel] [PATCH] ncurses: resize console if required Message-ID: <20080428175631.GC8787@tapir> References: <20080428035445.GA8787@tapir> <20080428085827.GA4537@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20080428085827.GA4537@implementation.uk.xensource.com> Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Mon, Apr 28, 2008 at 09:58:27AM +0100, Samuel Thibault wrote: > Hello, >=20 > Carlo Marcelo Arenas Belon, le Sun 27 Apr 2008 22:54:45 -0500, a =C3=A9= crit : > > The following patch instructs qemu to print an escape command to resi= ze the > > curses console to 80x25 if detected to have a different geometry (xte= rm and > > friends use 80x24 by default). >=20 > > + /* check size of console and try to adjust if needed */ > > + getmaxyx(stdscr, gheight, gwidth); > > + if ((gwidth !=3D 80) || (gheight !=3D 25)) { > > + printf("\033[8;25;80t"); > > + } >=20 > You can not just spit out escape sequences like this without know the > kind of terminal you're in, you know :) my original patch was checking the TERM variable for xterm or rxvt but si= nce CSI Window manipulation comes from dtterm I would expect most terminal emulators to support that, do you have one that does not? in the case of xterm with allowWindowOps =3D false the escape string gets= just ignored with no visible output, so expected the same from a terminal that doesn't support it, but since it seems all the terminals I have access to= do, wasn't able to test that. > At least check the TERM environment variable for those kind you know > support it. Also, this should probably go inside the curses_resize() > function, so that when the guest resizes to e.g. 80x50, the xterm windo= w > gets resized too. from my tests, while booting a linux guest, curses_resize will be called = with a 66 x 3 geometry at least once, and a first attempt to make the guest us= e a resized console of 80x50 didn't reflect correctly in the curses side eith= er so I settled for this different implementation as a starting point, and that solves the problem with default sized xterm used as a curses console. my intention with this patch was to propose a simple solution to this pro= blem and hopefully get someone else with more experience in curses and termina= l emulations intrigued enough to give it a more complete spin. Carlo